/* Virtual Piano reference studio — presentation only.
 * Screenshot-derived desktop layout; retains the existing controls and JS contracts.
 * This sheet intentionally follows the legacy inline theme so all overrides live together.
 */
:root {
  --studio-bg: #0b111e;
  --studio-panel: #131c2b;
  --studio-line: #2e3a4e;
  --studio-gold: #f1c875;
  --studio-text: #edf2fb;
  --studio-muted: #a5b0c3;
}
html, body { width:100%; }
body {
  background:radial-gradient(ellipse at 55% -35%,#202c42 0%,#0b111e 58%);
  color:var(--studio-text);
}
.shell { height:100dvh; min-height:0; padding:0; }
.shell > header {
  flex:none; height:61px; margin:0; padding:0 28px;
  border-bottom:1px solid #243046;
  background:linear-gradient(90deg,#0c1321,#111a2a 60%,#0b1320);
}
.brand { gap:12px; color:#fbfcff; font-size:1.16rem; letter-spacing:.045em; }
.brand-mark {
  width:39px; height:39px; border-radius:10px;
  background:linear-gradient(145deg,#ffdd8c,#f4b944);
  color:#33240c; font-size:1.4rem; box-shadow:0 0 18px #eebc5f55;
}
.key-range-toggle {
  min-height:39px; padding:0 16px; border-radius:10px;
  border-color:#c99935; color:#f1c875; background:#141b29;
  font-size:.89rem; letter-spacing:.16em; font-weight:900;
}
.key-range-toggle:focus-visible,
.utility-panel :is(button,select,input):focus-visible,
.playback-panel button:focus-visible,
.reference-metronome button:focus-visible,
.score-viewport:focus-visible {
  outline:2px solid #ffdf89; outline-offset:3px;
}
.studio {
  flex:1; min-height:0; display:flex; flex-direction:column;
  justify-content:flex-start; gap:0; padding:0; margin:0;
  border:0; background:transparent; box-shadow:none;
}
.studio-workspace {
  display:grid; grid-template-columns:minmax(245px,17.4fr) minmax(0,65.2fr) minmax(245px,17.4fr);
  gap:10px; width:100%; min-height:0; flex:1;
  padding:12px 16px 10px;
}
.utility-panel, .reference-metronome, .playback-panel {
  min-width:0;
  border:1px solid var(--studio-line);
  background:linear-gradient(145deg,#172234,#111928 58%,#111826);
  box-shadow:inset 0 1px #ffffff0c,0 8px 22px #02060e59;
}
.utility-panel {
  border-radius:19px; padding:8px 15px;
  display:flex; flex-direction:column; overflow-y:auto;
  scrollbar-width:thin; scrollbar-color:#526075 #101725;
}
.utility-group { min-width:0; padding:10px 5px 11px; border-bottom:1px solid #2b3647; }
.utility-group:last-of-type { border-bottom:0; }
.utility-label, .utility-panel .song-label, .utility-panel .action-label {
  display:flex; align-items:center; gap:9px; margin:0 0 9px;
  color:#eef2fb; font-size:.68rem; font-weight:850;
  letter-spacing:.13em; text-transform:uppercase; white-space:nowrap;
}
.utility-label > span[aria-hidden] { width:20px; text-align:center; color:#e7c177; font-size:1rem; letter-spacing:0; }
.utility-panel .select-wrap { display:block; width:100%; }
.utility-panel .select-wrap::after { right:15px; top:12px; }
.utility-panel #songSelect, .utility-panel #midiInputSelect {
  appearance:none; display:block; min-width:0; max-width:100%; width:100%;
  height:38px; border:1px solid #344459; border-radius:10px;
  padding:0 34px 0 10px; color:#f7f8fd; background:#101726;
  font-size:.77rem; font-weight:650;
}
.utility-panel #midiInputSelect[hidden] { display:none; }
.utility-panel .action-buttons { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.utility-panel .action-buttons .stop-button {
  min-width:0; min-height:37px; width:100%; padding:0 5px;
  border:1px solid #3c485b; border-radius:9px;
  background:linear-gradient(#293448,#1b2434); color:#e3e9f3;
  font-size:.75rem; font-weight:700;
}
.utility-panel .action-buttons .stop-button:hover:not(:disabled) { border-color:#daa953; background:#354157; }
.utility-panel .loop-button.active { border-color:#d5b16c; color:#ffe8b1; background:#3a3427; }
.utility-panel .loop-status { display:block; min-height:0; padding-top:3px; font-size:.68rem; color:var(--studio-gold); }
.utility-panel .loop-status:empty { display:none; }
.utility-panel .midi-line { display:flex; align-items:center; gap:9px; min-width:0; }
.utility-panel #midiConnect {
  min-width:102px; min-height:37px; padding:0 10px; border-radius:9px;
  border:1px solid #45536a; color:#edf2f8;
  background:linear-gradient(#2d384d,#1c2637); font-size:.72rem;
}
.utility-panel .midi-status {
  flex:1; min-width:0; overflow-wrap:anywhere; white-space:normal;
  color:#b4bfd2; font-size:.64rem; line-height:1.35;
}
.utility-panel #midiInputSelect:not([hidden]) { margin-top:7px; }
.utility-panel .volume { margin:0; font-size:.7rem; }
.utility-panel #volume { display:block; width:100%; height:22px; margin:2px 0 0; accent-color:var(--studio-gold); }
.utility-panel .tempo-line { display:flex; gap:10px; align-items:center; }
.utility-panel #tempoBpm {
  width:68px; height:35px; padding:0 6px;
  border:1px solid #b89146; border-radius:9px;
  color:#ffdb88; background:#101a2a; font-size:1.09rem;
  font-weight:850; text-align:center; font-variant-numeric:tabular-nums;
}
.utility-panel .tempo-line > span { color:#b6bfd2; font-size:.68rem; font-weight:700; }
.utility-switch-row { display:flex; align-items:center; justify-content:space-between; }
.utility-switch-row .utility-label { margin-bottom:0; }
.utility-panel .sustain-control {
  display:flex; align-items:center; grid-column:auto; grid-row:auto;
  flex-direction:row; justify-content:flex-end; margin:0; padding:0;
}
.utility-panel .sustain-control input {
  width:46px; height:25px; margin:0; border-color:#6e7b8c; background:#2b3546;
}
.utility-panel .sustain-control input:checked { border-color:#e2b755; background:#c89b41; }
.utility-panel .sustain-control input:checked::after { transform:translateX(21px); background:#fff5db; }
.range-guidance { display:block; padding-left:28px; color:#b6bfd0; font-size:.68rem; line-height:1.45; }
.utility-panel #soundHint {
  display:block; margin:auto 4px 2px; padding-top:7px;
  color:#7e93ad; font-size:.64rem; line-height:1.25;
}
.visually-hidden {
  position:absolute!important; width:1px!important; height:1px!important;
  padding:0!important; margin:-1px!important; overflow:hidden!important;
  clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important;
}
.studio-main { display:grid; grid-template-rows:minmax(0,1fr) minmax(118px,126px); gap:10px; min-width:0; min-height:0; }
.studio-main .score-panel {
  width:100%; height:auto; min-width:0; min-height:0;
  margin:0; padding:7px; border-radius:18px;
  border:1px solid #3e4d62; background:linear-gradient(#192338,#111a2b);
  box-shadow:0 8px 20px #050a1461,inset 0 1px #ffffff14;
}
.studio-main .score-heading {
  min-height:29px; display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin:0 10px 5px; color:#e0e8f5;
  font-size:.81rem; font-weight:800; letter-spacing:.15em; text-transform:uppercase;
}
.studio-main .score-heading > span:first-child > span { margin-right:5px; color:#f3d080; }
.studio-main .score-heading #scoreStatus {
  min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  color:#c5cedd; font-size:.79rem; text-transform:none; letter-spacing:0; font-weight:500;
}
.studio-main .score-viewport {
  height:calc(100% - 36px); min-height:0;
  padding:8px 0 0; border:1px solid #eadfce;
  border-radius:15px; background:#fcf9f2; color:#292729;
  overflow-x:auto; overflow-y:hidden;
}
.studio-main .score-canvas { min-width:100%; }
.playback-panel {
  display:flex; flex-direction:column; padding:10px 15px 11px;
  border-radius:17px; min-height:0;
}
.playback-header { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:22px; }
.playback-heading {
  color:#cdd7e9; font-size:.73rem; text-transform:uppercase;
  letter-spacing:.18em; font-weight:850; white-space:nowrap;
}
.playback-heading > span { color:#f9f8ff; font-size:.95rem; margin-right:8px; }
.playback-panel .screen-status {
  display:inline-flex; gap:6px; align-items:center;
  color:#edf1f8; font-size:.72rem; letter-spacing:0; font-weight:600;
  text-transform:none; white-space:nowrap;
}
.playback-panel .screen-status::before { background:#f1c875; box-shadow:0 0 0 3px #f1c87520; }
.playback-content { flex:1; display:grid; grid-template-columns:minmax(0,1fr) minmax(128px,.45fr); align-items:center; gap:16px; min-height:0; }
.playback-panel .screen-transport {
  display:grid; grid-template-columns:1.15fr .85fr; gap:11px; min-width:0;
}
.playback-panel .screen-transport button {
  width:100%; min-width:0; min-height:48px;
  border-radius:11px; font-size:.95rem; font-weight:850;
  box-shadow:0 5px 14px #0000003b;
}
.playback-panel #playSong {
  border:1px solid #ffd987; color:#20190e;
  background:linear-gradient(#ffe09a,#efb84a); box-shadow:0 3px 15px #edbd5340;
}
.playback-panel #playSong:hover:not(:disabled) { background:linear-gradient(#ffebae,#f5c96f); }
.playback-panel #playSong[data-playing="true"]::before { content:"Ⅱ"; }
.playback-panel #stopSong {
  border:1px solid #596579; color:#e7edf7;
  background:linear-gradient(#303b4f,#222b3b);
}
.playback-panel #stopSong::before { content:"■"; }
.playback-panel .tutor-actions {
  display:flex; flex-direction:column; justify-content:center; gap:4px;
  padding-left:16px; border-left:1px solid #3b475a; min-width:0;
}
.playback-panel #tutorMode {
  width:100%; min-height:48px; border:1px solid #e8c471;
  border-radius:12px; color:#f6e7bf; background:linear-gradient(#1d2a3b,#141d2b);
  font-size:.84rem; font-weight:850;
}
.playback-panel #tutorMode::before { content:"♜"; color:#f1c875; font-size:1rem; margin-right:9px; }
.playback-panel #tutorMode.active { color:#162032; background:linear-gradient(#ffe2a2,#ecc16d); }
.playback-panel #tutorMode.active::before { color:#162032; }
.playback-panel .tutor-status {
  min-width:0; max-width:100%; white-space:normal;
  font-size:.61rem; line-height:1.25; text-align:center; color:#b7c4d4;
}
.reference-metronome {
  position:relative; display:flex; flex-direction:column;
  padding:13px 12px 14px; border-radius:19px; min-height:0;
  border-color:#455064; overflow:hidden;
}
.reference-metronome::before {
  content:""; position:absolute; inset:5px; border:1.5px solid #e5b955;
  border-radius:15px; box-shadow:0 0 12px #d9a73452;
  pointer-events:none;
}
.metronome-heading {
  display:flex; align-items:center; justify-content:space-between; gap:5px;
  min-height:50px; padding:0 9px 10px; border-bottom:1px solid #2e394c;
}
.metronome-title {
  display:flex; align-items:center; gap:7px; color:#f4f5fb;
  font-weight:850; font-size:.82rem; text-transform:uppercase; letter-spacing:.07em;
}
.metronome-title > span { color:#f3d38b; font-size:1.45rem; }
.reference-metronome #metronomePlay {
  /* Keep the knob absolutely positioned: flex-direction cannot animate. */
  position:relative; display:block;
  min-width:81px; width:81px; height:35px; min-height:35px;
  padding:0; border:1px solid #576378; border-radius:99px;
  background-color:#293447; box-shadow:inset 0 1px #ffffff16;
  color:#d3dceb; font-size:0; cursor:pointer;
  transition:background-color .24s ease,border-color .24s ease,box-shadow .24s ease;
}
.reference-metronome #metronomePlay::before {
  content:"Off"; position:absolute; right:11px; top:50%;
  transform:translateY(-50%); margin:0; color:inherit;
  font-size:.79rem; font-weight:850; white-space:nowrap;
}
.reference-metronome #metronomePlay::after {
  content:""; position:absolute; top:4px; left:5px;
  display:block; width:24px; height:24px;
  background:#c4d0dd; border-radius:50%; box-shadow:0 1px 4px #0009;
  transform:translateX(0);
  transition:transform .24s cubic-bezier(.22,.72,.2,1),background-color .24s ease;
}
.reference-metronome #metronomePlay[aria-pressed="true"] {
  color:#1b1a18; border-color:#f7d58c;
  background-color:#f6c34f; box-shadow:inset 0 1px #fff1bc50;
}
.reference-metronome #metronomePlay[aria-pressed="true"]::before {
  content:"On"; left:11px; right:auto;
}
.reference-metronome #metronomePlay[aria-pressed="true"]::after {
  background:#fffaf0; transform:translateX(46px);
}
.reference-metronome .metronome-center {
  flex:1; min-height:88px; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:6px;
  padding:15px 4px 10px; text-align:center;
}
.metronome-time-label {
  color:#d6bb7a; font-size:.68rem; font-weight:800;
  letter-spacing:.16em; text-transform:uppercase;
}
.metronome-tempo-number {
  display:block; font-size:clamp(2.25rem,4.4vw,4.1rem); line-height:1.06;
  font-weight:900; letter-spacing:-.055em; color:#ffdb8d;
  font-variant-numeric:tabular-nums; text-shadow:0 0 24px #dcaa4c3e;
}
.metronome-bpm-unit { color:#bdc9d8; font-size:.91rem; letter-spacing:.07em; }
.reference-metronome .metronome-status {
  display:block; max-width:100%; min-width:0;
  font-size:.7rem; line-height:1.2; font-weight:700;
  letter-spacing:.05em; color:#c8d6e9;
  text-align:center; white-space:normal;
}
.reference-metronome .metronome-beats {
  flex:none; display:flex; justify-content:center; align-items:center;
  gap:7px; width:100%; min-height:68px; padding:3px 5px 8px;
}
.reference-metronome .metronome-beat {
  display:grid; place-items:center; flex:1 1 0; width:min(22%,56px);
  height:auto; max-width:56px; min-width:0; aspect-ratio:1;
  border:1px solid #3f4a5d; border-radius:50%;
  color:#aeb9cf; background:linear-gradient(#263247,#172134);
  font-size:clamp(.72rem,1.7vw,1.15rem); font-weight:800;
  box-shadow:0 3px 10px #0005;
  transition:transform .12s,box-shadow .12s,background .12s,border-color .12s;
}
.reference-metronome .metronome-beat.accent { color:#f1d79d; border-color:#9c8145; background:linear-gradient(#483c2d,#2b2a27); }
.reference-metronome .metronome-beat.active {
  border-color:#ffd981; color:#171c26;
  background:linear-gradient(#ffe3a2,#e9af43);
  box-shadow:0 0 20px #ffd0699c,inset 0 1px #fff7cf;
  transform:scale(1.07);
}
.reference-metronome .metronome-beat.accent.active { border-color:#fff3d7; background:linear-gradient(#fff2cb,#efc16a); }
.signature-readout {
  flex:none; display:flex; align-items:center; justify-content:space-between;
  gap:8px; min-height:62px; margin-top:12px; padding:10px 13px;
  border:1px solid #354156; border-radius:11px;
  background:linear-gradient(#242e41,#1a2435);
}
.signature-readout > span { font-size:.67rem; text-transform:uppercase; letter-spacing:.1em; color:#d5dce9; }
.signature-readout .meter-display {
  font-size:1.8rem; line-height:1; font-weight:900;
  color:#f8c963; font-variant-numeric:tabular-nums;
  grid-column:auto; grid-row:auto;
}
.studio .keyboard-frame {
  flex:none; margin:0; padding:0; width:100%;
  border-top:6px solid #080e18; overflow:hidden;
}
.studio .keyboard {
  height:clamp(148px,21vh,230px); margin:0; border-top:0;
  border-radius:0 0 6px 6px;
}
.studio .lower-bar {
  flex:none; min-height:33px; margin:0; padding:5px 22px;
  background:#0d1522; border-top:1px solid #253147;
  font-size:.71rem; color:#b5c2d5;
}
.studio .lower-bar .legend { display:flex; gap:6px; margin-left:auto; flex-wrap:wrap; justify-content:flex-end; }
.studio .lower-bar kbd { font-size:.67rem; }
@media (max-width:1180px) and (min-width:921px) {
  .studio-workspace { grid-template-columns:minmax(220px,22%) minmax(0,1fr) minmax(218px,22%); gap:8px; padding-inline:10px; }
  .utility-panel { padding-inline:9px; }
  .reference-metronome { padding-inline:7px; }
  .metronome-title { font-size:.7rem; }
  .playback-panel { padding-inline:10px; }
  .playback-content { gap:8px; }
  .playback-panel .tutor-actions { padding-left:9px; }
}
@media (max-width:920px) {
  html, body { height:auto; min-height:100%; overflow-x:hidden; overflow-y:auto; }
  .shell { height:auto; min-height:100dvh; }
  .studio { flex:none; overflow:visible; }
  .studio-workspace {
    flex:none; grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    grid-template-areas:"center center" "side metro";
    gap:10px; padding:10px;
  }
  .studio-main { grid-area:center; grid-template-rows:minmax(260px,40vh) auto; }
  .utility-panel { grid-area:side; overflow:visible; }
  .reference-metronome { grid-area:metro; min-height:300px; }
  .playback-panel { min-height:115px; }
  .studio .keyboard { height:clamp(125px,23vw,215px); }
}
@media (max-width:600px) {
  .shell > header { height:56px; margin:0; padding:0 13px; }
  .brand { font-size:.88rem; gap:7px; }
  .brand-mark { width:33px; height:33px; font-size:1.1rem; }
  .key-range-toggle { min-height:34px; padding:0 8px; font-size:.73rem; }
  .studio-workspace {
    grid-template-columns:minmax(0,1fr);
    grid-template-areas:"center" "side" "metro";
    padding:8px; gap:9px;
  }
  .studio-main { grid-template-rows:clamp(220px,38vh,325px) auto; }
  .studio-main .score-heading { font-size:.7rem; letter-spacing:.11em; margin-inline:5px; }
  .studio-main .score-heading #scoreStatus { max-width:50%; font-size:.68rem; }
  .studio-main .score-viewport { height:calc(100% - 33px); }
  .playback-panel { padding:9px; min-height:117px; }
  .playback-heading { font-size:.61rem; letter-spacing:.08em; }
  .playback-content { grid-template-columns:minmax(0,1fr) minmax(110px,.64fr); gap:7px; }
  .playback-panel .screen-transport { gap:6px; }
  .playback-panel .screen-transport button { min-height:44px; font-size:.75rem; padding:0 6px; }
  .playback-panel .tutor-actions { padding-left:7px; }
  .playback-panel #tutorMode { min-height:44px; font-size:.71rem; padding:0 4px; }
  .playback-panel #tutorMode::before { font-size:.8rem; margin-right:2px; }
  .utility-panel { padding:8px 13px; }
  .utility-group { padding:9px 3px; }
  .reference-metronome { min-height:258px; }
  .reference-metronome .metronome-center { min-height:74px; padding:12px 4px; }
  .reference-metronome .metronome-beat { max-width:52px; font-size:1rem; }
  .studio .keyboard { height:clamp(90px,29vw,160px); }
  .studio .lower-bar { padding:6px 8px; font-size:.61rem; }
  .studio .lower-bar .legend { gap:3px; }
  .studio .lower-bar kbd { font-size:.6rem; padding:1px 4px; }
}
@media (max-height:700px) and (min-width:921px) {
  .utility-group { padding-block:6px; }
  .utility-label, .utility-panel .song-label, .utility-panel .action-label { margin-bottom:5px; }
  .studio-main { grid-template-rows:minmax(0,1fr) 100px; }
  .playback-panel { padding:6px 10px; }
  .playback-panel .screen-transport button, .playback-panel #tutorMode { min-height:40px; }
  .reference-metronome .metronome-center { min-height:70px; padding:6px; }
  .studio .keyboard { height:clamp(105px,19vh,170px); }
}
@media (prefers-reduced-motion:reduce) {
  .reference-metronome .metronome-beat,
  .reference-metronome #metronomePlay,
  .reference-metronome #metronomePlay::after { transition:none; }
}
