/* Aeriale — layout: a single centred "survey" column; the photo sits in a viewfinder frame
   with HUD readouts, flanked by optional ad columns on wide screens.
   Palette: the logo's light-blue → green gradient on survey-paper grey. */
:root {
  --bg: #E5F1EE;
  --surface: #F5FBF9;
  --surface-2: #D2E7E1;
  --ink: #0B2830;
  --muted: #48676E;
  --line: #B4D1CA;
  --blue: #0A74C2;
  --accent: #0A9677;
  --accent-ink: #FFFFFF;
  --good: #1D8A4B;
  --good-bg: #D0EFDA;
  --bad: #B3261E;
  --hud: rgba(5, 24, 30, .62);
  --hud-ink: #F0FBF8;
  --shadow: 0 1px 0 rgba(11,40,48,.06), 0 10px 30px -18px rgba(11,40,48,.35);
  --grad: linear-gradient(180deg, #0A6FD6, #0FA3C4 30%, #16BC93 55%, #5BD368 78%, #B2F03C);
  --grad-ink: #04211B;

  --f-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #061920; --surface: #0C252C; --surface-2: #11323B; --ink: #E0F5F0; --muted: #8DB0AE;
    --line: #1C434B; --blue: #4CC3F2; --accent: #5ADB86; --accent-ink: #04211B; --good: #77DD8E;
    --good-bg: #113829; --bad: #F08A80; --shadow: 0 10px 30px -18px rgba(0,0,0,.8);
    --grad: linear-gradient(180deg, #0A6FD6, #0FA3C4 30%, #16BC93 55%, #5BD368 78%, #B2F03C); --grad-ink: #04211B;    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #061920; --surface: #0C252C; --surface-2: #11323B; --ink: #E0F5F0; --muted: #8DB0AE;
    --line: #1C434B; --blue: #4CC3F2; --accent: #5ADB86; --accent-ink: #04211B; --good: #77DD8E;
    --good-bg: #113829; --bad: #F08A80; --shadow: 0 10px 30px -18px rgba(0,0,0,.8);
    --grad: linear-gradient(180deg, #0A6FD6, #0FA3C4 30%, #16BC93 55%, #5BD368 78%, #B2F03C); --grad-ink: #04211B;  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1.5px solid var(--ink);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: 0; padding: 4px 0;
  font: 800 1.75rem/1 var(--f-display); letter-spacing: .14em;
}
.wordmark-mark { width: 26px; height: 26px; flex: none; display: block; }
.wordmark-mark svg { width: 100%; height: 100%; display: block; }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 1.5px solid transparent; border-radius: 50%;
}
.icon-btn:hover { border-color: var(--line); background: var(--surface); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.icon-btn svg .fill { fill: var(--ink); stroke: none; }
.icon-btn svg .knob { fill: var(--bg); }

/* ---------- screens ---------- */
#app {
  max-width: 1240px; margin: 0 auto;
  padding-block: 28px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.screen { animation: rise .35s ease backwards; } /* "backwards": no transform left behind, so fixed gradients work inside */
@keyframes rise { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.menu-hero { max-width: 760px; margin: 8px auto 36px; }
.menu-hero h1 { font: 800 clamp(2.4rem, 7vw, 4.4rem)/.95 var(--f-display); letter-spacing: .01em; text-transform: uppercase; }
.lede { font-size: 1.125rem; color: var(--muted); max-width: 46ch; margin: 14px 0 0; }

.mode-group { max-width: 980px; margin: 0 auto 34px; display: grid; grid-template-columns: 140px 1fr; gap: 20px; align-items: start; }
.mode-label { font: 600 .8rem/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-top: 14px; border-top: 1.5px solid var(--ink); }
.mode-grid { display: grid; gap: 14px; }
.mode-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mode-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mode-grid.two { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mode-card {
  position: relative; overflow: hidden; text-align: left;
  display: flex; flex-direction: column; gap: 6px; min-height: 176px;
  padding: 18px 18px 16px;
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: var(--r);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
/* contour-line motif: rings get tighter on "closer" modes */
.mode-card::before {
  content: ""; position: absolute; right: -70px; bottom: -90px; width: 220px; height: 220px; border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 13px, var(--line) 13px 14.5px);
  opacity: .9; pointer-events: none;
}
.mode-card:hover { transform: translateY(-2px); box-shadow: 4px 4px 0 var(--accent); border-color: var(--accent); }
.mode-name { font: 800 2rem/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; position: relative; }
.mode-desc { color: var(--muted); font-size: .95rem; max-width: 26ch; position: relative; }
.mode-meta { margin-top: auto; font: 500 .78rem/1.3 var(--f-mono); color: var(--blue); position: relative; letter-spacing: .02em; }

.back-link { background: none; border: 0; padding: 4px 0; color: var(--muted); font-weight: 600; font-size: .95rem; }
.back-link:hover { color: var(--accent); }
.eyebrow { margin: 14px 0 2px; font: 500 .78rem/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--blue); }

/* picker */
#screen-picker { max-width: 860px; margin: 0 auto; }
#screen-picker h1 { font: 800 clamp(2rem, 5vw, 3rem)/1 var(--f-display); text-transform: uppercase; margin-bottom: 22px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.picker-group { grid-column: 1 / -1; margin: 14px 0 0; font: 500 .78rem/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-top: 12px; border-top: 1.5px solid var(--ink); }
.picker-group:first-child { margin-top: 0; }
.pick {
  text-align: left; padding: 16px 16px 14px; border-radius: var(--r);
  background: var(--surface); border: 1.5px solid var(--ink);
  display: flex; flex-direction: column; gap: 4px;
}
.pick:hover:not(:disabled) { border-color: var(--accent); box-shadow: 3px 3px 0 var(--accent); }
.pick strong { font: 800 1.6rem/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.pick span { font: 500 .78rem/1.3 var(--f-mono); color: var(--muted); }
.pick:disabled { border-style: dashed; border-color: var(--line); background: transparent; cursor: not-allowed; }
.pick:disabled strong { color: var(--muted); }

/* ---------- game ---------- */
.game-layout { display: grid; grid-template-columns: 160px minmax(0, 720px) 160px; justify-content: center; gap: 36px; }
.pp-slot {
  align-self: start; height: 600px;
  border: 1.5px dashed var(--line); border-radius: 6px;
  display: grid; place-items: center; text-align: center;
  font: 500 .72rem/1.5 var(--f-mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase;
}
body.no-pp .game-layout { grid-template-columns: minmax(0, 720px); }
.game-col { min-width: 0; }
.game-head h1 { font: 800 clamp(2.2rem, 6vw, 3.2rem)/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }

.tiers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.tier {
  background: none; border: 0; padding: 6px 2px 0; text-align: left;
  font: 600 .82rem/1.2 var(--f-body); color: var(--muted);
  display: flex; flex-direction: column; gap: 7px;
}
.tier .bar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.tier .bar i { display: block; height: 100%; width: 0; background: var(--muted); transition: width .4s ease; }
.tier .count { font: 400 .7rem/1 var(--f-mono); color: var(--muted); }
.tier[aria-selected="true"] { color: var(--ink); }
.tier[aria-selected="true"] .bar { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); }
.tier[aria-selected="true"] .bar i { background: var(--accent); }
.tier:disabled { opacity: .45; cursor: not-allowed; }
.tier:hover:not(:disabled):not([aria-selected="true"]) { color: var(--ink); }
.tier-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 10px 0 12px; }
.tier-desc { margin: 0; color: var(--muted); font-size: .95rem; min-height: 1.5em; }
.new-only { display: inline-flex; align-items: center; gap: 8px; flex: none; margin-left: auto; font-size: .85rem; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; }
.new-only:has(input:checked) { color: var(--ink); }
.switch.small { width: 36px; height: 21px; }
.switch.small::after { width: 13px; height: 13px; }
.switch.small:checked::after { transform: translateX(15px); }

.frame {
  position: relative; aspect-ratio: 16 / 10; max-width: 100%;
  border: 1.5px solid var(--ink); border-radius: var(--r); overflow: hidden;
  background: #1b2730; box-shadow: var(--shadow);
}
.map, .map.mapboxgl-map { position: absolute; inset: 0; isolation: isolate; }
.map-shield { position: absolute; inset: 0; z-index: 3; background: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.frame-cover {
  position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #16222a; color: #c9d4d8; font: 500 .8rem/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
  transition: opacity .35s ease;
}
.frame-cover.gone { opacity: 0; pointer-events: none; }
.frame-cover.error, .frame-cover.done { text-transform: none; letter-spacing: 0; font: 500 .95rem/1.5 var(--f-body); padding: 24px; text-align: center; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.frame-cover.error .spinner, .frame-cover.done .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.hud { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.corner { position: absolute; width: 22px; height: 22px; border: 0 solid rgba(255,255,255,.85); }
.corner.tl { top: 12px; left: 12px; border-top-width: 2px; border-left-width: 2px; }
.corner.tr { top: 12px; right: 12px; border-top-width: 2px; border-right-width: 2px; }
.corner.bl { bottom: 30px; left: 12px; border-bottom-width: 2px; border-left-width: 2px; }
.corner.br { bottom: 30px; right: 12px; border-bottom-width: 2px; border-right-width: 2px; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%,-50%); opacity: .55;
  background: linear-gradient(#fff,#fff) center / 1.5px 100% no-repeat, linear-gradient(#fff,#fff) center / 100% 1.5px no-repeat; }
.hud-tag {
  position: absolute; padding: 4px 7px; border-radius: 4px;
  background: var(--hud); color: var(--hud-ink);
  font: 500 .72rem/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; font-variant-numeric: tabular-nums;
}
.hud-tl { top: 18px; left: 40px; }
.hud-tr { top: 18px; right: 40px; }
.hud-bl { bottom: 36px; left: 40px; }

.guess-form { display: flex; gap: 8px; margin-top: 14px; }
.combo { position: relative; flex: 1; min-width: 0; }
#guess-input {
  width: 100%; height: 50px; padding: 0 16px;
  font: 500 1.05rem var(--f-body); color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: 999px;
}
#guess-input::placeholder { color: var(--muted); }
#guess-input:disabled { opacity: .55; }
.suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 10;
  list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow);
  max-height: 280px; overflow-y: auto;
}
.suggestions li { padding: 9px 12px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.suggestions li small { color: var(--muted); font: 400 .78rem var(--f-mono); }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--surface-2); }
.suggestions li.used { opacity: .45; }

.btn {
  height: 50px; padding: 0 20px; border-radius: 999px; font-weight: 700; white-space: nowrap;
  border: 1.5px solid var(--ink); background: var(--surface);
}
.btn.small { height: 36px; padding: 0 14px; font-size: .9rem; }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.form-msg { min-height: 1.4em; margin: 8px 4px 0; font-size: .9rem; color: var(--bad); }

.result {
  min-height: 78px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin: 14px 0 22px; padding: 12px 12px 12px 18px; border-radius: var(--r);
  border: 1.5px solid var(--ink); background: var(--surface);
}
.result.win { border-color: var(--good); background: var(--good-bg); }
.result-kicker { margin: 0; font: 500 .75rem/1.2 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.result.win .result-kicker { color: var(--good); }
.result-answer { margin: 2px 0 0; font: 800 1.9rem/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.result-actions { display: flex; gap: 8px; }

.guesses { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 8px; }
.guess {
  display: grid; grid-template-columns: 28px minmax(0,1fr) auto 32px; align-items: center; gap: 10px;
  height: 46px; padding: 0 10px 0 14px; border-radius: 999px;
  border: 1.5px solid var(--ink); background: var(--surface);
  font-variant-numeric: tabular-nums;
}
.guess.empty { border-style: dashed; border-color: var(--line); background: transparent; color: var(--muted); }
.guess .n { font: 500 .78rem var(--f-mono); color: var(--muted); }
.guess .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guess .dist { font: 500 .9rem var(--f-mono); }
.guess .dir { width: 28px; height: 28px; display: grid; place-items: center; }
.guess .dir svg { width: 22px; height: 22px; transform-origin: 50% 50%; transform-box: border-box; transition: transform .5s cubic-bezier(.3,1.4,.5,1); }
.guess .dir svg path { fill: var(--blue); }
.guess.correct { border-color: var(--good); background: var(--good-bg); }
.guess.correct .dir svg path { fill: var(--good); }
.guess.skipped .name { color: var(--muted); font-style: italic; font-weight: 500; }
.guess.new { animation: pop .3s ease; }
@keyframes pop { from { transform: scale(.97); opacity: .3; } to { transform: none; opacity: 1; } }

/* ---------- modals ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(8, 14, 18, .55); }
.modal {
  position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto;
  padding: 22px 24px 24px; border-radius: 14px;
  background: var(--surface); border: 1.5px solid var(--ink); box-shadow: 8px 8px 0 var(--accent);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal h2 { font: 800 2rem/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.modal h3 { margin: 20px 0 8px; font: 500 .78rem/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.modal p { margin: 0 0 10px; }
.close { font-size: 1.6rem; line-height: 1; }
.steps { padding-left: 1.2em; margin: 0; display: grid; gap: 8px; }

.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.opt-row:first-of-type { border-top: 0; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 6px 14px; font-weight: 600; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-2); border: 1.5px solid var(--ink); position: relative; cursor: pointer; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: transform .2s; }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(18px); background: var(--accent-ink); }
.confirm { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-top: 14px; }
.stat { text-align: center; }
.stat b { display: block; font: 800 2.2rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.stat span { font: 500 .7rem/1.2 var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.dist { display: grid; gap: 6px; }
.dist-row { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: center; font: 500 .8rem var(--f-mono); }
.dist-row i { display: block; height: 22px; min-width: 26px; border-radius: 4px; background: var(--surface-2); color: var(--ink); font-style: normal; text-align: right; padding: 3px 7px; font-size: .75rem; }
.dist-row.hot i { background: var(--accent); color: var(--accent-ink); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50;
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: .9rem;
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .game-layout { grid-template-columns: minmax(0, 720px); }
}
@media (max-width: 760px) {
  .mode-group { grid-template-columns: 1fr; gap: 10px; }
  .mode-label { padding-top: 10px; }
  .mode-grid.three, .mode-grid.two, .mode-grid.four { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  #app { padding-block: 18px 48px; }
  .mode-grid.three, .mode-grid.two, .mode-grid.four { grid-template-columns: 1fr; }
  .mode-card { min-height: 128px; }
  .tiers { gap: 5px; }
  .tier { font-size: .7rem; }
  .frame { aspect-ratio: 1 / 1; }
  .guess-form { flex-wrap: wrap; }
  .combo { flex-basis: 100%; }
  .guess-form .btn { flex: 1; }
  .hud-tl, .hud-bl { left: 18px; } .hud-tr { right: 18px; }
  .corner { display: none; }
  .result-actions { width: 100%; } .result-actions .btn { flex: 1; }
  .stat-row { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------- Subway lines mode ---------------- */
.draw-layer { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; display: none; touch-action: none; cursor: crosshair; }
.palette { position: absolute; left: 14px; bottom: 34px; z-index: 3; display: none; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 28px); }
body.mode-subway .draw-layer, body.mode-subway .palette { display: flex; }
body.mode-subway .draw-layer { display: block; }
body.mode-subway .crosshair, body.mode-subway .guess-form, body.mode-subway .form-msg,
body.mode-subway #guesses, body.mode-subway .hud-bl { display: none !important; }
.swatch {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 7px; border: 2px solid rgba(0,0,0,.55);
  background: var(--c); color: var(--on, #fff); font: 700 .78rem/1 var(--f-mono); cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.4); display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.swatch[aria-pressed="true"] { outline: 3px solid #fff; outline-offset: 2px; }
.swatch.drawn::after { content: "✓"; font-size: .75rem; }
.swatch:disabled { cursor: default; }
.sub-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; }
.sub-hint { margin: 0; color: var(--muted); font-size: .92rem; }
.sub-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sub-scores { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 8px; }
.sub-score {
  display: grid; grid-template-columns: 22px minmax(0,1fr) minmax(60px, 34%) 48px; align-items: center; gap: 10px;
  height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--surface);
}
.sub-score .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--c); border: 1.5px solid rgba(0,0,0,.4); }
.sub-score .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-score .bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.sub-score .bar i { display: block; height: 100%; background: var(--c); }
.sub-score .pts { font: 600 .95rem var(--f-mono); text-align: right; font-variant-numeric: tabular-nums; }
.zoom-tools { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); z-index: 3; display: none; flex-direction: column; gap: 6px; }
body.mode-subway .zoom-tools { display: flex; }
.ztool {
  width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid rgba(0,0,0,.5); background: rgba(16,26,33,.82); color: #fff;
  font: 600 1.2rem/1 var(--f-body); display: grid; place-items: center; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.ztool svg { width: 18px; height: 18px; fill: currentColor; }
.ztool:hover { background: rgba(16,26,33,.95); }
.ztool[aria-pressed="true"] { background: #fff; color: #10191f; }
.draw-layer.move-mode { cursor: grab; }
.draw-layer.panning { cursor: grabbing; }
/* Subway lines: use the whole width of the window, and a tall photo to draw on */
body.mode-subway #app { max-width: none; }
body.mode-subway .game-layout { grid-template-columns: minmax(0, 1600px); }
body.mode-subway .frame { aspect-ratio: auto; height: clamp(400px, calc(100vh - 330px), 1000px); }
@media (max-width: 520px) {
  body.mode-subway .frame { height: clamp(320px, 72vh, 760px); }
}
.swatch.shown { opacity: .55; text-decoration: line-through; cursor: default; }
.swatch.shown::after { content: "👁"; font-size: .7rem; text-decoration: none; }
body.mode-unzoomed .crosshair { display: none; }

/* Bigger photo: the game column fills the space between the two ad columns (pushed to the edges) */
@media (min-width: 761px) {
  body.in-game #app { max-width: none; }
  .game-layout { grid-template-columns: 160px minmax(0, 1fr) 160px; justify-content: stretch; gap: 28px; }
  .game-col { width: 100%; max-width: 1280px; justify-self: center; }
  .frame { aspect-ratio: auto; height: clamp(340px, min(calc(100vh - 400px), 60vw), 860px); }
}
@media (min-width: 761px) and (max-width: 1180px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); }
}
body.no-pp .game-layout { grid-template-columns: minmax(0, 1fr); }
body.mode-subway .game-col { max-width: none; }
body.mode-subway .game-layout { justify-content: center; } /* keep the wide subway column centred in the window */
#replay-btn { display: none; }
body.mode-subway #replay-btn { display: inline-flex; }

/* Brand gradient on the selected difficulty and the progress bars */
.tier[aria-selected="true"] .bar i { background: var(--grad); }
.tier .bar i { background: var(--grad); opacity: .55; }
.tier[aria-selected="true"] .bar i { opacity: 1; }

/* ================= Theme: the logo's blue → green gradient throughout ================= */
body {
  background:
    radial-gradient(1100px 620px at -8% -12%, color-mix(in srgb, #0A6FD6 16%, transparent), transparent 70%),
    radial-gradient(900px 560px at 108% 4%, color-mix(in srgb, #5BD368 14%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.topbar { border-bottom: 2px solid; border-image: var(--grad) 1; }
.wordmark { color: var(--ink); }
#menu-title {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.eyebrow { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; width: fit-content; }
.mode-label { color: var(--accent); }
.mode-card { border-color: color-mix(in srgb, var(--ink) 55%, transparent); }
.mode-card::before { background: repeating-radial-gradient(circle, transparent 0 13px, color-mix(in srgb, var(--accent) 38%, transparent) 13px 14.5px); }
.mode-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 14px 30px -16px color-mix(in srgb, var(--accent) 70%, transparent); }
.mode-meta { color: var(--blue); }
.btn.primary { background: var(--grad); color: var(--grad-ink); border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: var(--grad); filter: brightness(1.08) saturate(1.1); color: var(--grad-ink); border-color: transparent; }
.frame { border: 2px solid transparent; background: linear-gradient(#10232a, #10232a) padding-box, var(--grad) border-box; }
.switch:checked { background: var(--grad); border-color: transparent; }
.switch:checked::after { background: #fff; }
.tier .bar i { background: var(--grad); opacity: .7; }
.tier[aria-selected="true"] .label { color: var(--accent); }
.result { border-color: color-mix(in srgb, var(--ink) 50%, transparent); }
.result.win { border: 2px solid transparent; background: linear-gradient(var(--good-bg), var(--good-bg)) padding-box, var(--grad) border-box; }
.guess { border-color: color-mix(in srgb, var(--ink) 45%, transparent); }
.guess.correct { border: 2px solid transparent; background: linear-gradient(var(--good-bg), var(--good-bg)) padding-box, var(--grad) border-box; }
#guess-input:focus, .combo input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.icon-btn:hover { color: var(--accent); }
.icon-btn:hover svg { stroke: var(--accent); }
.icon-btn:hover svg .fill { fill: var(--accent); }
.mode-label { border-top: 2px solid; border-image: var(--grad) 1; }

/* ---------------- Main menu sections ---------------- */
.section-grid { max-width: 980px; margin: 0 auto 40px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.section-card {
  position: relative; overflow: hidden; text-align: left; min-height: 210px;
  display: flex; flex-direction: column; gap: 10px; padding: 26px 26px 22px;
  background: var(--surface); border: 2px solid transparent; border-radius: calc(var(--r) + 4px);
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box;
  transition: transform .15s ease, box-shadow .15s ease;
}
.section-card::before {
  content: ""; position: absolute; right: -80px; bottom: -110px; width: 280px; height: 280px; border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 15px, color-mix(in srgb, var(--accent) 34%, transparent) 15px 16.5px);
  pointer-events: none;
}
.section-card:hover { transform: translateY(-3px); box-shadow: 0 18px 36px -18px color-mix(in srgb, var(--accent) 75%, transparent); }
.section-name { font: 800 3rem/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; position: relative;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; width: fit-content; }
.section-desc { color: var(--muted); font-size: 1rem; max-width: 34ch; position: relative; }
.section-meta { margin-top: auto; font: 500 .8rem/1.3 var(--f-mono); color: var(--blue); position: relative; }
.section-detail { max-width: 980px; margin: 0 auto; }
.section-detail .mode-group { display: block; margin: 8px 0 30px; }
.section-detail .mode-group[hidden] { display: none; }
.section-title { font: 800 3.2rem/1 var(--f-display); text-transform: uppercase; margin: 10px 0 20px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; width: fit-content; }
@media (max-width: 760px) {
  .section-grid { grid-template-columns: 1fr; }
  .section-card { min-height: 160px; }
  .section-name { font-size: 2.4rem; }
}

/* The brand gradient runs down the whole window (blue at the top, green at the bottom): every element
   that uses it shows the slice for where it sits on screen, instead of its own left-to-right copy. */
#menu-title, .eyebrow, .section-name, .section-title, .btn.primary, .switch:checked, .tier .bar i { background-attachment: fixed; }
.frame { background: linear-gradient(#10232a, #10232a) padding-box, var(--grad) fixed border-box; }
.section-card { background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) fixed border-box; }
.result.win { background: linear-gradient(var(--good-bg), var(--good-bg)) padding-box, var(--grad) fixed border-box; }
.guess.correct { background: linear-gradient(var(--good-bg), var(--good-bg)) padding-box, var(--grad) fixed border-box; }
.btn.primary:hover:not(:disabled) { background: var(--grad) fixed; }
/* thin lines can't show a vertical gradient: the top bar takes the top colour, section rules the middle */
.topbar { border-image: none; border-bottom: 2px solid #0A6FD6; }
.mode-label { border-image: none; border-top: 2px solid #16BC93; }

}

/* ================= Ads: placement changes with the screen, so every visitor sees some
   without ads ever covering the photo or the guess box =================
   ≥1421px  : a column on each side — 300×600 next to the photo, two 300×250 lower down
   1181–1420: one column on the right — 300×600 + 300×250
   761–1180 : a 728×90 banner under the guesses (and under the menu)
   ≤760     : a 320×50 banner fixed to the bottom of the screen (can be closed) + a 300×250 under the guesses
   Subway lines keeps the whole width for drawing: only the in-page banner, never the side columns or the fixed one. */
.pp-slot { position: static; }
.pp-col, .pp-inline, .pp-anchor, .pp-menu { display: none; }
.pp-col { flex-direction: column; gap: 16px; align-self: start; width: 300px; }
.pp-col .pp-slot { width: 300px; }
.pp-col .pp-600 { height: 600px; }
.pp-col .pp-250 { height: 250px; }
.pp-inline, .pp-menu { margin: 26px auto 0; }
.pp-728 { width: 728px; max-width: 100%; height: 90px; }
.pp-300 { width: 300px; height: 250px; }
.pp-anchor {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; justify-content: center; align-items: center;
  padding: 5px 0 calc(5px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-top: 1px solid var(--line); backdrop-filter: blur(6px);
}
.pp-anchor .pp-slot { width: 320px; height: 50px; }
.pp-close {
  position: absolute; right: 8px; top: -14px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer;
}

@media (min-width: 1421px) {
  body:not(.mode-subway) .pp-col { display: flex; }
  body:not(.mode-subway) .game-layout { grid-template-columns: 300px minmax(0, 1fr) 300px; }
  /* pin every column to its place, so an ad blocker hiding the side columns can't squeeze the game into a 300px slot */
  body:not(.mode-subway) .game-layout > .pp-left { grid-column: 1; grid-row: 1; }
  body:not(.mode-subway) .game-layout > .game-col { grid-column: 2; grid-row: 1; }
  body:not(.mode-subway) .game-layout > .pp-right { grid-column: 3; grid-row: 1; }
  .pp-menu.pp-728 { display: grid; }
}
@media (min-width: 1181px) and (max-width: 1420px) {
  body:not(.mode-subway) .pp-col.pp-right { display: flex; }
  body:not(.mode-subway) .pp-col.pp-right .pp-250 ~ .pp-250 { display: none; }
  body:not(.mode-subway) .game-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  body:not(.mode-subway) .game-layout > .game-col { grid-column: 1; grid-row: 1; }
  body:not(.mode-subway) .game-layout > .pp-right { grid-column: 2; grid-row: 1; }
  .pp-menu.pp-728 { display: grid; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  .pp-inline.pp-728, .pp-menu.pp-728 { display: grid; }
  .game-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 761px) {
  body.mode-subway .pp-inline.pp-728 { display: grid; }
}
@media (max-width: 760px) {
  body.in-game:not(.mode-subway):not(.anchor-closed) .pp-anchor { display: flex; }
  body.in-game:not(.mode-subway):not(.anchor-closed) #app { padding-bottom: 80px; }
  /* a slightly shorter photo so the Guess and Skip buttons stay clear of the bottom banner */
  body.in-game:not(.mode-subway):not(.anchor-closed) .frame { aspect-ratio: 6 / 5; }
  body:not(.mode-subway) .pp-inline.pp-300, .pp-menu.pp-300 { display: grid; }
}

/* Wide screens: a flex row instead of grid columns. Whatever an ad blocker hides or removes,
   the game column simply takes the free space and can never be pushed into an ad slot. */
@media (min-width: 1181px) {
  body:not(.mode-subway) .game-layout { display: flex !important; align-items: flex-start; justify-content: center; }
  body:not(.mode-subway) .game-layout > .game-col { flex: 1 1 0; min-width: 0; order: 2; }
  body:not(.mode-subway) .game-layout > .pp-left { flex: 0 0 300px; order: 1; }
  body:not(.mode-subway) .game-layout > .pp-right { flex: 0 0 300px; order: 3; }
  body:not(.mode-subway) .game-layout[hidden] { display: none !important; }
}
body.no-pp .pp-col, body.no-pp .pp-inline, body.no-pp .pp-anchor, body.no-pp .pp-menu { display: none !important; }

/* ---------------- Demo ads (preview only) ---------------- */
.pp-slot.has-demo { border: 0; padding: 0; overflow: hidden; }
.demo-pp {
  position: relative; display: flex; width: 100%; height: 100%; overflow: hidden; text-decoration: none;
  background: var(--dbg); color: var(--dfg); border-radius: 6px; font-family: var(--f-body); text-transform: none; letter-spacing: 0; text-align: left;
}
.demo-tag { position: absolute; top: 4px; right: 4px; z-index: 2; font: 600 9px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 5px; border-radius: 3px; background: rgba(255,255,255,.85); color: #333; }
.demo-art svg { width: 100%; height: 100%; display: block; }
.demo-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.demo-brand { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.demo-head { font: 800 1.35rem/1.05 var(--f-display); text-transform: uppercase; }
.demo-sub { font-size: .82rem; opacity: .9; line-height: 1.3; }
.demo-cta { align-self: flex-start; background: var(--dbtn); color: var(--dink); font-weight: 700; font-size: .85rem; padding: 8px 14px; border-radius: 999px; white-space: nowrap; }
/* 300×600: big picture, text and button underneath */
.demo-300x600 { flex-direction: column; padding: 26px 22px; gap: 18px; }
.demo-300x600 .demo-art { width: 100%; height: 260px; opacity: .9; }
.demo-300x600 .demo-head { font-size: 2.2rem; }
.demo-300x600 .demo-cta { margin-top: auto; font-size: 1rem; padding: 12px 20px; }
/* 300×250 */
.demo-300x250 { flex-direction: column; padding: 18px; gap: 8px; }
.demo-300x250 .demo-art { position: absolute; right: -10px; bottom: -10px; width: 120px; height: 120px; opacity: .35; }
.demo-300x250 .demo-head { font-size: 1.7rem; max-width: 85%; }
.demo-300x250 .demo-cta { margin-top: auto; position: relative; }
/* 728×90 */
.demo-728x90 { align-items: center; padding: 0 18px; gap: 16px; }
.demo-728x90 .demo-art { width: 64px; height: 64px; flex: none; }
.demo-728x90 .demo-text { flex: 1; }
.demo-728x90 .demo-sub { display: none; }
/* 320×50 */
.demo-320x50 { align-items: center; padding: 0 10px; gap: 10px; }
.demo-320x50 .demo-art { width: 34px; height: 34px; flex: none; }
.demo-320x50 .demo-text { flex: 1; gap: 0; }
.demo-320x50 .demo-brand, .demo-320x50 .demo-sub { display: none; }
.demo-320x50 .demo-head { font-size: .95rem; }
.demo-320x50 .demo-cta { padding: 6px 10px; font-size: .75rem; }
.demo-320x50 .demo-tag { top: 2px; right: auto; left: 2px; font-size: 7px; padding: 2px 3px; }
.demo-728x90 .demo-tag { left: 4px; right: auto; }
.demo-728x90 .demo-cta { align-self: center; }

/* ---------------- Ad-blocker wall ---------------- */
.abw { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 14, 18, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.abw[hidden] { display: none; }
.abw-box { width: min(460px, 100%); text-align: center; padding: 28px 26px 26px; border-radius: 16px;
  background: var(--surface); border: 1.5px solid var(--ink); box-shadow: 8px 8px 0 var(--accent); }
.abw-box h2 { margin: 6px 0 12px; font: 800 2rem/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.abw-box p { margin: 0 0 10px; font-size: 1.05rem; }
.abw-box .abw-small { color: var(--muted); font-size: .9rem; margin-bottom: 20px; }
.abw-logo { width: 54px; height: 54px; }
.abw-box .btn { width: 100%; justify-content: center; }
body.abw-on { overflow: hidden; }

/* ---------------- Suggestions ---------------- */
#screen-suggest { max-width: 860px; margin: 0 auto; }
#screen-suggest h1 { font: 800 clamp(2rem, 5vw, 3rem)/1 var(--f-display); text-transform: uppercase; margin-bottom: 10px; }
.sg-lede { color: var(--muted); margin: 0 0 22px; }
.sg-choices { max-width: none; margin: 0; }
.sg-form { display: grid; gap: 16px; }
.sg-city { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sg-field { display: grid; gap: 6px; }
.sg-field > span { font: 500 .78rem/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.sg-field em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--muted); font-family: var(--f-body); }
.sg-field input, .sg-field textarea {
  width: 100%; padding: 12px 16px; font: 500 1rem var(--f-body); color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: 12px;
}
.sg-field input { height: 48px; border-radius: 999px; }
.sg-field textarea { resize: vertical; min-height: 140px; }
.sg-field input:focus, .sg-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.sg-bot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.sg-status { margin: 0; min-height: 1.4em; font-size: .95rem; }
.sg-status.err { color: #E5484D; }
.sg-actions { display: flex; gap: 12px; justify-content: flex-end; }
.sg-done { text-align: center; padding: 30px 0; }
.sg-done h2 { font: 800 2.4rem/1 var(--f-display); text-transform: uppercase; margin-bottom: 10px; }
.sg-done .sg-actions { justify-content: center; margin-top: 20px; }
@media (max-width: 560px) { .sg-city { grid-template-columns: 1fr; } .sg-actions .btn { flex: 1; } }

/* ---------------- Footer (legal links, map credits) ---------------- */
.site-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; padding: 18px 16px 26px;
  font: 400 .8rem/1.4 var(--f-body); color: var(--muted); text-align: center; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--ink); }
body.in-game:not(.anchor-closed) .site-foot { padding-bottom: 90px; }
@media (min-width: 761px) { body.in-game:not(.anchor-closed) .site-foot { padding-bottom: 26px; } }
/* OpenStreetMap credit for the subway lines (ODbL) */
.osm-credit { display: none; position: absolute; right: 8px; bottom: 28px; z-index: 6; padding: 2px 6px; border-radius: 4px;
  background: rgba(255,255,255,.75); color: #333; font: 400 11px/1.3 var(--f-body); text-decoration: none; }
.osm-credit:hover { text-decoration: underline; }
body.mode-subway .osm-credit { display: block; }
