:root {
  /* the difficulty hues, used by the mode buttons and the tier chip */
  --t-casual: #86d6a6;
  --t-hard: #e3b96a;
  --t-genius: #f0a3ab;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* dvh follows the mobile browser's shrinking/growing chrome, so the maps don't
   jump when the URL bar hides */
@supports (height: 100dvh) { html, body { height: 100dvh; } }
body {
  display: flex; flex-direction: column;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0d0f13; color: #e8ebf0;
  /* no double-tap zoom, and no pull-to-refresh fighting a map drag */
  touch-action: manipulation;
  overscroll-behavior: none;
}

/* Touch inside a map belongs to the MAP. Without this, a pinch that starts on
   the map — or that drifts a finger onto the panel around it — zooms the whole
   page instead of the footprints. Page zoom stays available everywhere else,
   so this doesn't take accessibility zoom away. */
.map, .map canvas, .maplibregl-canvas-container {
  touch-action: none;
}

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; border-bottom: 1px solid #222834; background: #11141b;
}
header h1 { font-size: 18px; margin: 0; letter-spacing: 0.5px; }
#title { cursor: pointer; }
#title:hover { color: #9aa4b2; }
.header-right { display: flex; align-items: center; gap: 18px; }
.scores { display: flex; gap: 20px; font-size: 14px; color: #9aa4b2; }
.scores b { color: #e8ebf0; }
.leave-btn {
  padding: 6px 12px; border: 1px solid #2a3140; border-radius: 6px;
  background: transparent; color: #9aa4b2; font-size: 13px; cursor: pointer;
}
.leave-btn:hover { color: #e8ebf0; border-color: #3a4150; }

main { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; min-height: 0; }
.panel { display: flex; flex-direction: column; min-height: 0; position: relative; }
.panel-label {
  padding: 8px 14px; font-size: 13px; color: #9aa4b2;
  background: #11141b; border-bottom: 1px solid #222834;
}
.map { flex: 1; min-height: 0; position: relative; }
#footprint-map { background: #0d0f13; }

#guess-btn {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 5; padding: 10px 22px; border: 0; border-radius: 8px;
  background: #3b82f6; color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
#guess-btn:disabled { background: #384152; color: #8b93a1; cursor: not-allowed; }

.result {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; gap: 14px;
  padding-top: 72px; background: transparent; z-index: 20;
  pointer-events: none;                 /* let the player see & pan the maps behind */
}
.result.hidden { display: none; }
.result > * { pointer-events: auto; }   /* but the card and button stay interactive */
#result-text {
  font-size: 20px; text-align: center; line-height: 1.5;
  background: rgba(15,18,24,.94); border: 1px solid #222834; border-radius: 16px;
  padding: 18px 26px; box-shadow: 0 24px 70px rgba(0,0,0,.6);
}
#result-text .pts { font-size: 42px; font-weight: 700; color: #4ade80; }
#result-text .city { font-weight: 700; }
#result-text .breakdown { font-size: 14px; color: #9aa4b2; margin-top: 4px; }
/* Region credit sits between the distance line and the arithmetic, in the accent
   the game uses for "this went your way" — the same blue as a rank or a
   highlighted leaderboard row, not a new colour asking to be decoded. */
#result-text .region-credit { font-size: 14px; color: #93c5fd; margin-top: 4px; }
#result-text .region-credit b { font-weight: 700; }
#next-btn {
  padding: 12px 28px; border: 0; border-radius: 8px; background: #3b82f6;
  color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
footer { padding: 6px 14px; font-size: 11px; color: #5b6472; background: #11141b; text-align: center; }

/* ---- start / summary screens ---- */
.screen {
  position: fixed; inset: 0; z-index: 30; padding: 20px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 25%, #171d28, #0b0d11);
}
.screen.hidden { display: none; }
.screen-card {
  width: 100%; max-width: 460px; text-align: center;
  background: #11141b; border: 1px solid #222834; border-radius: 16px;
  padding: 32px 28px; box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.screen-card .big { font-size: 40px; margin: 0 0 6px; letter-spacing: .5px; }
.screen-card .tag { color: #9aa4b2; margin: 0 0 22px; font-size: 15px; }
.how {
  text-align: left; color: #c2c9d4; font-size: 14px; line-height: 1.6;
  margin: 0 auto 26px; padding-left: 22px; max-width: 370px;
}
.how li { margin-bottom: 7px; }
.how em { color: #e8ebf0; font-style: normal; font-weight: 600; }
.primary-btn {
  padding: 13px 36px; border: 0; border-radius: 10px; background: #3b82f6;
  color: #fff; font-size: 17px; font-weight: 700; cursor: pointer;
}
.primary-btn:hover { background: #2f6fe0; }
.total-big { font-size: 52px; font-weight: 800; color: #4ade80; margin: 2px 0 18px; }
.total-big small { font-size: 20px; color: #9aa4b2; font-weight: 500; }
.summary-list { list-style: none; padding: 0; margin: 0 0 24px; text-align: left; }
.summary-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 4px; border-bottom: 1px solid #1c212b; font-size: 14px;
}
.summary-list .s-city { color: #e8ebf0; }
.summary-list .s-meta { color: #9aa4b2; white-space: nowrap; }

/* ---- login form ---- */
.login-form { display: grid; gap: 14px; text-align: left; margin: 0 0 6px; }
.login-form label, .settings label { display: grid; gap: 6px; font-size: 13px; color: #9aa4b2; }
.login-form input,
.settings input[type=text], .settings input[type=email] {
  padding: 11px 12px; border: 1px solid #2a3140; border-radius: 8px;
  background: #0d0f13; color: #e8ebf0; font-size: 14px; width: 100%;
}
.login-form input:focus, .settings input:focus { outline: none; border-color: #3b82f6; }
.primary-btn.full { width: 100%; margin-top: 4px; }
.divider { display: flex; align-items: center; gap: 10px; color: #5b6472; font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #222834; }
.oauth-row { display: grid; gap: 10px; }
.oauth-btn {
  padding: 11px 14px; border: 1px solid #2a3140; border-radius: 8px;
  background: #0d0f13; color: #e8ebf0; font-size: 14px; font-weight: 600; cursor: pointer;
}
.oauth-btn:hover { border-color: #3a4150; background: #141821; }
.fineprint { font-size: 12px; color: #5b6472; margin: 16px 0 0; }
.login-msg { font-size: 13px; color: #93c5fd; text-align: center; margin: 12px 0 0; }
.login-msg.hidden { display: none; }
.oauth-btn:disabled { color: #5b6472; cursor: not-allowed; opacity: .7; }

/* ---- landing (immersive reveal) ---- */
.screen.landing { padding: 0; background: #0a0c10; overflow: hidden; }
#landing-map {
  position: absolute; inset: 0; z-index: 0;
  opacity: 0; transition: opacity 1.4s ease;
}
#landing-map.shown { opacity: 1; }
#landing-bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
#landing-bg.hidden { display: none; }
.landing-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse 72% 66% at 50% 46%,
    rgba(10,12,16,.74) 0%, rgba(10,12,16,.36) 50%, rgba(10,12,16,.08) 100%);
}
.landing-card {
  position: relative; z-index: 2; width: 100%; max-width: 430px; margin: 20px; text-align: center;
  background: rgba(15,18,24,.62); backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(255,255,255,.10); border-radius: 20px;
  padding: 34px 30px; box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.wordmark {
  font-size: 40px; margin: 0 0 12px; letter-spacing: .5px; font-weight: 800; line-height: 1.05;
  background: linear-gradient(90deg,#ff6b6b,#ffd93d,#6bff9e,#4dd0ff,#7c86ff,#e86bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { color: #c2c9d4; font-size: 15px; line-height: 1.55; margin: 0 auto 24px; max-width: 340px; }
.play-btn {
  width: 100%; padding: 16px; border: 0; border-radius: 12px; cursor: pointer;
  font-size: 19px; font-weight: 800; color: #fff; letter-spacing: .3px;
  background: linear-gradient(135deg,#3b82f6,#6d5cff);
  box-shadow: 0 10px 30px rgba(59,130,246,.35); transition: transform .08s ease, box-shadow .2s ease;
}
.play-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(59,130,246,.45); }
.play-caption { color: #7f8896; font-size: 12px; margin-top: 10px; }
.landing-footer {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 12px 14px; text-align: center; font-size: 11px; color: #7f8896;
  background: linear-gradient(to top, rgba(10,12,16,.75), rgba(10,12,16,0));
}
.landing-signin { margin-top: 24px; }
/* The card would otherwise cover the animated background, so the sign-in half
   folds away behind a link and the footprints show through — at every width, not
   just on a phone. The link takes the panel's place while it's folded. */
.signin-toggle { display: block; margin: 0; }
.landing-signin.collapsed .signin-body { display: none; }
.landing-signin:not(.collapsed) .signin-toggle { display: none; }
.signin-divider {
  display: flex; align-items: center; gap: 10px; color: #5b6472; font-size: 12px; margin-bottom: 14px;
}
.signin-divider::before, .signin-divider::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.09); }
.landing .login-form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.landing .login-form input {
  width: 100%; padding: 11px 12px; border: 1px solid #2a3140; border-radius: 8px;
  background: rgba(13,15,19,.6); color: #e8ebf0; font-size: 14px;
}
.landing .login-form input:focus { outline: none; border-color: #3b82f6; }
.landing .login-form .primary-btn { width: 100%; padding: 12px 16px; }
.landing .oauth-row { display: flex; gap: 8px; margin-top: 10px; }
.landing .oauth-btn { flex: 1; padding: 10px; font-size: 13px; }
.text-link {
  display: block; width: 100%; margin: 14px 0 0; padding: 6px;
  background: none; border: 0; color: #93c5fd; font-size: 14px; font-weight: 600; cursor: pointer;
}
.text-link:hover { color: #bfdbfe; text-decoration: underline; }
.text-link:disabled { color: #5b6472; cursor: not-allowed; }
.text-link:disabled:hover { color: #5b6472; text-decoration: none; }
.login-form input:disabled, .login-form button:disabled { opacity: .55; cursor: not-allowed; }

/* ---- guest end: blurred leaderboard teaser ---- */
.lb-teaser {
  position: relative; text-align: left; margin: 20px 0; padding: 14px 18px;
  background: #0f1218; border: 1px solid #1c212b; border-radius: 12px; overflow: hidden;
}
.leaderboard.blurred { filter: blur(2px); pointer-events: none; user-select: none; }
.lb-lock {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 22px 12px 12px; font-size: 13px; font-weight: 600; color: #e8ebf0; text-align: center;
  background: linear-gradient(to top, rgba(15,18,24,.95) 35%, rgba(15,18,24,0));
}

/* a fold for the panels a player rarely opens (account settings) */
.panel-fold > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  margin: 0; user-select: none;
}
.panel-fold > summary::-webkit-details-marker { display: none; }
.panel-fold > summary::after {
  content: ""; width: 6px; height: 6px; margin-left: auto; margin-bottom: 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .18s ease;
}
.panel-fold[open] > summary::after { transform: rotate(-135deg); margin-bottom: -2px; }
.panel-fold > summary:hover { color: #e8ebf0; }
.panel-fold[open] > summary { margin-bottom: 14px; }

/* ---- buy me a coffee ----------------------------------------------------
   Amber is the one warm colour the UI doesn't already use: blue is the primary
   action, green is a score, red is danger. So this reads as an aside and can't
   be mistaken for either. It stays visually quieter than Play — the click worth
   the most is still the one that starts another game. */
.coffee-btn {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 15px; border: 1px solid #e0bd12; border-radius: 8px;
  background: #ffd93d; color: #0d0f13;
  font-size: 13.5px; font-weight: 700; text-decoration: none;
}
.coffee-btn:hover { background: #ffe463; }
.coffee-link {
  display: inline-block; margin-top: 16px; padding: 6px;
  color: #ffd93d; font-size: 14px; font-weight: 600; text-decoration: none;
}
.coffee-link:hover { text-decoration: underline; }
.coffee-btn:focus-visible, .coffee-link:focus-visible {
  outline: 2px solid #ffd93d; outline-offset: 3px;
}

/* ---- dashboard ---- */
.screen.dashboard { align-items: flex-start; overflow-y: auto; padding: 28px 20px; }
.dash-card {
  width: 100%; max-width: 920px; margin: auto;
  background: #11141b; border: 1px solid #222834; border-radius: 16px;
  padding: 26px; box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.dash-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.dash-top .big { font-size: 28px; margin: 0 0 2px; text-align: left; overflow-wrap: anywhere; }
.dash-top .tag { margin: 0; text-align: left; overflow-wrap: anywhere; }
.dash-actions { display: flex; align-items: center; gap: 10px; }
/* Sign out sits beside the greeting rather than in the action row: it's the one
   control there nobody comes to the dashboard to press, and as an icon it stops
   competing with Play. */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin-left: 12px; vertical-align: middle;
  padding: 0; border: 1px solid #2a3140; border-radius: 8px;
  background: transparent; color: #9aa4b2; cursor: pointer;
}
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: #e8ebf0; border-color: #3a4150; }
.icon-btn:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* min-width:0 — a grid item defaults to min-width:auto and so refuses to shrink
   below its content, which on a phone pushes the whole card wider than the screen */
.dash-panel { background: #0f1218; border: 1px solid #1c212b; border-radius: 12px; padding: 16px 18px; min-width: 0; }
.dash-panel:first-child { grid-column: 1 / -1; }   /* statistics span full width */
/* A .screen is fixed at inset 0 with z-index 30, so the document footer is
   painted underneath it and is invisible on every screen the player can reach
   from the game. The landing screen already carries its own; this is the
   dashboard's. It sits at the end of the card's flow rather than pinned to the
   viewport, so it scrolls in under the badges instead of covering them. */
.dash-footer {
  margin-top: 18px; padding: 14px 0 0; border-top: 1px solid #222834;
  background: none; text-align: center; font-size: 11px; color: #5b6472;
}
.panel-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: .6px;
  color: #9aa4b2; margin: 0 0 14px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.panel-head .panel-title { margin: 0; }

/* leaderboard board switcher: best game / total points / average per game */
.lb-tabs { display: flex; gap: 4px; background: #141821; border: 1px solid #1c212b; border-radius: 8px; padding: 3px; min-width: 0; }
.lb-tab {
  padding: 5px 10px; border: 0; border-radius: 6px; background: transparent;
  color: #9aa4b2; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.lb-tab:hover { color: #e8ebf0; }
.lb-tab.active { background: #232a37; color: #e8ebf0; }
.lb-sub { color: #5b6472; font-size: 12px; }

/* ---- countdown: three seconds of cover while the round loads ---- */
.countdown {
  position: fixed; inset: 0; z-index: 15;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(13,15,19,.78);
}
.countdown.hidden { display: none; }
#countdown-n {
  font-size: 92px; font-weight: 800; line-height: 1; color: #e8ebf0;
  font-variant-numeric: tabular-nums;
}
#countdown-n.tick { animation: cd-pop .45s cubic-bezier(.2,.9,.3,1); }
@keyframes cd-pop { from { transform: scale(1.45); opacity: .15 } to { transform: scale(1); opacity: 1 } }
.countdown-note { color: #9aa4b2; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { #countdown-n.tick { animation: none } }

/* ---- mode overlay: opens over the game, before the first round ---- */
.mode-screen {
  position: fixed; inset: 0; z-index: 28; padding: 20px; overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,12,16,.93);
}
.mode-screen.hidden { display: none; }
/* The settings overlay borrows .mode-screen's look but not its place in the
   stack. The mode picker opens over the GAME, so 28 keeps it under .screen (30)
   — the summary must never end up behind it. Settings opens over the DASHBOARD,
   which is a .screen with an opaque background, so at 28 it was drawn correctly
   and then covered by the very thing it opens on top of: the gear appeared dead
   while the click handler was working the whole time. */
#settings-screen { z-index: 34; }
/* Same trap, same fix: the ad scrim opens over #guest-end, which is a .screen
   (30), so at .mode-screen's 28 it was drawn *behind* the results it is meant
   to cover — "Play again" looked dead for as long as the ad took to arrive.
   36 puts it above every screen and above settings. */
#ad-scrim { z-index: 36; }
.mode-card {
  width: 100%; max-width: 620px; margin: auto; text-align: center;
  background: #11141b; border: 1px solid #222834; border-radius: 16px;
  padding: 24px; box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.mode-title { font-size: 24px; margin: 0 0 6px; }
#settings-screen .mode-card { max-width: 460px; text-align: left; }
#settings-screen .mode-title { text-align: center; }
#settings-screen .danger-zone { margin-top: 18px; }
#settings-screen .text-link { display: block; margin: 16px auto 0; }
.mode-lede { color: #9aa4b2; font-size: 14px; line-height: 1.5; margin: 0 0 18px; }
/* the multiplier is on every card on purpose: it's the whole reason one
   leaderboard can hold every mode, and this is the moment a player will read it */

/* one per row: five modes read as a list to choose from, not a grid to scan */
.mode-picker { display: flex; flex-direction: column; gap: 8px; }
.mode-chip {
  display: grid; grid-template-columns: 5.5rem 1fr auto; align-items: baseline;
  gap: 14px; padding: 12px 15px; cursor: pointer; text-align: left;
  background: #0f1218; border: 1px solid #1c212b; border-radius: 10px;
  color: #9aa4b2; font: inherit;
}
.mode-chip:hover { border-color: #3b82f6; background: #131b2b; color: #e8ebf0; }
.mode-chip:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
/* the mode this player chose last time: a hint, not a selection — pressing a
   card is what starts the game, so nothing here is "already chosen" */
.mode-chip.last { border-color: #2f3f5c; }
.mode-name { font-size: 15px; font-weight: 700; white-space: nowrap; }
/* each mode wears the colour its rounds are scored in — the same three hues the
   result card uses for the tier chip, so the promise on the button and the badge
   on the round match */
.mode-chip[data-mode="mixed"]    .mode-name { color: #e8ebf0; }
.mode-chip[data-mode="capitals"] .mode-name { color: #7fb0ff; }
.mode-chip[data-mode="casual"]   .mode-name { color: var(--t-casual); }
.mode-chip[data-mode="hard"]     .mode-name { color: var(--t-hard); }
.mode-chip[data-mode="genius"]   .mode-name { color: var(--t-genius); }
.mode-blurb { font-size: 12.5px; color: #7f8896; }
.mode-mult { font-size: 12px; color: #5b6472; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mode-chip:hover .mode-mult { color: #9aa4b2; }

/* the tier a round was drawn from, beside the revealed city name */
.tier-chip {
  display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px;
  background: #1c212b; color: #9aa4b2; font-size: 12px; font-weight: 600;
  vertical-align: middle; white-space: nowrap;
}
.tier-chip.tier-casual { background: #16241d; color: var(--t-casual); }
.tier-chip.tier-hard   { background: #241f16; color: var(--t-hard); }
.tier-chip.tier-genius { background: #2b1f24; color: var(--t-genius); }
.summary-mode { color: #7f8896; font-size: 12.5px; margin: -6px 0 10px; }

/* ---- badges ---------------------------------------------------------------
   Ported from the design page. The frame is a MAP TILE — a rounded square, the
   object this game already ships by the thousand; a hexagon or a shield would be
   borrowed from someone else's game. The art inside is real footprint geometry
   from the catalogue, and the colour is the tier palette, so a pink tile means
   the same thing here as it does on a mode button.

   Locked is the same tile with the colour drained out, not a padlock: it should
   read as a city not yet revealed, which is this game's whole metaphor. */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); gap: 10px; }
.badge {
  display: grid; grid-template-columns: 46px 1fr; gap: 11px; align-items: start;
  padding: 11px 12px; border-radius: 11px;
  background: #0d1016; border: 1px solid #1c212b;
  --badge-ground: #0d1016;                /* what the numeral is haloed against */
  --badge-off: #39414f;                   /* the drained-out hue of a locked tile */
}
.badge-text { display: grid; gap: 1px; min-width: 0; }
/* the tile itself: same rounded square, inset ground, hairline border */
.badge-tile {
  width: 46px; height: 46px; border-radius: 9px; display: block;
  background: #0f1218; border: 1px solid #232a37; overflow: hidden;
}
.badge-name { font-size: 12.5px; font-weight: 700; line-height: 1.25; }
.badge-need { font-size: 10.5px; line-height: 1.3; }
/* "31 / 50" — tabular so the numbers line up down the column rather than
   wobbling, and it's the one thing on the tile worth scanning vertically */
.badge-at { font-size: 10px; font-variant-numeric: tabular-nums; letter-spacing: .02em; margin-top: 3px; }
.badge.locked { background: #0f1116; border-color: #1a1e26; }
.badge.locked .badge-tile { opacity: .5; }
.badge.locked .badge-name { color: #6b7482; }
.badge.locked .badge-need { color: #4a525f; }
.badge.locked .badge-at { color: #5a6472; }
/* Rarity is expressed by ground and hue, never by a glow — a starburst reads as
   a mobile game. So an earned tile is a tint of its own tier, nothing more. */
.badge.got.t-casual { --bh: var(--t-casual); }
.badge.got.t-hard   { --bh: var(--t-hard); }
.badge.got.t-genius { --bh: var(--t-genius); }
.badge.got {
  border-color: color-mix(in oklab, var(--bh, #3b82f6) 38%, #1c212b);
  background: color-mix(in oklab, var(--bh, #3b82f6) 7%, #0d1016);
  --badge-ground: color-mix(in oklab, var(--bh, #3b82f6) 7%, #0d1016);
}
.badge.got .badge-tile { border-color: color-mix(in oklab, var(--bh, #3b82f6) 30%, #232a37); }
.badge.got .badge-name { color: var(--bh, #e8ebf0); }
.badge.got .badge-need { color: #9aa4b2; }
.badge-empty { grid-column: 1 / -1; margin: 0; padding: 14px 2px; font-size: 12px; color: #6b7482; }

/* ---- badges won just now ---------------------------------------------------
   The results-screen moment. The same tile as the shelf, so what drops here is
   recognisably the thing that will be waiting on the profile — a different shape
   would read as a different reward. They arrive one after another rather than
   all at once, which is the whole point when a returning player's back catalogue
   lands in one go. */
.badge-drop { margin: -8px 0 22px; }
.badge-drop-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: #7d879a; margin-bottom: 10px;
}
.badge-drop-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.badge-won {
  display: grid; grid-template-columns: 56px auto; gap: 11px; align-items: center;
  text-align: left; padding: 10px 14px 10px 11px; border-radius: 11px;
  border: 1px solid color-mix(in oklab, var(--bh, #3b82f6) 38%, #1c212b);
  background: color-mix(in oklab, var(--bh, #3b82f6) 7%, #0d1016);
  --badge-ground: color-mix(in oklab, var(--bh, #3b82f6) 7%, #0d1016);
  --badge-off: #39414f;
  /* 90ms apart: quick enough that sixteen badges don't outlast the player's
     patience, slow enough to read as a sequence rather than a flicker */
  animation: badge-in .42s cubic-bezier(.2, .8, .3, 1) calc(var(--i) * 90ms) both;
}
.badge-won.t-casual { --bh: var(--t-casual); }
.badge-won.t-hard   { --bh: var(--t-hard); }
.badge-won.t-genius { --bh: var(--t-genius); }
.badge-won .badge-tile {
  width: 56px; height: 56px; border-radius: 11px;
  border-color: color-mix(in oklab, var(--bh, #3b82f6) 30%, #232a37);
}
.badge-won .badge-name { color: var(--bh, #e8ebf0); }
.badge-won .badge-need { color: #9aa4b2; }
@keyframes badge-in {
  from { opacity: 0; transform: translateY(9px) scale(.95); }
  to   { opacity: 1; transform: none; }
}
/* the badges still arrive, they just don't fly in */
@media (prefers-reduced-motion: reduce) { .badge-won { animation: none; } }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-tile { background: #141821; border: 1px solid #1c212b; border-radius: 10px; padding: 14px; text-align: center; }
.stat-val { font-size: 26px; font-weight: 800; color: #4ade80; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: #9aa4b2; margin-top: 4px; }
.stat-sub { color: #5b6472; }

.leaderboard { list-style: none; margin: 0; padding: 0; }
.leaderboard li {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px; border-bottom: 1px solid #1c212b; font-size: 14px;
}
.leaderboard li:last-child { border-bottom: 0; }
.lb-rank { width: 22px; color: #5b6472; font-variant-numeric: tabular-nums; }
.lb-name { flex: 1; min-width: 0; color: #e8ebf0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { color: #9aa4b2; font-variant-numeric: tabular-nums; }
.leaderboard li.you { background: rgba(59,130,246,.12); border-radius: 8px; }
.leaderboard li.you .lb-name { color: #93c5fd; font-weight: 700; }
.lb-empty { color: #5b6472; font-size: 13px; justify-content: center; }

/* The pager borrows the tab chrome above the list rather than inventing a
   second button language for the same panel: same ground, same radius, same
   muted-until-hovered text. A rank is a number in a column, so the two arrows
   sit either side of the count and nothing moves as the digits change. */
.lb-pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 0 2px; }
.lb-page-btn {
  min-width: 30px; height: 26px; padding: 0 8px; cursor: pointer;
  background: #141821; border: 1px solid #1c212b; border-radius: 8px;
  color: #9aa4b2; font: inherit; font-size: 13px; line-height: 1;
}
.lb-page-btn:hover:not(:disabled) { background: #232a37; color: #e8ebf0; }
/* A dead end reads as dead: dimmed and unclickable beats an arrow that does
   nothing when pressed. */
.lb-page-btn:disabled { opacity: .35; cursor: default; }
.lb-page-of { color: #5b6472; font-size: 12px; font-variant-numeric: tabular-nums; min-width: 92px; text-align: center; }
.summary-rank { color: #93c5fd; font-weight: 600; font-size: 14px; margin: -8px 0 14px; min-height: 18px; }

.settings { display: grid; gap: 12px; }
.settings-row { display: flex; align-items: center; gap: 12px; }
.secondary-btn {
  padding: 9px 18px; border: 1px solid #2a3140; border-radius: 8px;
  background: #1a1f29; color: #e8ebf0; font-size: 14px; font-weight: 600; cursor: pointer;
}
.secondary-btn:hover { border-color: #3a4150; }
/* mirrors .primary-btn.full — the guest end screen stacks its actions rather
   than putting them in a row, so the replay button matches the sign-up CTA */
.secondary-btn.full { width: 100%; margin-top: 8px; }
.saved-msg { color: #4ade80; font-size: 13px; }
.saved-msg.hidden { display: none; }
.danger-zone { margin-top: 16px; padding-top: 14px; border-top: 1px solid #241a1a; }
.danger-btn {
  padding: 9px 16px; border: 1px solid #7f1d1d; border-radius: 8px;
  background: transparent; color: #f87171; font-size: 14px; font-weight: 600; cursor: pointer;
}
.danger-btn:hover { background: #7f1d1d; color: #fff; }
.delete-confirm { margin-top: 12px; font-size: 13px; color: #c2c9d4; line-height: 1.5; }
.delete-confirm.hidden { display: none; }
.delete-actions { display: flex; gap: 8px; margin-top: 10px; }

.summary-actions { display: flex; gap: 12px; justify-content: center; }

/* Screens that stack a clickable title above their card. .screen is a flex ROW
   by default, which puts the title beside the card instead of above it — every
   screen carrying a .screen-title has to be listed here. */
#signup-screen, #reset-screen, #guest-end {
  flex-direction: column; gap: 14px; padding: 22px 20px;
}
.screen-title {
  margin: 0; font-size: 22px; font-weight: 800; letter-spacing: .3px; cursor: pointer;
  background: linear-gradient(90deg,#ff6b6b,#ffd93d,#6bff9e,#4dd0ff,#7c86ff,#e86bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.screen-title:hover { opacity: .82; }
#guest-end .screen-card { margin: 0; max-height: calc(100dvh - 90px); overflow-y: auto; }

/* ---- responsive: stack the two panels on narrow screens ---- */
@media (max-width: 860px) {
  /* The game view is exactly one viewport tall and can't be scrolled or zoomed,
     so every row has to earn its height and nothing may spill sideways. */
  body:not(.legal-body) { overflow: hidden; }   /* the legal pages still scroll */
  header { flex-direction: row; align-items: center; gap: 10px; padding: 7px 12px; flex: none; }
  header h1 { font-size: 15px; flex: none; }
  .header-right { flex: 1; justify-content: flex-end; gap: 10px; min-width: 0; }
  .scores { gap: 10px; font-size: 11px; flex-wrap: nowrap; min-width: 0; overflow: hidden; }
  .scores span { white-space: nowrap; }
  .leave-btn { padding: 7px 10px; font-size: 12px; white-space: nowrap; flex: none; }
  main { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; min-height: 0; }
  .panel { min-height: 0; }
  .panel-label { padding: 5px 12px; font-size: 12px; flex: none; }
  footer { flex: none; }
  .screen-card .big { font-size: 32px; }
  .total-big { font-size: 44px; }

  /* a card taller than the phone must scroll — there's no zooming out of it */
  .screen { align-items: flex-start; overflow-y: auto; overscroll-behavior: contain; }
  .screen-card { margin: auto 0; }
  /* …but on the stacked screens the vertical axis is the main one, so they
     start at the top and centre across instead */
  #signup-screen, #reset-screen, #guest-end { align-items: center; justify-content: flex-start; }
  #signup-screen .screen-card, #reset-screen .screen-card, #guest-end .screen-card { margin: 0; }

  /* iOS zooms the page when a focused field is under 16px — that reads as the
     page "randomly" zooming, so keep every input at 16px on touch layouts */
  .login-form input, .settings input[type=text], .settings input[type=email],
  .contact-form input, .contact-form textarea { font-size: 16px; }

  #guess-btn { bottom: 14px; padding: 12px 24px; font-size: 16px; }
  .result { padding-top: 48px; }   /* clear the header */
  #result-text { font-size: 17px; padding: 14px 18px; max-width: 92vw; max-height: 52dvh; overflow-y: auto; }
  #result-text .pts { font-size: 34px; }

  /* the landing is `overflow: hidden` so the map fills it — on a phone the card
     is taller than the screen, so it has to scroll or the sign-in links are
     simply unreachable */
  .screen.landing { align-items: center; overflow-y: auto; }
  .landing-card { margin: 16px 14px 66px; padding: 22px 18px; }
  .wordmark { font-size: 30px; margin-bottom: 6px; }
  .lede { font-size: 13.5px; line-height: 1.45; margin-bottom: 16px; max-width: 30ch; }
  .play-btn { padding: 14px; font-size: 18px; }
  .play-caption { font-size: 11.5px; margin-top: 8px; }
  .landing-signin { margin-top: 14px; }
  .screen { padding: 16px; }
  .screen-card { padding: 24px 18px; }
}
/* short screens (a phone in landscape, or a small window): the game view has no
   room for chrome, so trade it away rather than clip the maps */
@media (max-height: 560px) and (max-width: 860px) {
  .panel-label { display: none; }
  header { padding: 5px 12px; }
  footer { font-size: 10px; padding: 4px 10px; }
  main { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
}
@media (max-width: 720px) {
  .dash-grid { grid-template-columns: 1fr; }
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
  .screen.dashboard { padding: 16px 12px 24px; }
  .dash-card { padding: 18px 16px; }
  .dash-top .big { font-size: 23px; }
  .icon-btn { width: 34px; height: 34px; margin-left: 10px; }
  .dash-actions { width: 100%; flex-wrap: wrap; }
  .dash-actions .primary-btn { flex: 1; }
  /* four cards across is too tight on a phone: two rows of two */
  .mode-chip { grid-template-columns: 4.75rem 1fr auto; gap: 10px; padding: 11px 12px; }
  .mode-card { padding: 18px 16px; }
  .mode-title { font-size: 21px; }
  #countdown-n { font-size: 72px; }
  /* Play and Sign out keep the first row; the coffee pill wraps below and sits
     right, so it never squeezes the action that matters or forces a scroll */
  .coffee-btn { margin-left: auto; }
  /* three boards don't fit a phone's width: give them their own row, and let
     them swipe if even that isn't enough */
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .panel-head .panel-title { flex: 1 0 100%; }
  .lb-tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .lb-tabs::-webkit-scrollbar { display: none; }
  .lb-tab { flex: none; }
  .summary-actions { flex-direction: column-reverse; }
  .summary-actions button { width: 100%; }
  .coffee-link { margin-top: 14px; }
}
/* fingers need bigger targets than a mouse pointer does */
@media (pointer: coarse) {
  .text-link { padding: 11px 6px; }
  .lb-tab { padding: 9px 12px; }
  .secondary-btn, .danger-btn, .leave-btn { min-height: 40px; }
}

/* ---- legal pages (terms / privacy / impressum) ---- */
.legal-body { display: block; height: auto; }
.legal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #222834; background: #11141b;
}
.legal-lang { font-size: 13px; white-space: nowrap; }
.legal-lang a { color: #7f8896; text-decoration: none; margin: 0 3px; }
.legal-lang a.active { color: #e8ebf0; font-weight: 700; }
.legal-lang a:hover { color: #93c5fd; }
.legal-home {
  font-size: 18px; font-weight: 800; text-decoration: none; letter-spacing: .3px;
  background: linear-gradient(90deg,#ffd93d,#6bff9e,#4dd0ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.legal { display: block; max-width: 760px; margin: 0 auto; padding: 34px 22px 90px; line-height: 1.65; font-size: 15px; }
.legal h1 { color: #e8ebf0; font-size: 30px; margin: 8px 0 4px; }
.legal h2 { color: #e8ebf0; font-size: 20px; margin: 32px 0 10px; }
.legal h3 { color: #e8ebf0; font-size: 16px; margin: 22px 0 8px; }
.legal p, .legal li { color: #c2c9d4; }
.legal a { color: #93c5fd; }
.legal ul { list-style: none; padding-left: 0; margin: 10px 0; }
.legal li { margin: 12px 0; }
.legal-updated { color: #7f8896; font-size: 13px; margin: 0 0 22px; }
.legal-disclaimer {
  background: #161a22; border: 1px solid #2a3140; border-left: 3px solid #ffd93d;
  border-radius: 8px; padding: 12px 14px; color: #c2c9d4; font-size: 13px; margin: 0 0 24px;
}
.legal .ph { color: inherit; font-style: normal; }
/* ---- contact form (About page) ----
   Borrows the login form's control styling rather than restating it, so the
   inputs on a legal-layout page still look like the inputs in the game. */
.contact-form { display: grid; gap: 16px; margin: 20px 0 0; }
.contact-form label { display: grid; gap: 6px; font-size: 13px; color: #9aa4b2; }
.contact-form input[type=text],
.contact-form input[type=email],
.contact-form textarea {
  padding: 11px 12px; border: 1px solid #2a3140; border-radius: 8px;
  background: #0d0f13; color: #e8ebf0; font-size: 14px; width: 100%;
  font-family: inherit; line-height: 1.5;
}
.contact-form textarea { resize: vertical; min-height: 120px; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: #3b82f6; }
.contact-form button:disabled { opacity: .55; cursor: not-allowed; }
.contact-hint { font-size: 12px; color: #5b6472; }
/* Off-screen rather than display:none — some bots skip what is not rendered,
   and this field is only worth having if they fill it in. */
.contact-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-msg { font-size: 14px; color: #4ade80; margin: 4px 0 0; }
.contact-msg.bad { color: #f87171; }
.contact-msg.hidden { display: none; }
.contact-fine { font-size: 12px; color: #5b6472; margin: 8px 0 0; line-height: 1.55; }

.footer-links { margin-left: 8px; }
.footer-links a { color: #93c5fd; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
