/* ==========================================================================
   CrowdScreen — base
   Noche, cristal y luz. El neón solo aparece donde hay acción o estado activo.
   ========================================================================== */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/assets/fonts/inter-latin-var.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/assets/fonts/inter-latinext-var.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url(/assets/fonts/poppins-latin-600.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url(/assets/fonts/poppins-latin-ext-600.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20C0; }
@font-face { font-family: "Poppins"; font-weight: 800; font-display: swap; src: url(/assets/fonts/poppins-latin-800.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Poppins"; font-weight: 800; font-display: swap; src: url(/assets/fonts/poppins-latin-ext-800.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20C0; }

:root {
  /* superficie */
  --onyx: #0B0C10;
  --onyx-2: #111219;
  --onyx-3: #171923;
  --line: rgba(255, 255, 255, .075);
  --line-strong: rgba(255, 255, 255, .14);
  --glass: rgba(255, 255, 255, .045);
  --glass-strong: rgba(255, 255, 255, .075);
  --glass-blur: blur(18px) saturate(140%);

  /* tinta */
  --ink: #F3F4F8;
  --ink-2: rgba(243, 244, 248, .68);
  --ink-3: rgba(243, 244, 248, .42);

  /* acento: solo acción y estado activo */
  --cyan: #00E5FF;
  --violet: #B100FF;
  --cyan-glow: 0 0 0 1px rgba(0, 229, 255, .55), 0 0 22px rgba(0, 229, 255, .38), 0 0 64px rgba(0, 229, 255, .16);
  --violet-glow: 0 0 0 1px rgba(177, 0, 255, .55), 0 0 22px rgba(177, 0, 255, .36), 0 0 64px rgba(177, 0, 255, .16);
  --spectrum: linear-gradient(100deg, var(--cyan) 0%, #6A7BFF 48%, var(--violet) 100%);
  --coral: #FF5470;

  /* forma */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --font-display: "Poppins", "Inter", system-ui, sans-serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--onyx);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-ui);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Grano de película + dos fugas de luz: profundidad sin ruido visual. */
.atmo { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.atmo::before, .atmo::after {
  content: ""; position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%;
  filter: blur(90px); opacity: .22;
}
.atmo::before { background: radial-gradient(circle, var(--cyan), transparent 62%); top: -38vmax; left: -28vmax; }
.atmo::after { background: radial-gradient(circle, var(--violet), transparent 62%); bottom: -42vmax; right: -30vmax; opacity: .18; }
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: .055; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.page { position: relative; z-index: 2; }

/* ── Tipografía ─────────────────────────────────────────────────────────── */
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; margin: 0; }
h1 { font-size: clamp(34px, 9vw, 64px); }
h2 { font-size: clamp(24px, 5.4vw, 34px); }
h3 { font-size: 19px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0; }
.kicker {
  font: 600 11px/1.45 var(--font-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3);
  display: inline-flex; align-items: baseline; gap: 10px;
}
.kicker::before { content: ""; flex: none; width: 18px; height: 1px; background: currentColor; align-self: center; }
.stack > .kicker + h1, .stack > .kicker + h2 { margin-top: 4px; }
.lede { color: var(--ink-2); font-size: 16px; max-width: 46ch; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.grad-text { background: var(--spectrum); -webkit-background-clip: text; background-clip: text; color: transparent; }
a { color: var(--ink); text-decoration-color: rgba(0, 229, 255, .5); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--cyan); }
::selection { background: rgba(0, 229, 255, .3); }

/* ── Cristal ────────────────────────────────────────────────────────────── */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.025));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 30px 60px -30px rgba(0,0,0,.7);
}

/* ── Botones ────────────────────────────────────────────────────────────── */
.btn {
  --h: 52px;
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding: 0 22px; border-radius: 999px;
  font: 600 15px/1 var(--font-ui); letter-spacing: -.005em; color: var(--ink);
  transition: transform .25s var(--ease), box-shadow .3s var(--ease), background .3s var(--ease), opacity .2s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-block { width: 100%; }
.btn-sm { --h: 40px; padding: 0 16px; font-size: 14px; }

.btn-primary { background: var(--cyan); color: #00161A; }
.btn-primary:hover, .btn-primary:focus-visible { box-shadow: var(--cyan-glow); }

/* borde espectral sobre cristal */
.btn-ghost {
  background: linear-gradient(var(--onyx-2), var(--onyx-2)) padding-box, var(--spectrum) border-box;
  border: 1px solid transparent;
}
.btn-ghost:hover, .btn-ghost:focus-visible { box-shadow: 0 0 24px rgba(106, 123, 255, .35); }
.btn-quiet { background: var(--glass); border: 1px solid var(--line); }
.btn-quiet:hover { background: var(--glass-strong); }
.btn-danger { background: transparent; border: 1px solid rgba(255, 84, 112, .5); color: #FF8A9C; }
.btn-danger:hover { background: rgba(255, 84, 112, .1); box-shadow: 0 0 22px rgba(255, 84, 112, .25); }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.btn:focus-visible { outline: none; }

/* ── Formularios ────────────────────────────────────────────────────────── */
.field { display: grid; gap: 8px; }
.field > span, .label { font: 500 13px/1 var(--font-ui); color: var(--ink-2); }
.input, .textarea, .select {
  width: 100%; min-height: 52px; padding: 14px 16px;
  background: rgba(255,255,255,.035); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  font: 400 16px/1.4 var(--font-ui);
  transition: border-color .2s, box-shadow .25s var(--ease), background .2s;
}
.textarea { min-height: 112px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: rgba(0, 229, 255, .7); background: rgba(0, 229, 255, .04);
  box-shadow: 0 0 0 4px rgba(0, 229, 255, .1), 0 0 30px rgba(0, 229, 255, .12);
}
.input-code { text-align: center; font: 600 28px/1 var(--font-display); letter-spacing: .4em; padding-left: .4em; }
.hint { font-size: 12.5px; color: var(--ink-3); }
.counter { font: 500 12px/1 var(--font-ui); color: var(--ink-3); font-variant-numeric: tabular-nums; justify-self: end; }
.counter.is-near { color: var(--cyan); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch i { width: 44px; height: 26px; border-radius: 99px; background: var(--glass-strong); border: 1px solid var(--line-strong); position: relative; transition: background .25s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink-2); transition: transform .3s var(--ease), background .3s; }
.switch input:checked + i { background: rgba(0, 229, 255, .18); border-color: rgba(0, 229, 255, .6); box-shadow: 0 0 18px rgba(0, 229, 255, .25); }
.switch input:checked + i::after { transform: translateX(18px); background: var(--cyan); }
.switch input:focus-visible + i { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ── Avisos ─────────────────────────────────────────────────────────────── */
.flash { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); font-size: 14px; border: 1px solid var(--line); background: var(--glass); }
.flash::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; }
.flash-ok::before { background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.flash-error { border-color: rgba(255, 84, 112, .35); }
.flash-error::before { background: var(--coral); box-shadow: 0 0 12px var(--coral); }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, calc(100% + 60px)); visibility: hidden;
  transition: transform .45s var(--ease-out), visibility 0s .45s;
  max-width: min(92vw, 420px);
}
.toast.is-on { transform: translate(-50%, 0); visibility: visible; transition: transform .45s var(--ease-out); }

/* ── Utilidades ─────────────────────────────────────────────────────────── */
.stack { display: grid; gap: var(--gap, 16px); }
.row { display: flex; gap: var(--gap, 12px); align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.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; }
.hidden, [hidden] { display: none !important; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); display: inline-block; flex: none; }
.dot.is-live { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: pulse 2s var(--ease) infinite; }
.dot.is-warn { background: var(--violet); box-shadow: 0 0 10px var(--violet); }
.dot.is-off { background: var(--coral); }
@keyframes pulse { 50% { opacity: .45; } }

.logo { display: inline-flex; align-items: center; gap: 10px; font: 800 17px/1 var(--font-display); letter-spacing: -.03em; color: var(--ink); text-decoration: none; }
.logo svg { width: 26px; height: 26px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .grain { animation: none; }
}
.tight { --gap: 4px; }
