:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #667085;
    --border: #e3e6ec;
    --accent: #1f5fbf;
    --swiss: #d52b1e;
    --euro: #1c3f94;
    --lotto: #e2001a;
    --jackpot: #f07d00;
    --gold: #f2b705;
    --pos: #127a3f;
    --neg: #b42318;
    --radius: 12px;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #11151c;
        --surface: #1a202b;
        --text: #e6e9ef;
        --muted: #98a2b3;
        --border: #2b3342;
        --accent: #6ea8ff;
        --pos: #4cc27f;
        --neg: #ff7a6e;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
code { background: var(--border); padding: 0 .3em; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; }
h2 small, h3 small { font-size: .7em; font-weight: 400; color: var(--muted); margin-left: .4em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.site-header nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-header nav a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); }
.site-header nav a.active, .site-header nav a:hover { background: var(--bg); color: var(--text); }

.site-footer { color: var(--muted); font-size: .85rem; padding-top: 24px; padding-bottom: 40px; }

.intro { max-width: 820px; }
.callout {
    background: color-mix(in srgb, var(--gold) 14%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--border));
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 16px 0 24px;
}

.cards { display: grid; gap: 16px; margin-bottom: 16px; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
    min-width: 0;
}
.cards .card { margin-bottom: 0; }
.card h2, .card h3 { margin-top: 0; }

.game-card { border-top: 5px solid var(--accent); }
.game-card.swisslotto { border-top-color: var(--swiss); }
.game-card.euromillions { border-top-color: var(--euro); }
.game-card.lotto6aus49 { border-top-color: var(--lotto); }
.game-card.eurojackpot { border-top-color: var(--jackpot); }
.game-card h2 a { color: var(--text); text-decoration: none; }

.stat .value { display: block; font-size: 1.6rem; font-weight: 800; }
.stat .label { display: block; color: var(--muted); font-size: .9rem; margin: 4px 0; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 16px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 8px 16px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.game-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.game-head h1 { margin: 0; padding-left: 12px; border-left: 6px solid var(--accent); }
.game-head.swisslotto h1 { border-color: var(--swiss); }
.game-head.euromillions h1 { border-color: var(--euro); }
.game-head.lotto6aus49 h1 { border-color: var(--lotto); }
.game-head.eurojackpot h1 { border-color: var(--jackpot); }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.tabs a { padding: 6px 14px; border-radius: 7px; text-decoration: none; color: var(--muted); }
.tabs a.active { background: var(--accent); color: #fff; }

.filters { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: 4px; }
.filters select, .filters input {
    font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
}
.filters input[type=number] { width: 90px; }

.balls { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
.ball {
    display: inline-grid; place-items: center;
    width: 2.2em; height: 2.2em; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--text);
    font-weight: 700; font-variant-numeric: tabular-nums;
}
.ball.extra { background: var(--gold); border-color: var(--gold); color: #1d2330; }
.ball.bonus { border-style: dashed; color: var(--muted); }
.ball.hit { background: var(--pos); border-color: var(--pos); color: #fff; }

.tickets { padding-left: 1.4em; }
.tickets li { margin: 12px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tickets li::marker { color: var(--muted); }
.crowd { color: var(--muted); font-size: .9rem; }

.chart { width: 100%; max-height: 320px; }
.chart.short { max-height: 200px; }
.chart.tall { max-height: 420px; }

.scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
table.data td.pos { color: var(--pos); }
table.data td.neg { color: var(--neg); }
table.draws .ball { width: 1.9em; height: 1.9em; font-size: .9rem; }

.pager { display: flex; gap: 16px; align-items: center; margin: 12px 0; color: var(--muted); }

.strategies dt { font-weight: 700; margin-top: 10px; }
.strategies dd { margin: 2px 0 0; color: var(--muted); }
.prose { max-width: 860px; }

@media (max-width: 640px) {
    .ball { width: 2em; height: 2em; font-size: .9rem; }
    table.data th, table.data td { padding: 6px; }
}

/* Prize tiers: one column per strategy — let the long strategy names wrap */
table.tiers th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
table.tiers th:nth-child(n+2), table.tiers td:nth-child(n+2) { text-align: center; }
table.tiers th:nth-child(n+3) { min-width: 6.5em; max-width: 9em; }
table.tiers td:first-child { white-space: nowrap; font-weight: 600; }

.login { max-width: 360px; margin: 48px auto; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: .9rem; }
.login input[type=password] {
    font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
}
.login .error { color: var(--neg); margin: 0; }

.jackpot { color: color-mix(in srgb, var(--gold) 70%, var(--text)); font-weight: 800; }

.languages { display: flex; gap: 2px; margin-left: auto; }
.languages a { padding: 4px 8px; border-radius: 6px; text-decoration: none; color: var(--muted); font-size: .85rem; font-weight: 600; }
.languages a.active { background: var(--bg); color: var(--text); }

.favourite-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.favourite-head h3 { margin: 0 0 8px; }
.favourite .facts { grid-template-columns: minmax(8em, auto) 1fr; }
.favourite .facts dd { font-weight: 400; }
.favourite details { margin: 8px 0; }
.favourite summary { cursor: pointer; color: var(--muted); }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
form.inline { display: inline; }
.filters input.wide { width: 18em; max-width: 100%; }
.filters input[type=text] { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; }
.error { color: var(--neg); }
td.pos, strong.pos { color: var(--pos); }
