@font-face { font-family: 'Instrument Serif'; src: url(fonts/InstrumentSerif-Regular.ttf); font-display: swap; }
@font-face { font-family: 'Instrument Serif'; font-style: italic; src: url(fonts/InstrumentSerif-Italic.ttf); font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url(fonts/InstrumentSans.ttf); font-weight: 400 700; font-display: swap; }
:root {
  /* Atlas (light): chart paper, deep ocean ink, vermilion pin */
  --bg: #E9EFEC; --panel: #F6F9F6; --panel2: #DCE6E2; --ink: #0E2233; --ink2: #51666F; --line: #C5D3CF;
  --accent: #D9482B; --accent-ink: #fff; --teal: #12766E; --gold: #C98A1B; --good: #12766E; --bad: #C23A22;
  --land: #D2DDD6; --landline: #9DB1AA; --sea: transparent; --grat: rgba(14,34,51,.09); --shadow: 0 1px 0 rgba(14,34,51,.06), 0 8px 24px -12px rgba(14,34,51,.25);
  --serif: 'Instrument Serif', Georgia, serif; --sans: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --spring: cubic-bezier(.34,1.56,.64,1);
  /* aliases for module authors */
  --muted: var(--ink2); --card: var(--panel); --font-ui: var(--sans); --font-display: var(--serif);
}
:root[data-theme=dark] {
  /* Night sky */
  --bg: #08141F; --panel: #0F2030; --panel2: #162B3E; --ink: #E8EEF0; --ink2: #8DA3B0; --line: #223A4D;
  --accent: #F2B84B; --accent-ink: #1A1304; --teal: #4FD1B0; --gold: #F2B84B; --good: #4FD1B0; --bad: #FF7B66;
  --land: #17304A; --landline: #2A4B69; --grat: rgba(232,238,240,.07); --shadow: 0 8px 28px -12px rgba(0,0,0,.6);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; }
.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; padding: env(safe-area-inset-top) 18px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; animation: fade .3s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.ico { display: inline-flex; width: 22px; height: 22px; } .ico svg { width: 100%; height: 100%; }
.sp { flex: 1; }
/* buttons: tactile squash, springy release */
.btn, .ib, .gcard, .arow, .chip, .switch, .card-btn { transition: transform .28s var(--spring), background .15s, box-shadow .15s, opacity .15s; }
.btn:active, .ib:active, .gcard:active, .arow:active, .chip:active, .card-btn:active { transform: scale(.955); transition-duration: .06s; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--line); font-weight: 600; font-size: 16px; box-shadow: var(--shadow); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
:root[data-theme=dark] .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.xl { width: 100%; min-height: 60px; font-size: 18px; border-radius: 18px; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 12px; box-shadow: none; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.ib { width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center; }
.ib:hover { background: var(--panel2); }
/* home */
.home-top { display: flex; align-items: center; padding-top: 10px; gap: 2px; }
.home { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding-top: 4vh; }
.logo { color: var(--ink); display: block; } .logo svg { overflow: visible; }
.logo svg ellipse { transform-origin: 32px 32px; animation: spin 9s linear infinite; }
.logo-pin { animation: pinpulse 2.4s ease-in-out infinite; transform-origin: 41px 22px; }
@keyframes spin { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } 100% { transform: scaleX(1); } }
@keyframes pinpulse { 50% { transform: scale(1.35); } }
.wordmark { font-size: clamp(54px, 15vw, 76px); line-height: .95; letter-spacing: -.01em; margin-top: 2px; }
.datebar { display: flex; gap: 8px; color: var(--ink2); font-size: 15px; font-weight: 500; letter-spacing: .02em; }
.tagline { font-family: var(--serif); font-style: italic; font-size: 22px; margin: 0; color: var(--ink2); }
.pips { display: flex; gap: 8px; justify-content: center; } .pips.big { margin: 8px 0 10px; }
.pip { width: 10px; height: 10px; border-radius: 50%; border: 1.6px solid var(--ink2); background: transparent; transition: all .3s var(--spring); }
.pip.on { background: var(--accent); border-color: var(--accent); transform: scale(1.2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.streak { color: var(--ink2); font-size: 14px; margin-top: 6px; letter-spacing: .02em; } .streak.on { color: var(--accent); font-weight: 600; }
/* top bar */
.bar { display: flex; align-items: center; gap: 4px; padding: 10px 0 8px; }
.bar h2 { font-size: 30px; flex: 1; } .bar-d { color: var(--ink2); font-size: 14px; padding-right: 8px; }
.list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 20px; }
.lead { color: var(--ink2); margin: 0 0 6px; }
.gcard { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px; border-radius: 18px; background: var(--panel); border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.gnum { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 22px; background: var(--panel2); flex: none; }
.gtxt { flex: 1; display: flex; flex-direction: column; } .gtxt b { font-family: var(--serif); font-weight: 400; font-size: 23px; line-height: 1.1; } .gtxt small { color: var(--ink2); font-size: 13.5px; }
.gstat { display: flex; flex-direction: column; align-items: flex-end; font-weight: 600; font-size: 14px; color: var(--accent); } .gstat em { font-style: normal; font-family: var(--serif); font-size: 22px; color: var(--ink); } .gstat small { color: var(--ink2); font-weight: 400; font-size: 12px; }
.arow { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; border-radius: 14px; background: var(--panel); border: 1.5px solid var(--line); text-align: left; }
.arow span:first-child { display: flex; flex-direction: column; } .arow small { color: var(--ink2); } .ascore { font-weight: 600; color: var(--accent); } .arow.done .ascore { color: var(--ink); font-family: var(--serif); font-size: 21px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); font-size: 14px; font-weight: 600; color: var(--ink2); } .chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
:root[data-theme=dark] .chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* stats / settings */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 8px; text-align: center; display: flex; flex-direction: column; } .stat b { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1; } .stat small { color: var(--ink2); font-size: 12px; margin-top: 4px; }
.stats h3 { font-size: 24px; margin: 6px 0 10px; }
.srow { display: flex; justify-content: space-between; align-items: center; padding: 16px 2px; border-bottom: 1px solid var(--line); font-weight: 500; }
.switch { width: 54px; height: 32px; border-radius: 99px; background: var(--panel2); border: 1.5px solid var(--line); position: relative; } .switch i { position: absolute; top: 3px; left: 3px; width: 23px; height: 23px; border-radius: 50%; background: var(--ink2); transition: all .3s var(--spring); }
.switch.on { background: var(--accent); border-color: var(--accent); } .switch.on i { left: 25px; background: var(--accent-ink); }
.seg { display: flex; background: var(--panel2); border-radius: 12px; padding: 3px; } .seg button { padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink2); } .seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.credit, .muted { color: var(--ink2); font-size: 13px; margin-top: 18px; }
/* session */
.session { padding-bottom: 0; }
.s-top { display: flex; align-items: center; gap: 4px; padding: 8px 0 4px; }
.s-title { flex: 1; display: flex; flex-direction: column; line-height: 1.1; padding-left: 4px; } .s-title small { color: var(--ink2); font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; } .s-title span { font-family: var(--serif); font-size: 26px; }
.s-score { font-family: var(--serif); font-size: 26px; padding-right: 6px; min-width: 40px; text-align: right; }
.session .pips { padding: 6px 0 8px; }
.stage { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.mod { flex: 1; display: flex; flex-direction: column; animation: fade .35s ease both; }
.intro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 12vh; text-align: center; gap: 8px; z-index: 5; background: var(--bg); animation: introIn .45s var(--spring) both; cursor: pointer; }
.intro.out { opacity: 0; transition: opacity .16s; }
.intro small { text-transform: uppercase; letter-spacing: .16em; color: var(--accent); font-weight: 700; font-size: 13px; }
.intro h3 { font-size: clamp(46px, 13vw, 64px); line-height: 1; } .intro p { color: var(--ink2); font-size: 18px; max-width: 28ch; margin: 6px 0; }
@keyframes introIn { from { opacity: 0; transform: scale(.94) translateY(10px); } }
.dock { position: sticky; bottom: 0; margin: 0 -18px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 14px; background: linear-gradient(transparent, var(--bg) 30%); transform: translateY(120%); transition: transform .4s var(--spring); pointer-events: none; min-height: 0; }
.dock.in { transform: none; pointer-events: auto; } .dock:empty { display: none; }
.dock .btn { flex: 1; } .dock-pts { display: flex; flex-direction: column; line-height: 1; min-width: 84px; } .dock-pts span { font-family: var(--serif); font-size: 38px; color: var(--accent); } .dock-pts small { color: var(--ink2); font-size: 13px; margin-top: 2px; }
.ph { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; color: var(--ink2); }
/* results */
.results { display: flex; flex-direction: column; gap: 16px; padding-bottom: 20px; }
.r-hero { text-align: center; padding-top: 6px; display: flex; flex-direction: column; align-items: center; } .r-hero small { color: var(--ink2); }
.big-num { font-family: var(--serif); font-size: clamp(96px, 30vw, 132px); line-height: .95; font-variant-numeric: tabular-nums; }
.of { color: var(--ink2); margin-top: -2px; } .rank { font-family: var(--serif); font-style: italic; font-size: 34px; color: var(--accent); margin-top: 6px; }
.r-rows { display: flex; flex-direction: column; gap: 8px; }
.r-row { display: grid; grid-template-columns: 112px 1fr 34px; align-items: center; gap: 10px; animation: rowIn .5s var(--spring) both; animation-delay: var(--d, 0ms); }
.r-row small { grid-column: 1 / -1; color: var(--ink2); margin-top: -5px; font-size: 12.5px; padding-left: 122px; }
.r-n { font-size: 14px; font-weight: 600; } .r-row b { text-align: right; font-variant-numeric: tabular-nums; }
.r-bar { height: 10px; border-radius: 99px; background: var(--panel2); overflow: hidden; } .r-bar i { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 99px; animation: grow .9s var(--spring) both; animation-delay: var(--d, 0ms); transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } } @keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }
.share-line { text-align: center; font-size: 28px; letter-spacing: .14em; color: var(--ink); font-family: ui-monospace, Menlo, monospace; }
/* modal / toast / loader */
.modal { position: fixed; inset: 0; background: rgba(8,20,31,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; opacity: 0; transition: opacity .18s; } .modal.in { opacity: 1; } .modal.out { opacity: 0; }
.sheet { background: var(--bg); width: min(520px, 100%); border-radius: 26px 26px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); transform: translateY(30px); transition: transform .35s var(--spring); max-height: 88dvh; overflow: auto; } .modal.in .sheet { transform: none; }
.how h3 { font-size: 34px; margin-bottom: 8px; } .how p { color: var(--ink2); margin: 0 0 12px; } .how-r { display: flex; flex-direction: column; padding: 8px 0; border-top: 1px solid var(--line); } .how-r span { color: var(--ink2); font-size: 14px; } .how .btn { width: 100%; margin-top: 14px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 12px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; font-size: 14px; opacity: 0; transition: all .3s var(--spring); z-index: 80; pointer-events: none; } .toast.in { opacity: 1; transform: translate(-50%, 0); }
.loader { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; opacity: 0; transition: opacity .2s; } .loader.in { opacity: 1; }
.ld-globe { color: var(--ink); } .ld-globe .m1 { transform-origin: 50px 50px; animation: meridian 1.6s linear infinite; } .ld-globe .m2 { transform-origin: 50px 50px; animation: meridian 1.6s linear infinite -.8s; }
.ld-globe .orb { transform-origin: 50px 50px; animation: orbit 2.2s cubic-bezier(.5,.1,.5,.9) infinite; }
@keyframes meridian { 0% { transform: scaleX(1); } 50% { transform: scaleX(.02); } 100% { transform: scaleX(1); } } @keyframes orbit { to { transform: rotate(360deg); } }
.ld-t { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--ink2); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; width: 100vw; height: 100vh; }
.err { padding: 40px 0; text-align: center; }
[data-motion=off] *, [data-motion=off] *::before { animation-duration: .001s !important; transition-duration: .001s !important; }
@media (prefers-reduced-motion: reduce) { *, *::before { animation-duration: .001s !important; transition-duration: .001s !important; } }
/* shared module helpers */
.mapwrap { position: relative; border-radius: 20px; overflow: hidden; background: var(--panel); border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.mapwrap canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
