/* ==========================================================
   REFUGIO · base: paleta, tipografía, CRT y componentes comunes
   ========================================================== */
:root {
  --bg: #07090c;
  --bg-2: #0b0f13;
  --panel: #0f151a;
  --panel-2: #141c22;
  --line: #22303a;
  --line-2: #2f4250;
  --text: #cfe6d4;
  --dim: #6f8a7a;
  --faint: #3d5048;
  --amber: #ffb000;
  --amber-dim: #8a5f00;
  --neon: #39ff14;
  --neon-dim: #1d7a0c;
  --red: #ff3b3b;
  --red-dim: #7a1515;
  --grey: #5d6b73;

  --font-pixel: "Press Start 2P", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --font-mono: "VT323", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --px: 4px;                 /* unidad "pixel" */
  --radius: 0;
  --gutter: 16px;
  --shadow-pixel:
    0 calc(var(--px) * -1) 0 0 var(--line),
    0 var(--px) 0 0 var(--line),
    calc(var(--px) * -1) 0 0 0 var(--line),
    var(--px) 0 0 0 var(--line);
  color-scheme: dark;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0%, #0f1a14 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 21px;
  line-height: 1.2;
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
}

/* Scanlines + viñeta CRT (no interceptan clics) */
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}
body::before {
  background: repeating-linear-gradient(
    to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px, rgba(0, 0, 0, 0) 4px);
}
body::after {
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 {
  font-family: var(--font-pixel);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.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;
}

.dim { color: var(--dim); }
.amber { color: var(--amber); }
.neon { color: var(--neon); }
.hidden { display: none !important; }

/* ---------- Botones ---------- */
.btn {
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--panel-2);
  border: 2px solid var(--line-2);
  padding: 9px 12px;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}
.btn:hover { border-color: var(--amber); color: var(--amber); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-primary { background: var(--amber); color: #120c00; border-color: var(--amber); }
.btn-primary:hover { background: #ffc233; color: #120c00; }
.btn[aria-pressed="true"] { color: var(--neon); border-color: var(--neon-dim); }

kbd {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--amber);
  border: 1px solid var(--amber-dim);
  border-bottom-width: 3px;
  padding: 3px 5px 2px;
  background: #1a1404;
  white-space: nowrap;
}

/* ---------- LED / semáforo ---------- */
.led {
  --c: var(--grey);
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  background: var(--c);
  box-shadow: 0 0 0 2px #000, 0 0 10px 1px var(--c);
}
.led.green { --c: var(--neon); }
.led.amber { --c: var(--amber); }
.led.red { --c: var(--red); animation: blink 1s steps(2, start) infinite; }
.led.unknown { --c: var(--grey); box-shadow: 0 0 0 2px #000; }

@keyframes blink { to { visibility: hidden; } }

.tag {
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 4px 6px 3px;
  border: 1px solid currentColor;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tag.green { color: var(--neon); }
.tag.amber { color: var(--amber); }
.tag.red { color: var(--red); }
.tag.unknown { color: var(--grey); }

/* ---------- Panel genérico ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 2px solid var(--line);
  box-shadow: inset 0 0 0 2px #000, 0 0 0 2px #000;
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: var(--gutter);
}
.login {
  width: min(420px, 100%);
  padding: 28px 24px 24px;
}
.login h1 { font-size: 16px; color: var(--amber); line-height: 1.6; }
.login .sub { color: var(--dim); margin: 8px 0 22px; }
.login label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--dim);
  margin: 14px 0 6px;
  text-transform: uppercase;
}
.input {
  width: 100%;
  font: inherit;
  color: var(--neon);
  background: #050806;
  border: 2px solid var(--line-2);
  padding: 8px 10px;
  caret-color: var(--neon);
}
.input:focus { border-color: var(--neon-dim); outline: none; box-shadow: 0 0 0 2px var(--neon-dim); }
.login .btn { width: 100%; justify-content: center; margin-top: 22px; min-height: 44px; }
.login .error { color: var(--red); min-height: 1.2em; margin-top: 12px; }
.cursor::after {
  content: "_";
  animation: blink 1s steps(2, start) infinite;
  color: var(--neon);
}
