/* Lotto Results Finder. One stylesheet, no framework. */
:root {
  --bg: #fbfaf6;
  --surface: #ffffff;
  --sunk: #f3f1ea;
  --ink: #1b2420;
  --muted: #5a6560;
  --line: #e3e0d6;
  --accent: #17624a;
  --accent-ink: #0f4a37;
  --accent-soft: #e4f1eb;
  --gold: #f2b233;
  --red: #cf3b2b;
  --blue: #2c67d6;
  --green: #1d8a5a;
  --ball: #ffffff;
  --ball-ink: #1b2420;
  --ball-line: #cfcabd;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 36, 32, .06), 0 4px 16px rgba(27, 36, 32, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121714;
    --surface: #1a211d;
    --sunk: #202823;
    --ink: #e8ece9;
    --muted: #a3ada8;
    --line: #2d3732;
    --accent: #5cc49b;
    --accent-ink: #8fdcbc;
    --accent-soft: #1f3a2f;
    --ball: #f4f2ec;
    --ball-ink: #151a17;
    --ball-line: #f4f2ec;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.4rem); margin: 0 0 .4em; }
h2 { font-size: 1.35rem; margin: 0 0 .7em; }
h3 { font-size: 1rem; margin: 0 0 .6em; }
img, svg { max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--sunk); }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 780px; }
main { padding-bottom: 48px; }

/* ---------------------------------------------------------------- header */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { color: var(--accent); }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.site-nav a:hover, .site-nav a[aria-current] { background: var(--sunk); }
.gamebar { border-top: 1px solid var(--line); }
.gamebar ul { list-style: none; margin: 0; padding: 8px 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.gamebar a { display: block; white-space: nowrap; padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: .92rem; border: 1px solid var(--line); }

.crumbs ol { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 4px; }
.crumbs a { color: var(--muted); }
.page-head { padding: 20px 0 8px; }
.lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 .5em; max-width: 46em; }
.byline { color: var(--muted); font-size: .9rem; margin: 0; }

/* ----------------------------------------------------------------- balls */
.balls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ball, .digit {
  display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--ball); color: var(--ball-ink); border: 2px solid var(--ball-line);
  font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; flex: none;
}
.digit { border-radius: 10px; background: var(--g); border-color: var(--g); color: var(--g-ink); }
.ball-red { background: var(--red); border-color: var(--red); color: #fff; }
.ball-gold { background: var(--gold); border-color: var(--gold); color: #2a1f05; }
.ball-green { background: var(--green); border-color: var(--green); color: #fff; }
.ball-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.balls.small { gap: 5px; }
.balls.small .ball, .balls.small .digit { width: 32px; height: 32px; font-size: .88rem; border-width: 1.5px; }
.balls.keno .ball { width: 36px; height: 36px; font-size: .92rem; }
.balls.keno.small .ball { width: 28px; height: 28px; font-size: .78rem; }
.ball.hit { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 6px; background: var(--sunk); color: var(--muted); vertical-align: middle; }

/* --------------------------------------------------------------- results */
section.latest { display: grid; gap: 14px; margin: 8px 0 8px; }
.result-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.result-date { font-size: 1.05rem; margin: 0 0 12px; font-weight: 600; }
.result-card .meta { margin: 12px 0 0; color: var(--muted); }
.dp { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dp-label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.schedule { color: var(--muted); font-size: .95rem; margin: 4px 0 0; }
.more { margin: 12px 0 0; }
.block { margin-top: 40px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap table { min-width: 100%; }
.table-wrap tr:last-child td, .table-wrap tr:last-child th { border-bottom: 0; }
table.results td:first-child { white-space: nowrap; font-size: .95rem; }
table.odds tr.top td { font-weight: 700; }
.note { color: var(--muted); font-size: .9rem; margin: 10px 0 0; }
.note.source { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------ home cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 8px; }
.game-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.game-card h2 { font-size: 1.15rem; margin: 0 0 6px; }
.game-card h2 a { color: var(--ink); text-decoration: none; }
.game-card h2 a:hover { color: var(--accent); }
.card-date { margin: 8px 0 6px; font-size: .88rem; color: var(--muted); }
.card-foot { margin: auto 0 0; padding-top: 14px; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; font-size: .88rem; color: var(--muted); }
.card-foot a { white-space: nowrap; }

/* ----------------------------------------------------------------- stats */
.trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.trend-grid > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.chips, .rank { list-style: none; padding: 0; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips li { display: grid; justify-items: center; gap: 2px; }
.chips .ball, .rank .ball { width: 36px; height: 36px; font-size: .92rem; }
.chips small, .rank small { color: var(--muted); font-size: .78rem; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.freq-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 16px; }
.freq-grid li { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 8px; }
.freq-grid .ball { width: 32px; height: 32px; font-size: .85rem; border-width: 1.5px; }
.freq-grid .bar { height: 8px; background: var(--sunk); border-radius: 4px; overflow: hidden; }
.freq-grid .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.freq-grid small { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.digit-table .digit { width: 30px; height: 30px; font-size: .88rem; }
.digit-table small { color: var(--muted); }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 4px 18px; margin: 12px 0 0; }

/* -------------------------------------------------------------- archives */
.year-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.year-grid a { display: grid; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--ink); }
.year-grid a:hover { border-color: var(--accent); }
.year-grid small { color: var(--muted); }
.month-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.month-jump a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: .88rem; background: var(--surface); }
.pager { display: flex; justify-content: space-between; margin-top: 32px; gap: 12px; }
.pager a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; background: var(--surface); }

/* ------------------------------------------------------------- checker */
.checker { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.checker label { display: block; margin-bottom: 8px; }
.checker-row { display: flex; gap: 8px; flex-wrap: wrap; }
.checker input { flex: 1 1 220px; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
.checker input.bonus-input { flex: 0 1 140px; }
.checker button { font: inherit; font-weight: 600; padding: 10px 20px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; cursor: pointer; }
@media (prefers-color-scheme: dark) { .checker button { color: #0d1511; } }
.checker-out:not(:empty) { margin-top: 14px; }
.checker-out .err { color: var(--red); margin: 0; }
.checker-out .summary { font-weight: 600; margin: 0 0 10px; }
.checker-out td { padding: 8px 10px; }

/* --------------------------------------------------------------- prose */
.prose { max-width: 46em; }
.prose p, .prose li { margin: 0 0 .9em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose h2 { margin-top: 1.6em; }
.prose table { margin: 0 0 1.2em; background: var(--surface); border: 1px solid var(--line); }
.prose .formula { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92rem; background: var(--sunk); padding: 10px 14px; border-radius: 10px; overflow-x: auto; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; }
.post-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.post-list a { font-weight: 600; font-size: 1.05rem; }
.post-list p { margin: 2px 0 0; color: var(--muted); }
.post-list small { color: var(--muted); font-size: .82rem; }
.post-list.big li { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.game-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.game-links a { display: block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; }
.by-day { padding-left: 1.2em; }

/* -------------------------------------------------------------- footer */
.site-foot { background: var(--surface); border-top: 1px solid var(--line); padding: 36px 0 28px; font-size: .92rem; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.foot-grid h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.foot-grid ul { list-style: none; padding: 0; margin: 0; }
.foot-grid li { margin-bottom: 4px; }
.foot-grid p { color: var(--muted); max-width: 26em; }
.foot-note { color: var(--muted); font-size: .84rem; margin: 18px 0 0; }

@media (max-width: 640px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-grid > div:first-child { grid-column: 1 / -1; }
  .ball, .digit { width: 40px; height: 40px; font-size: 1rem; }
  .result-card { padding: 16px; }
  th, td { padding: 8px 10px; }
  .head-row { min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
  .site-nav a { padding: 6px 8px; font-size: .9rem; }
}

/* ------------------------------------------------------ archive tools */
.date-finder { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.date-finder label { display: block; margin-bottom: 8px; font-weight: 600; }
.date-finder input, .archive-tools input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); min-width: 0; }
.date-finder button { font: inherit; font-weight: 600; padding: 10px 20px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; cursor: pointer; }
@media (prefers-color-scheme: dark) { .date-finder button { color: #0d1511; } }
.archive-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin: 12px 0 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.archive-tools label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.archive-tools input { width: 100%; }
.archive-tools .filter-note { grid-column: 1 / -1; margin: 0; }
.archive-tools .filter-note:empty { display: none; }
tr.draw { scroll-margin-top: 90px; }
tr.draw.picked td, tr.draw:target td { background: var(--accent-soft); }
tr.draw.picked td:first-child { box-shadow: inset 4px 0 0 var(--accent); }

/* ------------------------------------------------ game colours and latest draw */
/* --g is the current game's colour (set inline); pages without a game use the site accent. */
:root { --g: var(--accent); --g-ink: #fff; }
@media (prefers-color-scheme: dark) { :root { --g-ink: #0d1511; } }
.badge {
  display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 7px; border-radius: 10px;
  background: var(--g); color: var(--g-ink); font-weight: 800; font-size: .8rem; letter-spacing: .02em; line-height: 1; flex: none;
}
.game-title { display: flex; align-items: center; gap: 12px; }
.game-title .badge { min-width: 44px; height: 44px; font-size: .95rem; border-radius: 12px; }
.gamebar a { display: flex; align-items: center; gap: 7px; }
.gamebar .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--g); flex: none; }
.gamebar a:hover { border-color: var(--g); }
.gamebar a[aria-current] { background: var(--g); border-color: var(--g); color: var(--g-ink); }
.gamebar a[aria-current] .dot { background: var(--g-ink); }

.game-card { border-top: 5px solid var(--g); }
.game-card h2 { display: flex; align-items: center; gap: 10px; }
.game-card h2 .badge { min-width: 32px; height: 32px; font-size: .74rem; border-radius: 9px; }

/* The newest draw: tinted in the game's colour, bold, and labelled. */
.latest-card {
  border: 2px solid var(--g);
  background: color-mix(in srgb, var(--g) 9%, var(--surface));
  box-shadow: 0 6px 22px color-mix(in srgb, var(--g) 22%, transparent);
}
.latest-label {
  display: inline-block; margin: 0 0 10px; padding: 3px 10px; border-radius: 999px;
  background: var(--g); color: var(--g-ink); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
}
.latest-card .result-date { font-size: 1.25rem; font-weight: 800; }
.latest-card .balls { gap: 10px; }
.latest-card .balls:not(.small) .ball, .latest-card .balls:not(.small) .digit { width: 56px; height: 56px; font-size: 1.35rem; border-width: 2.5px; }
.latest-card .balls.keno:not(.small) .ball { width: 42px; height: 42px; font-size: 1rem; }
tr.latest td { background: color-mix(in srgb, var(--g) 11%, var(--surface)); font-weight: 700; }
tr.latest td:first-child { box-shadow: inset 5px 0 0 var(--g); }
.latest-tag {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; vertical-align: middle;
  background: var(--g); color: var(--g-ink); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
}
@media (prefers-color-scheme: dark) {
  .latest-card { background: color-mix(in srgb, var(--g) 16%, var(--surface)); }
  tr.latest td { background: color-mix(in srgb, var(--g) 18%, var(--surface)); }
}
@media (max-width: 640px) {
  .latest-card .balls:not(.small) .ball, .latest-card .balls:not(.small) .digit { width: 48px; height: 48px; font-size: 1.15rem; }
  .game-title .badge { min-width: 38px; height: 38px; font-size: .85rem; }
}
