/*
 * The demo page.
 *
 * Two jobs, kept apart on purpose:
 *
 *   `.page`     a plausible operator's sportsbook — the room the widget sits
 *               in. Opaque cards on a switchable backdrop, which is what gives
 *               the glass something worth refracting.
 *   `.console`  the demo harness. Deliberately flat and grey: if it were glass
 *               too, a viewer could not tell which panel is the product.
 *
 * Nothing here styles the widget. It cannot — the widget is a shadow root, and
 * that is the point being demonstrated.
 */

:root {
  --ink: #16141f;
  --ink-muted: #5c5870;
  --ink-faint: #8d89a0;
  --card: #ffffff;
  --card-line: rgba(22, 20, 31, 0.08);
  --accent: #5223d3;
  --page-shadow: 0 1px 2px rgba(16, 12, 32, 0.04), 0 8px 24px rgba(16, 12, 32, 0.06);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif;
}

/* The page tone follows the backdrop, not the operating system: picking
   "Midnight" should darken the sportsbook whatever the OS prefers. */
body[data-tone="dark"] {
  --ink: #f2f0f9;
  --ink-muted: #a9a4c0;
  --ink-faint: #7d7897;
  --card: #16121f;
  --card-line: rgba(255, 255, 255, 0.09);
  --page-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  background: #f9f8fd;
}

/* ── Backdrops ─────────────────────────────────────────────────────────────
   Fixed and behind everything. Each is built from layered gradients rather
   than an image file, so the page is genuinely standalone — no network, no
   assets directory, nothing to lose. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  transition: opacity 0.6s ease, filter 0.6s ease;
}

body[data-backdrop="studio"] .backdrop {
  background:
    radial-gradient(120% 80% at 12% 0%, #ffffff, transparent 60%),
    radial-gradient(90% 70% at 88% 8%, #efeafc, transparent 62%),
    linear-gradient(180deg, #f9f8fd, #f1eff8);
}

body[data-backdrop="aurora"] .backdrop {
  background:
    radial-gradient(58% 48% at 14% 12%, #7c4dff 0%, transparent 62%),
    radial-gradient(52% 46% at 86% 16%, #16d0c4 0%, transparent 60%),
    radial-gradient(64% 56% at 74% 88%, #ff5fa2 0%, transparent 62%),
    radial-gradient(50% 44% at 24% 84%, #3b1fd6 0%, transparent 60%),
    linear-gradient(150deg, #2a1259, #120a2c);
}

body[data-backdrop="stadium"] .backdrop {
  background:
    radial-gradient(28% 34% at 18% 2%, rgba(255, 236, 186, 0.62), transparent 62%),
    radial-gradient(28% 34% at 50% -2%, rgba(255, 240, 200, 0.5), transparent 60%),
    radial-gradient(28% 34% at 82% 2%, rgba(255, 236, 186, 0.62), transparent 62%),
    radial-gradient(90% 60% at 50% 96%, #0d3f22, transparent 66%),
    linear-gradient(180deg, #08131f 0%, #0a1a2b 46%, #071a12 100%);
}

body[data-backdrop="dusk"] .backdrop {
  background:
    radial-gradient(70% 52% at 78% 6%, #ff8a4c 0%, transparent 58%),
    radial-gradient(60% 46% at 16% 20%, #b4409a 0%, transparent 58%),
    linear-gradient(170deg, #2b0f45 0%, #150b2c 52%, #060411 100%);
}

body[data-backdrop="slate"] .backdrop { background: #5f6673; }

/* ── Operator page ─────────────────────────────────────────────────────────── */
.page {
  max-width: 940px;
  margin: 0 auto;
  padding: 22px 24px 140px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 11px 16px;
  margin-bottom: 30px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--card-line);
  box-shadow: var(--page-shadow);
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(150deg, #5223d3, #471faa);
}

.brand-name { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; }
.brand-name span { color: var(--ink-faint); font-weight: 500; }

.nav { display: flex; gap: 4px; margin-left: 8px; }

/* Buttons now rather than links, because they move the page rather than
   navigating to one. The reset keeps them looking exactly as they did. */
.nav-link {
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 520;
  text-decoration: none;
  color: var(--ink-muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.nav-link.is-active { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }

.account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.balance { font-size: 13.5px; font-weight: 620; font-variant-numeric: tabular-nums; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(150deg, #d9d3f2, #a99ae0);
  border: 1px solid var(--card-line);
}

.page-title {
  margin: 0 0 14px 2px;
  font-size: 27px;
  font-weight: 680;
  letter-spacing: -0.03em;
}

.pills { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

.pill {
  padding: 8px 15px;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 540;
  color: var(--ink-muted);
  background: var(--card);
  cursor: pointer;
  transition: transform 0.22s ease, background 0.22s ease, color 0.22s ease;
}

.pill:hover { transform: translateY(-1px); }
.pill.is-active {
  color: #fff;
  background: linear-gradient(150deg, #5223d3, #471faa);
  border-color: transparent;
}

.board {
  margin-bottom: 20px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--card-line);
  box-shadow: var(--page-shadow);
  overflow: hidden;
}

.board-head {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--card-line);
}

.board-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e5484d;
  box-shadow: 0 0 0 3px color-mix(in srgb, #e5484d 20%, transparent);
}

.board-cols {
  margin-left: auto;
  display: grid;
  grid-template-columns: repeat(3, 58px);
  gap: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
}

.fixtures { list-style: none; margin: 0; padding: 0; }

.fixture {
  display: grid;
  /* A fourth column for the sport's second market — a spread, a first set, a
     second map. `auto` so it collapses to nothing on the boards that have none,
     which is how the football rows keep the layout they always had. */
  grid-template-columns: 76px 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--card-line);
}

/* Printed, not clickable. The page is a plausible room for the widget to sit
   in, not a betting engine, and a button here would promise something the demo
   does not do. */
.fixture-extra {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  white-space: nowrap;
}

.fixture:last-child { border-bottom: 0; }

.fixture-when {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.fixture-teams { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.fixture-team {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 540;
  letter-spacing: -0.01em;
}

.team-crest {
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
}

.fixture-comp {
  font-size: 10.5px;
  font-weight: 560;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 3px;
}

.odds { display: grid; grid-template-columns: repeat(3, 58px); gap: 8px; }

.odd {
  height: 38px;
  border: 1px solid var(--card-line);
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 3%, transparent);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.odd:hover {
  transform: translateY(-1px);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.board-more {
  width: 100%;
  padding: 12px;
  border: 0;
  border-top: 1px solid var(--card-line);
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--ink-muted);
  background: none;
  cursor: pointer;
}

.board-more:hover { color: var(--ink); }

.fixture-score {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  font-weight: 660;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ── Demo console ──────────────────────────────────────────────────────────── */
.console {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 100;
  width: 250px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  font-size: 12.5px;
  color: #e8e6f2;
  background: rgba(20, 18, 30, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.console-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 620;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #b9b4cf;
  background: none;
  cursor: pointer;
}

.console-toggle-icon {
  width: 7px;
  height: 7px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.28s ease;
}

.console-toggle[aria-expanded="false"] .console-toggle-icon { transform: rotate(-45deg); }

.console-body {
  padding: 0 14px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.console-body[hidden] { display: none; }

.console-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 540;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5a524;
}

.console-status[data-mode="live"] .status-dot { background: #34d17d; }
.console-status[data-mode="demo"] .status-dot { background: #f5a524; }
.console-status[data-mode="error"] .status-dot { background: #e5484d; }

.field { display: flex; flex-direction: column; gap: 7px; }

.field-label {
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #8f8aa8;
}

.field-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  font: inherit;
  font-size: 12px;
  color: #f0eef8;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.field-input:focus {
  outline: none;
  border-color: rgba(140, 110, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(140, 110, 255, 0.2);
}

select.field-input { cursor: pointer; }
select.field-input option { color: #16141f; }

.field-hint { margin: 0; font-size: 10.5px; line-height: 1.45; color: #837e9c; }
.field-hint code { font-size: 10px; color: #b6afd8; }

.swatches { display: flex; flex-wrap: wrap; gap: 7px; }

.swatch {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 9px;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: transform 0.24s cubic-bezier(0.22, 1.16, 0.36, 1), border-color 0.24s ease;
}

.swatch:hover { transform: translateY(-2px) scale(1.06); }
.swatch[aria-pressed="true"] {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.segment {
  padding: 6px 4px;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 540;
  color: #b9b4cf;
  background: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.segment[aria-checked="true"] { color: #16141f; background: #ffffff; }

.console-notes {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.console-notes p { margin: 0; font-size: 11px; line-height: 1.45; color: #938ead; }
.console-notes strong { color: #d6d1ea; font-weight: 600; }

/* Reserve the console's column so the sportsbook centres in what is left,
   rather than sliding underneath it. */
@media (min-width: 1181px) {
  body { padding-left: 292px; }
}

@media (max-width: 1180px) {
  .console { top: auto; bottom: 20px; left: 20px; width: 218px; }
  .console-body { max-height: 52vh; }
}

@media (max-width: 720px) {
  .page { padding: 16px 14px 120px; }
  .nav, .account { display: none; }
  .console { display: none; }
  .fixture { grid-template-columns: 62px 1fr; gap: 10px; }
  .odds, .board-cols { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
}

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

/*
 * Where the board's prices came from.
 *
 * Quiet, but deliberately not the faintest token in the palette — same
 * argument as the RG notice. This is the line that says "sample prices, not
 * real quotes", and greying out the disclaimer is the oldest trick in the book.
 */
.board-source {
  margin: 0;
  padding: 0.5rem 1rem 0;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
}

/* The one case that must not read as a footnote. */
.board-source[data-synthetic='true'] {
  color: var(--ink);
  font-weight: 600;
}
