:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #182521;
  background: #f5f3ed;
  font-synthesis: none;
  --paper: #f5f3ed;
  --surface: #fffefa;
  --ink: #182521;
  --muted: #4f6058;
  --line: #d5dbd2;
  --focus: #275ee0;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
h1:focus { outline: none; }
h1, p { margin: 0; }

.shell { max-width: 1440px; padding-inline: clamp(20px, 5vw, 78px); margin-inline: auto; }
.top { height: 74px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-size: 1.13rem; font-weight: 770; letter-spacing: -.035em; }
.home { max-width: 1040px; margin-inline: auto; padding: clamp(55px, 12vh, 135px) 0 50px; }
.home h1 { font-size: clamp(3.2rem, 10vw, 8.5rem); line-height: .93; font-weight: 790; letter-spacing: -.088em; }
.intro { color: var(--muted); font-size: clamp(1.1rem, 2vw, 1.5rem); margin: 20px 0 38px; }
.roles, .choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.role {
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  position: relative; gap: 26px; min-height: 220px; border-radius: 20px;
  padding: clamp(22px, 3vw, 36px); text-decoration: none; border: 1px solid transparent;
}
.player-role { background: #203b32; color: #f6fff9; }
.conductor-role { background: #e4e9fa; color: #243454; }
.player-role:hover { background: #2b4c40; }
.conductor-role:hover { background: #d7e1fc; }
.role strong, .role small { display: block; }
.role strong { font-size: clamp(1.55rem, 3.4vw, 2.55rem); line-height: 1.05; letter-spacing: -.045em; }
.role small { font-size: .98rem; margin-top: 10px; }
.arrow { position: absolute; top: 27px; right: 30px; font-size: 1.5rem; }

.chooser { max-width: 1000px; margin: 30px auto; }
.back { display: inline-flex; align-items: center; min-height: 38px; font-weight: 650; font-size: .93rem; text-decoration: none; }
.back:hover { text-decoration: underline; text-underline-offset: 4px; }
.chooser h1 { margin: 30px 0 25px; font-size: clamp(2.4rem, 6vw, 5rem); letter-spacing: -.07em; line-height: 1; }
.choice {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 15px; text-align: left; padding: 20px 24px; min-height: 100px;
  font-size: clamp(1.22rem, 2.4vw, 1.75rem); font-weight: 720; letter-spacing: -.04em;
}
.choice:hover, .control:hover:not(:disabled) { background: #e6ece3; border-color: #9aab9e; }
.choice small { display: block; color: var(--muted); font-size: .88rem; font-weight: 550; margin-top: 5px; letter-spacing: 0; }
.notice { color: #8c3629; margin-top: 12px; overflow-wrap: anywhere; }
.notice:empty { display: none; }
.notice p + p { margin-top: 6px; }
.notice .control { margin-top: 12px; }

.stage { min-height: calc(100vh - 74px); padding: 14px 0 20px; background: var(--paper); }
.stage:fullscreen { padding: 18px clamp(18px, 3vw, 50px); overflow: auto; }
.stage:-webkit-full-screen { padding: 18px clamp(18px, 3vw, 50px); overflow: auto; }
.stage-top, .instrument-heading, .score-heading, .score-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap;
}
.stage-controls, .audio-status, .pagination { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.control {
  color: var(--ink); border: 1px solid var(--line); border-radius: 9px; min-height: 40px;
  background: var(--surface); padding: 7px 13px; font-weight: 670; font-size: .9rem;
}
.control:disabled { opacity: .46; }
.volume { display: inline-flex; align-items: center; gap: 9px; font-size: .87rem; font-weight: 630; }
.volume input { accent-color: #275440; width: clamp(76px, 12vw, 145px); }
.instrument-heading, .score-heading { margin: 18px 0 14px; }
.stage h1 { font-size: clamp(2rem, 5vw, 4.4rem); line-height: 1; letter-spacing: -.066em; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; background: #e5e8e2;
  color: #36443a; padding: 8px 13px; font-size: .88rem; font-weight: 700;
}
.status-pill::before { content: ""; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: currentColor; }
.status-pill.ready { color: #135537; background: #dceee2; }
.status-pill.error { color: #892a20; background: #f9e6e1; overflow-wrap: anywhere; }

.pads { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(7px, 1.35vw, 18px); }
.pad {
  display: grid; place-items: center; padding: 6px; min-width: 0;
  min-height: clamp(112px, 26vh, 300px); color: #111b1e;
  border: 1px solid #dce0d8; border-radius: 17px; background: var(--surface);
  user-select: none; touch-action: manipulation;
}
.pad:disabled .symbol { opacity: .58; }
.pad:not(:disabled):hover { border-color: #8d9b90; }
.pad.playing { background: #e9ede5; border-color: #728178; }
.pad.playing .symbol { filter: brightness(1.22) saturate(1.2) drop-shadow(0 0 10px var(--color)); }
.symbol { position: relative; display: inline-grid; place-items: center; isolation: isolate; color: #111b1e; }
.symbol::before { content: ""; position: absolute; inset: 0; background: var(--color); clip-path: var(--shape); z-index: -1; }
.key-1 { --color: #ff7779; --shape: circle(47%); }
.key-2 { --color: #ffab66; --shape: inset(7%); }
.key-3 { --color: #ffdc64; --shape: polygon(50% 3%, 99% 94%, 1% 94%); }
.key-4 { --color: #69d6a0; --shape: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.key-5 { --color: #8abbff; --shape: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%); }
.key-6 { --color: #ccabff; --shape: polygon(50% 1%, 62% 32%, 98% 36%, 72% 59%, 79% 96%, 50% 76%, 21% 96%, 28% 59%, 2% 36%, 38% 32%); }
.pad .symbol { width: min(91%, clamp(100px, 23vh, 258px)); aspect-ratio: 1; align-content: center; }
.symbol-copy { display: grid; justify-items: center; line-height: 1; }
.key-3 .symbol-copy { transform: translateY(24%); }
.key-6 .symbol-copy { transform: translateY(8%); }
.pad .symbol b { display: block; font-size: clamp(1.65rem, 7.3vh, 4.8rem); font-weight: 820; line-height: .92; font-variant-numeric: tabular-nums; }
.pad .symbol small {
  display: block; max-width: 82%; margin-top: .32em; font-weight: 760;
  font-size: clamp(.65rem, 2.1vh, 1.07rem); line-height: 1.08; overflow-wrap: anywhere;
  padding: .08em .25em; border-radius: 4px; background: var(--color);
}
.tip { color: var(--muted); font-size: .9rem; margin-top: 11px; }

.score-meta { display: flex; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.score-meta span { background: #e5ebe3; padding: 7px 12px; border-radius: 8px; color: #263e32; font-size: clamp(.95rem, 1.7vw, 1.35rem); font-weight: 750; }
.score-scroll { overflow: auto; border: 1px solid #b7c3b9; border-radius: 12px; background: var(--surface); }
.notation {
  table-layout: fixed; border-collapse: collapse; width: 100%;
  --labels: clamp(106px, 15vw, 218px); min-width: calc(var(--labels) + var(--slots) * 33px);
}
.notation .labels { width: var(--labels); }
.notation .slot { width: auto; }
.notation th, .notation td { text-align: center; padding: 0; }
.notation .bar-row th { background: #203b32; color: #fffefa; height: clamp(30px, 5vh, 51px); font-size: clamp(.8rem, 1.7vw, 1.34rem); }
.notation .bar-row .bar-start { border-left-color: #b4c8b9; }
.notation .beat-row th { background: #e9eee7; height: clamp(27px, 4.5vh, 43px); color: #25362e; font-size: clamp(.74rem, 1.5vw, 1.15rem); border-bottom: 1px solid #aab8ae; }
.notation tbody th {
  text-align: left; padding-left: clamp(8px, 1.5vw, 22px);
  font-size: clamp(.92rem, 2.2vw, 1.9rem); letter-spacing: -.04em; overflow-wrap: anywhere;
}
.notation tbody tr { height: clamp(53px, 13.2vh, 150px); border-bottom: 1px solid #bdc9be; }
.notation tbody tr:nth-child(even) { background: #f3f5ef; }
.notation tbody tr:last-child { border-bottom: 0; }
.notation .bar-start { border-left: 2px solid #52685b; }
.notation .beat-start { border-left: 1px solid #c7d0c8; }
.notation .symbol {
  width: min(91%, clamp(32px, 8.8vh, 95px)); aspect-ratio: 1; vertical-align: middle;
  font-size: clamp(1.05rem, calc(50vw / var(--slots)), 2.8rem); font-weight: 830;
}
.notation .symbol b { font-weight: inherit; }
.rest { color: #627469; font-size: clamp(.85rem, 2vw, 1.6rem); }
.score-bottom { margin-top: 12px; }
.score-bottom .tip { margin: 0; }
.page-number { font-size: clamp(.92rem, 1.7vw, 1.21rem); font-weight: 735; min-width: 12ch; text-align: center; }
.pagination .control { min-width: 45px; font-size: 1.15rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 540px) {
  .top { height: 57px; }
  .roles, .choices { grid-template-columns: 1fr; }
  .role { min-height: 172px; }
  .stage { min-height: calc(100vh - 57px); }
  .pad { min-height: 105px; border-radius: 10px; }
  .pad .symbol b { font-size: clamp(1.4rem, 6.7vw, 2.7rem); }
}
@media (max-height: 620px) and (min-width: 541px) {
  .top { height: 52px; }
  .stage { min-height: calc(100vh - 52px); padding-top: 8px; }
  .instrument-heading, .score-heading { margin: 9px 0; }
}
@media (forced-colors: active) {
  .symbol { forced-color-adjust: none; }
}
