/* ══════════════════════════════════════════════════════════
   RVN-2089 · Terminal CRT · Diseño Retro-Hardware
   ══════════════════════════════════════════════════════════ */

/* ── Reset & Fonts ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --phosphor:       #00ff66;
  --phosphor-dim:   #00cc44;
  --phosphor-faint: #008833;
  --phosphor-bg:    #010901;
  --chassis-dark:   #5e5952;
  --chassis-mid:    #8a847a;
  --chassis-light:  #c8c2b6;
  --bezel:          #3a3834;
  --btn-face:       #7a746c;
  --btn-edge:       #3e3a34;
  --rust:           #8a4b2a;
  --red-led:        #ff2200;
  --amber:          #ffaa00;
  --font-mono: 'Share Tech Mono', 'Courier New', Courier, monospace;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #3a3834;
  color: var(--phosphor);
  font-family: var(--font-mono);
}

/* ── Fondo del sistema ── */
.rvn-bg {
  height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background:
    radial-gradient(ellipse 90% 70% at 50% 40%, #b7b1a4 0%, #6e6860 55%, #3a3834 100%);
  padding: 0;
  overflow: hidden;
}

/* ══════════════════════════════════
   CHASIS
   ══════════════════════════════════ */
.chassis {
  width: 100%;
  max-width: none;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(165deg, #d5d0c6 0%, #a8a299 22%, #7c776f 48%, #6a655e 62%, #8f8a82 100%);
  border: 0;
  border-radius: 0;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  box-shadow:
    0 18px 40px rgba(30, 24, 18, 0.45),
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -10px 18px rgba(90, 50, 24, 0.18);
  position: relative;
}
.chassis > * { position: relative; z-index: 1; }
.chassis::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(circle at 8% 86%, rgba(90, 70, 40, 0.22), transparent 26%),
    radial-gradient(circle at 92% 14%, rgba(60, 55, 48, 0.28), transparent 22%),
    radial-gradient(circle at 70% 90%, rgba(40, 38, 34, 0.2), transparent 20%);
  mix-blend-mode: multiply;
}

/* Tornillos en esquinas */
.screw {
  position: absolute;
  width: 12px; height: 12px;
  background: radial-gradient(circle at 35% 35%, #d9d3c6, #6a6458 55%, #3a342c);
  border-radius: 50%;
  border: 1px solid #2e2a26;
  display: flex; align-items: center; justify-content: center;
  font-size: 7px; color: #3a342c; line-height: 1;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.05);
}
.screw-tl { top: 8px;  left: 8px;  }
.screw-tr { top: 8px;  right: 8px; }
.screw-bl { bottom: 8px; left: 8px; }
.screw-br { bottom: 8px; right: 8px; }

/* ── Cabecera del chasis ── */
.chassis-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 8px;
  font-size: 0.62rem;
  letter-spacing: 2px;
  color: #3a342c;
}
.chassis-brand {
  flex: 1;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 3px;
  color: #2c2824;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
}
.signal-bars {
  display: flex; gap: 2px; align-items: flex-end;
}
.signal-bars span {
  width: 4px; background: var(--phosphor-faint);
  border-radius: 1px;
  opacity: 0.4;
  transition: opacity 0.3s, background 0.3s;
}
.signal-bars span.active { opacity: 1; background: var(--phosphor); }
.signal-bars span:nth-child(1) { height: 6px; }
.signal-bars span:nth-child(2) { height: 10px; }
.signal-bars span:nth-child(3) { height: 14px; }
.signal-bars span:nth-child(4) { height: 18px; }

/* LED de encendido */
.power-led {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #220000;
  border: 1px solid #330000;
  transition: all 0.4s;
  flex-shrink: 0;
}
.power-led.on {
  background: var(--red-led);
  box-shadow: 0 0 4px var(--red-led), 0 0 12px rgba(255,34,0,0.7);
  border-color: #ff4400;
}
.power-led.on.alert {
  animation: led-double 1s infinite;
}
@keyframes led-double {
  0%, 8% { opacity: 1; box-shadow: 0 0 8px #ff2200, 0 0 16px rgba(255,34,0,.8); }
  12%, 20% { opacity: 0.15; box-shadow: none; }
  24%, 32% { opacity: 1; box-shadow: 0 0 8px #ff2200, 0 0 16px rgba(255,34,0,.8); }
  40%, 100% { opacity: 0.15; box-shadow: none; }
}
.power-led.green {
  background: var(--phosphor);
  box-shadow: 0 0 4px var(--phosphor), 0 0 12px rgba(0,255,102,0.7);
  border-color: #66ffaa;
}

/* ══════════════════════════════════
   BISEL Y PANTALLA CRT
   ══════════════════════════════════ */
.crt-bezel {
  flex: 1;
  min-height: 0;
  display: flex;
  background: linear-gradient(145deg, #2a241c, #12100c 40%, #3a3024);
  border: 3px solid #1a1612;
  border-radius: 12px;
  padding: 10px;
  box-shadow:
    inset 3px 3px 8px rgba(0,0,0,0.9),
    inset -1px -1px 4px rgba(80,40,10,0.25);
  margin: 0 0 8px;
}

.crt-screen {
  position: relative;
  background: var(--phosphor-bg);
  border-radius: 7px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  width: 100%;
  /* Resplandor del fósforo */
  box-shadow:
    0 0 0 1px rgba(0,255,102,0.08),
    inset 0 0 24px rgba(0,255,102,0.06),
    inset 0 0 60px rgba(0,0,0,0.6);
}

/* Scanlines */
.crt-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0)   0px, rgba(0,0,0,0)   2px,
    rgba(0,0,0,0.18) 2px, rgba(0,0,0,0.18) 4px
  );
  pointer-events: none;
  z-index: 20;
  border-radius: 7px;
}

/* Viñeta (curvatura de vidrio CRT) */
.crt-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 90% 80% at 50% 50%,
    transparent 55%, rgba(0,0,0,0.55) 100%
  );
  pointer-events: none;
  z-index: 21;
  border-radius: 7px;
}

/* Capa de glitch ocasional */
.crt-glitch-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 19;
  opacity: 0;
  animation: crt-glitch-burst 12s infinite;
}
@keyframes crt-glitch-burst {
  0%,94%,100% { opacity: 0; transform: none; background: none; }
  95% {
    opacity: 1;
    transform: translateX(-2px) skewX(-0.3deg);
    background: rgba(0,255,102,0.03);
  }
  96% {
    transform: translateX(3px);
    background: rgba(0,255,102,0.02);
    clip-path: inset(8% 0 85% 0);
  }
  97% { transform: translateX(-1px); clip-path: none; }
  98% { transform: translateX(1px) skewX(0.5deg); clip-path: inset(50% 0 40% 0); }
  99% { transform: none; clip-path: none; opacity: 0.5; }
}

/* Parpadeo del fósforo */
@keyframes phosphor-flicker {
  0%,100% { opacity: 1; }
  30%     { opacity: 0.98; }
  60%     { opacity: 0.995; }
  80%     { opacity: 0.97; }
}

/* ── Contenido de la pantalla ── */
.screen-content {
  position: relative;
  z-index: 10;
  padding: 28px 14px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--phosphor);
  height: 100%;
  min-height: 0;
  animation: phosphor-flicker 3s ease-in-out infinite;
}
.crt-grime {
  position: absolute;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  border-radius: 7px;
  background:
    radial-gradient(circle at 18% 22%, rgba(90, 70, 30, 0.28), transparent 16%),
    radial-gradient(circle at 78% 70%, rgba(40, 28, 10, 0.45), transparent 22%),
    radial-gradient(circle at 60% 18%, rgba(20, 16, 8, 0.35), transparent 12%),
    repeating-linear-gradient(115deg, transparent 0 14px, rgba(0,0,0,0.05) 14px 15px);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.45);
  mix-blend-mode: multiply;
}
.crt-screen .signal-bars {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 12;
}
.crt-screen .mic-led {
  position: absolute;
  top: 6px;
  left: 10px;
  z-index: 12;
}
.news-ticker {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  z-index: 24;
  padding: 4px 7px 5px;
  background: rgba(0, 12, 0, 0.88);
  border: 1px solid rgba(0, 255, 102, 0.35);
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.15);
}
.news-ticker[hidden] { display: none; }
.news-ticker-kicker,
.news-extra-kicker {
  font-size: 0.52rem;
  letter-spacing: 1px;
  color: #99ffbb;
  margin-bottom: 2px;
}
.news-ticker-mask { overflow: hidden; }
.news-ticker-track {
  display: block;
  font-size: 0.58rem;
  line-height: 1.28;
  color: #33ff66;
  text-shadow: 0 0 6px rgba(0, 255, 102, 0.45);
  white-space: normal;
}
.crt-screen.ticker-live .screen-content { padding-bottom: 62px; }
.news-extra {
  flex: 0 0 auto;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(0, 255, 102, 0.28);
  font-size: 0.58rem;
  line-height: 1.28;
  color: #99ffbb;
}
.transcribing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 2px;
  text-align: center;
}
.transcribe-wait {
  letter-spacing: 1px;
  line-height: 1.45;
  max-width: 16rem;
}

.screen-content.copy-mode {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  padding-bottom: 12px;
}
.copy-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 0.78rem;
  color: var(--phosphor);
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
.screen-content h2 {
  font-size: 0.68rem;
  letter-spacing: 3px;
  color: var(--phosphor-dim);
  border-bottom: 1px solid rgba(0,255,102,0.2);
  padding-bottom: 4px;
  margin-bottom: 10px;
  text-shadow: 0 0 8px var(--phosphor-dim);
}

.phosphor {
  color: var(--phosphor);
  text-shadow:
    0 0 4px var(--phosphor),
    0 0 10px rgba(0,255,102,0.7),
    0 0 20px rgba(0,255,102,0.3);
}
.phosphor-dim {
  color: var(--phosphor-dim);
  text-shadow: 0 0 6px var(--phosphor-dim);
}
.phosphor-faint { color: var(--phosphor-faint); }

/* Cursor parpadeante */
.blink-cursor::after {
  content: '█';
  animation: blink 1s step-end infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* Typing animation */
.typing-line { overflow: hidden; white-space: nowrap; }

/* Separador */
.screen-divider {
  border: none;
  border-top: 1px solid rgba(0,255,102,0.15);
  margin: 8px 0;
}

/* ── Bloques de info ── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  font-size: 0.72rem;
}
.info-label { color: var(--phosphor-faint); }
.info-value { color: var(--phosphor); text-shadow: 0 0 6px var(--phosphor); }

/* ══════════════════════════════════
   MODOS ESPECÍFICOS
   ══════════════════════════════════ */

/* ── Radio ── */
.freq-display {
  text-align: center;
  margin: 10px 0;
}
.freq-number {
  font-size: 2.4rem;
  color: var(--phosphor);
  text-shadow:
    0 0 10px var(--phosphor),
    0 0 30px rgba(0,255,102,0.5),
    0 0 60px rgba(0,255,102,0.2);
  letter-spacing: 4px;
  display: inline-block;
  animation: freq-pulse 4s ease-in-out infinite;
}
@keyframes freq-pulse {
  0%,100% { text-shadow: 0 0 10px var(--phosphor), 0 0 30px rgba(0,255,102,0.5); }
  50%     { text-shadow: 0 0 14px var(--phosphor), 0 0 40px rgba(0,255,102,0.7), 0 0 80px rgba(0,255,102,0.3); }
}
.freq-unit { font-size: 0.75rem; color: var(--phosphor-dim); margin-left: 4px; }

.signal-meter {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 30px;
  margin: 6px 0;
}
.signal-meter .bar {
  flex: 1;
  background: var(--phosphor-faint);
  border-radius: 2px;
  opacity: 0.3;
  transition: height 0.15s, opacity 0.15s;
  min-height: 3px;
}
.signal-meter .bar.active {
  background: var(--phosphor);
  opacity: 1;
  box-shadow: 0 0 6px var(--phosphor);
}

.static-text {
  font-size: 0.65rem;
  color: var(--phosphor-faint);
  letter-spacing: 1px;
  min-height: 20px;
  overflow: hidden;
}

/* ── Morse ── */
.morse-display {
  text-align: center;
  padding: 10px 0;
}
.morse-symbol {
  font-size: 1.8rem;
  letter-spacing: 4px;
  color: var(--phosphor);
  text-shadow: 0 0 12px var(--phosphor), 0 0 30px rgba(0,255,102,0.5);
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.morse-dot  { width: 10px; height: 10px; border-radius: 50%; background: var(--phosphor); box-shadow: 0 0 8px var(--phosphor); }
.morse-dash { width: 30px; height: 10px; border-radius: 4px; background: var(--phosphor); box-shadow: 0 0 8px var(--phosphor); }
.morse-decoded {
  font-size: 1.4rem;
  color: var(--phosphor);
  text-shadow: 0 0 10px var(--phosphor);
  letter-spacing: 3px;
  margin-top: 8px;
  min-height: 30px;
}
.morse-progress {
  height: 3px;
  background: rgba(0,255,102,0.1);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.morse-progress-bar {
  height: 100%;
  background: var(--phosphor);
  box-shadow: 0 0 6px var(--phosphor);
  transition: width 0.1s linear;
}

/* ── Osciloscopio ── */
.scope-canvas {
  width: 100%;
  height: 100px;
  display: block;
  border: 1px solid rgba(0,255,102,0.15);
  border-radius: 4px;
  background: rgba(0,255,102,0.02);
  margin: 8px 0;
}
.scope-stats {
  display: flex;
  gap: 12px;
  font-size: 0.68rem;
  color: var(--phosphor-dim);
  margin-top: 4px;
}

/* ── Teclado / Comandos ── */
.terminal-log {
  height: 100px;
  overflow-y: auto;
  font-size: 0.68rem;
  color: var(--phosphor-dim);
  margin-bottom: 6px;
  scrollbar-width: none;
}
.terminal-log::-webkit-scrollbar { display: none; }
.terminal-log .log-entry { line-height: 1.6; }
.terminal-log .log-entry.sent  { color: var(--phosphor); }
.terminal-log .log-entry.recv  { color: var(--phosphor-dim); }
.terminal-log .log-entry.error { color: #ff5544; text-shadow: 0 0 6px #ff4433; }
.terminal-log .log-entry.ok    { color: #66ffaa; }

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid rgba(0,255,102,0.2);
  padding-top: 6px;
}
.terminal-prompt {
  color: var(--phosphor-dim);
  font-size: 0.7rem;
  white-space: nowrap;
}
.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--phosphor);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  caret-color: var(--phosphor);
  text-shadow: 0 0 6px var(--phosphor);
}

/* Pad numérico DTMF */
.dtmf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.dtmf-key {
  aspect-ratio: 1;
  background: linear-gradient(145deg, #1e1a14, #141008);
  border: 1px solid var(--btn-edge);
  border-radius: 6px;
  color: var(--phosphor-dim);
  font-family: var(--font-mono);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    2px 2px 4px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.04);
  transition: all 0.08s;
  text-shadow: 0 0 6px var(--phosphor-faint);
}
.dtmf-key:active, .dtmf-key.pressed {
  transform: translateY(1px);
  box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  background: linear-gradient(145deg, #0a1008, #050804);
  color: var(--phosphor);
  text-shadow: 0 0 10px var(--phosphor);
}

/* ── Estado / Perfil ── */
.status-avatar {
  text-align: center;
  font-size: 2rem;
  margin: 6px 0;
  text-shadow: 0 0 20px var(--phosphor);
}
.status-badge {
  display: inline-block;
  border: 1px solid var(--phosphor-dim);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.62rem;
  letter-spacing: 2px;
  color: var(--phosphor-dim);
  box-shadow: 0 0 6px rgba(0,255,102,0.2), inset 0 0 6px rgba(0,255,102,0.05);
}
.mission-log {
  max-height: 80px;
  overflow-y: auto;
  font-size: 0.64rem;
  color: var(--phosphor-faint);
  scrollbar-width: none;
}
.mission-log::-webkit-scrollbar { display: none; }
.mission-log-entry { line-height: 1.7; border-bottom: 1px solid rgba(0,255,102,0.05); }
.mission-log-ts { color: #005522; }

/* ══════════════════════════════════
   PANEL DE CONTROLES
   ══════════════════════════════════ */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.fixed-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.fixed-controls.pair {
  grid-template-columns: 1fr 1fr;
}

.dynamic-module {
  /* Área de botones dinámicos según modo */
}

/* ── Botones retro ── */
.retro-btn {
  flex: 1;
  padding: 9px 6px;
  background: linear-gradient(180deg, #e4ded2 0%, #8d877c 46%, #5c574f 100%);
  border: 1px solid #3a3630;
  border-radius: 7px;
  color: #2a2622;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
  box-shadow:
    2px 2px 5px rgba(0,0,0,0.6),
    1px 1px 0 rgba(255,255,255,0.04),
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -1px 0 rgba(0,0,0,0.3);
  transition: all 0.08s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.retro-btn::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.03);
  pointer-events: none;
}
.retro-btn:active {
  transform: translateY(1px);
  box-shadow: 1px 1px 2px rgba(0,0,0,0.6), inset 0 1px 2px rgba(0,0,0,0.4);
}
.retro-btn.active {
  background: linear-gradient(160deg, #001508, #010a03, #001508);
  border-color: var(--phosphor-dim);
  color: var(--phosphor);
  text-shadow: 0 0 10px var(--phosphor);
  box-shadow:
    0 0 8px rgba(0,255,102,0.3),
    2px 2px 5px rgba(0,0,0,0.6),
    inset 0 0 8px rgba(0,255,102,0.08);
}
.retro-btn.success {
  border-color: #00ff66;
  color: #00ff66;
  text-shadow: 0 0 8px rgba(0, 255, 102, .45);
}
.retro-btn.danger {
  color: #cc3322;
  text-shadow: 0 0 8px rgba(200,50,30,0.7);
}
.retro-btn.danger:active {
  color: #ff4433;
}
.retro-btn.power-on {
  color: var(--red-led);
  text-shadow: 0 0 8px rgba(255,34,0,0.8);
  border-color: #441100;
  box-shadow:
    0 0 8px rgba(255,34,0,0.2),
    2px 2px 5px rgba(0,0,0,0.6);
}

/* Separador de sección */
.controls-sep {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,255,102,0.1), transparent);
  margin: 2px 0;
}

/* Slider de frecuencia */
.freq-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.freq-slider-wrap .retro-btn {
  flex: 0 0 44px;
}
.freq-slider-label {
  font-size: 0.62rem;
  color: var(--phosphor-faint);
  white-space: nowrap;
}
.freq-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: linear-gradient(90deg, #002208, #004410, #002208);
  border: 1px solid #003308;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.freq-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #44ff88, var(--phosphor), #008833);
  box-shadow: 0 0 6px var(--phosphor), 0 0 12px rgba(0,255,102,0.4);
  border: 1px solid #66ffaa;
  cursor: pointer;
}
.freq-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 8px var(--phosphor);
  border: 1px solid #66ffaa;
  cursor: pointer;
}

/* Botón de grabar */
.rec-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}
.rec-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #330000;
  transition: all 0.3s;
}
.rec-indicator.recording {
  background: var(--red-led);
  box-shadow: 0 0 6px var(--red-led);
  animation: rec-blink 1s step-end infinite;
}
@keyframes rec-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.2; } }

/* Módulo dinámico de botones de modo */
.mode-module {
  display: grid;
  gap: 6px;
}
.mode-module.grid-2 { grid-template-columns: 1fr 1fr; }
.mode-module.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.mode-module.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ══════════════════════════════════
   REJILLA DE MICRÓFONO
   ══════════════════════════════════ */
.mic-grille {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 3px;
  padding: 8px 14px 4px;
  opacity: 0.5;
}
.grille-hole {
  aspect-ratio: 1;
  background: #060504;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.9);
}

/* ══════════════════════════════════
   LANDING PAGE
   ══════════════════════════════════ */
.landing-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  padding: 24px;
  gap: 0;
}
.landing-terminal {
  width: 100%;
  max-width: 420px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 2;
  color: var(--phosphor-dim);
  text-align: left;
  min-height: 280px;
  padding: 10px 0;
}
.landing-line {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  color: var(--phosphor);
  text-shadow: 0 0 8px rgba(0,255,102,0.6);
  animation: fade-in 0.3s forwards;
}
.landing-line.dim {
  color: var(--phosphor-faint);
  text-shadow: none;
}
.landing-line.warn {
  color: var(--amber);
  text-shadow: 0 0 8px rgba(255,170,0,0.6);
}
@keyframes fade-in { to { opacity: 1; } }

.landing-cursor {
  display: inline-block;
  width: 10px;
  height: 1.1em;
  background: var(--phosphor);
  vertical-align: text-bottom;
  box-shadow: 0 0 8px var(--phosphor);
  animation: blink 1s step-end infinite;
}
.landing-btn-wrap {
  margin-top: 32px;
  text-align: center;
  width: 100%;
  max-width: 420px;
  opacity: 0;
  transition: opacity 0.6s;
}
.landing-btn-wrap.visible { opacity: 1; }
.install-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 2px solid var(--phosphor-dim);
  color: var(--phosphor);
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 2px;
  padding: 16px 28px;
  border-radius: 6px;
  cursor: pointer;
  text-shadow: 0 0 12px var(--phosphor);
  box-shadow:
    0 0 16px rgba(0,255,102,0.2),
    inset 0 0 12px rgba(0,255,102,0.05);
  transition: all 0.2s;
  animation: btn-glow 2.5s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
@keyframes btn-glow {
  0%,100% {
    box-shadow: 0 0 16px rgba(0,255,102,0.2), inset 0 0 12px rgba(0,255,102,0.05);
    border-color: var(--phosphor-dim);
  }
  50% {
    box-shadow: 0 0 30px rgba(0,255,102,0.4), inset 0 0 20px rgba(0,255,102,0.1);
    border-color: var(--phosphor);
  }
}
.install-btn:active {
  transform: scale(0.97);
  box-shadow: 0 0 8px rgba(0,255,102,0.3);
}
.install-sub {
  margin-top: 12px;
  font-size: 0.6rem;
  color: var(--phosphor-faint);
  letter-spacing: 2px;
  text-align: center;
}

/* ══════════════════════════════════
   MODALES
   ══════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  background: var(--chassis-dark);
  border: 1px solid var(--chassis-light);
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9);
}
.modal-card h3 {
  font-size: 0.75rem;
  letter-spacing: 3px;
  color: var(--phosphor-dim);
  margin-bottom: 16px;
  text-align: center;
  text-shadow: 0 0 8px var(--phosphor-faint);
}

/* ══════════════════════════════════
   INPUT / FORM STYLES
   ══════════════════════════════════ */
.term-input {
  width: 100%;
  background: var(--phosphor-bg);
  border: 1px solid rgba(0,255,102,0.3);
  border-radius: 4px;
  color: var(--phosphor);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px 12px;
  outline: none;
  caret-color: var(--phosphor);
  text-shadow: 0 0 6px var(--phosphor);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.term-input:focus {
  border-color: var(--phosphor);
  box-shadow: 0 0 8px rgba(0,255,102,0.3), inset 0 0 6px rgba(0,255,102,0.06);
}
.term-input::placeholder { color: var(--phosphor-faint); }

/* ══════════════════════════════════
   UTILIDADES
   ══════════════════════════════════ */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }

/* Ocultar en modo no-standalone */
@media (display-mode: standalone) {
  .install-hint { display: none; }
}

/* Animación de entrada para el chasis */
@keyframes chassis-boot {
  0%   { opacity: 0; transform: scale(0.97) translateY(6px); }
  100% { opacity: 1; transform: none; }
}
.chassis { animation: chassis-boot 0.5s ease-out forwards; }

/* Responsive */
@media (max-height: 660px) {
  .screen-content { min-height: 160px; }
  .crt-screen { min-height: 160px; }
}
@media (max-width: 360px) {
  .chassis { padding: 8px; }
  .retro-btn { font-size: 0.55rem; padding: 8px 4px; }
}

/* ── Calibración Matutino: 4 barras rojas ── */
.cal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 8px;
}
.cal-label {
  font-size: 0.55rem;
  letter-spacing: 1px;
  color: #3a342c;
  white-space: nowrap;
}
.cal-bars {
  display: flex;
  gap: 6px;
  flex: 1;
}
.cal-bars span {
  flex: 1;
  height: 9px;
  background: #2a1210;
  border: 1px solid #5a3028;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.65);
}
.cal-bars span.lit {
  background: #ff1a00;
  border-color: #ff6644;
  box-shadow: 0 0 8px #ff2200, 0 0 14px rgba(255, 30, 0, .65);
}
.mic-led {
  display: none;
  font-size: 0.62rem;
  letter-spacing: 1px;
  color: #ff2200;
  text-shadow: 0 0 8px #ff2200;
}
.mic-led.on {
  display: block;
  animation: mic-blink 0.7s steps(2) infinite;
}
@keyframes mic-blink { 50% { opacity: .25; } }

.call-911 {
  width: 100%;
  margin-top: 2px;
  letter-spacing: 2px;
}
.call-911.locked,
.call-911:disabled {
  background: linear-gradient(180deg, #8a8680, #5c5954);
  color: #9a968f;
  border-color: #4a4742;
  text-shadow: none;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.35);
  cursor: not-allowed;
}
.call-911.armed {
  background: linear-gradient(180deg, #ff5a42, #a10d0d 70%);
  color: #fff;
  border-color: #ff2200;
  text-shadow: 0 0 8px rgba(255,80,40,.8);
  animation: call-glow 1s ease-in-out infinite;
  cursor: pointer;
}
@keyframes call-glow {
  0%, 100% { box-shadow: 0 0 10px #ff2200, 0 0 22px rgba(255,0,0,.45); }
  50% { box-shadow: 0 0 4px #ff2200; filter: brightness(.82); }
}
.nav-btns { max-width: 92px; }
.exit-link {
  display: block;
  margin-top: 6px;
  background: none;
  border: 0;
  color: #4a453e;
  font-family: inherit;
  font-size: 0.58rem;
  letter-spacing: 2px;
  cursor: pointer;
  text-align: right;
}
.call-stage {
  min-height: 160px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 8px;
}
.call-title {
  letter-spacing: 3px;
  font-size: 1.15rem;
  text-align: center;
}
.call-line {
  font-size: 0.72rem;
  letter-spacing: 1px;
  line-height: 1.35;
  color: var(--phosphor-dim);
  max-width: 18rem;
}
.call-dots {
  display: inline-block;
  width: 1.4em;
  text-align: left;
}
.call-dots i {
  display: inline-block;
  width: 0.35em;
  font-style: normal;
  opacity: 0;
  animation: call-dot 1.2s infinite;
}
.call-dots i::before { content: '.'; }
.call-dots i:nth-child(2) { animation-delay: .2s; }
.call-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes call-dot {
  0%, 15% { opacity: 0; }
  30%, 100% { opacity: 1; }
}
.call-stop {
  min-height: 48px;
  min-width: 70%;
  margin-top: 8px;
  touch-action: manipulation;
}
.standby-static {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0,255,102,.03) 0 1px,
    transparent 1px 3px
  );
  animation: static-flicker 1.6s steps(2) infinite;
}
@keyframes static-flicker { 50% { opacity: .72; } }
.vol-readout {
  font-size: 1.4rem;
  letter-spacing: 4px;
  text-align: center;
}
