/* Self-hosted (CSP default-src 'self'); latin subsets, other scripts fall back to system fonts. OFL: fonts/OFL-*.txt */
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/fredoka-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400 900; font-display: swap; src: url(fonts/nunito-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* Classic Night tokens. */
:root {
  --bg: #101b32; --bg-glow: #1f3056;
  --surface: #232c3e; --surface-raised: #2b354a; --surface-sunken: #19212f;
  --line: #3a465d; --line-strong: #56637d;
  --wood: #705035; --wood-light: #82603f; --wood-line: #9a7650;
  --text: #f4ebdc; --text-soft: #d6ccbb; --text-muted: #aab3c4;
  --gold: #ffc56b; --gold-deep: #eba446; --on-gold: #3a2410;
  --green: #b6e65b; --green-deep: #8cc236; --orange: #f0952f;
  --radius-sm: 8px; --radius: 12px; --radius-lg: 16px;
  --shadow: 0 14px 36px #050b1c99;
  --font-display: "Fredoka", "Nunito", "Trebuchet MS", system-ui, sans-serif;
  --font-ui: "Nunito", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark; font-family: var(--font-ui); color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
/* Reserve the scrollbar's space so short and long pages line up. */
html { scrollbar-gutter: stable; }
body { margin: 0; min-width: 280px; min-height: 100vh; background: radial-gradient(ellipse 90% 60% at 50% -10%, var(--bg-glow), transparent 70%), radial-gradient(ellipse at 80% 100%, #1b2a4b, var(--bg) 60%); background-attachment: fixed; }
.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.sky::before, .sky::after { content: ""; position: absolute; width: 300px; height: 100px; border-radius: 100px; background: #b7c8e40a; box-shadow: 50px -30px 0 #b7c8e40a; }
.sky::before { top: 180px; left: -160px; }
.sky::after { top: 430px; right: -160px; }
main { position: relative; max-width: 1160px; padding: 36px 24px 32px; margin: auto; }
.masthead, .brand, .board-header, .toolbar, .metrics, .windows, .ranking-context, .board-footer { display: flex; align-items: center; }
.masthead { justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.brand { gap: 12px; min-width: 0; }
.emblem { flex: 0 0 42px; width: 42px; height: 42px; filter: drop-shadow(0 0px 0 #6b4a2e); }
.brand strong { display: block; font-family: var(--font-display); font-size: 32px; font-weight: 600; line-height: 1.05; letter-spacing: -.3px; color: var(--text); text-shadow: 0 3px 0 #5a3e27; }
.brand span { display: block; margin-top: 5px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.local-badge { color: var(--gold); border: 1px solid var(--wood-line); background: #3b2b1e; border-radius: var(--radius-sm); padding: 7px 11px; font-size: 11px; font-weight: 800; letter-spacing: 1px; white-space: nowrap; }
.demo-notice { display: flex; gap: 12px; align-items: baseline; padding: 12px 16px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text-soft); font-size: 13px; line-height: 1.5; }
.demo-notice strong { color: var(--gold); font-size: 11px; letter-spacing: 1px; white-space: nowrap; }
.board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow), inset 0 1px #ffffff0a; overflow: hidden; transition: height 2s;}
.board-header { justify-content: space-between; gap: 12px; padding: 14px 20px; background: linear-gradient(var(--wood-light), var(--wood)); border-bottom: 2px solid #4b3423; box-shadow: inset 0 1px #ffffff1f; }
.board.player-board header.board-header { justify-content: flex-start }
h1 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: .2px; }
h1 span { color: var(--gold); margin-right: 7px; }
.board-header > span { font-size: 12px; font-weight: 600; color: #f0dcc0; }
.toolbar { justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 12px 20px 8px; }
.metrics, .windows { gap: 7px; flex-wrap: wrap; }
#streamer-metrics button, #character-sort-control button { width: 8em; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface-raised); color: var(--text-soft); border-radius: 100px; font-size: 14px; font-weight: 800; padding: 9px 17px; min-height: 40px; transition: background-color .15s, border-color .15s, color .15s; }
button:hover:not(:disabled) { border-color: var(--gold-deep); color: var(--text); background: #34405a; }
button:focus-visible { outline: 3px solid #bedbff; outline-offset: 3px; }
.metrics button[aria-pressed="true"] { background: linear-gradient(#ffd68c, var(--gold-deep)); border-color: #ffdf9f; color: var(--on-gold); box-shadow: inset 0 -3px #b06d1d40, 0 2px 0 #00000040; }
.windows { gap: 5px; }
.windows > span { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-right: 3px; }
.windows:not(#streamer-windows) button { padding: 5px 12px; min-height: 32px; font-size: 12px; font-variant-numeric: tabular-nums; }
.windows button[aria-pressed="true"] { background: var(--wood); border-color: var(--gold); color: #fff3dc; }
button:disabled { cursor: default; opacity: .35; }
.ranking-context { justify-content: space-between; gap: 10px; padding: 2px 21px 12px; min-height: 35px; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.ranking-context p { margin: 0; line-height: 1.5; }
#ranking-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
ol { list-style: none; padding: 0 20px 8px; margin: 0; }
.entry { display: grid; grid-template-columns: 38px 65px minmax(130px, 185px) minmax(150px, 1fr) 115px; gap: 14px; align-items: center; min-height: 86px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised); transition: border-color .15s; }
.entry:hover { border-color: var(--line-strong); }
.entry[data-rank="1"] { border-color: #b8934a; background: linear-gradient(100deg, #3a3a3f, var(--surface-raised) 45%); }
.rank { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--text-soft); background: var(--surface-sunken); border: 1px solid var(--line-strong); font-family: var(--font-display); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank[data-medal="1"] { background: linear-gradient(135deg, #fff2ab, #deb12c); border-color: #eaca63; color: #684909; box-shadow: inset 0 -3px #936b2826; }
.rank[data-medal="2"] { background: linear-gradient(135deg, #f6f8fc, #9da8b7); border-color: #bec7d2; color: #404957; }
.rank[data-medal="3"] { background: linear-gradient(135deg, #ffdcac, #ba7139); border-color: #d8a06a; color: #66320b; }
.level { padding: 6px 5px; background: linear-gradient(#3d4964, #2a3349); border: 1px solid #5d6b88; border-radius: var(--radius-sm); font-weight: 800; text-align: center; white-space: nowrap; font-size: 16px; font-variant-numeric: tabular-nums; box-shadow: 0 2px #10182a; }
.level small { font-size: 10px; font-weight: 800; font-style: italic; margin-right: 4px; color: var(--text-soft); }
.level strong { color: var(--gold); }
.identity, .exp-section, .score { min-width: 0; }
.character { display: block; font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.channel { display: block; color: var(--text-muted); font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 4px; }
.status { font-size: 12px; font-weight: 600; line-height: 1.45; color: var(--text-soft); }
.status::before { content: ""; display: inline-block; width: 7px; height: 7px; background: #8e97a8; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.entry[data-state="tracking"] .status::before { background: var(--green); box-shadow: 0 0 6px #b6e65b99; }
.entry[data-state="stale"] .status::before { background: var(--gold); }
.exp-bar { position: relative; height: 24px; border-radius: 7px; background: #39445a; border: 1px solid #4a5670; overflow: hidden; box-shadow: inset 0 2px 3px #0006; }
progress { display: block; appearance: none; width: 100%; height: 100%; border: 0; background: #39445a; accent-color: var(--green); }
progress::-webkit-progress-bar { background: #39445a; }
progress::-webkit-progress-value { background: linear-gradient(#d4f584, var(--green) 45%, var(--green-deep)); box-shadow: inset 0 1px #f4ffc4; }
progress::-moz-progress-bar { background: var(--green); }
.exp-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 6px; white-space: nowrap; font-size: 12px; font-weight: 800; text-shadow: 0 1px 2px #000, 1px 0 2px #000, -1px 0 2px #000; font-variant-numeric: tabular-nums; }
.exp-label small { font-size: 10px; color: #fbf3c4; font-style: italic; }
.exp-detail { margin-top: 7px; font-size: 12px; font-weight: 600; color: var(--text-muted); line-height: 1.5; font-variant-numeric: tabular-nums; }
.score { text-align: right; font-variant-numeric: tabular-nums; }
.score strong { display: block; font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -.2px; color: var(--text); }
.score small { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); margin-top: 2px; }
.board-footer { justify-content: space-between; gap: 12px; padding: 10px 21px 18px; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.board-footer > span:first-child { color: var(--gold); }
.page-footer { margin: 18px 5px 0; color: var(--text-muted); font-size: 12px; line-height: 1.8; text-align: center; }
.page-footer strong { color: var(--text-soft); }
.no-script { padding: 20px; }
[hidden] { display: none !important; }
@media (max-width: 850px) {
  .entry { grid-template-columns: 32px 58px minmax(115px, 150px) minmax(100px, 1fr) 85px; gap: 9px; padding: 13px 10px; }
  .character { font-size: 16px; }
  .score strong { font-size: 22px; }
  .exp-label { font-size: 11px; }
}
@media (max-width: 650px) {
  main { padding: 22px 12px; }
  .masthead { margin-bottom: 19px; gap: 8px; }
  .brand { gap: 8px; }
  .brand strong { font-size: 26px; }
  .brand span { font-size: 12px; max-width: 240px; line-height: 1.4; }
  .emblem { width: 34px; height: 34px; flex-basis: 34px; }
  .local-badge { font-size: 9px; padding: 6px; letter-spacing: .5px; }
  .demo-notice { display: block; padding: 10px 12px; font-size: 12px; }
  .demo-notice strong { display: block; margin-bottom: 2px; }
  .board-header { padding: 12px 13px; align-items: flex-start; }
  .board-header > span { max-width: 140px; text-align: right; line-height: 1.45; font-size: 11px; }
  h1 { font-size: 16px; }
  .toolbar { padding: 14px 12px 8px; gap: 12px; }
  .metrics { gap: 5px; }
  .metrics button, #streamer-windows button { font-size: 13px; padding: 8px 13px; }
  .ranking-context { padding: 4px 13px 12px; align-items: flex-start; font-size: 11px; }
  #ranking-count { text-align: right; }
  ol { padding: 0 10px 4px; }
  .entry { grid-template-columns: 36px minmax(0, 1fr) 87px; gap: 9px; padding: 12px 11px; }
  .rank { grid-column: 1; grid-row: 1; }
  .identity { grid-column: 2; grid-row: 1; }
  .score { grid-column: 3; grid-row: 1; }
  .level { grid-column: 1; grid-row: 2; padding: 5px 1px; font-size: 15px; }
  .level small { display: block; font-size: 9px; margin: 0; }
  .exp-section { grid-column: 2 / 4; grid-row: 2; }
  .character { font-size: 17px; }
  .score strong { font-size: 22px; }
  .exp-label { font-size: 11px; }
  .board-footer { padding: 10px 13px 15px; font-size: 11px; flex-wrap: wrap; }
}
/* Same-site page changes cross-fade where supported instead of flashing. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; transition: none !important; } @view-transition { navigation: none; } }
