:root {
    color-scheme: light dark;
    --bg: #eef1fa;
    --card-bg: #ffffff;
    --text: #1b1e24;
    --muted: #5b6472;
    --border: #dbe1f0;
    --stripe: #eef2f8;
    --cream: #fdf3d7;

    /* brand palette - a fixed identity, not theme-dependent */
    --black: #141414;
    --navy: #0a3d8f;
    --blue: #1976d2;
    --blue-light: #2f8ae8;
    --gold: #f5b300;
    --red: #d0202e;

    --heading: var(--text);
    --warn: #9a6b00;

    --ball-bg: var(--blue);
    --ball-text: #ffffff;
    --ball-ring: var(--gold);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1220;
        --card-bg: #121a2b;
        --text: #eef0f4;
        --muted: #9aa7bf;
        --border: #26314a;
        --stripe: #17203a;
        --cream: #3a3016;

        --blue-light: #4f83ea;
        --heading: #eef0f4;
        --warn: #ffcc4d;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.topbar {
    background: var(--black);
    color: #f2f4f8;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    padding: 0.55rem 1.5rem;
}

.masthead {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, var(--blue), var(--navy));
    color: #fff;
    padding: 1.25rem 1.5rem;
}

.brand-badge {
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
}

.dot-red {
    background: var(--red);
}

.dot-gold {
    background: var(--gold);
}

.dot-blue {
    background: var(--blue);
}

.masthead-eyebrow {
    margin: 0;
    font-size: 0.75rem;
    font-style: italic;
    opacity: 0.9;
}

.masthead-title {
    margin: 0.15rem 0 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.page {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 2.5rem 1rem;
}

.card {
    width: 100%;
    max-width: 32rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(11, 23, 55, 0.08);
}

.card-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading);
}

.subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 1.5rem;
}

.form-panel {
    background: var(--stripe);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 1.25rem 1.25rem 0.25rem;
    margin-bottom: 1.25rem;
}

fieldset {
    border: none;
    padding: 0;
    margin: 0 0 1.25rem;
}

legend {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 0.5rem;
    padding: 0;
}

.games {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.game-option,
.mode-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    padding: 0.5rem 0.7rem;
    cursor: pointer;
}

.game-option:has(:checked),
.mode-option:has(:checked) {
    border-color: var(--gold);
    background: var(--cream);
    color: var(--heading);
    font-weight: 600;
}

.mode {
    display: flex;
    gap: 0.5rem;
}

.mode-option {
    flex: 1;
}

button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 0.25rem;
    background: var(--blue);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background: var(--blue-light);
}

.result {
    margin-top: 1.5rem;
    min-height: 1px;
}

.ticket {
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    overflow: hidden;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--navy);
    color: #fff;
    padding: 0.6rem 1.25rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ticket-game {
    font-weight: 700;
}

.ticket-mode {
    color: rgba(255, 255, 255, 0.75);
}

.ticket-mode--filtered-fallback {
    color: var(--gold);
}

.balls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    padding: 1.25rem;
}

.ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--ball-bg);
    color: var(--ball-text);
    border: 2px solid var(--ball-ring);
    font-weight: 700;
    font-size: 1.05rem;
}

.ticket-note {
    margin: 0;
    padding: 0 1.25rem 1.25rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.site-footer {
    background: var(--black);
    color: #b6bdc9;
    font-size: 0.75rem;
    line-height: 1.6;
    text-align: center;
    padding: 1rem 1.5rem;
}

.site-footer a {
    color: #fff;
}
