/* Compass V3 — soft cartography
   sand paper, living contour lines, compass rose, dusty blue as the one accent */

@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap;
  font-weight: 100 900; font-stretch: 62% 125%;
  src: url("fonts/archivo-latin-wdth-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap;
  font-weight: 100 900; font-stretch: 62% 125%;
  src: url("fonts/archivo-latin-ext-wdth-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url("fonts/newsreader-latin-opsz-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Newsreader"; font-style: italic; font-display: swap; font-weight: 200 800;
  src: url("fonts/newsreader-latin-opsz-italic.woff2") format("woff2-variations");
}

:root {
  --css-version: "3.12";
  --sand: #F2ECE1;
  --card: #FBF8F2;
  --line: #DED3C1;
  --ink: #2E3846;
  --ink-2: #6E7581;
  --blue: #4877A8;
  --blue-deep: #345E8C;
  --blue-soft: #DCE6F0;
  --blue-mist: #BFD3E6;
  --contour: #CDB497;
  --butter: #F1E2B5;
  --water: #D3E3EA;

  --sans: "Archivo", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --pad: 20px;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { background: var(--sand); }
html, body { min-height: 100%; }
body { position: relative; overflow-x: hidden; overflow-x: clip; }
html { overflow-x: hidden; overflow-x: clip; }
body {
  background: var(--sand);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}

/* ---------- living terrain ---------- */
.terrain {
  position: absolute; top: 0; left: 0; width: 100%; height: max(100lvh, 100%); z-index: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 72px, #000 calc(100% - 96px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 72px, #000 calc(100% - 96px), transparent 100%);
}
.terrain .band { fill: #B99A74; fill-opacity: .038; stroke: none; }
.terrain .lake { fill: var(--water); opacity: .75; }
.terrain .c { fill: none; stroke: var(--contour); stroke-width: 1; opacity: .75; vector-effect: non-scaling-stroke; }
.terrain .c.index { stroke-width: 1.7; opacity: .9; }
.terrain .shore { fill: none; stroke: #A9C4D2; stroke-width: 1.2; vector-effect: non-scaling-stroke; }

#app { position: relative; z-index: 1; overflow: hidden; min-height: 100dvh; max-width: 520px; margin: 0 auto; }
.screen { display: none; min-height: 100dvh; position: relative; }
.screen.active { display: flex; flex-direction: column; animation: screen-in .45s ease both; }
@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }

.card {
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: 17px;
  border: 0; cursor: pointer; width: 100%;
  min-height: 54px; padding: 14px 18px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .08s ease, background-color .2s ease, color .2s ease;
}
.btn:active { transform: scale(.985); }
.btn:focus-visible, .icon-btn:focus-visible {
  outline: 3px solid var(--blue-mist); outline-offset: 3px;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); }
.btn-primary:disabled { background: #E3DCCF; color: #A39C90; cursor: default; }
.btn-ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.ico { width: 18px; height: 18px; color: var(--blue); flex: none; }
.icon-btn {
  width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink);
  border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- compass rose ---------- */
.rose .f-light { fill: var(--card); stroke: var(--ink); stroke-width: .9; stroke-linejoin: round; }
.rose .f-dark { fill: #C9BBA5; stroke: var(--ink); stroke-width: .9; stroke-linejoin: round; }
.rose .f-north { fill: var(--blue); stroke: var(--blue-deep); stroke-width: .9; stroke-linejoin: round; }
.rose .f-north-l { fill: var(--blue-soft); stroke: var(--blue-deep); stroke-width: .9; stroke-linejoin: round; }
.rose .ring { fill: none; stroke: var(--ink); stroke-width: .8; }
.rose .ring-dash { fill: none; stroke: var(--ink); stroke-width: 3; stroke-dasharray: .8 4.43; }
.rose .n { font-family: var(--serif); font-size: 22px; font-weight: 500; fill: var(--blue-deep); text-anchor: middle; }

/* ---------- home (fits one screen) ---------- */
.home-inner {
  flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px;
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 20px) var(--pad) calc(var(--safe-bot) + 20px);
}
.home-head { position: relative; padding-top: 4px; }
.rose-hero {
  position: absolute; right: -46px; top: -44px; width: 140px; height: 140px; opacity: .6;
  transform: rotate(-12deg); animation: rose-settle 2.2s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes rose-settle { from { transform: rotate(-80deg); opacity: 0; } to { transform: rotate(-12deg); opacity: .6; } }
.wordmark {
  position: relative; font-family: var(--serif); font-weight: 400;
  font-size: clamp(50px, 14vw, 68px); line-height: .95; letter-spacing: -.015em;
  font-variation-settings: "opsz" 72;
}
.lede { position: relative; margin-top: 8px; max-width: 24ch; font-size: 17px; color: var(--ink); }

.streak { display: flex; align-items: baseline; gap: 10px; }
.streak-num {
  font-family: var(--serif); font-size: 40px; font-weight: 500; line-height: 1; color: var(--blue);
  font-variant-numeric: lining-nums tabular-nums;
}
.streak-txt { font-weight: 500; color: var(--ink-2); }

.course-card { padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.course-date { font-family: var(--serif); font-size: 20px; font-weight: 500; line-height: 1.2; }
.course-map { width: 100%; height: auto; display: block; }
.course-map text, .progress-map text { font-family: var(--sans); }

.pre-play, .post-play { display: flex; flex-direction: column; gap: 10px; }
.level-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.level-label { font-weight: 600; font-size: 15px; color: var(--ink-2); }
.select-wrap { position: relative; color: var(--blue-deep); }
.select-wrap select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-weight: 600; font-size: 16px; color: var(--ink);
  background: var(--card); border: 0; box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 999px; padding: 10px 38px 10px 44px; min-height: 44px; cursor: pointer;
}
.select-wrap select:focus-visible { outline: 3px solid var(--blue-mist); outline-offset: 2px; }
.select-wrap select:disabled { color: var(--ink-2); cursor: default; }
.select-wrap .level-icon { position: absolute; left: 11px; top: 50%; width: 24px; height: 24px; margin-top: -12px; pointer-events: none; overflow: visible; }
.select-wrap svg:not(.level-icon) { position: absolute; right: 15px; top: 50%; width: 12px; height: 8px; margin-top: -4px; pointer-events: none; }
.level-desc { font-size: 14px; color: var(--ink-2); line-height: 1.35; min-height: 2.7em; }
#btn-start, #btn-share-home { margin-top: 6px; }

.done-score, .summary-total {
  font-family: var(--serif); font-size: 64px; font-weight: 400; line-height: 1;
  font-variant-numeric: lining-nums tabular-nums; font-variation-settings: "opsz" 72;
}
.done-of { font-size: .36em; font-family: var(--sans); font-weight: 500; color: var(--ink-2); margin-left: 6px; }
.done-line { font-size: 20px; letter-spacing: .06em; }
.next-in { font-size: 14px; color: var(--ink-2); text-align: center; }

.secondary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.btn-small { font-size: 15px; font-weight: 500; min-height: 44px; padding: 10px 16px; white-space: nowrap; }
.secondary #btn-practice { padding: 10px 22px; }
@media (max-width: 360px) {
  .btn-small { font-size: 14px; padding: 8px 12px; white-space: normal; line-height: 1.2; }
  .secondary #btn-practice { padding: 8px 14px; }
  .course-date { font-size: 18px; }
}

/* ---------- gate ---------- */
#screen-gate { justify-content: center; padding: var(--pad); }
.gate { display: flex; flex-direction: column; gap: 12px; padding: 26px 22px; }
.gate-mark { width: 84px; height: 84px; animation: spin 6s linear infinite; }
.gate.error .gate-mark { animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.gate h2 { font-family: var(--serif); font-size: 30px; line-height: 1.1; font-weight: 500; }
.gate p { color: var(--ink); }
.gate-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

/* ---------- play ---------- */
#screen-play { padding: calc(var(--safe-top) + 6px) var(--pad) calc(var(--safe-bot) + 16px); gap: 10px; }
.play-bar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: 0 -8px; }
.progress-map { width: 100%; max-width: 200px; height: 32px; justify-self: center; }
/* old timer label */
.timer-unused {
  justify-self: end; font-family: var(--serif); font-weight: 500; font-size: 24px;
  font-variant-numeric: lining-nums tabular-nums; color: var(--ink);
}
.timer.low { color: var(--blue); }

.target { min-height: 96px; }
.target-kicker { font-size: 15px; font-weight: 500; color: var(--ink-2); }
.target-name {
  font-family: var(--serif); font-style: italic; font-weight: 450;
  font-size: clamp(34px, 11vw, 50px); line-height: 1; letter-spacing: -.01em; margin-top: 2px;
  font-variation-settings: "opsz" 60; overflow-wrap: anywhere;
}
.target-country { margin-top: 6px; font-weight: 500; font-size: 16px; color: var(--ink); }

.photo { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--line); height: 22vh; min-height: 120px; border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo figcaption {
  position: absolute; right: 8px; bottom: 8px; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(251,248,242,.88); color: var(--ink-2);
}
.photo figcaption a { color: inherit; }

.dial-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 0; }
.dial { width: min(80vw, 40vh, 380px); height: auto; overflow: visible; margin-top: 26px; }
.has-photo .dial { width: min(66vw, 30vh, 320px); }
.dial-face { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; }
.dial-glow { fill: var(--line); transition: fill .35s ease; }
.dial-glow.cold { fill: var(--water); }
.dial-glow.warm { fill: var(--butter); }
.dial-glow.hot { fill: var(--blue-mist); }
.dial .tick { stroke: var(--ink); stroke-linecap: round; }
.dial .lbl { font-family: var(--sans); font-size: 11.5px; font-weight: 500; fill: var(--ink-2); text-anchor: middle; dominant-baseline: central; }
.dial .card-lbl { font-family: var(--serif); font-size: 20px; font-weight: 500; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.dial .card-lbl.north { fill: var(--blue-deep); font-size: 24px; }
.travel-line { stroke: var(--blue); stroke-width: 2; }
.travel-arrow { fill: var(--blue); }
.hub { fill: var(--card); stroke: var(--blue); stroke-width: 2; }
.dial-hint { font-size: 14px; color: var(--ink-2); text-align: center; max-width: 30ch; min-height: 2.8em; }
.dial-hint.warn { color: var(--blue-deep); font-weight: 600; }
.desktop .dial { cursor: grab; touch-action: none; }

.lock-area { display: flex; flex-direction: column; gap: 10px; }
.steady { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.steady-fill { height: 100%; width: 0; background: var(--blue); transition: width .12s linear; }
.btn-lock { min-height: 58px; font-size: 18px; }

/* ---------- reveal ---------- */
#screen-reveal { padding: calc(var(--safe-top) + 10px) var(--pad) calc(var(--safe-bot) + 16px); }
.reveal { display: flex; flex-direction: column; flex: 1; gap: 6px; }
.globe-box { display: flex; flex-direction: column; align-items: center; }
.globe { width: min(100%, 44vh, 440px); aspect-ratio: 1; display: block; touch-action: none; cursor: grab; }
.globe-hint { font-size: 12px; color: var(--ink-2); }
.reveal-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.reveal-target { font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1.2; }
.off { font-family: var(--serif); font-size: 64px; line-height: .95; font-weight: 400; font-variant-numeric: lining-nums tabular-nums; font-variation-settings: "opsz" 72; }
.off-unit { font-size: .34em; font-family: var(--sans); font-weight: 500; margin-left: 4px; color: var(--ink-2); }
.points { font-weight: 600; color: var(--blue); font-size: 17px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.facts dt { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.facts dd { font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }
.key { width: 14px; height: 0; border-top: 3px solid var(--blue); display: inline-block; border-radius: 2px; }
.key-you { border-top: 2px dashed var(--ink-2); }
.flat-note { font-size: 15px; background: var(--butter); padding: 10px 12px; border-radius: 10px; line-height: 1.4; }
.reveal-body .btn { margin-top: auto; }
.reveal-body .btn + .btn { margin-top: 0; }

/* ---------- summary ---------- */
.summary {
  flex: 1; display: flex; flex-direction: column; gap: 14px;
  padding: calc(var(--safe-top) + 36px) var(--pad) calc(var(--safe-bot) + 22px);
}
.summary-kicker { font-family: var(--serif); font-style: italic; font-size: 22px; }
.summary-list { list-style: none; }
.summary-list li { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 13px 14px; }
.summary-list li + li { border-top: 1px solid var(--line); }
.summary-list .n {
  width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--blue); color: var(--blue);
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.summary-list .nm { font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.15; }
.summary-list .nm small { display: block; font-family: var(--sans); font-style: normal; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.summary-list .dg { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.summary-list .dg small { display: block; font-weight: 600; color: var(--blue); font-size: 13px; }
.summary-streak { color: var(--ink); }
.summary .btn-primary { margin-top: auto; }
.toast { min-height: 1.4em; text-align: center; font-size: 14px; font-weight: 600; color: var(--blue-deep); }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dial-timer { fill: none; stroke: var(--blue); stroke-width: 12; stroke-linecap: butt; }
.dial-count { font-family: var(--serif); font-size: 26px; font-weight: 500; fill: var(--blue); text-anchor: middle; font-variant-numeric: lining-nums tabular-nums; }
.build { text-align: center; font-size: 11px; color: var(--ink-2); opacity: .7; margin-top: -6px; }
.build.stale { opacity: 1; color: var(--blue-deep); font-weight: 600; }
