/* geoguess.es — the app shell (docs/redesign/FINAL.md §6). The indigo left rail is gone.
   ≥ 860 px  one 72 px top bar: logo · Play · Charts · Learn · Leaderboards · More ▾ ·· search · theme · bell · account
   < 860 px  a 64 px top bar: logo ·· bell · account (or Sign in) · menu — the menu opens a bottom sheet with everything
   in game   no chrome at all (#game-root owns the viewport). */

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "top" "main";
  min-height: 100vh;
  min-height: 100dvh;
}
.rail, .tabbar { display: none !important; } /* legacy markup, if any page still prints it */

/* keyboard focus never lands under the sticky top bar (WCAG 2.4.11): scrolling into view stops below it.
   --topbar-h follows the 64 px phone bar; the game has no chrome, so no padding there. */
html { scroll-padding-top: calc(var(--topbar-h) + var(--sp-3)); }
:root:has(body[data-chrome="game"]) { scroll-padding-top: 0; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  grid-area: top;
  position: sticky; top: 0; z-index: var(--z-rail);
  display: flex; align-items: center; gap: var(--sp-8);
  height: var(--topbar-h);
  padding: 0 var(--gutter);
  background: var(--paper);
}
@supports (backdrop-filter: blur(8px)) {
  .topbar { background: color-mix(in srgb, var(--paper) 90%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
}
/* the logo: the sextant exactly as drawn (colour file by Day, reverse file at Night) + the pixel wordmark */
.brand { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; min-width: 44px; flex: none; color: var(--ink); text-decoration: none; border-radius: var(--r-1); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-mark-night { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark-day { display: none; }
  :root:not([data-theme="light"]) .brand-mark-night { display: block; }
}
:root[data-theme="dark"] .brand-mark-day { display: none; }
:root[data-theme="dark"] .brand-mark-night { display: block; }
.wordmark { display: inline-flex; align-items: center; font: 400 22px/22px var(--font-pixel); letter-spacing: 0; white-space: nowrap; color: var(--ink); }
.wordmark .wm-star { width: 9px; height: 11px; margin: 2px 1px 0; fill: var(--brass); flex: none; }

.topnav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.topnav-link {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-2);
  font-size: var(--fs-14); font-weight: 400; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.topnav-link:hover { color: var(--ink); background: var(--paper-2); }
.topnav-link[aria-current="page"], .topnav-link.is-current { color: var(--ink); font-weight: 500; }
.topnav-link[aria-current="page"]::after, .topnav-link.is-current::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--signal); }
.topnav-link .icon { width: 14px; height: 14px; color: var(--ink-2); }
.topnav-link[aria-expanded="true"] { color: var(--ink); background: var(--paper-2); }

.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; flex: none; }
.tb-slot { display: flex; align-items: center; gap: 4px; }
.tb-bell { position: relative; }
.tb-bell .count-badge { position: absolute; top: 3px; right: 1px; }
.tb-bell .tb-dot { position: absolute; top: 11px; right: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 2px var(--paper); }
/* the account pill: name · flag · avatar → the account menu */
.tb-me { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 4px 0 14px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink); font-size: var(--fs-14); cursor: pointer; max-width: 240px; }
.tb-me:hover, .tb-me[aria-expanded="true"] { background: var(--paper-2); }
.tb-me .tb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tb-me .avatar { --d: 32px; }
.topbar .tb-menu-btn { display: none; }

/* ------------------------------------------------------------------ main */
.main { grid-area: main; min-width: 0; }
.main:focus { outline: none; }
.page { max-width: calc(var(--content-max) + 2 * var(--gutter)); margin: 0 auto; padding: var(--sp-12) var(--gutter) var(--sp-24); min-width: 0; }
.page-loading { min-height: 60vh; }
.page-head { display: flex; align-items: flex-end; gap: var(--sp-4) var(--sp-6); flex-wrap: wrap; margin-bottom: var(--sp-12); }
.page-head > div:first-child { flex: 1; min-width: 0; }
.page-head .eyebrow { margin-bottom: var(--sp-2); }
.page-head .flavour { margin: var(--sp-2) 0 0; font-size: var(--fs-15); }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--sp-12); }
.col-8 { grid-column: span 8; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; } .col-7 { grid-column: span 7; } .col-12 { grid-column: 1 / -1; }
.col-6 { grid-column: span 6; }
/* main column + a 280 px side column, 96 px apart (C) */
.with-side { display: grid; grid-template-columns: minmax(0, 1fr) var(--side-col); gap: var(--sp-12) var(--sp-24); align-items: start; }

/* the footer (components.js siteFooter()) and the legacy .footer */
.site-footer, .footer {
  max-width: calc(var(--content-max) + 2 * var(--gutter)); margin: 0 auto; padding: var(--sp-8) var(--gutter) var(--sp-12);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-6);
  color: var(--ink-2); font-size: var(--fs-13);
}
.site-footer { border-top: 1px solid var(--line); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 var(--sp-6); }
.site-footer a, .footer a { position: relative; color: var(--ink-2); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.site-footer nav a::after { content: ""; position: absolute; inset: 0 -8px; } /* "Help" is 32 px wide: a 44 px hit area, same layout */
.site-footer a:hover, .footer a:hover { color: var(--ink); text-decoration: underline; }
.site-footer .wordmark { font-size: 22px; margin-right: var(--sp-4); }
.site-footer .sf-end { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }

/* ------------------------------------------------------------------ the phone menu sheet + search */
.menu-sheet .dialog-body { padding-top: var(--sp-5); }
.ms-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.ms-group { display: flex; flex-direction: column; padding: var(--sp-2) 0; }
.ms-group + .ms-group { border-top: 1px solid var(--line); }
.ms-label { font-size: var(--fs-12); font-weight: 500; letter-spacing: var(--tracking-label); color: var(--ink-2); padding: var(--sp-2) 0 2px; }
.ms-link { display: flex; align-items: center; gap: var(--sp-3); min-height: 48px; padding: 0 var(--sp-2); margin: 0 calc(-1 * var(--sp-2)); border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink); text-decoration: none; font-size: var(--fs-15); text-align: left; cursor: pointer; width: calc(100% + 2 * var(--sp-2)); }
.ms-link:hover { background: var(--raised-2); color: var(--ink); }
.ms-link[aria-current="page"] { font-weight: 500; }
.ms-link[aria-current="page"]::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--signal); margin-left: -1px; }
.ms-link .icon { width: 18px; height: 18px; color: var(--ink-2); }
.ms-link .menu-meta { margin-left: auto; }
.ms-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--sp-4); }
.ms-actions { display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-4); }
.search-pop { width: min(420px, calc(100vw - 16px)); padding: 10px; }
.search-results { display: flex; flex-direction: column; margin-top: 6px; }
.search-results:empty { display: none; }
.search-results .menu-label { padding-left: 14px; }
.search-hit { display: flex; align-items: center; gap: var(--sp-3); min-height: 44px; padding: 0 14px; border-radius: var(--r-pill); color: var(--ink); text-decoration: none; font-size: var(--fs-14); }
.search-hit:hover, .search-hit:focus-visible { background: var(--raised-2); outline: none; color: var(--ink); }
.search-hit:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.search-hit .icon { width: 16px; height: 16px; color: var(--ink-2); }
.search-hit .who-name { font-weight: 400; }
.search-note { padding: 8px 14px; font-size: var(--fs-13); color: var(--ink-2); margin: 0; }

/* ------------------------------------------------------------------ breakpoints */
@media (max-width: 1199.98px) { .tb-me .tb-name { display: none; } .tb-me { padding-left: 4px; } }
@media (max-width: 1099.98px) { .topbar { gap: var(--sp-4); } .topbar .tb-theme { display: none; } }
@media (max-width: 959.98px) {
  :root { --gutter: 32px; }
  .grid-12 { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--sp-8); }
  .col-8, .col-4, .col-5, .col-7, .col-6 { grid-column: 1 / -1; }
  .with-side { grid-template-columns: minmax(0, 1fr); gap: var(--sp-12); }
}
@media (max-width: 859.98px) {
  :root { --topbar-h: 64px; }
  .topbar .topnav, .topbar .tb-search, .topbar .tb-signup { display: none; }
  .topbar .tb-menu-btn { display: inline-grid; }
  .topbar { gap: var(--sp-3); }
  .tb-me { padding: 0 6px; } .tb-me .flag, .tb-me .flag-rose { display: none; } /* the name is hidden here, so its flag goes with it */
}
@media (max-width: 719.98px) {
  :root { --gutter: 20px; }
  h1, .h1 { font-size: var(--fs-28); line-height: 1.15; }
  .display { font-size: var(--fs-34); }
  .page { padding-top: var(--sp-8); padding-bottom: var(--sp-16); }
  .page-head { margin-bottom: var(--sp-8); }
  .grid-12 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-6); }
  .site-footer .sf-end { margin-left: 0; }
  .dialog-body { padding: var(--sp-6); }
}
@media (max-width: 419.98px) { .topbar { gap: var(--sp-2); } .tb-actions { gap: 0; } }
@media (max-width: 359.98px) { :root { --gutter: 16px; } .topbar .wordmark { display: none; } } /* below 360 the mark carries the brand */
.label-short { display: none; }
@media (max-width: 719.98px) { .label-long { display: none; } .label-short { display: inline; } }

/* ------------------------------------------------------------------ chrome modes */
body[data-chrome="bare"] .topnav, body[data-chrome="bare"] .tb-actions { display: none; }
body[data-chrome="game"] .app { display: none; }
body[data-chrome="game"] { overflow: hidden; }
.game-root { position: fixed; inset: 0; z-index: var(--z-base); background: var(--paper); }

/* The keep-alive Maps stage lives here when no page holds it (never display:none: it would stop rendering). */
.stage-park { position: fixed; left: -12000px; top: 0; width: 640px; height: 400px; visibility: hidden; pointer-events: none; overflow: hidden; }

/* ------------------------------------------------------------------ toasts: bottom-centre, 24 px above the edge */
.toasts { position: fixed; left: 50%; bottom: calc(var(--sp-6) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); width: max-content; max-width: calc(100vw - 2 * var(--sp-4)); pointer-events: none; }
.toasts > * { pointer-events: auto; }

/* the site-wide notices (chrome.js): quiet, above the page, dismissible */
.site-banner { width: calc(100% - 2 * var(--gutter)); max-width: var(--content-max); margin: var(--sp-4) auto 0; }
.site-banner-text { flex: 1; min-width: 0; }
.site-banner-x { flex: none; margin: -8px -10px -8px 0; color: inherit; }
