/* The Lotto Calculator look: warm cream in light mode, true black in dark mode, sage for overs and
   best prices, sand for unders, each device's own system font, normal scrolling, no animation. */
:root {
  --bg: #f5f1e8;
  --card: #fcfaf5;
  --inset: #f4efe4;
  --rule: rgba(40, 32, 20, 0.09);
  --track: rgba(40, 32, 20, 0.08);
  --text: #1d1b17;
  --text-2: #5f594f;
  --text-3: #726c63; /* captions: at least 4.5:1 on every background, in both modes */
  --invert-bg: #1d1b17;
  --invert-text: #f5f1e8;
  --sage: #4d7d6b;
  --sand: #a9693a;
  --best: rgba(77, 125, 107, 0.14);
  --ok: #3f9a66;
  --warn: #c48a2c;
  --danger: #c0513f;
  --warn-text: #88591a;
  --error-text: #9a3526;
  --card-edge: rgba(40, 32, 20, 0.06);
  --card-shadow: 0 1px 2px rgba(60, 45, 20, 0.04), 0 6px 22px rgba(60, 45, 20, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #101011;
    --inset: #18181a;
    --rule: rgba(255, 255, 255, 0.08);
    --track: rgba(255, 255, 255, 0.08);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #808084;
    --invert-bg: #f5f5f7;
    --invert-text: #000000;
    --sage: #a9cbbc;
    --sand: #e2c393;
    --best: rgba(169, 203, 188, 0.16);
    --ok: #7dc79a;
    --warn: #e2b264;
    --danger: #ec8a7c;
    --warn-text: #e8c07c;
    --error-text: #f2a497;
    --card-edge: rgba(255, 255, 255, 0.06);
    --card-shadow: none;
    color-scheme: dark;
  }
}

/* Base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
}
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}
a { color: inherit; text-underline-offset: 2px; text-decoration-thickness: 1px; }
h1, h2, p { margin: 0; }
button, select, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; }
.muted { color: var(--text-3); font-weight: 400; }
[hidden] { display: none !important; }

/* Top bar */
.appbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px 12px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.mark { width: 20px; height: 20px; flex: none; }
.mark-over { fill: var(--sage); }
.mark-under { fill: var(--sand); }
.mark-line { stroke: var(--text-2); stroke-width: 1.6; stroke-dasharray: 2.5 2; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--card-edge);
  background: var(--card);
  color: var(--text-2);
  border-radius: 999px;
  padding: 5px 11px;
  font: 500 12px/1.4 var(--font);
  white-space: nowrap;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); flex: none; }
.status-icon { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.status.is-ok .status-dot { background: var(--ok); }
.status.is-stale .status-dot { background: var(--warn); }
.status.is-error .status-dot { background: var(--danger); }
.status.is-busy .status-dot { background: var(--sage); }

/* Page tabs */
.tabs {
  display: flex;
  max-width: 440px;
  margin: 0 auto 16px;
  padding: 3px;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 999px;
}
.tabs a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--text-2);
  font: 500 13px/1.4 var(--font);
  padding: 7px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.tabs a[aria-current="page"] { background: var(--invert-bg); color: var(--invert-text); font-weight: 600; }

/* Shared */
.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 22px;
  box-shadow: var(--card-shadow);
  padding: 18px 20px;
  margin-bottom: 14px;
  min-width: 0;
}
.card h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.page-head { margin: 4px 4px 14px; }
.page-head h1 { font-size: 24px; line-height: 1.15; font-weight: 700; letter-spacing: -0.03em; }
.page-head .caption { margin-top: 4px; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.caption { font-size: 13px; color: var(--text-3); line-height: 1.45; }
.notice { margin: 0 0 12px; padding: 11px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--card-edge); font-size: 13px; line-height: 1.45; }
.notice.warn { color: var(--warn-text); }
.notice.error { color: var(--error-text); }
.notice button { margin-left: 6px; border: 0; background: none; padding: 0; text-decoration: underline; font-size: 13px; }
.error-text { color: var(--error-text); font-size: 13px; margin-top: 8px; }
.empty { text-align: center; padding: 28px 20px; }
.empty .caption { margin-top: 6px; }
.badge {
  display: inline-block;
  margin-right: 4px;
  border-radius: 999px;
  padding: 1px 8px;
  background: var(--inset);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: 1px;
  white-space: nowrap;
}
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn-text); }
.badge.good { background: var(--best); color: var(--sage); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule); }
.list li:first-child { border-top: 0; }
.list li > span { min-width: 0; }
.list b { font-weight: 600; text-align: right; }
.segmented { display: inline-flex; padding: 3px; background: var(--inset); border-radius: 999px; max-width: 100%; overflow-x: auto; }
.segmented button { border: 0; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-text); font-weight: 600; }

/* Today */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.games .card { margin-bottom: 0; }
.game-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.game-head h2 { font-size: 19px; }
.at { color: var(--text-3); font-weight: 400; }
.game-when { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.game .kicker { margin: 14px 0 2px; }
.injuries li { justify-content: flex-start; font-size: 13px; color: var(--text-2); }
.injuries .team { flex: none; width: 40px; font-weight: 600; color: var(--text); }
.inj { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-3); }
.inj.out, .inj.doubtful { color: var(--error-text); }
.inj.questionable { color: var(--warn-text); }
.more { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--sage); text-decoration: none; }

/* Best prices: one bet per row, the books scroll sideways inside it on a phone */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; margin: 0 0 14px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--text-3); min-width: 0; }
.filters .grow { flex: 1 1 160px; }
.filters select, .filters input[type="search"] {
  height: 36px;
  border: 1px solid var(--card-edge);
  border-radius: 12px;
  background: var(--card);
  padding: 0 10px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  max-width: 100%;
}
.filters .check { flex-direction: row; align-items: center; gap: 6px; height: 36px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.filters .check input { width: 18px; height: 18px; margin: 0; accent-color: var(--sage); }
.board-game { padding: 6px 0; }
.board-game > h2 { padding: 12px 20px 6px; }
.board-game > .caption { padding: 0 20px 8px; }
.bet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--rule);
}
.bet-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.bet-title a { text-decoration: none; }
.bet-title a:hover { text-decoration: underline; }
.bet-sub, .bet-note { margin-top: 3px; font-size: 13px; color: var(--text-2); }
.bet-note { font-size: 12.5px; }
.bet-why { margin-top: 4px; font-size: 12.5px; color: var(--text-3); }
.ev.pos { color: var(--ok); }
.ev.neg { color: var(--text-3); font-weight: 500; }
.books { display: flex; gap: 4px; overflow-x: auto; max-width: 100%; padding-bottom: 2px; overscroll-behavior-x: contain; }
.book {
  flex: none;
  width: 70px;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 5px 2px;
  border-radius: 10px;
  background: var(--inset);
  border: 1.5px solid transparent;
}
.book-name { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.book b { font-size: 14px; font-weight: 600; }
.book .age { font-size: 10.5px; color: var(--text-3); }
.book.best { background: var(--best); border-color: var(--sage); }
.book.best b { color: var(--sage); }
.book.old b, .book.old .book-name { opacity: 0.45; }
.book.none b { color: var(--text-3); font-weight: 400; }
.book.ref { background: transparent; border: 1px dashed var(--rule); }
.book.flag .book-name { color: var(--warn-text); font-weight: 600; }
.show-more { display: block; margin: 0 auto 14px; border: 1px solid var(--card-edge); background: var(--card); border-radius: 999px; padding: 8px 18px; font-size: 13px; font-weight: 500; }

/* Prop analyzer */
.search input {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--inset);
  padding: 0 14px;
  font-size: 16px; /* 16px keeps iPhones from zooming in */
}
.results { list-style: none; margin: 6px 0 0; padding: 0; }
.results a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--rule); text-decoration: none; }
.results li:first-child a { border-top: 0; }
.results small { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.who { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.who h1 { font-size: 24px; line-height: 1.15; font-weight: 700; letter-spacing: -0.03em; }
.who .caption { margin-top: 2px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.line-pick { display: inline-flex; align-items: center; gap: 4px; }
.line-pick button { width: 36px; height: 36px; border: 1px solid var(--card-edge); border-radius: 50%; background: var(--inset); font-size: 18px; line-height: 1; }
.line-pick input { width: 74px; height: 36px; text-align: center; border: 1px solid var(--rule); border-radius: 12px; background: var(--inset); font-size: 16px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--text-3); align-items: center; }
.chips button { border: 1px solid var(--card-edge); background: var(--inset); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.chips button[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-text); }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.pair > .card { margin-bottom: 0; }
.chart { margin: 12px -4px 0; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .bar.over { fill: var(--sage); }
.chart .bar.under { fill: var(--sand); }
.chart .val { fill: var(--text-2); font-size: 9px; font-family: var(--font); text-anchor: middle; }
.chart .lab { fill: var(--text-3); font-size: 8px; font-family: var(--font); text-anchor: middle; }
.chart .line { stroke: var(--text); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .line-label { fill: var(--text); font-size: 9px; font-weight: 600; font-family: var(--font); }
.chart .base { stroke: var(--rule); stroke-width: 1; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.big { font-size: 30px; line-height: 1.05; font-weight: 700; letter-spacing: -0.04em; margin-top: 8px; }
.prices { padding: 6px 0; }
.prices > h2 { padding: 12px 20px 6px; }
.prices > .caption { padding: 0 20px 12px; }

/* Passcode dialog */
dialog {
  width: min(92vw, 380px);
  border: 1px solid var(--card-edge);
  border-radius: 22px;
  background: var(--card);
  color: var(--text);
  padding: 20px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h2 { font-size: 17px; font-weight: 600; }
dialog .caption { margin-top: 6px; }
dialog input { width: 100%; height: 44px; margin-top: 14px; border: 1px solid var(--rule); border-radius: 14px; background: var(--inset); padding: 0 14px; font-size: 16px; }
.dialog-actions { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 8px; margin-top: 16px; }
.dialog-actions button { border: 1px solid var(--card-edge); background: var(--inset); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500; }
.dialog-actions .primary { background: var(--invert-bg); color: var(--invert-text); font-weight: 600; }

/* Footer */
.footer { margin-top: 22px; padding: 0 4px; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.footer p + p { margin-top: 6px; }

/* Phones: each bet stacks, and its books scroll sideways inside the row */
@media (max-width: 640px) {
  main { padding-left: 12px; padding-right: 12px; }
  .card { padding: 16px 14px; border-radius: 18px; }
  .board-game, .prices { padding: 4px 0; }
  .board-game > h2, .prices > h2 { padding: 12px 14px 4px; }
  .board-game > .caption, .prices > .caption { padding: 0 14px 8px; }
  .bet { grid-template-columns: minmax(0, 1fr); padding: 12px 14px; }
  .pair { grid-template-columns: minmax(0, 1fr); gap: 0; margin-bottom: 0; }
  .pair > .card { margin-bottom: 14px; }
  .page-head h1, .who h1 { font-size: 21px; }
  .tabs a { font-size: 12.5px; padding: 7px 4px; }
}
