/* DISTANCED — clean light/dark theme (inspired by chain-daily). */

:root {
  --bg: #fafafa;
  --bg-2: #f4f4f5;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --line: #e4e4e7;
  --text: #18181b;
  --muted: #71717a;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --hot: #15803d;
  --warm: #b45309;
  --cool: #2563eb;
  --cold: #dc2626;
  --soft: rgba(0, 0, 0, 0.04);
  --soft-2: rgba(0, 0, 0, 0.07);
  --globe-bg: #0a1424;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.10);
  --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0f;
    --bg-2: #0d0d0f;
    --panel: #161618;
    --panel-solid: #161618;
    --line: #27272a;
    --text: #f5f5f5;
    --muted: #b4bac2;
    --accent: #3b82f6;
    --accent-2: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.14);
    --hot: #22c55e;
    --warm: #fdba74;
    --cool: #3b82f6;
    --cold: #f87171;
    --soft: rgba(255, 255, 255, 0.05);
    --soft-2: rgba(255, 255, 255, 0.09);
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

#app { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 18px clamp(14px, 3vw, 28px) 40px; }

h1, h2, h3, h4 { margin: 0 0 0.4em; line-height: 1.15; }
[tabindex="-1"]:focus { outline: none; }
.ac-item { user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
p { margin: 0 0 0.6em; }
.muted { color: var(--muted); }
.fine-print { font-size: 0.82rem; }

/* ---- buttons ---- */
.btn {
  appearance: none; border: 1px solid var(--line); cursor: pointer;
  font: inherit; font-weight: 600; color: var(--text); background: var(--panel);
  padding: 10px 16px; border-radius: 10px; min-height: 40px;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--muted); background: var(--soft); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.btn-primary:hover { filter: brightness(1.07); background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--soft); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
  background: var(--soft); border: 1px solid var(--line); color: var(--text); white-space: nowrap;
}
.chip-win { color: var(--hot); border-color: color-mix(in srgb, var(--hot) 45%, var(--line)); }
.chip-loss { color: var(--cold); border-color: color-mix(in srgb, var(--cold) 40%, var(--line)); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2.4vw, 26px); box-shadow: var(--shadow); }

/* ---- topbar ---- */
.topbar { display: flex; align-items: center; gap: 14px; padding: 6px 2px 22px; flex-wrap: wrap; }
.logo-btn { font-weight: 800; letter-spacing: 0.16em; font-size: 1.05rem; background: none; border: 0; color: var(--text); cursor: pointer; padding: 0; }
.topbar-meta { display: flex; gap: 8px; }
.topbar-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { font: inherit; font-weight: 600; cursor: pointer; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.icon-btn:hover { background: var(--soft); }
.icon-btn.is-active { border-color: var(--accent); color: var(--accent); }
.icon-btn-q { width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 1.1rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }

/* help / settings modal */
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(15, 23, 42, 0.55); animation: fade .15s ease both; }
.modal { position: relative; width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28); animation: rise .2s ease both; }
.modal-close { position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--soft); color: var(--text); }
.modal-tabs { display: inline-flex; gap: 4px; padding: 4px; margin: 2px 0 16px; background: var(--soft); border-radius: 12px; }
.modal-tab { font: inherit; font-weight: 600; cursor: pointer; color: var(--muted); background: transparent; border: 0; border-radius: 9px; padding: 7px 14px; }
.modal-tab.is-active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.how-steps { margin: 0; padding-left: 1.2em; display: grid; gap: 11px; line-height: 1.5; }
.how-steps strong { color: var(--text); }
.settings { display: grid; gap: 14px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting-label { font-weight: 600; }
.setting-hint { margin: 2px 0 0; font-size: 0.82rem; }
.seg-group { display: inline-flex; flex: none; gap: 4px; padding: 4px; background: var(--soft); border-radius: 11px; }
.seg { font: inherit; font-weight: 600; cursor: pointer; color: var(--muted); background: transparent; border: 0; border-radius: 8px; padding: 7px 16px; }
.seg:hover { color: var(--text); }
.seg.is-active { background: var(--panel); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- onboarding ---- */
.onboarding { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; padding-top: 7vh; }
.brand .logo { font-size: clamp(2.4rem, 8vw, 4rem); letter-spacing: 0.2em; margin: 0; font-weight: 800; color: var(--text); }
.brand .tagline { color: var(--muted); font-size: 1.1rem; }
.onboard-card { width: min(520px, 100%); text-align: left; }
.onboard-card .btn { width: 100%; margin-top: 14px; }

/* ---- autocomplete ---- */
.ac-wrap { position: relative; }
.home-input, .city-input, .dist-input {
  width: 100%; font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px;
}
.home-input:focus, .city-input:focus, .dist-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.ac-dropdown { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; overflow: hidden auto; box-shadow: var(--shadow); max-height: 320px; }
.ac-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: 11px 14px; cursor: pointer; }
.ac-item:hover, .ac-item.is-active { background: var(--accent-soft); }
.ac-emoji { font-size: 1.15rem; }
.ac-name { font-weight: 600; }
.ac-country { margin-left: auto; color: var(--muted); font-size: 0.85rem; }

/* ---- mode select ---- */
.mode-head { margin-bottom: 18px; }
.mode-head h2 { font-size: 1.5rem; }
.mode-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-tile {
  text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: grid; gap: 8px; box-shadow: var(--shadow);
  transition: transform .1s ease, border-color .15s ease;
}
.mode-tile:hover { transform: translateY(-3px); border-color: var(--accent); }
.mode-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mode-tile-emoji { font-size: 2.4rem; }
.mode-tile h3 { margin: 0; font-size: 1.2rem; }
.mode-tile p { margin: 0; line-height: 1.45; }

/* ---- play ---- */
.play-grid { display: grid; gap: 18px; }
.challenge-head h2 { font-size: 1.35rem; }
.clues-wrap { margin-bottom: 16px; }
.clue { padding: 13px 15px; border-radius: 12px; line-height: 1.45; background: var(--soft); border: 1px solid var(--line); }
.clue-num { display: block; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; font-weight: 700; }

/* clue carousel — one clue at a time, arrows flank the clue (no counter row) */
.clue-carousel { margin: 8px 0 12px; }
.cc-row { display: flex; align-items: stretch; gap: 8px; }
.cc-track { flex: 1 1 auto; min-width: 0; }
.cc-nav { align-self: center; width: 34px; height: 34px; flex: none; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.cc-nav:hover:not(:disabled) { background: var(--soft); border-color: var(--muted); }
.cc-nav:disabled { opacity: 0.25; cursor: default; }
.cc-slide[hidden] { display: none; }
.clue-slide { animation: rise .25s ease both; }
/* bound the photo clue's height (aspect-ratio would otherwise balloon on wide screens) */
.clue-slide .play-photo { margin-top: 2px; aspect-ratio: auto; height: clamp(160px, 32vh, 300px); }
/* unrevealed clue: a centered "Show clue" tile with an eye icon */
.clue-locked { display: grid; place-items: center; min-height: 92px; }
.show-clue-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--panel); color: var(--accent); border: 1px solid var(--accent); }
.show-clue-btn:hover { background: var(--accent); color: #fff; }
.eye-ico { display: inline-flex; align-items: center; }
.eye-ico svg { display: block; }
.cc-dots { display: flex; justify-content: center; gap: 7px; margin-top: 10px; }
.cc-dot { width: 8px; height: 8px; border-radius: 50%; padding: 0; border: 0; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); cursor: pointer; }
.cc-dot.is-revealed { background: var(--soft-2); box-shadow: none; }
.cc-dot.is-active { background: var(--accent); box-shadow: none; }
.cc-dot:hover { box-shadow: inset 0 0 0 1.5px var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.subject-known { display: grid; gap: 12px; margin-bottom: 16px; }
.subject-meta { display: flex; gap: 12px; align-items: center; }
.subject-emoji { font-size: 2.2rem; }
.subject-name { font-size: 1.5rem; margin: 0; }
.play-photo { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background-size: cover; }

.guess-dots { display: flex; gap: 8px; margin: 4px 0 16px; }
.guess-dots .dot { width: 13px; height: 13px; border-radius: 50%; background: var(--soft-2); border: 1px solid var(--line); }
.guess-dots .dot.used { background: var(--accent); border-color: transparent; }

.guess-form { display: grid; gap: 10px; margin-top: 6px; }
.guess-form .field { position: relative; }
.form-msg { min-height: 1em; margin: 2px 0 0; }
.btn-ghost { margin-top: 0; }
.challenge > .btn-ghost { margin-top: 12px; }

/* hot/cold proximity meter */
.hotcold { position: relative; margin: 6px 0 10px; padding-top: 14px; }
.hc-bar {
  height: 26px; border-radius: 5px;
  background: linear-gradient(90deg, #2563eb 0%, #38bdf8 26%, #a3e635 50%, #f59e0b 74%, #ef4444 100%);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 7px);
          mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 7px);
}
.hc-indicator {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-top: 9px solid var(--text);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  transition: left .55s cubic-bezier(.2, .7, .2, 1);
}
.hc-labels { display: flex; justify-content: space-between; font-size: 0.66rem; letter-spacing: 0.06em; color: var(--muted); margin-top: 5px; }

/* feedback */
.feedback { display: grid; gap: 8px; margin: 4px 0 14px; }
.feedback.empty { display: none; }
.fb-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 11px; background: var(--soft); border: 1px solid var(--line); line-height: 1.35; }
.fb-tag { font-weight: 700; font-size: 0.78rem; padding: 3px 8px; border-radius: 7px; white-space: nowrap; background: var(--soft-2); }
.tone-hot { border-color: color-mix(in srgb, var(--hot) 45%, var(--line)); }
.tone-hot .fb-tag, .solved-line.tone-hot { color: var(--hot); }
.tone-warm { border-color: color-mix(in srgb, var(--warm) 45%, var(--line)); }
.tone-warm .fb-tag { color: var(--warm); }
.tone-cool { border-color: color-mix(in srgb, var(--cool) 45%, var(--line)); }
.tone-cool .fb-tag { color: var(--cool); }
.tone-cold { border-color: color-mix(in srgb, var(--cold) 40%, var(--line)); }
.tone-cold .fb-tag, .solved-line.tone-cold { color: var(--cold); }

/* ---- results ---- */
/* Globe is a fixed square; the dark card stretches to match the score tile's
   height, so the tiles are equal height with empty space below the globe.
   The square uses the padding-box trick (a definite height) + an absolutely
   positioned canvas, because globe.gl's canvas overrides `aspect-ratio` and
   would otherwise blow the element up to a huge height. */
.results-top { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 18px; align-items: stretch; margin-bottom: 18px; }
.globe-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--globe-bg); }
.globe { position: relative; width: 100%; max-width: 460px; margin: 0 auto; height: 0; padding-bottom: 100%; overflow: hidden; flex: none; }
.globe canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/* location details, full width under the globe + score */
.reveal-wide { display: grid; gap: 16px; margin-bottom: 4px; }
@media (min-width: 720px) {
  .reveal-wide { grid-template-columns: 340px 1fr; align-items: start; }
  .reveal-wide .reveal-photo { margin-bottom: 0; aspect-ratio: 4 / 3; }
}
/* compact log of guesses inside the score card */
.guess-log { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.guess-log-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.result-list { display: grid; gap: 6px; }
.result-row { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; }
.result-sq { flex: none; width: 18px; height: 18px; border-radius: 5px; background: var(--soft-2); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.result-sq.tone-good { background: var(--hot); }
.result-sq.tone-close { background: var(--warm); }
.result-sq.tone-far { background: var(--cold); }
.result-main { font-weight: 700; font-variant-numeric: tabular-nums; }
.result-detail { margin-left: auto; font-size: 0.78rem; white-space: nowrap; }
.reveal-photo { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; margin-bottom: 14px; background-size: cover; }
.photo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .45s ease; }
.has-photo .photo-img { opacity: 1; }
.reveal-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.reveal-emoji { font-size: 2.4rem; }
.reveal-card h2 { font-size: 1.6rem; }
.reveal-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 14px; }
.stat { background: var(--soft); border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; display: grid; gap: 3px; }
.stat-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat-value { font-weight: 700; font-size: 1.05rem; }
.solved-line { font-weight: 600; margin: 6px 0; }
.fun-facts { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 11px; padding: 12px 14px; margin-top: 8px; }
.fun-facts h4 { margin: 0 0 6px; font-size: 0.95rem; color: var(--accent); }
.fun-facts ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.fun-facts li { line-height: 1.45; }

/* rotating "Did you know?" fact */
.fact-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.fact-head h4 { margin: 0; }
.fact-dots { display: flex; gap: 6px; }
.fact-dot { width: 7px; height: 7px; border-radius: 50%; padding: 0; border: 0; background: var(--soft-2); cursor: pointer; }
.fact-dot.is-active { background: var(--accent); }
.fact-text { margin: 0; line-height: 1.45; min-height: 2.9em; }
.fact-text.fade { animation: factfade .45s ease; }
@keyframes factfade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* compact tabbed "Explore" panel: Sights / Food / Guide / Wiki */
.explore { margin-top: 12px; }
.exp-tabs { display: flex; gap: 4px; padding: 4px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; }
.exp-tab { flex: 1; font: inherit; font-weight: 600; font-size: 0.78rem; cursor: pointer; color: var(--muted); background: transparent; border: 0; border-radius: 7px; padding: 7px 6px; white-space: nowrap; }
.exp-tab.is-active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.exp-panel { margin-top: 10px; min-height: 2.5em; }
.exp-content { display: grid; gap: 8px; }
.exp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.exp-item { display: flex; align-items: flex-start; gap: 10px; }
.exp-text { flex: 1; min-width: 0; }
.exp-name { font-weight: 700; font-size: 0.9rem; color: var(--text); text-decoration: none; }
a.exp-name:hover { color: var(--accent); text-decoration: underline; }
.exp-blurb { font-size: 0.8rem; line-height: 1.35; margin-top: 1px; }
.exp-besttime { font-size: 0.85rem; line-height: 1.4; margin: 0 0 2px; }
.exp-linkrow { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.exp-linkrow:hover { text-decoration: underline; }
.bm { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 0.95rem; line-height: 1; cursor: pointer; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.bm:hover { border-color: var(--warm); color: var(--warm); }
.bm.is-on { color: #fff; background: var(--warm); border-color: var(--warm); }

.scorecard h3 { margin-bottom: 14px; }
.score-metric { margin-bottom: 16px; }
.score-row-top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; font-size: 0.92rem; margin-bottom: 6px; }
.score-val { font-weight: 800; font-size: 1.35rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.score-sub { font-size: 0.82rem; margin-top: 6px; }
.bar { height: 9px; border-radius: 99px; background: var(--soft-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .8s cubic-bezier(.2,.7,.2,1); }
.city-tag { font-weight: 700; font-size: 0.95rem; color: var(--muted); }
.city-tag.is-solved { color: var(--hot); }

/* ---- postcard (real-postcard look) ---- */
.postcard-reveal { margin-top: 22px; }
.postcard-reveal h3 { margin-bottom: 12px; }
.postcard { position: relative; border-radius: 12px; overflow: hidden; max-width: 400px; background: #f4efe3; color: #1f2933; box-shadow: var(--shadow); border: 1px solid rgba(0,0,0,0.18); }
.postcard.is-solved { box-shadow: var(--shadow), 0 0 0 2px var(--hot); }
.pc-photo { position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; background-size: cover; }
.pc-photo .photo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .45s ease; }
.pc-photo.has-photo .photo-img { opacity: 1; }
.pc-corner { position: absolute; top: 12px; right: 12px; width: 92px; height: 78px; }
.pc-stamp { position: absolute; top: 0; right: 0; width: 56px; min-height: 68px; background: #fffdf5; border: 1px solid #cbbf9e; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transform: rotate(4deg); box-shadow: 0 2px 7px rgba(0,0,0,0.35); outline: 3px dashed #fffdf5; outline-offset: -1px; }
.pc-stamp-flag { font-size: 1.4rem; line-height: 1; }
.pc-stamp-val { font-size: 0.58rem; font-weight: 800; color: #0f766e; text-align: center; }
.pc-stamp-name { font-size: 0.46rem; font-weight: 800; letter-spacing: 0.12em; color: #8a8270; }
.pc-postmark { position: absolute; top: 16px; left: 0; width: 62px; height: 62px; border-radius: 50%; border: 2px solid rgba(40,52,66,0.55); color: rgba(40,52,66,0.7); display: flex; flex-direction: column; align-items: center; justify-content: center; transform: rotate(-13deg); font-size: 0.46rem; font-weight: 800; line-height: 1.25; text-align: center; letter-spacing: 0.04em; pointer-events: none; background: repeating-radial-gradient(circle, transparent 0 7px, rgba(40,52,66,0.06) 7px 8px); }
.pc-caption { padding: 12px 14px 14px; position: relative; }
.postcard.is-solved .pc-caption { box-shadow: inset 4px 0 0 var(--hot); }
.pc-title { font-family: Georgia, 'Times New Roman', serif; font-size: 1.25rem; font-weight: 800; line-height: 1.1; }
.pc-sub { font-size: 0.85rem; color: #6b7280; margin-top: 1px; }
.pc-greeting { margin-top: 7px; font-family: 'Snell Roundhand', 'Segoe Script', 'Bradley Hand', cursive; font-size: 1.05rem; color: #3f4756; }
.results-actions { display: flex; align-items: center; gap: 16px; margin-top: 16px; flex-wrap: wrap; }

/* ---- stats ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { text-align: center; padding: 18px 14px; }
.stat-card-value { font-size: 2rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.stat-card-label { font-size: 0.85rem; margin-top: 6px; }
.stat-card-sub { font-size: 0.74rem; margin-top: 2px; }
.mode-breakdown h3 { margin-bottom: 8px; }
.mode-row { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); }
.mode-row:first-of-type { border-top: 0; }

/* ---- journal map ---- */
.journal-map { position: relative; width: 100%; aspect-ratio: 2 / 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--panel); }
.map-canvas { display: block; width: 100%; height: 100%; }
.map-pin { position: absolute; width: 16px; height: 16px; transform: translate(-50%, -50%); padding: 0; border: 0; background: none; cursor: pointer; z-index: 2; }
.map-pin::before { content: ''; display: block; width: 12px; height: 12px; margin: 2px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.45); transition: transform .1s ease; }
.map-pin.is-solved::before { background: var(--hot); }
.map-pin.has-bookmarks::after { content: '★'; position: absolute; top: -7px; right: -7px; font-size: 9px; line-height: 1; color: var(--warm); text-shadow: 0 0 2px #000, 0 0 2px #000; }
.map-pin.is-home { cursor: default; }
.map-pin.is-home::before { background: var(--warm); width: 14px; height: 14px; margin: 1px; }
.map-pin:hover::before, .map-pin:focus-visible::before { transform: scale(1.45); }
.map-pin:focus-visible { outline: none; }
.map-popup { position: absolute; z-index: 10; width: 240px; max-width: 72%; }
.map-popup .postcard { max-width: 240px; }
.map-popup .photo-img { transition: none; } /* no fade/flicker when opening a pin */
.map-popup-close { position: absolute; top: -10px; right: -10px; z-index: 11; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font-size: 16px; line-height: 1; box-shadow: var(--shadow); }
.map-popup-open { width: 100%; margin-top: 8px; min-height: 34px; padding: 6px 10px; font-size: 0.85rem; }
.popup-saved { margin-top: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.popup-saved-h { font-size: 0.7rem; font-weight: 800; color: var(--warm); text-transform: uppercase; letter-spacing: 0.06em; }
.popup-saved ul { margin: 5px 0 0; padding-left: 16px; font-size: 0.8rem; color: var(--text); display: grid; gap: 2px; }

/* ---- journal ---- */
.journal-head { margin-bottom: 18px; }
.journal-head .btn { margin-top: 10px; }
.journal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.postcard-wrap { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.postcard-wrap .postcard { max-width: none; transition: transform .12s ease; }
.postcard-wrap:hover .postcard { transform: translateY(-3px); }
.postcard-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 14px; }
.empty-journal { padding: 30px 0; }

/* ---- archive ---- */
.archive-list { display: grid; gap: 10px; }
.archive-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); transition: border-color .15s ease, transform .08s ease; }
.archive-row:hover { border-color: var(--accent); }
.archive-row:active { transform: scale(0.995); }
.archive-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.archive-day { display: flex; flex-direction: column; gap: 2px; }
.archive-status { font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.archive-status.tone-hot { color: var(--hot); }
.archive-status.tone-cold { color: var(--cold); }

/* ---- footer ---- */
.app-footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 14px; border-top: 1px solid var(--line); }

/* ---- responsive ---- */
@media (max-width: 820px) {
  .results-top { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .mode-tiles { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .reveal-stats { grid-template-columns: 1fr; }
  .topbar-nav { width: 100%; margin-left: 0; }
}
