:root {
  --parchment: #f3e6c8; --parchment-hi: #faf1dc; --parchment-lo: #e6d3a8;
  --ink: #1f2a2a; --sepia: #5a4630; --rule: #8a6f49;
  --teal: #145059; --teal-deep: #0f434c; --teal-line: rgba(243,230,200,.2);
  --oxblood: #7c1a24; --oxblood-deep: #631219;
  --land: #dcc698; --land-edge: #6d5533; --target: #fbf3df;
  --serif: "Iowan Old Style", "New York", ui-serif, Palatino, Georgia, serif;
  --gutter: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  font: 17px/1.5 var(--serif); color: var(--ink);
  background-color: var(--parchment);
  background-image:
    radial-gradient(120% 70% at 50% 0, rgba(250,241,220,.9), transparent 70%),
    radial-gradient(90% 60% at 100% 100%, rgba(160,122,70,.2), transparent 70%),
    radial-gradient(70% 50% at 0 80%, rgba(160,122,70,.14), transparent 70%);
  font-variant-numeric: oldstyle-nums;
}
h1, h2, p, dl, dd, ol, figure, pre { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--oxblood); outline-offset: 2px; }

#site-header {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px var(--gutter) 9px;
  border-bottom: 1px solid var(--ink); box-shadow: 0 3px 0 -2px var(--parchment), 0 3px 0 -1px var(--rule);
}
.mark { width: 36px; height: 36px; display: block; }
#site-title { font-size: 1.45rem; line-height: 1.1; font-weight: 600; letter-spacing: -.005em; color: var(--teal-deep); }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#load-status { padding: 48px var(--gutter); text-align: center; font-style: italic; color: var(--sepia); }

/* Controls */
.primary, .secondary, .teal, .quiet {
  display: block; width: 100%; min-height: 52px; padding: 10px 18px;
  font-size: 1.1rem; font-weight: 600; cursor: pointer; border-radius: 2px;
}
.primary { background: var(--oxblood); color: var(--parchment-hi); border: 1px solid var(--oxblood-deep); box-shadow: inset 0 0 0 2px var(--oxblood), inset 0 0 0 3px rgba(243,230,200,.55); }
.teal { background: var(--teal); color: var(--parchment-hi); border: 1px solid var(--teal-deep); box-shadow: inset 0 0 0 2px var(--teal), inset 0 0 0 3px rgba(243,230,200,.55); }
.secondary { background: transparent; color: var(--teal-deep); border: 1px solid var(--teal-deep); }
.quiet { background: none; border: 0; color: var(--sepia); text-decoration: underline; text-underline-offset: 3px; font-weight: 400; min-height: 44px; font-size: 1rem; }
.primary:disabled { background: var(--parchment-lo); color: #5a4630; border-color: var(--rule); box-shadow: none; cursor: not-allowed; }
@media (hover: hover) {
  .primary:enabled:hover { background: var(--oxblood-deep); box-shadow: inset 0 0 0 2px var(--oxblood-deep), inset 0 0 0 3px rgba(243,230,200,.55); }
  .teal:hover { background: var(--teal-deep); box-shadow: inset 0 0 0 2px var(--teal-deep), inset 0 0 0 3px rgba(243,230,200,.55); }
  .secondary:hover { background: rgba(20,80,89,.09); }
}

/* Home */
#home { flex: 1; display: flex; flex-direction: column; }
.portolan { height: 200px; background: var(--teal); border-bottom: 1px solid var(--ink); overflow: hidden; }
.portolan svg { display: block; width: 100%; height: 100%; }
.rhumb path { stroke: rgba(243,230,200,.2); stroke-width: 1; fill: none; }
.grat circle { fill: none; stroke: rgba(243,230,200,.14); }
.voyage { fill: none; stroke: #d98b7c; stroke-width: 2; stroke-dasharray: 9 6; }
.rose circle { fill: none; stroke: var(--parchment); stroke-width: 1; }
.rose .dark { fill: var(--parchment); }
.rose .light { fill: var(--teal-deep); stroke: var(--parchment); stroke-width: 1; }
.rose .pts-b path { fill: #b9a57c; }
.rose .hub { fill: var(--oxblood); stroke: var(--parchment); stroke-width: 1.5; }
.home-copy { padding: 22px var(--gutter) 28px; max-width: 34rem; width: 100%; margin: 0 auto; }
#intro { font-size: 1.32rem; line-height: 1.36; margin-bottom: 20px; }
.home-actions { display: grid; gap: 10px; }
#home h2 {
  display: flex; align-items: center; gap: 12px; margin: 30px 0 4px;
  font-size: .82rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--sepia);
}
#home h2::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
#stats > div { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px dotted var(--rule); }
#stats dt { color: var(--sepia); }
#stats dd { font-size: 1.2rem; font-weight: 600; color: var(--teal-deep); font-variant-numeric: lining-nums tabular-nums; }

/* Game */
#game { flex: 1; display: flex; flex-direction: column; min-height: calc(100dvh - 58px); }
.log { padding: 9px var(--gutter) 10px; }
.tally { display: flex; justify-content: space-between; gap: 12px; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--sepia); font-variant-numeric: lining-nums; }
#running-score { color: var(--oxblood); font-weight: 600; white-space: nowrap; }
#clue-type { margin-top: 4px; font-style: italic; color: var(--sepia); line-height: 1.25; }
#clue { font-size: 1.42rem; line-height: 1.2; font-weight: 600; color: var(--ink); }

/* The neatline: alternating ink and parchment, as on a printed sheet. */
.chart {
  position: relative; flex: 1; display: flex; min-height: 280px; padding: 6px;
  --tick: repeating-linear-gradient(90deg, var(--ink) 0 34px, var(--parchment-hi) 34px 68px);
  --tickv: repeating-linear-gradient(0deg, var(--ink) 0 34px, var(--parchment-hi) 34px 68px);
  background:
    var(--tick) top / 100% 5px no-repeat, var(--tick) bottom / 100% 5px no-repeat,
    var(--tickv) left / 5px 100% no-repeat, var(--tickv) right / 5px 100% no-repeat,
    var(--ink);
}
.chart::after { content: ""; position: absolute; inset: 6px; pointer-events: none; box-shadow: inset 0 0 44px rgba(6,32,38,.42); }
#game-map-slot, #results-map-slot { flex: 1; min-width: 0; position: relative; }
#map {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair;
  background: repeating-linear-gradient(0deg, rgba(243,230,200,.045) 0 1px, transparent 1px 5px), var(--teal);
}
.map-graticule { stroke: var(--teal-line); stroke-width: .75; }
.map-land { fill: var(--land); stroke: var(--land-edge); stroke-width: .6; }
.map-target { fill: var(--target); stroke: var(--oxblood); stroke-width: 1.4; }
.map-glyph { stroke: var(--parchment-hi); stroke-width: 1.5; paint-order: stroke; stroke-linejoin: round; }
.map-guess .map-glyph { fill: var(--oxblood); transform-origin: 0 0; animation: drop .22s cubic-bezier(.2,1.4,.5,1); }
.map-answer .map-glyph { fill: var(--teal-deep); }
.map-marker text {
  font: 600 15px var(--serif); fill: var(--ink); stroke: var(--parchment-hi); stroke-width: 3.5px;
  paint-order: stroke; stroke-linejoin: round; pointer-events: none;
}
.map-line { stroke: var(--oxblood); stroke-width: 2; stroke-dasharray: 7 5; }
@keyframes drop { from { transform: translateY(-14px) scale(.8); opacity: 0; } }

#map-controls { position: absolute; top: 16px; right: 16px; z-index: 2; display: flex; flex-direction: column; background: var(--parchment-hi); border: 1px solid var(--ink); border-radius: 2px; box-shadow: 0 1px 4px rgba(6,32,38,.4); }
#map-controls button { width: 46px; height: 46px; border: 0; background: none; font-size: 1.55rem; line-height: 1; color: var(--ink); cursor: pointer; font-variant-numeric: lining-nums; }
#map-controls button + button { border-top: 1px solid var(--rule); }
@media (hover: hover) { #map-controls button:hover { background: var(--parchment-lo); } }

.helm { padding: 8px var(--gutter) calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 7px; }
#feedback { min-height: 1.5em; text-align: center; font-size: 1.05rem; font-weight: 600; color: var(--oxblood); line-height: 1.3; }
#feedback:empty::before { content: "Tap the map to place your pin"; font-weight: 400; font-style: italic; color: var(--sepia); }
#game:has(#btn-confirm:enabled) #feedback:empty::before { content: "Tap again to move your pin"; }

/* Results */
#results { flex: 1; display: flex; flex-direction: column; }
.res-head { padding: 18px var(--gutter) 14px; text-align: center; }
#results-title { font-size: 1rem; font-weight: 400; font-style: italic; color: var(--sepia); }
#results-score { font-size: 2.7rem; line-height: 1.1; font-weight: 600; color: var(--teal-deep); font-variant-numeric: lining-nums; }
#results .chart { flex: none; height: clamp(250px, 44vh, 420px); }
.res-body { padding: 14px var(--gutter) 24px; max-width: 34rem; width: 100%; margin: 0 auto; }
#results-list { list-style: none; padding: 0; counter-reset: leg; margin-bottom: 18px; }
#results-list li {
  counter-increment: leg; display: grid; grid-template-columns: 1.7rem 1fr auto; column-gap: 8px;
  padding: 8px 0; border-bottom: 1px dotted var(--rule);
}
#results-list li::before { content: counter(leg); grid-row: span 2; font-weight: 600; color: var(--oxblood); font-variant-numeric: lining-nums; }
.r-place { font-weight: 600; grid-column: 2; }
.r-pts { grid-column: 3; grid-row: 1; font-weight: 600; color: var(--teal-deep); text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.r-type { grid-column: 3; grid-row: 2; font-size: .9rem; font-style: italic; color: var(--sepia); text-align: right; }
.r-km { grid-column: 2; grid-row: 2; font-size: .9rem; color: var(--sepia); font-variant-numeric: lining-nums; }
#share-status { min-height: 1.5em; margin-top: 8px; text-align: center; font-style: italic; color: var(--sepia); }
#share-text { white-space: pre-wrap; font: 1rem/1.4 ui-monospace, "American Typewriter", Courier, monospace; padding-top: 8px; }
#share-text:empty { display: none; }

#site-footer { padding: 10px var(--gutter) 16px; border-top: 1px solid var(--rule); font-size: .82rem; line-height: 1.4; color: var(--sepia); text-align: center; }

@media (min-width: 900px) {
  :root { --gutter: 28px; }
  #site-title { font-size: 1.7rem; }
  .mark { width: 44px; height: 44px; }
  #home { flex-direction: row; }
  .portolan { flex: 1 1 58%; height: auto; border-bottom: 0; border-right: 1px solid var(--ink); }
  .home-copy { flex: 0 0 min(460px, 42%); margin: 0; padding: 40px 40px; align-self: center; }
  #intro { font-size: 1.5rem; }
  .home-actions { grid-template-columns: 1fr 1fr; }
  #game { display: grid; grid-template-columns: 330px 1fr; grid-template-rows: 1fr auto; min-height: calc(100dvh - 66px - 58px); }
  .log { grid-column: 1; grid-row: 1; padding: 34px 26px 16px; }
  .chart { grid-column: 2; grid-row: 1 / span 2; }
  .helm { grid-column: 1; grid-row: 2; padding: 16px 26px 28px; }
  #clue { font-size: 2rem; margin-top: 8px; }
  #clue-type { margin-top: 26px; font-size: 1.1rem; }
  #feedback { text-align: left; font-size: 1.2rem; }
  #results { display: grid; grid-template-columns: 1fr 400px; grid-template-rows: auto 1fr; }
  #results .chart { grid-column: 1; grid-row: 1 / span 2; height: auto; min-height: 520px; }
  .res-head { grid-column: 2; padding-top: 30px; }
  .res-body { grid-column: 2; padding: 0 28px 24px; }
}
@media (prefers-reduced-motion: reduce) { :not(.help-frames *), *::before, *::after { animation: none !important; transition: none !important; } }

.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 22px; margin: 0; padding: 0; list-style: none; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--sepia); text-underline-offset: 3px; }
.brand { display: flex; align-items: center; gap: inherit; color: inherit; text-decoration: none; }
.prose ol, .prose ul { margin: .7em 0 0; padding-left: 1.3em; }
.prose li + li { margin-top: .5em; }
.prose { overflow-wrap: break-word; }
.prose h1 { margin: 0; }
.prose h3 { margin: 1.2em 0 0; }
.prose table { width: 100%; margin-top: .8em; border-collapse: collapse; }
.prose th, .prose td { padding: .4em 0; text-align: left; }
.prose th:last-child, .prose td:last-child { text-align: right; }
.play-link a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* Content pages */
.site-note { width: 100%; max-width: 34rem; margin: 0 auto; padding: 20px var(--gutter); text-align: center; color: var(--sepia); }
.site-note a, .prose a { color: var(--teal-deep); text-underline-offset: 3px; }
#site-footer nav { margin-top: 4px; }
.reading { display: block; }
.prose { width: 100%; max-width: 38rem; margin: 0 auto; padding: 28px var(--gutter) 40px; }
.prose h1 { font-size: 2rem; line-height: 1.15; font-weight: 600; color: var(--teal-deep); }
.prose h2 { margin-top: 1.7em; padding-bottom: 4px; border-bottom: 1px solid var(--rule); font-size: 1.28rem; line-height: 1.25; font-weight: 600; color: var(--teal-deep); }
.prose h3 { font-size: 1.05rem; line-height: 1.3; font-weight: 600; color: var(--ink); }
.prose p { margin-top: .8em; }
.prose .lede { font-size: 1.2rem; line-height: 1.4; }
.prose .updated { color: var(--sepia); font-style: italic; }
.prose th, .prose td { border-bottom: 1px dotted var(--rule); font-variant-numeric: lining-nums tabular-nums; }
.prose th { font-weight: 600; color: var(--sepia); }
.play-link { margin-top: 2em; }

/* Challenges, stats and sharing */
#challenge-note { margin: 12px var(--gutter) 0; padding: 8px 12px; border-left: 3px solid var(--rule); color: var(--sepia); }
#challenge-banner { margin: 12px auto 0; width: calc(100% - 2 * var(--gutter)); max-width: 34rem; padding: 12px 14px; display: grid; gap: 6px; text-align: center; background: var(--parchment-hi); border: 1px solid var(--rule); box-shadow: inset 0 0 0 3px var(--parchment-hi), inset 0 0 0 4px var(--rule); }
#challenge-banner h2 { margin: 0; font-size: 1.5rem; line-height: 1.2; color: var(--oxblood); }
#challenge-detail { color: var(--sepia); }
#packs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { min-height: 44px; padding: 4px 12px; background: transparent; border: 1px solid var(--rule); color: var(--teal-deep); font-size: .95rem; cursor: pointer; }
@media (hover: hover) { .chip:hover { background: rgba(20,80,89,.09); } }
#streak-note { color: var(--teal-deep); font-style: italic; }
#streak-note:empty, #results-note:empty, #results-streak:empty, #code-status:empty { display: none; }
#more-stats { margin-top: 12px; border-top: 1px solid var(--rule); padding-top: 6px; }
#more-stats summary { min-height: 44px; display: flex; align-items: center; color: var(--teal-deep); cursor: pointer; }
#more-stats h3 { margin: 12px 0 4px; font-size: 1rem; color: var(--sepia); }
.rows { margin: 0; padding: 0; list-style: none; }
.rows li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dotted var(--rule); }
.fine { font-size: .9rem; color: var(--sepia); margin-top: 4px; }
#recent-bars { display: flex; align-items: flex-end; gap: 2px; height: 48px; }
#recent-bars i { flex: 1; max-width: 14px; background: var(--teal); }
#code-box { width: 100%; font: .85rem/1.3 ui-monospace, monospace; background: var(--parchment-hi); border: 1px solid var(--rule); color: var(--ink); padding: 6px; }
.code-actions { display: flex; flex-wrap: wrap; gap: 4px 16px; }
#results-note { color: var(--ink); }
#results-streak, #countdown-line { color: var(--sepia); }
#vs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 8px; padding: 10px; border: 1px solid var(--rule); background: var(--parchment-hi); text-align: center; }
#vs span { display: block; font-size: 1.5rem; line-height: 1.2; }
#vs small { color: var(--sepia); font-size: .9rem; }
#vs-line { grid-column: 1 / -1; font-style: italic; }
#results-actions { display: grid; gap: 8px; }
#challenge-box { display: grid; gap: 4px; }
#challenge-box label { font-size: .95rem; color: var(--sepia); }
#challenge-name { min-height: 44px; font: inherit; padding: 6px 10px; background: var(--parchment-hi); color: var(--ink); border: 1px solid var(--rule); width: 100%; }
#share-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.share-opt { flex: 1 1 30%; min-height: 44px; display: flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--teal-deep); color: var(--teal-deep); font: inherit; text-decoration: none; cursor: pointer; }
#results-actions { grid-template-columns: 1fr; }

:root { --h-bg:#faf1dc;--h-ink:#1f2a2a;--h-btn:#7c1a24;--h-btn-ink:#faf1dc;--h-radius:2px;--h-font:var(--serif); }
/* First-visit walkthrough. Only transform and opacity animate. */
.help-btn { position: fixed; z-index: 6; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); width: 44px; height: 44px; min-width: 0; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid var(--h-ink); background: var(--h-bg); color: var(--h-ink); font: 600 20px/1 var(--h-font); cursor: pointer; }
.help-card, .help-strip { position: fixed; z-index: 7; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); max-width: 440px; margin: 0 auto; background: var(--h-bg); color: var(--h-ink); border: 1px solid var(--h-ink); border-radius: var(--h-radius); box-shadow: 0 6px 22px rgba(0,0,0,.28); font: 15px/1.35 var(--h-font); }
.help-card { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; align-items: center; padding: 10px; }
.help-card.help-top { top: max(8px, env(safe-area-inset-top)); bottom: auto; right: 60px; }
.help-text { margin: 0; font: 15px/1.35 var(--h-font); color: var(--h-ink); }
.help-row { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.help-ok { flex: 1; min-height: 44px; min-width: 0; width: auto; padding: 0 18px; border: 1px solid var(--h-btn); border-radius: var(--h-radius); background: var(--h-btn); color: var(--h-btn-ink); font: 600 16px/1.2 var(--h-font); cursor: pointer; }
.help-link { min-height: 44px; min-width: 44px; width: auto; padding: 0 8px; border: 0; background: none; color: var(--h-ink); font: 15px/1.2 var(--h-font); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.help-link:hover, .help-ok:hover { background: none; color: var(--h-ink); }
.help-ok:hover { background: var(--h-btn); color: var(--h-btn-ink); }
.help-strip { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 0 8px; }
.help-x { width: 44px; height: 44px; min-width: 0; padding: 0; border: 0; background: none; color: var(--h-ink); font-size: 22px; cursor: pointer; }
.help-demo { --s: 1; --freeze: 0s; --d: 5s; position: relative; width: calc(130px * var(--s)); height: calc(110px * var(--s)); overflow: hidden; border-radius: var(--h-radius); }
.help-frame { position: absolute; left: 0; top: 0; width: 130px; height: 110px; transform: scale(var(--s)); transform-origin: 0 0; }
.help-frame svg { display: block; width: 130px; height: 110px; }
.help-frame svg * { transform-box: fill-box; transform-origin: center; }
.help-tick { position: absolute; width: 0; height: 0; animation: help-tick var(--d) linear var(--loops) both; }
.help-paused * { animation-play-state: paused !important; }
.help-frames { --s: .5; width: 130px; height: 55px; }
.help-frames .help-frame:nth-child(2) { left: 65px; }
.help-frames * { animation-delay: var(--freeze) !important; animation-play-state: paused !important; animation-iteration-count: 1 !important; }
.help-dialog { width: min(92vw, 420px); max-height: 92dvh; overflow: auto; padding: 18px; border: 1px solid var(--h-ink); border-radius: var(--h-radius); background: var(--h-bg); color: var(--h-ink); }
.help-dialog::backdrop { background: rgba(0,0,0,.5); }
.help-dialog .help-demo { --s: 1.8; margin: 0 auto; }
.help-dialog .help-frames { --s: .9; width: 234px; height: 99px; }
.help-dialog .help-frames .help-frame:nth-child(2) { left: 117px; }
.help-title { margin: 0 0 10px; font: 600 21px/1.2 var(--h-font); color: var(--h-ink); }
.help-title:focus { outline: none; }
.help-dialog > .help-link { display: block; margin: 0 auto; }
.help-dialog > .help-text { margin-top: 8px; }
.help-legend { list-style: none; margin: 12px 0 0; padding: 0; font: 15px/1.3 var(--h-font); }
.help-legend li { display: flex; align-items: center; gap: 10px; padding: 3px 0; border: 0; }
.help-swatch { flex: none; width: 36px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.help-swatch svg { width: 24px; height: 24px; }
.help-more { display: inline-flex; align-items: center; min-height: 44px; font: 15px/1.2 var(--h-font); color: var(--h-ink); }
.help-dialog .help-ok { display: block; width: 100%; margin-top: 6px; }
.help-how { display: block; margin: 0 auto; min-height: 44px; padding: 0 8px; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.help-rule { margin: 4px 0 0; }
@media (min-width: 900px) { .help-card, .help-strip { left: auto; right: 16px; width: 400px; } .help-card.help-top { right: 60px; } }
@media (prefers-reduced-motion: no-preference) { .help-pulse { animation: help-pulse 1.1s ease-in-out 1; } }
@keyframes help-tick { from, to { opacity: 0; } }
@keyframes help-pulse { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.025); } }
.gd-pin { animation: gd-pin var(--d) linear var(--loops) both; }
.gd-off { animation: gd-off var(--d) linear var(--loops) both; }
.gd-on { animation: gd-on var(--d) linear var(--loops) both; }
.gd-tap { animation: gd-tap var(--d) linear var(--loops) both; }
.gd-line { animation: gd-line var(--d) linear var(--loops) both; }
.gd-ans { animation: gd-line var(--d) linear var(--loops) both; }
.gd-p1 { animation: gd-p1 var(--d) linear var(--loops) both; }
.gd-p2 { animation: gd-p2 var(--d) linear var(--loops) both; }
@keyframes gd-pin { 0%, 10% { opacity: 0; transform: translateY(-40px); } 20%, 100% { opacity: 1; transform: none; } }
@keyframes gd-off { 0%, 25% { opacity: 1; } 32%, 100% { opacity: 0; } }
@keyframes gd-on { 0%, 25% { opacity: 0; } 32%, 100% { opacity: 1; } }
@keyframes gd-tap { 0%, 40% { opacity: 0; } 46% { opacity: .55; } 54%, 100% { opacity: 0; } }
@keyframes gd-line { 0%, 54% { opacity: 0; } 64%, 100% { opacity: 1; } }
@keyframes gd-p1 { 0%, 66% { opacity: 0; } 72%, 80% { opacity: 1; } 84%, 100% { opacity: 0; } }
@keyframes gd-p2 { 0%, 80% { opacity: 0; } 86%, 100% { opacity: 1; } }
@media (max-width: 560px) { #site-header { justify-content: flex-start; padding-right: 60px; } }

/* Keep the note and footer below the fold until the first screen renders (CLS). */
#load-status:not([hidden]) { min-height: 100svh; }

/* Leaderboard */
.lb { margin: 14px 0 18px; padding: 10px 12px 12px; border: 1px solid var(--rule); background: var(--parchment-hi); border-radius: 2px; }
.lb h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--teal-deep); }
.lb-tabs { display: flex; gap: 12px; margin-bottom: 8px; }
.lb-tab { background: none; border: 0; padding: 8px 2px; min-height: 44px; color: var(--sepia); cursor: pointer; font-size: 1rem; }
.lb-tab[data-on] { color: var(--teal-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.lb-line { margin-bottom: 6px; color: var(--ink); }
.lb-fine { font-size: .9rem; color: var(--sepia); margin-top: 6px; }
.lb-list { list-style: none; padding: 0; }
.lb-list li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; align-items: baseline; padding: 4px 6px; border-bottom: 1px dotted var(--rule); font-variant-numeric: lining-nums tabular-nums; }
.lb-list li.lb-me { background: rgba(20,80,89,.14); font-weight: 600; }
.lb-rank { color: var(--oxblood); }
.lb-name { min-width: 0; overflow-wrap: anywhere; }
