:root {
  --royal: #1f4fd8;
  --royal-deep: #163aa6;
  --ink: #0e1b33;
  --ink-2: #4a5873;
  --ink-3: #7b88a1;
  --ice: #eef3fa;
  --paper: #ffffff;
  --line: #d6deeb;
  --line-soft: #e6ecf5;
  --win: #11865a;
  --win-soft: #ddf3ea;
  --loss: #c8372d;
  --loss-soft: #fbe5e3;
  --gold: #f2b705;
  --lean: #8a5a00;
  --lean-soft: #fdf1d6;
  --focus: #f2b705;
  --band-text: #ffffff;
  --shadow: 0 1px 0 rgba(14, 27, 51, 0.06);
  --display: "Big Shoulders Display", "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --r-sm: 6px;
  --r-md: 10px;
  --tab-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --royal: #5b86ff;
    --royal-deep: #1b3c99;
    --ink: #e8eef8;
    --ink-2: #b2bfd6;
    --ink-3: #7f8eaa;
    --ice: #0a1428;
    --paper: #111e3a;
    --line: #233457;
    --line-soft: #1a2a4b;
    --win: #3fcf92;
    --win-soft: #0f3326;
    --loss: #ff7a6e;
    --loss-soft: #3a1714;
    --lean: #f3c04d;
    --lean-soft: #352a0e;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --royal: #5b86ff;
  --royal-deep: #1b3c99;
  --ink: #e8eef8;
  --ink-2: #b2bfd6;
  --ink-3: #7f8eaa;
  --ice: #0a1428;
  --paper: #111e3a;
  --line: #233457;
  --line-soft: #1a2a4b;
  --win: #3fcf92;
  --win-soft: #0f3326;
  --loss: #ff7a6e;
  --loss-soft: #3a1714;
  --lean: #f3c04d;
  --lean-soft: #352a0e;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ice);
  color: var(--ink);
  font: 400 16px/1.45 var(--body);
  font-variant-numeric: tabular-nums;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- masthead: the one loud thing ---------- */
.band {
  background: var(--royal-deep);
  background-image: linear-gradient(100deg, #1f4fd8 0%, #163aa6 62%, #11307f 100%);
  color: var(--band-text);
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  position: relative;
  overflow: hidden;
}
.band::after { /* jersey stripe */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background: repeating-linear-gradient(90deg, #ffffff 0 18px, transparent 18px 26px);
  opacity: .9;
}
.band-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.wordmark {
  font: 900 italic 34px/0.9 var(--display);
  letter-spacing: 0.01em; margin: 0; text-transform: uppercase;
  text-decoration: none; color: inherit;
}
.wordmark span { display: inline-block; transform: skewX(-6deg); }
.band-meta { text-align: right; font-size: 13px; opacity: .92; line-height: 1.3; }
.band-meta strong { display: block; font: 700 16px/1.1 var(--body); }

/* ---------- layout ---------- */
.shell { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr; }
main { padding: 16px; min-width: 0; }
.rail { display: none; }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .shell { grid-template-columns: 200px 1fr; gap: 8px; }
  .rail { display: block; padding: 20px 0 20px 16px; position: sticky; top: 0; align-self: start; }
  .rail a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm);
    text-decoration: none; font-weight: 600; color: var(--ink-2);
  }
  .rail a[aria-current="page"] { background: var(--paper); color: var(--royal); box-shadow: var(--shadow); }
  .rail a:hover { color: var(--ink); }
  .tabs { display: none !important; }
  .wordmark { font-size: 44px; }
  main { padding: 20px 16px 40px; }
}

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; font-size: 12px; font-weight: 600; color: var(--ink-3);
}
.tabs a[aria-current="page"] { color: var(--royal); }
.tabs svg, .rail svg { width: 22px; height: 22px; }

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; }
.h-page { font: 800 30px/1 var(--display); text-transform: uppercase; letter-spacing: .01em; margin-bottom: 4px; }
.h-sec { font: 700 20px/1.2 var(--body); margin: 28px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.h-sec:first-child { margin-top: 4px; }
.h-sec small { font: 500 14px var(--body); color: var(--ink-3); }
.sub { color: var(--ink-2); margin: 0 0 12px; max-width: 64ch; }
.muted { color: var(--ink-3); }
.num { font-family: var(--display); font-weight: 800; }

/* ---------- surfaces ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); }
.rows > * + * { border-top: 1px solid var(--line-soft); }
.empty { padding: 18px 16px; color: var(--ink-2); }
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; }

/* ---------- favorite team strip ---------- */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 280px); gap: 10px; overflow-x: auto;
  scroll-snap-type: x mandatory; padding-bottom: 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.fav-tile { scroll-snap-align: start; padding: 14px; text-decoration: none; display: grid; gap: 8px; }
.fav-tile .top { display: flex; align-items: center; gap: 10px; }
.fav-tile .name { font-weight: 700; line-height: 1.15; }
.fav-tile .lg { font-size: 13px; color: var(--ink-3); }
.fav-tile .big { font: 800 40px/0.9 var(--display); color: var(--royal); }
.fav-tile .big small { font: 600 14px var(--body); color: var(--ink-2); margin-left: 6px; }
.fav-tile .when { font-size: 14px; color: var(--ink-2); }
.logo { width: 32px; height: 32px; object-fit: contain; flex: none; }
.logo.sm { width: 22px; height: 22px; }
.logo-ph { width: 32px; height: 32px; border-radius: 50%; background: var(--line-soft); display: grid; place-items: center;
  font: 800 12px var(--display); color: var(--ink-2); flex: none; }
.logo-ph.sm { width: 22px; height: 22px; font-size: 10px; }

/* ---------- bet slip ---------- */
.slips { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.slip {
  position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 16px 12px; box-shadow: var(--shadow);
}
.slip::before, .slip::after { /* ticket notches */
  content: ""; position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%;
  background: var(--ice); border: 1px solid var(--line);
}
.slip::before { left: -8px; clip-path: inset(0 0 0 50%); }
.slip::after { right: -8px; clip-path: inset(0 50% 0 0); }
.slip.featured { border-color: var(--royal); box-shadow: 0 0 0 1px var(--royal) inset; }
.slip .game { font-size: 13px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; }
.slip .pick { font: 800 26px/1.05 var(--display); text-transform: uppercase; margin: 6px 0 2px; }
.slip .price { font: 700 16px var(--body); color: var(--ink-2); margin-left: 6px; }
.slip .why { font-size: 14px; color: var(--ink-2); margin: 6px 0 0; }
.slip .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px;
  border-top: 1px dashed var(--line); padding-top: 9px; font-size: 13px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font: 700 12px/1 var(--body); padding: 5px 8px; border-radius: 999px;
  background: var(--line-soft); color: var(--ink-2); white-space: nowrap; }
.chip.proven { background: var(--win-soft); color: var(--win); }
.chip.losing { background: var(--loss-soft); color: var(--loss); }
.chip.unproven { background: var(--lean-soft); color: var(--lean); }
.chip.strong { background: var(--royal); color: #fff; }

/* probability meter: our chance vs the chance needed to break even */
.meter { position: relative; height: 8px; border-radius: 4px; background: var(--line-soft); margin-top: 8px; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--royal); }
.meter b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.meter-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ---------- games ---------- */
.game-row { padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; cursor: pointer; }
.game-row:hover { background: color-mix(in srgb, var(--ice) 60%, transparent); }
.teams { display: grid; gap: 4px; min-width: 0; }
.team-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team-line .tn { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-line .rec { font-size: 13px; color: var(--ink-3); }
.team-line .sc { margin-left: auto; font: 800 20px var(--display); padding-left: 8px; }
.team-line.won .tn, .team-line.won .sc { color: var(--ink); }
.team-line.lost .tn, .team-line.lost .sc { color: var(--ink-3); }
.game-side { text-align: right; font-size: 13px; color: var(--ink-2); display: grid; gap: 2px; align-content: start; }
.game-side .pct { font: 800 22px/1 var(--display); color: var(--royal); }
.game-meta { grid-column: 1 / -1; font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.winbar { grid-column: 1 / -1; display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line-soft); }
.winbar span { display: block; height: 100%; }
.winbar .a { background: var(--ink-3); }
.winbar .d { background: var(--line); }
.winbar .h { background: var(--royal); }
.game-detail { grid-column: 1 / -1; display: none; padding-top: 8px; }
.game-row.open .game-detail { display: block; }
.opt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.opt-table th { text-align: left; font-weight: 600; color: var(--ink-3); padding: 6px 4px; border-bottom: 1px solid var(--line-soft); }
.opt-table td { padding: 6px 4px; border-bottom: 1px solid var(--line-soft); }
.opt-table td.r, .opt-table th.r { text-align: right; }
.pos { color: var(--win); font-weight: 700; }
.neg { color: var(--ink-3); }
.note { font-size: 13px; color: var(--lean); margin-top: 6px; }

.day-head { padding: 10px 14px 6px; font-weight: 700; font-size: 14px; color: var(--ink-2); background: var(--ice); }

/* ---------- lists of teams / players ---------- */
.item { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; min-height: 52px; }
.item a.main { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 1; min-width: 0; }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--ink-3); }
.item .r { margin-left: auto; text-align: right; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.star {
  border: 0; background: none; cursor: pointer; width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; color: var(--ink-3); flex: none;
}
.star svg { width: 24px; height: 24px; }
.star[aria-pressed="true"] { color: var(--gold); }
.star:hover { background: var(--line-soft); }
.star.pop svg { animation: pop .25s ease-out; }
@keyframes pop { 50% { transform: scale(1.3); } }

.search { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--paper); color: var(--ink); font-size: 16px; margin-bottom: 10px; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 14px; }
.seg button, .seg a {
  border: 1px solid var(--line); background: var(--paper); padding: 8px 14px; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--ink-2); text-decoration: none;
}
.seg [aria-pressed="true"], .seg [aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.league-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.league-tile { padding: 16px; text-decoration: none; display: grid; gap: 6px; }
.league-tile .n { font: 800 26px/1 var(--display); text-transform: uppercase; }
.league-tile .d { font-size: 14px; color: var(--ink-2); }

/* ---------- team page ---------- */
.team-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.team-head .logo, .team-head .logo-ph { width: 56px; height: 56px; }
.team-head .logo-ph { font-size: 18px; }
.statline { display: flex; gap: 22px; flex-wrap: wrap; margin: 10px 0 4px; }
.statline div { display: grid; }
.statline .v { font: 800 30px/1 var(--display); }
.statline .k { font-size: 13px; color: var(--ink-3); }
.inj-row { padding: 10px 14px; display: flex; gap: 10px; align-items: baseline; }
.inj-row .st { font-weight: 700; font-size: 13px; min-width: 92px; }
.inj-row .st.out { color: var(--loss); }
.inj-row .st.q { color: var(--lean); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.std { width: 100%; border-collapse: collapse; font-size: 14px; }
table.std th { text-align: left; color: var(--ink-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.std td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.std td.r, table.std th.r { text-align: right; }
table.std tr.me td { background: color-mix(in srgb, var(--gold) 14%, transparent); }

/* ---------- record ---------- */
.record-hero { padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; }
.record-hero .v { font: 800 36px/1 var(--display); }
.record-hero .k { font-size: 13px; color: var(--ink-3); }
.up { color: var(--win); }
.down { color: var(--loss); }
.result { font-weight: 700; font-size: 13px; }
.result.win { color: var(--win); }
.result.loss { color: var(--loss); }
.result.push, .result.void, .result.pending { color: var(--ink-3); }

/* ---------- forms ---------- */
.form { padding: 16px; display: grid; gap: 12px; }
.form label { font-weight: 600; font-size: 14px; display: grid; gap: 6px; }
.form input[type=text], .form input[type=password], .form input[type=url] {
  padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--ice); color: var(--ink); font-size: 16px; width: 100%;
}
.form .hint { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.btn { border: 0; border-radius: var(--r-sm); padding: 12px 16px; font-weight: 700; cursor: pointer; background: var(--royal); color: #fff; }
.btn.quiet { background: var(--line-soft); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 10px; font-weight: 500 !important; padding: 6px 0; }
.check input { width: 20px; height: 20px; }
ol.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }
ol.steps code, .form code { background: var(--line-soft); padding: 1px 5px; border-radius: 4px; font-size: 14px; }
.msg { padding: 10px 12px; border-radius: var(--r-sm); font-size: 14px; }
.msg.ok { background: var(--win-soft); color: var(--win); }
.msg.err { background: var(--loss-soft); color: var(--loss); }
.msg.info { background: var(--lean-soft); color: var(--lean); }

.status-row { display: flex; gap: 10px; padding: 10px 14px; align-items: baseline; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.dot.ok { background: var(--win); } .dot.partial { background: var(--gold); } .dot.error { background: var(--loss); } .dot.skipped { background: var(--ink-3); }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 50;
  max-width: calc(100% - 32px); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

.banner { padding: 12px 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner p { margin: 0; font-size: 14px; color: var(--ink-2); }

.loading { padding: 40px 0; text-align: center; color: var(--ink-3); }

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