/* Two identity colors, HEADS and TAILS: slots 1 and 2 of the validated dataviz palette
   (CVD ΔE 26.8 dark / 24.7 light, both ≥ 3:1 on the card surface). Dark is the default look. */
:root {
  color-scheme: dark;
  --page: #0d0d0c;
  --surface: #1a1a19;
  --surface-2: #232321;
  --line: #2f2f2c;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #8f8e86;
  --heads: #d95926;
  --tails: #3987e5;
  --radius: 14px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --page: #f4f3ef;
    --surface: #fcfcfb;
    --surface-2: #f0efea;
    --line: #e2e0d8;
    --text: #0b0b0b;
    --text-2: #52514e;
    --muted: #6d6c66;
    --heads: #eb6834;
    --tails: #2a78d6;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.banner { background: #3a2d00; color: #ffd66b; text-align: center; padding: 8px 16px; font-size: 14px; font-weight: 500; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .banner { background: #fff1c2; color: #5c4300; } }

main, .hero, footer { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ---- hero ---- */
.hero { text-align: center; padding-top: 24px; padding-bottom: 32px; }
.hero-banner { position: relative; margin-bottom: 20px; }
.hero-banner img { display: block; width: 100%; border-radius: var(--radius); box-shadow: 0 10px 40px rgb(0 0 0 / .5); transition: opacity .35s ease; }
.hero-banner img.fading { opacity: 0; }
.tagline { font-size: clamp(20px, 3.4vw, 26px); font-weight: 600; margin: 0 0 12px; }
.lede { max-width: 620px; margin: 0 auto; color: var(--text-2); }

/* ---- duel ---- */
.duel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; margin-bottom: 16px; }
.side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-align: center; border-top: 4px solid var(--c); }
.side.heads { --c: var(--heads); }
.side.tails { --c: var(--tails); }
.side .coin { width: 128px; border-radius: 50%; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.side:hover .coin { transform: rotateY(360deg); }
.side h3 { font-family: Cinzel, Georgia, serif; font-size: 28px; margin: 8px 0 12px; letter-spacing: .06em; }
.label { margin: 0; color: var(--text-2); font-size: 14px; }
.big { font-size: clamp(32px, 5vw, 44px); font-weight: 600; margin: 0; line-height: 1.15; }
.sub { margin: 4px 0 20px; color: var(--muted); font-size: 14px; }
.vs { font-family: Cinzel, Georgia, serif; font-size: 28px; color: var(--muted); }

.meter-wrap { text-align: left; margin-bottom: 16px; }
.meter-head { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.meter { height: 10px; border-radius: 5px; background: color-mix(in oklab, var(--c) 18%, var(--surface)); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--c); border-radius: 5px; transition: width 1s ease; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 20px; text-align: left; }
.facts div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.buy { display: block; padding: 12px; border-radius: 10px; background: var(--c); color: #fff; font-weight: 600; text-decoration: none; }
.buy[aria-disabled="true"] { background: var(--surface-2); color: var(--muted); cursor: default; }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.card h2 { font-size: 20px; margin: 0 0 4px; }
.hint { margin: 0 0 16px; color: var(--muted); font-size: 14px; }

/* comparison bars: one row per side on a shared scale, value labelled at the end (never colour alone) */
.race-q { font-size: 14px; font-weight: 600; color: var(--text-2); margin: 20px 0 10px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 112px 1fr auto; align-items: center; gap: 12px; }
.bar-label { font-size: 14px; color: var(--text-2); white-space: nowrap; }
.bar-track { height: 14px; border-radius: 4px; background: color-mix(in oklab, var(--c) 14%, var(--surface)); }
.bar-fill { display: block; height: 100%; width: 0; min-width: 2px; background: var(--c); border-radius: 4px; transition: width 1s ease; }
.bar-val { font-size: 14px; font-weight: 600; white-space: nowrap; min-width: 84px; text-align: right; }
.bar-row.heads { --c: var(--heads); }
.bar-row.tails { --c: var(--tails); }
.lead { font-size: 12px; font-weight: 600; color: var(--text); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }

/* teams */
.team-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.team-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; border-radius: 12px; font: inherit; font-weight: 600; font-size: 16px;
  color: var(--text); background: var(--surface-2); border: 2px solid transparent; cursor: pointer; }
.team-btn img { width: 44px; height: 44px; border-radius: 50%; }
.team-btn.heads { --c: var(--heads); }
.team-btn.tails { --c: var(--tails); }
.team-btn:hover { border-color: color-mix(in oklab, var(--c) 50%, transparent); }
.team-btn[aria-pressed="true"] { border-color: var(--c); background: color-mix(in oklab, var(--c) 16%, var(--surface)); }
.team-btn:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.team-you { margin: 12px 0 0; color: var(--text-2); min-height: 1.5em; }

.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.two .card { margin-bottom: 16px; }

/* feed */
#feed { list-style: none; margin: 12px 0 0; padding: 0; max-height: 380px; overflow-y: auto; }
#feed li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
#feed li:last-child { border-bottom: 0; }
#feed li.empty { color: var(--muted); display: block; }
#feed img { width: 36px; height: 36px; border-radius: 50%; flex: none; }
#feed .what { flex: 1; min-width: 0; }
#feed .what b { display: block; }
#feed .what small { color: var(--muted); }
#feed .when { color: var(--muted); font-size: 13px; white-space: nowrap; text-decoration: none; }
#feed .when:hover { text-decoration: underline; }
#feed li.new { animation: flipin .7s ease; }
@keyframes flipin { from { transform: rotateX(90deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* flip toy */
.flip { text-align: center; }
.flipper { position: relative; width: 200px; height: 200px; margin: 16px auto 8px; display: block; border: 0; padding: 0; background: none; cursor: pointer;
  transform-style: preserve-3d; transition: transform 1.6s cubic-bezier(.2,.7,.2,1); border-radius: 50%; }
.flipper:focus-visible { outline: 3px solid var(--text); outline-offset: 6px; }
.face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 50%; overflow: hidden; }
.face img { width: 100%; height: 100%; display: block; }
.face.back { transform: rotateY(180deg); }
.flip-result { min-height: 3em; color: var(--text-2); }
.flip-result b { font-size: 20px; }
.flip-buy { margin: 10px auto 6px; max-width: 260px; }
.flip-buy.heads { --c: var(--heads); }
.flip-buy.tails { --c: var(--tails); }
.flip-result small { display: block; color: var(--muted); }

/* how */
.steps { padding-left: 20px; color: var(--text-2); }
.steps li { margin-bottom: 8px; }
.steps b { color: var(--text); }
.split { background: var(--surface-2); border-radius: 10px; padding: 16px; }
.split-row { margin-bottom: 8px; }
.pill { display: inline-block; min-width: 52px; text-align: center; padding: 2px 8px; border-radius: 999px; background: var(--text); color: var(--page); font-weight: 600; margin-right: 8px; }
.pill.dim { background: var(--line); color: var(--text); }
.lock { margin: 8px 0 0; font-size: 14px; color: var(--text-2); }
.lock a { color: var(--text); }

footer { color: var(--muted); font-size: 13px; padding-top: 16px; padding-bottom: 48px; text-align: center; }
footer .social { font-size: 15px; color: var(--text-2); }
footer .social a { font-weight: 600; }

/* ---- phones ---- */
@media (max-width: 760px) {
  .duel { grid-template-columns: 1fr; }
  .vs { text-align: center; margin: -4px 0; }
  .two { grid-template-columns: 1fr; }
  .side, .card { padding: 20px 16px; }
  .bar-row { grid-template-columns: 76px 1fr auto; gap: 8px; }
  .bar-val { min-width: 0; }
  .team-btn { font-size: 15px; }
}

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