:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --ink: #1b1a17;
  --muted: #6b665c;
  --line: #e4ddcf;
  --accent: #c8102e;
  --accent-ink: #fff;
  --track: #ebe4d6;
  --green: #2f9e44;
  --yellow: #f2b705;
  --orange: #f0801a;
  --red: #e03131;
  --shadow: 0 1px 0 rgba(27, 26, 23, .04), 0 12px 32px -12px rgba(27, 26, 23, .18);
  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16140f;
    --surface: #211e18;
    --ink: #f3eee4;
    --muted: #a39d90;
    --line: #36322a;
    --accent: #ff4d5e;
    --accent-ink: #16140f;
    --track: #36322a;
    --shadow: 0 12px 32px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  min-height: 100vh;
  padding: 0 16px env(safe-area-inset-bottom);
}

a { color: inherit; }

button { font: inherit; color: inherit; cursor: pointer; }

.top, .card, .about, .foot { max-width: 520px; margin-inline: auto; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 14px;
}

.logo {
  font: 800 34px/1 var(--display);
  letter-spacing: -.04em;
  text-decoration: none;
}
.logo span { color: var(--accent); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.icon-btn:hover { border-color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px 22px 22px;
  min-height: 460px;
  display: flex;
  flex-direction: column;
}

/* ---------- intro ---------- */

.kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

.intro h2 {
  font: 800 clamp(30px, 8vw, 40px)/1.05 var(--display);
  letter-spacing: -.03em;
  margin: 0 0 16px;
}

.rules {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: grid;
  gap: 12px;
}
.rules li { display: flex; gap: 12px; align-items: flex-start; }
.rules b {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--track);
  font: 700 14px/1 var(--display);
}

.squares { display: flex; gap: 6px; margin: 4px 0 20px; }
.sq { width: 26px; height: 26px; border-radius: 7px; background: var(--track); }
.sq.g { background: var(--green); }
.sq.y { background: var(--yellow); }
.sq.o { background: var(--orange); }
.sq.r { background: var(--red); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 19px/1 var(--display);
  letter-spacing: -.01em;
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}

.spacer { flex: 1; }

/* ---------- spørgsmål ---------- */

.progress { display: flex; gap: 6px; margin-bottom: 20px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--track); }
.progress .g { background: var(--green); }
.progress .y { background: var(--yellow); }
.progress .o { background: var(--orange); }
.progress .r { background: var(--red); }
.progress .now { background: var(--ink); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--track);
  font-size: 13px;
  font-weight: 600;
}

.question {
  font: 700 clamp(23px, 6vw, 28px)/1.2 var(--display);
  letter-spacing: -.02em;
  margin: 14px 0 4px;
  text-wrap: balance;
}

.hint { color: var(--muted); font-size: 14px; margin: 0; }

.guess {
  margin: 28px 0 6px;
  text-align: center;
}
.guess input {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font: 800 clamp(44px, 13vw, 60px)/1 var(--display);
  letter-spacing: -.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  padding: 0;
}
.guess input:focus { outline: none; }
.guess input:focus-visible { outline: 2px dashed var(--line); outline-offset: 6px; border-radius: 8px; }
.unit { color: var(--muted); font-weight: 600; margin-top: 4px; min-height: 1.5em; }

.slider { position: relative; margin: 22px 0 8px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 6px;
  background: var(--track);
}
input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: 6px;
  background: var(--track);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 34px;
  height: 34px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--ink); outline-offset: 2px; }

.ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

.nudge { display: flex; justify-content: center; gap: 10px; margin: 14px 0 22px; }
.nudge button {
  min-width: 64px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: transparent;
  font-weight: 700;
}

/* ---------- svar ---------- */

.reveal-track { position: relative; height: 12px; border-radius: 6px; background: var(--track); margin: 44px 0 40px; }
.pin { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.pin i {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 4px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.pin small {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}
.pin.you i { background: var(--muted); }
.pin.you small { top: 26px; color: var(--muted); }
.pin.ans i { background: var(--ink); }
.pin.ans small { bottom: 26px; }

.answer { text-align: center; margin-top: 18px; }
.answer .label { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.answer .big {
  font: 800 clamp(40px, 12vw, 54px)/1.05 var(--display);
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.answer .yours { color: var(--muted); }

.score-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.points { font: 800 26px/1 var(--display); }
.quip { text-align: center; font-weight: 600; margin: 4px 0 6px; text-wrap: balance; }
.source { text-align: center; font-size: 12px; color: var(--muted); margin: 0 0 20px; }

@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
.pop { animation: pop .35s ease-out both; }
@keyframes slide-in { from { transform: translateY(8px); } to { transform: none; } }
.enter { animation: slide-in .25s ease-out both; }

/* ---------- resultat ---------- */

.result { text-align: center; }
.total { font: 800 clamp(64px, 20vw, 88px)/1 var(--display); letter-spacing: -.05em; margin: 4px 0 0; }
.total small { font-size: .35em; color: var(--muted); letter-spacing: -.02em; }
.verdict { font: 700 24px/1.2 var(--display); margin: 10px 0 2px; }
.verdict-sub { color: var(--muted); margin: 0 0 16px; text-wrap: balance; }
.result .squares { justify-content: center; margin: 12px 0 20px; }

.recap { list-style: none; padding: 0; margin: 0 0 20px; text-align: left; border-top: 1px solid var(--line); }
.recap li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.recap .sq { width: 18px; height: 18px; border-radius: 5px; }
.recap .rq { line-height: 1.3; }
.recap .rq small { display: block; color: var(--muted); }
.recap .rp { font-weight: 800; font-family: var(--display); }

.actions { display: grid; gap: 10px; }
.countdown { color: var(--muted); font-size: 14px; margin: 16px 0 0; }
.countdown b { font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- statistik ---------- */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; text-align: center; }
.stats div { background: var(--track); border-radius: 14px; padding: 12px 4px; }
.stats b { display: block; font: 800 26px/1.1 var(--display); }
.stats span { font-size: 12px; color: var(--muted); }

.dist { display: grid; gap: 6px; margin-top: 8px; }
.dist div { display: grid; grid-template-columns: 70px 1fr 28px; gap: 8px; align-items: center; font-size: 13px; }
.dist i { display: block; height: 14px; border-radius: 4px; background: var(--accent); min-width: 4px; }

/* ---------- om, sheet, toast ---------- */

.about { padding: 40px 4px 8px; color: var(--ink); }
.about h1 { font: 800 26px/1.15 var(--display); letter-spacing: -.02em; margin: 0 0 12px; }
.about h2 { font: 700 19px/1.2 var(--display); margin: 28px 0 8px; }
.about p, .about li { color: var(--muted); }
.about ul { padding-left: 20px; }
.about li { margin-bottom: 6px; }

.foot { padding: 24px 4px 40px; font-size: 13px; color: var(--muted); }

.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: end center; z-index: 10; padding: 16px; }
.sheet[hidden] { display: none; }
.sheet-body {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: 24px;
  padding: 24px 22px;
  max-height: 85vh;
  overflow: auto;
  animation: slide-in .2s ease-out;
}
@media (min-width: 600px) { .sheet { place-items: center; } }
.sheet h3 { font: 800 24px/1.1 var(--display); margin: 0 0 4px; }
.close { position: absolute; top: 14px; right: 14px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  z-index: 20;
}

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