/* Site chrome: header, nav, prose pages, ad slots, footer, consent banner.
   The scorekeeper's own styles live in styles.css and are loaded only on the
   page that runs it. Tokens are shared — this file defines them. */

:root {
  --bg: #16161d;
  --surface: #1f1f29;
  --surface-2: #2a2a36;
  --line: #383848;
  --text: #f2f2f7;
  --muted: #a0a0b4;
  --accent: #ffb238;
  --accent-ink: #2a1c00;
  --good: #4ade80;
  --bad: #f87171;
  --radius: 14px;
  --tap: 48px;
  --measure: 34rem;
  color-scheme: dark light;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --surface-2: #efeee9;
    --line: #dedbd2;
    --text: #1d1d22;
    --muted: #5f5f6d;
    --accent: #b26a00;
    --accent-ink: #ffffff;
    --good: #128a4a;
    --bad: #c2321f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }
a:hover { color: var(--accent); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  z-index: 20;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Header and nav ──────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; font-size: 1.05rem; }
.brand-name { text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.brand-name strong { color: var(--accent); }

.brand-mark { width: 1.5rem; height: 1.5rem; flex: none; color: var(--accent); }

.site-nav { display: flex; flex-wrap: wrap; gap: 0.15rem 0.35rem; margin-left: auto; }

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current='page'] { color: var(--accent-ink); background: var(--accent); font-weight: 600; }

/* ── Main ────────────────────────────────────────────── */
main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

/* ── Prose pages ─────────────────────────────────────── */
.prose { font-size: 1.02rem; }
.prose.narrow { max-width: 32rem; }

.prose h1 { font-size: 1.7rem; line-height: 1.25; margin: 0.6rem 0 0.4rem; }
.prose h2 { font-size: 1.22rem; margin: 2rem 0 0.5rem; }
.prose h3 { font-size: 1.02rem; margin: 1.4rem 0 0.35rem; }
.prose p { margin: 0.7rem 0; }
.prose ul, .prose ol { margin: 0.7rem 0; padding-left: 1.3rem; }
.prose li { margin: 0.4rem 0; }
.prose li > ul { margin: 0.35rem 0; }
.prose code { background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 5px; font-size: 0.9em; }

.lede { font-size: 1.1rem; color: var(--muted); margin-top: 0; }
.updated { color: var(--muted); font-size: 0.85rem; margin-top: 0; }

.note {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.7rem 0.9rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.formula { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem; }

.contact-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; font-size: 1.05rem; }

.steps > li { margin: 0.7rem 0; }

/* ── Tables ──────────────────────────────────────────── */
.chart { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.92rem; }
.chart caption { text-align: left; color: var(--muted); font-size: 0.82rem; padding-bottom: 0.4rem; }
.chart th, .chart td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); }
.chart th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.chart tbody tr:nth-child(odd) { background: var(--surface); }
.chart td:last-child, .chart th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.chart td:last-child { font-weight: 600; }

/* ── App page extras ─────────────────────────────────── */
.app-intro h1 { font-size: 1.5rem; margin: 0.4rem 0 0.3rem; }
.app-intro .lede { font-size: 0.98rem; margin-bottom: 1rem; }

.app-actions { display: flex; gap: 0.4rem; justify-content: flex-end; margin-bottom: 0.75rem; }

.icon-button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.icon-button:hover { border-color: var(--accent); }

/* Separate the supporting copy from the working tool above it. */
.prose.after-app { border-top: 1px solid var(--line); margin-top: 2rem; padding-top: 0.5rem; }

/* ── Ad slots ────────────────────────────────────────── */
/* Ads sit outside <main> and never between the dice and the buttons, so a
   mis-tap during a game cannot land on one. */
.ad-slot {
  max-width: 62rem;
  margin: 1rem auto;
  padding: 0 1rem;
  text-align: center;
  min-height: 0;
}

.ad-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.ad-slot ins { display: block; }

/* ── Footer ──────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: 2.5rem;
  padding-bottom: env(safe-area-inset-bottom);
}

.footer-inner { max-width: 62rem; margin: 0 auto; padding: 1.5rem 1rem; }

.site-footer ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; padding: 0; margin: 0 0 1rem; }
.site-footer a { color: var(--muted); text-decoration: none; font-size: 0.88rem; }
.site-footer a:hover { color: var(--accent); }
.footer-note { color: var(--muted); font-size: 0.8rem; margin: 0; max-width: 42rem; }

/* ── Consent banner ──────────────────────────────────── */
.consent {
  position: fixed;
  inset: auto 0 0 0;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}

.consent-inner {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0.9rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.consent p { margin: 0; font-size: 0.85rem; flex: 1 1 18rem; color: var(--muted); }
.consent a { color: var(--accent); }
.consent-actions { display: flex; gap: 0.5rem; margin-left: auto; }

/* Buttons shared with the app. */
.button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  min-height: var(--tap);
  padding: 0 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.button.ghost { background: transparent; }
.button.small { min-height: 38px; font-size: 0.85rem; padding: 0 0.85rem; }

@media (min-width: 46rem) {
  main { max-width: 42rem; }
  .prose { font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
