:root {
  --page: #E7E9EC;
  --page-ink: #000000;
  --page-muted: #5E636B;
  --r-card: 30px;
  --r-inner: 18px;
  --gutter: 22px;
  font-family: 'Schibsted Grotesk', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) { --page: #000000; --page-ink: #FFFFFF; --page-muted: #8C9098; color-scheme: dark; }
}
:root[data-theme='dark'] { --page: #000000; --page-ink: #FFFFFF; --page-muted: #8C9098; color-scheme: dark; }

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--page);
  color: var(--page-ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }

/* ---------- game page ---------- */
.game-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}
#app { width: min(440px, 100%); min-width: 0; position: relative; }
.game-page { grid-template-columns: minmax(0, 1fr); justify-items: center; }

.card {
  --bg: #000; --ink: #fff;
  position: relative;
  background: var(--bg);
  color: var(--ink);
  border-radius: var(--r-card);
  height: min(820px, calc(100svh - 96px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  container-type: inline-size;
  transition: background-color .25s ease, color .25s ease;
}
.mauve .card, .card:has(.mauve) { transition: none; }

.card-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--gutter) 0;
  font-size: 15px; font-weight: 600;
  position: relative; z-index: 3;
  pointer-events: none;
}
.card-top > * { pointer-events: auto; }
.mark { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-weight: 800; letter-spacing: -0.02em; font-size: 17px; }
.card-count { opacity: .7; }

.card-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px var(--gutter);
  overflow-y: auto;
  position: relative;
}
.card-foot {
  display: flex; flex-direction: column; gap: 10px;
  padding: 0 var(--gutter) var(--gutter);
  position: relative; z-index: 3;
}
.card-foot:empty { padding-bottom: calc(var(--gutter) + 56px); }

.btn {
  height: 56px; border-radius: 999px; border: 0;
  font-size: 17px; font-weight: 700; letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 28%, transparent); }
.link { background: none; border: 0; padding: 14px 0 0; align-self: flex-start; font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; opacity: .75; cursor: pointer; }

.more { display: flex; justify-content: center; gap: 22px; padding: 18px 0 4px; font-size: 15px; font-weight: 600; }
.more-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--page-muted); }
.more-link::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--dot); }
.more-link:hover { color: var(--page-ink); }

/* intro */
.intro { gap: 14px; padding-bottom: 28px; }
.intro-art { flex: 1; min-height: 90px; display: grid; place-items: center; }
.intro-art .glyph { width: min(58%, 210px); max-height: 100%; fill: var(--ink); overflow: visible; }
.glyph .g-stroke { stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.glyph .g-ring { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.glyph .g-swatch { stroke: var(--ink); stroke-width: 1.6; }
.title {
  font-size: clamp(76px, 24vw, 112px);
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: .82;
  margin: 0 0 12px -4px;
}
.lede { font-size: 19px; line-height: 1.32; font-weight: 500; max-width: 30ch; letter-spacing: -0.01em; }
.lede + .lede { opacity: .72; }
.callout { margin-top: 14px; padding-top: 16px; border-top: 2px solid color-mix(in srgb, var(--ink) 22%, transparent); font-size: 16px; line-height: 1.4; }
.callout-big { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.meta { font-size: 15px; font-weight: 600; opacity: .7; }

/* reveal */
.round-score { margin-top: auto; padding-top: 12px; }
.round-num { font-size: 96px; font-weight: 800; letter-spacing: -0.06em; line-height: .9; margin-left: -3px; }
.round-line { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; margin-top: 8px; }

.compare { display: flex; gap: 28px; margin-top: 14px; }
.compare dt { font-size: 14px; font-weight: 500; opacity: .7; }
.compare dd { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
.dd-unit { font-size: 16px; font-weight: 600; letter-spacing: 0; opacity: .7; }

/* results */
.results > :first-child { margin-top: auto; }
.total { display: flex; align-items: baseline; margin: 8px 0 0 -5px; }
.total-num { font-size: clamp(88px, 27vw, 132px); font-weight: 800; letter-spacing: -0.07em; line-height: .86; }
.total-of { font-size: 30px; font-weight: 700; opacity: .6; margin-left: 6px; letter-spacing: -0.02em; }
.verdict { font-size: 22px; font-weight: 700; line-height: 1.22; letter-spacing: -0.02em; margin: 16px 0 22px; max-width: 22ch; }
.bars { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.bar { display: flex; flex-direction: column; gap: 6px; }
.bar-track { height: 84px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 16%, transparent); display: flex; align-items: flex-end; overflow: hidden; }
.bar-fill { width: 100%; background: var(--ink); border-radius: 10px; transform-origin: bottom; animation: rise .7s cubic-bezier(.2,.8,.2,1) both; }
.bar:nth-child(2) .bar-fill { animation-delay: .06s; }
.bar:nth-child(3) .bar-fill { animation-delay: .12s; }
.bar:nth-child(4) .bar-fill { animation-delay: .18s; }
.bar:nth-child(5) .bar-fill { animation-delay: .24s; }
@keyframes rise { from { transform: scaleY(0); } }
.bar-val { font-size: 15px; font-weight: 700; }
.bars-key { font-size: 13px; font-weight: 500; opacity: .6; margin-top: 8px; }
.bar-rival { font-size: 13px; font-weight: 500; opacity: .6; margin-top: -4px; }

.board { list-style: none; padding: 0; margin-top: 22px; border-top: 2px solid color-mix(in srgb, var(--ink) 22%, transparent); }
.board-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding: 10px 0; font-size: 17px; font-weight: 600; border-bottom: 1px solid color-mix(in srgb, var(--ink) 14%, transparent); }
.board-row.you { font-weight: 800; }
.board-rank { opacity: .55; }
.results .meta { margin-top: 16px; }

/* name sheet */
.sheet { position: absolute; inset: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px); display: flex; align-items: flex-end; padding: 10px; }
.sheet-inner { width: 100%; background: var(--ink); color: var(--bg); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 8px; animation: up .22s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.sheet-sub { font-size: 15px; opacity: .7; margin-bottom: 8px; }
.name-input { height: 56px; border-radius: 16px; border: 0; padding: 0 18px; font-size: 19px; font-weight: 600; background: color-mix(in srgb, var(--bg) 14%, transparent); color: var(--bg); }
.name-input::placeholder { color: color-mix(in srgb, var(--bg) 45%, transparent); }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.sheet .btn.primary { background: var(--bg); color: var(--ink); }
.sheet .btn.secondary { color: var(--bg); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bg) 30%, transparent); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--page-ink); color: var(--page); padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: 15px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 20; white-space: nowrap; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- count ---------- */
.count-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.count-ready { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; max-width: 14ch; }
.dots { width: 100%; max-height: 100%; aspect-ratio: 1; fill: var(--ink); }
.dots.shown { opacity: .9; }
.count-display { font-size: 92px; font-weight: 800; letter-spacing: -0.06em; line-height: 1; text-align: center; padding: 8px 0 20px; }
.count-display.empty { font-size: 40px; opacity: .55; padding: 34px 0 32px; letter-spacing: -0.03em; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key { height: 60px; border: 0; border-radius: 16px; background: color-mix(in srgb, var(--ink) 12%, transparent); font-size: 26px; font-weight: 700; cursor: pointer; }
.key:active { background: color-mix(in srgb, var(--ink) 24%, transparent); }

/* ---------- eyeball ---------- */
.prompt { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; max-width: 18ch; }
.eye-wrap { flex: 1; display: grid; place-items: center; min-height: 0; }
.eye-field { width: 100%; max-height: 100%; aspect-ratio: 1; touch-action: none; cursor: crosshair; overflow: visible; }
.eye-stroke { stroke: var(--ink); stroke-width: .9; stroke-linecap: round; stroke-linejoin: round; }
.eye-dot { fill: var(--ink); }
.eye-mark circle { fill: none; stroke: var(--ink); stroke-width: .7; }
.eye-mark line { stroke: var(--ink); stroke-width: .7; stroke-linecap: round; }
.eye-target { fill: var(--ink); }
.eye-miss { stroke: var(--ink); stroke-width: .5; stroke-dasharray: 1 1; }
.reveal.eyeball .eye-mark { opacity: .55; }

/* ---------- mauve ---------- */
.mauve { padding-bottom: 8px; }
.mauve-pad { position: absolute; inset: 0; touch-action: none; cursor: crosshair; z-index: 0; outline-offset: -6px; }
.mauve-ring { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; box-shadow: 0 0 0 3px var(--ink), inset 0 0 0 3px var(--bg); pointer-events: none; }
.mauve-hue { position: absolute; left: var(--gutter); right: var(--gutter); top: 4px; height: 8px; border-radius: 3px; opacity: .9; }
.mauve-light { position: absolute; right: 8px; top: 18px; bottom: 18px; width: 6px; border-radius: 3px; }
.mauve-name { position: relative; z-index: 1; pointer-events: none; font-size: clamp(54px, 16vw, 76px); font-weight: 800; letter-spacing: -0.055em; line-height: .9; margin-top: 18%; max-width: 8ch; }
.mauve-hint { position: relative; z-index: 1; pointer-events: none; font-size: 16px; font-weight: 500; opacity: .75; margin-top: 14px; max-width: 26ch; }
.mauve-slider { position: relative; z-index: 2; margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; }
.mauve-slider span { opacity: .75; }
.mauve-chroma { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; cursor: pointer; }
.mauve-chroma::-webkit-slider-runnable-track { height: 14px; border-radius: 7px; background: var(--track); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 30%, transparent); }
.mauve-chroma::-moz-range-track { height: 14px; border-radius: 7px; background: var(--track); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 30%, transparent); }
.mauve-chroma::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -8px; border-radius: 50%; background: var(--bg); box-shadow: 0 0 0 3px var(--ink); }
.mauve-chroma::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); border: 3px solid var(--ink); }

.mauve-reveal { gap: 0; }
.swatch { flex: 1; max-height: 46%; min-height: 150px; border-radius: var(--r-inner); padding: 16px 18px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 15%, transparent); }
.swatch-label { font-size: 17px; font-weight: 700; }
.swatch-hex, .answer-hex { font-size: 15px; font-weight: 600; opacity: .75; }
.answer { padding-top: 16px; }
.answer-name { font-size: 44px; font-weight: 800; letter-spacing: -0.04em; line-height: .95; }

/* ---------- small screens: the card becomes the screen ---------- */
@media (max-width: 520px) {
  .game-page { padding: 8px; }
  .card { height: calc(100svh - 16px); --r-card: 26px; }
  .card-top { padding-top: 18px; }
  .round-num { font-size: 84px; }
}
@media (max-height: 700px) {
  .key { height: 50px; }
  .count-display { font-size: 72px; padding-bottom: 12px; }
  .bar-track { height: 60px; }
  .title { font-size: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- ads: under the card, labeled, never inside the game ---------- */
.ad { width: 100%; margin: 16px auto 0; display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.ad-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--page-muted, #6b6f76); }
.ad:has(ins[data-ad-status="unfilled"]) { display: none; }
.ad-stand-in { flex: 1; min-height: 100px; border-radius: 16px; border: 2px dashed color-mix(in srgb, currentColor 25%, transparent); display: grid; place-items: center; font-size: 14px; font-weight: 600; opacity: .6; }

/* ---------- add to home screen (iOS instructions) ---------- */
.install-sheet { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .45); display: flex; align-items: flex-end; justify-content: center; padding: 12px; }
.install-card { width: min(440px, 100%); background: #fff; color: #000; border-radius: 26px; padding: 24px; display: flex; flex-direction: column; gap: 14px; animation: up .22s cubic-bezier(.2,.8,.2,1); }
.install-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.install-steps { padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 18px; font-weight: 500; }
.install-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 2px solid currentColor; border-radius: 6px; font-size: 14px; font-weight: 800; }
.install-card .btn { --bg: #fff; --ink: #000; }
