:root {
  --bg: #14162b;
  --bg2: #1d2040;
  --panel: #232750;
  --line: #3a3f78;
  --text: #f2f3ff;
  --muted: #a3a7d6;
  --accent: #ffb547;
  --accent-ink: #2a1a00;
  --ok: #3ad29f;
  --ko: #ff6b7a;
  --card: #fdf8ec;
  --card-ink: #1d1b2e;
  --radius: 14px;
  --dock-h: 0px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(circle at 20% -10%, #2b2f66 0, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.offline::before {
  content: attr(data-offline); position: fixed; inset: 0 0 auto; z-index: 50;
  background: var(--ko); color: #fff; text-align: center; padding: 4px; font-size: 14px;
}
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
h1, h2 { margin: 0 0 12px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.center { text-align: center; padding: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
code, pre { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
pre { background: var(--bg); padding: 10px; border-radius: 8px; overflow-x: auto; }
button, a, label { touch-action: manipulation; }

/* ---------- Botones y formularios */
.btn {
  appearance: none; border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600;
  cursor: pointer; color: var(--text); background: var(--line); text-decoration: none; display: inline-block;
  transition: transform .12s, background-color .2s, opacity .2s;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.ghost:hover { background: rgba(255, 255, 255, .05); }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.big { width: 100%; padding: 15px; font-size: 18px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:active:not(:disabled) { transform: scale(.97); }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
label[hidden], label.check[hidden] { display: none; }
input, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
textarea { font-family: ui-monospace, Menlo, monospace; font-size: 13px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-size: 24px; font-weight: 700; text-align: center; }
label.file { color: var(--text); margin: 0; }
label.file input[type=file] { display: none; }
label.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); cursor: pointer; }
label.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
label.check:has(input:checked) { border-color: var(--accent); background: rgba(255, 181, 71, .08); }

/* ---------- Home */
.home { max-width: 480px; margin: 0 auto; padding: 32px 16px; }
.logo { font-size: 46px; text-align: center; letter-spacing: -1px; margin-bottom: 4px; }
.logo span { display: inline-block; }
.logo .line { animation: wobble 3.5s ease-in-out infinite; }
.logo .ch.acc { color: var(--accent); }
html.logo-intro, html.logo-intro body { overflow: hidden; }
.logo.intro .line { animation: none; }
.logo .ch.off { display: none; }
.logo .ch { transition: color .2s; }
.logo.ko .ch { color: var(--ko); }
.home-btn { width: 100%; margin-top: 10px; }
.tagline { text-align: center; margin: 0 0 24px; }
.tabs { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.tab { flex: 1; border: 0; background: none; color: var(--muted); padding: 10px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; transition: background-color .2s, color .2s; }
.tab.on { background: var(--panel); color: var(--text); }
.panel { background: var(--panel); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.panel .row { margin-bottom: 14px; }
.field-label { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 14px; }
.deck { display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .2s, background-color .2s; }
.deck.on { border-color: var(--accent); background: rgba(255, 181, 71, .08); }
.deck-groups { margin-bottom: 14px; }
.deck-groups .decks { margin-bottom: 0; }
.deck-group { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--bg2); }
.deck-group > summary { cursor: pointer; padding: 11px 14px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; }
.deck-group > summary::-webkit-details-marker { display: none; }
.deck-group > summary::after { content: "▸"; margin-left: auto; color: var(--muted); transition: transform .2s; }
.deck-group[open] > summary::after { transform: rotate(90deg); }
.deck-group > summary:focus-visible { outline: 2px solid var(--accent); border-radius: 12px; }
.deck-group > .decks { padding: 0 8px 8px; }
.deck-group:has(.deck.on) > summary { color: var(--accent); }
.deck:focus-visible { outline: 2px solid var(--accent); }
.deck-emoji { font-size: 24px; flex: none; }
.deck-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.deck-text b { font-size: 15px; }
.deck-text .muted { font-size: 12px; }
.hint { display: block; margin-top: 6px; font-size: 12px; }
#customFields[hidden] { display: none; }
.help { margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.help summary { cursor: pointer; }

/* ---------- Barra superior */
.bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(20, 22, 43, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.bar-title { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code { color: var(--accent); letter-spacing: .1em; }
.game { max-width: 1500px; margin: 0 auto; padding: 12px 12px 40px; }
body:has(.dock) .game { padding-bottom: calc(var(--dock-h, 150px) + 24px); }

/* ---------- Lobby */
.share { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.share .btn { margin: 4px 4px 0 0; }
.qr { width: 150px; height: 150px; background: #fff; border-radius: 10px; padding: 6px; }
.url { margin: 0; font-weight: 600; }
.share p { margin: 0 0 4px; }
.bigcode { font-size: 40px; font-weight: 800; letter-spacing: .2em; color: var(--accent); margin: 0; }
.players { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.players li { background: var(--bg2); padding: 8px 12px; border-radius: 999px; }
.players li.off, .order li.off, .ranking li.off { opacity: .45; }
.tag { font-size: 11px; background: var(--line); padding: 2px 6px; border-radius: 6px; vertical-align: middle; font-weight: 600; }
.tag.me { background: var(--accent); color: var(--accent-ink); }
.lobby-screen { display: grid; gap: 16px; max-width: 1100px; margin: 0 auto; }
.qr-panel { text-align: center; }
.qr.big { width: min(320px, 70vw); height: auto; aspect-ratio: 1; }
.qr-panel .bigcode { font-size: clamp(48px, 9vw, 96px); }

/* ---------- Partida */
.layout { display: grid; gap: 12px; }
.layout aside { min-width: 0; }
.turn { background: var(--panel); border-radius: var(--radius); padding: 14px; border: 2px solid transparent; }
.turn.mine { border-color: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.turn .who { margin: 0 0 10px; font-size: 18px; }
.turn.mine .who { margin-bottom: 4px; font-size: 20px; }
.turn.result.ok { border-color: var(--ok); }
.turn.result.ko { border-color: var(--ko); }
.turn.result p { margin: 4px 0; }
.turn .date { color: var(--accent); font-weight: 700; }
.hint { font-size: 14px; margin: 0; color: var(--muted); }
.meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin: 12px 2px 6px; }
.progress { height: 6px; background: var(--bg2); border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ffd28a); border-radius: 6px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.order { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.order li { background: var(--bg2); padding: 6px 10px; border-radius: 999px; font-size: 14px; transition: background-color .3s, color .3s, opacity .3s; }
.order li b { color: var(--accent); margin-left: 4px; display: inline-block; }
.order li.done { opacity: .6; }
.order li.skipped { text-decoration: line-through; }
.grace { margin: 0 0 10px; color: var(--ko); font-size: 14px; }
.paused-note { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 181, 71, .14); color: var(--accent); font-size: 14px; font-weight: 600; }
.small { font-size: 13px; }
.order li.now { background: var(--accent); color: var(--accent-ink); }
.order li.now b { color: var(--accent-ink); }
.admin { margin-top: 8px; }

.ranking { padding: 0; list-style: none; margin: 12px 0 16px; }
.ranking li { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--bg2); margin-bottom: 6px; transition: background-color .3s, color .3s; }
.ranking li b { display: inline-block; color: var(--accent); font-size: 18px; }
.ranking .pos { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line); font-size: 12px; margin-right: 8px; }
.ranking li.now { outline: 2px solid var(--accent); }
.ranking li.win { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.ranking li.win b { color: var(--accent-ink); }
.ranking li.win .pos { background: rgba(0, 0, 0, .15); }

/* ---------- Cartas */
.card {
  background: var(--card); color: var(--card-ink); border-radius: 12px; overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25); border-left: 6px solid #c9c2ad; position: relative;
}
.card img { display: block; width: 100%; max-height: 120px; object-fit: cover; pointer-events: none; }
.card-body { padding: 10px 12px; }
.card .date { font-weight: 800; color: #8a5a00; font-size: 15px; transform-origin: 50% 0; }
.card .title { font-weight: 600; }
.card .desc { font-size: 13px; color: #555; margin-top: 2px; }
.card .by { font-size: 12px; color: #777; margin-top: 4px; }
.card.ok { border-left-color: var(--ok); }
.card.ko { border-left-color: var(--ko); }
.card.pending { border-left-color: var(--accent); background: #fff3d6; }
.card.pending .date { color: #c47f00; }
.card.just { outline: 3px solid var(--accent); outline-offset: 2px; }
.card.just.ok { outline-color: var(--ok); }
.card.just.ko { outline-color: var(--ko); }
.grip { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 22px; color: #c47f00; opacity: .7; }

/* ---------- Línea de tiempo (vertical en móvil) */
.tl-wrap { min-width: 0; }
.tl-end { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 4px 0 6px 30px; }
.tl-end.finish { padding: 6px 0 0 30px; }
.tl-end.start span::before { content: "▲ "; }
.tl-end.finish span::before { content: "▼ "; }
.timeline { display: flex; flex-direction: column; position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--line), var(--accent) 50%, var(--line)); border-radius: 3px; opacity: .8; }
.timeline .card[data-card-index] { overflow: visible; }
.timeline .card[data-card-index]::before {
  content: ""; position: absolute; left: -26px; top: 15px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg);
}
.timeline .card[data-card-index].ok::before { background: var(--ok); }
.timeline .card[data-card-index].ko::before { background: var(--ko); }
.slot { min-height: 10px; }
.slot.pick {
  appearance: none; display: grid; place-items: center; width: 100%; margin: 3px 0; min-height: 34px; border-radius: 10px; cursor: pointer;
  border: 2px dashed rgba(255, 181, 71, .55); background: rgba(255, 181, 71, .05); color: var(--accent); font: inherit; font-weight: 800; font-size: 18px;
  transition: background-color .2s, border-color .2s, transform .15s;
}
.slot.pick:hover, .slot.pick:active { background: rgba(255, 181, 71, .2); border-color: var(--accent); }
.slot.ghost { margin: 6px 0; }
.slot.ghost:not(.mine) .card { opacity: .8; }
.slot.ghost .card { outline: 3px dashed var(--accent); outline-offset: 2px; }
.slot.ghost.mine { cursor: grab; touch-action: none; }
.ghost-who { font-size: 13px; color: var(--accent); margin: 0 0 4px 2px; animation: blink 1.4s ease-in-out infinite; }
.drag-source .card, .drag-source.card { opacity: .35; }

/* Barra fija con la carta a colocar */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 10px; align-items: stretch;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  background: rgba(20, 22, 43, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(0, 0, 0, .35);
  animation: rise .35s cubic-bezier(.2, .8, .2, 1);
}
.dock-card { flex: 1; min-width: 0; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.dock-card .card { height: 100%; padding-right: 30px; animation: nudge 2.4s ease-in-out 1s infinite; }
.dock-card .card img { display: none; }
.dock-card .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dock-card .desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dock .btn { flex: 0 0 auto; min-width: 112px; font-size: 16px; }
.card.dragging {
  position: fixed; z-index: 100; margin: 0; pointer-events: none; transform-origin: 30% 30%;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5); outline: 3px solid var(--accent);
}
.card.dragging img { display: none; }

/* ---------- Efectos */
.burst { position: absolute; left: 50%; top: 40%; width: 0; height: 0; pointer-events: none; z-index: 5; }
.burst i, .rain i { position: absolute; width: 8px; height: 12px; border-radius: 2px; }
.rain { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.rain i { top: 0; }
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px);
  background: #000c; color: #fff; padding: 10px 16px; border-radius: 10px; white-space: pre-line; font-size: 14px;
  animation: fadeup .25s ease-out;
}
.turn-flash {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none;
  background: rgba(255, 181, 71, .92); animation: flash 1.6s ease-out forwards;
}
.turn-flash div { font-size: 56px; font-weight: 900; color: var(--accent-ink); animation: pop .5s ease-out; }
@keyframes flash { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pop { 0% { transform: scale(.7); } 70% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(255, 181, 71, .15); } 50% { box-shadow: 0 0 0 10px rgba(255, 181, 71, .04); } }
@keyframes rise { from { transform: translateY(100%); opacity: 0; } }
@keyframes nudge { 0%, 80%, 100% { transform: translateY(0); } 88% { transform: translateY(-6px); } 94% { transform: translateY(1px); } }
@keyframes fadeup { from { opacity: 0; margin-bottom: -10px; } }
@keyframes blink { 50% { opacity: .5; } }
@keyframes wobble { 0%, 85%, 100% { transform: rotate(0); } 90% { transform: rotate(-6deg); } 95% { transform: rotate(4deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Pantallas grandes: línea de tiempo en serpiente (filas que alternan sentido) */
@media (min-width: 900px) {
  .game { padding: 16px 20px 40px; }
  .layout { grid-template-columns: 320px 1fr; align-items: start; }
  .layout aside { position: sticky; top: 70px; }
  .lobby-screen { grid-template-columns: 1fr 1fr; align-items: start; }
  .tl-end { display: none; }
  .tl-wrap::before { content: "Más antiguo ➜"; display: block; padding-left: 36px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
  .dock { left: 50%; right: auto; transform: translateX(-50%); width: min(640px, 100%); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; }
  @keyframes rise { from { transform: translate(-50%, 100%); opacity: 0; } }
}
.timeline.snake { display: block; position: relative; padding: 0 36px 8px; }
.timeline.snake::before { display: none; }
.snake-line { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; overflow: visible; }
.snake-path { fill: none; stroke: var(--line); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.snake-row { display: flex; align-items: flex-start; padding-top: 30px; margin-bottom: 18px; position: relative; z-index: 1; }
.snake-row.rtl { flex-direction: row-reverse; }
.snake-row > .card { flex: 0 0 var(--cw); width: var(--cw); }
.timeline.snake .snake-row > .card[data-card-index]::before { left: 50%; top: -24px; transform: translateX(-50%); }
.snake-row > .slot { flex: 0 0 12px; min-width: 12px; }
.snake-row > .slot.pick { flex: 0 0 46px; width: 46px; min-height: 110px; margin: 0 4px; }
.snake-row > .slot.ghost { flex: 0 0 var(--cw); margin: 0 6px; position: relative; }
.snake-row .ghost-who { position: absolute; transform: translateY(-22px); white-space: nowrap; }

/* ---------- Modo presentación / pantalla compartida: todo más grande */
@media (min-width: 900px) {
  body.screen { font-size: 19px; }
  body.screen .layout { grid-template-columns: 380px 1fr; }
  body.screen .turn .who { font-size: 24px; }
  body.screen .turn .card .title { font-size: 22px; }
  body.screen .card .date { font-size: 18px; }
  body.screen .card .title { font-size: 18px; }
  body.screen .ranking li { font-size: 20px; padding: 12px 14px; }
}

/* ---------- Selector de idioma */
.langs { display: flex; gap: 6px; align-items: center; }
.lang {
  width: 30px; height: 21px; padding: 0; border: 2px solid transparent; border-radius: 5px; overflow: hidden;
  background: none; cursor: pointer; opacity: .55; transition: opacity .2s, transform .12s, border-color .2s; flex: none;
}
.lang svg { display: block; width: 100%; height: 100%; }
.lang:hover { opacity: .9; }
.lang.on { opacity: 1; border-color: var(--accent); }
.lang:active { transform: scale(.92); }
.home-top { display: flex; justify-content: flex-end; margin: -16px 0 12px; }
.bar-right { display: flex; align-items: center; gap: 12px; flex: none; }
.bar-only { justify-content: flex-end; }
@media (max-width: 420px) {
  .bar-right { gap: 8px; }
  .bar-right .langs { gap: 4px; }
  .bar-right .lang { width: 24px; height: 17px; }
}

/* ---------- Opciones del anfitrión */
.host-tools { margin-top: 12px; }
.host-tools summary { cursor: pointer; font-weight: 600; }
.host-tools[open] summary { margin-bottom: 8px; }
.host-tools .small { margin: 6px 0; }
.host-label { margin: 12px 0 6px; font-size: 14px; color: var(--muted); }
.host-tools .row .btn { margin: 0; }
.seg { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: 12px; }
.seg button { flex: 1; border: 0; background: none; color: var(--muted); padding: 9px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; transition: background-color .2s, color .2s; }
.seg button.on { background: var(--accent); color: var(--accent-ink); cursor: default; }
.lobby-screen .host-tools { grid-column: 1 / -1; margin-top: 0; }

/* ---------- Temporizador por pregunta */
.timer-setting { margin: 8px 0 14px; }
.timer-setting .host-label { margin-top: 4px; }
.timer-info { margin: 4px 0 12px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 10px 0 4px; }
.stepper .btn { width: 44px; height: 40px; padding: 0; font-size: 22px; line-height: 1; margin: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.limits { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: center; }
.limits .stepper { gap: 8px; margin-top: 4px; }
.limits .stepper b { min-width: 36px; }
.stepper b { min-width: 90px; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; }
.turn-timer { display: flex; align-items: center; gap: 10px; margin: 8px 0 10px; font-size: 15px; font-variant-numeric: tabular-nums; }
.turn-timer span { flex: none; min-width: 60px; }
.turn-timer .bar-track { flex: 1; height: 8px; background: var(--bg2); border-radius: 8px; overflow: hidden; }
.turn-timer i { display: block; height: 100%; background: var(--accent); border-radius: 8px; transition: width .25s linear, background-color .3s; }
.turn-timer.urgent { color: var(--ko); font-weight: 700; }
.turn-timer.urgent i { background: var(--ko); }
.turn-timer.paused { opacity: .6; }
.dock { flex-wrap: wrap; }
.dock .turn-timer { flex: 1 0 100%; margin: 0; }
body.screen .turn-timer { font-size: 22px; }
body.screen .turn-timer .bar-track { height: 12px; }
@media (prefers-reduced-motion: reduce) { .turn-timer i { transition: none; } }

/* ---------- Barra fija para seguir el turno de otro (móvil) */
.watch {
  position: fixed; left: 0; right: 0; top: 0; z-index: 9; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 10px 16px 12px; border: 0; border-bottom: 1px solid var(--line); text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: rgba(35, 39, 80, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 24px rgba(0, 0, 0, .3);
  transform: translateY(-110%); opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .3s, visibility 0s .3s, padding .25s;
}
.watch.show { transform: none; opacity: 1; visibility: visible; pointer-events: auto; transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .3s, padding .25s; }
.watch:empty { display: none; }
.watch-who { grid-column: 1; grid-row: 1; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-card { grid-column: 1 / -1; font-weight: 700; font-size: 15px; color: var(--accent); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.watch-card i { font-style: normal; opacity: .7; margin-right: 4px; }
.watch-card small { font-size: inherit; font-weight: 500; color: var(--text); opacity: .85; }
.watch .turn-timer { grid-column: 2; grid-row: 1; margin: 0; font-size: 14px; }
.watch .turn-timer .bar-track { display: none; }
.watch .turn-timer span { min-width: 0; }
.watch-follow { display: none; }
/* Pequeña: una sola línea mientras quien mira se mueve por su cuenta */
.watch.compact { display: flex; gap: 8px; padding: 6px 12px; }
.watch.compact .watch-who { flex: none; max-width: 40%; font-size: 13px; }
.watch.compact .watch-card { flex: 1; font-size: 13px; display: block; white-space: nowrap; text-overflow: ellipsis; }
.watch.compact .turn-timer { flex: none; font-size: 13px; }
.watch.compact .watch-follow { display: inline-block; flex: none; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
@media (min-width: 900px) { .watch { display: none; } }

/* ---------- Aviso fijo con el resultado de la jugada (móvil) */
.result-bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 11; display: flex; flex-direction: column; gap: 2px;
  padding: 10px 16px 12px; border: 0; border-bottom: 4px solid var(--ok); text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: rgba(24, 64, 56, .97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
  transform: translateY(-110%); opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .3s, visibility 0s .3s;
}
.result-bar.ko { border-bottom-color: var(--ko); background: rgba(84, 28, 44, .97); }
.result-bar.show { transform: none; opacity: 1; visibility: visible; pointer-events: auto; transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .3s; }
.result-bar:empty { display: none; }
.result-head { font-size: 17px; font-weight: 700; }
.result-card { font-size: 15px; }
.result-date { font-weight: 800; color: var(--accent); white-space: nowrap; }
.result-where { font-size: 13px; color: var(--muted); }
.result-where u { text-underline-offset: 2px; }
.card.recent { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { outline-offset: 6px; } }
@media (min-width: 900px) { .result-bar { display: none; } }

/* ---------- Filtros del formulario y modo fácil */
.pool-info { margin: -4px 0 12px; }
.pool-info.bad { color: var(--ko); }
.slot.closed { min-height: 6px; }

/* ---------- Modalidad «¿En qué año?» */
.kind-seg { margin-bottom: 6px; }
.kind-help { margin: 0 0 14px; }
.kind-info { margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 181, 71, .1); }
.turn { position: relative; }
.year-q .card { margin: 4px 0 8px; }
.year-q .card .title { font-size: 18px; }
.my-answer { margin: 6px 0 0; color: var(--ok); font-weight: 600; }
.answered-count { margin: 6px 0 0; font-size: 14px; }
.done-mark { color: var(--ok); font-weight: 800; }
.off-total { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 32px; }
.ranking li.win .off-total { color: var(--accent-ink); opacity: .75; }
.year-result .yr-title { margin: 0; }
.year-result .yr-solution { font-size: 34px; font-weight: 900; color: var(--accent); margin: 2px 0 8px; transform-origin: 50% 0; }
.answers { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.answers li { display: grid; grid-template-columns: 1fr auto auto 34px; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 9px; background: var(--bg2); font-size: 15px; }
.answers li.win { background: rgba(58, 210, 159, .16); }
.answers li.me { outline: 2px solid var(--accent); }
.answers .a-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.answers .a-guess { font-weight: 700; font-variant-numeric: tabular-nums; }
.answers .a-diff { color: var(--muted); font-size: 13px; text-align: right; }
.answers .a-pts { color: var(--ok); text-align: right; }
.year-dock { flex-direction: column; align-items: stretch; }
.year-dock .btn[data-act="answer"] { width: 100%; padding: 13px; font-size: 18px; }
.year-picker { display: flex; align-items: stretch; gap: 8px; }
.yr-col { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.dock .yr-btn { min-width: 58px; padding: 8px 6px; font-size: 16px; font-variant-numeric: tabular-nums; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.year-pad {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card); color: var(--card-ink); border-radius: 12px; padding: 4px 8px; cursor: ns-resize;
  touch-action: none; user-select: none; -webkit-user-select: none; outline: none; border: 3px solid transparent;
}
.year-pad:focus-visible, .year-pad.swiping { border-color: var(--accent); }
.year-pad .year-num { font-size: 40px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.year-pad .yr-arrow { font-size: 12px; color: #b08a3a; line-height: 1; }
.year-pad .yr-hint { font-size: 11px; color: #8a7a5a; margin-top: 2px; }
@media (min-width: 900px) {
  body.screen .year-q .card .title { font-size: 26px; }
  body.screen .year-result .yr-solution { font-size: 48px; }
  body.screen .answers li { font-size: 19px; }
}
.main-col { min-width: 0; }
body.screen .year-stage { margin-bottom: 20px; }
body.screen .year-stage .turn { padding: 22px 26px; }
body.screen .year-stage .turn .who { font-size: 30px; }
body.screen .year-stage .year-q .card { max-width: 760px; padding: 20px 24px; }
body.screen .year-stage .year-q .card .title { font-size: 40px; line-height: 1.15; }
body.screen .year-stage .year-q .card .desc { font-size: 24px; }
body.screen .year-stage .year-q .card .date { font-size: 26px; }
body.screen .year-stage .answered-count { font-size: 20px; }
body.screen .year-stage .yr-title { font-size: 28px; }
body.screen .year-stage .year-result .yr-solution { font-size: 72px; }
body.screen .year-stage .answers { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px; }
body.screen .year-stage .answers li { font-size: 20px; }

/* ---------- «¿En qué año?» por equipos */
.teams { display: grid; gap: 8px; margin-bottom: 12px; }
.team-box { background: var(--bg2); border-radius: 12px; padding: 10px 12px; border: 2px solid transparent; }
.team-box.mine { border-color: var(--accent); }
.team-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.team-head .btn { margin-left: auto; }
.team-box .players { margin: 0; }
.team-box .players li { background: var(--panel); }
.team-box p { margin: 0; }
.team-members { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 32px; }
.ranking li.win .team-members { color: var(--accent-ink); opacity: .8; }
.ranking li.mine:not(.win) { outline: 1px solid var(--accent); }
.answers .a-sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: -2px; }
.my-team { margin: 4px 0 0; font-size: 14px; }
.center-row { justify-content: center; margin: 4px 0; }
@media (min-width: 640px) { .teams { grid-template-columns: 1fr 1fr; } }
body.screen .year-stage .answers .a-sub { font-size: 15px; }

.team-split { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.team-split li { display: grid; grid-template-columns: 1fr auto 44px; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 9px; background: var(--bg2); font-size: 14px; }
.team-split li.win { background: rgba(58, 210, 159, .16); }
.team-split b { text-align: right; color: var(--ok); }
body.screen .year-stage .team-split li { font-size: 18px; }

/* ------------------------------------------------------------ Elegir juego */
.game-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.game-tile { display: flex; gap: 10px; align-items: center; text-align: left; padding: 12px; font: inherit; color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color .2s, background-color .2s; }
.game-tile.on { border-color: var(--accent); background: rgba(255, 181, 71, .1); }
.game-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) { .game-tile { flex-direction: column; align-items: flex-start; padding: 10px; } .game-tile .deck-text .muted { display: none; } }

/* ------------------------------------------------------------ «Letra a letra» */
.lt-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 860px) { .lt-layout { grid-template-columns: minmax(340px, 1fr) 1fr; } .lt-left { position: sticky; top: 72px; } }
.lt-left { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lt-who { margin: 0; font-size: 18px; text-align: center; }
.lt-who.mine { color: var(--accent); font-weight: 700; }
.ring { position: relative; width: min(88vw, 420px); aspect-ratio: 1; container-type: inline-size; }
.lt {
  position: absolute; transform: translate(-50%, -50%); width: min(11%, calc(250% / var(--n, 20))); aspect-ratio: 1; display: grid; place-items: center;
  border-radius: 50%; font-weight: 800; font-size: min(5.4cqw, calc(120cqw / var(--n, 20))); background: #3d5bd9; color: #fff;
  border: 2px solid rgba(255, 255, 255, .25); transition: background-color .3s, transform .3s, box-shadow .3s;
}
.lt.passed { background: #6a5acd; opacity: .85; }
.lt.ok { background: var(--ok); color: #05281c; }
.lt.ko { background: var(--ko); color: #330009; }
.lt.now { transform: translate(-50%, -50%) scale(1.25); background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 4px rgba(255, 181, 71, .35); z-index: 1; animation: pulse 1.6s ease-in-out infinite; }
.ring-center { position: absolute; inset: 22%; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--bg2); border: 1px solid var(--line); }
.ring-center b { font-size: 13cqw; font-variant-numeric: tabular-nums; line-height: 1; }
.ring-center span { font-size: 5cqw; color: var(--muted); }
.lt-time.urgent { color: var(--ko); animation: blink 1s steps(2) infinite; }
.lt-paused { color: var(--accent) !important; font-weight: 700; }
.lt-clue { text-align: center; transition: background-color .3s; }
.lt-clue.no-flash { background: rgba(255, 107, 122, .22); }
.lt-how { margin: 0 0 6px; color: var(--muted); font-size: 15px; }
.lt-letter { display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.lt-text { margin: 0; font-size: 22px; line-height: 1.35; font-weight: 600; }
.lt-answer { margin: 12px 0 0; padding: 8px 10px; border-radius: 10px; background: rgba(58, 210, 159, .14); color: var(--ok); font-size: 20px; font-weight: 700; }
.lt-dock { flex-direction: column; }
.lt-main { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.lt-dock .lt-main .btn { min-width: 0; font-size: 18px; padding: 14px 6px; font-weight: 700; }
.lt-ok { background: var(--ok); color: #05281c; }
.lt-no { background: var(--ko); color: #330009; }
.lt-pass { background: #6a5acd; color: #fff; }
.lt-sub { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.lt-dock .lt-sub .btn { min-width: 0; font-size: 14px; }
.lt-result { text-align: center; }
.lt-result.ok { outline: 2px solid var(--ok); }
.lt-answers { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.lt-answers li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; background: var(--panel); border-radius: 10px; padding: 8px 10px; border-left: 4px solid var(--ko); font-size: 14px; }
.lt-answers li.ok { border-left-color: var(--ok); }
.lt-l { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bg2); }
.chip-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.lt-players li:has(.chip-btn) { padding: 0; }
.lt-players .chip-btn { padding: 8px 12px; border-radius: 999px; border: 2px solid transparent; }
.lt-players .chip-btn.on, .lt-players li.on { border-color: var(--accent); background: rgba(255, 181, 71, .12); color: var(--accent); font-weight: 700; }
.lt-players li.on { border: 2px solid var(--accent); }
.lt-lobby { max-width: 640px; margin: 0 auto; }
.lt-rosco-name { text-align: center; }
.lt-rosco-name small { display: block; font-weight: 400; }
body.screen .ring { width: min(46vw, 78vh, 640px); }
body.screen .lt-text { font-size: 32px; }
body.screen .lt-how, body.screen .lt-who { font-size: 24px; }

/* ------------------------------------------------------------ «El infiltrado» */
.im-layout { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.im-layout > .panel { margin-bottom: 0; }
.im-phase { margin: 0; text-align: center; font-weight: 700; font-size: 18px; }
.im-big { margin: 4px 0 8px; font-size: 22px; font-weight: 700; line-height: 1.3; text-align: center; }
.im-card {
  width: 100%; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 20px; font: inherit; color: var(--card-ink); background: var(--card); border: 0; border-radius: 18px; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transition: transform .2s;
}
.im-card:not(.big) { min-height: 0; padding: 12px; }
.im-card:not(.shown) { background: repeating-linear-gradient(45deg, #3d5bd9 0 14px, #3550c4 14px 28px); color: #fff; }
.im-card.shown.inf { background: #2b1830; color: #ffd6e0; outline: 3px solid var(--ko); }
.im-card:active { transform: scale(.98); }
.im-card p { margin: 0; }
.im-back { font-size: 56px; line-height: 1; }
.im-card:not(.big) .im-back { display: none; }
.im-role { font-size: 22px; font-weight: 800; color: var(--ko); }
.im-cat { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.im-word { font-size: 40px; font-weight: 800; line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.im-card:not(.big) .im-word { font-size: 26px; }
.im-wait li.done { background: rgba(58, 210, 159, .16); }
.im-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.im-chip { font: inherit; font-size: 14px; color: var(--text); background: var(--bg2); border: 2px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.im-chip.on { border-color: var(--accent); background: rgba(255, 181, 71, .12); color: var(--accent); font-weight: 700; }
.im-speaker { text-align: center; }
.im-speaker.mine { outline: 2px solid var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.im-order { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.im-order li { padding: 8px 12px; border-radius: 10px; background: var(--bg2); }
.im-order li.done { opacity: .6; }
.im-order li.now { background: rgba(255, 181, 71, .16); color: var(--accent); font-weight: 700; }
.im-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.im-candidates { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.im-count { font-size: 28px; font-weight: 800; margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.im-guess-form { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.im-guess-form input { font-size: 20px; text-align: center; }
.im-votes { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.im-votes li { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--bg2); }
.im-votes li.hit { background: rgba(58, 210, 159, .16); }
.im-infs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.im-infs li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--bg2); border-left: 4px solid var(--ok); }
.im-infs li.free { border-left-color: var(--ko); }
.im-infs .ok { color: var(--ok); font-weight: 700; }
.im-infs .ko { color: var(--ko); }
.im-result.inf { outline: 2px solid var(--ko); }
.im-result.civ { outline: 2px solid var(--ok); }
.im-result .im-word { color: var(--accent); }
body.screen .im-layout { max-width: 900px; }
body.screen .im-big { font-size: 34px; }
body.screen .im-phase { font-size: 26px; }
body.screen .im-count { font-size: 56px; }
body.screen .im-result .im-word { font-size: 64px; }
.im-flags svg { display: block; width: 30px; height: 20px; margin: 0 auto; border-radius: 3px; }
.im-card .muted { color: inherit; opacity: .7; }
