/* betedge — adult sports-betting research dashboard.
   Dark navy/charcoal "sportsbook" aesthetic with green/amber value accents. Built on the kidenv
   token system (tokens retuned for an information-dense adult product), not the kid house style. */

:root {
  color-scheme: dark;

  /* Identity / actions */
  --brand:     #3b82f6;   /* electric blue — primary actions, active state, links */
  --brand-ink: #ffffff;
  --accent:    #5e7bff;
  --sun:       #f5a623;   /* amber — secondary value accent, warnings */

  /* Semantic feedback */
  --go:     #21c281;      /* value / favorable / positive */
  --go-ink: #04140d;
  --stop:   #ff6b5e;      /* OUT / negative */
  --stop-ink:#240705;
  --calm:   #46527a;      /* neutral slate (toggle off state) */

  /* Surfaces & ink — deep navy → charcoal */
  --surface:   #0a0f1e;   /* page background */
  --surface-2: #0d1426;
  --card:      #121b30;   /* raised surface */
  --card-2:    #172139;   /* nested surface (bet cells, rows) */
  --card-3:    #1d2a47;
  --ink:       #eaf0fb;   /* primary text — ~14:1 on --card */
  --ink-soft:  #9fadcb;   /* secondary text — ~6.5:1 on --card */
  --ink-mut:   #6c7896;   /* tertiary / hints */
  --line:      #233151;   /* hairlines */
  --line-soft: #1a2540;

  /* Shape, space, type */
  --radius:    12px;
  --radius-lg: 18px;
  --radius-sm: 8px;
  --tap-min:   44px;                 /* adult product: comfortable, not kid-sized */
  --tap-primary: 48px;
  --gap:  14px;
  --gap-sm: 8px;
  --pad:  16px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Consolas", monospace;
  --shadow:    0 6px 22px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;                  /* the shell owns layout; only .board scrolls (DESIGN rule 7) */
  font: 15px/1.45 var(--font);
  color: var(--ink);
  background:
    radial-gradient(140% 80% at 80% -20%, rgba(59,130,246,0.16), transparent 55%),
    radial-gradient(120% 70% at 0% 110%, rgba(33,194,129,0.08), transparent 55%),
    var(--surface);
  -webkit-font-smoothing: antialiased;
}

/* ===== Shell ================================================================================= */
.shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding:
    env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ----- Top bar ----- */
.topbar {
  flex: none;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 10px clamp(12px, 3vw, 22px);
  background: linear-gradient(180deg, var(--surface-2), rgba(13,20,38,0.6));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.brand .mark {
  width: 36px; height: 36px; flex: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #1e4fc4);
  display: grid; place-items: center; font-weight: 900; color: #fff; font-size: 18px;
  box-shadow: 0 2px 10px rgba(59,130,246,0.5);
}
.brand .titles { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand h1 { font-size: clamp(1.05rem, 2.6vw, 1.3rem); margin: 0; letter-spacing: -0.01em; white-space: nowrap; }
.brand .tag { font-size: 11px; color: var(--ink-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.datebar { display: flex; align-items: center; gap: 6px; flex: none; }
.datebar .date-input {
  appearance: none; background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 8px; font: inherit; font-size: 13px;
  color-scheme: dark; min-height: var(--tap-min);
}
.nav-btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: var(--radius-sm); min-width: 40px; min-height: var(--tap-min); cursor: pointer;
  font: inherit; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s, transform .06s;
}
.nav-btn:hover { background: var(--card-2); border-color: var(--brand); }
.nav-btn:active { transform: scale(0.96); }
.nav-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, white); outline-offset: 2px; }

/* ----- View tabs ----- */
.tabs { display: flex; gap: 4px; background: var(--card); padding: 4px; border-radius: var(--radius); flex: none; }
.tab {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 13px;
  color: var(--ink-soft); background: transparent; padding: 0 14px; min-height: 40px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 6px;
}
.tab[aria-selected="true"] { color: #fff; background: var(--brand); box-shadow: 0 2px 8px rgba(59,130,246,0.4); }
.tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, white); outline-offset: 2px; }

/* ----- Compliance banner (persistent) ----- */
.banner {
  flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px clamp(12px, 3vw, 22px);
  background: rgba(245,166,35,0.08);
  border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--ink-soft);
}
.banner b { color: var(--sun); }
.banner .sep { color: var(--ink-mut); }
.banner a { color: var(--sun); text-decoration: none; font-weight: 700; }

/* ----- Filter chips row ----- */
.chipbar {
  flex: none; display: flex; gap: 8px; align-items: center;
  padding: 8px clamp(12px, 3vw, 22px);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; min-width: 0;
  border-bottom: 1px solid var(--line-soft);
}
.chip {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  border-radius: 999px; padding: 0 14px; min-height: 36px; white-space: nowrap; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 13px; flex: none; display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s, color .12s, border-color .12s;
}
.chip[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--go); }
.chip[aria-pressed="true"] .dot { background: #fff; }
.chip:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, white); outline-offset: 2px; }

/* ===== Board (the only scroll area) ========================================================= */
.board {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: clamp(12px, 3vw, 20px);
  display: grid; gap: var(--gap);
  align-content: start;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.board::-webkit-scrollbar { width: 10px; }
.board::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

.board-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }

/* ----- Section headers ----- */
.section-head { display: flex; align-items: center; gap: 10px; margin: 4px 2px 0; }
.section-head h2 { font-size: 14px; margin: 0; color: var(--ink); letter-spacing: 0.04em; text-transform: uppercase; }
.section-head .count { font-size: 12px; color: var(--ink-mut); }
.section-head .rule { flex: 1; height: 1px; background: var(--line-soft); }

/* ----- Game card ----- */
.game {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.game-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: 11.5px; color: var(--ink-mut);
}
.game-top .when { font-weight: 700; color: var(--ink-soft); }
.game-state { font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.game-state.live { color: var(--go); }
.game-state.final { color: var(--ink-mut); }
.game-state.pre { color: var(--brand); }

.matchup { display: grid; gap: 6px; padding: 10px 12px; }
.team-row { display: grid; grid-template-columns: 24px 1fr auto auto; align-items: center; gap: 8px; }
.team-row img { width: 24px; height: 24px; object-fit: contain; }
.team-logo-fallback { width:24px;height:24px;border-radius:6px;background:var(--card-3);display:grid;place-items:center;font-size:10px;font-weight:800;color:var(--ink-soft);}
.team-row .tname { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-row .trec { font-size: 11px; color: var(--ink-mut); font-variant-numeric: tabular-nums; }
.team-row .tscore { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; }
.rankbadge { font-size: 10px; font-weight: 800; color: var(--sun); margin-right: 4px; }
.fav-tag { font-size: 9px; font-weight: 800; color: var(--go); border: 1px solid color-mix(in srgb,var(--go) 40%, transparent); padding: 1px 4px; border-radius: 4px; }

/* ----- Bet grid (the three core bets) ----- */
.bets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 12px 10px; }
.bet {
  background: var(--card-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 7px 8px; display: grid; gap: 3px; text-align: center;
}
.bet .bet-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-mut); font-weight: 800; }
.bet .bet-line { font-size: 13px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.bet .bet-price { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; font-family: var(--mono); }
.bet .bet-imp { font-size: 10px; color: var(--brand); font-weight: 700; }
.bet.value { border-color: color-mix(in srgb, var(--go) 55%, transparent); background: color-mix(in srgb, var(--go) 12%, var(--card-2)); }
.bet .two { display: flex; justify-content: space-between; gap: 6px; font-variant-numeric: tabular-nums; }
.bet .two span { font-size: 11px; }

.noline { padding: 10px 12px 12px; color: var(--ink-mut); font-size: 12.5px; font-style: italic; }

/* ----- Game meta strip (weather + injuries + details) ----- */
.game-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 12px 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line-soft); color: var(--ink-soft);
}
.badge.wx { color: #cfe6ff; }
.badge.out { color: var(--stop); border-color: color-mix(in srgb,var(--stop) 35%, transparent); }
.details-btn {
  margin-left: auto; appearance: none; border: 1px solid var(--line); background: var(--card-2); color: var(--ink);
  border-radius: var(--radius-sm); padding: 0 12px; min-height: 36px; cursor: pointer; font: inherit; font-weight: 700; font-size: 12px;
}
.details-btn:hover { border-color: var(--brand); background: var(--card-3); }
.details-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, white); outline-offset: 2px; }

/* ----- Details drawer ----- */
.details {
  border-top: 1px solid var(--line-soft); padding: 12px; display: grid; gap: 12px;
  background: var(--surface-2);
}
.details h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-mut); margin: 0 0 6px; }
.winbar { height: 18px; border-radius: 6px; overflow: hidden; display: flex; font-size: 10px; font-weight: 800; }
.winbar .away { background: var(--card-3); color: var(--ink); display: grid; place-items: center; }
.winbar .home { background: var(--brand); color: #fff; display: grid; place-items: center; }
.inj-list { display: grid; gap: 4px; }
.inj-team { font-size: 11px; font-weight: 800; color: var(--ink-soft); margin-top: 4px; }
.inj-row { display: flex; gap: 6px; font-size: 12px; align-items: baseline; }
.inj-row .st { font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 4px; }
.st.Out, .st-out { background: color-mix(in srgb,var(--stop) 22%, transparent); color: var(--stop); }
.st-q { background: color-mix(in srgb,var(--sun) 22%, transparent); color: var(--sun); }
.st-d { background: var(--card-3); color: var(--ink-soft); }
.book-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.book-table th, .book-table td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.book-table th:first-child, .book-table td:first-child { text-align: left; color: var(--ink-soft); }
.book-table th { color: var(--ink-mut); font-weight: 800; font-size: 10px; text-transform: uppercase; }
.edge { color: var(--go); font-weight: 800; }

/* ===== Futures ============================================================================== */
.fut-market {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.fut-market > h3 {
  margin: 0; padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--line-soft);
  color: var(--ink); letter-spacing: 0.02em; background: var(--surface-2);
}
.fut-row { display: grid; grid-template-columns: 18px 22px 1fr auto; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); }
.fut-row:last-child { border-bottom: 0; }
.fut-row .frank { font-size: 11px; color: var(--ink-mut); font-weight: 800; text-align: center; }
.fut-row img { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; }
.fut-row .fname { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fut-row .fodds { font-weight: 800; font-variant-numeric: tabular-nums; font-family: var(--mono); color: var(--ink); }
.fut-row .fimp { font-size: 10px; color: var(--brand); margin-left: 8px; }
.fut-row.top .fodds { color: var(--go); }

/* ===== Empty / loading / error ============================================================== */
.empty {
  grid-column: 1 / -1; text-align: center; padding: 40px 20px; color: var(--ink-soft);
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius-lg); display: grid; gap: 12px; justify-items: center;
}
.empty .big { font-size: 40px; }
.empty h2 { color: var(--ink); margin: 0; font-size: 18px; }
.empty p { margin: 0; max-width: 42ch; }
.empty .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 13px;
  color: var(--brand-ink); background: var(--brand); min-height: var(--tap-min); padding: 0 18px;
  border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: var(--shadow); transition: filter .12s, transform .06s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, white); outline-offset: 2px; }
.btn-ghost { background: var(--card-2); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn-go { background: var(--go); color: var(--go-ink); }

.offnote { grid-column: 1 / -1; font-size: 12px; color: var(--ink-mut); padding: 6px 4px; border-top: 1px dashed var(--line-soft); }
.offnote b { color: var(--ink-soft); }

.disclaimer-full {
  grid-column: 1 / -1; font-size: 10.5px; line-height: 1.5; color: var(--ink-mut);
  border-top: 1px solid var(--line-soft); padding: 12px 4px 4px; margin-top: 6px;
}
.disclaimer-full b { color: var(--ink-soft); }

/* ----- Skeletons ----- */
.skel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); height: 168px; position: relative; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  transform: translateX(-100%); animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ----- Persistent footer ----- */
.footnote {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 5px 12px; font-size: 10.5px; color: var(--ink-mut);
  background: var(--surface-2); border-top: 1px solid var(--line);
}
.footnote .sep { opacity: 0.5; }
.footnote b { color: var(--ink-soft); }

/* ===== Density: compact ===================================================================== */
.density-compact { --gap: 9px; --pad: 11px; }
.density-compact .board-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.density-compact .matchup { padding: 7px 10px; gap: 4px; }
.density-compact .bets { padding: 0 10px 8px; gap: 4px; }
.density-compact .bet { padding: 5px 6px; }
.density-compact .game-top { padding: 6px 10px; }
.density-compact .team-row .tname { font-size: 13px; }

/* ===== Settings kit (themed; markup from the kidenv components) ============================= */
.btn-icon {
  appearance: none; border: 1px solid var(--line); cursor: pointer; font: inherit;
  width: var(--tap-min); height: var(--tap-min); min-width: var(--tap-min);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; line-height: 1;
  border-radius: 10px; color: var(--ink); background: var(--card); flex: none;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn-icon:hover { background: var(--card-2); border-color: var(--brand); }
.btn-icon:active { transform: scale(0.94); }
.btn-icon:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, white); outline-offset: 2px; }

.sheet { border: 0; padding: 0; color: var(--ink); background: transparent; max-width: min(30rem, 94vw); width: 100%; }
.sheet::backdrop { background: rgba(4, 8, 18, 0.7); backdrop-filter: blur(3px); }
.sheet .sheet-body {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 18px; display: grid; gap: 14px; text-align: left; max-height: 88vh; overflow-y: auto;
}
.sheet h2 { margin: 0; font-size: 18px; }
.sheet[open] { animation: sheet-in .16s ease; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }

.field { display: grid; gap: 6px; }
.field > .field-label { font-weight: 800; color: var(--ink); font-size: 13px; }
.field > .field-hint { font-size: 11px; color: var(--ink-mut); }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; cursor: pointer; }
.range:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, white); outline-offset: 3px; border-radius: var(--radius); }
.range::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; background: var(--card-3); }
.range::-moz-range-track { height: 10px; border-radius: 999px; background: var(--card-3); }
.range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -7px; border-radius: 50%; background: var(--brand); border: 3px solid var(--card); }
.range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); border: 3px solid var(--card); }

.switch { appearance: none; border: 0; cursor: pointer; position: relative; width: 56px; height: 32px; min-width: 56px; border-radius: 999px; padding: 0; background: var(--calm); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--go); }
.switch[aria-checked="true"]::after { transform: translateX(24px); }
.switch:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, white); outline-offset: 2px; }

.segmented { display: flex; gap: 4px; background: var(--card-2); padding: 4px; border-radius: var(--radius); flex-wrap: wrap; }
.segmented .seg { appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 13px; flex: 1 1 auto; min-width: 64px; min-height: 40px; border-radius: var(--radius-sm); color: var(--ink-soft); background: transparent; }
.segmented .seg[aria-pressed="true"] { color: #fff; background: var(--brand); }
.segmented .seg:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, white); outline-offset: 2px; }

.league-toggle { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.league-toggle .seg { min-width: 0; font-size: 12px; min-height: 38px; }

/* ===== Motion ============================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ===== Short / landscape viewports (DESIGN rule 7: keep the shell within one screen) ======== */
@media (max-height: 480px) {
  :root { --gap: 9px; --pad: 10px; }
  .banner { display: none; }                 /* compliance stays in the persistent footer */
  .brand .tag { display: none; }
  .topbar { padding-top: 6px; padding-bottom: 6px; }
  .chipbar { padding-top: 5px; padding-bottom: 5px; }
}
/* Narrow phones: wrap the top bar into tidy rows instead of one overflowing line.
   Row 1: brand … tabs ⚙   ·   Row 2: ‹ date › Today (full width). */
@media (max-width: 600px) {
  .brand { order: 1; }
  .tabs { order: 2; }
  .btn-icon#open-settings { order: 3; }
  .datebar { order: 4; flex: 1 1 100%; justify-content: space-between; margin-left: 0; }
  .datebar .date-input { flex: 1 1 auto; min-width: 0; }
}
@media (max-width: 460px) {
  .brand .tag { display: none; }
  .tabs { flex: 1 1 auto; }
  .tabs .tab { padding: 0 12px; flex: 1; }
}
