:root {
    --bg: #f4f5f9;
    --card: #fff;
    --ink: #1d2433;
    --muted: #6b7385;
    --line: #e2e5ee;
    --accent: #c62828;
    --accent-ink: #fff;
    --ok: #2e7d32;
    --gold: #f2b705;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h1:focus { outline: none; }
h2 { font-size: 1.2rem; margin: 0; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
a { color: #1e5bb8; }
input, textarea, select { font: inherit; padding: .4rem .55rem; border: 1px solid #c9cedb; border-radius: 6px; background: #fff; }
textarea { width: 100%; }
input.narrow { width: 5.5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: .5rem 0; }

/* nav */
.topnav { display: flex; gap: .25rem; align-items: center; background: #1d2433; padding: 0 1rem; position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.topnav .brand { color: var(--gold); font-weight: 800; letter-spacing: .12em; margin-right: 1rem; }
.topnav a { color: #cfd5e3; text-decoration: none; padding: .85rem .8rem; }
.topnav a.active { color: #fff; box-shadow: inset 0 -3px 0 var(--gold); }
.topnav .screen-link { margin-left: auto; }
.page { padding: 1.25rem; max-width: 1400px; margin: 0 auto; }
.topnav .logout { margin: 0; }
.topnav .logout button { font: inherit; background: none; border: 1px solid #4a5470; color: #cfd5e3; border-radius: 6px; padding: .3rem .7rem; cursor: pointer; margin-left: .5rem; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: radial-gradient(ellipse at top, #24304a, #0d1220 70%); }
.login { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: .9rem; }
.login-title { text-align: center; font-size: 1.6rem; font-weight: 900; letter-spacing: .2em; color: var(--accent); }
.login label { display: flex; flex-direction: column; gap: .3rem; color: var(--muted); font-size: .9rem; }
.login .btn { width: 100%; padding: .65rem; }
.login p { margin: 0; }
.login a { text-align: center; }

/* generic */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.btn { font: inherit; border: 1px solid #c9cedb; background: #fff; border-radius: 8px; padding: .5rem 1rem; cursor: pointer; }
a.btn { display: inline-block; text-decoration: none; color: inherit; }
a.btn.primary { color: var(--accent-ink); }
.btn:hover:not(:disabled) { filter: brightness(.95); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--accent); border-color: #e9b4b4; background: #fff; }
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
.pill { display: inline-block; font-size: .78rem; padding: .15rem .55rem; border-radius: 999px; background: #eef0f6; color: var(--muted); }
.notice { background: #fff6d6; border: 1px solid #f0d77b; padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.error { color: #b00020; margin: .4rem 0; font-weight: 600; }
.success { color: var(--ok); margin: .4rem 0; font-weight: 600; }
.success.inline, .error.inline { margin-left: .5rem; }
.nowrap { white-space: nowrap; }
.compact-log td { padding: .3rem .6rem; font-size: .88rem; }
.compact-log tr.log-BallAdded td:last-child { color: var(--ok); }
.compact-log tr.log-BallRemoved td, .compact-log tr.log-BallsCleared td { background: #fdecec; color: #8a1c1c; font-weight: 600; }
.compact-log tr.log-TicketsGenerated td, .compact-log tr.log-SettingsChanged td, .compact-log tr.log-Restored td { background: #fff6d6; font-weight: 600; }
.compact-log tr.log-AppStarted td { color: var(--muted); }
.table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; }
.table tr.win td { background: #e8f5e9; }
.table tr.current td { background: #fff3c4; font-weight: 600; }
.table.compact { width: auto; font-size: .82rem; }
.table.compact td, .table.compact th { padding: .2rem .5rem; }
.curves { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem 1rem; }
.form-grid label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); }
.check-label { display: flex; align-items: center; gap: .4rem; }

/* balls */
/* All balls look the same (the real balls have no colours): Loto18 yellow with dark numbers. */
.ball {
    --c: #f5c400;
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.1em; height: 2.1em; border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, #fff 0, color-mix(in srgb, var(--c) 55%, #fff) 18%, var(--c) 55%, color-mix(in srgb, var(--c) 75%, #000) 100%);
    color: #1d2433; font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.ball.tiny { font-size: .75rem; }
.ball.big { font-size: 1.9rem; }

/* game page */
.game { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(360px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .game { grid-template-columns: 1fr; } }
.draw-head { display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; }
.ballcount { font-size: 2.4rem; font-weight: 800; }
.ballcount .muted { font-size: 1.2rem; }
.last-ball { display: flex; flex-direction: column; align-items: center; }
.draw-form { display: flex; gap: .75rem; margin: 1rem 0 .6rem; align-items: stretch; }
.draw-form input { flex: 1; min-width: 10rem; height: 5rem; padding: 0 1rem; font-size: 3rem; font-weight: 800;
    border-width: 2px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.draw-form input::placeholder { font-size: 1.4rem; font-weight: 600; }
.draw-form input:focus { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.draw-form .btn { font-size: 1.3rem; padding: 0 1.6rem; border-radius: 10px; }
.board-num { user-select: none; }
.board { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: .4rem; margin-top: .75rem; }
.board-col { display: flex; flex-direction: column; gap: .3rem; }
.board-colhead { background: #e8eaf1; color: var(--muted); text-align: center; font-weight: 700; border-radius: 6px; padding: .2rem 0; font-size: .85rem; }
.board-num { font: inherit; font-weight: 700; padding: .35rem 0; border-radius: 6px; cursor: pointer;
    border: 1px solid #d5d9e3; background: #fff; color: var(--ink); }
.board-num.drawn { background: #f5c400; border-color: #d9a800; color: #1d2433; cursor: default; opacity: 1; }
.board-num.selected { outline: 3px solid var(--ink); }
.history { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1.2rem .35rem; counter-reset: b; margin-bottom: 1.6rem; }
.history li { counter-increment: b; position: relative; font-size: .8rem; }
.history li::after { content: counter(b); position: absolute; bottom: -1.1em; left: 0; right: 0; text-align: center; font-size: .65rem; color: var(--muted); }

.stages { display: flex; flex-direction: column; }
.stage { border-left: 6px solid #9aa3b5; }
.stage.open { border-left-color: #1e88e5; }
.stage.won { border-left-color: var(--ok); background: #f3fbf3; }
.stage.nowinner { border-left-color: #b0b6c3; opacity: .75; }
.stage.jackpot { border-left-color: var(--gold); background: #fff9e0; }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.stage-rule { font-size: .82rem; margin: .2rem 0 .5rem; }
.stage-status { font-weight: 800; letter-spacing: .03em; }
.stage-status span { font-weight: 500; letter-spacing: 0; color: var(--muted); }
.jackpot-line { color: #8a6500; font-weight: 600; margin-top: .2rem; }
.winners { margin: .4rem 0 0; padding-left: 1.2rem; font-size: 1.1rem; }
.nearmiss { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed var(--line); font-size: .9rem; }
.need { display: inline-flex; align-items: center; gap: .15rem; margin: .15rem .4rem .15rem 0; }

/* tickets: drawn as SVG (Services/TicketSvg.cs), same as in the PDF */
@font-face { font-family: "Ultra"; src: url("fonts/Ultra-Regular.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "Archivo Black"; src: url("fonts/ArchivoBlack-Regular.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; src: url("fonts/BarlowCondensed-Bold.ttf") format("truetype"); font-display: block; }
.ticket-sheet { display: flex; flex-wrap: wrap; gap: 6mm 4mm; }
.ticket { width: 62mm; height: 107mm; break-inside: avoid; page-break-inside: avoid; line-height: 0;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ticket-svg { display: block; width: 62mm; height: 107mm; }
.check { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; margin-top: 1rem; }
.check .table { flex: 1; min-width: 380px; background: #fff; }

/* projector screen */
.screen { min-height: 100vh; background: radial-gradient(ellipse at top, #24304a, #0d1220 70%); color: #fff; padding: 2vh 3vw; display: flex; flex-direction: column; gap: 2.5vh; }
.screen-title { text-align: center; font-size: 5vh; font-weight: 900; letter-spacing: .25em; color: var(--gold); text-shadow: 0 0 2vh rgba(242,183,5,.35); }
.screen-main { display: flex; gap: 4vw; align-items: center; justify-content: center; flex: 1; }
.screen-ball { display: flex; flex-direction: column; align-items: center; gap: 2vh; }
.ball.huge { font-size: 16vh; animation: pop .6s cubic-bezier(.2,1.6,.4,1); box-shadow: 0 2vh 6vh rgba(0,0,0,.5); }
.ball.huge.empty { --c: #4a5470; animation: none; }
@keyframes pop { from { transform: scale(.2) rotate(-90deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.screen-count { font-size: 3.6vh; font-weight: 700; color: #cfd5e3; }
.screen-board { display: flex; flex-direction: column; gap: 1.1vh; }
.screen-row { display: flex; gap: .7vh; align-items: center; }
.sb-num { width: 6.2vh; height: 6.2vh; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 2.6vh; font-weight: 800; color: #6b7590; border: .3vh solid #3a4258;
    font-variant-numeric: tabular-nums; transition: all .4s; }
.sb-num.on { background: #f5c400; color: #1d2433; border-color: #ffe27a; box-shadow: 0 0 1.5vh rgba(245,196,0,.6); }
.screen-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(22vw, 1fr)); gap: 1.5vh 1.5vw; }
.ss { background: rgba(255,255,255,.07); border: .2vh solid rgba(255,255,255,.15); border-radius: 1.5vh; padding: 1.5vh 1.5vw; }
.ss-name { font-size: 3.2vh; font-weight: 800; }
.ss-info { font-size: 2.3vh; color: #cfd5e3; margin-top: .5vh; }
.ss-winners { display: flex; flex-direction: column; gap: .3vh; margin-top: .6vh; }
.ss-winner { font-size: 2.8vh; font-weight: 800; color: #fff; }
.ss.won { background: rgba(46,125,50,.35); border-color: #66bb6a; }
.ss.nowinner { opacity: .45; }
.ss.jackpot { background: rgba(242,183,5,.3); border-color: var(--gold); animation: glow 1.4s ease-in-out infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 4vh rgba(242,183,5,.7); } }

/* print: tickets only, 6 per A4 page */
@page { size: A4; margin: 8mm; }
@media print {
    body { background: #fff; }
    .no-print, .topnav { display: none !important; }
    .page { padding: 0; max-width: none; }
    .ticket-sheet { gap: 6mm 4mm; justify-content: flex-start; width: 194mm; }
}

/* blazor error ui */
#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); color: #000;
    display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred."; }
