/* Warm cream in light mode, true black in dark mode, a soft accent per game (sage for
   Lotto Max, sand for Lotto 6/49), in each device's own system font. */
: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;
  --max: #4d7d6b;
  --g649: #a9693a;
  /* chart lines: each game's shade above and below the minimum */
  --max-hi: #1d8a5a;
  --max-lo: #74a58f;
  --g649-hi: #cc5f0e;
  --g649-lo: #d69a6c;
  --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;
    --max: #a9cbbc;
    --g649: #e2c393;
    --max-hi: #7ee2b0;
    --max-lo: #5c9e80;
    --g649-hi: #f7b04b;
    --g649-lo: #b58a50;
    --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 { -webkit-tap-highlight-color: transparent; }
.max { color: var(--max); }
.g649 { color: var(--g649); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.dot.max { background: var(--max); }
.dot.g649 { background: var(--g649); }

/* Top bar */
.appbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px 14px; }
.brand { display: flex; align-items: center; gap: 8px; }
.mark { width: 20px; height: 20px; flex: none; }
.mark-max { fill: var(--max); }
.mark-649 { fill: var(--g649); stroke: var(--bg); stroke-width: 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;
  cursor: pointer;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); flex: none; }
.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 { animation: pulse 1s ease-in-out infinite; }

/* Shared */
.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 22px;
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-bottom: 14px;
}
.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; }
.note { margin-top: 14px; font-size: 12px; 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); }
.badge {
  display: inline-block;
  margin-right: 4px;
  border-radius: 999px;
  padding: 1px 8px;
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  color: var(--warn-text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: 1px;
}

/* The game cards side by side, and the charts side by side under them */
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.pair > .card { margin-bottom: 0; }

/* Recommendation */
.verdict { max-width: 640px; margin-inline: auto; padding: 22px 20px 20px; }
.verdict-title { font-size: 32px; line-height: 1.1; font-weight: 700; letter-spacing: -0.035em; margin: 8px 0 6px; }
.verdict-sub { font-size: 14px; color: var(--text-2); line-height: 1.45; }
.verdict-foot { margin-top: 12px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.verdict-foot + .verdict-foot { margin-top: 6px; }
.verdict-foot strong { color: var(--text); font-weight: 600; }

/* The two games as bars from $0; the minimum is a tick across both tracks */
.vs {
  --name: 96px;
  --num: 52px;
  --gap: 12px;
  position: relative;
  display: grid;
  gap: 12px;
  margin: 22px 0 4px;
  padding-top: 18px;
}
.vs-row { display: grid; grid-template-columns: var(--name) 1fr var(--num); gap: var(--gap); align-items: center; }
.vs-name { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.vs-track { position: relative; height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.vs-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--text-3); opacity: 0.45; }
.vs-fill.max { background: var(--max); }
.vs-fill.g649 { background: var(--g649); }
.vs-row.is-best .vs-fill { opacity: 1; }
.vs-num { text-align: right; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.vs-row.is-best .vs-name { color: var(--text); }
.vs-min-layer { position: absolute; top: 0; bottom: -4px; left: calc(var(--name) + var(--gap)); right: calc(var(--num) + var(--gap)); pointer-events: none; }
.vs-min { position: absolute; top: 14px; bottom: 0; width: 0; border-left: 1px dashed var(--text-3); }
.vs-min span { position: absolute; top: -16px; left: 0; transform: translateX(-50%); font-size: 10.5px; font-weight: 500; color: var(--text-3); white-space: nowrap; }

/* Prize toggle */
.segmented {
  display: flex;
  max-width: 260px;
  margin: 2px auto 16px;
  padding: 3px;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 999px;
}
.segmented button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: 500 13px/1.4 var(--font);
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.segmented button[aria-pressed="true"] { background: var(--invert-bg); color: var(--invert-text); font-weight: 600; }

/* Game cards */
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.game-head h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.game-when { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.jackpot { font-size: 46px; line-height: 1.05; font-weight: 700; letter-spacing: -0.045em; margin-top: 4px; }
.tags { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: 12px; color: var(--text-2); background: var(--inset); border-radius: 999px; padding: 4px 10px; }

/* Whether the game is sure to pay out */
.guarantee { margin-top: 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--rule); font-size: 13px; color: var(--text-2); line-height: 1.5; }
.guarantee-title { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; font-size: 13px; font-weight: 600; color: var(--text); }
.guarantee-title::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.guarantee-title.is-sure::before { background: var(--ok); }
.guarantee strong { color: var(--text); font-weight: 600; }

.value { margin-top: 18px; padding: 16px; border-radius: 16px; background: var(--inset); }
.value-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.value-num { font-size: 30px; line-height: 1; font-weight: 700; letter-spacing: -0.04em; }
.value .caption { margin-top: 4px; }
.bar { display: flex; gap: 2px; height: 6px; margin: 14px 0 6px; border-radius: 999px; overflow: hidden; background: var(--track); }
.bar span { display: block; height: 100%; }

/* Label-and-figure rows, like a settings list */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 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; white-space: nowrap; }
.list small { display: block; margin-top: 1px; font-size: 12px; color: var(--text-3); }
.parts li { padding: 6px 0; font-size: 13px; color: var(--text-2); border-top: 0; }
.parts li > span { display: inline-flex; align-items: center; gap: 8px; }
.parts i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.parts b { color: var(--text); }
.facts { margin-top: 10px; }
.facts li { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: baseline; padding: 11px 2px; }
.facts b { font-size: 16px; letter-spacing: -0.01em; }
.facts small { grid-column: 1; }

/* Charts */
.chart-card h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.chart-card .caption { margin-top: 4px; }
.chart { margin: 16px -4px 0; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 9.5px; font-family: var(--font); }
.chart .max.hi { stroke: var(--max-hi); fill: var(--max-hi); }
.chart .max.lo { stroke: var(--max-lo); fill: var(--max-lo); }
.chart .g649.hi { stroke: var(--g649-hi); fill: var(--g649-hi); }
.chart .g649.lo { stroke: var(--g649-lo); fill: var(--g649-lo); }
.chart .line.hi,
.chart .line.lo { fill: none; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; } /* after the shade rules' fill */

.chart circle.next.hi,
.chart circle.next.lo { fill: var(--card); stroke-width: 1.7; }
.chart circle.focus { fill: none; stroke: var(--text); stroke-width: 1; }
.chart .minline { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 4px 0; font-size: 12px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 3px; border-radius: 2px; margin-right: -3px; }
.chart-legend i:nth-of-type(2) { margin-right: 2px; }
.chart-legend .key-max .hi { background: var(--max-hi); }
.chart-legend .key-max .lo { background: var(--max-lo); }
.chart-legend .key-g649 .hi { background: var(--g649-hi); }
.chart-legend .key-g649 .lo { background: var(--g649-lo); }
.chart-legend .key-min::before { content: ""; width: 14px; border-top: 1px dashed var(--text-3); }
.chart-key-note { margin: 4px 4px 0; font-size: 11.5px; color: var(--text-3); }
.readout { min-height: 2.9em; margin-top: 10px; font-size: 12.5px; color: var(--text-2); line-height: 1.45; }

/* Phones: two narrow columns, so each card tightens up and stacks its rows */
@media (max-width: 640px) {
  main { padding-left: 12px; padding-right: 12px; }
  .pair { gap: 8px; margin-bottom: 10px; }
  .pair > .card { padding: 14px 11px; border-radius: 18px; }
  .game-head { flex-direction: column; align-items: flex-start; gap: 2px; margin-bottom: 12px; }
  .game-head h2 { font-size: 15px; }
  .game-when { white-space: normal; font-size: 11px; }
  .kicker { font-size: 10.5px; }
  .jackpot { font-size: 30px; }
  .tags { gap: 4px; margin-top: 8px; }
  .tags li { font-size: 10.5px; padding: 3px 7px; }
  .guarantee { margin-top: 10px; padding: 9px 10px; font-size: 11.5px; }
  .guarantee-title { font-size: 12px; }
  .value { margin-top: 12px; padding: 11px 10px; border-radius: 12px; }
  .value-head { flex-direction: column; gap: 4px; }
  .value-num { font-size: 24px; }
  .value .caption { font-size: 11px; }
  .parts li { font-size: 11.5px; gap: 6px; padding: 4px 0; }
  .parts li > span { gap: 5px; }
  .parts i { width: 6px; height: 6px; }
  .facts li { grid-template-columns: 1fr; padding: 9px 0; font-size: 12.5px; }
  .facts b { font-size: 15px; margin-top: 1px; }
  .facts small { font-size: 11px; }
  .note { font-size: 11px; }
  .chart-card h2 { font-size: 14px; }
  .chart-card .caption { font-size: 11px; }
  .chart { margin: 12px -2px 0; }
  .chart-legend { gap: 4px 10px; font-size: 11px; margin: 8px 2px 0; }
  .chart-key-note, .readout { font-size: 11px; }
}

/* Draw simulator: balls in the game's colour, revealed one by one like the TV draw */
.sim { max-width: 640px; margin-inline: auto; color: var(--text); --accent: var(--max); } /* text colour over the game class's */
.sim.g649 { --accent: var(--g649); }
.sim h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.sim > .caption { margin-top: 4px; }
.sim .segmented { margin: 16px auto 4px; }
.sim .kicker { margin: 16px 0 8px; }
.sim .caption { margin-top: 8px; }
.balls { display: flex; flex-wrap: wrap; gap: 6px; }
.balls.small { gap: 5px; }
.ball { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--inset); border: 1.5px solid var(--rule); font-size: 14px; font-weight: 600; }
.balls.small .ball { width: 28px; height: 28px; font-size: 12px; }
.ball.drawn, .ball.hit { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.ball.bonus { background: transparent; border: 2px solid var(--accent); color: var(--text); }
.sim-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sim-size { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 14px; }
.sim-size span { width: 112px; color: var(--text-2); }
.sim-size b { min-width: 16px; text-align: center; font-weight: 600; }
.sim-set { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.sim-nums { display: inline-flex; gap: 10px; font-size: 14px; }
.sim-nums span { min-width: 2ch; text-align: right; }
.sim-lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 6px 16px; margin-top: 8px; }
.sim-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.sim-line b { font-size: 12px; font-weight: 600; }
.sim-play { grid-column: 1 / -1; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.sim-actions button, .sim-tally button, .sim-grid button, .sim-size button, .sim-set button {
  font: 500 13px/1.4 var(--font);
  color: var(--text);
  background: var(--inset);
  border: 1px solid var(--card-edge);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}
.sim-actions .primary { background: var(--accent); color: var(--bg); font-weight: 600; padding: 8px 22px; }
.sim-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; max-width: 360px; }
.sim-grid button { padding: 0; aspect-ratio: 1; border-radius: 50%; }
.sim-size button { width: 34px; height: 34px; padding: 0; font-size: 18px; }
.sim button:disabled { opacity: 0.35; cursor: default; }
.sim-grid button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.sim-draw { margin-top: 18px; }
.sim-draw .drawn { animation: pop 0.35s both; animation-delay: calc(var(--i) * 0.7s); }
.sim-after { animation: fade 0.4s both; animation-delay: calc(var(--i) * 0.7s); }
.sim-draw.skip .drawn, .sim-draw.skip .sim-after { animation-delay: 0s; }
.sim-numbers { margin-top: 10px; font-size: 13px; color: var(--text-2); }
.sim details { margin-top: 10px; font-size: 13px; color: var(--text-2); }
.sim summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.sim-won { margin-top: 16px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.sim-tally { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 16px; font-size: 13px; color: var(--text-2); }
.sim-tally:empty { display: none; }
.sim-tally button, .sim-set button { padding: 3px 10px; font-size: 12px; }
@keyframes pop { from { opacity: 0; transform: scale(0.4); } }
@keyframes fade { from { opacity: 0; } }
@media (max-width: 640px) {
  .ball { width: 32px; height: 32px; }
  .balls.small .ball { width: 26px; height: 26px; }
}

/* 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; }

/* Loading placeholders */
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--track) 25%, var(--rule) 37%, var(--track) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton-title { width: 60%; height: 32px; margin: 10px 0 8px; }
.skeleton-line { width: 45%; height: 14px; }
.skeleton-bars { height: 44px; margin-top: 24px; }

@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
@keyframes pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton, .status.is-busy .status-dot, .sim-draw .drawn, .sim-after { animation: none; }
  .segmented button { transition: none; }
}
