/* betting-forecast demo landing: one column, system fonts (CSP forbids external resources),
   light and dark themes via tokens; the manual theme choice is the data-theme attribute on <html>. */
:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eceff3;
  --fg: #141a21;
  --muted: #5f6b78;
  --line: #d8dee6;
  --accent: #0f7b6c;
  --accent-soft: #d9f0ea;
  --accent-ink: #0a5a4f;
  --ok: #1f7a4d;
  --warn: #9a6400;
  --crit: #b53a2b;
  --crit-soft: #f8e1dd;
  --live: #c2410c;
  --shadow: 0 1px 2px rgba(20, 26, 33, 0.06), 0 8px 24px rgba(20, 26, 33, 0.06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1318; --surface: #161c23; --surface-2: #1f2730; --fg: #e6ebf0; --muted: #98a4b1; --line: #2b3541;
    --accent: #3fc9b3; --accent-soft: #123a35; --accent-ink: #bff0e6; --ok: #5bc78f; --warn: #e2b24f;
    --crit: #f08a7b; --crit-soft: #3d231f; --live: #fb923c; --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1318; --surface: #161c23; --surface-2: #1f2730; --fg: #e6ebf0; --muted: #98a4b1; --line: #2b3541;
  --accent: #3fc9b3; --accent-soft: #123a35; --accent-ink: #bff0e6; --ok: #5bc78f; --warn: #e2b24f;
  --crit: #f08a7b; --crit-soft: #3d231f; --live: #fb923c; --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, pre, .mono { font-family: var(--mono); font-size: 0.92em; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--fg); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 22px; height: 22px; color: var(--accent); }
.links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.top .links { margin-left: 6px; }
.controls { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--fg); padding: 0; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
#theme-toggle .sun { display: none; }
#theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) #theme-toggle .moon { display: none; }
}
:root[data-theme="dark"] #theme-toggle .sun { display: block; }
:root[data-theme="dark"] #theme-toggle .moon { display: none; }

/* Containers */
main { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 0 48px; }
.section { padding-top: 44px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 18px; margin-bottom: 14px; }
.section-head h2 { font-size: 24px; font-weight: 700; }
.section-head p { margin: 0; font-size: 14px; }
.toolbar { display: flex; align-items: center; gap: 12px; font-size: 14px; }

/* Hero with the key check */
.hero { padding-top: 56px; max-width: 760px; }
.eyebrow { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-size: clamp(30px, 4.6vw, 48px); font-weight: 800; }
.lede { margin: 16px 0 26px; font-size: 18px; color: var(--muted); max-width: 64ch; }
.key-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.key-row { display: flex; gap: 8px; align-items: stretch; }
.key-row input { flex: 1 1 240px; min-width: 0; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--fg); font-family: var(--mono); font-size: 15px; }
.key-row input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.key-row .icon-btn { width: 44px; height: auto; border-radius: 12px; }
.primary { padding: 11px 18px; border: 0; border-radius: 12px; background: var(--accent); color: #ffffff; font-weight: 700; white-space: nowrap; }
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: 0.6; cursor: wait; }
.key-aux { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.key-info { margin-top: 18px; display: inline-flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; }
.key-info strong { font-weight: 700; }
.key-info .pill { padding: 1px 8px; border-radius: 999px; background: var(--surface); color: var(--fg); font-size: 12px; font-weight: 600; }
.error { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--crit-soft); color: var(--crit); font-size: 14px; }
.error .trace { display: block; margin-top: 4px; font-family: var(--mono); font-size: 12px; opacity: 0.85; }

/* Disciplines */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--fg); font-size: 14px; font-weight: 600; transition: border-color 0.15s, background 0.15s; }
.chip svg { width: 20px; height: 20px; color: var(--muted); }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.chip.active svg { color: #ffffff; }
.chip .kind { font-size: 11px; font-weight: 500; color: var(--muted); }
.chip.active .kind { color: rgba(255, 255, 255, 0.8); }
.chips .placeholder { color: var(--muted); font-size: 14px; }

/* Forecasts */
.legend { margin: 0 0 14px; font-size: 13px; max-width: 80ch; }
.empty { padding: 28px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.card .meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.card .meta .comp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card .teams { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card .teams .names { display: grid; gap: 2px; min-width: 0; font-size: 17px; font-weight: 700; }
.card .teams .names span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .teams .names .vs { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.08em; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.pill.live { border-color: var(--live); color: var(--live); }
.market { border-top: 1px solid var(--line); padding-top: 10px; }
.market .title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.outcome { display: grid; grid-template-columns: 1fr 54px 56px; gap: 10px; align-items: center; font-size: 14px; margin-top: 6px; }
.outcome .name { display: grid; gap: 4px; min-width: 0; }
.outcome .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.outcome .bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.outcome .bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.4s ease; }
.outcome .pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.outcome .odds { text-align: right; color: var(--muted); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.card .foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.card .foot .tag { font-family: var(--mono); font-size: 11px; opacity: 0.6; }
.more-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.ghost { padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 600; font-size: 14px; }
.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Footer */
.foot { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 18px 32px; border-top: 1px solid var(--line); }
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.foot p { margin: 10px 0 0; max-width: 80ch; }

@media (max-width: 640px) {
  .top { gap: 10px; }
  .top .links { display: none; }
  .hero { padding-top: 36px; }
  .lede { font-size: 16px; }
  .key-row { flex-wrap: wrap; }
  .key-row input { flex-basis: 100%; }
  .primary { flex: 1 1 auto; }
  .outcome { grid-template-columns: 1fr 50px 52px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .outcome .bar i, .chip { transition: none; }
}
