/* Taya dashboard — phone-first (designed at 390px), hand-written. */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(fonts/bricolage-grotesque-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(fonts/bricolage-grotesque-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/figtree-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/figtree-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --bg: #F3F5F7;
  --text: #12161C;
  --muted: #4A5563;
  --card: #FFFFFF;
  --border: #D5DAE1;
  --paid-bg: #E7F4EC;
  --paid: #0F7A4F;          /* paid border / button */
  --paid-on: #FFFFFF;       /* text on the paid button */
  --paid-text: #0A5537;
  --neg: #B3261E;
  --ball: #FFD84D;
  --ball-text: #1A1A1A;
  --summary-bg: #12161C;
  --summary-text: #FFFFFF;
  --summary-muted: #B9C1CC;
  --amber-bg: #FFF1D6;
  --amber-text: #7A4A00;
  --amber-border: #E7B661;
  --chip-bg: #E7EBF0;
  --focus: #2F6FEB;
  --ball-off-bg: transparent; /* unmatched number on the results page */
  --shadow: 0 1px 2px rgba(18, 22, 28, .06);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B0E12; --text: #E8ECF1; --muted: #9AA5B4; --card: #161B22; --border: #2A323D;
    --paid-bg: #0F2A1E; --paid: #3FB97F; --paid-on: #0B0E12; --paid-text: #8FE0B5; --neg: #FF9B8A;
    --ball: #E6C23A; --ball-text: #1A1A1A;
    --summary-bg: #1F2731; --summary-text: #F3F6F9; --summary-muted: #A8B3C1;
    --amber-bg: #33260C; --amber-text: #F5C97A; --amber-border: #6B4F17;
    --chip-bg: #1E252E; --focus: #7AA7FF; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0E12; --text: #E8ECF1; --muted: #9AA5B4; --card: #161B22; --border: #2A323D;
  --paid-bg: #0F2A1E; --paid: #3FB97F; --paid-on: #0B0E12; --paid-text: #8FE0B5; --neg: #FF9B8A;
  --ball: #E6C23A; --ball-text: #1A1A1A;
  --summary-bg: #1F2731; --summary-text: #F3F6F9; --summary-muted: #A8B3C1;
  --amber-bg: #33260C; --amber-text: #F5C97A; --amber-border: #6B4F17;
  --chip-bg: #1E252E; --focus: #7AA7FF; --shadow: none;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px); /* installed app: clear of the gesture bar */
}
h1, h2, h3, .display { font-family: "Bricolage Grotesque", "Figtree", system-ui, sans-serif; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 750; margin: 0; line-height: 1.15; }
h2 { font-size: 19px; font-weight: 700; margin: 0; }
h3 { font-size: 16px; font-weight: 700; margin: 0; }
p { margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.num, .money { font-variant-numeric: tabular-nums; }
.neg { color: var(--neg); }
.pos { color: var(--paid-text); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 480px; }
main.wrap { padding-bottom: 48px; }

/* ------------------------------------------------------------------ header + switcher */
.topbar { padding-top: max(14px, env(safe-area-inset-top)); }
.topbar-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.topbar-row .sub { margin-top: 4px; font-size: 14px; }
.page-tickets .topbar .wrap { max-width: 480px; }

.btn, .theme-toggle, .pill, .chip {
  font: inherit;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600; font-size: 14px;
}
.theme-toggle svg { width: 18px; height: 18px; }

.switcher {
  display: flex; gap: 4px;
  margin-top: 14px; margin-bottom: 18px;
  overflow-x: auto; scrollbar-width: none;
}
.switcher::-webkit-scrollbar { display: none; }
.switcher-inner { display: flex; flex: 1; gap: 2px; padding: 4px; border-radius: 999px; background: var(--chip-bg); }
.switcher a {
  flex: 1 1 auto; justify-content: center;
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 0 9px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none; font-weight: 600; font-size: 13.5px; white-space: nowrap;
}
.switcher a[aria-current="page"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 16px;
  border: 1px solid var(--border);
  background: var(--card); color: var(--text);
  font-weight: 650; font-size: 14px; white-space: nowrap;
}
.btn-primary { background: var(--text); color: var(--card); border-color: var(--text); }
.btn-paid { background: var(--paid); color: var(--paid-on); border-color: var(--paid); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-link {
  font: inherit; font-weight: 650; font-size: 14px;
  min-height: 44px; padding: 0 4px;
  background: none; border: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 16px; margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.panel-head .export { font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------------ balls */
.balls { display: flex; gap: 6px; flex-wrap: nowrap; }
.ball {
  flex: none;
  width: 46px; height: 46px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ball); color: var(--ball-text);
  font: 700 18px/1 "Bricolage Grotesque", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.ball.off { background: var(--ball-off-bg); color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--border); }
.balls.sm .ball { width: 36px; height: 36px; font-size: 15px; }

/* ------------------------------------------------------------------ tickets */
.summary {
  background: var(--summary-bg); color: var(--summary-text);
  border-radius: 18px; padding: 18px;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  margin-bottom: 14px;
}
.summary-count { font: 750 28px/1.1 "Bricolage Grotesque", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.summary-sub { color: var(--summary-muted); font-size: 14px; grid-column: 1; }
.summary .btn-undo {
  grid-row: 1 / span 2; grid-column: 2;
  font: inherit; font-weight: 650; font-size: 14px;
  min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--summary-text); border: 1px solid rgba(255,255,255,.35);
}
.summary .btn-undo:disabled { opacity: .4; cursor: not-allowed; }

.outlet { margin-bottom: 18px; }
.outlet label { display: block; font-weight: 650; font-size: 14px; margin-bottom: 6px; }
.outlet input {
  width: 100%; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text); font: inherit;
}

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; background: var(--amber-bg); color: var(--amber-text); border: 1px solid var(--amber-border); font-size: 14px; }

.game { margin-bottom: 22px; }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.game-head p { font-size: 14px; margin-top: 2px; }
.cards { display: grid; gap: 10px; }

.set-card { padding: 14px; }
.set-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.set-card-head p { font-size: 13px; color: var(--muted); }
.set-card.is-paid { background: var(--paid-bg); border-color: var(--paid); }
.set-card.is-paid h3, .set-card.is-paid .set-card-head p { color: var(--paid-text); }

.pill {
  flex: none;
  padding: 0 16px;
  border: 1.5px solid var(--paid);
  background: transparent; color: var(--paid-text);
  font-weight: 700; font-size: 14px;
}
.pill[aria-pressed="true"] { background: var(--paid); color: var(--paid-on); }

.paid-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px 10px 16px;
  background: var(--paid-bg); color: var(--paid-text);
  border: 1px solid var(--paid); border-radius: var(--radius);
  font-weight: 650; font-size: 15px;
}
.paid-row + .cards { margin-top: 10px; }
.paid-row .btn-link { white-space: nowrap; }
.load-more { display: flex; justify-content: center; margin: 4px 0 14px; }
.empty { padding: 16px; text-align: center; }
.empty p { margin-bottom: 10px; }

/* ------------------------------------------------------------------ chips + filters */
.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.chip {
  display: inline-flex; align-items: center;
  padding: 0 14px; min-height: 40px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.chip[aria-current="true"] { background: var(--text); color: var(--card); border-color: var(--text); }

details.filters { margin-bottom: 14px; }
details.filters summary {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer;
  font-weight: 650; font-size: 14px; list-style: none;
}
details.filters summary::-webkit-details-marker { display: none; }
details.filters summary .active { font-weight: 500; color: var(--muted); }
details.filters summary .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--paid); }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 0 4px; }
.filter-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.filter-grid select, .filter-grid input {
  min-height: 44px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-size: 15px;
}
.filter-actions { grid-column: 1 / -1; display: flex; gap: 10px; }

.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--chip-bg); gap: 2px; }
.segmented a { min-height: 38px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted); }
.segmented a[aria-current="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ------------------------------------------------------------------ overview */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kpi { padding: 14px; min-height: 104px; display: flex; flex-direction: column; gap: 2px; }
.kpi .label { font-size: 13px; font-weight: 650; color: var(--muted); }
.kpi .value { font: 750 24px/1.15 "Bricolage Grotesque", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.kpi .value.small { font-size: 18px; }
.kpi .note { font-size: 13px; color: var(--muted); margin-top: auto; }
.kpi.would { border-style: dashed; }

.chart-box { position: relative; height: 220px; }
.chart-box.tall { height: 260px; }

.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tier { padding: 12px 8px; border-radius: 12px; border: 1px solid var(--border); text-align: center; }
.tier .n { font: 750 22px/1.1 "Bricolage Grotesque", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.tier .t { font-size: 12px; color: var(--muted); font-weight: 600; }
.tier.hit { background: var(--paid-bg); border-color: var(--paid); color: var(--paid-text); }
.tier.hit .t { color: var(--paid-text); }

.rows { display: grid; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; padding-top: 0; }
.row .meta { font-size: 13px; color: var(--muted); }
.row .right { text-align: right; font-variant-numeric: tabular-nums; }
.row .right .meta { white-space: nowrap; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--chip-bg); color: var(--muted); margin-left: 6px; vertical-align: 2px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }

.status-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; border: 1px solid var(--border); color: var(--muted); }
.status-pill.partial { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-border); }
.status-pill.done { background: var(--paid-bg); color: var(--paid-text); border-color: var(--paid); }
.status-pill.missing { background: transparent; color: var(--neg); border-color: var(--neg); }

/* ------------------------------------------------------------------ results */
.draw-group { padding: 16px; margin-bottom: 14px; }
.draw-group .winning { margin: 10px 0 14px; }
.result-set { padding: 12px 0; border-top: 1px solid var(--border); }
.result-set-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; font-size: 14px; }
.result-set.unpaid { opacity: .78; }
.pending-sets { padding-top: 10px; border-top: 1px solid var(--border); font-size: 14px; }
.result-set.unpaid .balls .ball:not(.off) { box-shadow: inset 0 0 0 2px var(--ball-text); }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.paid { background: var(--paid); color: var(--paid-on); }
.badge.unpaid { border: 1.5px dashed var(--muted); color: var(--muted); }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td.r, table.data th.r { text-align: right; }
table.data tr > :last-child { padding-right: 0; }
table.data th .meta { font-size: 12px; color: var(--muted); }
table.data tr.baseline > * { background: var(--chip-bg); }
table.data tr.baseline > :first-child { padding-left: 8px; border-radius: 8px 0 0 8px; }
table.data tr.baseline > :last-child { border-radius: 0 8px 8px 0; }
table.data .hits { letter-spacing: .02em; }
.pair { display: grid; gap: 14px; }
@media (min-width: 820px) { .pair { grid-template-columns: 1fr 1fr; } .kpis { grid-template-columns: repeat(3, 1fr); } }

.hotcold { display: grid; gap: 10px; margin-top: 12px; }
.hotcold .label { font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 6px; }

/* ------------------------------------------------------------------ login */
.login { max-width: 360px; margin: 12vh auto 0; padding: 0 16px; }
.login .card { padding: 22px; }
.login label { display: block; font-weight: 650; font-size: 14px; margin: 16px 0 6px; }
.login input[type=password] { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); font: inherit; }
.login .btn { width: 100%; margin-top: 16px; }
.login .error { color: var(--neg); font-size: 14px; margin-top: 10px; }

/* insights */
.flash.audit-ok { background: var(--paid-bg); color: var(--paid-text); border-color: var(--paid); }
.value-card .row .right .status-pill { margin-top: 4px; }

/* settings + regenerate */
.top-actions { display: flex; gap: 8px; flex: none; }
.theme-toggle.icon-only { width: 44px; padding: 0; justify-content: center; text-decoration: none; }
.theme-toggle[aria-current="page"] { background: var(--text); color: var(--card); border-color: var(--text); }
.count-select { flex: none; min-height: 44px; min-width: 104px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-size: 15px; }
.toggle-row { cursor: pointer; }
.toggle-row input[type=checkbox] { flex: none; width: 24px; height: 24px; accent-color: var(--paid); }
.regen { display: flex; justify-content: flex-end; margin-top: 4px; }
.regen .btn-link { color: var(--muted); font-weight: 600; }

/* Results: each draw's sets fold away (native <details>) */
.draw-sets { border-top: 1px solid var(--border); }
.draw-sets > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 44px; padding-top: 6px; cursor: pointer; list-style: none; font-size: 14px;
}
.draw-sets > summary::-webkit-details-marker { display: none; }
.draw-sets > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.draw-sets-sum { color: var(--muted); }
.draw-sets-toggle { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; white-space: nowrap; }
.draw-sets-toggle svg { width: 18px; height: 18px; transition: transform .15s ease; }
.draw-sets[open] .draw-sets-toggle svg { transform: rotate(180deg); }
.draw-sets .when-open, .draw-sets[open] .when-closed { display: none; }
.draw-sets[open] .when-open { display: inline; }
.draw-sets[open] > summary { margin-bottom: 2px; }
.results-tools { display: flex; justify-content: flex-end; margin: -4px 0 8px; }
@media (prefers-reduced-motion: reduce) { .draw-sets-toggle svg { transition: none; } }

/* Settings: strategy tuning, one fold per strategy */
details.tuning { border-top: 1px solid var(--border); }
details.tuning > summary {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 0; min-height: 44px; cursor: pointer; list-style: none;
}
details.tuning > summary::-webkit-details-marker { display: none; }
details.tuning > summary .meta { font-size: 13px; color: var(--muted); font-weight: 400; }
details.tuning[open] > summary strong::after { content: " ▴"; color: var(--muted); }
details.tuning:not([open]) > summary strong::after { content: " ▾"; color: var(--muted); }

/* Tickets: what a set can win, per number of matches */
details.prize-guide { background: var(--chip-bg); border-radius: 12px; padding: 0 12px; margin-bottom: 10px; }
details.prize-guide > summary {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 0; min-height: 44px; cursor: pointer; list-style: none;
}
details.prize-guide > summary::-webkit-details-marker { display: none; }
details.prize-guide > summary strong { font-size: 14px; }
details.prize-guide > summary .meta { font-size: 13px; color: var(--muted); font-weight: 400; }
details.prize-guide[open] > summary strong::after { content: " ▴"; color: var(--muted); }
details.prize-guide:not([open]) > summary strong::after { content: " ▾"; color: var(--muted); }
details.prize-guide[open] { padding-bottom: 10px; }
table.prize-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.prize-table th, table.prize-table td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.prize-table thead th { font-size: 12px; font-weight: 700; color: var(--muted); }
table.prize-table tbody th { font-weight: 600; }
table.prize-table .num { text-align: right; }
table.prize-table tr > :last-child { padding-right: 0; }
table.prize-table tr.jackpot > * { font-weight: 750; border-bottom: 0; }
details.prize-guide .hint { margin-top: 8px; }

/* Settings: prize amounts per game */
fieldset.prize-row { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
fieldset.prize-row legend { padding: 0; font-size: 14px; float: left; width: 100%; }
.prize-grid { clear: both; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 6px 0 0; }
.prize-grid label { min-width: 0; }
.prize-grid input { width: 100%; min-width: 0; box-sizing: border-box; }
table.prize-table .meta { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
