/* Dark theme, banner as the shared background on both screens (landing +
   game) — see game/README.md. Bases still reuse the main site's identity:
   the same banner.webp, the same slate blue (#34495e / #2c3e50) as the
   brand accent for primary buttons, the same green (#34d399, from
   static/js/map/annotate.js ADDED_STYLE) for "confirm". Everything else
   (surfaces, borders, ink) is a dark palette so panels/menus/cards read as
   one dark app instead of white panels floating on a dark banner.

   NB the banner path below is relative to THIS FILE (game/css/style.css),
   not to game/index.html — it needs two `../` to reach the repo-root
   static/ folder (game/css/ -> game/ -> repo root). One `../` was a bug:
   it resolved to game/static/..., which doesn't exist, so the banner
   silently failed to load on both screens. */

:root {
    --bg: #12171d;
    --surface: #1c232c;
    --surface-2: #262f3a;
    --ink: #eef2f5;
    --muted: #9aa7b4;
    --muted-2: #71808d;
    --border: #2c3540;
    --border-2: #38424e;
    --slate: #34495e;
    --slate-hover: #2c3e50;
    --confirm: #34d399;
    --confirm-ink: #04231a;
    --reject: #e76f51;
    --reject-ink: #2a0a05;
}

* { box-sizing: border-box; }

/* Any element with the `hidden` attribute must actually disappear, even
   when another rule below sets `display` on it unconditionally (an author
   rule always wins over the browser's own [hidden]{display:none} default,
   regardless of specificity) — without this, show()/hide() in JS silently
   stop working the moment a component's CSS declares its own `display`. */
[hidden] { display: none !important; }

html, body {
    margin: 0; padding: 0; height: 100%;
    background: var(--bg); color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overscroll-behavior: none;
}

#app { height: 100dvh; display: flex; flex-direction: column; }

button { font: inherit; cursor: pointer; border: none; border-radius: 10px; }

/* ─── Shared banner background — landing AND game screen, same treatment ── */
#auth-screen, #game-screen {
    background:
        linear-gradient(rgba(44, 62, 80, 0.85), rgba(44, 62, 80, 0.85)),
        url('../../static/images/banner.webp') center / cover no-repeat;
    color: var(--ink);
}

#auth-screen {
    flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto;
}

.game-topbar { padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 0; }
.back-home {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.82rem; font-weight: 500; color: rgba(255, 255, 255, 0.68);
    text-decoration: none; transition: color 0.2s ease;
}
.back-home:hover, .back-home:focus-visible { color: #ffffff; }

.game-hero {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 24px; text-align: center;
}
.game-hero h1 { margin: 0; font-size: 2.1rem; font-weight: 300; letter-spacing: -0.02em; text-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.pitch { color: rgba(255,255,255,0.9); margin: 0 0 6px; max-width: 32em; }

.hero-stats {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
    gap: 6px 12px; margin: 0; font-size: 0.88rem; color: rgba(255, 255, 255, 0.72);
}
.hero-stats strong { color: #ffffff; font-weight: 600; }
.hero-stats .hero-stat-sep { color: rgba(255, 255, 255, 0.32); }

/* Same pill treatment as the main site's .quick-links (static/css/style.css)
   — small rounded buttons on the dark banner, used instead of a text link
   whenever a landing/tutorial row offers a handful of jump-off points. */
.quick-links {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
    gap: 8px; margin: 0 0 6px;
}
.quick-link {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.82rem; font-weight: 500; color: white;
    background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px; padding: 7px 16px; text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease; cursor: pointer;
}
.quick-link:hover, .quick-link:focus-visible { background: rgba(255, 255, 255, 0.24); border-color: rgba(255, 255, 255, 0.45); }

.landing-cta-actions { display: flex; flex-direction: row; gap: 8px; width: 100%; max-width: 320px; margin: 4px 0; }

.link { background: none; color: rgba(255,255,255,0.85); text-decoration: underline; padding: 6px; font-size: 0.9rem; }

#login-panel {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    width: 100%; max-width: 320px; margin: 4px 0;
}
.login-panel-title { margin: 0; font-size: 0.95rem; font-weight: 700; color: #fff; }
#login-cancel { margin-top: 2px; font-size: 0.82rem; opacity: 0.8; }

.google-badge {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.85); padding: 10px 20px;
    width: 100%; max-width: 320px; opacity: 0.7; border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px; font-weight: 500; font-size: 0.9rem;
}
.google-badge:disabled { cursor: not-allowed; }

#pseudo-form, #email-form {
    display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 320px;
}
.pseudo-row { display: flex; gap: 8px; }
.pseudo-row input { flex: 1; }
#pseudo-random {
    flex-shrink: 0; width: 46px; background: rgba(255,255,255,0.1); color: #fff;
    border: 1px solid rgba(255,255,255,0.25); border-radius: 6px; font-size: 1.15rem;
}
#pseudo-random:hover { background: rgba(255,255,255,0.18); }

/* Inputs stay light/white on purpose, on both screens — a bright field
   reads clearly against the dark banner and is the easiest way to keep
   typed text legible without a separate dark-input treatment. */
input {
    background: #ffffff; border: 1px solid var(--border-2); color: #1a1f26;
    padding: 12px; border-radius: 8px; font-size: 1rem;
}
.hint { color: rgba(255,255,255,0.65); font-size: 0.8rem; margin: 0; }
.error { color: #ffb4a3; font-size: 0.85rem; margin: 4px 0 0; }

/* ─── .btn — identical to the main site's button (static/css/style.css) ──── */
.btn {
    display: inline-block; padding: 12px 24px; background-color: #34495e; color: white;
    text-decoration: none; border-radius: 6px; font-weight: 500;
    transition: all 0.3s ease; border: 1px solid #34495e; width: 100%; max-width: 320px;
    text-align: center;
}
.btn:hover { background-color: #2c3e50; transform: translateY(-1px); border-color: #2c3e50; }
.btn:disabled {
    background-color: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.5); cursor: not-allowed; transform: none;
}

/* Secondary variant — same shape/size as .btn (used e.g. for "Learn more"
   sitting next to a primary "Got it"/close .btn), just visually lighter. */
.btn-outline {
    display: inline-block; padding: 12px 24px; background-color: transparent; color: var(--ink);
    text-decoration: none; border-radius: 6px; font-weight: 500;
    transition: all 0.3s ease; border: 1px solid var(--border-2); width: 100%; max-width: 320px;
    text-align: center;
}
.btn-outline:hover { background-color: var(--surface-2); border-color: var(--muted-2); transform: translateY(-1px); }

/* ─── Footer — copied from the main site, same class names ────────────────── */
.footer { background-color: #2c3e50; color: white; text-align: center; padding: 20px 0; margin-top: auto; }
.footer .container { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; max-width: 900px; margin: 0 auto; padding: 0 16px; }
.footer p { margin: 0; font-size: 0.85rem; }
.footer a { color: #bdc3c7; text-decoration: none; }
.footer a:hover { color: #ecf0f1; text-decoration: underline; }
.footer-about-link { font-size: 0.85rem; }
.footer-contact { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; }
.footer-contact a {
    display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
    border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.18);
    color: #bdc3c7; transition: all 0.2s ease;
}
.footer-contact a:hover { color: #ffffff; background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.32); }
.footer-contact svg { width: 14px; height: 14px; }

/* ─── Game screen — same banner as the landing (see shared rule above),
   but header + controls sit on solid dark panels for legibility; the
   banner mostly shows through around the card in #card-stack. ─────────── */

#game-screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }

header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; background: var(--surface); border-bottom: 1px solid var(--border);
}
header button {
    background: var(--surface-2); color: var(--ink); font-size: 1.1rem;
    width: 36px; height: 36px; border-radius: 50%;
}
.header-actions { display: flex; align-items: center; gap: 8px; }
header button:hover { background: var(--border-2); }
#header-pseudo { color: var(--muted); font-size: 0.9rem; flex: 1; text-align: center; }

#session-counts {
    display: flex; justify-content: center; gap: 16px; padding: 8px 16px 0;
    font-size: 0.82rem; color: var(--muted); font-weight: 600;
}
.sc-confirm { color: var(--confirm); }
.sc-reject { color: var(--reject); }
.sc-ambiguous { color: #8ea9c4; }

#card-stack {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 16px; min-height: 0; position: relative;
}

/* ─── Gamification flourishes (js/hooks.js) — self-clearing pop-ups, no
   dismiss control. pointer-events: none so they can never eat a swipe. ── */
#hook-flash {
    position: fixed; top: calc(96px + env(safe-area-inset-top, 0px)); left: 50%;
    transform: translate(-50%, -8px) scale(0.75);
    pointer-events: none; z-index: 16; opacity: 0;
    font-weight: 700; font-size: 0.92rem; padding: 9px 18px; border-radius: 999px;
    color: #06210f; white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
#hook-flash.milestone { background: linear-gradient(135deg, #6ee7b7, #34d399); }
#hook-flash.streak { background: linear-gradient(135deg, #fbbf24, #f97316); color: #2a1400; }
#hook-flash.show {
    animation: hook-flash-in 0.35s ease-out forwards;
    transition: opacity 0.25s ease;
}
@keyframes hook-flash-in {
    0%   { opacity: 0; transform: translate(-50%, -8px) scale(0.75); }
    60%  { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
    100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

#rank-banner {
    position: fixed; top: calc(96px + env(safe-area-inset-top, 0px)); left: 16px; right: 16px;
    max-width: 380px; margin: 0 auto;
    pointer-events: none; z-index: 16; opacity: 0; transform: translateY(-10px);
    background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px;
    padding: 10px 16px; font-size: 0.85rem; text-align: center; color: var(--ink);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
#rank-banner strong { color: #34d399; }
#rank-banner.show { opacity: 1; transform: translateY(0); }

.card {
    width: min(400px, 90vw); aspect-ratio: 1 / 1;
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45); overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 20px; gap: 10px; color: var(--ink);
    transition: transform 0.18s ease-out, opacity 0.18s ease-out;
}

.card.loading { gap: 14px; color: var(--muted); }
.spinner {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--border-2); border-top-color: var(--ink);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#card-current { padding: 0; touch-action: none; }
.card-image-wrap { position: relative; width: 100%; height: 100%; }
#card-image { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--border); }
#card-marker {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 34%; aspect-ratio: 1 / 1;
    border: 0.75px solid #ffffff; border-radius: 3px; opacity: 0.9;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.85));
    pointer-events: none;
}

#card-current.fly-left  { transform: translate(-140%, 0) rotate(-18deg); opacity: 0; }
#card-current.fly-right { transform: translate(140%, 0) rotate(18deg); opacity: 0; }
#card-current.fly-down  { transform: translate(0, 120%); opacity: 0; }
#card-current.fly-up    { transform: translate(0, -120%); opacity: 0; }

.empty-title { font-size: 1.3rem; }
#notify-form { display: flex; gap: 8px; margin-top: 8px; width: 100%; }
#notify-form input { flex: 1; }
#notify-form .btn { width: auto; padding: 10px 16px; }

#report-form {
    position: absolute; inset: 0; background: rgba(14, 18, 23, 0.94);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 24px; z-index: 5;
}
.report-form-title { margin: 0 0 2px; font-weight: 600; color: var(--ink); text-align: center; }
#report-comment {
    width: 100%; max-width: 340px; min-height: 90px; background: #fff;
    border: 1px solid var(--border-2); color: #1a1f26; border-radius: 8px; padding: 10px;
}
#report-send-skip, #report-send-stay { width: auto; min-width: 220px; padding: 10px 24px; }
#report-cancel { background: none; color: var(--muted); }

#install-nudge {
    position: fixed; top: calc(150px + env(safe-area-inset-top, 0px)); left: 16px; right: 16px;
    max-width: 380px; margin: 0 auto; z-index: 17;
    padding: 12px 14px; background: var(--surface);
    border: 1px solid var(--border-2); border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    display: flex; flex-direction: column; gap: 10px;
}
.install-nudge-text { margin: 0; font-size: 0.85rem; color: var(--ink); }
.install-nudge-actions { display: flex; gap: 10px; align-items: center; }
.install-nudge-actions .btn { flex: 1; padding: 10px; font-size: 0.85rem; }
.install-nudge-actions .link { padding: 6px 4px; font-size: 0.82rem; }

#controls { display: flex; justify-content: center; align-items: flex-start; gap: 16px; padding: 12px 16px; }
.ctrl-wrap { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.ctrl-label { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.ctrl { width: 60px; height: 60px; border-radius: 50%; font-size: 1.4rem; }
.ctrl.reject { background: var(--reject); color: #fff; }
.ctrl.confirm { background: var(--confirm); color: var(--confirm-ink); }
.ctrl.ambiguous {
    background: var(--surface-2); color: var(--ink); border: 1px solid var(--border-2);
}
.ctrl.ambiguous:hover { background: var(--border-2); }

/* In normal flow, directly above #controls — both buttons here are always
   visible (unlike the old ephemeral show/hide undo pill): "go back" toggles
   disabled/enabled depending on whether there's a decision left to undo,
   "comment" is always actionable. Grouped together as a lighter utility
   row, deliberately smaller/quieter than the confirm/reject/ambiguous row
   below so the two don't compete for attention. */
#utility-row { display: flex; justify-content: center; gap: 10px; padding: 4px 16px 0; }
.utility-btn {
    height: 36px; padding: 0 14px 0 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--surface-2); color: var(--ink); border: 1px solid var(--border-2);
}
.utility-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.utility-btn:hover:not(:disabled) { background: var(--border-2); }
.utility-btn:disabled { opacity: 0.4; cursor: default; }

#toast {
    position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
    background: var(--slate); color: #fff; padding: 8px 16px; border-radius: 10px; font-size: 0.9rem;
    z-index: 20;
}

/* ─── Tuto / aide ─── */

#tutorial {
    position: fixed; inset: 0; background: rgba(6, 9, 12, 0.7); z-index: 30;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.tutorial-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; max-width: 420px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5); max-height: 86vh; overflow-y: auto;
}
.tutorial-box h2 { margin-top: 0; text-align: center; }
.tutorial-box .key {
    display: inline-block; min-width: 1.6em; padding: 0 4px; text-align: center; margin: 0 2px;
    background: var(--surface-2); border-radius: 6px; font-weight: 700; color: var(--ink);
}

/* ─── Tutorial frames — one illustrated step at a time, auto-advancing
   (see help.js). Each frame is either a mini replay of the actual card
   (image + marker + a looping swipe dot) for the three vote gestures, or
   a tap demo (pulsing ring around the real icon/glyph) for the utility
   buttons and header icons, which stay too small/fragile to spotlight
   live behind the modal — a self-contained illustration is what actually
   holds still across screen sizes. ── */
#tutorial-frames { position: relative; min-height: 250px; }
.tutorial-frame { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.tutorial-frame[hidden] { display: none; }

.tutorial-scene { position: relative; width: 140px; height: 140px; display: flex; align-items: center; justify-content: center; }
.tutorial-card {
    position: relative; width: 140px; height: 140px; border-radius: 10px;
    overflow: hidden; border: 1px solid var(--border-2);
}
.tutorial-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tutorial-marker {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 34%; aspect-ratio: 1 / 1;
    border: 0.75px solid #ffffff; border-radius: 3px; opacity: 0.9;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.85));
}

.tutorial-swipe {
    position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; border-radius: 50%;
    background: var(--ink); opacity: 0; pointer-events: none;
}
.tutorial-swipe-right { animation: tutorial-swipe-right 1.8s ease-in-out infinite; }
.tutorial-swipe-left  { animation: tutorial-swipe-left 1.8s ease-in-out infinite; }
.tutorial-swipe-up    { animation: tutorial-swipe-up 1.8s ease-in-out infinite; }

@keyframes tutorial-swipe-right {
    0%   { transform: translate(-50%, -50%); opacity: 0; }
    15%  { opacity: 0.85; }
    70%  { transform: translate(40px, -50%); opacity: 0.85; }
    100% { transform: translate(40px, -50%); opacity: 0; }
}
@keyframes tutorial-swipe-left {
    0%   { transform: translate(-50%, -50%); opacity: 0; }
    15%  { opacity: 0.85; }
    70%  { transform: translate(-140%, -50%); opacity: 0.85; }
    100% { transform: translate(-140%, -50%); opacity: 0; }
}
@keyframes tutorial-swipe-up {
    0%   { transform: translate(-50%, -50%); opacity: 0; }
    15%  { opacity: 0.85; }
    70%  { transform: translate(-50%, -140%); opacity: 0.85; }
    100% { transform: translate(-50%, -140%); opacity: 0; }
}

.tutorial-scene-icon { width: 72px; height: 72px; }
.tutorial-tap-demo {
    position: relative; width: 56px; height: 56px; border-radius: 50%;
    background: var(--surface-2); border: 1px solid var(--border-2); color: var(--ink);
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 600;
}
.tutorial-tap-ring {
    position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--ink); opacity: 0;
    animation: tutorial-tap-pulse 1.8s ease-out infinite;
}
@keyframes tutorial-tap-pulse {
    0%   { transform: scale(0.8); opacity: 0; }
    30%  { opacity: 0.5; }
    100% { transform: scale(1.35); opacity: 0; }
}

.tutorial-caption { text-align: center; min-height: 42px; }

#tutorial-dots { display: flex; justify-content: center; gap: 6px; margin: 2px 0 14px; }
.tutorial-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-2); transition: background 0.2s ease, transform 0.2s ease; }
.tutorial-dot.active { background: var(--ink); transform: scale(1.3); }

#tutorial-nav { display: flex; }
#tutorial-nav .btn, #tutorial-nav .btn-outline { width: 100%; text-align: center; display: block; }

/* ─── "What is the purpose of this game?" panel — same overlay mechanic,
   reuses .tutorial-box, adds prose-specific rules (h3/p) it didn't need. ── */
#purpose-panel {
    position: fixed; inset: 0; background: rgba(6, 9, 12, 0.7); z-index: 30;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.purpose-intro { color: var(--muted); font-size: 0.92rem; margin: 4px 0 18px; }
.tutorial-box h3 { margin: 18px 0 6px; font-size: 0.95rem; }
.tutorial-box h3:first-of-type { margin-top: 0; }
.tutorial-box p { color: var(--ink); font-size: 0.88rem; line-height: 1.5; margin: 0 0 4px; }
.tutorial-box p a { color: inherit; }
.purpose-learn-more { display: block; margin: 18px 0 12px; font-size: 0.88rem; text-align: center; }
#purpose-close { width: 100%; margin-top: 4px; text-align: center; display: block; }

/* ─── Menu ─── */

/* Three fixed zones so Share/Join-the-discussion never scroll out of view
   on a short phone screen (iPhone 13 + Firefox was the reported case): a
   shrink-to-fit account header, a flexible scrolling middle (the
   leaderboard/progress "dropdown"), and a shrink-to-fit CTA bar pinned to
   the bottom. dvh (with a vh fallback for older engines) accounts for
   mobile browser chrome the way plain vh doesn't. */
#menu {
    position: fixed; inset: 0; background: var(--bg); z-index: 10; color: var(--ink);
    display: flex; flex-direction: column;
    height: 100vh; height: 100dvh;
}
#menu-close {
    position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px; background: var(--surface-2); color: var(--ink);
    font-size: 1.1rem; width: 32px; height: 32px; border-radius: 50%; z-index: 1;
}

#menu-account { flex-shrink: 0; padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 14px; border-bottom: 1px solid var(--border); }
.menu-section-title {
    margin: 0 0 8px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--muted-2);
}
.menu-pseudo strong, #menu-mycount { color: var(--ink); }
.menu-edit-pseudo-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; padding: 0; margin-left: 4px; vertical-align: -3px;
    background: none; border: none; color: var(--muted);
}
.menu-edit-pseudo-btn:hover { color: var(--ink); }
.menu-edit-pseudo-btn svg { width: 14px; height: 14px; }
.menu-email-line { margin: 2px 0 0; font-size: 0.85rem; color: var(--muted); }
.menu-email-line strong { color: var(--ink); }
.menu-account-links { display: flex; gap: 8px; margin: 8px 0; }
.menu-account-link {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px; font-size: 0.8rem; background: var(--surface-2); color: var(--ink);
    border: 1px solid var(--border-2); border-radius: 6px;
}
.menu-account-link:hover:not(:disabled) { background: var(--border-2); }
.menu-account-link:disabled { opacity: 0.45; }
.menu-account-link-icon { width: 14px; height: 14px; flex-shrink: 0; }
.menu-inline-form { display: flex; flex-direction: column; gap: 6px; margin: 0 0 8px; }
.menu-inline-form input { padding: 9px 10px; font-size: 0.88rem; border-radius: 6px; }
.menu-inline-form-actions { display: flex; align-items: center; gap: 10px; }
/* Narrower than the full-width default (.btn/.btn-outline are 100%-wide by
   default, sized for standalone screens) — side by side here, "Create
   account" kept as the filled/primary shape so it stays the visually
   appealing choice, "Cancel" downgraded from a bare text .link to a real
   (but outline, secondary) button so it doesn't look like an afterthought. */
.menu-inline-form-actions .btn,
.menu-inline-form-actions .btn-outline {
    width: auto; max-width: none; flex: 0 0 auto; padding: 8px 16px; font-size: 0.85rem;
}
.menu-consent-label {
    display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 4px;
    font-size: 0.8rem; line-height: 1.4; color: var(--muted); cursor: pointer;
}
.menu-consent-label input[type="checkbox"] {
    flex-shrink: 0; width: 15px; height: 15px; margin-top: 1px; accent-color: var(--slate);
}
.menu-consent-label a { color: var(--ink); }
.menu-mycount-line { margin: 4px 0 0; font-size: 0.85rem; color: var(--muted); }
.menu-breakdown { display: flex; gap: 14px; margin: 4px 0 0; font-size: 0.85rem; color: var(--muted); flex-wrap: wrap; }
.menu-breakdown strong { color: var(--ink); }
.menu-rank-line { display: flex; gap: 8px; margin: 8px 0 0; flex-wrap: wrap; }
.rank-pill {
    font-size: 0.75rem; color: var(--muted); background: var(--surface-2);
    border: 1px solid var(--border-2); border-radius: 20px; padding: 3px 10px;
}
.rank-pill strong { color: var(--ink); }
.bd-confirm { color: var(--confirm); }
.bd-reject { color: var(--reject); }
.menu-account-danger { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.menu-signout-link {
    display: inline; margin: 0; padding: 0; background: none; border: none;
    font-size: 0.74rem; color: var(--muted-2); text-decoration: underline;
}
.menu-signout-link:hover { color: var(--reject); }
.menu-delete-link { color: rgba(231, 111, 81, 0.75); }
.menu-delete-link:hover { color: var(--reject); }

#menu-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px; }

/* Top-level Leaderboard/Progress switcher — same visual language as the
   week/month/all-time sub-tabs below it, just a size step up. */
#menu-main-tabs { display: flex; gap: 8px; margin: 0 0 10px; }
#menu-main-tabs button {
    flex: 1; background: var(--surface); border: 1px solid var(--border); color: var(--muted);
    padding: 10px; font-weight: 600; font-size: 0.9rem; border-radius: 8px;
}
#menu-main-tabs button.active { background: var(--slate); border-color: var(--slate); color: #fff; }

#menu-tabs { display: flex; gap: 8px; margin: 0 0 8px; }
#menu-tabs button { flex: 1; background: var(--surface-2); color: var(--muted); padding: 8px; }
#menu-tabs button.active { background: var(--slate); color: #fff; }
#menu-leaderboard-total {
    margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
/* The "dropdown" — a shortened, internally-scrolling window instead of an
   unbounded list (up to 20 rows was pushing everything below it, including
   the CTA bar, off-screen on a phone). */
#menu-leaderboard {
    list-style: none; padding: 0; margin: 0; max-height: 38vh; overflow-y: auto;
}
#menu-leaderboard li {
    display: flex; align-items: center; gap: 10px; padding: 8px 4px;
    border-bottom: 1px solid var(--border);
}
#menu-leaderboard li.me { color: var(--confirm); font-weight: 700; background: rgba(52,211,153,0.14); border-radius: 6px; }
#menu-leaderboard .rank { width: 2em; color: var(--muted); }
#menu-leaderboard .pseudo { flex: 1; }
#menu-leaderboard li.empty { color: var(--muted); border: none; }

#menu-completion .menu-completion-headline {
    margin: 0 0 8px; font-size: 1.6rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums;
}
#menu-completion .menu-completion-headline strong { color: var(--confirm); }
#menu-completion .bar { background: var(--surface-2); border-radius: 8px; height: 10px; overflow: hidden; }
#menu-pct-bar { background: var(--confirm); height: 100%; width: 0; transition: width 0.3s; }
#menu-completion p { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }

.menu-dept-title { margin: 16px 0 8px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
#menu-dept-map {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px; display: flex; justify-content: center;
}
#menu-dept-map svg { width: 100%; max-width: 320px; height: auto; }
.menu-dept-error { color: var(--muted); font-size: 0.85rem; margin: 0; }
#menu-dept-legend {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 8px 0 0; font-size: 0.72rem; color: var(--muted-2);
}
#menu-dept-legend-bar {
    width: 80px; height: 6px; border-radius: 4px;
    background: linear-gradient(90deg, rgb(38,47,58), rgb(52,211,153));
}

#menu-cta {
    flex-shrink: 0; padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border); background: var(--surface);
}
/* Side-by-side, small icon + title + description cards — same shape as
   the main site's .hub-card/.contrib-card tiles (content/contribute.html),
   just compact and dark-themed: this sits in the pinned bottom bar, no
   room for the full-size version. */
.menu-cta-actions { display: flex; flex-direction: row; gap: 8px; }
.cta-card {
    flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center;
    gap: 3px; padding: 10px 6px; background: var(--surface-2); border: 1px solid var(--border-2);
    border-radius: 10px; color: var(--ink); text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.cta-card:hover { border-color: var(--slate); transform: translateY(-1px); }
.cta-card-icon { width: 18px; height: 18px; color: #8ea9c4; }
.cta-card-icon svg { width: 100%; height: 100%; }
.cta-card-title { font-size: 0.8rem; font-weight: 600; }

@media (min-width: 640px) {
    #controls { gap: 24px; }
    .ctrl { width: 68px; height: 68px; }
}
