/* ==========================================================
   Chispa · identidad visual
   Paleta: rosa mexicano, naranja y ámbar sobre noche violeta.
   Tipografías: Bricolage Grotesque (títulos) y Figtree (texto),
   ambas con licencia SIL OFL, servidas desde /fonts.
   ========================================================== */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree.woff2") format("woff2");
  font-weight: 300 900; font-style: normal; font-display: swap;
}

:root {
  /* Marca (no cambian con el tema) */
  --rosa: #FF2D87;
  --naranja: #FF7A1A;
  --ambar: #FFC53D;
  --violeta: #7B2FF7;
  --grad: linear-gradient(120deg, #F0167A 0%, #FF4F4F 55%, #FF7A1A 100%);
  --grad-spark: linear-gradient(100deg, var(--rosa), var(--naranja) 60%, var(--ambar));
  --heading-grad: var(--grad-spark);
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Tema oscuro (por defecto) */
  --bg: #0F0A1F;
  --bg-2: #160F2C;
  --surface: #1D1538;
  --surface-2: #2A2050;
  --surface-3: #352A63;
  --border: #33295A;
  --text: #F7F3FF;
  --text-2: #D9D2EE;
  --muted: #A99FC8;
  --accent: var(--rosa);
  --accent-2: var(--naranja);
  --accent-text: #10091D;
  --link: #FF8CBF;
  --danger: #F0475A;
  --danger-text: #FF9AA6;
  --ok: #3DDC97;
  --mark-star: #FFFFFF;
  --spark-dot: var(--ambar);
  --card: rgba(29, 21, 56, .82);
  --glow-1: rgba(255, 45, 135, .22);
  --glow-2: rgba(255, 122, 26, .14);
  --glow-3: rgba(123, 47, 247, .22);
  --radius: 18px;
  --shadow: 0 18px 50px rgba(5, 2, 15, .55);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not(.force-dark) {
    --bg: #FFF7F0;
    --bg-2: #FFFFFF;
    --surface: #FFFFFF;
    --surface-2: #F7EEF6;
    --surface-3: #EFE2EE;
    --border: #EBDDE7;
    --text: #1A1033;
    --text-2: #3B3157;
    --muted: #6D6287;
    --accent: #E8137A;
    --heading-grad: linear-gradient(100deg, #CC105F, #B74708 60%, #91620D);
    --link: #D10F6C;
    --danger: #D92D47;
    --danger-text: #C21F3A;
    --ok: #12A56A;
    --mark-star: var(--naranja);
    --spark-dot: var(--naranja);
    --card: rgba(255, 255, 255, .9);
    --glow-1: rgba(255, 45, 135, .16);
    --glow-2: rgba(255, 197, 61, .22);
    --glow-3: rgba(123, 47, 247, .10);
    --shadow: 0 18px 50px rgba(74, 28, 74, .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.025em; }
[hidden] { display: none !important; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
kbd {
  font: 600 11px/1 ui-monospace, monospace;
  padding: 3px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .22);
  margin-left: 6px;
}
::selection { background: rgba(255, 45, 135, .3); }

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-mark { width: 34px; height: 34px; flex: none; color: var(--mark-star); }
.brand-word { height: 30px; width: auto; display: block; }
.brand-word .spark-dot { fill: var(--spark-dot); }
.brand-sub {
  margin-left: 4px; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--border); background: var(--surface);
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease, background .15s ease, box-shadow .2s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 22px; height: 22px; fill: currentColor; }
.btn-primary {
  background: var(--grad); border-color: transparent; color: var(--accent-text);
  box-shadow: 0 8px 24px -8px rgba(240, 22, 122, .7);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 30px -6px rgba(240, 22, 122, .8); }
.btn-primary:disabled { box-shadow: none; }
.btn-danger { background: #BD2445; border-color: transparent; color: #fff; }
.btn-lg { padding: 16px 22px; font-size: 17px; width: 100%; border-radius: 16px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }

/* ---------- Inicio ---------- */
.landing {
  min-height: 100%;
  display: flex; flex-direction: column;
  background:
    radial-gradient(800px 520px at 88% -8%, var(--glow-1), transparent 62%),
    radial-gradient(640px 420px at 6% 18%, var(--glow-3), transparent 62%),
    radial-gradient(700px 420px at 40% 112%, var(--glow-2), transparent 62%),
    var(--bg);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; max-width: 1160px; margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 40px);
}
.online-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 14px; color: var(--muted); white-space: nowrap;
}
.online-pill #onlineCount { color: var(--text); font-weight: 800; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, .6); } 100% { box-shadow: 0 0 0 9px rgba(61, 220, 151, 0); } }

.hero {
  flex: 1;
  width: 100%; max-width: 560px;
  margin: 0 auto;
  padding: clamp(12px, 4vh, 40px) 16px 32px;
  display: grid; gap: 24px;
  grid-template-areas: "copy" "form" "feat";
}
.hero-copy { grid-area: copy; }
.hero-art { grid-area: art; display: none; }
.start-card { grid-area: form; }
.features { grid-area: feat; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 14px; padding: 6px 12px 6px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
}
.eyebrow-spark {
  width: 14px; height: 14px; flex: none; background: var(--grad-spark);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
.hero h1 { font-size: clamp(36px, 7vw, 64px); line-height: 1.02; font-weight: 800; letter-spacing: -.035em; margin: 0 0 16px; }
.hl {
  background: var(--heading-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hero-sub { color: var(--muted); font-size: 18px; margin: 0; max-width: 34em; }

.art { width: 100%; height: auto; display: block; overflow: visible; }
.art-bubble rect { fill: var(--surface); stroke: var(--border); }
.art-bubble text { font: 700 14px var(--font-body); fill: var(--text); }
.art-bubble:first-of-type { animation: float 5s ease-in-out infinite; }
.art-bubble:last-of-type { animation: float 5s ease-in-out 1.2s infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }

.start-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.field-label { font-weight: 700; display: block; margin-bottom: 8px; }
.optional { color: var(--muted); font-weight: 400; }
.tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px; min-height: 48px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-2);
  cursor: text;
}
.tags:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 45, 135, .15); }
.tags input { flex: 1; min-width: 120px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; padding: 4px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 6px 4px 11px; border-radius: 999px;
  background: rgba(255, 45, 135, .14); color: var(--text); font-size: 14px; font-weight: 600;
  border: 1px solid rgba(255, 45, 135, .35);
}
.tag button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.check a, .center-card a, .dialog a { color: var(--link); text-underline-offset: 2px; }
#startBtn { margin-top: 8px; }
.monitor-note { margin: 14px 0 0; border-top: 1px solid var(--border); color: var(--text-2); font-size: 14px; }
.monitor-note summary { padding: 12px 0 2px; cursor: pointer; font-weight: 600; }
.monitor-note p { margin: 10px 0 0; line-height: 1.6; }
.monitor-note a { color: var(--link); text-underline-offset: 3px; }
.start-card .btn-primary:disabled { opacity: 1; background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.seg-field { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--border); }
.seg label { flex: 1; min-width: 90px; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 8px 10px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--muted);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.seg label:hover span { color: var(--text); }
.seg input:checked + span { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-note { margin-top: -4px; }

/* ---------- Premium ---------- */
:root { --gold: #F5B027; --gold-2: #FFD66B; }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #2A1A00; border-color: transparent; box-shadow: 0 8px 24px -10px rgba(245, 176, 39, .8); }
.premium-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font: 800 13px/1.6 var(--font-body); color: #2A1A00; background: linear-gradient(135deg, var(--gold), var(--gold-2)); }
.filters-box { margin-top: 4px; }
.filters-box .seg-field { margin-bottom: 8px; }
.filters-box .filter-note { margin: 0; }
/* Sin Premium: se ve, pero al tocarlo se abre Premium. */
.filters-box.locked .seg, .toggle.locked input { opacity: .45; filter: grayscale(1); }
.filters-box.locked, .toggle.locked { cursor: pointer; }
.filters-box.locked .seg label { pointer-events: none; }
.premium-state { font-size: 13px; color: var(--muted); }
.premium-state button { font: inherit; background: none; border: 0; color: var(--gold); text-decoration: underline; cursor: pointer; padding: 0; }
.premium-dialog h2 { margin-bottom: 10px; }
.price { font: 800 22px/1.3 var(--font-display); margin: 4px 0 14px !important; }
.small { font-size: 13px; }
.inline-form { margin-top: 18px; }
.inline-form .row { display: flex; gap: 8px; }
.text-input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit; text-transform: uppercase; }
.text-input:focus { outline: 0; border-color: var(--accent); }
.recovery-key { font: 700 20px/1.3 ui-monospace, monospace; letter-spacing: .06em; text-align: center; padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px dashed var(--gold); user-select: all; overflow-wrap: anywhere; }
#premiumMsg.ok { color: var(--ok); }
.form-error { color: var(--danger-text); font-size: 14px; margin: 12px 0 0; }

.features { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 12px; color: var(--muted); font-size: 15px; }
.features li { display: flex; gap: 12px; align-items: flex-start; }
.features svg {
  width: 36px; height: 36px; flex: none; padding: 8px; border-radius: 11px;
  fill: #fff; background: var(--grad);
}
.features li:nth-child(2) svg { background: linear-gradient(135deg, var(--naranja), var(--ambar)); }
.features li:nth-child(3) svg { background: linear-gradient(135deg, var(--violeta), var(--rosa)); }
.features span { padding-top: 6px; }
.features strong { color: var(--text); }
.footer { display: flex; gap: 20px; justify-content: center; padding: 24px; font-size: 14px; color: var(--muted); }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

@media (min-width: 980px) {
  .hero {
    max-width: 1160px;
    padding: clamp(16px, 5vh, 56px) clamp(24px, 4vw, 40px) 40px;
    grid-template-columns: minmax(0, 1.1fr) minmax(400px, 480px);
    grid-template-areas: "copy form" "art form" "feat form";
    grid-template-rows: auto auto 1fr;
    column-gap: clamp(32px, 5vw, 72px);
    align-items: start;
  }
  .hero-art { display: block; max-width: 520px; }
  .start-card { position: sticky; top: 24px; }
}

/* ---------- Sala (siempre en oscuro: el video se ve mejor) ---------- */
.room {
  --bg: #0F0A1F; --bg-2: #160F2C; --surface: #1D1538; --surface-2: #2A2050; --surface-3: #352A63;
  --border: #33295A; --text: #F7F3FF; --text-2: #D9D2EE; --muted: #A99FC8; --accent: var(--rosa);
  --danger: #F0475A; --danger-text: #FF9AA6; --ok: #3DDC97;
  color-scheme: dark;
  color: var(--text);
  background: var(--bg);
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 12px;
  padding: 12px;
}
.stage { position: relative; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.remote {
  position: relative; flex: 1; min-height: 0;
  border-radius: 22px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #241a45, #0b0717);
}
.remote video, .local video { width: 100%; height: 100%; object-fit: cover; display: block; }
.remote video { object-fit: contain; background: #000; }
.stage-status {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  color: var(--text-2); font-size: 18px; text-align: center; padding: 24px;
  background:
    radial-gradient(500px 320px at 50% 42%, rgba(255, 45, 135, .16), transparent 70%),
    radial-gradient(circle at 50% 40%, #241a45, #0b0717);
}
.stage-status p { margin: 0; max-width: 520px; line-height: 1.45; }
.wait-box { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(560px, 100%); }
.wait-card {
  width: min(440px, 100%); padding: 16px 18px; border-radius: 16px; text-align: left;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1);
}
.wait-card.enter { animation: wait-in .4s ease; }
.wait-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ambar); margin-bottom: 6px; }
.wait-card .wait-tip { margin: 0; font-size: 16px; color: var(--text); line-height: 1.45; max-width: none; }
.wait-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.wait-more, .wait-link {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--rosa); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.wait-more { font-size: 14px; }
.wait-hint { margin: 0; font-size: 14px; color: var(--text-2); }
.widen-note {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: min(440px, 100%); padding: 10px 14px; border-radius: 12px;
  font-size: 14px; color: var(--text-2);
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1);
}
.widen-note.active { background: rgba(255, 197, 61, .1); border-color: rgba(255, 197, 61, .35); color: var(--text); animation: wait-in .4s ease; }
.widen-note p { margin: 0; font-size: 14px; }
.widen-note .wait-link { font-size: 14px; }
@keyframes wait-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Minijuego «Atrapa la chispa» */
.stage-status.playing { gap: 10px; justify-content: center; }
.stage-status.playing .spinner { width: 40px; height: 40px; }
.stage-status.playing #stageText { font-size: 16px; }
.game {
  width: 100%; border-radius: 18px; overflow: hidden; text-align: left;
  background: radial-gradient(120% 90% at 50% 0%, rgba(255, 45, 135, .12), transparent 60%), rgba(11, 7, 23, .72);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.game-hud { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.game-score { display: flex; align-items: baseline; gap: 8px; min-width: 70px; font-family: Bricolage, Figtree, system-ui, sans-serif; font-weight: 800; font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.game-combo { font-size: 14px; font-weight: 800; color: #1a1030; background: var(--ambar); padding: 1px 7px; border-radius: 999px; }
.game-combo.pop { animation: combo-pop .35s ease; }
@keyframes combo-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.game-lives { display: flex; gap: 3px; flex: 1; justify-content: center; }
.game-lives .life svg { width: 18px; height: 18px; display: block; fill: var(--rosa); filter: drop-shadow(0 0 4px rgba(255, 45, 135, .7)); transition: transform .2s, opacity .2s; }
.game-lives .life.lost svg { fill: rgba(255, 255, 255, .18); filter: none; transform: scale(.8); }
.game-tools { display: flex; gap: 4px; }
.game-icon {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgba(255, 255, 255, .07); color: var(--text-2);
}
.game-icon:hover { background: rgba(255, 255, 255, .14); color: var(--text); }
.game-icon svg { width: 18px; height: 18px; fill: currentColor; }
.game-icon .off, .game-icon[aria-pressed="false"] .on { display: none; }
.game-icon[aria-pressed="false"] .off { display: block; }
.game-field { position: relative; height: clamp(230px, 42vh, 360px); }
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.game-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; text-align: center; background: rgba(11, 7, 23, .66); backdrop-filter: blur(3px);
}
.game-overlay[hidden] { display: none; }
.game-title { margin: 0; font-family: Bricolage, Figtree, system-ui, sans-serif; font-size: 26px; font-weight: 800; color: var(--text);
  background: linear-gradient(90deg, var(--rosa), var(--ambar)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.game-overlay .game-text { margin: 0; max-width: 340px; font-size: 15px; color: var(--text-2); }
.game-overlay .game-best { margin: 0; font-size: 14px; font-weight: 700; color: var(--ambar); }
.game-open svg { width: 18px; height: 18px; }
@media (max-width: 700px) {
  .wait-card .wait-tip { font-size: 15px; }
  .wait-box { gap: 10px; }
  .stage-status.playing { padding: 12px; justify-content: flex-end; padding-bottom: 96px; }
  .stage-status.playing .spinner { width: 32px; height: 32px; }
  .stage-status.playing #stageText { font-size: 15px; }
  .game-field { height: clamp(220px, 46vh, 380px); }
}
@media (prefers-reduced-motion: reduce) { .wait-card.enter, .widen-note.active, .game-combo.pop { animation: none; } }
.spinner { width: 76px; height: 76px; }
.spinner svg { width: 100%; height: 100%; display: block; overflow: visible; }
.spinner path { fill: none; stroke-width: 8; stroke-linecap: round; transform-origin: 32px 32px; }
.spinner .sp-l { stroke: var(--rosa); animation: meet-l 1.6s ease-in-out infinite; }
.spinner .sp-r { stroke: var(--ambar); animation: meet-r 1.6s ease-in-out infinite; }
.spinner .sp-s { fill: #fff; stroke: none; animation: spark 1.6s ease-in-out infinite; }
@keyframes meet-l { 0%, 100% { transform: translateX(-7px); } 50% { transform: translateX(0); } }
@keyframes meet-r { 0%, 100% { transform: translateX(7px); } 50% { transform: translateX(0); } }
@keyframes spark { 0%, 100% { transform: scale(.35) rotate(0); opacity: .5; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }
.badges { position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.shared-badge {
  padding: 6px 12px; border-radius: 999px;
  background: rgba(15, 10, 31, .6); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .12);
  font-size: 14px; font-weight: 600;
}
.local {
  position: absolute; right: 16px; top: 16px;
  width: clamp(120px, 20%, 240px); aspect-ratio: 4 / 3;
  border-radius: 16px; overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .18);
  background: #000; box-shadow: var(--shadow);
  z-index: 2;
}
.local video { transform: scaleX(-1); }
.local.no-mirror video { transform: none; }
.cam-off { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); background: #140e26; }

.controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--border);
}
.ctl {
  position: relative;
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: background .15s ease, transform .08s ease;
}
.ctl:hover:not(:disabled) { background: var(--surface-3); }
.ctl:active:not(:disabled) { transform: scale(.94); }
.ctl:disabled { opacity: .4; cursor: not-allowed; }
.ctl svg { width: 22px; height: 22px; fill: currentColor; }
.ctl .off { display: none; }
.ctl[aria-pressed="false"] { background: var(--danger); border-color: transparent; }
.ctl[aria-pressed="false"] .on { display: none; }
.ctl[aria-pressed="false"] .off { display: block; }
.ctl-danger { color: var(--danger-text); }
.next-btn { margin-left: auto; padding: 12px 28px; font-size: 16px; border-radius: 999px; }
.badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--rosa); color: #fff; font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}

.chat-panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  overflow: hidden;
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); font: 800 17px var(--font-display); }
.icon-btn { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 8px 13px; border-radius: 16px; overflow-wrap: anywhere; white-space: pre-wrap; animation: pop .15s ease; }
.msg.me { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 5px; }
.msg.them { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 5px; }
.msg.system { align-self: center; max-width: 100%; text-align: center; color: var(--muted); font-size: 13px; background: none; padding: 2px 8px; }
@keyframes pop { from { transform: translateY(4px); opacity: 0; } }
.typing { padding: 0 16px 6px; font-size: 13px; color: var(--muted); font-style: italic; }
.msg-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.msg-form input {
  flex: 1; min-width: 0;
  padding: 11px 14px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit;
}
.msg-form input:focus { outline: 0; border-color: var(--accent); }
.safety-tip { margin: 0; padding: 0 12px 12px; font-size: 12px; color: var(--muted); }

/* ---------- Diálogos ---------- */
.dialog {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border); border-radius: 24px;
  background: var(--surface); color: var(--text);
  padding: 24px; box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(10, 5, 25, .6); backdrop-filter: blur(4px); }
.dialog h2 { margin: 0 0 6px; font-size: 22px; }
.dialog p { margin: 0 0 14px; font-size: 14px; }
.reasons { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.reasons label { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); cursor: pointer; }
.reasons label:has(input:checked) { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.reasons input { accent-color: var(--danger); }
.dialog textarea {
  width: 100%; resize: vertical;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit;
}
.report-preview { display: block; width: 120px; border-radius: 10px; margin-top: 10px; filter: blur(6px); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.dialog-actions .btn { min-height: 44px; }
.text-input:focus-visible, .msg-form input:focus-visible, .select:focus-visible, .dialog textarea:focus-visible {
  outline: 3px solid var(--link); outline-offset: 2px;
}

/* ---------- Preferencias y ajustes ---------- */
.round-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
}
.round-btn:hover { color: var(--text); background: var(--surface-2); }
.round-btn svg, .btn-sm svg { width: 20px; height: 20px; fill: currentColor; }
.topbar-end { display: flex; align-items: center; gap: 10px; }
.btn-sm { padding: 7px 14px; font-size: 14px; gap: 6px; }
.btn-sm svg { width: 17px; height: 17px; }
.prefs-summary { padding: 12px 14px; margin-bottom: 16px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--border); }
.prefs-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.prefs-head .field-label { margin: 0; }
.prefs-text { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; font-size: 14px; color: var(--text-2); }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.summary-person { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 36px; flex: none; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--text); }
.summary-person .ico { width: 23px; height: 23px; }
.summary-arrow { color: var(--muted); }
.summary-detail { min-width: 0; overflow-wrap: anywhere; }
.summary-detail::before { content: '·'; margin-right: 8px; color: var(--muted); }
.prefs-summary .hint { margin: 4px 0 0; }

.settings-dialog { width: min(600px, calc(100% - 24px)); padding: 18px; }
.settings-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.settings-dialog h2 { margin: 0; font-size: 20px; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-sm .ico { fill: none; }
.settings-sections { display: grid; gap: 12px; }
.settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.settings-footer .hint { margin: 0; }
.settings-footer .btn { flex: none; min-height: 44px; }
.settings-footer .wait-link { text-align: left; }
.set-card { padding: 14px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--border); }
.set-title {
  margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
  font: 800 12px/1.4 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2);
}
.set-card .seg { background: var(--surface); }
.seg-icons span { position: relative; display: flex; justify-content: center; align-items: center; min-height: 64px; padding: 14px 10px; }
.seg-icons .ico { width: 30px; height: 30px; stroke-width: 1.8; }
.seg-icons input:checked + span::after { content: ''; position: absolute; top: 8px; right: 10px; width: 5px; height: 9px; border: solid currentColor; border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); }
.seg-icons label { min-width: 0; }
.field-label .premium-tag { margin-left: 6px; font-size: 11px; padding: 1px 8px; vertical-align: 1px; }
.interests-card { background: linear-gradient(135deg, color-mix(in srgb, var(--violeta) 16%, var(--bg-2)), color-mix(in srgb, var(--rosa) 10%, var(--bg-2))); border-color: color-mix(in srgb, var(--violeta) 45%, var(--border)); }
.interests-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.interests-head label { font-size: 15px; }
.count-pill { flex: none; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--surface); border: 1px solid var(--border); }
.interests-card .tags { background: var(--surface); }
.toggles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
.toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  font-size: 14px; cursor: pointer;
}
.toggle[hidden] { display: none; }
.toggle-text small { color: var(--muted); }
.toggle .premium-tag { font-size: 11px; padding: 0 7px; }
.toggle input {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0;
  width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3); cursor: pointer;
  transition: background .15s ease;
}
.toggle input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s ease;
}
.toggle input:checked { background: var(--grad); }
.toggle input:checked::after { transform: translateX(18px); }
.toggle input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.select {
  width: 100%; margin-bottom: 12px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.select:focus { outline: 0; border-color: var(--accent); }
.premium-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 2px; }
.premium-bar[hidden] { display: none; }

/* Confirmación de Salir / Siguiente: el botón queda "armado" unos segundos. */
.armed { box-shadow: 0 0 0 3px var(--ambar), 0 0 24px rgba(255, 197, 61, .6) !important; animation: armed 1s ease-in-out infinite; }
@keyframes armed { 50% { box-shadow: 0 0 0 5px var(--ambar), 0 0 30px rgba(255, 197, 61, .8); } }

/* ---------- Otros ---------- */
.center-card {
  max-width: 480px; margin: 12vh auto; padding: 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.center-card h1 { margin-top: 0; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px;
  background: #1A1033; color: #F7F3FF; border: 1px solid #33295A;
  font-size: 14px; font-weight: 600; z-index: 50; box-shadow: var(--shadow);
}
.toast { pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
/* En la sala el aviso va por encima de los botones para no taparlos. */
body:has(#room:not([hidden])) .toast { bottom: 110px; }
.only-mobile { display: none; }

/* ---------- Móvil ---------- */
@media (max-width: 979px) {
  .hero { padding-top: 12px; gap: 18px; }
  .hero h1 { font-size: clamp(34px, 8vw, 52px); line-height: 1.06; margin-bottom: 12px; text-wrap: balance; }
  .hero-sub { font-size: 16px; line-height: 1.5; }
  .eyebrow { margin-bottom: 12px; }
  .start-card { padding: 18px; border-radius: 20px; }
  .prefs-summary { padding: 8px 12px; margin-bottom: 12px; }
  .prefs-head .btn { min-height: 40px; }
  .prefs-text { margin-top: 4px; line-height: 1.4; }
  .start-card .check { margin-bottom: 10px; line-height: 1.45; }
  .start-card .check:first-of-type { min-height: 32px; align-items: center; }
  .start-card .check input { width: 20px; height: 20px; margin-left: 0; }
  #startBtn { margin-top: 4px; min-height: 54px; padding-top: 12px; padding-bottom: 12px; }
  .features { margin-top: 0; }
}
@media (max-width: 480px) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 8px; }
  .topbar-end { gap: 6px; }
  .online-pill { font-size: 12px; gap: 5px; padding: 6px 8px; }
  .hero { padding-top: 8px; gap: 16px; }
  .eyebrow { font-size: 12px; padding: 5px 10px; }
  .dialog { width: calc(100% - 24px); padding: 18px; border-radius: 20px; }
  .dialog textarea, .dialog .text-input, .dialog .select, .tags input { font-size: 16px; }
  .dialog-actions .btn { flex: 1; }
  .inline-form .row { flex-wrap: wrap; }
  .inline-form .text-input { flex-basis: 100%; min-height: 46px; }
  .inline-form .row .btn { width: 100%; }
  .reasons label { min-height: 44px; }
  .set-card { padding: 12px; }
  .seg-icons span { padding: 10px 4px; }
  .footer { flex-wrap: wrap; gap: 12px 20px; }
}
@media (max-width: 820px) {
  .room { display: block; padding: 0; height: 100dvh; }
  .stage { height: 100%; gap: 0; }
  .remote { border-radius: 0; }
  .remote video { object-fit: cover; }
  .local { top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 28vw; aspect-ratio: 3 / 4; }
  .controls {
    position: absolute; left: 0; right: 0; bottom: 0;
    border-radius: 0; border: 0;
    padding: 12px 8px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, rgba(8, 4, 20, .88));
    justify-content: center;
    flex-wrap: nowrap;
    gap: 5px;
  }
  .ctl { width: 40px; height: 40px; flex: none; background: rgba(42, 32, 80, .78); backdrop-filter: blur(6px); }
  /* En el celular, Ajustes va arriba a la izquierda para que quepan los demás botones. */
  #settingsBtn { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 12px; z-index: 5; }
  .next-btn { margin-left: 4px; padding: 12px 14px; flex: none; }
  @media (max-width: 400px) {
    .controls { gap: 4px; padding-left: 6px; padding-right: 6px; }
    .ctl { width: 38px; height: 38px; }
    .ctl svg { width: 20px; height: 20px; }
    .next-btn { padding: 11px 12px; font-size: 15px; }
  }
  .next-btn kbd { display: none; }
  .only-mobile { display: grid; }
  .chat-head .only-mobile { display: block; }
  .chat-panel {
    position: fixed; left: 0; right: 0; bottom: 0; height: 60dvh;
    border-radius: 24px 24px 0 0; z-index: 10;
    transform: translateY(100%); transition: transform .25s ease;
    box-shadow: var(--shadow);
  }
  .chat-panel.open { transform: none; }
  .msg-form { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .brand-word { height: 26px; }
  .brand-mark { width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============ Texto para buscadores (inicio) ============ */
.seo { width: 100%; max-width: 1160px; margin: 0 auto; padding: 24px 16px 8px; color: var(--text-2); }
.seo h2 { font-size: clamp(22px, 3.2vw, 30px); font-weight: 800; letter-spacing: -.02em; color: var(--text); margin: 24px 0 10px; }
.seo h3 { font-size: 17px; color: var(--text); margin: 0 0 6px; }
.seo p { line-height: 1.6; margin: 0 0 12px; }
.seo-grid { display: grid; gap: 14px; margin: 18px 0 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.seo-grid > div { padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.seo-grid p { margin: 0; font-size: 15px; }
.seo details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.seo summary { cursor: pointer; font-weight: 700; color: var(--text); }
.seo details p { margin: 8px 0 0; }
.seo-more a { color: var(--link); }
.seo-disclaimer { font-size: 13px; color: var(--muted); }
@media (min-width: 980px) { .seo { padding: 32px clamp(24px, 4vw, 40px) 8px; } }

/* ============ Sin conexión ============ */
.offline { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 16px; text-align: center; }
.offline h1 { margin: 8px 0 0; font-size: 28px; }
.offline p { max-width: 360px; color: var(--text-2); margin: 0 0 8px; }
.offline .btn { text-decoration: none; }

/* ---------- Selector de idioma (ES/EN) ---------- */
.lang-switch, .legal nav.lang-switch {
  display: inline-flex; align-items: center; gap: 2px; flex: none;
  padding: 3px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; font-weight: 800; letter-spacing: .02em;
}
.lang-switch > * { display: grid; place-items: center; min-width: 34px; height: 30px; padding: 0 8px; border-radius: 999px; }
.lang-switch a, .legal .lang-switch a:not(.brand) { color: var(--muted); text-decoration: none; }
.lang-switch a:hover, .legal .lang-switch a:not(.brand):hover { color: var(--text); background: var(--surface-2); }
.lang-switch [aria-current] { background: var(--surface-3); color: var(--text); }
.lang-switch:empty { display: none; }
