/* Paper and ink. One ground, one ink, one grey, and a single accent taken from the song.
   Hairlines instead of boxes, a serif for anything worth reading large, no glow anywhere. */
:root {
  --hue: 350;
  --bg: #f0e8d8;
  --surface: #f8f2e6;
  --ink: #1a1614;
  --muted: #746a5e;
  --faint: #a3978a;
  --line: rgba(29, 27, 25, 0.12);
  --line-strong: rgba(29, 27, 25, 0.3);
  --wash: rgba(29, 27, 25, 0.045);
  --miss: #96562a;
  --warn: #9a6f14;
  --accent: hsl(var(--hue) 58% 30%);
  --accent-soft: hsl(var(--hue) 58% 30% / 0.1);
  --serif: "Fraunces", "LXGW WenKai TC", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: Inter, "LXGW WenKai TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --brush: "Cormorant Garamond", "Long Cang", "LXGW WenKai TC", "Fraunces", Georgia, serif;
}
:root[data-theme="ink"] {
  --bg: #14100f;
  --surface: #1e1917;
  --ink: #ece2d0;
  --muted: #96908a;
  --faint: #6e6962;
  --line: rgba(236, 231, 221, 0.13);
  --line-strong: rgba(236, 231, 221, 0.32);
  --wash: rgba(236, 231, 221, 0.055);
  --miss: #d6965a;
  --warn: #d9b25c;
  --accent: hsl(var(--hue) 52% 52%);
  --accent-soft: hsl(var(--hue) 52% 52% / 0.16);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
  overflow: hidden; -webkit-font-smoothing: antialiased; user-select: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; font-weight: 400; }
.logo, .detail-meta h2, .np-title, .score, .big-score, .grade, .diff-lv, .countdown, .res-song, .modal-card h2, .drop b, .best b { font-weight: 300; font-optical-sizing: auto; }
::selection { background: var(--accent-soft); }
kbd {
  font-family: var(--sans); font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--muted); margin: 0 2px;
}

#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#art {
  position: fixed; inset: -60px; z-index: 0; background-size: cover; background-position: center;
  filter: blur(46px) saturate(0.85); opacity: 0; transition: opacity 0.8s ease;
}
#art.show { opacity: 0.16; }

.screen { position: fixed; inset: 0; z-index: 1; display: none; }
.screen.show { display: flex; animation: fade-in 0.4s ease both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 500; font-size: 14px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink); white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--wash); border-color: var(--ink); }
.btn:active { opacity: 0.7; }
.btn:focus-visible, .seg button:focus-visible, .diff:focus-visible, .chip-toggle:focus-visible, .song:focus-visible, .drop:focus-visible, .bind:focus-visible {
  outline: 1.5px solid var(--accent); outline-offset: 3px;
}
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.86; background: var(--ink); }
.btn.primary kbd { border-color: currentColor; color: inherit; opacity: 0.55; }
.btn.big { font-size: 15px; padding: 14px 28px; }
.btn.tiny { font-size: 12.5px; padding: 6px 12px; }
.btn.danger:hover { border-color: var(--miss); color: var(--miss); }
.btn[disabled] { opacity: 0.35; pointer-events: none; }

/* title */
#title { align-items: center; justify-content: center; text-align: center; }
.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 24px; position: relative; z-index: 0; }
.enso { width: clamp(120px, 22vh, 200px); height: clamp(120px, 22vh, 200px); margin-bottom: -6px; pointer-events: none; }
.logo-mark { width: 72px; height: 74px; position: relative; margin-bottom: 6px; }
.logo-mark::before { content: ""; position: absolute; left: 50%; top: 0; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; background: var(--ink); animation: drop 3.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; }
.logo-mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: var(--ink); }
@keyframes drop { 0%, 12% { transform: translateY(0); } 50%, 62% { transform: translateY(40px); background: var(--accent); } 100% { transform: translateY(0); } }
.logo { font-family: var(--brush); font-weight: 400 !important; font-size: clamp(84px, 15vw, 190px); line-height: 0.9; letter-spacing: -0.01em; }
.tagline { font-size: 12.5px; color: var(--muted); letter-spacing: 0.24em; text-transform: uppercase; margin-bottom: 18px; }
#btn-start { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }
.fine { font-size: 12.5px; color: var(--faint); line-height: 1.6; }
.fine.ok { color: var(--accent); }
.fine.warn { color: var(--warn); }
.fine code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; padding: 3px 7px; border-radius: 5px; background: var(--wash); color: var(--ink); user-select: all; white-space: nowrap; }
.muted { color: var(--muted); }

/* song select */
#select { flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 62%, transparent); }
.brand { font-family: var(--brush); font-size: 34px; line-height: 0.8; margin-right: 14px; }
.search { width: min(280px, 30vw); padding: 8px 2px; border: 0; border-bottom: 1px solid var(--line-strong); background: transparent; outline: none; user-select: text; border-radius: 0; }
.search::placeholder, .url-form input::placeholder { color: var(--faint); }
.search:focus { border-color: var(--ink); }
.spacer { flex: 1; }
.select-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 390px) 1fr; }
.song-list { overflow-y: auto; padding: 6px 14px 30px 20px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 62%, transparent); scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.list-head { font-size: 10.5px; letter-spacing: 0.2em; color: var(--faint); padding: 20px 10px 8px; text-transform: uppercase; }
.song {
  width: 100%; display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center; text-align: left;
  padding: 9px 12px 9px 10px; border-radius: 10px; border: 0; background: transparent; position: relative; transition: background 0.15s;
}
.song:hover { background: var(--wash); }
.song.sel { background: var(--accent-soft); }
.song.sel::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; border-radius: 2px; background: var(--accent); }
.thumb { width: 46px; height: 46px; border-radius: 6px; background-size: cover; background-position: center; background-color: var(--wash); }
.song-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-meta { font-size: 11.5px; color: var(--faint); text-align: right; line-height: 1.55; font-variant-numeric: tabular-nums; }
.song-meta b { color: var(--accent); font-family: var(--serif); font-style: italic; font-size: 15px; font-weight: 400; }
.empty { padding: 8px 10px 14px; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.empty button { margin-top: 12px; }

.detail { overflow-y: auto; padding: 38px clamp(24px, 5vw, 76px) 30px; display: flex; flex-direction: column; gap: 26px; scrollbar-width: thin; }
.detail-head { display: flex; gap: 28px; align-items: flex-end; }
.cover { flex: none; width: 148px; height: 148px; border-radius: 8px; background-size: cover; background-position: center; background-color: var(--wash); box-shadow: 0 0 0 1px var(--line), 0 22px 44px -26px rgba(0, 0, 0, 0.5); }
.detail-meta { min-width: 0; }
.d-tag { font-size: 10.5px; letter-spacing: 0.2em; color: var(--accent); text-transform: uppercase; margin-bottom: 10px; }
.detail-meta h2 { font-family: var(--serif); font-size: clamp(34px, 4.2vw, 60px); line-height: 1; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.d-artist { font-size: 15.5px; margin-top: 10px; }
.d-sub { font-family: var(--serif); font-style: italic; font-size: 15.5px; color: var(--muted); margin-top: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip { font-size: 11.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); font-variant-numeric: tabular-nums; }

.row { display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: center; }
.label { font-size: 10.5px; letter-spacing: 0.2em; color: var(--faint); text-transform: uppercase; }
.row-body { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; min-width: 0; }
.seg { display: inline-flex; gap: 22px; }
.seg button { border: 0; background: transparent; padding: 5px 0; color: var(--muted); border-bottom: 1.5px solid transparent; border-radius: 0; }
.seg button:hover { color: var(--ink); }
.seg button.on { color: var(--ink); border-bottom-color: var(--ink); }
.keycaps { display: flex; gap: 5px; }
.cap, .bind { display: grid; place-items: center; border: 1px solid var(--line-strong); background: transparent; font-weight: 600; color: var(--ink); letter-spacing: 0.02em; }
.cap { min-width: 28px; height: 28px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; }
.cap.wide { min-width: 58px; font-size: 10px; letter-spacing: 0.12em; }
:root { --ochre: #9c6c1e; --indigo: #345484; }
:root[data-theme="ink"] { --ochre: #e2b05c; --indigo: #84aad8; }
.t-ochre { border-color: var(--ochre); color: var(--ochre); }
.t-indigo { border-color: var(--indigo); color: var(--indigo); }
.t-accent { border-color: var(--accent); color: var(--accent); }

.diffs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 660px; }
.diff { text-align: left; padding: 13px 16px 12px; border-radius: 12px; border: 1px solid var(--line); background: transparent; display: flex; flex-direction: column; gap: 2px; transition: border-color 0.15s, background 0.15s; }
.diff:hover { border-color: var(--line-strong); }
.diff.on { border-color: var(--ink); background: var(--surface); }
.diff-name { font-size: 10.5px; letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase; display: flex; align-items: center; gap: 7px; }
.diff-name::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.diff-lv { font-family: var(--serif); font-size: 40px; line-height: 1; margin-top: 6px; letter-spacing: -0.02em; }
.diff-lv small { font-family: var(--sans); font-size: 10px; color: var(--faint); font-weight: 600; letter-spacing: 0.14em; margin-right: 6px; }
.diff-info { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.diff-best { font-size: 11.5px; color: var(--accent); min-height: 17px; }

.mods { gap: 8px 10px; }
.chip-toggle { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; font-size: 13px; color: var(--muted); transition: background 0.15s, color 0.15s; }
.chip-toggle:hover { color: var(--ink); border-color: var(--ink); }
.chip-toggle.on { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.mini { display: inline-flex; align-items: center; gap: 9px; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); margin-left: 8px; }
.mini select, .set-ctl select { padding: 5px 2px; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; background: transparent; font-size: 14px; letter-spacing: 0; color: var(--ink); outline: none; }
.mini select option, .set-ctl select option { background: var(--surface); color: var(--ink); }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { border: 1px solid var(--line-strong); background: transparent; width: 26px; height: 26px; border-radius: 50%; line-height: 1; display: grid; place-items: center; font-size: 14px; }
.stepper button:hover { border-color: var(--ink); }
.stepper b { min-width: 44px; text-align: center; font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.lyr { gap: 8px; font-size: 13.5px; color: var(--muted); }
.lyr #lyr-status { margin-right: 6px; }
.lyr #lyr-status.ok { color: var(--accent); }

.play-row { margin-top: auto; padding: 18px 20px; margin-left: -20px; margin-right: -20px; border-radius: 16px; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(6px); border-top: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.best { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.best b { font-family: var(--serif); color: var(--ink); font-size: 28px; margin-right: 12px; letter-spacing: -0.02em; }
.best .g { font-family: var(--serif); font-style: italic; font-size: 30px; color: var(--accent); margin-right: 12px; }
#btn-play { min-width: 210px; padding: 10px 28px; }
#btn-play span { font-family: var(--serif); font-size: 24px; line-height: 1.3; font-weight: 300; }
.hints { padding: 10px 28px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); background: color-mix(in srgb, var(--bg) 78%, transparent); }
.hints i, .hud-hint i { display: inline-block; width: 14px; }

/* game */
#game { display: none; }
#game.show { display: block; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.hud { position: absolute; top: 0; bottom: 0; width: calc(50% - var(--half-field, 290px) - 40px); padding: 34px 36px; display: flex; flex-direction: column; pointer-events: none; }
.hud-left { left: 0; }
.hud-right { right: 0; align-items: flex-end; text-align: right; }
.np-title { font-family: var(--serif); font-size: clamp(20px, 2.1vw, 30px); line-height: 1.05; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.np-artist { color: var(--muted); font-size: 13px; margin-top: 6px; }
.np-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.np-tags span { font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.np-tags span.hot { border-color: var(--accent); color: var(--accent); }
.lyrics { margin: auto 0; display: flex; flex-direction: column; gap: 14px; text-align: right; padding-bottom: 6vh; font-family: var(--serif); }
.ly { line-height: 1.12; overflow-wrap: anywhere; min-height: 1em; }
.ly.prev, .ly.next { font-size: clamp(16px, 1.5vw, 21px); color: var(--faint); }
.ly { text-shadow: 0 0 10px var(--bg), 0 0 3px var(--bg); }
.ly.cur { font-family: var(--brush); font-size: clamp(34px, 4vw, 60px); line-height: 0.95; color: var(--ink); }
.ly.cur.pop { animation: ly-in 0.5s ease both; }
@keyframes ly-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.score { font-family: var(--serif); font-size: clamp(40px, 4.6vw, 70px); line-height: 0.9; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.score-sub { display: flex; gap: 14px; align-items: baseline; justify-content: flex-end; margin-top: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mult { font-family: var(--brush); font-size: 34px; color: var(--ink); line-height: 0.8; }
.mult.hot { color: var(--accent); }
.counts, .score, .score-sub, .np-title, .np-artist { text-shadow: 0 0 8px var(--bg), 0 0 2px var(--bg); }
.counts { margin: auto -14px 0 0; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 66%, transparent); backdrop-filter: blur(5px); display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.counts div { display: flex; gap: 16px; justify-content: flex-end; align-items: baseline; }
.counts dt { color: var(--faint); letter-spacing: 0.16em; text-transform: uppercase; font-size: 10px; }
.counts dd { margin: 0; min-width: 40px; font-size: 14px; font-weight: 500; }
.c-perfect dd { color: var(--accent); } .c-great dd { color: var(--ink); } .c-good dd { color: var(--muted); } .c-miss dd { color: var(--miss); } .c-combo { margin-top: 10px; }
.hud-hint { margin-top: 14px; font-size: 11px; color: var(--muted); text-shadow: 0 0 8px var(--bg), 0 0 2px var(--bg); }
.countdown { position: absolute; inset: 0; display: none; place-items: center; font-family: var(--brush); font-weight: 400 !important; font-size: 240px; pointer-events: none; }
.countdown.show { display: grid; }

#game.zen .score, #game.zen .score-sub, #game.zen .counts { display: none; }
.live-art { margin: auto 0 0; }
.live-art canvas { display: block; width: min(100%, 300px); height: auto; background: var(--surface); border-radius: 3px; box-shadow: 0 0 0 1px var(--line), 0 20px 36px -26px rgba(0, 0, 0, 0.55); }
.live-art figcaption { margin-top: 9px; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); }

/* overlays + modals */
.overlay, .modal { position: fixed; inset: 0; z-index: 20; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(10px); }
.overlay.show, .modal.show { display: grid; animation: fade-in 0.2s ease both; }
#pause { position: absolute; }
.overlay-card { display: flex; flex-direction: column; gap: 10px; min-width: 280px; padding: 30px 30px 26px; border-radius: 18px; border: 1px solid var(--line-strong); background: var(--surface); text-align: center; }
.overlay-card h2 { font-family: var(--brush); font-size: 54px; line-height: 0.9; margin-bottom: 14px; }
.loader { display: flex; flex-direction: column; align-items: center; gap: 18px; font-family: var(--brush); font-size: 34px; color: var(--muted); }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); border-top-color: var(--ink); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-card { width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 34px 36px 30px; border-radius: 18px; border: 1px solid var(--line-strong); background: var(--surface); display: flex; flex-direction: column; gap: 16px; box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.5); user-select: text; }
.modal-card h2 { font-family: var(--serif); font-size: 36px; line-height: 1; letter-spacing: -0.02em; }
.modal-card h3 { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); margin-top: 10px; font-weight: 500; }
.modal-card h3 small { letter-spacing: 0.06em; margin-left: 8px; text-transform: none; font-size: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.drop { border: 1px dashed var(--line-strong); border-radius: 14px; padding: 34px 18px; text-align: center; display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.drop:hover, .drop.over { border-color: var(--ink); background: var(--wash); }
.drop b { font-family: var(--serif); font-size: 24px; line-height: 1.15; }
.drop span { font-size: 12.5px; color: var(--muted); }
.or { display: flex; align-items: center; gap: 14px; color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.22em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.url-form { display: flex; gap: 12px; align-items: flex-end; }
.url-form input { flex: 1; min-width: 0; padding: 10px 2px; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; background: transparent; outline: none; }
.url-form input:focus { border-color: var(--ink); }
.progress { display: flex; flex-direction: column; gap: 10px; }
.p-stage { font-size: 13.5px; }
.bar { height: 2px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.25s ease; }
.error { padding: 4px 0 4px 14px; border-left: 2px solid var(--miss); color: var(--ink); font-size: 13.5px; overflow-wrap: anywhere; }
.set-grid { display: grid; grid-template-columns: 1fr minmax(200px, 240px); gap: 16px 20px; align-items: center; }
.set-grid label { font-weight: 500; }
.set-grid small { display: block; font-size: 12px; color: var(--faint); font-weight: 400; }
.set-ctl { display: flex; align-items: center; gap: 12px; }
.set-ctl input[type="range"] { flex: 1; accent-color: var(--ink); }
.set-ctl input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ink); }
.set-ctl select { flex: 1; }
.set-ctl output { min-width: 58px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.binds { display: flex; gap: 6px; flex-wrap: wrap; }
.bind { min-width: 44px; height: 44px; padding: 0 10px; border-radius: 10px; font-size: 13px; }
.bind:hover { border-color: var(--ink); }
.bind.wide { min-width: 92px; font-size: 11px; letter-spacing: 0.14em; }
.bind.listening { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* results */
#results { align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.res-card { width: min(1080px, 100%); padding: 36px 42px 30px; border-radius: 20px; border: 1px solid var(--line-strong); background: var(--surface); display: flex; flex-direction: column; gap: 26px; }
.res-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.res-song { font-family: var(--serif); font-size: 32px; line-height: 1.05; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.res-meta { color: var(--muted); font-size: 13px; margin-top: 8px; }
.res-flags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.flag { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--ink); color: var(--ink); white-space: nowrap; }
.flag.prism { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.flag.dim { border-color: var(--line-strong); color: var(--muted); }
.res-main { display: grid; grid-template-columns: 1.55fr 1fr; gap: 40px; align-items: center; }
.res-art { margin: 0; }
.res-art canvas { display: block; width: 100%; height: auto; border-radius: 3px; box-shadow: 0 0 0 1px var(--line), 0 30px 54px -34px rgba(0, 0, 0, 0.55); }
.res-art figcaption { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.res-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.grade { font-family: var(--brush); font-weight: 400 !important; font-size: 150px; line-height: 0.8; line-height: 0.7; min-width: 0; text-align: left; color: var(--accent); padding-bottom: 6px; animation: grade-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both 0.1s; }
.grade.f { color: var(--miss); }
@keyframes grade-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.big-score { font-family: var(--serif); font-size: 52px; line-height: 0.95; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.res-pair { display: flex; gap: 34px; margin: 14px 0 18px; }
.res-pair span { display: block; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); }
.res-pair b { font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; }
.res-counts { display: grid; gap: 7px; }
.rc { display: grid; grid-template-columns: 70px 1fr 40px; gap: 12px; align-items: center; font-size: 13px; }
.rc span { letter-spacing: 0.14em; text-transform: uppercase; color: var(--c); font-size: 10.5px; font-weight: 600; }
.rc i { height: 2px; background: var(--line); display: block; }
.rc i em { display: block; height: 100%; background: var(--c); }
.rc b { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.timing { display: flex; flex-direction: column; gap: 10px; }
#r-hist { width: 100%; height: 84px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.timing-text { font-size: 13px; color: var(--muted); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; min-height: 30px; }
.res-actions { display: flex; justify-content: flex-end; gap: 10px; }

.toast { position: fixed; left: 50%; bottom: 44px; transform: translate(-50%, 16px); z-index: 40; padding: 10px 20px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; max-width: min(560px, 90vw); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) {
  .hud { width: auto; padding: 16px 18px; }
  .hud-left { right: 50%; }
  .hud-right { left: 50%; }
  .lyrics { position: fixed; left: 0; right: 0; top: 12vh; margin: 0; padding: 0 16px; text-align: center; }
  .ly.prev { display: none; }
  .counts, .hud-hint, .np-tags, .live-art { display: none; }
  .np-title { font-size: 17px; } .np-artist { font-size: 12px; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  #select.show { position: static; min-height: 100vh; }
  .select-main { grid-template-columns: 1fr; }
  .song-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; padding: 4px 10px 14px; }
  .detail { padding: 24px 18px; }
  .detail-head { gap: 16px; align-items: center; } .cover { width: 88px; height: 88px; }
  .row { grid-template-columns: 1fr; gap: 8px; }
  .diffs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hints { display: none; }
  .search { width: 100%; flex: 1; } .brand, .spacer { display: none; }
  .res-main { grid-template-columns: 1fr; gap: 20px; } .grade { font-size: 110px; }
  .res-card { padding: 28px 24px; }
  .set-grid { grid-template-columns: 1fr; gap: 6px; }
  #btn-play { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* online: leaderboard, sharing */
.board { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 660px; font-variant-numeric: tabular-nums; }
.board-note { font-size: 13px; color: var(--muted); }
.board-row { display: grid; grid-template-columns: 26px 1fr 34px 96px 86px; gap: 10px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.board-row.me { color: var(--accent); font-weight: 600; }
.b-rank { color: var(--faint); } .b-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-grade { font-family: var(--brush); font-size: 20px; line-height: 0.8; color: var(--accent); }
.b-score { text-align: right; } .b-acc { text-align: right; color: var(--muted); font-size: 12px; }
.declare { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; }
.declare input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.community { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; }
.c-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.c-title { font-weight: 500; } .c-sub { font-size: 12.5px; color: var(--muted); } .c-info { min-width: 0; } .c-acts { display: flex; gap: 6px; flex: none; }

.np-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Chinese lyrics in running script (行书); the kai face only steps in for a character it lacks */
.ly.cjk { font-family: "Long Cang", "LXGW WenKai TC", var(--serif); }
.ly.cur.cjk { font-size: clamp(32px, 3.6vw, 54px); line-height: 1.2; }
.ly.prev.cjk, .ly.next.cjk { font-size: clamp(19px, 1.8vw, 26px); }

/* compact song page: the title never pushes Play off the screen */
.detail { gap: clamp(10px, 1.9vh, 24px); padding-top: clamp(16px, 3vh, 38px); padding-bottom: 14px; }
.detail-meta h2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: clamp(26px, min(3.4vw, 5.2vh), 54px); }
.cover { width: clamp(84px, 15vh, 148px); height: clamp(84px, 15vh, 148px); }
.diff { padding: clamp(7px, 1.2vh, 13px) 14px; } .diff-lv { font-size: clamp(26px, 4.2vh, 40px); }
.board { max-height: 16vh; overflow-y: auto; }
.play-row { position: sticky; bottom: 0; z-index: 2; padding: clamp(10px, 1.6vh, 18px) 20px; }
/* YouTube's player, small, beside the field. It can't be clicked, so it never takes the keyboard. */
.yt-holder { display: none; margin-top: 16px; width: 356px; max-width: 100%; height: 200px; flex: none; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--line), 0 20px 36px -26px rgba(0,0,0,.55); pointer-events: none; background: #000; }
.yt-holder.show { display: block; }
.yt-holder iframe { width: 100%; height: 100%; display: block; }

/* the expressive face: a soft old-style italic instead of a brush script */
.logo, .brand, .grade, .overlay-card h2, .loader, .countdown, .mult, .b-grade, .ly.cur { font-style: italic; font-weight: 500 !important; }
.logo { font-size: clamp(72px, 12vw, 156px); letter-spacing: -0.02em; line-height: 1; }
.brand { font-size: 30px; line-height: 0.9; }
.grade { font-size: 140px; line-height: 0.85; }
.ly.cur { font-size: clamp(28px, 3.2vw, 48px); line-height: 1.08; }
.ly.cjk { font-style: normal; }
.keys-link { color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }
a.btn { text-decoration: none; }
.modal-card.wide { width: min(720px, calc(100vw - 32px)); }
.free-tabs { margin: 6px 0 4px; flex-wrap: wrap; gap: 6px 20px; }
.free-list { max-height: 52vh; }
.free-lic { color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; font-size: 11.5px; }
.song.ghost .song-title, .song.ghost .song-artist { opacity: 0.72; }
.song.ghost .thumb { opacity: 0.55; filter: saturate(0.6); }
.song-meta .get { color: var(--accent); font-weight: 600; letter-spacing: 0.02em; }
.acct-menu { position: fixed; z-index: 60; min-width: 230px; padding: 8px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16); display: flex; flex-direction: column; gap: 2px; }
.acct-who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; min-width: 0; }
.acct-who b { font-weight: 500; } .acct-who span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.acct-item { text-align: left; padding: 9px 12px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; color: var(--ink); }
.acct-item:hover { background: var(--wash); } .acct-item.quiet { color: var(--muted); }
