:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #1c1b19;
  --muted: #6b6860;
  --line: #e3e0d8;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --good: #16a34a;
  --mid: #ca8a04;
  --far: #9ca3af;
  --dot: #a8a294;
  --sea: #e8f0f2;
  --land: #fbfaf6;
  --land-other: #e6e3dc;
  --border: #b9b4a8;
  --border-other: #d2cec5;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  /* fondo en pantallas anchas: cuadrícula de meridianos y paralelos + rosa de los vientos */
  --bg-grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath d='M120 0H0V120' fill='none' stroke='rgba%2815,118,110,0.07%29' stroke-width='1'/%3E%3Cpath d='M60 0V120M0 60H120' fill='none' stroke='rgba%2815,118,110,0.07%29' stroke-width='1' stroke-dasharray='2 6'/%3E%3C/svg%3E");
  --bg-rose: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'%3E%3Cg fill='none' stroke='rgba%2815,118,110,0.10%29' stroke-width='2'%3E%3Ccircle cx='200' cy='200' r='186'/%3E%3Ccircle cx='200' cy='200' r='150'/%3E%3Ccircle cx='200' cy='200' r='60'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%280 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2810 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2820 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%2830 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2840 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2850 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%2860 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2870 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2880 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%2890 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28100 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28110 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28120 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28130 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28140 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28150 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28160 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28170 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28180 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28190 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28200 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28210 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28220 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28230 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28240 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28250 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28260 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28270 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28280 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28290 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28300 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28310 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28320 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28330 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28340 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28350 200 200%29'/%3E%3Cpolygon points='200,20 222,178 380,200 222,222 200,380 178,222 20,200 178,178'/%3E%3Cpolygon points='200,80 214,186 320,200 214,214 200,320 186,214 80,200 186,186' transform='rotate%2845 200 200%29'/%3E%3C/g%3E%3Ctext x='200' y='62' font-family='Georgia,serif' font-size='34' text-anchor='middle' fill='rgba%2815,118,110,0.10%29'%3EN%3C/text%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121412;
    --card: #1c1f1d;
    --text: #ecebe6;
    --muted: #a19e95;
    --line: #2e322f;
    --accent: #2dd4bf;
    --accent-ink: #062b27;
    --good: #22c55e;
    --mid: #eab308;
    --far: #6b7280;
    --dot: #6f7a74;
    --sea: #141a1c;
    --land: #262b28;
    --land-other: #1d211f;
    --border: #4a504c;
    --border-other: #2f3431;
    --shadow: none;
    --bg-grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath d='M120 0H0V120' fill='none' stroke='rgba%2845,212,191,0.06%29' stroke-width='1'/%3E%3Cpath d='M60 0V120M0 60H120' fill='none' stroke='rgba%2845,212,191,0.06%29' stroke-width='1' stroke-dasharray='2 6'/%3E%3C/svg%3E");
    --bg-rose: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'%3E%3Cg fill='none' stroke='rgba%2845,212,191,0.08%29' stroke-width='2'%3E%3Ccircle cx='200' cy='200' r='186'/%3E%3Ccircle cx='200' cy='200' r='150'/%3E%3Ccircle cx='200' cy='200' r='60'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%280 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2810 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2820 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%2830 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2840 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2850 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%2860 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2870 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%2880 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%2890 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28100 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28110 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28120 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28130 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28140 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28150 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28160 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28170 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28180 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28190 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28200 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28210 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28220 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28230 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28240 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28250 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28260 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28270 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28280 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28290 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28300 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28310 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28320 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='34' transform='rotate%28330 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28340 200 200%29'/%3E%3Cline x1='200' y1='14' x2='200' y2='26' transform='rotate%28350 200 200%29'/%3E%3Cpolygon points='200,20 222,178 380,200 222,222 200,380 178,222 20,200 178,178'/%3E%3Cpolygon points='200,80 214,186 320,200 214,214 200,320 186,214 80,200 186,186' transform='rotate%2845 200 200%29'/%3E%3C/g%3E%3Ctext x='200' y='62' font-family='Georgia,serif' font-size='34' text-anchor='middle' fill='rgba%2845,212,191,0.08%29'%3EN%3C/text%3E%3C/svg%3E");
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto; padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.logo { margin: 0; font-size: 1.6rem; letter-spacing: .02em; }
.logo::before { content: "🧭 "; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; font-weight: 700;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 12px 16px 24px; }
.subtitle { margin: 4px 0 12px; color: var(--muted); text-align: center; }

.clues ol { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.clue {
  display: flex; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: .95rem; box-shadow: var(--shadow);
}
.clue .k { color: var(--muted); }
.clue .v { font-weight: 600; text-align: right; }
.clue.locked { box-shadow: none; background: transparent; border-style: dashed; color: var(--muted); }
.clue.locked .v { font-weight: 400; }

.guess-form { display: flex; gap: 8px; }
.combo { position: relative; flex: 1; }
#guess-input {
  width: 100%; height: 46px; padding: 0 14px; font-size: 1rem;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text);
}
#guess-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-primary {
  height: 46px; padding: 0 18px; border: 0; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-primary.wide { width: 100%; margin-top: 8px; }

.suggestions {
  position: absolute; z-index: 5; left: 0; right: 0; top: 50px;
  margin: 0; padding: 4px; list-style: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 280px; overflow-y: auto;
}
.suggestions li { padding: 9px 10px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.suggestions li .c { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--sea); }

.attempts { margin: 6px 2px 10px; font-size: .85rem; color: var(--muted); }

.guesses { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.guess {
  display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  animation: pop .25s ease-out;
}
.guess .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guess .dist { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .92rem; }
.guess .dir { font-size: 1.15rem; }
.guess .pct {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: .85rem;
  min-width: 48px; text-align: center; padding: 3px 6px; border-radius: 6px; color: #fff;
}
.guess.win { border-color: var(--good); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

.result {
  text-align: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.result-title { font-size: 1.3rem; font-weight: 800; margin: 0 0 4px; }
.result-sub { margin: 0 0 12px; color: var(--muted); }
.next { margin: 12px 0 0; color: var(--muted); font-size: .9rem; }
.next strong { color: var(--text); font-variant-numeric: tabular-nums; }

.map-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.map-tools { padding: 8px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 5px 11px; font-size: .82rem; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.map-box { position: relative; background: var(--sea); }
#map { display: block; width: 100%; aspect-ratio: 4 / 3; touch-action: none; cursor: grab; user-select: none; }
#map:active { cursor: grabbing; }
#map .land-other { fill: var(--land-other); stroke: var(--border-other); stroke-width: .6; vector-effect: non-scaling-stroke; fill-rule: evenodd; }
/* El grosor de costas y puntos lo pone app.js según el zoom (Safari en iPhone ignora vector-effect en trazos de longitud cero) */
#map .land { fill: var(--land); stroke: var(--border); fill-rule: evenodd; }
#map .dots { fill: none; stroke: var(--dot); stroke-linecap: round; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 10px;
  background: var(--sea); border: 1px solid var(--line); border-radius: 12px; }
.tabs button { border: 0; background: none; border-radius: 9px; padding: 8px 6px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.free-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--card); padding: 8px 2px; font-size: .85rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
#cont-select { border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); padding: 0 8px; font: inherit; font-size: .88rem; min-height: 38px; }
.caps-toggle { grid-column: 1 / -1; justify-self: center; }
.clues-ctl { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.clues-ctl > span { color: var(--muted); font-size: .85rem; }
.clues-ctl .seg { flex: 1; }
.hint-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; margin: -4px 0 10px; text-align: center; }
.hint-row[hidden] { display: none; }
.nh-badge { font-size: .85rem; font-weight: 600; color: var(--accent); }
.clue.clue-none { display: block; text-align: center; color: var(--muted); font-size: .9rem; box-shadow: none; background: transparent; border-style: dashed; }
.nh-seal { font-size: .8em; }
.chip.caps-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.daily-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 4px; }
.daily-pick button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: .8rem; line-height: 1.2;
}
.daily-pick .dp-icon { font-size: 1.15rem; }
.daily-pick button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 700; }
.free-count { grid-column: 1 / -1; margin: 0; font-size: .78rem; color: var(--muted); text-align: center; }
.flag { width: 1.25em; height: .94em; object-fit: cover; border-radius: 2px; vertical-align: -1px; margin-right: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.flag-big { display: block; height: 48px; width: auto; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
#map .map-label { fill: var(--text); stroke: var(--sea); paint-order: stroke; stroke-linejoin: round; }
.zoom-btns { position: absolute; right: 8px; bottom: 8px; display: grid; gap: 4px; }
.zoom-btns button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); font-size: 1.2rem; line-height: 1; box-shadow: var(--shadow);
}
.map-hint { text-align: center; color: var(--muted); font-size: .75rem; margin: 6px 0 0; }

.practice-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px;
  background: var(--sea); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: .88rem;
}
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.btn-secondary {
  height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); font-weight: 700;
}
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.result-actions[hidden], .result-actions > [hidden] { display: none; }
.fb-ask { margin: 12px 0 0; font-size: .9rem; }

.clue.wide { align-items: center; }
.sil { display: block; height: 72px; width: auto; max-width: 150px; color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: .8rem; margin: 4px 0 10px; }
.rating { display: flex; justify-content: space-between; gap: 6px; margin: 10px 0; }
.rating button {
  flex: 1; font-size: 1.6rem; padding: 6px 0; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); filter: grayscale(.6); opacity: .8;
}
.rating button[aria-pressed="true"] { filter: none; opacity: 1; border-color: var(--accent); background: var(--sea); }
#fb-text {
  width: 100%; resize: vertical; font: inherit; padding: 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
#fb-text:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.credits { font-size: .72rem; opacity: .85; }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 24px; }
.foot a { color: inherit; }

.dialog {
  width: min(92vw, 440px); border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); color: var(--text); padding: 20px; position: relative;
}
.dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog h2 { margin: 0 0 10px; font-size: 1.25rem; }
.dialog h3 { margin: 18px 0 8px; font-size: .95rem; color: var(--muted); }
.dialog ul { padding-left: 18px; }
.dialog li { margin-bottom: 6px; }
.dialog .close {
  position: absolute; right: 10px; top: 8px; border: 0; background: none;
  font-size: 1.6rem; line-height: 1; color: var(--muted);
}
.example span { display: inline-block; margin-top: 4px; padding: 4px 8px; border-radius: 6px; background: var(--sea); }

.topbar-side { display: flex; gap: 6px; }
.lang-btn { font-size: .78rem; letter-spacing: .02em; }
.result-points { margin: -4px 0 12px; font-weight: 700; color: var(--accent); }

/* Clasificación */
#dlg-board .seg { margin-bottom: 8px; }
#dlg-board .seg button { font-size: .8rem; }
.seg.seg-2 { grid-template-columns: 1fr 1fr; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.board li {
  display: grid; grid-template-columns: 28px 1fr auto auto; gap: 8px; align-items: center;
  padding: 6px 10px; border-radius: 8px; background: var(--bg); font-size: .9rem;
}
.board .pos { font-weight: 700; color: var(--muted); text-align: right; }
.board .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .meta { font-size: .78rem; color: var(--muted); }
.board .pts { font-weight: 700; min-width: 3ch; text-align: right; }
.board li.me { background: var(--sea); box-shadow: inset 0 0 0 1px var(--accent); }
.board li.gap { background: none; display: block; text-align: center; padding: 0; color: var(--muted); }
.board li.empty { display: block; text-align: center; color: var(--muted); background: none; }
.account { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .9rem; }
.account p { margin: 0 0 8px; }
.account form { display: flex; gap: 8px; margin-bottom: 8px; }
.account input {
  flex: 1; min-width: 0; height: 42px; padding: 0 12px; font: inherit; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.account input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.account .btn-primary { height: 42px; padding: 0 14px; }
.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 8px;
  padding: 8px 12px; border-radius: 10px; background: var(--sea); border: 1px dashed var(--accent);
}
.code-box code { font-size: 1.05rem; font-weight: 700; letter-spacing: .06em; }
.board-help { margin-top: 12px; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 4px; }
.stat-row b { display: block; font-size: 1.6rem; }
.stat-row span { font-size: .75rem; color: var(--muted); }
.dist { display: grid; gap: 4px; }
.dist-row { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: center; font-size: .85rem; }
.dist-bar {
  background: var(--far); color: #fff; text-align: right; padding: 1px 6px;
  border-radius: 4px; min-width: 22px; font-weight: 700;
}
.dist-bar.today { background: var(--accent); color: var(--accent-ink); }

.toast {
  position: fixed; left: 50%; top: 70px; transform: translateX(-50%) translateY(-10px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 20; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.clue-more, .last-guess { display: none; }
/* ---------- Móvil: todo lo necesario para jugar en una pantalla, sin subir y bajar ---------- */
@media (max-width: 700px) {
  /* orden: pistas → casilla → resultado → mapa → intentos (el más reciente arriba) */
  .wrap { display: flex; flex-direction: column; padding-top: 10px; }
  .result { order: 1; }
  .map-card { order: 2; }
  .map-hint { order: 3; margin-bottom: 12px; }
  .guesses { order: 4; display: flex; flex-direction: column-reverse; }
  /* el último intento, entre la casilla y el mapa (en la lista de abajo no se repite) */
  .guesses.last-guess { order: 0; display: grid; margin-bottom: 10px; }
  .guesses.last-guess:empty { display: none; }
  #guesses:has(+ .last-guess:not(:empty)) > li:last-child { display: none; }
  .clue .flag-big { height: 32px; }
  /* solo las pistas ya desbloqueadas; las demás, resumidas en una línea */
  .clue.locked { display: none; }
  .clue-more { display: block; text-align: center; font-size: .85rem; color: var(--muted); background: transparent;
    border-style: dashed; box-shadow: none; padding: 6px 12px; }
  .clue { padding: 6px 12px; }
  .clues ol { gap: 5px; margin-bottom: 10px; }
  /* cabecera más baja */
  .topbar { padding: 6px 16px; }
  .tabs { margin-bottom: 8px; }
  .tabs button { padding: 6px; }
  .daily-pick button { flex-direction: row; justify-content: center; gap: 5px; padding: 7px 4px; }
  .daily-pick .dp-icon { font-size: 1rem; }
  .subtitle { margin: 2px 0 8px; font-size: .9rem; }
  .attempts { margin: 4px 2px 8px; }
}
.clue.new { animation: clue-new 1.6s ease-out; }
@keyframes clue-new { 0%, 30% { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); } }

.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- Pantalla ancha (ordenador) ---------- */
@media (min-width: 900px) {
  body {
    background-image: var(--bg-rose), var(--bg-grid);
    background-repeat: no-repeat, repeat;
    background-size: 380px 380px, 120px 120px;
    background-position: left 3vw bottom 4vh, center top;
    background-attachment: fixed, fixed;
  }
  .topbar { background: var(--bg); }
}
/* Clasificación al lado del juego */
.side-board { display: none; }
@media (min-width: 1200px) {
  .side-board {
    display: block; position: fixed; top: 86px; left: calc(50% + 300px); width: min(330px, calc(50% - 330px));
    max-height: calc(100vh - 106px); overflow-y: auto;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow);
  }
  .side-board h2 { margin: 0 0 10px; font-size: 1.05rem; }
  .side-board .seg { margin-bottom: 8px; }
  .side-board .seg button { font-size: .76rem; padding: 7px 2px; }
  .side-board .board li { font-size: .85rem; padding: 5px 8px; }
  .side-board .side-join { margin: 10px 0 0; font-size: .85rem; text-align: center; }
}

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