:root {
  --bg1: #f4f2ff;
  --bg2: #e6e9ff;
  --ink: #0c1230;
  --muted: #6c7392;
  --accent: #2f6bff;
  --accent-2: #5a4bff;
  --accent-grad: linear-gradient(135deg, #3b82f6 0%, #2f6bff 55%, #5a4bff 100%);
  --good: #18c98a;
  --warn: #f4b740;
  --bad: #ff5d6c;
  --card: #ffffff;
  --shadow: 0 16px 38px rgba(31, 45, 110, 0.18);
  --shadow-sm: 0 6px 18px rgba(31, 45, 110, 0.14);
  --radius: 24px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, system-ui, sans-serif;
  /* Anton — bold condensed display face for titles + buttons. */
  --font-display: "Anton", "Plus Jakarta Sans", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg1);
  overscroll-behavior: none;
}

.screen { position: absolute; inset: 0; }
.hidden { display: none !important; }

/* ---------------------- Buttons ---------------------- */
/* Bump-style: fully-rounded gradient pills with an icon + bold white text. */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: none; border-radius: 999px; padding: 15px 26px; min-height: 54px;
  font-family: var(--font-display); font-size: 1.18rem; font-weight: 400;
  letter-spacing: 0.6px; text-transform: uppercase;
  cursor: pointer; color: #fff;
  transition: transform 0.12s cubic-bezier(.2,.9,.3,1.2), box-shadow 0.2s ease, background 0.2s ease, filter 0.2s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn:focus-visible { outline: 3px solid rgba(47,107,255,0.5); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(180deg, #4a90ff 0%, #2f6bff 100%);
  box-shadow: 0 12px 26px rgba(47, 107, 255, 0.45), inset 0 1px 0 rgba(255,255,255,0.4);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 16px 32px rgba(47,107,255,0.52), inset 0 1px 0 rgba(255,255,255,0.4); }
.btn-primary:active { transform: translateY(1px) scale(0.985); }
.btn-primary:disabled { background: #cdd2e6; color: #fff; box-shadow: none; cursor: not-allowed; }

.btn-secondary {
  background: #fff; color: var(--accent);
  box-shadow: 0 8px 20px rgba(31,45,110,0.12); border: 1px solid #eceefb;
}
.btn-secondary:hover { background: #f7f9ff; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--muted); box-shadow: none; min-height: 46px; }
.btn-ghost:hover { color: var(--ink); }
.btn-lg { padding: 18px 30px; font-size: 1.25rem; }
.btn-block { display: flex; width: 100%; }
.install-btn { margin-top: 10px; }

/* ---------------------- Flat icons ---------------------- */
.ic { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -0.2em; flex: 0 0 auto; }
.ic--stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic--fill { fill: currentColor; }
.btn .ic { width: 1.05em; height: 1.05em; vertical-align: -0.12em; }
.logo .ic { width: 0.95em; height: 0.95em; color: var(--accent); vertical-align: -0.08em; margin-right: 6px; }
.map-open .ic { width: 1.05em; height: 1.05em; }
.result-emoji .ic { width: 2.4rem; height: 2.4rem; color: var(--ink); }
.how-to span { display: inline-flex; align-items: center; gap: 5px; }
.round-row-heart .ic { width: 18px; height: 18px; color: var(--ink); vertical-align: middle; }
.round-row-heart .ic.half { opacity: 0.4; }

/* ---------------------- Start / summary ---------------------- */
#start-screen, #summary-screen {
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 480px at 15% -10%, #ffffff 0%, transparent 55%),
    radial-gradient(800px 520px at 100% 110%, #d9ddff 0%, transparent 55%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
}
/* Random blurred scene photo behind the start screen (set in game.js). */
.start-bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  filter: blur(10px) brightness(0.62) saturate(1.1);
  transform: scale(1.08);            /* hide the blurred edges */
  opacity: 0; transition: opacity 0.7s ease;
}
.start-bg.show { opacity: 1; }
.start-card, .summary-card {
  position: relative; z-index: 1;    /* sit above the blurred backdrop */
  background: var(--card);
  padding: 30px 26px;
  border-radius: 30px;
  box-shadow: var(--shadow);
  border: 2px solid rgba(12,18,48,0.10);
  max-width: 430px; width: 100%;
  text-align: center;
  animation: pop 0.42s cubic-bezier(.2,.85,.25,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }

.logo {
  font-family: var(--font-display); text-transform: uppercase;
  font-size: 3.1rem; font-weight: 400; margin: 0 0 4px; letter-spacing: 0.5px; line-height: 1;
  animation: float 4.5s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-5px); } }
.logo .ink { color: var(--ink); }
.logo .accent { color: var(--accent); }
.logo img { display: block; width: min(340px, 84%); height: auto; margin: 0 auto; }
.tagline { color: var(--muted); margin: 0 0 26px; font-size: 1.12rem; font-weight: 600; }

/* Segmented controls */
.rounds-seg { margin: 0 0 18px; }
.rounds-label { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 700; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1.2px; }
.seg {
  display: flex; background: #e9ecfa; border-radius: 16px; padding: 5px; gap: 5px;
  box-shadow: inset 0 2px 5px rgba(31,45,110,0.08);
}
.seg-btn {
  flex: 1; border: none; background: transparent; color: var(--muted);
  font-family: var(--font); font-size: 1.05rem; font-weight: 800; padding: 13px 0; border-radius: 12px; cursor: pointer;
  transition: transform 0.18s cubic-bezier(.2,.9,.3,1.2), background 0.2s, color 0.2s, box-shadow 0.2s;
}
.seg-btn:active { transform: scale(0.96); }
.seg-btn:focus-visible { outline: 3px solid rgba(47,107,255,0.45); outline-offset: 2px; }
.seg-btn.active { background: var(--accent-grad); color: #fff; box-shadow: 0 8px 16px rgba(47,107,255,0.4), inset 0 1px 0 rgba(255,255,255,0.35); transform: translateY(-1px); }
/* Four-option group (era) wraps to a 2×2 grid with a smaller label. */
.seg-4 { flex-wrap: wrap; }
.seg-4 .seg-btn { flex: 1 1 40%; font-size: 0.95rem; padding: 11px 0; }

.how-to {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px;
  color: var(--muted); font-size: 0.92rem; font-weight: 600; margin: 22px 0 2px;
}
.how-to span { white-space: nowrap; }

.sv-setup { margin-top: 20px; text-align: left; border-top: 1px solid #eceefb; padding-top: 14px; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.86rem; font-weight: 700; padding: 0; }
.link-btn:hover { color: var(--ink); }
.sv-panel { margin-top: 12px; padding: 14px; background: #f6f7ff; border: 1px solid #e7eaff; border-radius: 14px; }
.sv-help { color: var(--muted); font-size: 0.82rem; line-height: 1.5; margin: 0 0 10px; }
.sv-help a { color: var(--accent); font-weight: 700; }
#sv-token { width: 100%; background: #fff; border: 1px solid #dfe3f5; border-radius: 11px; color: var(--ink); padding: 11px; font-size: 0.9rem; font-family: ui-monospace, Menlo, monospace; }
.sv-actions { display: flex; gap: 8px; margin-top: 10px; }
.sv-actions .btn { padding: 10px 18px; min-height: 0; font-size: 0.9rem; }
.sv-status { font-size: 0.82rem; color: var(--muted); font-weight: 600; margin: 10px 0 0; }
.sv-status.ok { color: var(--good); }

/* ---------------------- Icon buttons ---------------------- */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: #fff; color: var(--ink); box-shadow: var(--shadow-sm);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn .ic { width: 22px; height: 22px; }
.icon-btn-float { position: absolute; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); z-index: 10; }

/* ---------------------- Profile / settings ---------------------- */
#profile-screen {
  overflow-y: auto;
  background:
    radial-gradient(900px 480px at 15% -10%, #ffffff 0%, transparent 55%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
}
.profile-wrap { max-width: 460px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom)); }
.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.profile-head h2 { flex: 1; text-align: center; margin: 0; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.5px; font-size: 1.5rem; }
.profile-head .head-spacer { width: 44px; }

.profile-card { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); border: 2px solid rgba(12,18,48,0.10); padding: 20px; margin-bottom: 22px; }
.profile-id { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-avatar {
  width: 58px; height: 58px; flex: 0 0 58px; border-radius: 50%;
  background: var(--accent-grad); color: #fff;
  font-family: var(--font-display); font-size: 1.8rem; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 18px rgba(47,107,255,0.4);
}
.profile-name {
  flex: 1; min-width: 0; border: none; background: #f1f2f8; border-radius: 12px;
  padding: 12px 14px; font-family: var(--font); font-weight: 800; font-size: 1.1rem; color: var(--ink);
}
.profile-name:focus { outline: 2px solid var(--accent); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: #f1f2f8; border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--accent); }
.stat span { color: var(--muted); font-size: 0.8rem; font-weight: 700; }

.section-title { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.5px; font-size: 1.15rem; margin: 0 0 12px; display: flex; align-items: baseline; gap: 8px; }
.section-sub { font-family: var(--font); font-size: 0.82rem; font-weight: 700; color: var(--muted); text-transform: none; letter-spacing: 0; }

.ach-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.ach { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow-sm); }
.ach-ic { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-grad); color: #fff; }
.ach-ic .ic { width: 22px; height: 22px; }
.ach-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ach-title { font-weight: 800; color: var(--ink); }
.ach-desc { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.ach-check { color: var(--good); }
.ach-check .ic { width: 22px; height: 22px; }
.ach.off { opacity: 0.55; }
.ach.off .ach-ic { background: #d7dbec; color: #fff; }
.ach.off .ach-check { color: #b6bccf; }

/* ---------------------- Geo Time Travel HUD ---------------------- */
/* Corner labels float directly over the scene (no pill chrome), like GeoGuessr. */
.ww-brand {
  position: absolute; z-index: 1000; pointer-events: none;
  top: max(16px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left));
  display: inline-flex; align-items: center; gap: 8px;
  color: #fff; font-family: var(--font-display); font-size: 1.55rem; letter-spacing: 0.4px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
  animation: dropIn 0.4s ease;
}
.ww-brand .ic { width: 26px; height: 26px; color: #7be08a; }
.ww-brand img { height: 46px; width: auto; display: block; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.ww-timer {
  position: absolute; z-index: 1000; pointer-events: none;
  top: max(15px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.94); color: var(--ink);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: 8px 22px; border-radius: 999px; font-weight: 800; font-size: 1.15rem;
  font-variant-numeric: tabular-nums; box-shadow: 0 6px 20px rgba(0,0,0,0.28);
}
.ww-timer.danger { background: var(--bad); color: #fff; animation: pulse 1s ease-in-out infinite; }

.ww-meta {
  position: absolute; z-index: 1000; pointer-events: none; text-align: right;
  top: max(14px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right));
  color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}
.ww-round { font-size: 1.1rem; font-weight: 700; }
.ww-score { font-family: var(--font-display); font-size: 2.1rem; line-height: 1.05; }

/* Bottom-corner pill buttons (Settings / Where?) — plain white rounded pills. */
.ww-corner {
  -webkit-appearance: none; appearance: none; border: none; cursor: pointer;
  background: rgba(255,255,255,0.95); color: var(--ink);
  font-family: var(--font); font-weight: 800; font-size: 1.05rem;
  padding: 13px 26px; border-radius: 999px; box-shadow: 0 8px 22px rgba(0,0,0,0.28);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: transform 0.12s ease, background 0.2s ease, color 0.2s ease;
}
.ww-corner:hover { background: #fff; transform: translateY(-1px); }
.ww-corner:active { transform: translateY(1px) scale(0.98); }
.ww-corner.danger { background: var(--bad); color: #fff; }
.ww-bl { position: absolute; z-index: 1000; left: max(18px, env(safe-area-inset-left)); bottom: calc(20px + env(safe-area-inset-bottom)); }

/* The "When?" timeline ruler (bottom-centre). */
.timeline {
  position: absolute; z-index: 1100; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom)); width: min(620px, 56vw);
  text-align: center; pointer-events: none;
}
.timeline-label { display: inline-block; margin-bottom: 8px; color: #fff;
  font-family: Georgia, "Times New Roman", serif; font-size: 1.9rem; font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px rgba(0,0,0,0.65); }
.timeline.nudge { animation: tnudge 0.6s ease; }
@keyframes tnudge { 0%,100% { transform: translateX(-50%) scale(1); } 35% { transform: translateX(-50%) scale(1.07); } }
.ruler {
  position: relative; height: 56px; border-radius: 14px; overflow: hidden; pointer-events: auto;
  cursor: grab; touch-action: none;
  background: rgba(18,20,32,0.45); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.18); box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}
.ruler:active { cursor: grabbing; }
.ruler-strip { position: absolute; top: 0; bottom: 0; left: 0; will-change: transform; }
.tick { position: absolute; top: 12px; width: 0; border-left: 2px solid rgba(255,255,255,0.45); }
.tick.major { top: 8px; height: 22px; border-left-color: rgba(255,255,255,0.85); }
.tick.minor { height: 11px; }
.tick-label { position: absolute; top: 32px; transform: translateX(-50%); color: rgba(255,255,255,0.92);
  font-size: 0.78rem; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,0.7); white-space: nowrap; }
.ruler-needle { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-50%);
  background: #fff; box-shadow: 0 0 6px rgba(0,0,0,0.4); }
.ruler-needle::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid #fff; }
.ruler-needle::after { content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 7px solid #fff; }

/* Live "players online" pill — kept but hidden by default to match the screenshot. */
.live-pill {
  position: absolute; z-index: 900;
  top: calc(env(safe-area-inset-top) + 60px); left: max(12px, env(safe-area-inset-left));
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--ink); font-weight: 800; font-size: 0.82rem;
  padding: 8px 13px; border-radius: 999px; box-shadow: var(--shadow-sm); pointer-events: none;
}
.live-pill b { color: var(--accent); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(24,201,138,0.6); animation: livepulse 1.7s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(24,201,138,0.6); } 70% { box-shadow: 0 0 0 8px rgba(24,201,138,0); } 100% { box-shadow: 0 0 0 0 rgba(24,201,138,0); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* ---------------------- Pano ---------------------- */
.pano { position: absolute; inset: 0; background: #0a0f15; overflow: hidden; }
.sv { position: absolute; inset: 0; width: 100%; height: 100%; display: none; touch-action: none; cursor: grab; }
.sv canvas { display: block; width: 100%; height: 100%; }
.pano-loader { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); background: linear-gradient(160deg, var(--bg1), var(--bg2)); z-index: 5; font-weight: 700; }
.spinner { width: 46px; height: 46px; border: 5px solid #dfe3f7; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pano-hint {
  position: absolute; top: calc(env(safe-area-inset-top) + 108px); left: 50%; transform: translateX(-50%) translateY(-8px);
  z-index: 900; max-width: min(92vw, 480px); padding: 11px 18px; border-radius: 999px;
  background: rgba(255,255,255,0.96); color: var(--ink); font-size: 0.88rem; font-weight: 700; text-align: center;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.pano-hint.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.pano-hint b { color: var(--accent); }

/* ---------------------- Guess panel (Where?) ---------------------- */
/* Bottom-right: mini-map thumbnail + a Where?/Guess pill. */
.guess-panel {
  position: absolute; z-index: 1000; display: flex; flex-direction: column; gap: 10px;
  bottom: calc(18px + env(safe-area-inset-bottom)); right: max(16px, env(safe-area-inset-right)); width: 300px;
  transition: width 0.22s ease, bottom 0.22s ease;
}
.guess-map { width: 100%; border-radius: 20px; border: 3px solid #fff; box-shadow: var(--shadow); overflow: hidden; transition: height 0.22s ease; height: 150px; background: var(--card); }
/* Lift the open map clear of the bottom ruler so the year stays visible + usable. */
.guess-panel.expanded { width: min(560px, 92vw); bottom: calc(120px + env(safe-area-inset-bottom)); }
.guess-panel.expanded .guess-map { height: min(60vh, 460px); }
.ww-where { width: 100%; }
.map-open {
  position: absolute; top: 0; left: 0; right: 0; height: 150px; border: none; border-radius: 20px; cursor: pointer;
  background: rgba(12,18,48,0.32); color: #fff; font-weight: 800; font-size: 1rem; backdrop-filter: blur(1px);
}
.guess-panel.expanded .map-open { display: none; }
.map-collapse {
  position: absolute; top: 10px; right: 10px; z-index: 5; display: none;
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: #fff; color: var(--ink); font-size: 1rem; box-shadow: var(--shadow-sm);
}
.guess-panel.expanded .map-collapse { display: block; }

/* ---------------------- Score bar ---------------------- */
.score-bar { height: 12px; background: #eceefb; border-radius: 999px; overflow: hidden; margin: 14px 0; }
.score-bar.big { height: 16px; }
.score-bar-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #18c98a, #11b3d6); transition: width 0.85s cubic-bezier(.2,.85,.25,1); }

/* ---------------------- Result ---------------------- */
.result-map { position: absolute; inset: 0; }
.result-card {
  position: absolute; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1000;
  background: var(--card); padding: 18px 18px 20px; border-radius: 28px; box-shadow: var(--shadow);
  border: 2px solid rgba(12,18,48,0.10);
  text-align: center; width: min(420px, calc(100vw - 28px));
  display: flex; flex-direction: column;
  max-height: calc(100dvh - 44px - env(safe-area-inset-bottom) - env(safe-area-inset-top));
  animation: slideUp 0.42s cubic-bezier(.2,.85,.25,1);
}
/* The summary + wiki content scrolls; the action buttons stay pinned so the
   key result (place/year guess + points) is never pushed off-screen. */
.result-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
@keyframes slideUp { from { opacity: 0; transform: translateX(-50%) translateY(26px); } to { opacity: 1; transform: translateX(-50%); } }
.result-emoji { font-size: 2.2rem; line-height: 1; margin-bottom: 4px; }
.result-card h2 { margin: 2px 0 0; font-family: var(--font-display); font-weight: 400; letter-spacing: 0.4px; font-size: 1.9rem; line-height: 1.05; color: var(--ink); }
.result-rows { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.result-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #f1f2f8; border-radius: 14px; padding: 11px 15px; text-align: left; }
.result-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result-row-label { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.result-row-guess { font-size: 0.95rem; font-weight: 700; color: var(--ink); }
.result-row-guess b { font-weight: 800; }
.result-row-pts { font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; color: var(--accent); font-variant-numeric: tabular-nums; flex: none; }
.result-blurb { color: var(--ink); font-size: 0.9rem; line-height: 1.5; font-weight: 600; margin: 4px 0 10px; }
.result-wiki { display: inline-block; color: var(--accent); font-weight: 800; font-size: 0.9rem; text-decoration: none; margin: 0 0 14px; }
.result-wiki:hover { text-decoration: underline; }
.result-wiki-fig { margin: 0 0 14px; }
.result-wiki-fig img { display: block; width: 100%; max-height: 200px; object-fit: cover; border-radius: 20px; box-shadow: var(--shadow-sm); }
.result-wiki-fig figcaption { color: var(--muted); font-size: 0.72rem; font-weight: 700; text-align: center; margin-top: 6px; }
.result-points {
  margin: 4px auto 12px; font-family: var(--font-display); font-weight: 400; letter-spacing: 0.5px;
  font-size: 1.7rem; color: #fff;
  background: var(--accent-grad); border-radius: 18px; padding: 12px 18px;
  box-shadow: 0 10px 22px rgba(47,107,255,0.38);
}
.result-points #result-points-num { font-size: 2.5rem; }
.result-actions { display: flex; gap: 10px; margin-top: 14px; flex: none; }
.result-actions .btn { flex: 1; }

/* ---------------------- Summary ---------------------- */
.summary-card h1 { margin: 0 0 6px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.5px; font-size: 2.2rem; font-weight: 400; }
.summary-total { color: var(--muted); margin: 0; font-weight: 700; }
.summary-score { font-family: var(--font-display); font-size: 4.4rem; font-weight: 400; color: var(--accent); line-height: 1; letter-spacing: 0.5px; }
.summary-max { color: var(--muted); margin: 0 0 6px; font-weight: 700; }
.summary-grade { font-size: 1.25rem; font-weight: 800; margin: 10px 0 16px; }
.round-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; text-align: left; }
.round-row { display: flex; align-items: center; gap: 12px; background: #f1f2f8; border-radius: 16px; padding: 10px 14px; }
.round-row-rank { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; background: #fff; color: var(--accent); font-weight: 800; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.round-row-main { flex: 1; min-width: 0; }
.round-row-name { font-weight: 800; color: var(--ink); font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round-row-sub { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.round-row-pts { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.round-row-heart { font-size: 1.05rem; width: 22px; text-align: center; }
.summary-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------------------- Stats ---------------------- */
.icon-btn-float-left { left: max(16px, env(safe-area-inset-left)); right: auto; }
.stats-empty { color: var(--muted); text-align: center; font-weight: 700; padding: 36px 10px; }
#stats-screen .stats-grid { margin-bottom: 20px; }
.stats-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.stats-sort { display: inline-flex; gap: 6px; }
.stats-sort-btn { font-family: var(--font); border: none; cursor: pointer; background: #e9ebf5; color: var(--muted); border-radius: 999px; padding: 4px 11px; font-size: 0.78rem; font-weight: 700; }
.stats-sort-btn.active { background: var(--accent); color: #fff; }
.stats-table { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.stats-row { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; align-items: center; background: var(--card); border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow-sm); font-weight: 700; font-size: 0.9rem; }
.stats-row span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.stats-row.stats-head { background: transparent; box-shadow: none; padding: 0 14px; color: var(--muted); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.stats-row-empty { display: block; text-align: center; color: var(--muted); background: #f1f2f8; box-shadow: none; }
.stats-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 14px; margin-bottom: 24px; }
.stats-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.stats-bar i { display: block; width: 100%; min-height: 4px; background: var(--accent-grad); border-radius: 6px 6px 3px 3px; }

/* ---------------------- Share / invite menu ---------------------- */
.share-sheet { position: fixed; inset: 0; z-index: 4000; display: flex; align-items: flex-end; justify-content: center; }
.share-backdrop { position: absolute; inset: 0; background: rgba(8,12,30,0.5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.share-panel { position: relative; z-index: 1; width: min(440px, calc(100vw - 24px)); margin-bottom: calc(16px + env(safe-area-inset-bottom)); background: var(--card); border-radius: 24px; box-shadow: var(--shadow); border: 2px solid rgba(12,18,48,0.10); padding: 20px; animation: sheetUp 0.28s ease; }
@keyframes sheetUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.share-title { margin: 0 0 14px; font-family: var(--font-display); font-weight: 400; letter-spacing: 0.4px; font-size: 1.3rem; text-align: center; color: var(--ink); }
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.share-opt { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-radius: 14px; background: #f1f2f8; border: none; cursor: pointer; font-family: var(--font); font-weight: 700; font-size: 0.95rem; color: var(--ink); text-decoration: none; text-align: left; }
.share-opt:hover { background: #e6e9f5; }
.share-opt:active { transform: scale(0.98); }
.share-dot { width: 13px; height: 13px; border-radius: 50%; flex: none; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.share-close { width: 100%; }

/* ---------------------- Toast ---------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  z-index: 3000; background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 999px;
  box-shadow: var(--shadow); font-size: 0.95rem; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------------- Mobile ---------------------- */
@media (max-width: 640px) {
  /* Stack the bottom UI: the timeline spans the very bottom; Settings and the
     map+Where stack sit just above it so nothing overlaps. */
  .ww-brand { font-size: 1.25rem; }
  .ww-brand .ic { width: 22px; height: 22px; }
  .ww-brand img { height: 38px; }
  .ww-score { font-size: 1.7rem; }
  .ww-round { font-size: 1rem; }
  .ww-timer { font-size: 1rem; padding: 7px 16px; }
  .ww-corner { font-size: 0.95rem; padding: 11px 18px; }

  .timeline { width: calc(100vw - 24px); bottom: calc(14px + env(safe-area-inset-bottom)); }
  .timeline-label { font-size: 1.4rem; margin-bottom: 6px; }

  .ww-bl { bottom: calc(120px + env(safe-area-inset-bottom)); }
  .guess-panel { right: max(10px, env(safe-area-inset-right)); width: 156px; bottom: calc(120px + env(safe-area-inset-bottom)); }
  .guess-panel.expanded { left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); width: auto; bottom: calc(110px + env(safe-area-inset-bottom)); }
  .guess-panel.collapsed .guess-map, .map-open { height: 104px; }
  .guess-panel.expanded .guess-map { height: 48vh; }
  .logo { font-size: 2.6rem; }
  .result-wiki-fig img { max-height: 150px; }
}
