/* Daily leaderboard - PEAK's boarding pass at night: deep sky, blue band, dark card, Darumadrop One. Dark only. */
:root {
    color-scheme: dark;
    --sky-top: #070d24;
    --sky-low: #1d2b57;
    --paper: #151a2a;
    --inset: #1f2539;
    --inset-hi: #283049;
    --ink: #eef0f6;
    --dim: #9aa1b5;
    --faint: #6b7189;
    --rule: rgba(238, 240, 246, 0.11);
    --band: #3d63d6;
    --band-hi: #5b80f0;
    --orange: #ff8a2a;
    --gold: #f2b705;
    --silver: #aeb8c4;
    --bronze: #c97d3c;
    --shadow: 0 22px 50px rgba(0, 0, 0, 0.5);
    --display: "Darumadrop One", "Nunito", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    --body: "Nunito", system-ui, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font: 16px/1.5 var(--body);
    background:
        url("/img/mountains.png") bottom center / min(1400px, 140vw) auto no-repeat,
        linear-gradient(180deg, var(--sky-top) 0%, var(--sky-low) 75%) fixed;
    background-color: var(--sky-low);
    padding: 0 16px 140px;
}

.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* --- Hero */
.hero { max-width: 980px; margin: 0 auto; padding-top: 28px; text-align: center; }
.band {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--band); color: #fff; border-radius: 18px 18px 0 0; padding: 10px 18px;
}
.airline { height: 34px; width: auto; }
.flight { flex: 1; text-align: left; font-family: var(--display); letter-spacing: 0.08em; font-size: 15px; }
.langs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(0, 0, 0, 0.22); }
.langs button {
    border: 0; background: transparent; padding: 4px 12px; border-radius: 999px; cursor: pointer;
    font-weight: 800; font-size: 13px; letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.75);
}
.langs button:hover { color: #fff; }
.langs button[aria-pressed="true"] { background: #fff; color: var(--band); }
.wordmark {
    display: block; width: min(420px, 70vw); height: auto; margin: 34px auto 6px;
    filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35));
}
.tagline { margin: 0 0 26px; font-family: var(--display); font-size: 22px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }

/* --- Boarding pass */
.pass {
    position: relative; max-width: 980px; margin: 0 auto; background: var(--paper);
    border-radius: 22px; box-shadow: var(--shadow);
}
.pass-head { display: flex; flex-wrap: wrap; gap: 14px 30px; align-items: flex-end; padding: 22px 26px 18px; }
.field { display: flex; flex-direction: column; min-width: 90px; }
.field.wide { flex: 1 1 260px; }
.field span { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.field b { font-family: var(--display); font-weight: 400; font-size: 24px; color: #fff; }
.days { flex-basis: 100%; display: flex; gap: 18px; font-weight: 700; }
.days a { color: var(--band-hi); text-decoration: none; }
.days a:hover { text-decoration: underline; }

.perforation { position: relative; height: 0; margin: 0 22px; border-top: 3px dashed var(--rule); }
.perforation::before, .perforation::after {
    content: ""; position: absolute; top: -15px; width: 28px; height: 28px; border-radius: 50%; background: var(--sky-low);
}
.perforation::before { left: -36px; }
.perforation::after { right: -36px; }

/* --- Tools: search, refresh, difficulty filter */
.tools {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 20px 26px 4px; align-items: center;
}
.search input {
    width: 100%; padding: 10px 14px 10px 40px; border-radius: 12px; border: 2px solid transparent;
    background: var(--inset) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%239aa1b5' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='7.5' cy='7.5' r='5.5'/%3E%3Cpath d='M12 12l4.5 4.5'/%3E%3C/svg%3E") 13px center no-repeat;
    color: var(--ink); font: 600 16px var(--body);
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--band-hi); }
.refresh {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 0; cursor: pointer;
    background: var(--band); color: #fff; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}
.refresh:hover:not(:disabled) { background: var(--band-hi); }
.refresh:disabled { opacity: 0.55; cursor: default; }
.refresh::before {
    content: ""; width: 16px; height: 16px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M13.5 8a5.5 5.5 0 1 1-1.6-3.9'/%3E%3Cpath d='M13.5 2.5v3.2h-3.2'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M13.5 8a5.5 5.5 0 1 1-1.6-3.9'/%3E%3Cpath d='M13.5 2.5v3.2h-3.2'/%3E%3C/svg%3E") center / contain no-repeat;
}
.refresh.spin::before { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.grades { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.grades button {
    border: 2px solid var(--inset-hi); background: transparent; color: var(--dim); cursor: pointer;
    padding: 4px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.grades button:hover { color: var(--ink); border-color: var(--band-hi); }
.grades button[aria-pressed="true"] { background: var(--band); border-color: var(--band); color: #fff; }
.grades button small { font-weight: 600; opacity: 0.7; margin-left: 4px; }
.grades:empty { display: none; }

/* --- Table */
.board-head, .row {
    display: grid; grid-template-columns: 56px minmax(0, 1fr) 150px 130px; gap: 14px; align-items: center;
}
.board-head {
    padding: 14px 26px 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim);
}
.board-head span:nth-child(3), .board-head span:nth-child(4) { text-align: right; }
.board { list-style: none; margin: 0; padding: 0 12px 10px; }
.entry { border-radius: 14px; transition: background-color 0.2s ease; }
.entry + .entry { border-top: 1px solid var(--rule); }
.entry.open { background: var(--inset); border-top-color: transparent; }
.entry.open + .entry { border-top-color: transparent; }
.row {
    width: 100%; padding: 12px 14px; border: 0; border-radius: 14px; background: transparent; text-align: left; cursor: pointer;
}
.row:hover { background: var(--inset); }
.entry.open .row:hover { background: var(--inset-hi); }

.rank {
    justify-self: center; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
    font-family: var(--display); font-size: 21px; color: var(--ink); background: var(--inset-hi);
}
.p1 .rank { background: var(--gold); color: #3d2a00; }
.p2 .rank { background: var(--silver); color: #232a33; }
.p3 .rank { background: var(--bronze); color: #2e1700; }

.group { min-width: 0; font-family: var(--display); font-size: 21px; line-height: 1.25; overflow-wrap: anywhere; }
.group .sep { color: var(--faint); }
.time { font-family: var(--display); font-size: 24px; text-align: right; color: #fff; white-space: nowrap; }
.time small { font-size: 15px; color: var(--dim); }
.ascent { justify-self: end; display: flex; align-items: center; gap: 10px; }
.pill {
    display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 800;
    background: var(--band); color: #fff; white-space: nowrap;
}
.chev {
    width: 10px; height: 10px; border-right: 2.5px solid var(--dim); border-bottom: 2.5px solid var(--dim);
    transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.3s ease;
}
.entry.open .chev { transform: rotate(225deg) translate(-2px, -2px); }

/* --- Names, painted per letter by board.js like PEAK's name colours */
.name { position: relative; display: inline-block; white-space: pre; color: #fff; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.75)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.8)); }
.name.host { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: rgba(255, 255, 255, 0.35); }
.name .l { display: inline-block; }
.name .l.grad { color: transparent; -webkit-background-clip: text; background-clip: text; }
.name .star {
    position: absolute; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle, #f2f7ff 0 45%, rgba(242, 247, 255, 0) 70%);
}

/* --- Details, slide open on click */
.more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.38s cubic-bezier(0.2, 0.7, 0.2, 1); }
.entry.open .more { grid-template-rows: 1fr; }
.more > div { overflow: hidden; min-height: 0; }
.card {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 26px;
    padding: 6px 18px 20px 84px; opacity: 0; transform: translateY(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.entry.open .card { opacity: 1; transform: none; }
.card h3 { margin: 0 0 10px; font-family: var(--display); font-weight: 400; font-size: 18px; color: #fff; }

.bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin-bottom: 12px; background: var(--paper); }
.bar span { min-width: 3px; }
.legs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.legs li { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; font-size: 15px; }
.legs li b { font-weight: 700; font-variant-numeric: tabular-nums; }
.dot { width: 12px; height: 12px; border-radius: 4px; }

.b-shore { background: #f2c14e; }
.b-tropics { background: #3fb56b; }
.b-roots { background: #9b6b4f; }
.b-alpine { background: #8ecae6; }
.b-mesa { background: #e07a3f; }
.b-caldera { background: #d7263d; }
.b-kiln { background: #7d1d1d; }
.b-gloom { background: #7b5ea7; }
.b-citadel { background: #5a6478; }
.b-peak { background: #e8ecf5; }

.scouts { display: grid; gap: 10px; }
.scout { padding: 10px 12px; border-radius: 12px; background: var(--paper); }
.scout.total { background: transparent; border: 2px dashed var(--rule); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 6px; }
.who .name, .who > b { font-family: var(--display); font-weight: 400; font-size: 19px; }
.who em { font-style: normal; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.count { display: inline-flex; align-items: center; gap: 4px; font-family: var(--display); font-size: 17px; color: var(--c, var(--ink)); }
.count img { width: 20px; height: 20px; }
/* Ohnmacht-Symbol im Grau des Totenkopfs (dead.png). */
.count .ico { background: #d5d4d4; }

/* Afflictions like the weather report: tinted PEAK icon, name and number in the status colour */
.chips { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--display); font-size: 17px; color: var(--c); white-space: nowrap; cursor: default; }
.ico {
    flex: none; width: 20px; height: 20px; background: var(--c);
    -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.none { margin: 0; color: var(--faint); font-size: 14px; }

.note, .empty { margin: 0; padding: 36px 20px 40px; text-align: center; color: var(--dim); font-weight: 600; }
.empty img { display: block; margin: 0 auto 10px; width: 56px; height: auto; opacity: 0.8; }
.more-row { display: flex; justify-content: center; padding: 0 0 18px; }
.link { border: 0; background: transparent; color: var(--band-hi); font-weight: 800; cursor: pointer; padding: 6px 10px; }
.link:hover { text-decoration: underline; }

.foot { max-width: 980px; margin: 26px auto 0; text-align: center; color: rgba(255, 255, 255, 0.82); font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.foot .small { font-size: 13px; color: rgba(255, 255, 255, 0.6); }
.peakname { font-family: var(--display); font-size: 1.25em; color: #fff; }

@media (max-width: 720px) {
    .band { padding: 10px 14px; }
    .flight { display: none; }
    .langs { margin-left: auto; }
    .tools { padding: 16px 14px 4px; }
    .board-head { display: none; }
    .board { padding: 0 6px 8px; }
    .row { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "rank group group" "rank time ascent"; gap: 4px 10px; padding: 10px; }
    .rank { grid-area: rank; width: 38px; height: 38px; font-size: 19px; }
    .group { grid-area: group; font-size: 19px; }
    .time { grid-area: time; text-align: left; font-size: 21px; }
    .ascent { grid-area: ascent; }
    .card { grid-template-columns: 1fr; padding: 4px 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .more, .card, .chev, .entry { transition: none; }
    .refresh.spin::before { animation: none; }
}
