/* Looking for Luck — "Draw night"
 *
 * The interface borrows from televised lottery draws: a deep ultramarine
 * stage where the balls land, and a calm editorial page below it. Colour
 * belongs to the balls (coloured by tens, white centre disc, like the real
 * thing); everything else is ink, paper and rules. One typeface, Archivo,
 * used across its width axis: expanded for titles, condensed for data.
 */

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    font-stretch: 62% 125%;
    src: url("../fonts/archivo-latin.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    font-stretch: 62% 125%;
    src: url("../fonts/archivo-latin-ext.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------------ tokens */
:root {
    --stage: var(--lottery-stage, #13227a);
    --stage-deep: color-mix(in srgb, var(--stage) 62%, #050a26);
    --stage-ink: #ffffff;
    --stage-muted: rgb(255 255 255 / .68);

    --paper: #ffffff;
    --paper-2: #f4f5f9;
    --ink: #0e1530;
    --muted: #5d6480;
    --rule: #e2e4ec;
    --rule-strong: #c8ccdb;
    --link: color-mix(in srgb, var(--stage) 85%, #3b6cff);

    --gold: #f7b500;
    --gold-deep: #c98a00;
    --win: #0f9c63;
    --loss: #d93350;

    /* Ball colours by tens, after the classic lottery-ball palette. */
    --d0: #efefe9;
    --d1: #2f6bf0;
    --d2: #ec4a8c;
    --d3: #17a673;
    --d4: #f4b81f;
    --d5: #8b5cf6;
    --d6: #ff7a2f;
    --d7: #13b2c2;

    --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --page: 1120px;
    --gutter: clamp(16px, 4vw, 40px);
    color-scheme: light;
}
:root[data-theme="dark"] {
    --paper: #0a0f24;
    --paper-2: #10173a;
    --ink: #e9ecf8;
    --muted: #939ab8;
    --rule: #1e2750;
    --rule-strong: #303c70;
    --link: #8fa8ff;
    --stage-deep: color-mix(in srgb, var(--stage) 45%, #02040f);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0a0f24;
        --paper-2: #10173a;
        --ink: #e9ecf8;
        --muted: #939ab8;
        --rule: #1e2750;
        --rule-strong: #303c70;
        --link: #8fa8ff;
        --stage-deep: color-mix(in srgb, var(--stage) 45%, #02040f);
        color-scheme: dark;
    }
}

/* -------------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 1rem/1.6 var(--font);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.1; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--link) 60%, transparent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.pos { color: var(--win); }
.neg { color: var(--loss); }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--fill { fill: currentColor; stroke: none; }
.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }

@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* --------------------------------------------------------------- masthead */
.masthead { background: var(--stage-deep); color: var(--stage-ink); }
.masthead__bar { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; font-stretch: 112%; font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; }
.brand svg { width: 30px; height: 30px; flex: none; }
.masthead__tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.switch { position: relative; }
.switch > summary {
    list-style: none; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 10px 6px 12px; border-radius: 999px;
    background: rgb(255 255 255 / .1); color: var(--stage-ink); font-weight: 600; font-size: .92rem;
}
.switch > summary::-webkit-details-marker { display: none; }
.switch > summary:hover { background: rgb(255 255 255 / .16); }
.switch[open] > summary .icon { rotate: 180deg; }
.switch__menu {
    position: absolute; z-index: 30; left: 0; top: calc(100% + 8px); min-width: 280px;
    background: var(--paper); color: var(--ink); border-radius: 12px; padding: 6px;
    box-shadow: 0 24px 60px rgb(5 10 38 / .35), 0 0 0 1px var(--rule);
}
.switch__menu a, .switch__soon { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.switch__menu a:hover { background: var(--paper-2); }
.switch__menu a[aria-current] { font-weight: 700; }
.switch__soon { color: var(--muted); font-size: .88rem; }
.switch__soon a { margin-left: auto; padding: 0; color: var(--link); text-decoration: underline; }
.switch__menu hr { border: 0; border-top: 1px solid var(--rule); margin: 6px; }

.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    display: inline-flex; align-items: center; gap: 8px; flex: none;
    padding: 12px 11px 13px; color: var(--stage-muted); text-decoration: none; font-weight: 500; font-size: .92rem;
    border-bottom: 3px solid transparent;
}
.tabs a:hover { color: var(--stage-ink); }
.tabs a[aria-current="page"] { color: var(--stage-ink); border-bottom-color: var(--gold); font-weight: 650; }
.tabs .icon { width: 16px; height: 16px; opacity: .8; }

.lang { position: relative; }
.lang select {
    appearance: none; cursor: pointer; font: inherit; font-size: .86rem; font-weight: 500;
    height: 34px; padding: 0 28px 0 12px; border-radius: 999px; border: 0;
    background: rgb(255 255 255 / .1); color: var(--stage-ink);
}
.lang select option { color: #0e1530; }
.lang .icon { position: absolute; right: 9px; top: 50%; translate: 0 -50%; width: 14px; height: 14px; pointer-events: none; }
.chip-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 34px; min-width: 34px; padding: 0 12px;
    border-radius: 999px; border: 0; background: rgb(255 255 255 / .1); color: var(--stage-ink);
    font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.chip-btn:hover { background: rgb(255 255 255 / .18); }
.chip-btn--icon { padding: 0; width: 34px; }
.theme-toggle .when-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .when-light { display: none; }
:root[data-theme="dark"] .theme-toggle .when-dark { display: block; }

/* ------------------------------------------------------------------ stage */
.stage {
    position: relative; overflow: hidden;
    color: var(--stage-ink);
    background:
        radial-gradient(70% 120% at 78% 0%, color-mix(in srgb, var(--stage) 55%, #7f9bff) 0%, transparent 60%),
        linear-gradient(180deg, var(--stage-deep) 0%, var(--stage) 100%);
}
.stage__inner { padding-top: clamp(32px, 6vw, 64px); padding-bottom: clamp(36px, 6vw, 72px); }
.stage h1 { font-size: clamp(2.3rem, 5.6vw, 4.2rem); font-weight: 800; font-stretch: 118%; letter-spacing: -.03em; line-height: .98; max-width: 16ch; }
.stage__lead { margin-top: 18px; font-size: clamp(1.02rem, 1.6vw, 1.2rem); color: var(--stage-muted); max-width: 52ch; line-height: 1.5; }
.stage__kicker { font-size: .95rem; color: var(--stage-muted); font-weight: 500; margin-bottom: 18px; }
.stage__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.stage--slim .stage__inner { padding-top: clamp(28px, 4vw, 44px); padding-bottom: clamp(28px, 4vw, 44px); }
.stage--slim h1 { font-size: clamp(2rem, 4.2vw, 3rem); max-width: none; }

.draw-board { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: end; margin-top: clamp(28px, 4vw, 44px); padding-top: 24px; border-top: 1px solid rgb(255 255 255 / .14); }
.draw-board__meta { display: flex; gap: 20px 48px; flex-wrap: wrap; margin: 0; }
.draw-board__meta dt { font-size: .84rem; color: var(--stage-muted); }
.draw-board__meta dd { margin: 2px 0 0; font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 750; font-stretch: 92%; letter-spacing: -.01em; }
.draw-board__meta dd small { display: block; font-size: .84rem; font-weight: 500; font-stretch: 100%; color: var(--stage-muted); letter-spacing: 0; }
.countdown { text-align: right; }
.countdown__label { font-size: .84rem; color: var(--stage-muted); }
.countdown__value { display: block; font-size: clamp(2rem, 4.4vw, 3.3rem); font-weight: 800; font-stretch: 80%; letter-spacing: -.01em; line-height: 1; margin: 6px 0 8px; }
.countdown__when { font-size: .9rem; color: var(--stage-muted); }
@media (max-width: 860px) { .draw-board { grid-template-columns: 1fr; } .countdown { text-align: left; } }

/* ------------------------------------------------------- balls and stars */
.balls { display: inline-flex; align-items: center; gap: calc(var(--size) * .16); flex-wrap: wrap; --size: 34px; }
.balls--xl { --size: clamp(36px, 8vw, 96px); gap: clamp(6px, 1.4vw, 18px); flex-wrap: nowrap; }
.balls--lg { --size: 46px; }
.balls--sm { --size: 28px; }
.balls__sep { width: calc(var(--size) * .3); }
.ball {
    --c: var(--d0);
    position: relative; isolation: isolate;
    width: var(--size); height: var(--size); flex: none; border-radius: 50%;
    display: inline-grid; place-items: center;
    font-weight: 800; font-stretch: 88%; font-size: calc(var(--size) * .38); letter-spacing: -.02em; color: #0e1530;
    background:
        radial-gradient(circle at 32% 26%, rgb(255 255 255 / .75) 0 9%, rgb(255 255 255 / 0) 34%),
        radial-gradient(circle at 50% 45%, var(--c) 52%, color-mix(in srgb, var(--c) 72%, #000) 100%);
    box-shadow: 0 calc(var(--size) * .06) calc(var(--size) * .14) rgb(5 10 38 / .25);
}
/* The white disc printed on real lottery balls. */
.ball::before {
    content: ""; position: absolute; inset: 21%; z-index: -1; border-radius: 50%;
    background: #fff; box-shadow: inset 0 -1px 2px rgb(0 0 0 / .12);
}
.ball.d0 { --c: var(--d0); } .ball.d1 { --c: var(--d1); } .ball.d2 { --c: var(--d2); } .ball.d3 { --c: var(--d3); }
.ball.d4 { --c: var(--d4); } .ball.d5 { --c: var(--d5); } .ball.d6 { --c: var(--d6); } .ball.d7 { --c: var(--d7); }
.ball--bonus { --c: #e23b3b; }

.star {
    position: relative; flex: none; display: inline-grid; place-items: center;
    width: calc(var(--size) * 1.12); height: calc(var(--size) * 1.12); margin: calc(var(--size) * -.06) 0;
    font-weight: 800; font-stretch: 88%; font-size: calc(var(--size) * .34); color: #3a2600;
}
.star::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle at 38% 30%, #ffe48a 0 12%, var(--gold) 45%, var(--gold-deep) 100%);
    clip-path: polygon(50% 1%, 62% 35%, 98% 36%, 69% 58%, 80% 93%, 50% 72%, 20% 93%, 31% 58%, 2% 36%, 38% 35%);
    filter: drop-shadow(0 2px 3px rgb(5 10 38 / .3));
}
.star > span { position: relative; translate: 0 8%; }
.balls--sm .star { width: calc(var(--size) * 1.24); height: calc(var(--size) * 1.24); font-size: calc(var(--size) * .4); }

/* Comparing a grid with a draw: what doesn't match fades away. */
.balls--compare .ball:not(.hit), .balls--compare .star:not(.hit) { opacity: .26; filter: grayscale(1); }

/* The draw: balls drop onto the stage one after the other. */
.balls--drop > * { animation: drop .7s cubic-bezier(.3, 1.45, .55, 1) both; animation-delay: calc(var(--i, 0) * 110ms + 120ms); }
@keyframes drop { 0% { opacity: 0; translate: 0 -70%; scale: .7; } 60% { opacity: 1; } 100% { opacity: 1; translate: 0 0; scale: 1; } }
@media (prefers-reduced-motion: reduce) { .balls--drop > * { animation: none; } }

/* ------------------------------------------------------------------ page */
.page { padding-top: clamp(28px, 4vw, 48px); padding-bottom: 32px; }
.flash { display: flex; gap: 10px; align-items: center; padding: 12px 16px; margin-bottom: 24px; border-radius: 10px; background: var(--paper-2); border-left: 4px solid var(--link); }
.flash--success { border-left-color: var(--win); }
.flash--error { border-left-color: var(--loss); }
.flash--win { background: var(--win); color: #fff; border: 0; font-weight: 700; }

/* A block: a heading column and a content column, separated by a rule. */
.block { display: grid; grid-template-columns: minmax(0, 270px) minmax(0, 1fr); gap: 20px 56px; padding: 36px 0; border-top: 1px solid var(--rule); }
.block:first-of-type { border-top: 0; padding-top: 8px; }
.block__head h2 { font-size: 1.32rem; font-weight: 750; font-stretch: 108%; letter-spacing: -.015em; }
.block__head p { margin-top: 10px; color: var(--muted); font-size: .94rem; line-height: 1.55; }
.block__head .link { display: inline-block; margin-top: 14px; font-size: .92rem; }
.block--wide { grid-template-columns: minmax(0, 1fr); }
.block--wide > .block__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 24px; }
.block--wide > .block__head p { margin-top: 0; }
.block--wide > .block__head .presets { margin-left: auto; }
@media (max-width: 860px) { .block { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 28px 0; } }

.cols { display: grid; gap: 32px 48px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.cols h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 12px; }

/* Big figures in a row, separated by rules. */
.figures { display: flex; flex-wrap: wrap; row-gap: 16px; margin: 0; }
.figure { padding: 2px 28px 2px 0; margin-right: 28px; border-right: 1px solid var(--rule); }
.figure:last-child { border-right: 0; margin-right: 0; }
.figure dt { font-size: .84rem; color: var(--muted); }
.figure dd { margin: 2px 0 0; font-size: clamp(1.5rem, 2.8vw, 2.1rem); font-weight: 750; font-stretch: 90%; letter-spacing: -.01em; line-height: 1.15; }
.figure dd small { display: block; font-size: .82rem; font-weight: 500; font-stretch: 100%; color: var(--muted); letter-spacing: 0; }
@media (max-width: 560px) { .figure { padding-right: 18px; margin-right: 18px; } }

/* Lists of draws or grids. */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.list > li:first-child { padding-top: 0; }
.list > li:last-child { border-bottom: 0; }
.list__date { min-width: 8.5em; color: var(--muted); font-size: .9rem; font-stretch: 92%; }
.list__index { width: 1.6em; color: var(--muted); font-weight: 600; font-stretch: 85%; }
.grow { flex: 1; }

/* Tables. */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 11px 14px 11px 0; vertical-align: middle; border-bottom: 1px solid var(--rule); }
th { font-weight: 500; color: var(--muted); font-size: .84rem; border-bottom-color: var(--rule-strong); }
td { font-stretch: 94%; }
tr:last-child td { border-bottom: 0; }
td .balls { flex-wrap: nowrap; }
td.num, th.num { text-align: right; padding-right: 0; padding-left: 14px; }
tr.win td:first-child { box-shadow: inset 3px 0 0 var(--win); padding-left: 12px; }

/* Grids thrown away by the anti-sharing filter. */
.rejected .balls { filter: saturate(.55); }
.rejected__reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.rejected__reasons .tag { white-space: normal; font-weight: 500; }

/* Quick date ranges on the statistics page. */
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.presets .tag { text-decoration: none; font-weight: 600; padding: 5px 11px; }
.presets .tag:hover { background: var(--rule); }
.presets .tag--active, .presets .tag--active:hover { background: var(--ink); color: var(--paper); }

/* Tags. */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 6px; font-size: .8rem; font-weight: 650; background: var(--paper-2); color: var(--ink); white-space: nowrap; }
.tag--win { background: var(--win); color: #fff; }
.tag--gold { background: color-mix(in srgb, var(--gold) 28%, transparent); color: var(--ink); }
.tag--live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--win); box-shadow: 0 0 0 3px color-mix(in srgb, var(--win) 25%, transparent); }

/* Ranked bars. */
.ranking { display: grid; gap: 10px; }
.rank { display: grid; grid-template-columns: auto minmax(0, 1fr) 3.4em; gap: 14px; align-items: center; }
.rank__bar { height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.rank__bar > span { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.rank__bar--gold > span { background: var(--gold); }
.rank__bar--muted > span { background: var(--rule-strong); }
.rank__bar--win > span { background: var(--win); }
.rank__bar--loss > span { background: var(--loss); }
.rank__value { text-align: right; font-weight: 700; font-stretch: 88%; }
.rank--label { grid-template-columns: 8.5em minmax(0, 1fr) 7.5em; }

/* Frequency heatmap: one hue, the stage blue; darker means more often. */
.heat { display: grid; gap: 4px; grid-template-columns: repeat(10, minmax(0, 1fr)); }
.heat--bonus { grid-template-columns: repeat(12, minmax(0, 1fr)); margin-top: 8px; }
.heat__cell {
    aspect-ratio: 1; border-radius: 6px; display: grid; place-content: center; text-align: center; line-height: 1.05;
    background: color-mix(in srgb, var(--stage) calc(var(--t) * 92% + 6%), var(--paper));
    color: var(--ink); font-weight: 750; font-stretch: 88%; font-size: clamp(.72rem, 1.6vw, 1rem);
}
.heat__cell.is-dark { color: #fff; }
.heat__cell small { display: block; font-size: .64rem; font-weight: 500; opacity: .75; }
.heat-scale { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: .84rem; color: var(--muted); }
.heat-scale i { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--stage) 6%, var(--paper)), var(--stage)); }
@media (max-width: 560px) { .heat__cell small { display: none; } .heat--bonus { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* Verdict of the χ² test. */
.verdict { display: flex; gap: 18px; align-items: flex-start; }
.verdict__seal { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--win); color: #fff; font-size: 1.5rem; font-weight: 800; }
.verdict--warn .verdict__seal { background: var(--gold); color: #3a2600; }
.verdict h3 { font-size: 1.35rem; font-weight: 750; font-stretch: 105%; letter-spacing: -.01em; margin-bottom: 8px; }
.verdict p { color: var(--muted); max-width: 64ch; }

.callout { padding: 16px 18px; border-radius: 10px; background: var(--paper-2); }
.callout strong { font-weight: 750; }

.lede { font-size: 1.15rem; line-height: 1.5; font-weight: 500; }

/* A real sequence of steps (strategy lab explanation). */
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; }
.steps li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--stage); color: #fff; font-weight: 750; font-size: .82rem; margin-top: 1px; }

/* Gauge of the strategy lab. */
.gauge-result { font-size: clamp(1.3rem, 2.4vw, 1.7rem); font-weight: 750; font-stretch: 92%; letter-spacing: -.01em; }
.gauge { position: relative; height: 8px; border-radius: 4px; margin: 22px 0 10px; background: linear-gradient(90deg, var(--loss), var(--gold) 50%, var(--win)); }
.gauge__dot { position: absolute; top: 50%; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); border: 5px solid var(--ink); translate: -50% -50%; }
.gauge-scale { display: flex; justify-content: space-between; font-size: .84rem; color: var(--muted); }

/* ------------------------------------------------------------------ forms */
.controls { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
label { display: grid; gap: 6px; font-size: .84rem; color: var(--muted); font-weight: 500; }
input, select {
    font: inherit; font-size: .96rem; color: var(--ink);
    height: 42px; padding: 0 12px; min-width: 0;
    background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 8px;
}
input:hover, select:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--link) 45%, transparent); outline-offset: 0; border-color: var(--link); }
.input-grid { width: min(260px, 100%); font-weight: 600; letter-spacing: .02em; }
.w-sm { width: 6.5em; }
.w-md { width: 9.5em; }
.check { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; height: 42px; color: var(--ink); font-size: .96rem; }
.check input { width: 18px; height: 18px; accent-color: var(--stage); }

.btn {
    font: inherit; font-size: .95rem; font-weight: 650;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px; border-radius: 8px; border: 1px solid transparent;
    background: var(--ink); color: var(--paper); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 85%, var(--stage)); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn--ghost:hover { background: var(--paper-2); }
.btn--sm { height: 34px; padding: 0 12px; font-size: .86rem; }
.btn--danger { background: transparent; color: var(--loss); border-color: color-mix(in srgb, var(--loss) 40%, transparent); }
.btn--danger:hover { background: color-mix(in srgb, var(--loss) 8%, transparent); }
.btn--gold { background: var(--gold); color: #2b1d00; }
.btn--gold:hover { background: #ffc61a; }
.btn--on-stage { background: rgb(255 255 255 / .12); color: var(--stage-ink); border-color: rgb(255 255 255 / .22); }
.btn--on-stage:hover { background: rgb(255 255 255 / .2); }

.empty { padding: 8px 0; }
.empty p { color: var(--muted); max-width: 46ch; margin-bottom: 18px; }

/* --------------------------------------------------------------- home page */
.lotteries { list-style: none; margin: 0; padding: 0; }
.lottery { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px 20px; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.lottery:first-child { padding-top: 4px; }
.lottery:last-child { border-bottom: 0; }
.lottery__flag { font-size: 2rem; line-height: 1; }
.lottery h3 { font-size: 1.3rem; font-weight: 750; font-stretch: 110%; letter-spacing: -.015em; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.lottery h3 a { color: inherit; text-decoration: none; }
.lottery p { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.lottery .balls { margin-top: 12px; }
.lottery.is-planned h3 { color: var(--muted); font-weight: 600; }
@media (max-width: 640px) { .lottery { grid-template-columns: 40px minmax(0, 1fr); } .lottery > :last-child { grid-column: 2; justify-self: start; } }

.terminal { margin: 14px 0 0; padding: 14px 16px; border-radius: 10px; background: #0b1130; color: #dfe5ff; white-space: pre-wrap; word-break: break-all; font-size: .82rem; line-height: 1.7; }
.terminal .prompt { color: var(--gold); user-select: none; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: center; }
.hero-balls { display: grid; grid-template-columns: repeat(4, auto); gap: 12px; justify-content: end; align-content: center; rotate: -6deg; --size: clamp(48px, 7vw, 84px); }
@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; }
    .hero-balls { justify-content: start; rotate: 0deg; grid-template-columns: repeat(7, auto); gap: 6px; --size: 40px; }
}

/* Home page: one showcase per lottery, every tool with a live preview. */
.showcase { padding: 44px 0 8px; }
.showcase + .showcase { border-top: 1px solid var(--rule); }
.showcase__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px 40px; flex-wrap: wrap; margin-bottom: 22px; }
.showcase__eyebrow { display: flex; gap: 10px; align-items: center; font-size: 1.3rem; margin-bottom: 6px; }
.showcase h2 { font-size: clamp(2rem, 4.4vw, 3rem); font-weight: 800; font-stretch: 118%; letter-spacing: -.03em; line-height: 1; }
.showcase h2 a { color: inherit; text-decoration: none; }
.showcase h2 a:hover { color: var(--stage); }
.showcase__facts { display: flex; gap: 36px; margin: 0; }
.showcase__facts dt { font-size: .84rem; color: var(--muted); }
.showcase__facts dd { margin: 2px 0 0; font-size: clamp(1.5rem, 2.8vw, 2.1rem); font-weight: 800; font-stretch: 85%; letter-spacing: -.01em; line-height: 1.1; }
.showcase__facts .countdown__value { font-size: inherit; margin: 0; display: inline; }

.features {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px;
    background: var(--rule); border: 1px solid var(--rule); border-radius: 16px; overflow: hidden;
}
.feature {
    display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
    padding: 22px 24px 24px; background: var(--paper); color: var(--ink); text-decoration: none;
    transition: background-color .15s;
}
.feature:hover { background: var(--paper-2); text-decoration: none; }
.feature:hover .feature__title { color: var(--stage); }
.feature--wide { grid-column: span 2; }
.feature__title { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-stretch: 105%; font-size: 1.02rem; }
.feature__title .icon { color: var(--stage); }
.feature__text { color: var(--muted); font-size: .92rem; line-height: 1.5; max-width: 52ch; }
.feature__figure { font-size: 2rem; font-weight: 800; font-stretch: 85%; letter-spacing: -.015em; line-height: 1; }
.feature__question { font-size: 1.25rem; font-weight: 700; font-stretch: 105%; line-height: 1.25; letter-spacing: -.01em; }
.feature--full { grid-column: 1 / -1; }
.feature--budget { background: var(--paper-2); }
.feature--budget:hover { background: var(--paper); }
.feature--budget .figures { margin: 4px 0 2px; }
.features__more { margin: 34px 0 14px; font-size: .84rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.features--small { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.features--small .feature { padding: 18px 20px 20px; gap: 10px; }
.features--small .feature__figure { font-size: 1.6rem; }
.features--small .feature__question { font-size: 1.08rem; }
.features--small .feature__text { font-size: .86rem; }
@media (max-width: 1080px) { .features--small { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
    .features, .features--small { grid-template-columns: minmax(0, 1fr); }
    .feature--wide { grid-column: auto; }
    .showcase__facts { gap: 24px; }
}

/* ------------------------------------------- responsible-gambling warning */
.warning { background: #ffd23f; color: #1b1400; font-size: .84rem; line-height: 1.35; }
.warning__inner { display: flex; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.warning__age { flex: none; font-weight: 800; font-stretch: 112%; border: 2px solid currentColor; border-radius: 999px; padding: 1px 8px; font-size: .8rem; }
.warning p { margin: 0; font-weight: 600; }
.warning a { color: inherit; text-decoration: underline; font-weight: 500; }

/* --------------------------------------------- analytics consent banner */
.consent { position: fixed; inset: auto 0 0 0; z-index: 50; background: var(--paper); color: var(--ink); border-top: 1px solid var(--rule-strong); box-shadow: 0 -8px 30px rgb(0 0 0 / .12); }
.consent[hidden] { display: none; }
.consent__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 14px; }
.consent p { margin: 0; max-width: 72ch; font-size: .9rem; }
.consent__actions { display: flex; gap: 10px; }

/* ------------------------------------------------------------------ footer */
.footer { border-top: 1px solid var(--rule); margin-top: 24px; padding: 28px 0 40px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 40px; font-size: .86rem; color: var(--muted); }
.footer p { max-width: 68ch; }
.footer nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--ink); }
.footer__link { font: inherit; color: var(--muted); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.footer__link:hover { color: var(--ink); }
@media (max-width: 860px) { .footer { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ mobile */
@media (max-width: 720px) {
    .masthead__bar { flex-wrap: wrap; gap: 10px 12px; padding-top: 10px; padding-bottom: 6px; min-height: 0; }
    .brand span { display: none; }
    .masthead__tools { gap: 6px; }
    .masthead__tools .github-label { display: none; }
    .tabs a { padding: 10px 11px 11px; }
    .tabs .icon { display: none; }
}

/* ------------------------------------------------------------------- print */
@media print {
    .masthead, .footer, .controls, .btn, form, .consent { display: none !important; }
    .stage { background: none; color: #000; }
    .ball, .star::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
