/* ============================================================
   History Daily: paper theme
   Themes are token sets; fonts and text size are set from Settings.
   ============================================================ */
:root {
  --font-display: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --font-body: "Lora", "Iowan Old Style", Georgia, serif;
  --font-ui: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --scale: 1;
  --radius: 6px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* Parchment (default): tan paper, walnut ink, Prussian-blue ink for actions, wax-seal red for answers */
:root, [data-theme="parchment"] {
  --bg: #E4D5B7; --paper: #F3E9D4; --paper-2: #ECDFC3; --ink: #2A2118; --muted: #6B5A43; --line: #CBB691;
  --accent: #1F3A5F; --accent-ink: #F6EEDC; --seal: #9A3324; --seal-ink: #F6EEDC;
  --good: #3D6A38; --bad: #9A3324; --ocean: #D3C29F; --land: #F4EBD8; --border-map: #A88F66; --grat: rgba(90,68,40,.16);
  --mount: #FBF6EA; --corner: #2A2118; --shadow: 0 1px 0 rgba(60,40,10,.08), 0 10px 26px -18px rgba(60,40,10,.55);
  --photo: #1F3A5F; --photo-bg: #DCE3EA; --artifact: #8A6414; --artifact-bg: #F1E2B8; --case: #EEE7DA;
  --grain-opacity: .55; color-scheme: light;
}
[data-theme="newsprint"] {
  --bg: #DEDCD6; --paper: #F4F3EF; --paper-2: #E9E7E1; --ink: #151515; --muted: #595855; --line: #C4C1B9;
  --accent: #151515; --accent-ink: #F4F3EF; --seal: #B3261E; --seal-ink: #FFFFFF;
  --good: #2D6A3E; --bad: #B3261E; --ocean: #CFCDC6; --land: #F7F6F2; --border-map: #97948C; --grat: rgba(0,0,0,.1);
  --mount: #FFFFFF; --corner: #151515; --shadow: 0 1px 0 rgba(0,0,0,.06), 0 10px 24px -18px rgba(0,0,0,.5);
  --photo: #151515; --photo-bg: #E4E3DF; --artifact: #7A5A12; --artifact-bg: #EFE4C6; --case: #F2F1ED;
  --grain-opacity: .35; color-scheme: light;
}
[data-theme="midnight"] {
  --bg: #13100C; --paper: #1D1913; --paper-2: #252018; --ink: #EEE4CF; --muted: #A8997E; --line: #3B3226;
  --accent: #D8B26A; --accent-ink: #1A150E; --seal: #D2745E; --seal-ink: #1A150E;
  --good: #8CC084; --bad: #E08A76; --ocean: #18222A; --land: #2B251B; --border-map: #5A4D3B; --grat: rgba(216,178,106,.12);
  --mount: #E9E0CC; --corner: #13100C; --shadow: 0 1px 0 rgba(0,0,0,.4), 0 14px 30px -18px rgba(0,0,0,.9);
  --photo: #9DBBD8; --photo-bg: #1E2A35; --artifact: #E2B659; --artifact-bg: #33291A; --case: #2A241B;
  --grain-opacity: .3; color-scheme: dark;
}
[data-theme="clear"] {
  --bg: #FFFFFF; --paper: #FFFFFF; --paper-2: #F2F4F7; --ink: #000000; --muted: #333A40; --line: #7C858D;
  --accent: #0B4FA8; --accent-ink: #FFFFFF; --seal: #B00020; --seal-ink: #FFFFFF;
  --good: #146B2E; --bad: #B00020; --ocean: #D6E6F2; --land: #FFFFFF; --border-map: #5E6B76; --grat: rgba(0,0,0,.12);
  --mount: #FFFFFF; --corner: #000000; --shadow: 0 0 0 1px #7C858D;
  --photo: #0B4FA8; --photo-bg: #E3EDF9; --artifact: #7A4E00; --artifact-bg: #FBEFD5; --case: #F6F6F6;
  --grain-opacity: 0; color-scheme: light;
}

/* One chart color per paper style, checked for lightness, saturation and 3:1 contrast against the paper */
:root, [data-theme="parchment"] { --chart: #2E66A8; }
[data-theme="newsprint"] { --chart: #2E66A8; }
[data-theme="midnight"] { --chart: #B08A3A; }
[data-theme="clear"] { --chart: #0B4FA8; }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); font-size: calc(16px * var(--scale)); -webkit-text-size-adjust: 100%; scroll-padding-top: var(--safe-t); scroll-padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.55 var(--font-body); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-top: var(--safe-t);
}
[data-theme="parchment"] body, :root:not([data-theme]) body {
  background: radial-gradient(120% 90% at 50% 0%, #EADCC0 0%, var(--bg) 55%, #D8C6A3 100%) fixed;
}
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 60; mix-blend-mode: multiply; opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .36  0 0 0 0 .27  0 0 0 0 .14  0 0 0 .5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
[data-theme="midnight"] .grain { mix-blend-mode: screen; }
[data-grain="off"] .grain { display: none; }
[data-grain="rich"] .grain { opacity: calc(var(--grain-opacity) * 1.7); }

a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--seal); outline-offset: 2px; border-radius: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- layout ---------------- */
.app { max-width: 640px; margin: 0 auto; padding: 0 18px calc(var(--tabbar-h) + var(--safe-b) + 28px); }
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 0 12px; border-bottom: 3px double var(--line); margin-bottom: 22px;
}
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.wordmark svg { width: 34px; height: 34px; flex: none; }
.wordmark span { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; line-height: 1; }
.wordmark svg.cancel { width: 30px; height: 14px; margin-left: -4px; fill: none; stroke: var(--seal); stroke-width: 1.6; stroke-linecap: round; opacity: .7; }
.mast-meta { display: flex; align-items: center; gap: 8px; }
.streak { display: inline-flex; align-items: center; gap: 5px; font: 600 .9rem/1 var(--font-ui); color: var(--muted); padding: 7px 12px 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-variant-numeric: tabular-nums; white-space: nowrap; }
.streak span { font-size: 1rem; line-height: 1; }
.streak b { font-weight: 700; color: var(--ink); }
/* Small phones: give the streak and Plus chips room next to the wordmark */
@media (max-width: 400px) {
  .mast-meta { gap: 10px; }
  .wordmark span { font-size: 1.4rem; }
  .wordmark svg.cancel { display: none; }
  .plus-chip { padding: 8px 10px; }
}
.plus-chip { font: 700 .85rem/1 var(--font-ui); padding: 8px 12px; border-radius: 999px; border: 1.5px solid var(--seal); color: var(--seal); background: transparent; cursor: pointer; }
.plus-chip.on { background: var(--seal); color: var(--seal-ink); }
main:focus { outline: none; }

/* ---------------- type ---------------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.012em; line-height: 1.12; margin: 0 0 12px; }
h1 { font-size: clamp(2.3rem, 9vw, 3.4rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
.issue { font: 600 .92rem/1.3 var(--font-display); font-variant-caps: all-small-caps; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.dek { font-family: var(--font-display); font-style: italic; font-size: 1.2rem; line-height: 1.45; color: var(--muted); margin: 0 0 18px; }
.meta { font: 400 .85rem/1.4 var(--font-ui); color: var(--muted); margin: 0; }
.kicker { font: 600 .85rem/1.3 var(--font-ui); color: var(--muted); margin: 0 0 6px; }
.fleuron { text-align: center; color: var(--line); font-size: 1.3rem; margin: 26px 0 18px; letter-spacing: .6em; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* ---------------- surfaces ---------------- */
.sheet-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.sheet-card + .sheet-card { margin-top: 14px; }
.stack > * + * { margin-top: 14px; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 20px;
  border-radius: 8px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font: 700 1rem/1.2 var(--font-ui); text-decoration: none; cursor: pointer; transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.seal { background: var(--seal); border-color: var(--seal); color: var(--seal-ink); }
.btn.small { min-height: 38px; padding: 8px 14px; font-size: .9rem; white-space: nowrap; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn-row .btn { flex: 1 1 160px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }

/* ---------------- today ---------------- */
.hero { text-align: left; }
.hero h1 { margin-bottom: 8px; }
.plan { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--line); counter-reset: s; }
.plan li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr auto; align-items: baseline; gap: 4px 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.plan li::before { content: counter(s); font: 700 1.3rem/1 var(--font-display); color: var(--seal); }
.plan b { font: 600 1rem/1.3 var(--font-ui); }
.plan small { font: 400 .85rem/1.3 var(--font-ui); color: var(--muted); }
.plan .x2 { font: 700 .75rem/1 var(--font-ui); color: var(--seal); border: 1px solid var(--seal); padding: 3px 6px; border-radius: 4px; }
.countdown { font: 600 .9rem/1.3 var(--font-ui); color: var(--muted); margin-top: 14px; font-variant-numeric: tabular-nums; }
.mini-board { list-style: none; margin: 0; padding: 0; }
.mini-board li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dotted var(--line); font: 400 .95rem/1.3 var(--font-ui); font-variant-numeric: tabular-nums; }
.mini-board li:last-child { border-bottom: 0; }

/* ---------------- play header ---------------- */
.play-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.play-head .score { text-align: right; font: 600 .8rem/1.2 var(--font-ui); color: var(--muted); }
.play-head .score b { display: block; font: 700 1.5rem/1.1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.progress { display: grid; gap: 6px; margin: 0 0 20px; }
.progress i { height: 6px; border-radius: 3px; background: var(--line); }
.progress i.done { background: var(--accent); }
.progress i.now { background: var(--muted); }

/* ---------------- photo print with album corners ---------------- */
.print { position: relative; margin: 0 0 6px; padding: 12px 12px 10px; background: var(--mount); box-shadow: var(--shadow); border-radius: 2px; transform: rotate(-.4deg); }
.print .ph { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #b9ad96; cursor: zoom-in; }
.print img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s ease; }
.print img.ready { opacity: 1; }
.print .ph.loading::after {
  z-index: 1;
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.35) 50%, transparent 80%) #b9ad96; background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.print .c { position: absolute; z-index: 2; width: 24px; height: 24px; background: linear-gradient(135deg, var(--corner) 0 50%, transparent 50%); opacity: .88; pointer-events: none; }
.print .c.tl { top: 0; left: 0; }
.print .c.tr { top: 0; right: 0; transform: rotate(90deg); }
.print .c.br { bottom: 0; right: 0; transform: rotate(180deg); }
.print .c.bl { bottom: 0; left: 0; transform: rotate(270deg); }
.print figcaption { font: italic 400 .8rem/1.3 var(--font-display); color: #5c5242; padding-top: 8px; display: flex; justify-content: space-between; gap: 10px; }
.print figcaption .zoomhint { font-style: normal; font-family: var(--font-ui); white-space: nowrap; }

/* ---------------- map ---------------- */
.map { position: relative; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--ocean); border: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: inset 0 0 40px rgba(60,40,10,.12); }
@media (min-width: 560px) { .map { aspect-ratio: 16 / 9; } }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.map.dragging svg { cursor: grabbing; }
.map.locked svg { cursor: grab; }
.map .grat { fill: none; stroke: var(--grat); stroke-width: .8px; vector-effect: non-scaling-stroke; }
.map .land { fill: var(--land); stroke: var(--border-map); stroke-width: .9px; vector-effect: non-scaling-stroke; }
.map .borders { fill: none; stroke: var(--border-map); stroke-width: .5px; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; opacity: .8; }
.map .link { stroke: var(--seal); stroke-width: 2px; stroke-dasharray: 6 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.map .pin .dot { stroke: var(--paper); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.map .pin .halo { opacity: .22; }
.map .pin.guess .dot, .map .pin.guess .halo { fill: var(--accent); }
.map .pin.actual .dot, .map .pin.actual .halo { fill: var(--seal); }
.map .pin.drop .dot { animation: pinDrop .28s cubic-bezier(.2,1.6,.4,1); transform-box: fill-box; transform-origin: center; }
@keyframes pinDrop { from { transform: scale(.2); } to { transform: scale(1); } }
.map .zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.map .zoom button { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 700 1.25rem/1 var(--font-ui); cursor: pointer; box-shadow: var(--shadow); }
.map .crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border: 1.5px solid var(--seal); border-radius: 50%; opacity: 0; pointer-events: none; }
.map svg:focus-visible + .zoom + .crosshair { opacity: .9; }
.maphint { font: 400 .82rem/1.35 var(--font-ui); color: var(--muted); margin: 7px 0 0; min-height: 1.3em; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---------------- year ---------------- */
.year { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-top: 18px; }
.year input[type=number] {
  width: 100%; text-align: center; font: 700 2.3rem/1.1 var(--font-display); font-variant-numeric: tabular-nums;
  background: transparent; border: 0; border-bottom: 2px solid var(--line); padding: 2px 0; color: var(--ink); -moz-appearance: textfield;
}
.year input::-webkit-outer-spin-button, .year input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step { width: 50px; height: 50px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 700 1.4rem/1 var(--font-ui); cursor: pointer; }
.step:disabled { opacity: .4; cursor: default; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 32px; margin: 10px 0 0; }
.range-ends { display: flex; justify-content: space-between; font: 400 .78rem/1 var(--font-ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.section-label { font: 700 1.05rem/1.2 var(--font-display); margin: 24px 0 10px; }

/* ---------------- choices & order ---------------- */
.prompt { font-family: var(--font-display); font-size: 1.55rem; line-height: 1.25; margin: 0 0 16px; }
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; min-height: 56px;
  border-radius: 8px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  font: 500 1.02rem/1.35 var(--font-ui); cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:disabled { cursor: default; }
.choice .badge { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font: 700 .95rem/1 var(--font-display); color: var(--muted); font-variant-numeric: tabular-nums; }
.choice.picked .badge { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.choice.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--paper)); }
.choice.right .badge { border-color: var(--good); color: var(--good); }
.choice.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--paper)); }
.choice .when { margin-left: auto; padding-left: 8px; font: 600 .85rem/1.2 var(--font-ui); color: var(--muted); white-space: nowrap; }

/* ---------------- reveal ---------------- */
.tally { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; margin: 20px 0 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font: 400 .98rem/1.35 var(--font-ui); font-variant-numeric: tabular-nums; }
.tally dt { color: var(--muted); }
.tally dd { margin: 0; text-align: right; font-weight: 700; }
.tally .sum { color: var(--ink); font-size: 1.12rem; font-weight: 700; }
.story { margin-top: 18px; }
.story h3 { font-size: 1.45rem; margin: 0 0 2px; }
.story .dateline { font: italic 400 .95rem/1.3 var(--font-display); color: var(--muted); margin: 0 0 10px; }
.story p.body { font-size: 1.1rem; line-height: 1.65; margin: 0; }
.story p.body::first-letter { float: left; font: 700 3.3em/.8 var(--font-display); padding: 6px 8px 0 0; color: var(--seal); }
.credit { font: 400 .78rem/1.4 var(--font-ui); color: var(--muted); margin: 14px 0 0; padding-left: 10px; border-left: 2px solid var(--line); }
.truth { margin: 10px 0 16px; padding-left: 1.4em; }
.truth li { padding: 4px 0; }
.truth b { display: block; font: 600 .82rem/1.2 var(--font-ui); color: var(--muted); }

/* ---------------- ad gate ---------------- */
.ad-gate { text-align: center; }
.ad-box { position: relative; margin: 14px 0 18px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #22303f; color: #F4EEE2; text-align: left; padding: 22px 20px 20px; min-height: 190px; }
.ad-box .tag { position: absolute; top: 10px; right: 12px; font: 700 .7rem/1 var(--font-ui); background: rgba(255,255,255,.18); padding: 4px 7px; border-radius: 4px; }
.ad-box h3 { font-family: "DM Serif Display", Georgia, serif; font-size: 1.7rem; margin: 18px 0 6px; color: #fff; }
.ad-box p { margin: 0; font: 400 .95rem/1.4 var(--font-ui); opacity: .85; max-width: 30ch; }
.ad-box .fake-cta { display: inline-block; margin-top: 14px; font: 700 .85rem/1 var(--font-ui); background: #F4B942; color: #22303f; padding: 10px 14px; border-radius: 6px; }
.ad-box .map-ghost { position: absolute; right: -30px; bottom: -40px; width: 200px; opacity: .25; }
.timer { display: inline-flex; align-items: center; gap: 10px; font: 600 .95rem/1 var(--font-ui); color: var(--muted); }
.timer svg { width: 30px; height: 30px; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 3; }
.timer .track { stroke: var(--line); }
.timer .bar { stroke: var(--seal); stroke-dasharray: 88; stroke-dashoffset: 0; }
.upsell { text-align: left; }
.upsell h3 { margin-bottom: 4px; }
.upsell ul { margin: 10px 0 0; padding-left: 1.2em; font: 400 .95rem/1.5 var(--font-ui); }

/* ---------------- results ---------------- */
.total { font: 700 clamp(3.2rem, 15vw, 4.8rem)/1 var(--font-display); font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.total small { font-size: .36em; color: var(--muted); font-weight: 400; }
.standing { font: 600 1rem/1.4 var(--font-ui); margin: 0 0 16px; }
.breakdown { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.breakdown li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); font: 400 .98rem/1.3 var(--font-ui); font-variant-numeric: tabular-nums; }
.breakdown li { display: block; padding: 0; }
.breakdown li > a { display: grid; grid-template-columns: 26px 1fr auto 14px; gap: 10px; align-items: baseline; padding: 11px 0; color: var(--ink); text-decoration: none; }
.breakdown li > a:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.breakdown .chev { color: var(--muted); font-size: 1.2rem; line-height: 1; }
.breakdown .ic { text-align: center; }
.breakdown span.lbl { color: var(--muted); }
.share { font: 400 1.02rem/1.7 var(--font-ui); background: var(--paper-2); border: 1px dashed var(--line); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; margin: 0; }

/* ---------------- leaderboard ---------------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 16px; background: var(--paper); }
.seg button { border: 0; background: transparent; padding: 11px 6px; font: 600 .95rem/1 var(--font-ui); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.board { list-style: none; margin: 0; padding: 0; }
.board li { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); font: 400 1rem/1.3 var(--font-ui); font-variant-numeric: tabular-nums; }
.board .rk { font: 700 1.2rem/1 var(--font-display); color: var(--muted); text-align: center; }
.board li:nth-child(1) .rk { color: #B8860B; }
.board li:nth-child(2) .rk { color: #8A8F94; }
.board li:nth-child(3) .rk { color: #A0612B; }
.board li.you { background: color-mix(in srgb, var(--accent) 10%, var(--paper)); border-left: 4px solid var(--accent); border-radius: 4px; }
.board .sc { font-weight: 700; }
.board .sub { display: block; font-size: .8rem; color: var(--muted); }
.me-line { margin-top: 12px; font: 600 .95rem/1.4 var(--font-ui); }

/* ---------------- packs ---------------- */
.pack { display: grid; gap: 6px; }
.pack .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.chip { font: 700 .72rem/1 var(--font-ui); padding: 5px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.chip.plus { color: var(--seal); }
.chip.soon { color: var(--muted); }
.chip.done { color: var(--good); }

/* ---------------- forms ---------------- */
label.field { display: block; margin: 0 0 14px; }
label.field > span { display: block; font: 600 .9rem/1.3 var(--font-ui); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; padding: 12px 12px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  font: 400 1rem/1.35 var(--font-ui);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.code-input { text-transform: uppercase; letter-spacing: .25em; font: 700 1.3rem/1.2 var(--font-display); text-align: center; }
.join { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.qcard { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--paper-2); margin-bottom: 12px; }
.qcard .qhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.qcard .qhead b { font: 700 1rem/1.2 var(--font-display); }
.opt { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; margin-bottom: 8px; }
.opt input[type=radio] { width: 20px; height: 20px; accent-color: var(--good); }
.bigcode { font: 700 2.4rem/1 var(--font-display); letter-spacing: .18em; text-align: center; padding: 16px; border: 2px dashed var(--seal); color: var(--seal); border-radius: 10px; margin: 12px 0; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.results { border-collapse: collapse; width: 100%; font: 400 .9rem/1.3 var(--font-ui); font-variant-numeric: tabular-nums; }
table.results th, table.results td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.results th:first-child, table.results td:first-child { text-align: left; }
table.results thead th { font-weight: 700; color: var(--muted); }
table.results tfoot td { font-weight: 700; }
.error { color: var(--bad); font: 600 .9rem/1.4 var(--font-ui); margin: 8px 0 0; }

/* ---------------- settings ---------------- */
.group { margin-bottom: 26px; }
.group > h2 { font-size: 1.3rem; margin-bottom: 10px; }
.swatches { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 520px) { .swatches { grid-template-columns: repeat(4, 1fr); } }
.swatch { position: relative; border: 2px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden; background: none; cursor: pointer; text-align: left; }
.swatch[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.swatch .paper { display: block; height: 62px; padding: 10px; }
.swatch .paper i { display: block; height: 6px; border-radius: 3px; margin-bottom: 6px; }
.swatch .name { display: block; padding: 8px 10px; font: 600 .88rem/1.2 var(--font-ui); background: var(--paper); color: var(--ink); border-top: 1px solid var(--line); }
.fontopts { display: grid; gap: 8px; }
.fontopt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; text-align: left; color: var(--ink); }
.fontopt[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fontopt .sample { font-size: 1.35rem; line-height: 1.1; }
.fontopt small { font: 400 .8rem/1.2 var(--font-ui); color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row .lbl { font: 600 .98rem/1.3 var(--font-ui); }
.row .lbl small { display: block; font-weight: 400; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s ease; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--seal); outline-offset: 2px; }
.segsmall { display: inline-grid; grid-auto-flow: column; border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; }
.segsmall button { border: 0; background: var(--paper); padding: 8px 12px; font: 600 .85rem/1 var(--font-ui); cursor: pointer; color: var(--muted); }
.segsmall button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.note { font: 400 .84rem/1.45 var(--font-ui); color: var(--muted); margin: 8px 0 0; }

/* ---------------- tab bar ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); box-shadow: 0 -8px 24px -18px rgba(40,25,5,.5);
}
.tabbar .inner { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar-h); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font: 600 .72rem/1 var(--font-ui); position: relative; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar a[aria-current="page"]::after { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }

/* ---------------- dialogs & toast ---------------- */
dialog.sheet {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--paper); color: var(--ink);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 30px 60px -20px rgba(0,0,0,.6);
}
dialog.sheet::backdrop { background: rgba(20,14,6,.55); }
.sheet-body { padding: 22px 20px 20px; overflow-y: auto; max-height: calc(100vh - 60px); }
.plans { display: grid; gap: 10px; margin: 14px 0; }
.plan-opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--paper); text-align: left; color: var(--ink); }
.plan-opt[aria-checked="true"] { border-color: var(--seal); box-shadow: 0 0 0 1px var(--seal); }
.plan-opt b { font: 700 1.05rem/1.2 var(--font-ui); }
.plan-opt small { display: block; font: 400 .82rem/1.3 var(--font-ui); color: var(--muted); }
.plan-opt .price { font: 700 1.2rem/1 var(--font-display); white-space: nowrap; }
.perks { margin: 10px 0 0; padding: 0; list-style: none; font: 400 .98rem/1.45 var(--font-ui); }
.perks li { padding: 6px 0 6px 28px; position: relative; }
.perks li::before { content: "\2713"; position: absolute; left: 4px; color: var(--good); font-weight: 700; }
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
dialog.lightbox::backdrop { background: rgba(10,8,4,.92); }
dialog.lightbox img { width: 100%; height: 100%; object-fit: contain; display: block; }
dialog.lightbox button { position: fixed; top: calc(12px + var(--safe-t)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font: 700 1.3rem/1 var(--font-ui); cursor: pointer; color: #111; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 10px; font: 600 .92rem/1.3 var(--font-ui);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.6); transition: opacity .2s ease, transform .2s ease; z-index: 80; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- motion ---------------- */
.fade-in { animation: fadeIn .35s ease both; }
/* While a screen waits for the server: the Pastmark seal, its dashed ring turning, alone in the middle of the page.
   It only shows once the screen has been loading for a second (app.js adds .loading-slow to #view);
   until then the last screen, or this one's heading, stays up. The game's Reduce motion setting is on by default,
   so the ring keeps turning under it and a slow load never looks frozen; the phone's own Reduce Motion holds it still. */
.loading-screen { display: grid; place-items: center; min-height: 52vh; min-height: calc(100svh - 200px); text-align: center; }
.loading-screen.in-page { min-height: 30vh; }
.loading-mark { display: block; width: 64px; height: 64px; visibility: hidden; }
#view.loading-slow .loading-mark { visibility: visible; animation: loadingIn .3s ease both; }
.loading-mark .seal-ring { transform-box: fill-box; transform-origin: center; }
#view.loading-slow .loading-mark .seal-ring { animation: markSpin 5s linear infinite; }
@keyframes loadingIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes markSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #view.loading-slow .loading-mark, #view.loading-slow .loading-mark .seal-ring { animation: none !important; } }
#view.loading-slow:has(.loading-screen:not(.in-page)) > :not(.loading-screen):not(:has(.loading-screen)) { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
[data-motion="reduced"] *, [data-motion="reduced"] *::before, [data-motion="reduced"] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: no-preference) { [data-motion="reduced"] #view.loading-slow .loading-mark .seal-ring { animation: markSpin 5s linear infinite !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ============================================================
   Round types: photograph (camera) vs artifact (crown)
   ============================================================ */
.round-type {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; margin: 0 0 12px;
  border-radius: 12px; border: 1.5px solid currentColor; width: fit-content; max-width: 100%;
}
.round-type.t-photo { color: var(--photo); background: var(--photo-bg); }
.round-type.t-artifact { color: var(--artifact); background: var(--artifact-bg); }
.round-type .rt-icon { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: currentColor; }
.round-type .rt-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--paper); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.round-type .rt-text b { display: block; font: 700 1.2rem/1.1 var(--font-display); letter-spacing: .01em; }
.round-type .rt-text small { display: block; font: 600 .82rem/1.3 var(--font-ui); color: var(--ink); opacity: .75; margin-top: 2px; }
.round-type .x2 { margin-left: 6px; font: 700 .75rem/1 var(--font-ui); border: 1px solid currentColor; padding: 4px 7px; border-radius: 4px; white-space: nowrap; }

.plan .pic { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; margin-right: 8px; vertical-align: -6px; }
.plan .pic.t-photo { background: var(--photo); }
.plan .pic.t-artifact { background: var(--artifact); }
.plan .pic svg { width: 15px; height: 15px; fill: none; stroke: var(--paper); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Museum case for objects: no crop, spotlight, brass plaque (photos keep the album print) */
.museum { position: relative; margin: 0 0 6px; padding: 14px; background: var(--case); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.museum::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--artifact); opacity: .45; border-radius: 2px; pointer-events: none; }
.museum .case {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden; cursor: zoom-in; border-radius: 2px;
  background: radial-gradient(70% 60% at 50% 35%, #FFFFFF 0%, #E9E4DA 70%, #D6CFC2 100%);
}
[data-theme="midnight"] .museum .case { background: radial-gradient(70% 60% at 50% 35%, #F4EFE6 0%, #D8D1C4 70%, #BDB5A6 100%); }
.museum img { display: block; width: 100%; height: 100%; object-fit: contain; padding: 10px; opacity: 0; transition: opacity .5s ease; mix-blend-mode: multiply; }
.museum img.ready { opacity: 1; }
.museum .case.loading::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.5) 50%, transparent 80%) #E6E0D4; background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.museum figcaption { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 10px; }
.plaque {
  font: 600 .8rem/1.2 var(--font-display); letter-spacing: .04em; color: #3B2A07;
  background: linear-gradient(180deg, #E8CF8A, #C9A34E); border: 1px solid #8A6414; border-radius: 3px; padding: 5px 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.museum .zoomhint { font: 400 .8rem/1 var(--font-ui); color: var(--muted); white-space: nowrap; }
.step { min-width: 44px; width: auto; padding: 0 6px; }

/* ============================================================
   Beta: welcome, install hint, feedback, player code
   ============================================================ */
.welcome h1 { margin-top: 4px; }
.welcome details summary { cursor: pointer; list-style: none; font: 600 .95rem/1.3 var(--font-ui); }
.install { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; border-color: var(--accent); }
.install > div > b:first-child { font-family: var(--font-display); font-size: 1.15rem; }
.install .meta b { font-family: var(--font-ui); }
.install .meta { margin-top: 6px; }
.share-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; vertical-align: -5px; border-radius: 5px; background: var(--paper-2); border: 1px solid var(--line); }
.share-ic svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feedback { margin-top: 26px; border-style: dashed; }
.faces { display: flex; gap: 8px; justify-content: space-between; }
.faces button { flex: 1; font-size: 1.7rem; line-height: 1; padding: 10px 0; border-radius: 10px; border: 1.5px solid var(--line); background: var(--paper); cursor: pointer; filter: grayscale(.6); transition: transform .1s ease, filter .1s ease; }
.faces button[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--paper)); filter: none; transform: scale(1.06); }
.pcode { font: 700 1.2rem/1 var(--font-display); letter-spacing: .12em; color: var(--seal); white-space: nowrap; }
.tabbar a[hidden] { display: none; }

/* Home-screen app: the status bar floats over the page, so darken the strip behind it a little */
@media (display-mode: standalone) {
  body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); z-index: 70;
    background: linear-gradient(rgba(30,20,8,.55), rgba(30,20,8,.35)); pointer-events: none; }
  [data-theme="midnight"] body::before { background: rgba(0,0,0,.35); }
}
/* No accidental double-tap zoom on buttons */
button, .btn, .choice, .step, .tabbar a { touch-action: manipulation; }

/* ============================================================
   Archive and stats
   ============================================================ */
a.streak { text-decoration: none; }
a.streak:hover { border-color: var(--accent); color: var(--ink); }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.month { font-size: 1.2rem; margin: 22px 0 6px; }
.arc { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.arc li { border-bottom: 1px solid var(--line); }
.arc li > a, .arc li > button, .arc li > div {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 12px 4px;
  text-decoration: none; color: var(--ink); background: none; border: 0; text-align: left; font: inherit; cursor: pointer;
}
.arc li > div { cursor: default; }
.arc li > a:hover, .arc li > button:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.arc .no { font: 700 1.1rem/1 var(--font-display); color: var(--seal); text-align: center; font-variant-numeric: tabular-nums; }
.arc .no.small { font: 700 .7rem/1.1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.arc .ic { font-size: 1.2rem; text-align: center; }
.arc .ttl { min-width: 0; }
.arc .ttl b { display: block; font: 600 1rem/1.25 var(--font-ui); }
.arc .ttl small { display: block; font: 400 .82rem/1.3 var(--font-ui); color: var(--muted); margin-top: 2px; }
.arc .res { font: 700 1rem/1 var(--font-ui); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.arc .res small { display: block; font: 400 .75rem/1.2 var(--font-ui); color: var(--muted); margin-top: 3px; }
.chip.go { color: var(--accent); }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 4px 0 16px; }
@media (min-width: 560px) { .kpis { grid-template-columns: repeat(4, 1fr); } .kpis.three { grid-template-columns: repeat(3, 1fr); } }
.kpis.three { margin: 12px 0 4px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.sheet-card .kpi { background: var(--paper-2); }
.kpi .v { display: block; font: 600 1.7rem/1.1 var(--font-ui); color: var(--ink); }
.kpi .l { display: block; font: 600 .84rem/1.3 var(--font-ui); color: var(--ink); margin-top: 4px; }
.kpi .s { display: block; font: 400 .78rem/1.3 var(--font-ui); color: var(--muted); margin-top: 2px; }
.chart { position: relative; margin-top: 10px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { font: 400 11px var(--font-ui); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .val { font: 600 11px var(--font-ui); fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .col { fill: var(--chart); transition: fill .12s ease; }
.chart .col.on { fill: color-mix(in srgb, var(--chart) 70%, var(--paper)); }
.chart .hit { fill: transparent; outline: none; }
.chart .hit:focus-visible { stroke: var(--ink); stroke-width: 1.5; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, -100%); max-width: 230px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px;
  font: 400 .8rem/1.35 var(--font-ui); color: var(--muted);
}
.tip b { display: block; font: 700 1rem/1.2 var(--font-ui); color: var(--ink); }
.tip span { display: block; }
.tableview { margin-top: 12px; }
.tableview summary { cursor: pointer; font: 600 .88rem/1.3 var(--font-ui); color: var(--accent); }
.tableview .table-wrap { margin-top: 8px; }
.bars { width: 100%; border-collapse: collapse; font: 400 .9rem/1.3 var(--font-ui); font-variant-numeric: tabular-nums; margin-top: 6px; }
.bars th { text-align: left; font-weight: 400; color: var(--muted); padding: 6px 12px 6px 0; white-space: nowrap; width: 1%; }
.bars td { padding: 6px 0; }
.bars td.n { text-align: right; width: 1%; padding-left: 12px; color: var(--ink); font-weight: 600; }
.bars .bar { display: block; height: 14px; border-radius: 0 4px 4px 0; background: var(--chart); }
.meter { margin-top: 16px; }
.meter .top { display: flex; justify-content: space-between; gap: 10px; font: 600 .95rem/1.3 var(--font-ui); }
.meter .top span + span { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.meter .track { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--chart) 18%, var(--paper)); margin-top: 6px; overflow: hidden; }
.meter .fill { display: block; height: 100%; border-radius: 4px; background: var(--chart); }

/* Before joining the beta, only the welcome form shows */
body.gated .mast-meta, body.gated .tabbar { display: none; }

/* ============================================================
   Photo and map share one stage; the toggle flips between them
   ============================================================ */
.stage-switch { margin: 0 0 10px; }
.stage { position: relative; height: clamp(320px, 58vh, 560px); }
.stage .pane { position: absolute; inset: 0; transition: opacity .15s ease; }
.stage[data-view="image"] .pane-map, .stage[data-view="map"] .pane-image { visibility: hidden; opacity: 0; pointer-events: none; }
.pane-image figure { height: 100%; margin: 0; display: flex; flex-direction: column; transform: none; }
.pane-image .print .ph, .pane-image .museum .case { flex: 1; min-height: 0; aspect-ratio: auto; }
.pane-image .print img { object-fit: contain; background: #2b2722; }
.pane-image .print .ph { background: #2b2722; }
.plaque:empty { display: none; }
.to-map {
  position: absolute; right: 22px; bottom: 50px; z-index: 3; border: 0; border-radius: 999px; padding: 11px 16px;
  background: var(--accent); color: var(--accent-ink); font: 700 .95rem/1 var(--font-ui); box-shadow: 0 6px 18px -6px rgba(0,0,0,.55); cursor: pointer;
}
.pane-map #map { height: 100%; aspect-ratio: auto; }
.peek {
  position: absolute; right: 10px; bottom: 24px; z-index: 1000; width: 88px; height: 70px; padding: 0; border: 2px solid var(--paper);
  border-radius: 8px; overflow: hidden; background: #2b2722; box-shadow: 0 6px 16px -6px rgba(0,0,0,.6); cursor: pointer;
}
.peek img { width: 100%; height: 100%; object-fit: cover; display: block; }
.peek span { position: absolute; left: 0; right: 0; bottom: 0; font: 700 .7rem/1.6 var(--font-ui); color: #fff; background: rgba(0,0,0,.55); text-align: center; }
/* The labeled map (Leaflet) keeps its layers inside the map box, under the tab bar */
.map.lmap { z-index: 0; isolation: isolate; background: var(--ocean); cursor: crosshair; }
.map.lmap.locked { cursor: grab; }
.map.lmap .leaflet-control-zoom a { width: 38px; height: 38px; line-height: 38px; font-size: 1.3rem; }
.map.lmap .leaflet-control-attribution { font: 400 9px/1.4 var(--font-ui); }
.map.lmap svg { position: absolute; inset: auto; left: 0; top: 0; width: auto; height: auto; display: inline; cursor: inherit; }
.tally .howlink { grid-column: 1 / -1; font-size: .85rem; }

/* Reviewing a finished round: the map stays folded away until asked for */
.mapbox { margin-top: 16px; }
.mapbox > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.mapbox > summary::-webkit-details-marker { display: none; }
.mapbox[open] > summary { opacity: .8; }

/* Year slider: thick track that fills up to the thumb, a big thumb, and era marks underneath */
.year .step { height: 52px; font-size: 1.05rem; }
.year input[type=number] { min-width: 0; font-size: 2.4rem; }
input.yslider { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 14px 0 0; background: transparent; touch-action: pan-y; }
input.yslider::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--accent) var(--pct, 50%), var(--line) var(--pct, 50%)); }
input.yslider::-moz-range-track { height: 12px; border-radius: 6px; background: var(--line); }
input.yslider::-moz-range-progress { height: 12px; border-radius: 6px; background: var(--accent); }
input.yslider::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -11px; border-radius: 50%; background: var(--paper); border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.35); cursor: grab; }
input.yslider::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--paper); border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.35); cursor: grab; }
input.yslider:disabled::-webkit-slider-thumb { border-color: var(--line); cursor: default; }
.ymarks { position: relative; height: 18px; margin: 2px 17px 0; font: 600 .76rem/1 var(--font-ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.ymarks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ymarks span::before { content: ""; position: absolute; left: 50%; top: -6px; width: 1px; height: 4px; background: var(--line); }

.preview-banner { position: sticky; top: var(--safe-t); z-index: 60; background: var(--seal); color: var(--seal-ink); font: 700 .8rem/1.3 var(--font-ui); text-align: center; padding: 6px 12px; }
.choice[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--paper)); box-shadow: 0 0 0 1px var(--accent); }

/* ---------------- profile icons and the Settings layout ---------------- */
/* A medallion: lit from the top left, a fine inner ring, and a two-tone engraving */
.avatar {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 32% 26%, color-mix(in srgb, var(--c) 62%, #fff) 0%, var(--c) 48%, color-mix(in srgb, var(--c) 72%, #000) 100%);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.28), inset 0 0 0 3px color-mix(in srgb, var(--c) 80%, #000), 0 2px 6px -2px rgba(0,0,0,.5);
}
.avatar::after { content: ""; position: absolute; inset: 11%; border-radius: 50%; border: 1px solid rgba(255,255,255,.22); pointer-events: none; }
.board .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.profile .ptop { display: flex; align-items: center; gap: 14px; }
.profile .btn-row { margin-top: 14px; }
.flabel { display: block; font: 600 .9rem/1.3 var(--font-ui); margin: 14px 0 8px; }
.iconpick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.iconpick button, .colorpick button { border: 2px solid transparent; background: none; padding: 3px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.colorpick { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.colorpick button { width: 36px; height: 36px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.sgroup { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; }
.sgroup > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; }
.sgroup > summary::-webkit-details-marker { display: none; }
.sgroup > summary b { display: block; font: 700 1.1rem/1.2 var(--font-display); }
.sgroup > summary small { display: block; font: 400 .84rem/1.3 var(--font-ui); color: var(--muted); margin-top: 2px; }
.sgroup > summary .chev { font-size: 1.5rem; color: var(--muted); transition: transform .15s ease; }
.sgroup[open] > summary .chev { transform: rotate(90deg); }
.sgroup .sgbody { padding: 0 16px 16px; }
.sgroup .sgbody h3 { font-size: 1rem; margin: 14px 0 8px; }
.sgroup .feedback { margin-top: 14px; }
.statsme { display: flex; align-items: center; gap: 12px; margin: -4px 0 14px; text-decoration: none; color: var(--ink); }
.statsme b { display: block; font: 700 1rem/1.2 var(--font-ui); }
.statsme small { display: block; font: 400 .8rem/1.2 var(--font-ui); color: var(--accent); }

/* Emoji for round types and emoji profile icons */
.round-type .rt-icon.rt-emoji { background: var(--paper); font-size: 1.6rem; line-height: 1; }
.plan .pic.pic-emoji { width: auto; height: auto; background: none; font-size: 1.15rem; margin-right: 6px; vertical-align: -2px; }
.avatar .aemoji { line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }

/* Tighter round header: a small type pill and a shorter question */
.round-type { gap: 8px; padding: 5px 12px 5px 6px; margin: 0 0 8px; border-radius: 999px; border-width: 1px; }
.round-type .rt-icon, .round-type .rt-icon.rt-emoji { width: 30px; height: 30px; font-size: 1.15rem; background: transparent; }
.round-type .rt-text { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.round-type .rt-text b { font-size: 1rem; }
.round-type .rt-text small { font-size: .78rem; margin-top: 0; }
.round-type .x2 { padding: 3px 6px; font-size: .7rem; }
.prompt { font-size: 1.3rem; margin: 0 0 10px; }
.year .step { width: 52px; height: 52px; font-size: 1.6rem; border-radius: 50%; }

.heatkey { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font: 400 .8rem/1.3 var(--font-ui); color: var(--muted); }
.heatkey i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: 0 0 0 2px var(--paper); }
#accMap { aspect-ratio: 4 / 3; }
.zoomhint { cursor: zoom-in; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }

/* Picked icon and color: a clean accent ring with a little gap, and a small lift */
.iconpick button, .colorpick button { transition: transform .12s ease, box-shadow .12s ease; }
.iconpick button[aria-checked="true"], .colorpick button[aria-checked="true"] {
  border-color: transparent; outline: none; transform: scale(1.06);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--accent), 0 6px 14px -4px rgba(0,0,0,.45);
}
/* Keep every choice a true circle, however wide its grid cell is */
/* Six icons and eight colors per row on any phone: each cell shrinks to fit, and stays a circle */
.iconpick { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.iconpick button { width: 100%; max-width: 52px; height: auto; aspect-ratio: 1; padding: 0; justify-self: center; }
.iconpick button .avatar { width: 100% !important; height: 100% !important; }
.colorpick { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.colorpick button { width: 100%; max-width: 36px; height: auto; aspect-ratio: 1; padding: 0; justify-self: center; }
.gamemap { width: 100%; height: 100%; }
/* "Tap to enlarge" sits on the left under both photos and objects */
.print figcaption, .museum figcaption { justify-content: flex-start; }
.print figcaption .zoomhint, .museum figcaption .zoomhint { order: -1; margin-right: auto; }

/* Random play stands apart from the theme packs below it */
.randomcard { border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--paper)); }
.randomcard h2 { font-size: 1.35rem; white-space: nowrap; }
.packs-head { font-size: 1.25rem; margin: 30px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.kpilink { text-decoration: none; color: inherit; border-color: var(--accent); }
.kpilink .s { color: var(--accent); font-weight: 600; }

/* Leaderboard: your own line and the way into your stats, above the board */
.youcard { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 12px; border: 1.5px solid var(--accent); border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--paper)); color: var(--ink); text-decoration: none; }
.youcard .who { flex: 1; min-width: 0; }
.youcard .who b { display: block; font: 700 1rem/1.2 var(--font-ui); }
.youcard .who small { display: block; font: 400 .85rem/1.3 var(--font-ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.youcard .go { font: 700 .9rem/1 var(--font-ui); color: var(--accent); white-space: nowrap; }
