:root {
  --bg: #d8d4e4;
  --ink: #2b2840;
  --ink-soft: #5e5977;
  --glass: rgba(252, 251, 255, 0.92);
  --glass-strong: rgba(248, 246, 253, 0.88);
  --line: rgba(43, 40, 64, 0.10);
  --red: #ff2d2d;          /* map markers only */
  --accent: #2b2840;       /* primary buttons and highlights */
  --accent-dark: #1a1829;
  --mint: #bfe8cf;
  --tint: #efedf5;         /* soft neutral panel */
  /* Round difficulty colors: easy green to boss red */
  --r1: #2fb562; --r2: #8cc63f; --r3: #e9b824; --r4: #f28c28; --r5: #e8553a; --r6: #b3202a;
  --shadow: 0 8px 24px rgba(40, 32, 80, 0.14), 0 1px 3px rgba(40, 32, 80, 0.08);
  --radius: 20px;
  --body: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Globe ---------- */
#map {
  position: fixed; inset: 0;
  background: var(--bg);
}
.maplibregl-ctrl-attrib.maplibregl-ctrl { font-family: system-ui, sans-serif; font-size: 9px; line-height: 1.3; background: rgba(255,255,255,.55); border-radius: 6px 0 0 0; max-width: 100vw; }
/* Credits sit at the very bottom edge; the controls float just above them. */
.maplibregl-ctrl-bottom-right { bottom: var(--safe-bottom); left: 0; right: 0; display: flex; justify-content: center; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-ctrl { margin: 0; border-radius: 6px 6px 0 0; }

/* Plain title text (the old animated shimmer is gone) */
.shimmer { color: var(--ink); }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid rgba(43, 40, 64, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; top: calc(8px + var(--safe-top)); left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: space-between;
  pointer-events: none; z-index: 5;
}
/* Title centered on the screen no matter how many buttons sit on each side */
.topbar .logo { position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none;
  text-shadow: 0 0 10px rgba(255,255,255,.9), 0 0 3px rgba(255,255,255,.9); }
.topbar > * { pointer-events: auto; }
.logo {
  font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .02em; margin: 0;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.8);
  background: var(--glass-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow); font-weight: 700; font-size: 16px;
}

.target-card {
  position: fixed; z-index: 4;
  top: calc(54px + var(--safe-top)); left: 12px; right: 12px;
  max-width: 560px; margin: 0 auto;
  padding: 14px 16px 12px;
}
.target-meta { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--ink-soft); letter-spacing: .04em; text-transform: uppercase; }
#mult-label { font-weight: 700; color: var(--ink); }
#mult-label.halved { color: #b0487a; }
.target-name {
  font-family: var(--display); font-weight: 700; font-size: clamp(19px, 5.4vw, 26px);
  line-height: 1.15; margin: 8px 0 10px; display: flex; gap: 10px; align-items: flex-start;
}
.target-name .flag { font-size: 1.15em; line-height: 1; flex: none; }
.target-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pips { display: flex; gap: 6px; }
/* Round bars colored by difficulty: faded until reached, solid once reached */
.pip { width: 22px; height: 6px; border-radius: 3px; background: var(--c); opacity: .28; }
.pip.done, .pip.current { opacity: 1; }
.pip.current { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--c); }
.chip {
  border: 1px solid var(--line); background: #f8f6fd; border-radius: 999px; padding: 7px 16px;
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.chip:disabled { opacity: .4; cursor: default; }
.hint-result {
  margin-top: 10px; padding: 8px 12px; border-radius: 12px;
  background: var(--tint); font-size: 13px;
}

/* ---------- Bottom ---------- */
.bottom {
  position: fixed; z-index: 4; left: 12px; right: 12px;
  bottom: calc(22px + var(--safe-bottom));
  max-width: 560px; margin: 0 auto;
  pointer-events: none;
}
.bottom > * { pointer-events: auto; }
.actions { display: flex; gap: 10px; justify-content: center; }
.helper {
  margin: 0; padding: 10px 16px; border-radius: 999px;
  background: var(--glass-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow); font-size: 12px; pointer-events: none;
}
.helper.probe { background: #fff; box-shadow: 0 0 0 2px var(--accent), var(--shadow); }

.btn {
  border: 0; border-radius: 16px; padding: 15px 20px; min-height: 52px;
  font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .01em;
  box-shadow: var(--shadow);
}
.btn.wide { width: 100%; }
.btn.ghost { background: var(--glass-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.8); }
.btn.prism {
  flex: 1; color: #fff; background: var(--accent); border: 0;
}
.btn.prism:active { background: var(--accent-dark); }
#actions-confirm .btn.ghost { flex: 0 0 34%; }
.btn:active { transform: translateY(1px) scale(.99); }

.result-card { padding: 14px 16px 14px; }
.result-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.result-text { flex: 1; min-width: 0; }
.result-dist { font-family: var(--display); font-weight: 700; font-size: 19px; }
.badge { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--mint); color: #24583d; }
.result-calc { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.result-points { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; text-align: right; }
.result-points small { display: block; font-family: var(--body); font-weight: 400; font-size: 11px; color: var(--ink-soft); }

/* ---------- Rings ---------- */
.ring { position: relative; width: 54px; height: 54px; flex: none; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .ring-bg { stroke: rgba(43,40,64,.10); }
.ring .ring-fg { stroke: var(--ring, var(--accent)); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.2,1); }
.ring span { font-weight: 700; font-size: 13px; position: relative; }
.ring.big { width: 72px; height: 72px; }
.ring.big span { font-size: 12px; }

/* ---------- Sheets ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(216,212,228,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px; padding-bottom: calc(12px + var(--safe-bottom));
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 520px; max-height: calc(100% - 20px); overflow: auto;
  padding: 20px 18px 16px; background: var(--glass-strong);
  animation: rise .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } }
.sheet h2 { font-family: var(--display); font-weight: 800; margin: 4px 0 6px; font-size: 22px; }
.muted { color: var(--ink-soft); }
.small { font-size: 12px; }
.option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  text-align: left; padding: 13px 14px; margin: 8px 0; border-radius: 14px;
  background: #f8f6fd; border: 1px solid var(--line);
}
.option b { font-family: var(--display); font-size: 16px; }
.option span { font-size: 13px; color: var(--ink-soft); }
.option:active { background: #efecf8; }
.sheet .btn.wide { margin-top: 10px; }
.help ul { padding-left: 18px; line-height: 1.55; }
.help li { margin-bottom: 6px; }

.end-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.end-total { font-family: var(--display); font-weight: 800; font-size: 46px; line-height: 1.05; }
.end-total small { font-size: 18px; color: var(--ink-soft); font-weight: 700; }
.share-grid { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 6px 18px; font-size: 18px; font-weight: 700; margin: 12px 0 4px; }
.breakdown { list-style: none; padding: 0; margin: 10px 0 14px; }
.breakdown li {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px;
}
.breakdown .bd-name { font-family: var(--display); font-weight: 700; font-size: 15px; }
.breakdown .bd-sub { color: var(--ink-soft); font-size: 12px; }
.breakdown .bd-pts { font-weight: 700; font-size: 16px; text-align: right; }
.end-actions { display: flex; gap: 10px; }
.end-actions .btn.ghost { flex: 0 0 38%; }
.link-btn { background: none; border: 0; width: 100%; margin-top: 12px; padding: 8px; text-decoration: underline; color: var(--ink-soft); }

.date-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; }
.date-row input { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #f8f6fd; color: var(--ink); }
.archive-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; }
.archive-list a {
  display: flex; justify-content: space-between; padding: 11px 4px; border-top: 1px solid var(--line);
  color: inherit; text-decoration: none;
}
.archive-list a.current { font-weight: 700; }
.archive-list .st { color: var(--ink-soft); }

/* ---------- Markers ---------- */
.mk { pointer-events: none; }
.pin { width: 30px; height: 40px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); }
.pin svg { display: block; width: 100%; height: 100%; }
.probe-dot { width: 20px; height: 20px; border-radius: 50%; border: 3px solid #fff; background: #8fc9ea; box-shadow: 0 2px 8px rgba(0,0,0,.45); }

/* Answer marker: red circle, thick red arrows, clickbait thumbnail energy */
.bait { width: 170px; height: 170px; }
.bait.mini { width: 84px; height: 84px; }
.bait svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.bait .halo { fill: none; stroke: #fff; stroke-width: 10; }
.bait .ring-red { fill: none; stroke: #ff2020; stroke-width: 6; }
.bait .arrows path { fill: #ff2020; stroke: #fff; stroke-width: 3.5; stroke-linejoin: round; paint-order: stroke; }
.bait .bob { animation: bob .7s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateX(0); } to { transform: translateX(9px); } }
@media (prefers-reduced-motion: reduce) { .bait .bob { animation: none; } }
.bait + .marker-label { bottom: auto; top: 50%; transform: translate(-50%, 74px); }
.bait.mini + .marker-label { transform: translate(-50%, 36px); }

.marker-label {
  position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, -6px);
  white-space: nowrap; font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--ink);
  background: rgba(248,246,253,.95); padding: 3px 9px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.probe-dot + .marker-label { transform: translate(-50%, -8px); }

.toast {
  position: fixed; z-index: 30; left: 50%; top: calc(50% - 20px); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13px;
  box-shadow: var(--shadow); animation: fade .15s ease;
}

.loading-screen {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; background: var(--bg);
  font-family: var(--display); font-weight: 800; font-size: 28px;
}

/* ---------- v7: guess country, round facts, stats ---------- */
.topbar-right { display: flex; gap: 8px; }
.result-where { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-top: 2px; min-height: 0; }
.result-where:empty { display: none; }
.badge { margin-left: 0; }
.section-title { font-family: var(--display); font-size: 15px; font-weight: 800; margin: 18px 0 4px; letter-spacing: .01em; }
.section-title small { font-weight: 500; font-size: 12px; color: var(--ink-soft); margin-left: 6px; }
.breakdown li { display: block; padding: 0; }
.breakdown details { padding: 10px 0; }
.breakdown summary { list-style: none; cursor: pointer; display: block; }
.breakdown summary::-webkit-details-marker { display: none; }
.bd-round { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); background: var(--c, var(--tint)); color: #fff; padding: 2px 8px; border-radius: 999px; margin-bottom: 6px; }
.bd-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; }
.bd-flag { font-size: 18px; }
.bd-name { display: block; }
.bd-sub { display: block; }
.bd-more { display: inline-block; margin: 6px 0 0 34px; font-size: 12px; font-weight: 600; color: #7a6fc0; }
.bd-more::after { content: " ▾"; }
details[open] .bd-more::after { content: " ▴"; }
.facts { margin: 8px 0 2px 34px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.55); display: grid; gap: 6px; }
.fact { display: grid; grid-template-columns: 82px 1fr; gap: 8px; font-size: 13px; }
.fact span { color: var(--ink-soft); }
.fact b { font-weight: 600; }
.stat-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; margin: 8px 0 12px; }
.stat-tiles div { background: rgba(255,255,255,.55); border-radius: 12px; padding: 8px 2px; }
.stat-tiles b { display: block; font-family: var(--display); font-size: 20px; font-weight: 800; }
.stat-tiles span { font-size: 10.5px; color: var(--ink-soft); font-weight: 600; }
.hist { display: grid; gap: 4px; margin-bottom: 6px; }
.hist-row { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-soft); }
.hist-bar { background: rgba(43,40,64,.18); color: var(--ink); border-radius: 5px; font-size: 11px; font-weight: 700; padding: 1px 6px; text-align: right; min-height: 16px; }
.hist-bar.mine { background: var(--accent); color: #fff; }

/* ---------- v8: menu and practice modes ---------- */
.menu { display: grid; gap: 8px; margin: 8px 0 4px; }
.menu a { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: #f8f6fd; border: 1px solid var(--line); color: inherit; text-decoration: none; }
.menu a b { font-family: var(--display); font-size: 16px; }
.menu a span { font-size: 13px; color: var(--ink-soft); }
.menu a.current { outline: 2px solid var(--accent); }
.mode-text { font-size: 15px; line-height: 1.45; margin: 8px 0 12px; }
.trail { font-size: 22px; letter-spacing: 2px; margin-top: 8px; word-break: break-all; }
.stat-tiles.three { grid-template-columns: repeat(3, 1fr); }
.stat-tiles.four { grid-template-columns: repeat(4, 1fr); }
a.link-btn { display: block; text-align: center; }
.temp-dot { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.45); }
.temp-dot.latest { width: 22px; height: 22px; box-shadow: 0 0 0 4px rgba(255,255,255,.45), 0 2px 8px rgba(0,0,0,.5); }
.temp-dot + .marker-label { transform: translate(-50%, -10px); }
body[data-mode="streak"] #pips, body[data-mode="hotcold"] #pips { display: none; }

/* ---------- v9: hot & cold direction ---------- */
.dir-arrow { position: absolute; left: 50%; top: 50%; width: 40px; height: 56px; margin: -28px 0 0 -20px;
  transform: rotate(var(--rot)) translateY(-50px); filter: drop-shadow(0 2px 4px rgba(0,0,0,.45)); pointer-events: none; }
.dir-arrow svg { display: block; width: 100%; height: 100%; animation: nudge 1s ease-in-out infinite alternate; }
@keyframes nudge { to { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .dir-arrow svg { animation: none; } }
.temp-dot.latest + .marker-label { transform: translate(-50%, 34px); bottom: auto; top: 50%; }
.hc-reading { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.hc-arrow { font-size: 30px; line-height: 1; }
.hc-sub { font-size: 13px; color: var(--ink-soft); }

/* ---------- v11: final results pins ---------- */
.result-pin { z-index: 2; }
.pin.red { width: 26px; height: 35px; }
.result-label { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 7px;
  background: rgba(255,255,255,.93); }
.result-label.short { padding: 1px 5px; font-size: 10.5px; }

/* ---------- v12: plain theme bits ---------- */
.help { padding-bottom: 0; }
.help ul { margin: 6px 0; line-height: 1.4; }
.help li { margin-bottom: 4px; }
.help p { margin: 6px 0; }
.help .sticky-go { position: sticky; bottom: 0; margin: 8px -18px 0; padding: 10px 18px calc(12px + var(--safe-bottom));
  background: linear-gradient(rgba(252,251,255,0), rgba(252,251,255,.97) 30%); }
.help .sticky-go .btn { margin: 0; }
.help details { margin: 4px 0 2px; font-size: 13px; }
.help details summary { cursor: pointer; font-weight: 700; color: var(--ink-soft); }

/* ---------- v14: next-step buttons ---------- */
#actions-done .btn.ghost { flex: 0 0 38%; }
.end-next { margin-top: 10px; }
.end-next.outline { background: #fff; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
