:root {
  color-scheme: light dark;
  --bg: #f6f1e7; --card: #fffdf8; --ink: #22302e; --muted: #6a7370; --line: #e2d9c8; --accent: #1f5c57; --on-accent: #fffdf8; --star: #c08a2b; --note: #f7e3cf;
  --stage-paper: #fffdf8; --stage-ink: #22302e; --stage-line: #ece4d5; --stage-staff: #a8a497; --stage-hit: #eef3ec; --stage-right: #2c7a73; --stage-left: #b5762a;
  --stage-good: #5d9a52; --stage-missed: #b3564c; --stage-slip: #c9a24a; --stage-hint: #bcd9d3; --stage-white: #ffffff; --stage-black: #2a2f2e; --stage-keytext: #77807c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16201f; --card: #1e2a28; --ink: #ece7dc; --muted: #9eaaa6; --line: #33423f; --accent: #6fb8ae; --on-accent: #10201e; --star: #dcae57; --note: #4a3826;
    --stage-paper: #1a2523; --stage-ink: #ece7dc; --stage-line: #2a3735; --stage-staff: #71807c; --stage-hit: #22322f; --stage-right: #5fb0a5; --stage-left: #d69a50;
    --stage-good: #7fbb73; --stage-missed: #d1796f; --stage-slip: #d8b765; --stage-hint: #5d8a83; --stage-white: #dcd8ce; --stage-black: #0d1312; --stage-keytext: #59625f;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
h1, h2, .brand { font-family: Georgia, serif; font-weight: 600; line-height: 1.2; margin: 0 0 .4rem; }
h1:focus { outline: none; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; }
p { margin: 0 0 1rem; }
.muted, small { color: var(--muted); }
small { font-size: .85rem; }
main { max-width: 1100px; margin: 0 auto; padding: 1rem max(1rem, env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.5rem; padding: calc(.5rem + env(safe-area-inset-top)) 1rem .5rem; border-bottom: 1px solid var(--line); }
.brand { font-size: 1.3rem; margin: 0; color: var(--accent); text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: .2rem; }
nav a { padding: .6rem .8rem; min-height: 44px; color: var(--muted); text-decoration: none; border-radius: 10px; }
nav a.active { color: var(--ink); background: var(--card); }
section { margin-bottom: 2rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.2rem; margin-bottom: 1rem; }
.text { max-width: 720px; }
.hero { padding: 1.5rem 0; }
.stats { display: flex; flex-wrap: wrap; gap: 2rem; margin: 1.5rem 0 0; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dd { margin: 0; font: 600 1.8rem Georgia, serif; } .stats dt { color: var(--muted); font-size: .9rem; }
.list { padding: 0; overflow: hidden; margin-top: .8rem; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.2rem; min-height: 56px; color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item span small { display: block; }
.locked { color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 1.2rem; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: inherit; font: inherit; text-decoration: none; cursor: pointer; touch-action: manipulation; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn:disabled { opacity: .5; }
:focus-visible { outline: 3px solid var(--star); outline-offset: 2px; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.center { text-align: center; justify-content: center; }
.seg { display: inline-flex; flex-wrap: wrap; gap: .2rem; background: var(--line); border-radius: 12px; padding: .2rem; margin-bottom: .6rem; }
.seg button { min-height: 44px; padding: 0 1rem; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; cursor: pointer; }
.seg button.active { background: var(--card); font-weight: 600; }
.field { display: block; margin-bottom: .6rem; } .field > span { display: block; color: var(--muted); font-size: .9rem; margin-bottom: .2rem; }
.input { min-height: 46px; padding: 0 .8rem; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
input[type=range] { width: 100%; max-width: 340px; min-height: 40px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: .6rem; min-height: 44px; } .check input { width: 22px; height: 22px; accent-color: var(--accent); }
.stars { color: var(--line); white-space: nowrap; font-size: 1.2rem; } .stars .on { color: var(--star); }
.overlay .stars { font-size: 2.4rem; }
.note { background: var(--note); border-radius: 12px; padding: .8rem 1rem; }
.player-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; align-items: start; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .4rem 1.5rem; }
.stage { position: relative; height: max(340px, calc(100dvh - 230px)); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 80%, transparent); }
.offer { position: absolute; top: .6rem; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem; padding: .7rem 1rem; width: max-content; max-width: 94%; }
.heard { font: 600 5rem Georgia, serif; text-align: center; }
.meter { height: 14px; background: var(--line); border-radius: 7px; overflow: hidden; margin-bottom: .6rem; } .meter div { height: 100%; background: var(--accent); transition: width .1s; }
.loading { text-align: center; padding: 20vh 1rem; color: var(--muted); }
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 1rem; background: var(--note); }
