/* 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;
  --buy: #2fbf71;
  --sell: #ef4f5a;
}
@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;
    --buy: #1a9b57;
    --sell: #d93a46;
  }
}

* { 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); }
/* the next banner fades in on top of the current one, then takes its place */
#banner-next { position: absolute; inset: 0; opacity: 0; transition: opacity .9s ease; box-shadow: none; pointer-events: none; }
#banner-next.show { opacity: 1; }
.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: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: center; margin-bottom: 16px; }
.side { min-width: 0; 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; }
.ca { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.ca:hover { border-color: var(--c); }
.ca:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.ca[hidden] { display: none; }
.ca-label { font-weight: 600; color: var(--muted); }
.ca code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); user-select: all; }
.ca-copy { font-weight: 600; color: var(--c); white-space: nowrap; }

/* ---- live chart (site/public/chart.js) ---- */
.live { margin: 0 0 20px; text-align: left; }
.live[hidden] { display: none; }
.live-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.live-mcap { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.live-chg { font-size: 13px; font-weight: 600; }
.live-chg.up { color: var(--buy); }
.live-chg.down { color: var(--sell); }
.live-tag { margin-left: auto; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.live-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--buy); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
.live-chart { position: relative; height: 200px; border-radius: 10px; background: var(--surface-2); }
.live-chart canvas { display: block; border-radius: 10px; width: 100%; height: 100%; touch-action: pan-y; cursor: crosshair; }
.live-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.tip { position: absolute; pointer-events: none; background: var(--page); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px; line-height: 1.4; color: var(--text-2); white-space: nowrap; box-shadow: 0 4px 16px rgb(0 0 0 / .3); }
.tip b { color: var(--text); }
.tip[hidden] { display: none; }
.pops { position: absolute; left: 8px; bottom: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none; }
.pop { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; color: #fff; background: var(--c); animation: pop 3.2s ease forwards; white-space: nowrap; }
@keyframes pop { 0% { transform: translateY(12px) scale(.6); opacity: 0; } 10% { transform: none; opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-24px); opacity: 0; } }
.live-sound { font-size: 15px; line-height: 1; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: none; cursor: pointer; }
.live-sound[aria-pressed="true"] { border-color: var(--c); }
.live-sound:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
/* the coin that springs out of the chart on a buy: up, spinning, then gone (above the card, like Mario's) */
.coins { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.jump { position: absolute; border-radius: 50%; animation: coinjump 1.05s cubic-bezier(.25,.9,.35,1) forwards; filter: drop-shadow(0 3px 6px rgb(0 0 0 / .45)); }
@keyframes coinjump {
  0% { transform: translateY(0) rotateY(0) scale(.4); opacity: 0; }
  12% { opacity: 1; transform: translateY(-18px) rotateY(180deg) scale(1); }
  55% { transform: translateY(-120px) rotateY(900deg) scale(1.15); opacity: 1; }
  100% { transform: translateY(-80px) rotateY(1440deg) scale(.8); opacity: 0; }
}
/* ---- 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; }

/* burn now */
.burn-now { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-items: center; }
.burn-now .hint { margin-bottom: 0; }
.burn-btn { font: inherit; font-weight: 600; font-size: 18px; padding: 14px 28px; border-radius: 12px; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(90deg, var(--heads), var(--tails)); white-space: nowrap; }
.burn-btn:disabled { background: var(--surface-2); color: var(--muted); cursor: default; }
.burn-btn:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.burn-status { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--text-2); min-height: 1.4em; }
.burn-last { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--muted); }

/* 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: 168px minmax(0, 1fr) 132px; 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-quiet { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 14px; line-height: 1.5; }
.feed-quiet[hidden] { display: none; }
.feed-quiet a { color: var(--text); font-weight: 600; }
#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: minmax(0, 1fr); }
  .vs { text-align: center; margin: -4px 0; }
  .two { grid-template-columns: 1fr; }
  .side, .card { padding: 20px 16px; }
  .bar-row { grid-template-columns: minmax(0, 1fr) 116px; grid-template-areas: 'label label' 'track val'; gap: 4px 8px; }
  .bar-label { grid-area: label; font-size: 13px; }
  .bar-track { grid-area: track; }
  .bar-val { grid-area: val; }
  .burn-now { grid-template-columns: 1fr; }
  .burn-btn { width: 100%; }
  .bar-val { min-width: 0; }
  .team-btn { font-size: 15px; }
  .live-chart { height: 180px; }
}

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