/* ============================================================
   LU92123 // VT-100 PHOSPHOR TERMINAL
   styles.css — sin frameworks, sin dependencias raras.
   ============================================================ */

/* ---------- 1. Tokens y temas de fósforo ---------- */

:root {
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: "VT323", "JetBrains Mono", ui-monospace, Consolas, monospace;

  --bg: #120c00;
  --bg-deep: #070400;
  --fg: #ffb000;
  --fg-rgb: 255, 176, 0;
  --fg-bright: #ffd27a;
  --fg-dim: #c98a00;
  --fg-faint: rgba(255, 176, 0, 0.08);
  --line: rgba(255, 176, 0, 0.28);
  --line-soft: rgba(255, 176, 0, 0.14);
  --panel: rgba(255, 176, 0, 0.045);
  --panel-strong: rgba(255, 176, 0, 0.09);
  --selection-bg: #ffb000;
  --selection-fg: #120c00;
  --text-glow: 0 0 1px rgba(255, 176, 0, 0.7), 0 0 14px rgba(255, 176, 0, 0.16);
  --screen-glow: 0 0 70px rgba(255, 176, 0, 0.07);

  --shell-1: #1d1810;
  --shell-2: #110e09;
  --shell-3: #0a0805;
  --shell-line: #2d2518;
  --shell-text: #8b7a5c;

  --font-size: clamp(12.5px, 1.05vw, 15px);
  --pad-x: clamp(14px, 4vw, 58px);
}

:root[data-theme="green"] {
  --bg: #02120a;
  --bg-deep: #000703;
  --fg: #3dff85;
  --fg-rgb: 61, 255, 133;
  --fg-bright: #b8ffd1;
  --fg-dim: #23b85d;
  --fg-faint: rgba(61, 255, 133, 0.08);
  --line: rgba(61, 255, 133, 0.28);
  --line-soft: rgba(61, 255, 133, 0.14);
  --panel: rgba(61, 255, 133, 0.045);
  --panel-strong: rgba(61, 255, 133, 0.09);
  --selection-bg: #3dff85;
  --selection-fg: #02120a;
  --text-glow: 0 0 1px rgba(61, 255, 133, 0.7), 0 0 14px rgba(61, 255, 133, 0.16);
  --screen-glow: 0 0 70px rgba(61, 255, 133, 0.08);
}

:root[data-theme="mono"] {
  --bg: #05080b;
  --bg-deep: #010203;
  --fg: #d9f5ff;
  --fg-rgb: 217, 245, 255;
  --fg-bright: #ffffff;
  --fg-dim: #8fb4c4;
  --fg-faint: rgba(217, 245, 255, 0.07);
  --line: rgba(217, 245, 255, 0.26);
  --line-soft: rgba(217, 245, 255, 0.13);
  --panel: rgba(217, 245, 255, 0.04);
  --panel-strong: rgba(217, 245, 255, 0.085);
  --selection-bg: #d9f5ff;
  --selection-fg: #05080b;
  --text-glow: 0 0 1px rgba(217, 245, 255, 0.8), 0 0 16px rgba(150, 225, 255, 0.22);
  --screen-glow: 0 0 70px rgba(160, 225, 255, 0.09);
}

/* ---------- 2. Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: #000;
  scrollbar-color: var(--fg-dim) transparent;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(6px, 1.6vw, 26px);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--fg);
  font-family: var(--mono);
  font-size: var(--font-size);
  background:
    radial-gradient(ellipse 60% 46% at 50% 44%, rgba(var(--fg-rgb), 0.1), transparent 70%),
    radial-gradient(ellipse 90% 90% at 50% 110%, #040300 0%, transparent 60%),
    #000;
  transition: background 0.5s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.noscript {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  width: min(440px, calc(100vw - 32px));
  padding: 1.2rem 1.35rem;
  border: 1px solid var(--fg);
  background: var(--bg);
  box-shadow: 0 0 30px rgba(var(--fg-rgb), 0.25);
  line-height: 1.6;
  text-align: left;
}

.noscript strong {
  display: block;
  margin-bottom: 0.6rem;
  letter-spacing: 0.08em;
}

.noscript p {
  margin: 0 0 0.7rem;
}

.noscript p:last-child {
  margin-bottom: 0;
}

.noscript a {
  color: var(--fg);
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
  text-shadow: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 1px dashed var(--fg);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 40% 30% at 50% 48%, rgba(var(--fg-rgb), 0.09), transparent 70%);
  opacity: 0.9;
  transition: background 0.5s ease;
}

/* ---------- 3. Monitor / carcasa ---------- */

.monitor {
  position: relative;
  z-index: 1;
  width: min(1200px, 100%);
  min-width: 0;
  height: min(880px, 100%);
  display: flex;
  flex-direction: column;
  padding: 9px 11px 7px;
  border: 1px solid var(--shell-line);
  border-radius: 26px;
  background:
    linear-gradient(180deg, var(--shell-1) 0%, var(--shell-2) 48%, var(--shell-3) 100%);
  box-shadow:
    0 50px 90px -34px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(var(--fg-rgb), 0.05),
    0 0 90px -20px rgba(var(--fg-rgb), 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 -1px 0 rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.monitor::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.06), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.02));
}

.monitor-top,
.monitor-bottom {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--shell-text);
  font-family: var(--display);
  font-size: 17px;
  line-height: 1;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  user-select: none;
}

.monitor-top {
  padding: 4px 7px 10px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  white-space: nowrap;
}

.brand-mark {
  color: var(--fg);
  font-size: 0.85em;
  text-shadow: 0 0 10px rgba(var(--fg-rgb), 0.5);
}

.brand-name {
  color: var(--fg);
  font-size: 1.35em;
  letter-spacing: 0.15em;
  text-shadow: 0 0 12px rgba(var(--fg-rgb), 0.35);
}

.brand-dash {
  opacity: 0.55;
}

.brand-sep {
  opacity: 0.35;
}

.brand-sub {
  color: var(--shell-text);
  font-size: 0.92em;
  letter-spacing: 0.19em;
}

.monitor-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 2vw, 1.4rem);
  white-space: nowrap;
}

.clock {
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
  text-shadow: 0 0 8px rgba(var(--fg-rgb), 0.25);
}

.leds {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.82em;
  letter-spacing: 0.16em;
  color: var(--shell-text);
}

.led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3a3022;
  box-shadow: inset 0 0 2px #000;
  transition: background 0.15s, box-shadow 0.15s;
}

.led-pwr {
  background: var(--fg);
  box-shadow: 0 0 6px rgba(var(--fg-rgb), 0.8);
}

.led-rx.pulse {
  background: var(--fg-bright);
  box-shadow: 0 0 10px rgba(var(--fg-rgb), 0.95);
}

.crt-toggle {
  cursor: pointer;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(var(--fg-rgb), 0.04);
  color: var(--fg);
  font-family: var(--display);
  font-size: 1em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.crt-toggle:hover,
.crt-toggle[aria-pressed="false"] {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  box-shadow: 0 0 14px rgba(var(--fg-rgb), 0.35);
}

.crt-toggle:active {
  transform: translateY(1px);
}

.bezel {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  padding: clamp(7px, 1.1vw, 14px);
  display: flex;
  border-radius: 20px;
  background:
    radial-gradient(ellipse 80% 70% at 50% 50%, #0d0a06 0%, #070604 100%);
  box-shadow:
    inset 0 0 0 1px #241d12,
    inset 0 0 36px rgba(0, 0, 0, 0.9),
    0 1px 0 rgba(255, 255, 255, 0.03);
}

.monitor-bottom {
  justify-content: space-between;
  gap: 1rem;
  padding: 9px 8px 2px;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: #6e6049;
}

.vents {
  flex: 1 1 auto;
  height: 4px;
  max-width: 220px;
  border-radius: 4px;
  opacity: 0.7;
  background: repeating-linear-gradient(
    to right,
    #2a2218 0 3px,
    transparent 3px 7px
  );
}

/* ---------- 4. Pantalla CRT ---------- */

.screen {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 1.35rem / 1.7rem;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 120% 110% at 50% 45%, var(--bg) 40%, var(--bg-deep) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(var(--fg-rgb), 0.12),
    inset 0 0 90px rgba(0, 0, 0, 0.9),
    inset 0 0 18px rgba(var(--fg-rgb), 0.05),
    var(--screen-glow);
  transition: box-shadow 0.3s ease, background 0.35s ease;
  animation: powerOn 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(130% 70% at 18% -8%, rgba(255, 255, 255, 0.055), transparent 42%),
    radial-gradient(90% 60% at 88% 108%, rgba(var(--fg-rgb), 0.04), transparent 55%);
  mix-blend-mode: screen;
}

.screen > * {
  position: relative;
  z-index: 2;
}

.screen-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: clamp(0.8rem, 2.4vw, 1.6rem);
  padding: 0.5rem clamp(0.8rem, 2vw, 1.2rem);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(var(--fg-rgb), 0.055), transparent);
  color: var(--fg-dim);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

.screen-online {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  color: var(--fg);
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg);
  box-shadow: 0 0 7px rgba(var(--fg-rgb), 0.9);
  animation: ledBlink 3.4s steps(1) infinite;
}

.screen-tx {
  margin-left: auto;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- 5. Barra de comandos rápidos ---------- */

.quickbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.38rem;
  padding: 0.55rem clamp(0.65rem, 1.8vw, 1.1rem);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(var(--fg-rgb), 0.018);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  user-select: none;
}

.quickbar::-webkit-scrollbar {
  display: none;
}

.quickbar-label {
  flex: 0 0 auto;
  margin-right: 0.25rem;
  color: var(--fg-dim);
  font-size: 9px;
  letter-spacing: 0.2em;
  opacity: 0.7;
}

.quickbar button {
  flex: 0 0 auto;
  cursor: pointer;
  padding: 0.22em 0.5em;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--fg-dim);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  line-height: 1.5;
  transition: color 0.14s, background 0.14s, border-color 0.14s, box-shadow 0.14s;
}

.quickbar button::before {
  content: "[";
  margin-right: 0.18em;
  opacity: 0.5;
}

.quickbar button::after {
  content: "]";
  margin-left: 0.18em;
  opacity: 0.5;
}

.quickbar button:hover,
.quickbar button:focus-visible {
  color: var(--bg);
  background: var(--fg);
  border-color: var(--fg);
  box-shadow: 0 0 12px rgba(var(--fg-rgb), 0.3);
  outline: none;
}

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

.quickbar-spacer {
  flex: 1 0 0.5rem;
}

.quickbar-hint {
  flex: 0 0 auto;
  padding-left: 0.5rem;
  color: var(--fg-dim);
  font-size: 9px;
  letter-spacing: 0.13em;
  opacity: 0.6;
  white-space: nowrap;
}

/* ---------- 6. Terminal: salida y prompt ---------- */

.terminal {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 3;
}

.terminal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim) transparent;
  padding: clamp(14px, 2.2vw, 26px) var(--pad-x) 6px;
}

.terminal-scroll::-webkit-scrollbar {
  width: 8px;
}

.terminal-scroll::-webkit-scrollbar-track {
  background: rgba(var(--fg-rgb), 0.03);
}

.terminal-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 2px solid var(--bg);
}

.terminal-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--fg-dim);
}

.output {
  min-height: 1px;
  min-width: 0;
}

.output,
.prompt-line {
  text-shadow: var(--text-glow);
}

.line {
  margin: 0 0 0.62em;
  min-width: 0;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.line:last-child {
  margin-bottom: 0;
}

.line.tight {
  margin-bottom: 0.18em;
}

.line.gap {
  margin-top: 1.15em;
}

.line.echo {
  margin-bottom: 0.9em;
  color: var(--fg);
}

.ps1,
.prompt-echo {
  color: var(--fg-bright);
  font-weight: 500;
  white-space: nowrap;
}

.prompt-echo .sep,
.sep {
  color: var(--fg-dim);
  opacity: 0.65;
}

.echo-cmd {
  color: var(--fg);
}

.dim {
  color: var(--fg-dim);
}

.faint {
  opacity: 0.55;
}

.bright {
  color: var(--fg-bright);
}

.ok {
  color: var(--fg-bright);
  font-weight: 500;
}

.warn {
  color: var(--fg-bright);
  border-bottom: 1px dotted var(--fg-dim);
}

.bullet {
  color: var(--fg-dim);
  margin-right: 0.15em;
}

.arrow {
  color: var(--fg-dim);
}

/* Prompt interactivo */

.prompt-line {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  padding: 10px var(--pad-x) clamp(12px, 2vw, 18px);
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, transparent, rgba(var(--fg-rgb), 0.025));
  line-height: 1.55;
  cursor: text;
}

.prompt-line .ps1 {
  flex: 0 0 auto;
  font-size: 0.95em;
  user-select: none;
}

.input-shell {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 1.58em;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.mirror {
  visibility: hidden;
  display: inline-block;
  white-space: pre;
  pointer-events: none;
  font: inherit;
  letter-spacing: inherit;
  min-width: 0;
}

#command-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  letter-spacing: inherit;
  caret-color: transparent;
}

#command-input::placeholder {
  color: var(--fg-dim);
  opacity: 0.35;
}

#command-input:placeholder-shown {
  padding-left: 0.8em;
}

#command-input:disabled {
  opacity: 0.4;
}

.caret {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0.62em;
  height: 1.12em;
  margin-left: -0.02em;
  transform: translateY(-50%);
  background: var(--fg);
  box-shadow: 0 0 9px rgba(var(--fg-rgb), 0.55);
  pointer-events: none;
  opacity: 0.9;
  animation: caretBlink 1.06s steps(1) infinite;
  transition: left 0.035s linear;
}

.input-shell:not(:focus-within) .caret {
  opacity: 0.4;
  animation-duration: 2.2s;
}

body.is-busy .caret {
  animation-duration: 0.7s;
  opacity: 0.7;
}

.prompt-hint {
  flex: 0 0 auto;
  color: var(--fg-dim);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.62;
  user-select: none;
  white-space: nowrap;
}

/* ---------- 7. Tipografía de contenido ---------- */

.eyebrow {
  margin-bottom: 0.35em;
  color: var(--fg-dim);
  font-size: 0.76em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.section-title {
  margin: 0 0 0.55em;
  color: var(--fg-bright);
  font-size: 1.06em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.output h3 {
  margin: 0.15em 0 0.55em;
  color: var(--fg-bright);
  font-size: 1.12em;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.output p {
  margin: 0 0 0.7em;
  max-width: 88ch;
}

.output p:last-child {
  margin-bottom: 0;
}

.output strong,
.output b {
  color: var(--fg-bright);
  font-weight: 700;
}

.output em {
  color: var(--fg-bright);
  font-style: normal;
  border-bottom: 1px dotted var(--line);
}

.hl {
  padding: 0 0.28em;
  background: rgba(var(--fg-rgb), 0.16);
  color: var(--fg-bright);
}

.lead {
  color: var(--fg-bright);
  font-size: 1.02em;
}

.quote {
  margin: 0.8em 0 0.2em;
  padding: 0.35em 0 0.35em 0.85em;
  border-left: 2px solid var(--line);
  color: var(--fg-dim);
  font-style: italic;
}

.mono-small {
  font-size: 0.86em;
  line-height: 1.55;
}

.ascii {
  margin: 0.35em 0 0.7em;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  background: transparent;
  color: var(--fg);
  font-family: var(--mono);
  font-size: clamp(8px, 1.25vw, 12.5px);
  line-height: 1.18;
  letter-spacing: 0;
  white-space: pre;
  text-shadow: var(--text-glow);
  scrollbar-width: thin;
}

.ascii.banner {
  margin-top: 0.15em;
  margin-bottom: 0.75em;
  color: var(--fg-bright);
  font-size: clamp(8px, 2vw, 13px);
  line-height: 1.16;
  text-shadow: 0 0 2px rgba(var(--fg-rgb), 0.7), 0 0 18px rgba(var(--fg-rgb), 0.25);
}

.ascii.card {
  color: var(--fg);
  font-size: clamp(9px, 1.35vw, 12.5px);
}

/* Listas */

.bullets {
  margin: 0.25em 0 0.8em;
  padding: 0;
  list-style: none;
}

.bullets li {
  position: relative;
  margin-bottom: 0.4em;
  padding-left: 1.25em;
  line-height: 1.5;
}

.bullets li::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--fg-dim);
}

/* Tabla de comandos */

.cmd-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.22em 1.4em;
  margin: 0.35em 0 0.9em;
  font-size: 0.95em;
}

.cmd-list .cmd {
  color: var(--fg-bright);
  font-weight: 500;
  white-space: nowrap;
}

.cmd-list .cmd::before {
  content: "› ";
  color: var(--fg-dim);
  opacity: 0.7;
}

.cmd-list .desc {
  color: var(--fg);
  opacity: 0.82;
}

/* Pares clave / valor */

.kv-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.28em 1.15em;
  margin: 0.65em 0 0.85em;
  font-size: 0.93em;
  line-height: 1.5;
}

.kv-grid .k {
  color: var(--fg-dim);
  font-size: 0.86em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-top: 0.12em;
}

.kv-grid .v {
  color: var(--fg);
}

/* Etiquetas y chips */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em;
  margin: 0.5em 0 0.9em;
}

.tag {
  display: inline-block;
  padding: 0.06em 0.45em;
  border: 1px solid var(--line-soft);
  color: var(--fg-dim);
  font-size: 0.72em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Paneles */

.panel {
  position: relative;
  margin: 0.55em 0 0.9em;
  padding: 0.8em 1em;
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--line);
  background:
    linear-gradient(180deg, rgba(var(--fg-rgb), 0.055), rgba(var(--fg-rgb), 0.012) 65%, transparent);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 0.55em;
  color: var(--fg-bright);
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.panel-title::before {
  content: "";
  width: 0.55em;
  height: 0.55em;
  background: var(--fg);
  box-shadow: 0 0 8px rgba(var(--fg-rgb), 0.6);
}

.panel .bullets {
  margin-bottom: 0.1em;
}

.panel .kv-grid {
  margin-bottom: 0.2em;
}

.panel .quote {
  margin-bottom: 0;
}

/* Tarjetas HUD, deck y ficha modal: ver bloque "PROJECT DECK" al final del archivo */

/* Estadísticas de cubing */

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.6em 0 0.9em;
}

.stat {
  flex: 1 1 105px;
  padding: 0.55em 0.7em;
  border: 1px solid var(--line-soft);
  background: rgba(var(--fg-rgb), 0.03);
}

.stat-value {
  display: block;
  color: var(--fg-bright);
  font-size: 1.28em;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.15;
  text-shadow: 0 0 10px rgba(var(--fg-rgb), 0.3);
}

.stat-label {
  display: block;
  margin-top: 0.2em;
  color: var(--fg-dim);
  font-size: 0.65em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Fila de enlaces / botones */

.media-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.75em 0 0.35em;
}

.term-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.18em 0.55em;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.8em;
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s, box-shadow 0.14s;
}

.term-btn:hover,
.term-btn:focus-visible {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  box-shadow: 0 0 14px rgba(var(--fg-rgb), 0.35);
  outline: none;
}

.term-btn:active {
  transform: translateY(1px);
}

.term-btn.ghost,
.term-btn[data-todo] {
  border-style: dashed;
  border-color: var(--line-soft);
  color: var(--fg-dim);
}

.term-btn.ghost:hover,
.term-btn[data-todo]:hover,
.term-btn.ghost:focus-visible,
.term-btn[data-todo]:focus-visible {
  background: var(--fg-dim);
  border-color: var(--fg-dim);
  color: var(--bg);
}

.term-link {
  color: var(--fg-bright);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.22em;
}

.term-link:hover {
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
}

/* Pull de sistema / neofetch */

.fetch {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.4em;
  margin-top: 0.45em;
}

.fetch .ascii {
  margin: 0;
  color: var(--fg-bright);
  font-size: clamp(9px, 1.25vw, 12px);
}

.fetch .kv-grid {
  flex: 1 1 260px;
  margin: 0;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65em 1.8em;
  margin: 0.55em 0 0.25em;
  font-size: 0.86em;
}

.swatch-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--fg-dim);
}

.swatch {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  box-shadow: 0 0 8px currentColor;
}

.swatch-amber { color: #ffb000; background: #ffb000; }
.swatch-green { color: #3dff85; background: #3dff85; }
.swatch-mono { color: #d9f5ff; background: #d9f5ff; }

.swatch-item.active {
  color: var(--fg-bright);
}

.swatch-item.active::after {
  content: "◂ ACTUAL";
  margin-left: 0.3em;
  font-size: 0.75em;
  letter-spacing: 0.1em;
  color: var(--fg);
}

/* Barra de estado inferior */

.screen-bottom {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 1rem;
  padding: 0.4rem clamp(0.85rem, 2vw, 1.25rem);
  border-top: 1px solid var(--line-soft);
  color: var(--fg-dim);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  user-select: none;
  white-space: nowrap;
}

.mode {
  color: var(--fg);
  letter-spacing: 0.16em;
}

.mode::before {
  content: "▸ ";
  opacity: 0.7;
}

.bottom-hint {
  flex: 1 1 auto;
  text-align: center;
  opacity: 0.62;
}

.phosphor {
  opacity: 0.75;
}

/* Utilidades */

.no-select {
  user-select: none;
}

/* ---------- 8. Capa CRT: scanlines, curvatura, fósforo ---------- */

.crt-effects {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  border-radius: inherit;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.crt-effects > * {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scanlines {
  opacity: 0.44;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.33) 3px,
    rgba(0, 0, 0, 0.33) 4px
  );
  background-size: 100% 4px;
  animation: scanDrift 14s linear infinite;
}

.scanbar {
  inset: auto 0 auto 0;
  top: -30%;
  height: 26%;
  opacity: 0.55;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(var(--fg-rgb), 0.045) 42%,
    rgba(var(--fg-rgb), 0.12) 50%,
    rgba(var(--fg-rgb), 0.045) 58%,
    transparent 100%
  );
  filter: blur(2px);
  animation: scanBar 9s linear infinite;
}

.flicker {
  background: rgba(var(--fg-rgb), 0.022);
  animation: phosphorFlicker 7s steps(1) infinite;
}

.grain {
  opacity: 0.045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.55'/></svg>");
  background-size: 140px 140px;
  mix-blend-mode: screen;
}

.vignette {
  background:
    radial-gradient(ellipse 82% 76% at 50% 48%, transparent 58%, rgba(0, 0, 0, 0.2) 86%, rgba(0, 0, 0, 0.48) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), transparent 8%, transparent 92%, rgba(0, 0, 0, 0.16));
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.42),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Modo CRT apagado: nitidez total, cero decoración */

.crt-off .crt-effects {
  opacity: 0;
  visibility: hidden;
}

.crt-off .screen {
  --text-glow: none;
  box-shadow:
    inset 0 0 0 1px rgba(var(--fg-rgb), 0.18),
    inset 0 0 22px rgba(0, 0, 0, 0.35),
    0 0 30px -10px rgba(var(--fg-rgb), 0.18);
}

.crt-off .screen::after {
  opacity: 0;
}

.crt-off .output,
.crt-off .prompt-line,
.crt-off .quickbar,
.crt-off .screen-top,
.crt-off .screen-bottom,
.crt-off .ascii {
  text-shadow: none;
}

.crt-off .monitor {
  box-shadow:
    0 46px 80px -34px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(var(--fg-rgb), 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Parpadeo de encendido / kick al alternar */

.screen.kick {
  animation: crtKick 0.42s ease;
}

/* ---------- 9. Matrix ---------- */

#matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  display: block;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: #000;
  transition: opacity 0.45s ease, visibility 0.45s;
}

html.matrix-on #matrix-canvas {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.matrix-veil {
  position: fixed;
  left: 50%;
  bottom: clamp(18px, 4vh, 44px);
  z-index: 101;
  transform: translate(-50%, 12px);
  padding: 0.5em 0.9em;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.72);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
  text-shadow: var(--text-glow);
}

html.matrix-on .matrix-veil {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------- 10. Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: clamp(16px, 3vh, 34px);
  z-index: 120;
  transform: translate(-50%, 14px);
  max-width: min(90vw, 520px);
  padding: 0.55em 0.9em;
  border: 1px solid var(--line);
  background: rgba(8, 6, 2, 0.94);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  box-shadow: 0 0 24px -6px rgba(var(--fg-rgb), 0.3);
  text-shadow: var(--text-glow);
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------- 11. Animaciones ---------- */

@keyframes caretBlink {
  0%, 49% { opacity: 0.9; }
  50%, 100% { opacity: 0; }
}

@keyframes ledBlink {
  0%, 88%, 100% { opacity: 1; }
  89%, 96% { opacity: 0.25; }
}

@keyframes scanDrift {
  from { background-position: 0 0; }
  to { background-position: 0 8px; }
}

@keyframes scanBar {
  from { transform: translateY(-10vh); }
  to { transform: translateY(120vh); }
}

@keyframes phosphorFlicker {
  0%, 19%, 21%, 62%, 64%, 100% { opacity: 0.55; }
  20%, 63% { opacity: 0.2; }
  82% { opacity: 0.75; }
}

@keyframes powerOn {
  0% {
    opacity: 0;
    transform: scaleY(0.82) scaleX(0.995);
    filter: brightness(2.6) blur(1px);
  }
  35% {
    opacity: 1;
    transform: scaleY(1.004) scaleX(1);
    filter: brightness(1.35) blur(0);
  }
  55% {
    filter: brightness(0.94);
  }
  100% {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes crtKick {
  0% { filter: brightness(1); }
  18% { filter: brightness(1.45); }
  32% { filter: brightness(0.86); }
  52% { filter: brightness(1.12); }
  100% { filter: brightness(1); }
}

/* ---------- 12. Responsive ---------- */

@media (max-width: 860px) {
  :root {
    --font-size: 13px;
    --pad-x: clamp(12px, 3.4vw, 26px);
  }

  .monitor {
    border-radius: 20px;
    padding: 7px 8px 5px;
  }

  .monitor-top {
    padding: 3px 4px 8px;
  }

  .monitor-meta {
    gap: 0.7rem;
  }

  .brand-sub,
  .brand-sep,
  .leds {
    display: none;
  }

  .screen-bottom .bottom-hint {
    display: none;
  }

  .screen-bottom {
    justify-content: space-between;
  }

  .quickbar-hint {
    display: none;
  }

  .ascii.card {
    font-size: clamp(8.5px, 2.15vw, 12px);
  }
}

@media (max-width: 620px) {
  body {
    padding: 0;
  }

  .monitor {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: 0;
    padding: 4px 5px 3px;
  }

  .bezel {
    padding: 5px;
    border-radius: 12px;
  }

  .screen {
    border-radius: 0.7rem / 1rem;
  }

  .monitor-top {
    gap: 0.4rem;
  }

  .brand-name {
    font-size: 1.15em;
  }

  .clock {
    font-size: 0.9em;
  }

  .crt-toggle {
    font-size: 0.9em;
    padding: 2px 5px;
  }

  .monitor-bottom {
    display: none;
  }

  .screen-top {
    gap: 0.7rem;
    padding: 0.4rem 0.75rem;
    font-size: 8.5px;
    letter-spacing: 0.1em;
  }

  .screen-top span:nth-child(3) {
    display: none;
  }

  .quickbar {
    padding: 0.45rem 0.6rem;
    gap: 0.24rem;
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 0.3rem;
  }

  .quickbar-label,
  .quickbar-spacer {
    display: none;
  }

  .quickbar button {
    font-size: 10px;
    padding: 0.24em 0.36em;
  }

  :root {
    --font-size: 16px;
    --pad-x: 13px;
  }

  .line {
    line-height: 1.5;
  }

  .mono-small {
    font-size: 0.8em;
  }

  .prompt-line {
    gap: 0.45rem;
    padding-top: 8px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .prompt-line .ps1 {
    font-size: 0.8em;
  }

  .prompt-hint {
    display: none;
  }

  .screen-bottom {
    padding: 0.35rem 0.75rem;
    font-size: 8px;
  }

  .bottom-hint,
  .phosphor {
    display: none;
  }

  .ascii {
    font-size: 8px;
  }

  .ascii.banner {
    font-size: clamp(7px, 2.1vw, 10px);
  }

  .ascii.card {
    font-size: clamp(7.5px, 2.15vw, 10px);
  }

  .panel {
    padding: 0.65em 0.7em;
  }

  .cmd-list {
    gap: 0.2em 0.9em;
    font-size: 0.9em;
  }

  .kv-grid {
    grid-template-columns: 1fr;
    gap: 0.1em;
    margin-bottom: 0.7em;
  }

  .kv-grid .k {
    margin-top: 0.45em;
  }

  .stat-row {
    gap: 0.35rem;
  }

  .stat {
    flex-basis: 88px;
    padding: 0.45em 0.55em;
  }

  .stat-value {
    font-size: 1.12em;
  }
}

@media (max-height: 640px) and (min-width: 621px) {
  .monitor {
    height: 100%;
    border-radius: 18px;
  }

  .monitor-bottom {
    display: none;
  }

  .screen-top {
    padding-block: 0.35rem;
  }

  .quickbar {
    padding-block: 0.4rem;
  }

  .terminal-scroll {
    padding-top: 12px;
  }

  .prompt-line {
    padding-block: 8px 10px;
  }
}

/* ---------- 13. Accesibilidad / movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .scanlines,
  .scanbar,
  .flicker,
  .grain {
    display: none;
  }

  .caret {
    animation: none;
    opacity: 0.9;
  }

  .screen {
    animation: none;
  }
}

/* ---------- 14. Fallback si Google Fonts no carga ---------- */

@supports not (font-variation-settings: normal) {
  .ascii {
    letter-spacing: 0;
  }
}

/* ============================================================
   15. PROJECT DECK / TARJETAS HUD
   ============================================================ */

.project-block {
  margin-top: 0.35em;
}

.project-deck {
  position: relative;
  margin: 0.7em 0 1em;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(var(--fg-rgb), 0.06), transparent 30%),
    repeating-linear-gradient(0deg, rgba(var(--fg-rgb), 0.018) 0 1px, transparent 1px 4px),
    rgba(0, 0, 0, 0.28);
  box-shadow:
    inset 0 0 55px rgba(var(--fg-rgb), 0.035),
    0 0 30px -20px rgba(var(--fg-rgb), 0.55);
}

.project-deck::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(var(--fg-rgb), 0.07);
  pointer-events: none;
}

.deck-head,
.deck-foot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.42em 0.7em;
  color: var(--fg-dim);
  font-size: 0.6em;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  line-height: 1.4;
}

.deck-head {
  border-bottom: 1px solid var(--line-soft);
  background: rgba(var(--fg-rgb), 0.04);
}

.deck-title {
  color: var(--fg-bright);
  font-weight: 700;
}

.deck-meta {
  color: var(--fg-dim);
  white-space: nowrap;
}

.deck-foot {
  border-top: 1px solid var(--line-soft);
  background: rgba(var(--fg-rgb), 0.025);
}

.deck-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--fg);
  white-space: nowrap;
}

.deck-led,
.hud-signal::before,
.modal-led {
  width: 0.45em;
  height: 0.45em;
  flex: 0 0 auto;
  background: var(--fg);
  box-shadow: 0 0 7px rgba(var(--fg-rgb), 0.8);
  animation: hud-pulse 2.6s ease-in-out infinite;
}

.deck-hint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 0.75rem;
}

.hud-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(var(--fg-rgb), 0.045), rgba(0, 0, 0, 0.12) 55%),
    rgba(0, 0, 0, 0.25);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.hud-card::before,
.hud-card::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--line);
  border-style: solid;
  pointer-events: none;
  transition: border-color 0.18s ease;
  z-index: 6;
}

.hud-card::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}

.hud-card::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 1px 1px 0;
}

.hud-card:hover,
.hud-card:focus-within {
  border-color: var(--fg);
  box-shadow:
    0 0 0 1px rgba(var(--fg-rgb), 0.12),
    0 0 34px -14px rgba(var(--fg-rgb), 0.75);
  transform: translateY(-2px);
}

.hud-card:hover::before,
.hud-card:hover::after,
.hud-card:focus-within::before,
.hud-card:focus-within::after {
  border-color: var(--fg);
}

.hud-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hud-open:focus-visible {
  outline: 1px dashed var(--fg);
  outline-offset: -4px;
}

.hud-media {
  display: block;
  border-bottom: 1px solid var(--line-soft);
}

.hud-media img {
  filter: sepia(0.28) saturate(0.78) contrast(1.06) brightness(0.9);
  transition: transform 0.45s ease, filter 0.35s ease;
}

.hud-card:hover .hud-media img,
.hud-card:focus-within .hud-media img {
  transform: scale(1.035);
  filter: sepia(0.12) saturate(0.95) contrast(1.08) brightness(1);
}

.media-frame {
  position: relative;
  overflow: hidden;
  background: #050300;
}

.hud-media.media-frame,
.project-media.media-frame {
  aspect-ratio: 16 / 9;
}

.media-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.26) 0 1px,
    transparent 1px 3px
  );
}

.media-scanline {
  position: absolute;
  left: 0;
  right: 0;
  top: -25%;
  z-index: 2;
  height: 18%;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(var(--fg-rgb), 0.16), transparent);
  animation: media-sweep 6s linear infinite;
}

.media-stamp,
.media-cta {
  position: absolute;
  z-index: 4;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.68);
  color: var(--fg-bright);
  font-size: 0.56em;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}

.media-stamp {
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.16em 0.42em;
}

.media-cta {
  left: 50%;
  bottom: 0.55rem;
  transform: translate(-50%, 4px);
  padding: 0.2em 0.55em;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.hud-card:hover .media-cta,
.hud-open:focus-visible .media-cta {
  opacity: 1;
  transform: translate(-50%, 0);
}

.media-fallback {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  padding: 1em;
  text-align: center;
  background:
    repeating-linear-gradient(0deg, rgba(var(--fg-rgb), 0.05) 0 1px, transparent 1px 4px),
    #0a0700;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.media-fallback strong {
  color: var(--fg-bright);
  font-size: 0.78em;
  letter-spacing: 0.2em;
}

.media-fallback span {
  max-width: 100%;
  color: var(--fg-dim);
  font-size: 0.56em;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.media-missing .media-fallback {
  opacity: 1;
  visibility: visible;
}

.media-missing img {
  opacity: 0;
}

.hud-copy {
  display: block;
  padding: 0.7em 0.78em 0.72em;
}

.hud-kicker {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  margin-bottom: 0.32em;
  color: var(--fg-dim);
  font-size: 0.56em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.3;
}

.hud-kicker b {
  color: var(--fg-bright);
  font-weight: 700;
}

.hud-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5em;
  margin-bottom: 0.18em;
  color: var(--fg-bright);
  font-size: 0.94em;
  font-weight: 700;
  letter-spacing: 0.025em;
  line-height: 1.25;
  text-transform: uppercase;
}

.hud-arrow {
  flex: 0 0 auto;
  color: var(--fg-dim);
  font-weight: 400;
  transition: transform 0.18s ease, color 0.18s ease;
}

.hud-card:hover .hud-arrow {
  color: var(--fg-bright);
  transform: translateX(3px);
}

.hud-sub {
  display: block;
  margin-bottom: 0.6em;
  color: var(--fg-dim);
  font-size: 0.57em;
  letter-spacing: 0.1em;
  line-height: 1.45;
  text-transform: uppercase;
}

.hud-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em;
}

.hud-badge {
  display: inline-block;
  padding: 0.13em 0.42em;
  border: 1px solid var(--line-soft);
  background: rgba(var(--fg-rgb), 0.06);
  color: var(--fg-dim);
  font-size: 0.55em;
  letter-spacing: 0.09em;
  line-height: 1.4;
  text-transform: uppercase;
  white-space: nowrap;
}

.hud-foot {
  display: flex;
  align-items: center;
  gap: 0.4em;
  flex-wrap: wrap;
  margin-top: auto;
  padding: 0.48em 0.65em;
  border-top: 1px dashed var(--line-soft);
  background: rgba(var(--fg-rgb), 0.022);
}

.hud-signal {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  color: var(--fg-dim);
  font-size: 0.54em;
  letter-spacing: 0.11em;
  white-space: nowrap;
}

.hud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em;
  margin-left: auto;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.24em 0.44em;
  border: 1px solid var(--line-soft);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.56em;
  letter-spacing: 0.05em;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.hud-btn.primary {
  border-color: var(--line);
  background: rgba(var(--fg-rgb), 0.12);
  color: var(--fg-bright);
}

.hud-btn:hover,
.hud-btn:focus-visible {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
  outline: none;
}

/* ============================================================
   16. FICHA DE PROYECTO / MODAL HUD
   ============================================================ */

.project-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 2vw, 28px);
}

.project-modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 50% 42%, rgba(var(--fg-rgb), 0.09), transparent 68%),
    rgba(0, 0, 0, 0.87);
  backdrop-filter: blur(3px);
}

.modal-frame {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1120px, 100%);
  max-height: min(920px, 94vh);
  max-height: min(920px, 94dvh);
  min-height: 0;
  border: 1px solid var(--fg);
  background:
    linear-gradient(180deg, rgba(var(--fg-rgb), 0.07), transparent 16%),
    var(--bg-deep);
  box-shadow:
    0 0 0 1px rgba(var(--fg-rgb), 0.14),
    0 0 70px rgba(var(--fg-rgb), 0.18),
    inset 0 0 90px rgba(var(--fg-rgb), 0.035);
  animation: modal-in 0.22s ease-out;
}

.modal-scan {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.3;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.24) 0 1px,
    transparent 1px 3px
  );
}

.m-corner {
  position: absolute;
  z-index: 6;
  width: 16px;
  height: 16px;
  border-color: var(--fg);
  border-style: solid;
  pointer-events: none;
}

.m-tl {
  top: 5px;
  left: 5px;
  border-width: 2px 0 0 2px;
}

.m-tr {
  top: 5px;
  right: 5px;
  border-width: 2px 2px 0 0;
}

.m-bl {
  bottom: 5px;
  left: 5px;
  border-width: 0 0 2px 2px;
}

.m-br {
  right: 5px;
  bottom: 5px;
  border-width: 0 2px 2px 0;
}

.modal-head {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex: 0 0 auto;
  padding: 0.55em 0.8em;
  border-bottom: 1px solid var(--line);
  background: rgba(var(--fg-rgb), 0.04);
  font-size: 0.66em;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.modal-path {
  display: flex;
  align-items: center;
  gap: 0.4em;
  min-width: 0;
  color: var(--fg-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-led {
  display: inline-block;
}

.modal-head-meta {
  display: flex;
  align-items: center;
  gap: 0.7em;
  flex: 0 0 auto;
  color: var(--fg-dim);
}

.modal-chip,
.modal-coord {
  white-space: nowrap;
}

.modal-chip {
  color: var(--fg);
}

.modal-close,
.modal-action,
.modal-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  font: inherit;
  letter-spacing: 0.06em;
  line-height: 1.45;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.modal-close {
  padding: 0.28em 0.55em;
  font-size: 0.95em;
  text-transform: uppercase;
}

.modal-close:hover,
.modal-close:focus-visible,
.modal-action:hover,
.modal-action:focus-visible,
.modal-nav-btn:hover,
.modal-nav-btn:focus-visible {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
  outline: none;
}

.modal-body {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1.1rem;
  flex: 1 1 auto;
  min-height: 0;
  padding: 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.modal-media-col,
.modal-info-col {
  min-width: 0;
}

.modal-media-slot {
  outline: none;
}

.modal-media-slot:focus-visible {
  outline: 1px dashed var(--fg);
  outline-offset: 4px;
}

.project-media {
  border: 1px solid var(--line);
  outline: none;
}

.project-media:focus-visible {
  outline: 1px dashed var(--fg);
  outline-offset: 4px;
}

.project-media iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.media-meta {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-wrap: wrap;
  margin-top: 0.45em;
  padding: 0.32em 0.5em;
  border: 1px solid var(--line-soft);
  color: var(--fg-dim);
  font-size: 0.56em;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.media-meta-label {
  color: var(--fg-bright);
}

#modal-media-path {
  color: var(--fg);
  text-transform: none;
  overflow-wrap: anywhere;
}

.media-status {
  margin-left: auto;
  color: var(--fg-bright);
  white-space: nowrap;
}

.media-note {
  margin: 0.5em 0 0;
  color: var(--fg-dim);
  font-size: 0.66em;
  line-height: 1.5;
}

.modal-title {
  margin: 0.15em 0 0.2em;
  color: var(--fg-bright);
  font-size: clamp(1.12em, 2.1vw, 1.55em);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(var(--fg-rgb), 0.28);
}

.modal-sub {
  margin: 0 0 0.8em;
  color: var(--fg-dim);
  font-size: 0.64em;
  letter-spacing: 0.12em;
  line-height: 1.45;
  text-transform: uppercase;
}

.modal-summary {
  margin: 0 0 0.8em;
  color: var(--fg);
  font-size: 0.82em;
  line-height: 1.55;
}

.modal-badges {
  margin-bottom: 0.9em;
}

.modal-section-label {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin: 0.75em 0 0.35em;
  color: var(--fg-dim);
  font-size: 0.58em;
  letter-spacing: 0.17em;
  line-height: 1.4;
  text-transform: uppercase;
}

.modal-section-label::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line-soft);
}

.modal-specs {
  margin: 0 0 0.6em;
  gap: 0.22em 0.9em;
  font-size: 0.7em;
}

.modal-specs .k {
  font-size: 0.86em;
}

.modal-info-col .bullets {
  margin-bottom: 0;
  font-size: 0.7em;
}

.modal-info-col .bullets li {
  margin-bottom: 0.32em;
  line-height: 1.45;
}

.modal-foot {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex: 0 0 auto;
  flex-wrap: wrap;
  padding: 0.6em 0.8em;
  border-top: 1px solid var(--line);
  background: rgba(var(--fg-rgb), 0.04);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.4em;
  flex-wrap: wrap;
}

.modal-action,
.modal-nav-btn {
  padding: 0.3em 0.6em;
  font-size: 0.68em;
}

.modal-action.primary {
  border-color: var(--fg);
  background: rgba(var(--fg-rgb), 0.14);
  color: var(--fg-bright);
}

.modal-nav {
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin-left: auto;
}

body.modal-open {
  overflow: hidden;
}

@keyframes media-sweep {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(720%);
  }
}

@keyframes hud-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.988);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1000px) {
  .hud-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .project-modal {
    align-items: stretch;
    padding: 0;
  }

  .modal-frame {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
  }

  .modal-body {
    grid-template-columns: 1fr;
    padding: 0.8rem;
  }

  .modal-info-col {
    padding-bottom: 0.5rem;
  }

  .modal-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-action {
    width: 100%;
  }

  .modal-nav {
    justify-content: space-between;
    margin-left: 0;
  }

  .modal-nav-btn {
    flex: 1 1 0;
  }
}

@media (max-width: 700px) {
  .hud-grid {
    grid-template-columns: 1fr;
  }

  .deck-hint {
    display: none;
  }
}

@media (max-width: 620px) {
  .project-deck {
    margin-left: -4px;
    margin-right: -4px;
  }

  .hud-grid {
    gap: 0.55rem;
    padding: 0.55rem;
  }

  .deck-head,
  .deck-foot {
    font-size: 0.5em;
    padding: 0.5em 0.6em;
  }

  .deck-meta {
    display: none;
  }

  .hud-title {
    font-size: 0.86em;
  }

  .modal-head {
    padding: 0.5em 0.6em;
    font-size: 0.58em;
  }

  .modal-coord,
  .modal-chip {
    display: none;
  }

  .modal-close {
    font-size: 1em;
  }

  .modal-body {
    gap: 0.8rem;
    padding: 0.65rem;
  }

  .modal-title {
    font-size: 1.08em;
  }

  .modal-summary {
    font-size: 0.76em;
  }

  .modal-foot {
    padding: 0.55em 0.65em;
  }

  .modal-action,
  .modal-nav-btn {
    font-size: 0.6em;
  }

  .media-note {
    font-size: 0.62em;
  }
}

@media (hover: none) {
  .media-cta {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
