/* Higher Ground: contour-map greens, sunrise orange, big confident numbers. */

@font-face { font-family: 'Bricolage'; src: url('fonts/bricolage-grotesque-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Bricolage'; src: url('fonts/bricolage-grotesque-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/inter-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/inter-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --ground: #0e2b29;
  --ground-2: #143936;
  --contour: rgba(190, 240, 220, .07);
  --line: #24504b;
  --text: #eef6f1;
  --muted: #92b3aa;
  --card: #f6f3ea;
  --card-ink: #0f201e;
  --sun: #ff8a3d;
  --sun-deep: #e0671b;
  --ok: #3fc483;
  --bad: #ff5f57;
  --display: 'Bricolage', 'Arial Black', system-ui, sans-serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font: 400 16px/1.45 var(--sans);
  background-color: var(--ground);
  /* contour lines */
  background-image:
    repeating-radial-gradient(ellipse at 15% 25%, transparent 0 26px, var(--contour) 26px 27.5px),
    repeating-radial-gradient(ellipse at 85% 80%, transparent 0 30px, var(--contour) 30px 31.5px);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
.ico { display: block; flex: none; }

/* ---- Header ---- */
.top {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px;
  max-width: 540px; margin: 0 auto; padding: 16px 16px 10px;
}
.brand { text-align: center; }
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0; font: 800 clamp(27px, 7.4vw, 36px)/1 var(--display); letter-spacing: -.02em;
}
.peak { /* sunrise behind a peak */
  width: 34px; height: 26px; flex: none;
  background:
    linear-gradient(135deg, transparent 49%, var(--text) 50%) left bottom / 50% 100% no-repeat,
    linear-gradient(225deg, transparent 49%, var(--text) 50%) right bottom / 50% 100% no-repeat,
    radial-gradient(circle at 70% 35%, var(--sun) 0 7px, transparent 7.5px);
}
.tagline {
  display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 8px 0 0; font: 600 13px/1.2 var(--sans); color: var(--muted);
}
.tagline .dot { opacity: .6; }
.cat-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--sun); }
.badge { padding: 2px 8px; border: 1px solid var(--sun); border-radius: 999px; color: var(--sun); }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.icon-btn:hover { background: var(--ground-2); }

.wrap { max-width: 540px; margin: 0 auto; padding: 6px 16px 48px; }

/* ---- The ridge: ten rising steps ---- */
.ridge { display: flex; align-items: flex-end; gap: 4px; height: 34px; list-style: none; margin: 4px 0 10px; padding: 0; }
.ridge li { flex: 1; border-radius: 3px 3px 0 0; background: var(--line); transition: background-color .3s; }
.ridge li.ok { background: var(--ok); }
.ridge li.bad { background: var(--bad); }
.ridge li.now { background: var(--sun); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.ridge.big { height: 56px; max-width: 320px; margin: 4px auto 22px; }

.step-label { margin: 0; font: 600 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.question { margin: 6px 0 14px; font: 800 28px/1.1 var(--display); letter-spacing: -.01em; }

/* ---- The duel ---- */
.duel { position: relative; display: grid; gap: 12px; }
.vs {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--ground); border: 2px solid var(--line);
  font: 800 15px/1 var(--display); color: var(--muted);
}
.choice {
  position: relative;
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 6px 12px;
  min-height: 132px; width: 100%;
  padding: 16px 18px;
  border: 0; border-radius: 16px;
  background: var(--card); color: var(--card-ink);
  text-align: left; cursor: pointer;
  box-shadow: 0 6px 0 #cfc8b5, 0 14px 28px rgba(0, 0, 0, .3);
  transition: transform .12s ease, box-shadow .12s ease;
}
.choice:hover:not(:disabled) { transform: translateY(-2px); }
.choice:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 3px 0 #cfc8b5, 0 8px 16px rgba(0, 0, 0, .3); }
.choice:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.choice:disabled { cursor: default; }
.choice .ic { grid-column: 1 / -1; color: #6c7f78; }
.choice .name { font: 700 22px/1.15 var(--display); letter-spacing: -.01em; }
.choice .val { font: 800 26px/1 var(--display); white-space: nowrap; text-align: right; color: var(--card-ink); }
.choice .val.hidden { color: #b3ab96; }
.choice .val small { display: block; margin-top: 4px; font: 600 12px/1 var(--sans); color: #6c7f78; text-align: right; }
.choice.right { box-shadow: 0 0 0 4px var(--ok), 0 6px 0 #cfc8b5, 0 14px 28px rgba(0, 0, 0, .3); }
.choice.right .val { color: #1f8a55; }
.choice.wrong { box-shadow: 0 0 0 4px var(--bad), 0 6px 0 #cfc8b5, 0 14px 28px rgba(0, 0, 0, .3); }
.choice.enter { animation: enter .35s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(24px); } }
.choice.rise { animation: rise .35s ease both; }
@keyframes rise { from { transform: translateY(70px); } }

.feedback { min-height: 1.6em; margin: 16px 0 0; text-align: center; font-weight: 600; }
.feedback .yes { color: var(--ok); }
.feedback .no { color: var(--bad); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--ground-2); font-weight: 600; cursor: pointer;
  transition: transform .08s;
}
.btn:active { transform: translateY(2px); }
.btn.primary { background: var(--sun); border-color: var(--sun); color: #2a1300; box-shadow: 0 4px 0 var(--sun-deep); }
.btn.primary:active { box-shadow: 0 2px 0 var(--sun-deep); }
.btn.wide { width: 100%; }

/* ---- End ---- */
.end { text-align: center; padding-top: 6px; }
.end-kicker { margin: 0; font: 600 12px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.end-score { margin: 8px 0 2px; font: 800 76px/1 var(--display); letter-spacing: -.03em; }
.end-score small { font-size: 34px; color: var(--muted); }
.end-sub { margin: 0 0 16px; font: 700 20px/1.2 var(--display); color: var(--sun); }
.share-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.next { margin: 16px 0 0; color: var(--muted); font-size: 15px; }
.next b { color: var(--text); font-variant-numeric: tabular-nums; }
.chain-title { margin: 30px 0 10px; font: 600 12px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.chain { list-style: none; margin: 0; padding: 0; text-align: left; }
.chain li.item {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: baseline;
  padding: 10px 12px; border-radius: 10px; background: var(--ground-2);
}
.chain .n { font-weight: 600; line-height: 1.3; }
.chain .v { font: 800 16px/1 var(--display); white-space: nowrap; }
.chain a { display: inline-flex; align-items: center; color: var(--muted); }
.chain a:hover { color: var(--text); }
.chain li.link { display: flex; align-items: center; gap: 8px; padding: 4px 0 4px 18px; font-size: 13px; color: var(--muted); }
.chain li.link .ok { color: var(--ok); }
.chain li.link .bad { color: var(--bad); }

/* ---- Dialogs ---- */
dialog.sheet {
  width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: auto;
  padding: 26px 22px 22px; border: 2px solid var(--line); border-radius: 18px;
  background: var(--ground-2); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
dialog::backdrop { background: rgba(4, 14, 13, .7); }
dialog h2 { margin: 0 0 12px; font: 800 28px/1.1 var(--display); }
dialog h3 { margin: 22px 0 8px; font: 600 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
dialog p { margin: 0 0 12px; }
dialog .close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.stat-grid b { display: block; font: 800 32px/1.1 var(--display); }
.stat-grid span { font-size: 12px; color: var(--muted); }
.dist { display: grid; gap: 4px; }
.dist .bar { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: center; font-weight: 600; font-size: 13px; }
.dist .fill { min-width: 24px; padding: 1px 7px; border-radius: 4px; background: var(--line); text-align: right; }
.dist .fill.today { background: var(--sun); color: #2a1300; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; top: 16px; transform: translate(-50%, -150%); visibility: hidden;
  padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--ground); font-weight: 600;
  transition: transform .25s, visibility .25s; pointer-events: none; z-index: 20;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

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