:root {
  color-scheme: light;
  --ink: #202a2b;
  --muted: #647173;
  --line: #d9e0dc;
  --paper: #f5f7f5;
  --surface: #ffffff;
  --pine: #173d32;
  --green: #187457;
  --green-soft: #e7f3ed;
  --gold: #a87517;
  --gold-soft: #fbf1d9;
  --blue: #38668b;
  --red: #a53c3c;
  --red-soft: #f9e9e7;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; background: var(--paper); }
button, input, select { font: inherit; }
button, select, input[type="checkbox"] { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }

.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); color: #fff; background: var(--pine); }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; color: inherit; font-size: 17px; font-weight: 700; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid #b8d6c8; border-radius: 50%; color: var(--pine); background: #e5f0e9; font-size: 15px; font-weight: 800; }
.topbar-tools, .connection-state { display: flex; align-items: center; gap: 12px; }
.connection-state { color: #e1ebe5; font-size: 13px; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5bd61; }
.connection-state.online .state-dot { background: #7ed0a6; }
.connection-state.offline .state-dot { background: #f09583; }
.page-shell { width: min(100% - 40px, 1120px); margin: 0 auto; padding: 42px 0 72px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 0 0 28px; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 720px; margin-bottom: 8px; font-size: 32px; line-height: 1.15; font-weight: 690; }
h2 { margin-bottom: 6px; font-size: 20px; line-height: 1.25; font-weight: 680; }
.muted, .field-hint { color: var(--muted); }
.page-heading .muted { margin: 0; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: 12px; font-weight: 700; }
.plays-section { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.play-group { min-width: 0; margin: 0; padding: 24px 28px 26px; border: 0; }
.play-group legend { display: flex; align-items: center; gap: 10px; padding: 0; font-size: 18px; font-weight: 700; }
.loto-group { border-left: 1px solid var(--line); }
.game-badge { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 800; }
.quini-badge { color: #fff; background: var(--green); }
.loto-badge { color: #fff; background: var(--blue); }
.field-hint { margin: 12px 0 16px; font-size: 13px; }
.number-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.number-grid input { width: 100%; min-width: 0; height: 48px; border: 1px solid #bcc9c2; border-radius: 4px; background: #fbfcfb; color: var(--ink); text-align: center; font-size: 17px; font-variant-numeric: tabular-nums; }
.number-grid input:focus, input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid #78a9cc; outline-offset: 2px; }
.field-label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 650; }
select, input[type="number"], input[type="password"] { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid #bcc9c2; border-radius: 4px; color: var(--ink); background: #fff; }
select:disabled { color: #7b8582; background: #f1f4f2; }
.check-row { display: flex; align-items: flex-start; gap: 9px; min-height: 24px; font-size: 14px; line-height: 1.45; }
.check-row input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--green); flex: 0 0 auto; }
#loto-plus { max-width: 150px; }
.query-options { display: grid; grid-template-columns: minmax(240px, 1fr) auto 190px; align-items: center; gap: 24px; margin-top: 16px; padding: 18px 22px; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 4px; background: #fffefa; }
.query-option-copy h2 { margin-bottom: 4px; font-size: 16px; }
.query-option-copy p { margin-bottom: 0; font-size: 13px; }
.count-control { display: grid; grid-template-columns: 1fr 76px; align-items: center; gap: 10px; font-size: 13px; font-weight: 650; }
.count-control input { width: 76px; text-align: center; }
.action-row, .action-group { display: flex; align-items: center; gap: 10px; }
.action-row { justify-content: space-between; flex-wrap: wrap; padding: 18px 0 24px; }
.action-secondary { margin-left: auto; }
.action-hint { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 13px; }
.button { min-height: 40px; display: inline-flex; justify-content: center; align-items: center; padding: 0 15px; border: 1px solid transparent; border-radius: 4px; font-size: 14px; font-weight: 650; text-decoration: none; transition: background-color .15s ease, border-color .15s ease; }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: #105b43; }
.button-secondary { color: var(--ink); border-color: #c4cec8; background: #fff; }
.button-secondary:hover { background: #edf2ee; }
.button-quiet { color: #465351; background: transparent; }
.button-quiet:hover { background: #e9eeeb; }
.button-danger { color: #8b2929; border-color: #e7c6c2; background: var(--red-soft); }
.button-wide { width: 100%; margin-top: 6px; }
.activity-section { padding: 20px 22px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.activity-heading, .results-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; }
.activity-heading h2, .results-heading h2 { margin: 0; }
.progress-label { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 8px; display: block; margin: 16px 0 10px; overflow: hidden; border: 0; border-radius: 8px; background: #e6ebe8; accent-color: var(--green); }
progress::-webkit-progress-bar { border-radius: 8px; background: #e6ebe8; }
progress::-webkit-progress-value { border-radius: 8px; background: var(--green); transition: width .25s ease; }
progress::-moz-progress-bar { border-radius: 8px; background: var(--green); }
.activity-detail { margin: 0; color: var(--muted); font-size: 13px; }
.results-section { margin-top: 28px; }
.results-heading { padding: 0 0 14px; border-bottom: 1px solid var(--line); }
.result-count { color: var(--muted); font-size: 13px; }
.results-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 30px; }
.result-game { min-width: 0; }
.result-game h3 { margin: 20px 0 6px; font-size: 17px; }
.draw-row { border-bottom: 1px solid var(--line); }
.draw-row summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 44px; cursor: pointer; list-style-position: inside; font-size: 13px; }
.draw-row summary::marker { color: var(--green); }
.draw-row[open] summary { color: var(--green); font-weight: 650; }
.draw-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.modality-list { padding: 0 0 12px 20px; }
.modality-row { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; align-items: center; gap: 10px; min-height: 32px; font-size: 12px; }
.modality-name { color: var(--muted); }
.ball-list { display: flex; flex-wrap: wrap; gap: 4px; }
.ball { width: 27px; height: 27px; display: inline-grid; place-items: center; border: 1px solid #c8d8ce; border-radius: 50%; color: var(--pine); background: #edf5ef; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hits { color: var(--green); font-size: 12px; font-weight: 700; white-space: nowrap; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 5; max-width: min(420px, calc(100vw - 40px)); padding: 12px 16px; border: 1px solid #9fb5a8; border-radius: 4px; color: var(--ink); background: #fff; box-shadow: 0 8px 24px #152b211f; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--pine); }
.login-panel { width: min(100%, 410px); padding: 30px; border-radius: 6px; background: #fff; }
.login-panel .brand-lockup { margin-bottom: 30px; color: var(--pine); }
.login-panel h1 { margin-bottom: 8px; font-size: 26px; }
.login-panel .muted { margin-bottom: 24px; font-size: 14px; }
.login-panel label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.login-panel input { margin-bottom: 14px; }
.form-error { margin: 12px 0 0; color: var(--red); font-size: 13px; }

@media (max-width: 760px) {
  .topbar { min-height: 60px; padding: 0 16px; }
  .page-shell { width: min(100% - 28px, 560px); padding-top: 28px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 16px; }
  h1 { font-size: 27px; }
  .plays-section { grid-template-columns: 1fr; }
  .play-group { padding: 20px 18px 22px; }
  .loto-group { border-top: 1px solid var(--line); border-left: 0; }
  .query-options { grid-template-columns: 1fr 1fr; gap: 14px; padding: 16px; }
  .query-option-copy { grid-column: 1 / -1; }
  .count-control { grid-template-columns: 1fr 68px; }
  .count-control input { width: 68px; }
  .action-row { align-items: stretch; flex-direction: column; }
  .action-group { flex-wrap: wrap; }
  .action-secondary { margin-left: 0; }
  .action-group .button { flex: 1 1 auto; }
  .results-list { grid-template-columns: 1fr; }
  .modality-row { grid-template-columns: minmax(75px, .8fr) 2fr auto; gap: 7px; }
  .ball { width: 25px; height: 25px; }
}

@media (max-width: 420px) {
  .connection-state { display: none; }
  .number-grid { gap: 5px; }
  .number-grid input { height: 43px; font-size: 15px; }
  .query-options { grid-template-columns: 1fr; }
  .query-option-copy { grid-column: auto; }
  .previous-toggle { padding: 2px 0; }
  .count-control { grid-template-columns: 1fr 80px; }
  .count-control input { width: 80px; }
  .activity-section { padding: 17px 16px; }
  .activity-heading { align-items: flex-start; }
  .activity-heading h2 { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
