:root {
  --bg: #f5f8fc; --card: #fff; --ink: #14213d; --muted: #5b6780; --line: #e2e8f1;
  --blue: #41b6e6; --blue-ink: #0a6c9f; --red: #e4002b; --good: 150; --bad: 8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d131d; --card: #161f2e; --ink: #e8eef8; --muted: #97a5bf; --line: #27334a; --blue-ink: #74cdf2; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
h2 { font-size: 1.25rem; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
small, .muted, .hint { color: var(--muted); }
.hint, small { font-size: .85rem; }
.more { font-size: .9rem; font-weight: 500; letter-spacing: 0; white-space: nowrap; }

.demo { background: var(--red); color: #fff; text-align: center; font-size: .85rem; padding: .35rem 1rem; }
header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
nav { max-width: 1100px; margin: auto; padding: .6rem 1rem; display: flex; align-items: center; gap: .5rem 1.25rem; flex-wrap: wrap; }
.brand { font-weight: 800; color: var(--ink); letter-spacing: -.02em; margin-right: auto; }
.star { color: var(--red); }
.links { display: flex; gap: 1.1rem; overflow-x: auto; }
.links a { color: var(--muted); font-weight: 500; padding: .2rem 0; border-bottom: 2px solid transparent; }
.links a[aria-current], .links a:hover { color: var(--ink); border-color: var(--blue); text-decoration: none; }

.btn { display: inline-block; background: var(--red); color: #fff; font: inherit; font-weight: 600; border: 0; border-radius: 999px; padding: .45rem 1rem; cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn.big { padding: .7rem 1.4rem; }
.btn.ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }

main { max-width: 1100px; margin: auto; padding: 1.5rem 1rem 3rem; display: grid; gap: 1.5rem; }
main > * { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; }
.narrow { max-width: 640px; width: 100%; margin: auto; }
.grid2 { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid2 > * { min-width: 0; }
.grid2 table :is(th, td):last-child { display: none; }

.hero { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: clamp(1.5rem, 5vw, 3rem); text-align: center; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); margin: 1.2rem 0 .4rem; }
.hero > p { max-width: 56ch; margin: .6rem auto; color: var(--muted); font-size: 1.1rem; }
.flag { max-width: 340px; margin: auto; color: var(--red); font-size: 1.9rem; line-height: 1.5; letter-spacing: .25em; }
.flag i { display: block; height: 12px; background: var(--blue); border-radius: 2px; }
.stats { display: flex; justify-content: center; gap: clamp(1rem, 5vw, 3rem); flex-wrap: wrap; margin: 1.5rem 0 0; }
.stats dt { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.stats dd { margin: 0; color: var(--muted); font-size: .85rem; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
tbody tr:last-child > * { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { color: var(--muted); width: 2rem; }
.pts { font-weight: 800; color: var(--blue-ink); }
.ok { color: #1a9e5c; font-weight: 700; }
details { display: inline-block; } summary { cursor: pointer; color: var(--blue-ink); }
pre { white-space: pre-wrap; font-size: .85rem; margin: .5rem 0 0; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.bars li { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr 3rem; gap: .75rem; align-items: center; font-size: .95rem; }
.bars .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bar { background: var(--line); border-radius: 99px; height: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.bar.inline { display: inline-block; width: 90px; vertical-align: middle; }
.ci { display: inline-block; position: relative; width: 120px; height: 10px; background: var(--line); border-radius: 99px; vertical-align: middle; }
.ci i { position: absolute; top: 0; bottom: 0; background: var(--blue); opacity: .55; border-radius: 99px; }
.ci b { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1px; background: var(--ink); border-radius: 2px; }

.tabs { display: inline-flex; gap: .25rem; background: var(--bg); border-radius: 99px; padding: .25rem; }
.tabs a { padding: .3rem .9rem; border-radius: 99px; color: var(--muted); font-weight: 500; font-size: .9rem; }
.tabs a[aria-current] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px #0002; }

.matrix th, .matrix td { text-align: center; border: 0; padding: 2px; }
.matrix thead th span { display: block; max-width: 6.5rem; white-space: normal; text-transform: none; letter-spacing: 0; font-size: .75rem; line-height: 1.2; margin: auto; }
.matrix tbody th { text-align: right; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--ink); padding-right: .6rem; }
.matrix td { min-width: 4.4rem; }
.matrix td:not(.nil) { background: hsl(calc(var(--bad) + (var(--good) - var(--bad)) * var(--wr)) 65% 45% / calc(.12 + .38 * var(--n))); border-radius: 8px; box-shadow: inset 0 0 0 2px var(--card); padding: .45rem .3rem; }
.matrix td b, .matrix td small { display: block; }
.matrix .nil { color: var(--muted); }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.event { color: var(--ink); transition: transform .15s, border-color .15s; }
.event:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--blue); }
.event time { color: var(--blue-ink); font-weight: 600; font-size: .85rem; }
.event h3 { margin: .2rem 0; } .event p { margin: 0; color: var(--muted); font-size: .9rem; }

.gallery { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
figure { margin: 0; border-radius: 14px; overflow: hidden; background: var(--card); border: 1px solid var(--line); }
figure img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
figcaption { padding: .4rem .7rem; font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

form { display: grid; gap: 1rem; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .9rem; margin: 0; display: grid; gap: .75rem; min-width: 0; }
legend { font-weight: 700; padding: 0 .4rem; }
label { display: grid; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--muted); min-width: 0; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; width: 100%; min-width: 0; }
:is(input, select, textarea, a, button, summary):focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.row { display: grid; gap: .75rem; grid-template-columns: 1fr 1fr; }
.row.three { grid-template-columns: repeat(3, 1fr); }
.row.round { grid-template-columns: 1fr 7rem; }
.hint { margin: 0; }
.del { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
.del button { border: 0; background: none; color: var(--red); cursor: pointer; font-weight: 700; }

.rules h2 { margin-top: 1.5rem; display: block; }
.rules li { margin: .3rem 0; }

footer { max-width: 1100px; margin: auto; padding: 1rem 1rem 3rem; color: var(--muted); font-size: .8rem; }

.warn { color: #b7791f; font-size: .85rem; white-space: normal; }
.copy { font: inherit; font-size: .8rem; margin-top: .4rem; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 8px; padding: .2rem .6rem; cursor: pointer; }
.poster { text-align: center; }
.poster .qr { max-width: 320px; margin: 1rem auto; background: #fff; padding: 12px; border-radius: 12px; }
.poster small { overflow-wrap: anywhere; }
@media print { header, footer, .demo, .noprint { display: none; } .card { border: 0; } }
