/* emajorsa — estilo minimalista. Fuente del sistema, sin fuentes externas (decidido el 18-oct). Paleta "Brújula" elegida el 24-oct. */
:root {
  --bg: #F7F6F2; --tx: #1E2230; --box: #ECEAF3; --boxoff: #CBC8D6;
  --ok: #1F8A5B; --ok-soft: rgba(31, 138, 91, .14); --ok-line: rgba(31, 138, 91, .4); --bad-bg: #FCE4E1; --bad: #D0433A; --mut: #6A6878; --card: #FFFFFF;
  --acc: #3B4CC0;   /* acento (índigo) */
  /* Estilo "Brújula" (24-oct): la dificultad se ve en color, de la pista 1 (fría, la más difícil) a la 5 (cálida, la más fácil) */
  --p1: #3B4CC0; --p2: #2E8FB8; --p3: #2BA37A; --p4: #E0A526; --p5: #E8642C;
  --r: 10px; --row: 44px; --rows: 3; --fh: 210px; --adw: 160px;
  --z: 1; --adgap: 150px; /* aire mínimo entre anuncios y juego (Google recomienda >=150 px junto a juegos) */
}
@media (max-width: 699px) { :root { --fh: min(300px, 38dvh); } .chip { font-size: 12px; padding: 0 7px; } .next { padding: 10px; margin: 8px 0; } .next b { font-size: 26px; } }
@media (min-width: 700px) { :root { --rows: 4; --fh: 240px; } }
@media (min-width: 1750px) { :root { --adw: 300px; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--tx); overflow: hidden;
  font: 16px/1.35 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--tx); outline-offset: 2px; }

/* ---------- Página: [anuncio izq] [juego] [anuncio der] ---------- */
.page { height: calc(var(--vvh, 100dvh) / var(--z, 1)); display: grid; grid-template-columns: minmax(0, 1fr); }
.ad { display: none; }
/* Los anuncios solo aparecen cuando caben con aire: columna + 150 px de separación a cada lado del juego. */
@media (min-width: 1400px) {
  .page { grid-template-columns: calc(var(--adw) + var(--adgap)) minmax(0, 1fr) calc(var(--adw) + var(--adgap)); }
  .ad { display: block; height: 100%; width: var(--adw); overflow: hidden; padding-top: 12px; }
  .ad-left { justify-self: start; }
  .ad-right { justify-self: end; }
}
/* Guías visibles solo en la previsualización (config adGuides) */
body.adguides .ad { outline: 1px dashed #b9b4aa; outline-offset: -6px; position: relative; }
body.adguides .ad::after { content: "Espacio para anuncio\A (reservado)"; white-space: pre; position: absolute; inset: 0;
  display: grid; place-items: center; text-align: center; color: #9a958b; font-size: 12px; pointer-events: none; }

/* ---------- Juego ---------- */
.game { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(150px, 1fr) auto auto auto;  /* 150 = 5 pistas de 26 px mínimo + separaciones */ gap: 10px; height: 100%; min-height: 0;
  width: 100%; max-width: 640px; margin: 0 auto; padding: 12px 14px calc(8px + env(safe-area-inset-bottom)); }
@media (min-width: 1000px) { .game { max-width: 980px; } }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { height: 30px; width: auto; flex: none; display: block; }
h1 { margin: 0; font-size: 26px; line-height: 1.1; letter-spacing: .12em; font-weight: 800; }
#sub { margin: 4px 0 0; font-size: 17px; line-height: 1.3; color: var(--tx); opacity: .75; }
#note { margin: 2px 0 0; font-size: 13px; color: var(--bad); }
#note:empty { display: none; }
@media (min-width: 700px) { .logo { height: 38px; } h1 { font-size: 34px; } #sub { font-size: 20px; } }
.lang { border: 0; background: none; padding: 4px 2px; font-size: 14px; letter-spacing: .04em; color: var(--mut); white-space: nowrap; }
.lang b { color: var(--tx); }

/* ---------- Pistas: 5 filas apiladas; la 1 abierta, las otras se desbloquean con cada intento ---------- */
.clues-zone { min-height: 0; display: flex; flex-direction: column; justify-content: center; }
.clues { list-style: none; margin: 0; padding: 0; display: grid; grid-template-rows: repeat(5, minmax(26px, 64px)); gap: 6px; height: 100%; max-height: 344px; }   /* 5 x 64 + 4 x 6: las filas se reparten el alto disponible */
.clue { display: flex; align-items: center; gap: 10px; min-height: 0; padding: 0 12px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--box); font-size: clamp(13px, min(2.6vh, 4.5vw), 20px); line-height: 1.2; overflow: hidden; }   /* en celular la letra baja con el ancho: las pistas llegan a 60 caracteres */
.clue .n { flex: none; display: grid; place-items: center; width: 1.7em; height: 1.7em; max-height: 100%; border-radius: 50%;
  background: var(--tx); color: var(--bg); font-size: .72em; font-weight: 700; }
.clue .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
/* Dos líneas cuando la fila tiene alto para ello (celular normal); si la fila es baja (teclado abierto, pantallas muy chicas) sigue en una línea con "…".
   .clue es contenedor de tamaño para poder medir su propio alto en em. */
.clue { container-type: size; }
@container (min-height: 2.4em) { .clue .t { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.15; } }
@container (min-height: 3.3em) { .clue .t { -webkit-line-clamp: 3; line-clamp: 3; line-height: 1.1; } }   /* tres líneas si la fila da para ello */
@media (max-width: 699px) { .clues { grid-template-rows: repeat(5, minmax(26px, 76px)); max-height: 404px; } .clue { padding: 0 10px; gap: 8px; } }

/* Ronda terminada en celular (o en "sitio de escritorio"): la página pasa a desplazarse, las pistas se muestran
   completas (sin "…") y el panel final queda debajo con su alto natural. game.js pone la clase "fin" en <html>. */
@media (max-width: 699px) {
  html.fin, html.fin body { height: auto; overflow: auto; }
  html.fin .page, html.fin .game { height: auto; }
  html.fin .game { grid-template-rows: auto auto auto auto auto; }
  html.fin .clues { grid-template-rows: none; grid-auto-rows: auto; height: auto; max-height: none; }
  html.fin .clue { container-type: normal; min-height: 44px; padding: 8px 10px; }
  html.fin .clue .t { white-space: normal; display: block; overflow: visible; }
  html.fin .final { height: auto; }
}
html.zm.fin, html.zm.fin body { height: auto; overflow: auto; }
html.zm.fin .page, html.zm.fin .game { height: auto; }
html.zm.fin .game { grid-template-rows: auto auto auto auto auto; }
html.zm.fin .clues { grid-template-rows: none; grid-auto-rows: auto; height: auto; max-height: none; }
html.zm.fin .clue { container-type: normal; min-height: 44px; padding: 8px 10px; }
html.zm.fin .clue .t { white-space: normal; display: block; overflow: visible; }
html.zm.fin .final { height: auto; }
.clue.locked { background: transparent; border: 1px dashed var(--boxoff); color: var(--boxoff); }
.clue.locked .n { background: var(--boxoff); }
.clue.locked .t { font-weight: 400; letter-spacing: .2em; }
.clue.new { animation: clueIn .32s ease-out; }   /* aparece desde arriba con un leve zoom */
@keyframes clueIn { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; transform: none; } }

.status { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; min-height: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips.left { justify-content: flex-end; }   /* fallos 1 y 2, pegados a los puntos */
.chips.right { justify-content: flex-start; }  /* fallos 3 y 4 */
.chip { background: var(--bad-bg); border: 1px solid var(--bad); color: var(--bad); border-radius: 999px; padding: 1px 9px; font-size: 13px; white-space: nowrap; }
.dots { display: flex; gap: 7px; }
.dot { width: 13px; height: 13px; border-radius: 50%; background: var(--ok-soft); border: 2px solid var(--ok-line); transition: background .25s, border-color .25s; }   /* intento disponible: verde claro y transparente */
.dot.used { background: var(--bad); border-color: var(--bad); }                   /* intento fallado: rojo */
.dot.hit { background: var(--ok); border-color: var(--ok); }                      /* intento con acierto: verde fuerte */
.dot.off { opacity: .55; }                                                        /* intentos que sobraron al terminar */

.lower { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.boxes { display: grid; grid-template-columns: minmax(0, 1fr); }
.box { min-width: 0; height: var(--row); display: flex; align-items: center; border-radius: var(--r); background: var(--box); border: 2px solid transparent; }
.box:focus-within { border-color: var(--tx); }
.box.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.box input { all: unset; flex: 1; min-width: 0; height: 100%; padding: 0 12px; font-size: 16px; }
.box input::placeholder { color: var(--mut); opacity: 1; }
.box.ok input { color: #fff; font-weight: 600; }
.box .mk { padding-right: 12px; font-weight: 700; }
.box.bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.box.bad input { color: var(--bad); font-weight: 600; }
.box.flash { animation: flash .5s; }
@keyframes flash { 0%, 100% { border-color: transparent; } 20%, 80% { border-color: var(--bad); } }
@media (prefers-reduced-motion: reduce) { .clue.new { animation: none; }
.box.bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.box.bad input { color: var(--bad); font-weight: 600; }
.box.flash { animation: none; border-color: var(--bad); } * { scroll-behavior: auto !important; } }

.list { list-style: none; margin: 8px 0 0; padding: 0; height: calc(var(--rows) * var(--row)); overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); border: 1px solid var(--box); border-radius: var(--r); }
.list li { min-height: var(--row); display: flex; align-items: center; padding: 0 12px; cursor: pointer; }
.list li.act, .list li:hover { background: var(--box); }
.list .empty { color: var(--mut); cursor: default; font-size: 14px; }
.list .empty:hover { background: none; }

.final { height: var(--fh); overflow-y: auto; background: var(--card); border: 1px solid var(--box); border-radius: var(--r); padding: 12px 14px; font-size: 14px; }
.final .res { font-size: 18px; font-weight: 650; margin: 0 0 4px; }
.final .res.ok { color: var(--ok); } .final .res.bad { color: var(--bad); }
.final .txt { margin: 6px 0 10px; }
.next { margin: 10px 0; padding: 14px; border-radius: var(--r); background: var(--tx); color: var(--bg); text-align: center; }
.next .invite { margin: 0; font-size: 17px; font-weight: 700; }
.next .starts { margin: 6px 0 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.next b { display: block; font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.next .btn { background: var(--bg); color: var(--tx); margin-top: 8px; }
.btn { border: 0; background: var(--tx); color: var(--bg); border-radius: var(--r); height: 40px; padding: 0 18px; font-weight: 600; }
.stats { display: flex; gap: 18px; margin: 12px 0; }
.stats div { display: grid; }
.stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--mut); }
dialog a { color: inherit; }
.cnote { margin: 4px 0; font-size: 12px; color: var(--mut); }
.foot { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px 26px; min-height: 30px; padding-top: 2px; font-size: 13px; }
.link { border: 0; background: none; padding: 6px 2px; font: inherit; color: var(--mut); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--tx); }

dialog { border: 0; border-radius: 14px; padding: 18px; max-width: min(560px, calc(100vw - 28px)); max-height: calc(100dvh - 40px);
  background: var(--card); color: var(--tx); overflow: auto; }
dialog::backdrop { background: rgba(38, 36, 31, .5); }
dialog h2 { margin: 0 0 8px; font-size: 16px; }
dialog h3 { margin: 14px 0 4px; font-size: 13px; letter-spacing: .04em; }
dialog p { margin: 4px 0; font-size: 14px; }
dialog .close { float: right; border: 0; background: none; font-size: 22px; line-height: 1; padding: 0 4px; }

/* ---------- Pantallas altas y angostas con ancho de "escritorio" ----------
   Es lo que pasa al pedir "Sitio de escritorio" en un celular (ancho ~980 px y alto ~2100 px) o en una tableta muy alta.
   game.js agrega la clase "zm" a <html> y pone --z (= ancho / 430); el cuerpo se amplía con zoom y se usa el diseño de celular.
   Las unidades vh/dvh/vw se dividen por --z porque el zoom también las multiplica. */
html.zm body { zoom: var(--z); }
html.zm { --rows: 3; --fh: min(300px, calc(38dvh / var(--z))); }
html.zm .page { grid-template-columns: minmax(0, 1fr); }
html.zm .ad { display: none; }
html.zm .game { max-width: 640px; }
html.zm h1 { font-size: 26px; }
html.zm #sub { font-size: 17px; }
html.zm .chip { font-size: 12px; padding: 0 7px; }
html.zm .next { padding: 10px; margin: 8px 0; }
html.zm .next b { font-size: 26px; }
html.zm .clue { font-size: clamp(14px, calc(2.6vh / var(--z)), 20px); }
html.zm dialog { max-width: min(560px, calc(100vw / var(--z) - 28px)); max-height: calc(100dvh / var(--z) - 40px); }

/* ---------- Estilo "Brújula" (24-oct-2026) ----------
   Cada pista lleva una franja lateral y un número de su color: azul (1, difícil) -> celeste -> verde -> ámbar -> naranja (5, fácil).
   Bajo el título, una línea fina con los cinco colores. */
h1::after { content: ""; display: block; height: 4px; width: 56px; margin-top: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--p1), var(--p2), var(--p3), var(--p4), var(--p5)); }
.clue { background: var(--card); border: 1px solid #E7E5EE; border-left-width: 6px; border-radius: 12px; }
.clue:nth-child(1) { border-left-color: var(--p1); } .clue:nth-child(1) .n { background: var(--p1); }
.clue:nth-child(2) { border-left-color: var(--p2); } .clue:nth-child(2) .n { background: var(--p2); }
.clue:nth-child(3) { border-left-color: var(--p3); } .clue:nth-child(3) .n { background: var(--p3); }
.clue:nth-child(4) { border-left-color: var(--p4); } .clue:nth-child(4) .n { background: var(--p4); }
.clue:nth-child(5) { border-left-color: var(--p5); } .clue:nth-child(5) .n { background: var(--p5); }
.clue .n { color: #fff; }
.clue.locked { background: transparent; border: 1px dashed #D3D0DD; color: #B7B3C4; }
.clue.locked .n { background: #D3D0DD; }
.box { background: #fff; border: 2px solid #E2E0EA; border-radius: 12px; }
.box:focus-within { border-color: var(--acc); }
.box.ok { background: var(--ok); border-color: var(--ok); }
.box.bad { background: var(--bad-bg); border-color: var(--bad); }
.list { border-color: #E7E5EE; border-radius: 12px; }
.list li.act, .list li:hover { background: #EEF0FB; }
.final { border-color: #E7E5EE; border-radius: 12px; }
.next { background: linear-gradient(120deg, #2B3590, var(--acc)); }
.lang b { color: var(--acc); }
:focus-visible { outline-color: var(--acc); }
