/* Zenith Lotto — mobile-first, calm, large targets.
   Visual language follows the Zenith baseline (deep navy canvas, gold primary
   action, card surfaces) but is written from scratch: no GG LMS code copied.
   All colours are tokens so branding stays configurable. */

:root {
  --bg: #0f2540;
  --panel: #15335a;
  --panel-2: #1c4272;
  --border: #2a4f80;
  --text: #f4f7fb;
  --muted: #a9c0dc;
  --primary: #c9a227;
  --primary-text: #0f2540;
  --good: #3fb8a0;
  --warn: #ffcc66;
  --bad: #ff8a8a;
  --ball: #f4f7fb;
  --ball-text: #0f2540;
  --radius: 14px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --maxw: 640px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
.eyebrow { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.35em; font-weight: 700; }
p { margin: 0 0 0.8em; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--primary-text); padding: 8px 14px; z-index: 10; }
.skip-link:focus { left: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.brand { font-weight: 800; letter-spacing: 0.02em; color: var(--text); text-decoration: none; }
.brand span { color: var(--primary); }
.topbar nav { display: flex; gap: 8px; align-items: center; }

main { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 16px; }
main.wide { max-width: 1040px; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card--accent { border-color: var(--primary); }
.card--good { border-color: var(--good); }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* Buttons: min 48px targets. */
.btn {
  appearance: none; border: 2px solid transparent; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 700; min-height: 52px; padding: 10px 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn--primary { background: var(--primary); color: var(--primary-text); }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn--danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn--small { min-height: 40px; padding: 6px 14px; font-size: 0.9rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 2px solid var(--border); border-radius: 10px; padding: 12px; min-height: 52px;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; }
.field { margin-bottom: 14px; }
.hint { font-size: 0.88rem; color: var(--muted); margin-top: 4px; }

/* Number balls */
.balls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.ball {
  width: 48px; height: 48px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ball); color: var(--ball-text); font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums;
}
.ball--big { width: 56px; height: 56px; font-size: 1.3rem; }
.ball--hit { background: var(--good); color: #062a22; }
.ball--miss { background: transparent; color: var(--muted); border: 2px dashed var(--border); }
/* A tick gained in the latest draw. */
.ball--new { box-shadow: 0 0 0 3px var(--primary); }
.ball--bonus { background: transparent; color: var(--text); border: 2px solid var(--muted); }

/* Cumulative tick card progress (width set via CSSOM: the CSP forbids inline styles). */
.progress { height: 10px; border-radius: 999px; background: var(--panel-2); overflow: hidden; margin: 6px auto 10px; max-width: 360px; }
.progress__fill { display: block; height: 100%; width: 0; background: var(--good); }

/* Picker grid: 1–45 */
.picker-count { font-size: 1.1rem; font-weight: 700; text-align: center; margin: 4px 0 12px; }
.picker-count.done { color: var(--good); }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.num {
  aspect-ratio: 1; min-height: 44px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 700; font-size: 1.05rem;
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.num[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.num:disabled { opacity: 0.35; cursor: not-allowed; }
.picker-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin-top: 12px; }

.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; padding: 4px 12px; border-radius: 999px; font-size: 0.9rem; }
.status--good { background: rgba(63, 184, 160, 0.18); color: var(--good); }
.status--warn { background: rgba(255, 204, 102, 0.16); color: var(--warn); }
.status--muted { background: rgba(169, 192, 220, 0.14); color: var(--muted); }
.status--bad { background: rgba(255, 138, 138, 0.15); color: var(--bad); }

.big-line { font-size: 1.6rem; font-weight: 800; margin: 6px 0; }
.recovery-codes { columns: 2; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.1rem; letter-spacing: 0.06em; padding-left: 1.2em; }
.recovery-codes li { margin: 4px 0; }
.code-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.5rem; letter-spacing: 0.08em; background: var(--bg); border: 2px dashed var(--primary); border-radius: 12px; padding: 14px; text-align: center; user-select: all; overflow-wrap: anywhere; }

.notice { border-left: 4px solid var(--warn); background: rgba(255, 204, 102, 0.08); padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; }
.error { border-left: 4px solid var(--bad); background: rgba(255, 138, 138, 0.1); padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; }

/* Admin */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 4px; }
.tab { white-space: nowrap; }
.tab[aria-current="page"] { background: var(--primary); color: var(--primary-text); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--panel-2); border-radius: 10px; padding: 12px; }
.stat b { display: block; font-size: 1.25rem; }
.stat span { font-size: 0.85rem; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8rem; color: var(--muted); word-break: break-all; }
/* Printable sign-in cards */
.signin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.signin-card { background: #fff; color: #111; border: 2px dashed #888; border-radius: 10px; padding: 14px; break-inside: avoid; page-break-inside: avoid; }
.signin-card p { margin: 0 0 4px; }
.signin-card__comp { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: #555; }
.signin-card__name { font-size: 1.2rem; font-weight: 800; }
.signin-card__label { font-size: 0.8rem; color: #555; margin-top: 8px !important; }
.signin-card__code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.4rem; font-weight: 700; letter-spacing: 0.06em; }
.signin-card__site { font-weight: 600; }
.signin-card__note { font-size: 0.75rem; color: #555; }
@media print {
  .topbar, footer.site, .no-print, .tabs { display: none !important; }
  body, main { background: #fff; color: #111; padding: 0; max-width: none; }
  .signin-cards { grid-template-columns: repeat(2, 1fr); gap: 8mm; }
}

/* Leaderboard */
.board { list-style: none; margin: 0; padding: 0; }
.board__row { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.board__row--you { background: rgba(201, 162, 39, 0.14); border-radius: 8px; }
.board__rank { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.board__name { overflow-wrap: anywhere; }
.board__count { font-weight: 800; font-variant-numeric: tabular-nums; }

/* Paper import */
.import-draw, .import-entry { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
@media (max-width: 420px) {
  /* Nested inside a card, six boxes clip two-digit numbers on a phone: use 3 × 2. */
  .import-draw .result-inputs { grid-template-columns: repeat(3, 1fr); }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
label.btn { margin: 0; }
td.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.result-inputs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.result-inputs input { text-align: center; padding: 8px 4px; }
details summary { cursor: pointer; color: var(--muted); }

footer.site { padding: 16px; font-size: 0.8rem; color: var(--muted); text-align: center; border-top: 1px solid var(--border); }

/* Seven 44px targets do not fit a 360px phone; six do. */
@media (max-width: 380px) {
  .grid { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 360px) {
  .ball { width: 42px; height: 42px; font-size: 1rem; }
  .ball--big { width: 48px; height: 48px; font-size: 1.1rem; }
}

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(9, 1fr); }
  h1 { font-size: 1.7rem; }
}
