:root {
    color-scheme: dark;
    --ink: #eef5ff;
    --muted: #b3c4d5;
    --cyan: #61dbf0;
    --lavender: #b4baff;
    --grid: #354758;
    --outline: #405569;
    --panel: linear-gradient(115deg, #1a2b3d, #101c2b 75%);
    font: 16px/1.45 "Segoe UI", Roboto, system-ui, sans-serif;
    color: var(--ink);
    background: #080f17;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 85% 0, #1a2a3a, transparent 55%); }
header, main { padding-inline: max(5vw, calc((100vw - 1120px) / 2)); }
header {
    height: 60px; display: flex; justify-content: space-between; align-items: stretch;
    background: #080f17; border-bottom: 1px solid #304150;
}
a { color: inherit; text-decoration: none; }
.brand, nav, nav a { display: flex; align-items: center; }
.brand { gap: 10px; font-size: 1.25rem; font-weight: 720; letter-spacing: -.045em; }
.piano-icon {
    width: 31px; height: 24px; color: var(--cyan);
    background: repeating-linear-gradient(90deg, currentColor 0 7px, transparent 7px 8px);
    mask: linear-gradient(#000 0 0) bottom / 100% 9px no-repeat,
          repeating-linear-gradient(90deg, transparent 0 2px, #000 2px 5px, transparent 5px 8px),
          linear-gradient(90deg, #000 0 4px, transparent 4px calc(100% - 4px), #000 calc(100% - 4px));
}
nav { gap: 24px; }
nav a { height: 100%; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
nav a[aria-current] { color: var(--cyan); border-color: var(--cyan); }
main { padding-block: 32px 56px; }
.masthead, section, article, #filters {
    border: 1px solid var(--outline); border-radius: 12px; background: var(--panel);
    box-shadow: 2px 3px 0 #09111b, 3px 4px 0 #2d4155;
}
.masthead { position: relative; isolation: isolate; overflow: hidden; min-height: 168px; display: flex; align-items: center; margin-bottom: 26px; background: #101c2a; }
.headline { z-index: 1; padding: 24px 32px; max-width: 63%; }
h1 { margin: 0; font-size: clamp(2rem, 4.6vw, 3.7rem); font-weight: 620; line-height: 1.05; letter-spacing: -.045em; }
.headline p { margin: 12px 0 0; max-width: 52ch; color: var(--muted); }
.stage {
    position: absolute; inset: 0 0 0 57%; overflow: hidden;
    background: #0c0e12 url("/playfield.webp") center bottom / contain no-repeat;
    mask-image: linear-gradient(90deg, transparent, #000 14%);
}
.ranking-layout { display: grid; grid-template-columns: minmax(170px, .28fr) 1fr; align-items: start; gap: 22px; }
.standings { min-width: 0; }
#filters { display: grid; gap: 16px; padding: 20px; }
h2 { margin: 30px 0 12px; font-size: 1.3rem; font-weight: 620; }
#filters h2 { margin: 0; }
label, th, article h2 { font-size: .73rem; font-weight: 650; letter-spacing: .065em; text-transform: uppercase; color: var(--muted); }
label { display: grid; gap: 6px; }
input, select, button { min-width: 0; color: var(--ink); border-radius: 6px; border: 1px solid var(--outline); background: #101e2d; padding: 9px 12px; font-weight: 500; font-family: inherit; font-size: .94rem; }
button { cursor: pointer; color: var(--cyan); }
button:hover:enabled, select:hover:enabled { border-color: var(--cyan); }
button:disabled { opacity: .48; cursor: default; }
section { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 18px; text-align: left; border-bottom: 1px solid #314152; }
th { background: #0e1b29; }
tbody tr:last-child td { border: 0; }
tbody tr:hover { background: #8cdfff08; }
.standings :is(td, th):last-child { text-align: right; }
#players td:first-child { color: var(--muted); width: 15%; }
#players td:nth-child(2) { font-weight: 600; overflow-wrap: anywhere; }
#players td:nth-child(3) { white-space: nowrap; }
.country-flag { font: 1rem/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; margin-inline-end: .4rem; }
#players td:nth-child(4) { color: #b3f2fd; font-weight: 650; }
#players tr[data-rank="1"] { background: linear-gradient(90deg,#f5cb7020,transparent 62%); box-shadow: inset 3px 0 #f5cb70; }
#players tr[data-rank="1"] td:first-child { color: #ffe0a2; }
footer, .bar, .axis, .legend { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
footer, .bar p, .axis { color: var(--muted); }
footer { margin-top: 18px; font-size: .88rem; }
.bar { margin: 0 0 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 14px; }
article, .plot { padding: 20px; }
article h2 { margin: 0 0 12px; }
#disk { white-space: nowrap; }
article strong { font-size: clamp(1rem,2vw,1.5rem); font-weight: 550; color: #d7f7f9; font-variant-numeric: tabular-nums; }
canvas { display: block; width: 100%; height: 160px; }
.axis, .legend { font-size: .8rem; }
.legend { justify-content: flex-start; margin-bottom: 12px; }
.legend span:first-child { color: var(--cyan); }
.legend span + span { color: var(--lavender); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (max-width: 740px) {
    .headline { padding: 20px; max-width: 77%; }
    .stage { left: 66%; }
    .ranking-layout { grid-template-columns: 1fr; gap: 16px; }
    #filters { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 14px; }
    #filters h2 { grid-column: 1 / -1; }
    th, td { padding: 10px; }
    article, .plot { padding: 14px; }
}
@media (max-width: 440px) {
    header, main { padding-inline: 14px; }
    main { padding-block: 16px 36px; }
    .masthead { min-height: 156px; }
    .headline { max-width: 100%; padding: 16px 16px 34px; }
    .stage { inset: 0; opacity: .18; mask-image: linear-gradient(90deg, transparent, #000); }
    .bar { justify-content: flex-start; }
}
.pager { display: flex; gap: .5rem; margin-block: .6rem; }
#chart-form, #alias-form, #owner-search { justify-content: flex-start; align-items: end; }
#maps-list button + button { margin-inline-start: .4rem; }
#moderation-status { color: var(--cyan); }

[hidden] { display: none !important; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px 20px; border-bottom: 1px solid var(--outline); margin-bottom: 20px; }
.admin-nav a { padding: 9px 0; }
.download { color: var(--cyan); text-decoration: underline; text-underline-offset: .2em; }
#moderation-status:empty { display: none; }
@media (max-width: 560px) { header { height: auto; flex-wrap: wrap; gap: 4px 14px; padding-block: 8px; } header nav { gap: 14px; } }
