/* Hallmark · macrostructure: Workbench-lite (product proof first) · tone: plain, confident
 * theme: studied-DNA (source: user's logo file) · paper oklch(0.987 0.004 85) · accent oklch(0.51 0.19 27)
 * display + body: Rubik (600/700, not 800) · data: IBM Plex Mono · nav: N1b · footer: Ft minimal
 * enrichment: hand-built side-by-side players (real run timings) + real popup screenshot
 */

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--font-display); font-style: normal; margin: 0; overflow-wrap: anywhere; min-width: 0; }
p { margin: 0; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; border-radius: var(--radius-sm); }

main, .top, .foot { width: min(var(--page), 100% - 2 * var(--space-lg)); margin-inline: auto; }
section { scroll-margin-top: var(--space-xl); }
h2 { font-size: var(--text-2xl); font-weight: 700; line-height: 1.1; letter-spacing: -0.025em; text-wrap: balance; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  min-height: 50px; padding: 0 var(--space-xl); border-radius: var(--radius-pill);
  background: var(--color-ink); color: var(--color-on-dark);
  font: 500 var(--text-md) var(--font-body); white-space: nowrap; text-decoration: none;
  border: 1.5px solid var(--color-ink);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.btn[aria-disabled="true"] { cursor: default; }
.btn-sm { min-height: 38px; padding: 0 var(--space-lg); font-size: var(--text-sm); }
.btn-ghost { background: transparent; color: var(--color-ink); border-color: var(--color-rule); }
.btn-ghost:hover { border-color: var(--color-ink); }
.btn-ghost:active { background: var(--color-tile); }
.btn-light { background: var(--color-on-dark); color: var(--color-ink); border-color: var(--color-on-dark); }

/* ---------- Header ---------- */
.top { display: flex; align-items: center; gap: var(--space-xl); padding-block: var(--space-lg); }
.brand { display: inline-flex; align-items: center; gap: var(--space-sm); text-decoration: none; color: inherit; margin-right: auto; }
/* The die by itself, at exact pixel sizes per screen scale (srcset). */
.brand-mark { width: 32px; height: 32px; }
.brand-word { height: 22px; width: auto; }
.nav { display: flex; gap: var(--space-lg); }
.nav a { font-size: var(--text-sm); color: var(--color-ink-2); text-decoration: none; white-space: nowrap; transition: color var(--dur-fast) var(--ease-out); }
.nav a:hover { color: var(--color-ink); }
.nav a:active { color: var(--color-red); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding-block: var(--space-xl) var(--space-xl); display: grid; justify-items: center; }
.hero h1 { font-size: var(--text-hero); font-weight: 700; line-height: 1; letter-spacing: -0.04em; }
.hero h1 .line { display: inline-block; }
/* The "o" in "Reroll" is the red refresh arrow. The real letter stays in the text (copy,
   search, screen readers) but is transparent, and the arrow sits on its ink. Measured from
   Rubik 700: ink center 0.305em from the glyph's left and 0.675em from its top, 0.54em tall.
   The arrow files put the ring at 96% of their side, so they're 0.5625em square. */
.arrow-o { position: relative; color: transparent; }
.arrow-o img {
  position: absolute; width: 0.5625em; height: 0.5625em; max-width: none; pointer-events: none;
  left: calc(0.305em - 0.28125em); top: calc(0.675em - 0.28125em);
}
.lede { margin-top: var(--space-md); max-width: 54ch; font-size: var(--text-lg); line-height: 1.45; color: var(--color-ink-2); text-wrap: pretty; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-sm); margin-top: var(--space-lg); }

/* ---------- Side by side ---------- */
.versus {
  background: var(--color-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: var(--space-xl) var(--space-2xl) var(--space-2xl); margin-bottom: var(--space-4xl);
}
.versus-label { font-weight: 600; color: var(--color-ink-2); }
.versus-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg); flex-wrap: wrap; }
.tabs { display: inline-flex; padding: 4px; border-radius: var(--radius-pill); background: var(--color-tile); }
.tabs button {
  font: 500 var(--text-sm) var(--font-body); color: var(--color-ink-2); background: transparent;
  border: 0; border-radius: var(--radius-pill); min-height: 36px; padding: 0 var(--space-lg); cursor: pointer; white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.tabs button:hover { color: var(--color-ink); }
.tabs button[aria-selected="true"] { background: var(--color-card); color: var(--color-ink); box-shadow: var(--shadow-card); }

.race { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xl); margin-top: var(--space-lg); }
.side { margin: 0; }
.side-name { display: flex; align-items: center; gap: var(--space-xs); font-weight: 600; margin-bottom: var(--space-sm); }
.side-name img { width: 20px; height: 20px; }
.side-wait .side-name { color: var(--color-ink-2); }
.side-reroll .side-name { color: var(--color-red); }

/* A video player like the ones everyone knows (no site's logo or exact design). Everything
   inside scales with the player's width (cqw), so a phone shows the same picture smaller. */
.player {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-md); overflow: hidden;
  background: var(--color-screen); container-type: inline-size;
}
.ph { position: absolute; inset: 0; opacity: 0; transition: opacity 120ms var(--ease-out); }
.player[data-phase="load"] .ph-load,
.player[data-phase="ad"] .ph-ad,
.player[data-phase="panel"] .ph-panel,
.player[data-phase="video"] .ph-video { opacity: 1; }

/* Your video */
.ph-video { display: grid; place-items: center; background: linear-gradient(var(--color-video-sky), var(--color-video-ground)); }
.ph-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vid-note { position: relative; color: var(--color-on-dark); font-weight: 500; font-size: clamp(11px, 3.4cqw, 17px); }
.player.has-video .vid-note { display: none; }

/* Loading */
.ph-load { display: grid; place-items: center; }
.spin {
  width: 10cqw; aspect-ratio: 1; border-radius: 50%;
  border: max(2px, 0.9cqw) solid var(--color-on-dark-track); border-top-color: var(--color-on-dark);
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

/* The made-up ad */
.ph-ad { background: linear-gradient(120deg, var(--color-adv-1), var(--color-adv-2)); }
.ad-art { position: absolute; inset: 0 0 9cqw; display: flex; align-items: center; justify-content: space-between; padding: 0 9cqw; }
.ad-brand { font-weight: 700; font-size: 3cqw; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-adv-ink); }
.ad-line { position: relative; height: 1.1em; width: 50cqw; margin-top: 0.8cqw; font-weight: 700; font-size: 6.4cqw; line-height: 1.1; letter-spacing: -0.03em; color: var(--color-adv-ink); }
.ad-line span { position: absolute; left: 0; top: 0; white-space: nowrap; animation: adline 6s var(--ease-in-out) infinite; }
.ad-line span + span { animation-delay: -3s; }
@keyframes adline {
  0%, 44% { opacity: 1; transform: none; }
  50%, 94% { opacity: 0; transform: translateY(0.2em); }
  100% { opacity: 1; transform: none; }
}
.ad-bag { width: 21cqw; height: auto; rotate: -8deg; filter: drop-shadow(var(--shadow-bag)); animation: bob 2.4s var(--ease-in-out) infinite alternate; }
@keyframes bob { to { transform: translateY(-2cqw); } }
.ad-badge, .ad-after {
  position: absolute; display: inline-flex; align-items: center; gap: 0.8cqw; padding: 0.5cqw 1.4cqw;
  border-radius: 0.8cqw; background: var(--color-player-chip); color: var(--color-on-dark); font-size: max(8px, 2.3cqw); font-weight: 500;
}
.ad-badge { left: 2.4cqw; bottom: 9.5cqw; font-weight: 600; }
.ad-badge span { color: var(--color-ad); }
.ad-after { right: 2.4cqw; top: 2.4cqw; }
.ad-cta {
  position: absolute; right: 2.4cqw; bottom: 9.5cqw; padding: 0.9cqw 2.2cqw; border-radius: var(--radius-pill);
  background: var(--color-on-dark); color: var(--color-ink); font-weight: 600; font-size: 2.3cqw;
}

/* Reroll's loading panel: the extension's own look (reroll/src/overlay.js), scaled to the player. */
.ph-panel {
  z-index: 2; display: grid; place-items: center; align-content: center; gap: 1.6cqw;
  background: var(--color-panel); color: var(--color-on-dark); text-align: center;
  font: 600 clamp(10px, 2.6cqw, 17px) / 1.3 var(--font-system);
}
.ph-panel img { width: 14%; height: auto; animation: roll 1.2s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
@keyframes roll {
  0% { transform: rotate(0) translateY(0); }
  40% { transform: rotate(200deg) translateY(-12%); }
  70% { transform: rotate(350deg) translateY(0); }
  100% { transform: rotate(360deg); }
}
.panel-stop {
  position: absolute; bottom: 1.8cqw; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font: 500 clamp(8px, 1.9cqw, 12.5px) var(--font-system); color: var(--color-panel-dim);
  background: var(--color-panel-chip); border-radius: var(--radius-pill); padding: 0.8cqw 1.6cqw;
}
@container (max-width: 300px) { .panel-stop { display: none; } }

/* Control bar */
.ctrl {
  position: absolute; inset: auto 0 0; z-index: 1; padding: 0 2cqw 1.2cqw; color: var(--color-on-dark);
  background: linear-gradient(transparent, var(--color-player-chip)); transition: opacity 120ms var(--ease-out);
}
.player[data-phase="load"] .ctrl { opacity: 0; }
.ctrl-track { position: relative; height: max(2px, 0.6cqw); margin-bottom: 1cqw; border-radius: var(--radius-pill); overflow: hidden; background: var(--color-on-dark-track); }
.ctrl-track span { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--color-red); }
.player[data-phase="ad"] .ctrl-track span { background: var(--color-ad); }
.ctrl-row { display: flex; align-items: center; gap: 2cqw; height: max(12px, 4.6cqw); }
.ctrl-row svg { height: 100%; width: auto; fill: currentColor; }
.ctrl-time { font-size: max(8px, 2.3cqw); font-weight: 500; white-space: nowrap; }
.ctrl-gap { flex: 1; }
@container (max-width: 220px) { .ad-after, .ad-cta, .ctrl-time { display: none; } }

.side-status { display: flex; align-items: baseline; gap: var(--space-sm); margin-top: var(--space-sm); color: var(--color-ink-2); }
.clock { font-family: var(--font-mono); font-weight: 500; font-size: var(--text-xl); color: var(--color-ink); min-width: 3.2ch; }
.side-reroll.is-done .clock { color: var(--color-red); }

.result { margin-top: var(--space-xl); text-align: center; font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em; min-height: 1.5em; opacity: 0; transform: translateY(6px); transition: opacity var(--dur-med) var(--ease-out), transform var(--dur-med) var(--ease-out); }
.result { text-wrap: balance; }
.result.on { opacity: 1; transform: none; }
.result strong { color: var(--color-red); font-weight: 700; white-space: nowrap; }
.note { margin-top: var(--space-xs); text-align: center; font-size: var(--text-xs); color: var(--color-ink-3); }
.note a { color: inherit; text-underline-offset: 2px; }
.note a:hover { color: var(--color-ink); }

/* ---------- Cards ---------- */
.cards { margin-bottom: var(--space-4xl); }
.cards h2 { max-width: 20ch; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); margin-top: var(--space-2xl); }
.card { background: var(--color-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: var(--space-md) var(--space-md) var(--space-xl); }
.card h3 { font-size: var(--text-lg); font-weight: 600; margin: var(--space-lg) var(--space-sm) 0; letter-spacing: -0.01em; }
.card p { margin: var(--space-xs) var(--space-sm) 0; color: var(--color-ink-2); font-size: var(--text-sm); }
.card-art { height: 220px; border-radius: var(--radius-md); display: grid; place-items: center; overflow: hidden; }
.card-pop .card-art { background: var(--color-tile); align-items: start; padding-top: var(--space-lg); }

/* The first two cards show the same player as the comparison above, frozen on one moment. */
.card-art .player { width: 100%; height: 100%; aspect-ratio: auto; border-radius: inherit; }
.ph-video .frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.resume {
  position: absolute; left: 4cqw; top: 4cqw; display: inline-flex; align-items: center; gap: 2cqw;
  padding: 1.6cqw 3cqw; border-radius: var(--radius-pill); background: var(--color-player-chip); color: var(--color-on-dark);
  font: 500 max(11px, 3.6cqw) var(--font-body);
}
.resume-old { color: var(--color-on-dark-dim); }
.resume-arrow { color: var(--color-red); font-weight: 700; }
.resume-new { font-weight: 700; }
.ctrl-track .at-spot { width: 45.9%; } /* 1:09:19 of 2:31:04 */

.card-art-pop img { width: 62%; border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); }

/* ---------- Facts: one die face per point ---------- */
.facts { margin-bottom: var(--space-4xl); }
.facts ul {
  list-style: none; margin: 0; padding: var(--space-xl);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-xl);
  background: var(--color-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.facts li { display: grid; gap: var(--space-2xs); align-content: start; color: var(--color-ink-2); font-size: var(--text-sm); }
.facts strong { color: var(--color-ink); font-weight: 600; font-size: var(--text-md); margin-top: var(--space-md); }
.face {
  width: 48px; height: 48px; padding: 9px; border-radius: 13px; background: var(--color-red);
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  box-shadow: inset 0 -3px 0 var(--color-red-deep);
  transition: transform var(--dur-med) var(--ease-out);
}
.facts li:hover .face { transform: rotate(-10deg) translateY(-2px); }
.face i { width: 8px; height: 8px; border-radius: 50%; background: var(--color-on-dark); place-self: center; }
.face .p1 { grid-area: 1 / 1; } .face .p3 { grid-area: 1 / 3; }
.face .p5 { grid-area: 2 / 2; }
.face .p7 { grid-area: 3 / 1; } .face .p9 { grid-area: 3 / 3; }

/* ---------- Pricing ---------- */
.pricing { margin-bottom: var(--space-4xl); text-align: center; }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-lg); max-width: 760px; margin: var(--space-2xl) auto 0; text-align: left; }
.plan { background: var(--color-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: var(--space-xl); }
.plan-pro { box-shadow: 0 0 0 2px var(--color-ink), var(--shadow-card); }
.plan-name { font-weight: 600; }
.plan-pro .plan-name { color: var(--color-red); display: flex; align-items: center; gap: var(--space-xs); }
.plan-tag {
  font-size: var(--text-xs); font-weight: 600; color: var(--color-red); background: var(--color-red-soft);
  border-radius: var(--radius-pill); padding: 1px 10px; white-space: nowrap;
}
.pricing-note { max-width: 52ch; margin: var(--space-md) auto 0; color: var(--color-ink-2); text-wrap: pretty; }
.plan-price { display: flex; align-items: baseline; gap: var(--space-xs); margin-top: var(--space-xs); }
.amt { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; }
.per { color: var(--color-ink-2); font-size: var(--text-sm); }
.plan ul { list-style: none; margin: var(--space-lg) 0 0; padding: 0; }
.plan li { padding: var(--space-xs) 0 var(--space-xs) var(--space-lg); position: relative; color: var(--color-ink-2); }
.plan li::before { content: ''; position: absolute; left: 2px; top: 0.95em; width: 8px; height: 8px; border-radius: 50%; background: var(--color-red); }

/* ---------- FAQ ---------- */
.faq { margin-bottom: var(--space-4xl); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-2xl); }
.faq-list details { border-bottom: var(--rule); }
.faq-list details:first-child { border-top: var(--rule); }
.faq summary {
  cursor: pointer; list-style: none; padding: var(--space-lg) 0; font-weight: 500; font-size: var(--text-lg);
  display: flex; justify-content: space-between; gap: var(--space-md);
  transition: color var(--dur-fast) var(--ease-out);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--color-ink-3); font-weight: 400; transition: transform var(--dur-fast) var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--color-red); }
.faq details p { padding-bottom: var(--space-lg); color: var(--color-ink-2); max-width: var(--measure); }

/* ---------- Closer ---------- */
.closer {
  position: relative; overflow: hidden; margin-bottom: var(--space-3xl);
  background: var(--color-ink); color: var(--color-on-dark); border-radius: var(--radius-lg);
  padding: var(--space-3xl) var(--space-2xl); display: grid; justify-items: start; gap: var(--space-sm);
}
.closer h2 { font-size: var(--text-2xl); max-width: 14ch; }
.closer p { color: var(--color-on-dark-dim); }
.closer .btn { margin-top: var(--space-md); }
.closer-die { position: absolute; right: 6%; top: 50%; width: 240px; transform: translateY(-50%) rotate(14deg); }

/* ---------- Footer ---------- */
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-xl); padding-block: var(--space-xl) var(--space-2xl); font-size: var(--text-xs); color: var(--color-ink-3); }
.foot .brand-mark { width: 22px; height: 22px; }
.foot .brand-word { height: 16px; }
.foot-links { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); }
.foot-links a { color: var(--color-ink-2); text-decoration: none; white-space: nowrap; transition: color var(--dur-fast) var(--ease-out); }
.foot-links a:hover, .foot-links a[aria-current="page"] { color: var(--color-ink); }
.foot-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Terms, privacy, 404 ---------- */
.doc { max-width: 68ch; padding-block: var(--space-2xl) var(--space-3xl); }
.doc h1 { font-size: var(--text-2xl); font-weight: 700; line-height: 1.1; letter-spacing: -0.025em; }
.doc-date { margin-top: var(--space-xs); font-size: var(--text-sm); color: var(--color-ink-3); }
.doc-lede, .doc-summary { margin-top: var(--space-lg); }
.doc-summary { padding: var(--space-md) var(--space-lg); border-radius: var(--radius-md); background: var(--color-card); box-shadow: var(--shadow-card); }
.doc h2 { margin-top: var(--space-2xl); font-size: var(--text-xl); letter-spacing: -0.015em; scroll-margin-top: var(--space-lg); }
.doc h3 { margin-top: var(--space-lg); font-size: var(--text-md); font-weight: 600; }
.doc p, .doc li { color: var(--color-ink-2); }
.doc p { margin-top: var(--space-sm); }
.doc h2 + p, .doc h3 + p { margin-top: var(--space-xs); }
.doc strong { color: var(--color-ink); font-weight: 600; }
.doc ul { margin: var(--space-sm) 0 0; padding-left: 1.2em; display: grid; gap: var(--space-xs); }
.doc li::marker { color: var(--color-red); }
.doc a:not(.btn), .faq a, .doc-lede a { color: var(--color-ink); text-decoration-color: var(--color-red); text-underline-offset: 3px; }
.doc a:not(.btn):hover, .faq a:hover { color: var(--color-red); }
.doc-404 { text-align: center; margin-inline: auto; display: grid; justify-items: center; gap: var(--space-sm); padding-block: var(--space-3xl) var(--space-4xl); }
.doc-404 .doc-die { width: 120px; rotate: 14deg; }
.doc-404 .btn { margin-top: var(--space-sm); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .card-art { height: 200px; }
  .facts ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .faq { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .versus { padding: var(--space-lg); }
  .race { gap: var(--space-sm); }
  .side-name { font-size: var(--text-sm); }
  .side-status { flex-direction: column; gap: 0; font-size: var(--text-sm); }
  .clock { font-size: var(--text-lg); }
  .result { font-size: var(--text-lg); }
  .plans { grid-template-columns: minmax(0, 1fr); }
  .closer { padding: var(--space-2xl) var(--space-lg); }
  /* Phones: the die sits whole under the button instead of hanging off the edge. */
  .closer-die { position: static; order: 1; justify-self: center; width: 150px; margin-top: var(--space-lg); transform: rotate(14deg); }
}
@media (max-width: 520px) {
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 0 var(--space-xs); }
  /* The header button collided with the wordmark; the same button sits right under the headline. */
  .top .btn-sm { display: none; }
}
@media (max-width: 420px) {
  .facts ul { grid-template-columns: minmax(0, 1fr); }
  /* Keeps "With Reroll" on one line so both players stay level. */
  .side-name img { display: none; }
}
@media (max-width: 360px) {
  .tabs button { font-size: var(--text-xs); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ph, .result { transition: none; }
  .spin, .ad-line span, .ad-bag, .ph-panel img { animation: none !important; }
  .ad-line span + span { display: none; }
}
