:root {
  /* Golden-ratio driven sizing */
  --g: 1.618;
  /* phi */
  --base: 10px;
  /* base unit */
  --size-1: calc(var(--base) * 1);
  /* 10 */
  --size-2: calc(var(--base) * var(--g));
  /* ~16.18 */
  --size-3: calc(var(--size-2) * var(--g));
  /* ~26 */
  --size-4: calc(var(--size-3) * var(--g));

  /* Pixel Chat Palette (Cyber Frost Super Dark Ice Blue Aesthetics) */
  --bg-deep: #04070D;
  /* Deep Black / Dark Navy */
  --bg-soft: #0B1220;
  /* Dark Ice Blue Panel */
  --panel: #0B1220;
  /* Dark Ice Blue Panel */
  --ink: #F1F5F9;
  /* Technical Ice White */
  --accent-gold: #00E5FF;
  /* Neon Ice Blue Accent */
  --pixel-red: #FF3B5C;
  /* Core Neon Red Alert */
  --jade: #00FF9D;
  /* Neon Mint Green */
  --lavender: #38BDF8;
  /* Sky Blue */
  --muted: #64748B;
  /* Muted Slate Grey */
  --danger: #FF3B5C;
  --glass: rgba(0, 229, 255, 0.05);
  --shadow: rgba(0, 0, 0, 0.8);
}

/* Layout tuned for small/Arduino-like displays, centered */
html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: var(--size-3);
  background: linear-gradient(180deg, var(--bg-deep), var(--bg-soft));
  color: var(--ink);
  font-family: 'Press Start 2P', monospace;
  image-rendering: pixelated;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-frame {
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  padding: calc(var(--size-2) + 6px);
  box-shadow: 0 8px 0 var(--shadow);
  background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, 0.01));
  border: 3px solid rgba(255, 255, 255, 0.02);
  position: relative;
}

.screen {
  padding: calc(var(--size-2) + 4px);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(0, 0, 0, 0.04));
}

.title {
  text-align: center;
  font-size: calc(var(--size-2) + 2px);
  margin: 4px 0 8px;
  color: var(--accent-gold);
  letter-spacing: 1px;
}

.subtitle {
  font-size: calc(var(--size-1));
  color: var(--muted);
  margin: 6px 0;
}

/* Controls sized by golden ratio for harmonious proportions */
input[type=text],
input[type=password] {
  width: 100%;
  padding: calc(var(--size-1) + 6px);
  background: transparent;
  border: 3px solid rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font-size: calc(var(--size-1) + 2px);
  box-sizing: border-box;
}

button,
.btn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.04));
  color: var(--ink);
  padding: calc(var(--size-1) + 6px) calc(var(--size-2) + 6px);
  border: 3px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-size: calc(var(--size-1) + 2px);
  display: inline-block;
}

button:active,
.btn:active {
  transform: translateY(1px);
}

.controls-row {
  display: flex;
  gap: 8px;
  margin-top: calc(var(--size-1));
  align-items: center;
  justify-content: center;
}

.small {
  font-size: calc(var(--size-1));
  padding: 6px 8px;
}

.list {
  margin: 8px 0;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  margin: 6px 0;
  border-radius: 6px;
  background: var(--glass);
  border: 2px solid rgba(255, 255, 255, 0.02);
}

.list-item a {
  color: var(--ink);
  text-decoration: none;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.online {
  background: var(--jade);
  box-shadow: 0 0 10px rgba(102, 178, 166, 0.22);
}

.offline {
  background: var(--danger);
}

.chat-box {
  height: 300px;
  overflow: auto;
  padding: 10px;
  background: linear-gradient(180deg, #f6f6f6, #e9e9e9);
  border: 4px solid var(--pixel-border);
  border-radius: 6px;
}

/* Message contrast: own messages dark blue with white text; others light with dark ink */
.message {
  margin-bottom: 10px;
  padding: 8px;
  background: #ffffff;
  color: var(--nes-ink);
  border: 4px solid var(--pixel-border);
  font-size: 12px;
  border-radius: 3px;
}

.message.mine {
  background: linear-gradient(180deg, #4aa3ff, #2d86ff);
  color: #ffffff;
  border-color: #0b2540;
}

.message .sender {
  color: inherit;
  font-weight: 700;
  margin-right: 6px;
  display: inline-block;
}

.message .time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.9);
  margin-left: 8px;
}

.message:not(.mine) .time {
  color: rgba(0, 0, 0, 0.45);
}

.message .text {
  display: block;
  margin-top: 6px;
  color: inherit;
}

/* Improve handling of long links inside messages */
.message .text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message .text .message-link {
  color: var(--nes-blue);
  text-decoration: underline;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: inline-block;
  max-width: 100%;
}

/* Optional: if you prefer single-line truncation instead of wrap, uncomment below
.message .text.single-line{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.message .text.single-line .message-link{ display:inline-block; max-width:100%; vertical-align:middle; }
*/

/* Pixel corners for retro feel */
.px-corner {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.03);
  position: absolute;
}

/* subtle wave motif (inspired by seigaiha pattern) using radial-gradients */
.wave-bg {
  background-image: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.01) 0 2px, transparent 3px), radial-gradient(circle at 60% 60%, rgba(255, 255, 255, 0.01) 0 2px, transparent 3px);
  background-size: 40px 40px;
}

/* Accessibility focus */
input:focus,
button:focus,
a:focus {
  outline: 3px solid rgba(155, 134, 194, 0.12);
  outline-offset: 2px;
}

/* Arduino/tiny view adjustments */
@media (max-width:420px) {
  .app-frame {
    padding: 10px;
  }

  .chat-box {
    height: 220px;
  }

  input[type=text] {
    font-size: 12px;
  }
}

/* decorative scanline overlay - disabled for clarity */
.scanlines::before {
  display: none !important;
}

/* helper classes */
.muted {
  color: var(--muted);
}

.accent {
  color: var(--lavender);
}

/* ---------------- NINTENDO-INSPIRED PIXEL THEME ---------------- */

/* New palette: high contrast, NES-like accents */
:root {
  --nes-bg: #0f0f16;
  --nes-panel: #e6e6e6;
  /* light panel for retro windows */
  --nes-dark: #2b2b2b;
  /* window titlebar */
  --nes-red: #d4001a;
  /* Nintendo red accent */
  --nes-green: #2ecc71;
  /* accent for online */
  --nes-blue: #4aa3ff;
  /* secondary accent */
  --nes-ink: #0b0b0b;
  /* dark ink for text */
  --pixel-border: #111;
}

/* Pixel-window base */
.window {
  background: var(--nes-panel);
  border: 6px solid var(--pixel-border);
  border-radius: 2px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: visible;
}

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nes-dark);
  color: var(--nes-panel);
  padding: 6px 8px;
  border-bottom: 4px solid var(--pixel-border);
  font-size: 12px;
}

.titlebar .left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.titlebar .icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  image-rendering: pixelated;
}

.titlebar .controls {
  display: flex;
  gap: 6px;
}

.titlebar .controls .title-btn {
  width: 22px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--pixel-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.06));
  color: var(--nes-panel);
  font-weight: 700;
  cursor: pointer;
}

.titlebar .controls .title-btn:hover {
  filter: brightness(1.12);
}

.window .content {
  padding: 10px;
  color: var(--nes-ink);
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  background: repeating-linear-gradient(transparent, transparent 6px, rgba(0, 0, 0, 0.02) 6px, rgba(0, 0, 0, 0.02) 7px);
}

/* Ensure inputs inside NES windows are readable (dark ink on white) */
.window .content input[type="text"],
.window .content input[type="password"],
.window .content textarea,
.window .content select {
  background: #fff;
  color: var(--nes-ink);
  border: 4px solid var(--pixel-border);
  padding: 6px;
  font-family: inherit;
  font-size: 12px;
  box-sizing: border-box;
}

.window .content input::placeholder,
.window .content textarea::placeholder {
  color: rgba(0, 0, 0, 0.45);
}

/* Minimize / Maximize behaviors */
.window.minimized .content {
  display: none;
}

.window.maximized {
  position: fixed !important;
  inset: 12px !important;
  width: auto !important;
  height: auto !important;
  z-index: 9999 !important;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  border-radius: 4px;
}

.window.transition {
  transition: all 160ms ease;
}

/* Pixel borders effect */
.pixel-border-outline {
  box-shadow: inset -6px -6px 0 rgba(0, 0, 0, 0.06), 6px 6px 0 rgba(0, 0, 0, 0.25);
}

/* Buttons: strong contrast, pixel-like */
.btn-primary {
  background: var(--nes-red);
  color: var(--nes-panel);
  border: 4px solid var(--pixel-border);
  padding: 8px 10px;
  display: inline-block;
  cursor: pointer;
  font-size: 12px;
}

.btn-secondary {
  background: var(--nes-blue);
  color: var(--nes-panel);
  border: 4px solid var(--pixel-border);
  padding: 6px 8px;
  font-size: 11px;
}

.btn-mini {
  padding: 4px 6px;
  font-size: 10px;
}

/* Push-to-Talk button */
.btn-ptt {
  margin-left: 6px;
  width: 42px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ff5a5a, #d4001a);
  color: var(--nes-panel);
  border: 4px solid var(--pixel-border);
  font-size: 16px;
  cursor: pointer;
  border-radius: 3px;
}

.btn-ptt:hover {
  filter: brightness(1.08);
}

.btn-ptt.recording {
  background: #ff4444;
  color: #fff;
  animation: pulse-red 1s infinite;
}

.btn-ptt.receiving {
  animation: pulse-green 1s infinite;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
  }
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(102, 178, 166, 0.7);
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(102, 178, 166, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(102, 178, 166, 0);
    transform: scale(1);
  }
}

/* List and contacts styled like cartridge items */
.cartridge {
  background: linear-gradient(180deg, #fff, #e9e9e9);
  border: 4px solid var(--pixel-border);
  padding: 8px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 3px solid rgba(0, 0, 0, 0.06);
  background: #fff;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 2px solid var(--pixel-border);
}

.online {
  background: var(--nes-green);
}

.offline {
  background: var(--nes-red);
}

/* Chat bubble retro */
.chat-bubble {
  background: #fff;
  border: 4px solid var(--pixel-border);
  padding: 6px;
  margin-bottom: 8px;
  display: inline-block;
  font-size: 11px;
}

/* Attachments styling */
.attachment {
  margin-top: 8px;
}

.attachment img {
  max-width: 220px;
  height: auto;
  display: block;
  border: 4px solid var(--pixel-border);
  background: #fff;
}

.attachment a {
  color: var(--nes-blue);
  text-decoration: none;
  border: 2px dashed rgba(0, 0, 0, 0.06);
  padding: 6px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Make images clearly tappable/clickable */
.attachment img {
  cursor: pointer;
}

.attachment a img {
  display: block;
}

/* Estilos para preview de archivos */
.att-preview,
.att-file {
  max-width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
}

.att-preview strong,
.att-file {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
  display: inline-block;
}

/* Para mensajes con archivos adjuntos */
.message .text a {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}

/* Small paperclip button for file input */
.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 4px solid var(--pixel-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.04));
  cursor: pointer;
  color: var(--nes-ink);
  font-size: 16px;
}

.file-btn:hover {
  filter: brightness(1.06);
}

/* Sending state visuals */
.message.sending {
  opacity: 0.85;
  font-style: italic;
  border-style: dashed;
}

.message.sending .spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-top-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  vertical-align: middle;
  margin-left: 6px;
  animation: spin 900ms linear infinite;
}

.message.error {
  background: #ffd6d6;
  color: #6b0000;
  border-color: #9b0000;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Modal viewer styles */
#img-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

#img-modal .modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

#img-modal .modal-content {
  position: relative;
  z-index: 2001;
  max-width: 90%;
  max-height: 90%;
  background: transparent;
  padding: 8px;
}

#img-modal #modal-body {
  max-height: calc(90vh - 60px);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#img-modal #modal-close {
  position: absolute;
  right: 8px;
  top: -8px;
  z-index: 2002;
  background: var(--nes-red);
  color: var(--nes-panel);
  border: 4px solid var(--pixel-border);
  cursor: pointer;
}

.modal-spinner {
  color: var(--nes-panel);
}

.modal-error {
  color: #ffd6d6;
}

/* Badge for view-once */
.badge.view-once {
  display: inline-block;
  background: #ffcf3f;
  color: #111;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  margin-left: 6px;
  font-weight: 700;
}

/* Small-screen adjustments */
@media (max-width:420px) {
  .titlebar {
    font-size: 10px;
    padding: 4px 6px;
  }

  .titlebar .icon {
    width: 12px;
    height: 12px;
  }

  .window {
    border-width: 4px;
  }
}

/* Mobile: Chat ocupa toda la pantalla */
@media (max-width:768px) {
  body {
    padding: 0;
    display: block;
    align-items: stretch;
  }

  .window {
    max-width: 100% !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
  }

  .window .content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px;
    overflow: hidden;
  }

  .chat-box {
    flex: 1 !important;
    height: auto !important;
    max-height: none !important;
    margin-bottom: 8px;
  }

  /* Formulario fijo en la parte inferior */
  #formulario,
  #public-form {
    flex-shrink: 0;
  }

  /* Botón de regresar más visible en móvil */
  .btn-secondary.btn-mini,
  .btn.small {
    padding: 8px 16px !important;
    font-size: 11px !important;
    display: inline-block;
    margin-top: 8px;
  }
}

/* Make sure old classes still usable */
.app-frame,
.screen {
  background: transparent;
  box-shadow: none;
  border: none;
}

/* ===== GLOBAL ANIMATED BACKGROUND ===== */

/* Animated background grid */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(74, 163, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 163, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridMove 20s linear infinite;
  z-index: 0;
  pointer-events: none;
}

@keyframes gridMove {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(40px, 40px);
  }
}

/* Floating pixels decoration */
.floating-pixels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.pixel {
  position: absolute;
  width: 8px;
  height: 8px;
  opacity: 0;
  animation: floatPixel 8s infinite;
}

.pixel:nth-child(1) {
  left: 10%;
  top: 20%;
  animation-delay: 0s;
  background: #d4001a;
}

.pixel:nth-child(2) {
  left: 20%;
  top: 80%;
  animation-delay: 1s;
  background: #4aa3ff;
}

.pixel:nth-child(3) {
  left: 80%;
  top: 30%;
  animation-delay: 2s;
  background: #2ecc71;
}

.pixel:nth-child(4) {
  left: 70%;
  top: 70%;
  animation-delay: 3s;
  background: #9b86c2;
}

.pixel:nth-child(5) {
  left: 90%;
  top: 50%;
  animation-delay: 4s;
  background: #d4001a;
}

.pixel:nth-child(6) {
  left: 5%;
  top: 60%;
  animation-delay: 5s;
  background: #66b2a6;
}

.pixel:nth-child(7) {
  left: 40%;
  top: 10%;
  animation-delay: 6s;
  background: #4aa3ff;
}

.pixel:nth-child(8) {
  left: 60%;
  top: 90%;
  animation-delay: 7s;
  background: #bfa98b;
}

@keyframes floatPixel {

  0%,
  100% {
    opacity: 0;
    transform: translateY(0) scale(1);
  }

  10% {
    opacity: 0.8;
  }

  50% {
    opacity: 0.6;
    transform: translateY(-100px) scale(1.5);
  }

  90% {
    opacity: 0.3;
  }
}

/* Decorative corners */
.corner {
  position: fixed;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(212, 0, 26, 0.3);
  z-index: 1;
  pointer-events: none;
}

.corner-tl {
  top: 20px;
  left: 20px;
  border-right: none;
  border-bottom: none;
}

.corner-tr {
  top: 20px;
  right: 20px;
  border-left: none;
  border-bottom: none;
}

.corner-bl {
  bottom: 20px;
  left: 20px;
  border-right: none;
  border-top: none;
}

.corner-br {
  bottom: 20px;
  right: 20px;
  border-left: none;
  border-top: none;
}

/* Ensure main content is above background */
.window,
.container,
.login-container {
  position: relative;
  z-index: 10;
}

/* Container styling for pages */
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  gap: 20px;
}

/* Title styling for main pages */
.container>.title {
  font-size: 24px;
  color: #fff;
  text-shadow:
    3px 3px 0 var(--nes-red),
    6px 6px 0 rgba(0, 0, 0, 0.5);
  letter-spacing: 2px;
  animation: glitchText 5s infinite;
}

@keyframes glitchText {

  0%,
  95%,
  100% {
    text-shadow: 3px 3px 0 var(--nes-red), 6px 6px 0 rgba(0, 0, 0, 0.5);
    transform: translate(0);
  }

  96% {
    text-shadow: -3px 3px 0 #4aa3ff, 6px 6px 0 rgba(0, 0, 0, 0.5);
    transform: translate(-2px, 0);
  }

  97% {
    text-shadow: 3px -3px 0 #2ecc71, 6px 6px 0 rgba(0, 0, 0, 0.5);
    transform: translate(2px, 0);
  }

  98% {
    text-shadow: 3px 3px 0 var(--nes-red), 6px 6px 0 rgba(0, 0, 0, 0.5);
    transform: translate(0);
  }
}

/* Enhanced window styling with glow */
.window {
  box-shadow:
    8px 8px 0 rgba(0, 0, 0, 0.4),
    0 0 30px rgba(212, 0, 26, 0.15);
}

/* Hide decorations on mobile for cleaner look */
@media (max-width: 768px) {

  .corner,
  .floating-pixels {
    display: none;
  }

  .bg-grid {
    opacity: 0.5;
  }
}

/* ---------------- DISCORD-STYLE COMMUNITY LAYOUT ---------------- */

.discord-layout {
  display: flex;
  height: 600px;
  background: var(--nes-panel);
  border: 4px solid var(--pixel-border);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.3);
  margin: 0 auto;
  overflow: hidden;
  font-family: inherit;
}

/* Common Sidebar Styles */
.sidebar {
  background: #f0f0f0;
  border-right: 4px solid var(--pixel-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 10px;
  font-size: 10px;
  background: var(--nes-dark);
  color: var(--nes-panel);
  border-bottom: 2px solid var(--pixel-border);
  text-align: center;
}

/* Channels Sidebar */
.sidebar-channels {
  width: 180px;
}

.channel-list {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}

/* Scrollbar styling for a cleaner look */
.channel-list::-webkit-scrollbar {
  width: 4px;
}

.channel-list::-webkit-scrollbar-track {
  background: transparent;
}

.channel-list::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

.channel-category {
  font-size: 9px;
  color: #888;
  margin: 12px 0 6px;
  text-transform: uppercase;
  font-weight: bold;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  margin: 2px 0;
  cursor: pointer;
  border-radius: 4px;
  font-size: 10px;
  color: #444;
  text-decoration: none;
  border: 2px solid transparent;
}

.channel-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--nes-ink);
}

.channel-item.active {
  background: var(--nes-blue);
  color: white;
  border-color: var(--nes-ink);
}

.channel-item .hash {
  color: #888;
  font-size: 12px;
}

.channel-item.active .hash {
  color: rgba(255, 255, 255, 0.8);
}

/* Member Sidebar */
.sidebar-members {
  width: 160px;
  border-left: 4px solid var(--pixel-border);
  border-right: none;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 10px;
}

/* Chat Main Area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  min-width: 0;
}

.chat-header {
  padding: 10px 15px;
  border-bottom: 2px solid #eee;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header .channel-name {
  font-weight: bold;
}

.chat-header .channel-desc {
  font-size: 9px;
  color: #888;
}

/* Discord-Style Message Layout (V2) */
.message-v2 {
  display: flex;
  gap: 12px;
  padding: 8px 15px;
  margin-bottom: 4px;
  font-family: inherit;
}

.message-v2:hover {
  background: rgba(0, 0, 0, 0.02);
}

.message-v2 .avatar-mini {
  width: 32px;
  height: 32px;
  background: var(--nes-blue);
  border: 2px solid var(--pixel-border);
  flex-shrink: 0;
  image-rendering: pixelated;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
}

.message-v2 .msg-body {
  flex: 1;
  min-width: 0;
}

.message-v2 .msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.message-v2 .msg-header .username {
  font-weight: bold;
  font-size: 11px;
}

.message-v2 .msg-header .timestamp {
  font-size: 9px;
  color: #999;
}

.message-v2 .msg-content {
  font-size: 11px;
  line-height: 1.4;
  color: #333;
  word-break: break-word;
}

/* Mobile responsive for community layout */
@media (max-width: 850px) {
  .discord-layout {
    height: 100vh;
    border: none;
    box-shadow: none;
    width: 100vw;
  }

  .sidebar-members {
    display: none;
  }
}

@media (max-width: 600px) {
  .sidebar-channels {
    width: 60px;
  }

  .sidebar-channels .channel-item span:not(.hash) {
    display: none;
  }

  .channel-category {
    display: none;
  }
}

/* ---------------- PREMIUM RETRO AUDIO PLAYER & WAVEFORM ---------------- */

.voice-message-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: #000;
  border: 3px solid var(--nes-red);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
  width: 280px;
  margin-top: 8px;
  position: relative;
}

.recorder-ui {
  display: flex;
  align-items: center;
  gap: 15px;
}

.waveform-canvas {
  width: 100%;
  height: 40px;
  background: #0a0a0a;
  border: 2px solid #222;
  image-rendering: pixelated;
}

.audio-player-v2 {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.play-pause-btn {
  width: 32px;
  height: 32px;
  background: var(--nes-red);
  border: 2px solid #000;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}

.play-pause-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}

.progress-bar-container {
  flex: 1;
  height: 12px;
  background: #1a1a1a;
  border: 2px solid #333;
  position: relative;
  cursor: pointer;
}

.progress-bar-fill {
  height: 100%;
  background: var(--nes-red);
  width: 0%;
  transition: width 0.1s linear;
}

.audio-time {
  font-size: 9px;
  color: var(--nes-red);
  font-family: 'Press Start 2P', monospace;
  min-width: 45px;
  text-align: right;
}

/* Transmission indicator / Radio Status */
.radio-status {
  font-size: 8px;
  color: #666;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.radio-status.transmitting {
  color: var(--nes-red);
}

.radio-status.receiving {
  color: var(--nes-green);
}

.radio-status .dot {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: blink 1s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.voice-btn.premium {
  width: 44px;
  height: 44px;
  font-size: 18px;
  box-shadow: 0 0 20px rgba(212, 0, 26, 0.4);
}

.voice-btn.premium.recording {
  background: #fff;
  color: var(--nes-red);
  border-color: var(--nes-red);
}

/* ---------------- MOBILE & UI CLARITY UPDATES ---------------- */

.btn-send {
  background: var(--nes-red) !important;
  color: #fff !important;
  border: none !important;
  padding: 0 20px !important;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px !important;
  height: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 4px 4px 0 !important;
  transition: filter 0.2s;
}

.btn-send:hover {
  filter: brightness(1.2);
}

@media (max-width: 600px) {
  .chat-footer {
    padding: 5px 10px 10px !important;
  }

  .input-wrapper {
    padding: 6px 8px !important;
    gap: 6px !important;
  }

  .input-wrapper input {
    font-size: 11px !important;
  }

  .btn-send {
    padding: 0 12px !important;
    font-size: 8px !important;
  }

  .voice-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
  }

  .recording-overlay {
    left: 45px !important;
    right: 45px !important;
    font-size: 9px !important;
  }
}

/* Ensure the window doesn't overflow on small screens */
.window {
  max-width: 100vw;
}

/* Voice Preview & Controls */
.voice-preview-container {
  display: none;
  align-items: center;
  gap: 10px;
  background: #000;
  padding: 8px 12px;
  border: 2px solid #d4001a;
  border-radius: 4px;
  margin-bottom: 8px;
  animation: slideUp 0.3s ease-out;
}

.voice-preview-container.active {
  display: flex;
}

@keyframes slideUp {
  from {
    transform: translateY(10px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.audio-preview-player {
  flex: 1;
  height: 30px;
  filter: invert(1) hue-rotate(180deg);
}

.voice-ctrl-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  padding: 5px;
  transition: transform 0.1s;
}

.voice-ctrl-btn:active {
  transform: scale(0.9);
}

.voice-ctrl-btn.delete {
  color: #ff5555;
}

.voice-ctrl-btn.send {
  color: #55ff55;
}

.view-once-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(212, 0, 26, 0.1);
  border: 1px solid #d4001a;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 9px;
  color: #d4001a;
  cursor: pointer;
  user-select: none;
}

.view-once-pill.active {
  background: #d4001a;
  color: #fff;
}

/* Emoji & Sticker Picker Styling */
.emoji-sticker-picker-container {
  position: fixed;
  width: 320px;
  max-width: 90vw;
  height: 320px;
  background: #0b0b0b;
  border: 3px solid #d4001a;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9), 0 0 15px rgba(212, 0, 26, 0.4);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Press Start 2P', monospace;
}

.emoji-picker-header {
  display: flex;
  background: #000;
  border-bottom: 2px solid #d4001a;
}

.emoji-tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: #888;
  font-size: 10px;
  cursor: pointer;
  text-align: center;
  font-weight: bold;
  font-family: inherit;
  transition: all 0.2s;
}

.emoji-tab-btn.active {
  color: #fff;
  background: #d4001a;
}

.emoji-picker-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.emoji-item {
  font-size: 22px;
  text-align: center;
  padding: 6px;
  cursor: pointer;
  border-radius: 4px;
  user-select: none;
  transition: transform 0.15s, background 0.15s;
}

.emoji-item:hover {
  background: rgba(212, 0, 26, 0.3);
  transform: scale(1.3);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sticker-card {
  background: #141414;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.sticker-card:hover {
  border-color: #d4001a;
  background: rgba(212, 0, 26, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 0, 26, 0.4);
}

.sticker-card .stk-icon {
  font-size: 38px;
}

.sticker-card .stk-label {
  font-size: 8px;
  color: #aaa;
  text-align: center;
}

/* Big Sticker Display inside Chat Messages */
.sticker-display {
  display: inline-block;
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px dashed #d4001a;
  border-radius: 8px;
  margin: 6px 0;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  animation: stickerPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sticker-icon {
  font-size: 56px;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 4px 10px rgba(212, 0, 26, 0.5));
}

@keyframes stickerPop {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== GLOBAL RESPONSIVE & LAYOUT CENTERING ENGINE ===== */
*, *::before, *::after {
  box-sizing: border-box !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

/* Container Centering Rules */
.login-container, .window, .frame, .chat-app-v2, .chat-app-container {
  width: 100% !important;
  max-width: 560px;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

@media (max-width: 768px) {
  body {
    padding: 8px !important;
    align-items: flex-start !important;
  }
  .login-container, .window, .frame, .chat-app-v2 {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
  .emoji-sticker-picker-container {
    width: 92vw !important;
    max-width: 380px !important;
    left: 4vw !important;
    bottom: 70px !important;
  }
}

@media (max-width: 480px) {
  body {
    padding: 4px !important;
  }
  .main-title {
    font-size: 20px !important;
    letter-spacing: 1px !important;
  }
  .logo-img {
    width: 130px !important;
    height: 130px !important;
  }
  .input-bar-v2 {
    gap: 4px !important;
    padding: 6px !important;
  }
  .btn-login, .btn-send {
    padding: 10px 16px !important;
    font-size: 11px !important;
  }
  .sticker-card .stk-icon {
    font-size: 30px !important;
  }
  .sticker-icon {
    font-size: 42px !important;
  }
}

/* ==========================================================================
   PIXELCHAT CYBER FROST - SUPER DARK ICE BLUE INTERFACE
   ========================================================================== */

:root {
  --tactical-bg: #04070D;
  --tactical-panel: #0B1220;
  --tactical-amber: #00E5FF; /* Ice Blue Accent */
  --tactical-amber-glow: rgba(0, 229, 255, 0.25);
  --tactical-green: #00FF9D; /* Neon Mint */
  --tactical-red: #FF3B5C;   /* Neon Red-Pink Alert */
  --tactical-steel: #1E293B;
  --tactical-muted: #64748B;
  --tactical-border: rgba(0, 229, 255, 0.35);
  --tactical-font: 'Share Tech Mono', 'Press Start 2P', monospace;
  --ice-blue: #00E5FF;
  --ice-blue-deep: #0284C7;
  --ice-bg-dark: #04070D;
  --ice-card: #0B1220;
  --ice-card-header: #111A2E;
}

body {
  background-color: #04070D !important;
  background-image: 
    linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px) !important;
  background-size: 32px 32px !important;
  color: #F1F5F9 !important;
  font-family: var(--tactical-font), monospace !important;
  letter-spacing: 0.5px;
}

body::before {
  display: none !important;
}

/* Ice Blue Glass Windows & Cards */
.window, .app-frame, .login-container, .frame {
  background: #0B1220 !important;
  border: 1px solid rgba(0, 229, 255, 0.35) !important;
  border-radius: 8px !important;
  box-shadow: 0 0 25px rgba(0, 229, 255, 0.12), inset 0 0 15px rgba(0, 0, 0, 0.8) !important;
  position: relative;
}

.titlebar, .sec-header, .sidebar-header, .chat-header {
  background: #111A2E !important;
  border-bottom: 1px solid rgba(0, 229, 255, 0.3) !important;
  border-radius: 8px 8px 0 0 !important;
  color: #00E5FF !important;
  font-family: var(--tactical-font), monospace !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  padding: 10px 14px !important;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

/* Status Ticker */
.tactical-status-ticker {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #070C16 !important;
  border-bottom: 1px solid #1E293B !important;
  padding: 6px 12px !important;
  font-size: 10px !important;
  color: #64748B !important;
  font-weight: bold !important;
}

.tactical-status-ticker .status-active {
  color: #00E5FF !important;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}

.tactical-status-ticker .status-alert {
  color: #FF3B5C !important;
  text-shadow: 0 0 8px rgba(255, 59, 92, 0.5);
}

/* Chat Messages */
.chat-box {
  background: #04070D !important;
  border: 1px solid #1E293B !important;
  border-radius: 6px !important;
  font-family: var(--tactical-font), monospace !important;
}

.chat-bubble, .message {
  background: #0F172A !important;
  border: 1px solid #1E293B !important;
  border-left: 3px solid #00E5FF !important;
  border-radius: 6px !important;
  color: #F1F5F9 !important;
  margin-bottom: 8px !important;
  padding: 10px 14px !important;
  font-size: 12px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.message.mine {
  background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%) !important;
  border-color: #38BDF8 !important;
  border-left: 3px solid #7DD3FC !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 15px rgba(2, 132, 199, 0.3) !important;
}

.message .sender {
  color: #00E5FF !important;
  font-weight: bold !important;
  text-transform: uppercase !important;
  letter-spacing: 1px;
}

.message.mine .sender {
  color: #7DD3FC !important;
}

.message .time {
  color: #64748B !important;
  font-size: 9px !important;
}

.message.mine .time {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Form Inputs */
input[type="text"], input[type="password"], textarea {
  background: #070C16 !important;
  border: 1px solid #1E293B !important;
  border-radius: 6px !important;
  color: #F1F5F9 !important;
  font-family: var(--tactical-font), monospace !important;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5) !important;
  transition: all 0.2s ease !important;
}

input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
  border-color: #00E5FF !important;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3), inset 0 0 5px rgba(0, 229, 255, 0.1) !important;
  outline: none !important;
}

input::placeholder {
  color: #475569 !important;
}

/* Ice Blue Glow Buttons */
button, .btn, .btn-primary, .btn-send, .btn-login {
  background: #0F172A !important;
  border: 1px solid #00E5FF !important;
  border-radius: 6px !important;
  color: #00E5FF !important;
  font-family: var(--tactical-font), monospace !important;
  font-weight: bold !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  cursor: pointer !important;
  transition: all 0.2s ease-in-out !important;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.15) !important;
}

button:hover, .btn:hover, .btn-primary:hover, .btn-send:hover, .btn-login:hover {
  background: #00E5FF !important;
  color: #04070D !important;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.5) !important;
  transform: translateY(-1px) !important;
}

button:active, .btn:active, .btn-primary:active, .btn-send:active, .btn-login:active {
  transform: translateY(1px) !important;
  box-shadow: 0 0 5px rgba(0, 229, 255, 0.3) !important;
}

.btn-ptt {
  border-radius: 6px !important;
  background: #070C16 !important;
  border: 1px solid #00E5FF !important;
  color: #00E5FF !important;
}

.btn-ptt.recording {
  background: #FF3B5C !important;
  color: #FFFFFF !important;
  border-color: #FF3B5C !important;
  box-shadow: 0 0 20px rgba(255, 59, 92, 0.6) !important;
}

/* Command Console Overlay */
#tactical-console-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(4, 7, 13, 0.9);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.tactical-console-window {
  width: 100%;
  max-width: 680px;
  height: 480px;
  background: #0B1220;
  border: 1px solid #00E5FF;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.3);
  display: flex;
  flex-direction: column;
}

.tactical-header {
  background: #111A2E;
  color: #00E5FF;
  padding: 10px 14px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.3);
}

.tactical-output {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.5;
  background: #04070D;
  color: #F1F5F9;
}

.tc-system { color: #00E5FF; font-weight: bold; }
.tc-cmd { color: #38BDF8; font-weight: bold; }
.tc-info { color: #7DD3FC; }
.tc-success { color: #00FF9D; font-weight: bold; }
.tc-warn { color: #FF3B5C; font-weight: bold; }

.tactical-input-line {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #070C16;
  border-top: 1px solid #1E293B;
}

.tc-prompt {
  color: #00E5FF;
  font-weight: bold;
  margin-right: 8px;
  font-size: 12px;
}

#tactical-cmd-input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #F1F5F9 !important;
  font-size: 12px !important;
  box-shadow: none !important;
}

@media (max-width: 600px) {
  button, .btn, .btn-small, input[type="text"], input[type="password"], textarea, .act-card, .contact-item {
    min-height: 44px !important;
    touch-action: manipulation;
    font-size: 12px !important;
  }
}