/* Weight of Nations — daily games. Riso look (same as the map's default):
   two-colour print, pink + blue on newsprint, hard black outlines, mobile first. */
:root {
  --bg: #f4efe4; --surface: #fbf8f1; --surface-2: #efe8da; --line: #1a1a1a;
  --text: #1a1a1a; --text-2: #3c3a36; --text-3: #6d6a63;
  --ink: #0078bf; --on-ink: #ffffff; --accent: #ff48b0; --accent-ink: #1a1a1a;
  --good: #00a95c; --near: #ffb000; --bad: #e8323c;
  --good-bg: #c9ecd8; --near-bg: #fff3a6; --bad-bg: #ffd3e9;
  --ocean: #f4efe4; --land: #ded6c6; --land-line: #fbf8f1;
  --body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: "Arial Black", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --r: 0px;
  --shadow: 4px 4px 0 #1a1a1a;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 16px/1.4 var(--body);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 16px env(safe-area-inset-bottom); }

/* header */
.top { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.top .back { text-decoration: none; color: var(--text-2); width: 32px; height: 36px; display: grid; place-items: center; }
.top .back .lc { width: 26px; height: 26px; }
.top .ttl { flex: 1; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.top h1 { margin: 0; font: 900 21px var(--display); letter-spacing: -0.05em; white-space: nowrap; }
.top .num { color: var(--text-3); font: 13px var(--sans); }
.ic { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text-2); display: grid; place-items: center; padding: 0; }
.ic .lc { width: 18px; height: 18px; }

.play { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 14px 0 20px; }
.loading { margin: auto; color: var(--text-3); font-style: italic; }
.prompt { font-size: 19px; text-align: center; margin: 2px 0; text-wrap: balance; }
.prompt b { font-weight: 600; }
.sub { text-align: center; color: var(--text-3); font: 13px var(--sans); margin: -6px 0 0; }
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.lbl { font: 600 11px var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); text-align: center; text-decoration: none; cursor: pointer; font: 600 16px var(--sans); color: var(--text); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border: 2px solid var(--line); box-shadow: var(--shadow); text-transform: uppercase; letter-spacing: 0.04em; }
.btn.primary:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--line); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn + .btn { margin-top: 8px; }
.btn .lc { width: 18px; height: 18px; }

/* pips: progress through rounds */
.pips { display: flex; gap: 6px; justify-content: center; }
.pips i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); }
.pips i.cur { background: var(--accent); border-color: var(--accent); }
.pips i.good { background: var(--good); border-color: var(--good); }
.pips i.near { background: var(--near); border-color: var(--near); }
.pips i.bad { background: var(--bad); border-color: var(--bad); }

/* picker */
.picker { position: relative; }
.picker input { width: 100%; padding: 13px 14px; font: 17px var(--sans); border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--text); outline: none; }
.picker input:focus { border-color: var(--accent); }
.sugg { position: absolute; left: 0; right: 0; bottom: 100%; margin: 0 0 4px; padding: 0; list-style: none; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; z-index: 10; }
.sugg:empty { display: none; }
.sugg li { padding: 11px 14px; font: 16px var(--sans); cursor: pointer; border-top: 1px solid var(--line); }
.sugg li:first-child { border-top: 0; }
.sugg li.on { background: var(--surface-2); }

/* guess rows */
.rows { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); font: 15px var(--sans); }
.row .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row.good { background: var(--good-bg); border-color: var(--good); }
.row.near { background: var(--near-bg); border-color: var(--near); }
.row.bad { background: var(--bad-bg); border-color: var(--bad); }
.row.empty { color: var(--text-3); border-style: dashed; background: transparent; }

/* hints */
.hints { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.hint { font: 13px var(--sans); padding: 5px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.hint.locked { opacity: 0.55; display: inline-flex; align-items: center; gap: 4px; }
.hint.locked .lc { width: 12px; height: 12px; }
.hint b { color: var(--text); }

/* bottom sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(15, 12, 8, 0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; opacity: 0; transition: opacity 0.2s; }
.sheet-bg.on { opacity: 1; }
.sheet { border-top: 2px solid var(--line); position: relative; width: 100%; max-width: 480px; max-height: 88dvh; overflow: auto; background: var(--surface); border-radius: 14px 14px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); transform: translateY(30px); transition: transform 0.25s; }
.sheet-bg.on .sheet { transform: none; }
.sheet h2 { margin: 0 0 10px; font: 900 26px var(--display); letter-spacing: -0.05em; }
.sheet p, .sheet li { color: var(--text-2); }
.sheet ul { padding-left: 20px; }
.sheet .fine { font: 12px var(--sans); color: var(--text-3); }
.sheet-x { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border: 0; background: none; color: var(--text-3); cursor: pointer; display: grid; place-items: center; }
.sheet-x .lc { width: 22px; height: 22px; }
.sheet .credit { font: 13px var(--sans); color: var(--text-3); margin: 6px 0 0; }
.sheet .credit a { color: var(--text); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.sheet .credit .lc { width: 14px; height: 14px; }
.sum { color: var(--text-2); margin-bottom: 10px; }
.grid-share { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 14px 0; }
.sh-row { display: flex; align-items: center; gap: 4px; }
.sh-cap { font: 600 12px var(--sans); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.sq { display: inline-block; width: 20px; height: 20px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); }
.sq.g { background: var(--good); border-color: var(--good); }
.sq.y { background: var(--near); border-color: var(--near); }
.sq.r { background: var(--bad); border-color: var(--bad); }
.grid-share .lc { width: 18px; height: 18px; color: var(--text-2); margin-right: 4px; }
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; margin: 14px 0; font: 12px var(--sans); color: var(--text-3); }
.statrow b { display: block; font: 900 26px var(--display); color: var(--text); }
.next { text-align: center; font: 14px var(--sans); color: var(--text-3); }
.next b { font-variant-numeric: tabular-nums; color: var(--text); }

.toast { position: fixed; left: 50%; top: 70px; transform: translate(-50%, -10px); background: var(--text); color: var(--bg); font: 600 14px var(--sans); padding: 10px 16px; border-radius: 99px; opacity: 0; transition: 0.25s; z-index: 60; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.shake { animation: shake 0.35s; }
@keyframes pop { 50% { transform: scale(1.06); } }
.pop { animation: pop 0.3s; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Lucide icons */
.lc { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; stroke-width: 2; }
.lc.dir { transition: transform 0.3s; }
.lc.ud { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
