/* Full viewport mode temporarily portals the SAME interactive keyboard to body.
   No additional key instances, audio engine, or recording callbacks exist. */
html:has(body.studio-piano-fullscreen-open),
body.studio-piano-fullscreen-open {
  overflow:hidden;
}
body > .instrument.studio-piano-fullscreen {
  position:fixed;
  inset:0;
  z-index:1000;
  display:flex;
  flex-direction:column;
  width:100vw;
  max-width:none;
  height:100vh;
  height:100dvh;
  max-height:none;
  min-width:0;
  min-height:0;
  margin:0!important;
  padding:clamp(12px,2.4vw,30px)!important;
  padding-bottom:max(14px,env(safe-area-inset-bottom))!important;
  border:0;
  border-radius:0;
  background:var(--bg);
  box-shadow:none;
  overflow:hidden;
}
body > .instrument.studio-piano-fullscreen > .row {
  display:flex;
  align-items:center;
  flex:none;
  gap:12px;
  min-height:54px;
  margin-bottom:12px;
  padding-bottom:12px;
  border-bottom:1px solid var(--glass-border);
}
body > .instrument.studio-piano-fullscreen > .row > strong {
  font-size:clamp(18px,2vw,24px);
  font-weight:750;
}
body > .instrument.studio-piano-fullscreen > .keys {
  flex:1 1 auto;
  width:100%;
  max-width:none;
  min-width:0;
  min-height:0;
  padding:0;
  overflow-x:auto;
  overflow-y:auto;
  direction:ltr;
  overscroll-behavior:contain;
}
body > .instrument.studio-piano-fullscreen .board {
  width:100%;
  max-width:none!important;
  min-width:max(100%,calc(var(--whites)*48px));
  height:clamp(140px,calc(100dvh - 205px),660px);
  margin:0;
}
body > .instrument.studio-piano-fullscreen .octave-rail {
  width:100%;
  min-width:max(100%,calc(var(--whites)*48px));
}
/* Override the later general mobile arrow rule only in Full size. */
body > .instrument.studio-piano-fullscreen > .piano-scroll-hint {
  display:none!important;
}
/* A maximized phone piano is a LANDSCAPE instrument, not a tall
   portrait panel. This layout applies whether the OS rotated natively or not. */
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  body > .instrument.studio-piano-fullscreen {
    padding:10px 12px max(10px,env(safe-area-inset-bottom))!important;
  }
  body > .instrument.studio-piano-fullscreen > .row {
    min-height:50px;
    margin-bottom:8px;
    padding-bottom:8px;
  }
  body > .instrument.studio-piano-fullscreen > .keys {
    display:flex;
    flex:1 1 auto;
    flex-direction:column;
    justify-content:flex-end;
    min-height:0;
    max-height:none;
    margin:0;
    overflow-x:auto;
    overflow-y:hidden;
  }
  body > .instrument.studio-piano-fullscreen .board {
    flex:0 0 auto;
    height:min(70dvh,calc(100dvh - 135px));
    max-height:none;
    min-width:max(100%,calc(var(--whites)*38px));
  }
  body > .instrument.studio-piano-fullscreen .octave-rail {
    flex:0 0 30px;
    min-width:max(100%,calc(var(--whites)*38px));
  }
}
/* When an OS/browser cannot switch orientation, rotate the SAME fullscreen
   keyboard surface, including toolbar and controls, across the long edge.
   Phone viewport portrait => visible piano looks/plays landscape. */
@media screen and (pointer:coarse) and (orientation:portrait) and (max-width:700px) {
  body > .instrument.studio-piano-fullscreen {
    inset:auto;
    top:0;
    left:100vw;
    right:auto;
    bottom:auto;
    width:100dvh;
    height:100vw;
    transform-origin:top left;
    transform:rotate(90deg);
    padding:10px 12px!important;
  }
  body > .instrument.studio-piano-fullscreen .board {
    height:min(70vw,calc(100vw - 135px));
    max-height:none;
  }
  body > .instrument.studio-piano-fullscreen > .keys {
    max-height:none;
  }
}
@media (prefers-reduced-motion:reduce) {
  :is(#app[data-page="studio"],body) .instrument .studio-piano-view-controls > button {
    transition:none;
  }
}

/* Fullscreen Etude Piano: show the ONE original Score above the keys,
   and move the ONE original Record action alongside piano view controls. */
body > .instrument.studio-piano-fullscreen > .studio-piano-score {
  display:block;
  flex:0 0 clamp(105px,25dvh,155px);
  width:100%;
  height:clamp(105px,25dvh,155px);
  min-height:0;
  margin:0 0 9px;
  padding:5px;
  border:1px solid var(--glass-border);
  border-radius:12px;
  background:var(--glass-elevated);
  overflow:hidden;
}
.instrument > .studio-piano-score[hidden] {
  display:none!important;
}
body > .instrument.studio-piano-fullscreen .studio-piano-score > .score {
  display:block;
  width:100%;
  height:100%;
  min-height:0;
  margin:0;
  padding:3px 7px;
  border:0;
  border-radius:8px;
  background:transparent;
  overflow:auto;
  direction:ltr;
  touch-action:pan-x pan-y;
  overscroll-behavior:contain;
}
body > .instrument.studio-piano-fullscreen .studio-piano-score > .score > svg {
  display:block;
  max-width:none!important;
  max-height:none;
  height:auto;
  pointer-events:none;
}
/* Keep the original Score meter picker in the landscape Piano toolbar.
   No duplicate select or separate meter state is created. */
.instrument .studio-piano-meter[hidden] {
  display:none!important;
}
body > .instrument.studio-piano-fullscreen .studio-piano-meter {
  position:relative;
  display:inline-flex;
  align-items:center;
  flex:0 1 auto;
  min-width:0;
  max-width:calc(100% - 175px);
}
body > .instrument.studio-piano-fullscreen .studio-piano-meter > .score-meter-control {
  display:inline-flex;
  flex-direction:row;
  flex-wrap:nowrap;
  align-items:center;
  gap:7px;
  min-width:0;
  margin:0;
  font-size:11px;
  font-weight:650;
}
body > .instrument.studio-piano-fullscreen .studio-piano-meter .score-meter-control > span {
  color:var(--muted);
  font-size:11px;
  white-space:nowrap;
}
body > .instrument.studio-piano-fullscreen .studio-piano-meter .score-meter-control > select {
  flex:0 1 146px;
  width:146px;
  min-width:98px;
  max-width:100%;
  height:36px;
  min-height:36px;
  margin:0;
  padding:0 9px;
  border:1px solid var(--glass-border);
  border-radius:10px;
  background:var(--dropdown-control-surface);
  color:var(--ink);
  box-shadow:none;
  font-size:12px;
  font-weight:650;
}

body > .instrument.studio-piano-fullscreen .studio-piano-meter > .score-meter-status[hidden] {
  display:none!important;
}
body > .instrument.studio-piano-fullscreen .studio-piano-meter > .score-meter-status:not([hidden]) {
  position:absolute;
  z-index:2;
  top:calc(100% + 7px);
  inset-inline-start:0;
  width:min(310px,70vw);
  margin:0;
  padding:8px 10px;
  border:1px solid var(--glass-border);
  border-radius:10px;
  background:var(--panel);
  color:var(--ink);
  box-shadow:var(--glass-soft-shadow);
  font-size:11px;
  line-height:1.45;
}
/* Fullscreen piano: the original Record is next to its live status.
   Its colors and states are shared with Score transport in visual-system.css. */
body > .instrument.studio-piano-fullscreen > .row > .score-record {
  display:inline-grid;
  place-items:center;
  flex:0 0 44px;
  width:44px;
  min-width:44px;
  height:44px;
  min-height:44px;
  padding:0;
  margin:0;
}

body > .instrument.studio-piano-fullscreen .studio-piano-view-controls > .studio-piano-toggle {
  display:none!important;
}
body > .instrument.studio-piano-fullscreen .studio-piano-view-controls > .studio-piano-fullscreen-toggle {
  display:inline-grid;
  flex-basis:44px;
  width:44px;
  min-width:44px;
  height:44px;
  min-height:44px;
  border-color:var(--glass-border);
  background:var(--glass-control);
  color:var(--ink);
}
/* The read-only notation strip gets the space previously given to extra-tall
   keys. The horizontally scrolled piano itself remains the original one. */
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  body > .instrument.studio-piano-fullscreen > .studio-piano-score {
    flex-basis:clamp(96px,27dvh,132px);
    height:clamp(96px,27dvh,132px);
  }
  body > .instrument.studio-piano-fullscreen .board {
    height:clamp(112px,calc(100dvh - 238px),400px);
    max-height:none;
  }
}
@media screen and (pointer:coarse) and (orientation:portrait) and (max-width:700px) {
  body > .instrument.studio-piano-fullscreen > .studio-piano-score {
    flex-basis:clamp(96px,27vw,132px);
    height:clamp(96px,27vw,132px);
  }
  body > .instrument.studio-piano-fullscreen .board {
    height:clamp(112px,calc(100vw - 238px),400px);
    max-height:none;
  }
}


/* Mobile-only Studio Score fullscreen: use the canonical Score and the SAME
   tool/transport/value/timeline controls, moved above backdrop-filter ancestors.
   Desktop layout and editor functionality stay unchanged. */
#app[data-page="studio"] .studio-score-fullscreen-header {
  display:none;
}
#app[data-page="studio"] .studio-score-mobile-title {
  display:none;
}
/* Keep the Pen glyph out of the normal mobile picker. */
#app[data-page="studio"] .score-pen-length > .studio-mobile-select-trigger > svg {
  display:none;
}
#app[data-page="studio"] .studio-score-fullscreen-header[hidden] {
  display:none!important;
}
#app[data-page="studio"] .studio-score-surface > .score[hidden] {
  display:none!important;
}
/* Timeline occupies the original staff slot, not a second block below it. */
#app[data-page="studio"] .studio-score-surface > .score-free-timeline:not([hidden]) {
  margin-block:12px;
}
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  #app[data-page="studio"] .studio-score-fullscreen-header {
    display:flex;
    justify-content:flex-end;
    align-items:center;
    min-height:36px;
    margin:0 0 8px;
  }
  #app[data-page="studio"] .studio-score-fullscreen-toggle {
    display:inline-grid;
    place-items:center;
    flex:none;
    width:36px;
    min-width:36px;
    height:36px;
    min-height:36px;
    margin:0;
    padding:0;
    border:1px solid var(--glass-border);
    border-radius:11px;
    background:var(--glass-control);
    color:var(--ink);
    box-shadow:none;
    cursor:pointer;
  }
  #app[data-page="studio"] .studio-score-fullscreen-toggle svg {
    display:block;
    width:19px;
    height:19px;
  }
  #app[data-page="studio"] .studio-score-fullscreen-toggle:hover,
  #app[data-page="studio"] .studio-score-fullscreen-toggle[aria-pressed="true"] {
    border-color:color-mix(in srgb,var(--accent) 38%,var(--glass-border));
    background:color-mix(in srgb,var(--accent) 9%,var(--glass-control));
    color:var(--accent);
  }
  
  html:has(body.studio-score-fullscreen-open),
  body.studio-score-fullscreen-open {
    overflow:hidden;
  }
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen {
    position:fixed;
    inset:0;
    z-index:1100;
    display:flex;
    flex-direction:column;
    gap:8px;
    width:100vw;
    max-width:none;
    min-width:0;
    height:100dvh;
    max-height:none;
    min-height:0;
    margin:0!important;
    padding:10px 12px max(10px,env(safe-area-inset-bottom))!important;
    border:0;
    border-radius:0;
    background:var(--bg);
    box-shadow:none;
    overflow:hidden;
    -webkit-backdrop-filter:none;
    backdrop-filter:none;
  }
  /* The Exit button joins the toolbar while fullscreen; do not reserve
     a second empty header row above the Score. */
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen > .studio-score-fullscreen-header {
    display:none!important;
  }
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen > .score-heading,
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen > .signature-editor-controls {
    display:none!important;
  }
  /* Two groups, one row: the LEFT cluster can scroll on narrow phones,
     while Play/Pause/Exit stay physically pinned on the RIGHT. */
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen > .score-actions {
    display:flex!important;
    flex:none;
    flex-wrap:nowrap;
    direction:ltr;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    width:100%;
    min-width:0;
    min-height:38px;
    margin:0!important;
    padding:0;
    overflow:hidden;
  }
  #app[data-page="studio"] .studio-score-fullscreen > .score-actions > :not(.studio-score-toolbar-left):not(.studio-score-toolbar-right),
  #app[data-page="studio"] .studio-score-fullscreen .score-transport-actions > :not(.score-transport-button) {
    display:none!important;
  }
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen > .score-actions > .studio-score-toolbar-left {
    display:flex;
    flex:1 1 auto;
    align-items:center;
    justify-content:flex-start;
    gap:5px;
    min-width:0;
    min-height:38px;
    padding:0;
    overflow-x:auto;
    overflow-y:hidden;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-inline:contain;
  }
  #app[data-page="studio"] .studio-score-toolbar-left::-webkit-scrollbar {
    display:none;
  }
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen > .score-actions > .studio-score-toolbar-right {
    display:flex;
    flex:0 0 auto;
    align-items:center;
    justify-content:flex-end;
    gap:6px;
    min-height:38px;
    margin-left:auto;
    padding:0;
    direction:ltr;
  }
  #app[data-page="studio"] .studio-score-fullscreen > .score-actions > .studio-score-toolbar-left > .score-tool-button,
  #app[data-page="studio"] .studio-score-fullscreen > .score-actions > .studio-score-toolbar-right .score-transport-button {
    display:inline-grid;
    place-items:center;
    flex:0 0 38px;
    width:38px;
    min-width:38px;
    height:38px;
    min-height:38px;
    margin:0;
    padding:7px;
    border-radius:10px;
  }
  #app[data-page="studio"] .studio-score-fullscreen > .score-actions > .studio-score-toolbar-right > .score-transport-actions {
    display:flex!important;
    flex:0 0 auto;
    align-items:center;
    gap:6px;
    width:auto;
    min-width:0;
    margin:0;
    padding:0;
    direction:ltr;
  }
  #app[data-page="studio"] .studio-score-fullscreen > .score-actions svg {
    width:19px;
    height:19px;
  }
  #app[data-page="studio"] .studio-score-fullscreen > .score-actions > .studio-score-toolbar-right > .studio-score-fullscreen-toggle {
    display:inline-grid;
    place-items:center;
    flex:0 0 38px;
    width:38px;
    min-width:38px;
    height:38px;
    min-height:38px;
    margin:0;
    padding:8px;
    border-radius:10px;
  }
  #app[data-page="studio"] .studio-score-fullscreen > .score,
  #app[data-page="studio"] .studio-score-fullscreen > .score-free-timeline:not([hidden]) {
    display:block;
    flex:1 1 auto;
    width:100%;
    max-width:100%;
    min-width:0;
    min-height:0;
    margin:0!important;
    padding:8px;
    border:1px solid var(--glass-border);
    border-radius:12px;
    background:var(--glass-elevated);
    overflow:auto;
    overscroll-behavior:contain;
    touch-action:pan-x pan-y;
  }
  /* Do not stretch the blank staff background to fill the screen.
     Each original engraved SVG row is 165px high; let those rows define
     the Score's intrinsic height. If several rows exceed the viewport,
     flex-shrink and overflow:auto preserve scrolling instead. */
  #app[data-page="studio"] .studio-score-fullscreen > .score:not([hidden]) {
    flex:0 1 auto;
    height:auto;
  }
  #app[data-page="studio"] .studio-score-fullscreen > .score[data-tool="range"] {
    touch-action:none;
  }
  /* The original Score settings row has no fullscreen controls after
     they are moved to the toolbar; it must consume zero vertical space. */
  #app[data-page="studio"] .studio-score-fullscreen > .score-below-actions {
    display:none!important;
  }
  #app[data-page="studio"] .studio-score-fullscreen > .score-actions > .studio-score-toolbar-left > .score-pen-length {
    display:flex;
    flex:0 0 136px;
    flex-direction:row;
    align-items:center;
    width:136px;
    min-width:136px;
    max-width:136px;
    height:38px;
    margin:0;
    padding:0;
    border:0;
    border-radius:0;
    background:transparent;
    box-shadow:none;
  }
  #app[data-page="studio"] .studio-score-fullscreen .studio-score-toolbar-left > .score-pen-length > span {
    display:none!important;
  }
  #app[data-page="studio"] .studio-score-fullscreen .studio-score-toolbar-left > .score-pen-length > .studio-native-music-select {
    display:none!important;
  }
  #app[data-page="studio"] .studio-score-fullscreen .score-pen-length > .studio-mobile-select-trigger {
    display:flex;
    align-items:center;
    flex:1 1 auto;
    gap:7px;
    width:100%;
    min-width:0;
    min-height:38px;
    height:38px;
    margin:0;
    padding:6px 9px;
    border:1px solid var(--glass-border);
    border-radius:10px;
    background:var(--dropdown-control-surface);
    color:var(--ink);
    box-shadow:none;
    font-size:12px;
  }
  #app[data-page="studio"] .studio-score-fullscreen .score-pen-length > .studio-mobile-select-trigger > svg {
    display:block;
    flex:none;
    width:17px;
    height:17px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
  }
  #app[data-page="studio"] .studio-score-fullscreen > .score-actions > .studio-score-toolbar-left > .score-free-timeline-toggle:not([hidden]) {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
    min-height:38px;
    height:38px;
    margin:0;
    padding:6px 9px;
    border-radius:10px;
    white-space:nowrap;
    font-size:12px;
  }
  #app[data-page="studio"] .studio-score-fullscreen .score-free-timeline-toggle svg {
    width:17px;
    height:17px;
  }
  #app[data-page="studio"] .studio-score-fullscreen .free-timeline-scroll {
    height:calc(100% - 62px);
    min-height:70px;
  }
}
/* Portrait fallback intentionally stays unrotated: Score engraving and
   pointer editing use real viewport coordinates. Forcing a CSS 90deg turn
   would display notes horizontally but misplace Pen/Eraser/seek gestures.
   Native/browser orientation lock still gives true landscape when allowed. */
@media screen and (pointer:coarse) and (orientation:portrait) and (max-width:700px) {
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen {
    padding:10px 10px max(10px,env(safe-area-inset-bottom))!important;
  }
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen > .score-actions {
    flex-wrap:nowrap;
  }
  #app[data-page="studio"] .studio-score-fullscreen .studio-score-toolbar-left > .score-pen-length {
    flex-basis:116px;
    width:116px;
    min-width:116px;
    max-width:116px;
  }
  #app[data-page="studio"] .studio-score-fullscreen .studio-score-toolbar-left > .score-tool-button {
    flex-basis:34px;
    width:34px;
    min-width:34px;
  }
  #app[data-page="studio"] .studio-score-fullscreen > .score-actions > .studio-score-toolbar-right {
    gap:4px;
  }
}


/* Mobile Studio Score: collapsible surface and uniform icon-led settings.
   The fullsize toolbar and desktop settings are intentionally untouched. */
#app[data-page="studio"] .studio-score-collapse-toggle {
  display:none;
}
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .studio-score-fullscreen-header {
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:6px;
  }
  #app[data-page="studio"] .studio-score-fullscreen-header > .studio-score-mobile-title {
    display:block;
    margin-inline-end:auto;
    color:var(--ink);
    font-size:15px;
    font-weight:700;
    line-height:1.4;
  }
  #app[data-page="studio"] .studio-score-collapse-toggle {
    display:inline-grid;
    place-items:center;
    flex:none;
    width:36px;
    min-width:36px;
    height:36px;
    min-height:36px;
    margin:0;
    padding:0;
    border:1px solid var(--glass-border);
    border-radius:11px;
    background:var(--glass-control);
    color:var(--ink);
    box-shadow:none;
  }
  #app[data-page="studio"] .studio-score-collapse-toggle svg {
    width:19px;
    height:19px;
    display:block;
    transition:transform 160ms ease;
  }
  #app[data-page="studio"] .studio-score-collapse-toggle[aria-expanded="true"] svg {
    transform:rotate(180deg);
  }
  #app[data-page="studio"] .studio-score-collapse-toggle:hover,
  #app[data-page="studio"] .studio-score-collapse-toggle:focus-visible {
    
    color:var(--accent);
  }
  
  #app[data-page="studio"] .studio-score-surface.studio-score-collapsed:not(.studio-score-fullscreen) > :not(.studio-score-fullscreen-header) {
    display:none!important;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-collapsed:not(.studio-score-fullscreen) {
    padding-bottom:10px;
  }

  /* Two orderly rows: Tempo | Time signature, then Pen value | Measures
     (or Timeline in Free). No extra caption rows or label text. */
  #app[data-page="studio"]:not(:has(> .shelves)) .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    align-items:stretch;
    min-width:0;
    width:100%;
    margin:0;
    padding:10px 0 0;
    border:0;
    border-top:1px solid var(--glass-border);
    background:transparent;
    box-shadow:none;
    direction:ltr;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-below-actions > .score-time-controls {
    display:grid;
    grid-column:1/-1;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    align-items:stretch;
    min-width:0;
    width:100%;
    margin:0;
    padding:0;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-time-controls > .score-tempo,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-time-controls > .score-meter-control,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-below-actions > .score-pen-length,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-below-actions > .score-measure-count,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-below-actions > .score-free-timeline-toggle:not([hidden]) {
    display:flex;
    flex-direction:row;
    flex-wrap:nowrap;
    align-items:center;
    justify-content:flex-start;
    gap:7px;
    min-width:0;
    max-width:none;
    width:100%;
    height:48px;
    min-height:48px;
    margin:0;
    padding:0 10px;
    border:1px solid var(--glass-border);
    border-radius:12px;
    background:var(--dropdown-control-surface);
    color:var(--ink);
    box-shadow:none;
    font-size:14px;
    font-weight:600;
  }
  /* The label is still in the DOM for the common picker dialog title;
     all icon-only controls keep their explicit aria-labels. */
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-tempo-label,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-meter-control > span,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-pen-length > span,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-measure-count > span,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle > span {
    display:none!important;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) :is(.score-tempo,.score-measure-count) > svg {
    display:block;
    flex:none;
    width:20px;
    height:20px;
    color:var(--muted);
    fill:none;
    stroke:currentColor;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-tempo > .score-tempo-number,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-measure-count > input {
    display:block;
    flex:1 1 auto;
    width:100%;
    min-width:0;
    max-width:none;
    height:44px;
    min-height:44px;
    margin:0;
    padding:0 2px;
    border:0;
    border-radius:0;
    outline-offset:-3px;
    background:transparent;
    box-shadow:none;
    color:var(--ink);
    text-align:center;
    font-size:16px;
    font-weight:700;
    font-variant-numeric:tabular-nums;
    appearance:textfield;
    -moz-appearance:textfield;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-tempo > .score-tempo-unit {
    display:block;
    flex:none;
    min-height:0;
    height:auto;
    padding:0;
    border:0;
    border-radius:0;
    background:transparent;
    color:var(--muted);
    font-size:10px;
    font-weight:700;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-meter-control > .studio-native-music-select,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-pen-length > .studio-native-music-select {
    display:none!important;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-meter-control > .studio-mobile-select-trigger,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-pen-length > .studio-mobile-select-trigger {
    display:flex;
    flex:1 1 auto;
    flex-direction:row;
    align-items:center;
    justify-content:flex-start;
    gap:8px;
    min-width:0;
    width:100%;
    height:46px;
    min-height:46px;
    margin:0;
    padding:0;
    border:0;
    border-radius:0;
    outline-offset:2px;
    background:transparent;
    box-shadow:none;
    color:var(--ink);
    text-align:start;
    font-size:14px;
    font-weight:600;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) :is(.score-meter-control,.score-pen-length) > .studio-mobile-select-trigger > svg {
    display:block;
    flex:none;
    width:20px;
    height:20px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    color:var(--muted);
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .studio-mobile-select-value {
    flex:1 1 auto;
    min-width:0;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-meter-control > .studio-mobile-select-trigger:disabled,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-pen-length > .studio-mobile-select-trigger:disabled {
    opacity:.55;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle:not([hidden]) {
    justify-content:center;
    padding:0 12px;
    cursor:pointer;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle svg {
    width:20px;
    height:20px;
    fill:none;
    stroke:currentColor;
    color:var(--muted);
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle.active {
    border-color:color-mix(in srgb,var(--accent) 45%,var(--glass-border));
    background:color-mix(in srgb,var(--accent) 10%,var(--panel));
    color:var(--accent);
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle.active svg {
    color:var(--accent);
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-below-actions > .score-meter-status:not([hidden]) {
    grid-column:1/-1;
    margin:0;
  }
}
/* Keep the same meter selector native (no duplicate custom popup) in the
   fullscreen Piano, where it is portaled outside #app and has its own UI. */
body > .instrument.studio-piano-fullscreen .score-meter-control > .studio-mobile-select-trigger {
  display:none!important;
}


/* Studio Score settings dock — one responsive layout shared by desktop and
   phone. Keep native inputs and the existing mobile picker implementation. */
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
  display:grid;
  grid-template-columns:minmax(110px, 140px) minmax(150px, 1.35fr) minmax(130px, 1fr) auto;
  align-items:stretch;
  gap:10px;
  width:100%;
  margin:12px 0 4px;
  padding:12px;
  border:1px solid var(--glass-border);
  border-radius:14px;
  background:color-mix(in srgb,var(--panel) 68%,var(--glass-surface));
  box-shadow:none;
  direction:ltr;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-below-actions > .score-time-controls {
  display:contents;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) :is(.score-tempo,.score-meter-control,.score-pen-length,.score-measure-count) {
  position:relative;
  display:flex;
  flex-direction:row;
  flex-wrap:nowrap;
  align-items:center;
  justify-content:stretch;
  gap:6px;
  min-width:0;
  width:100%;
  height:44px;
  min-height:44px;
  margin:0;
  padding:0 10px;
  border:1px solid var(--glass-border);
  border-radius:11px;
  background:var(--dropdown-control-surface);
  box-shadow:none;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) :is(.score-tempo-label,.score-meter-control > span,.score-pen-length > span,.score-measure-count > span) {
  display:none!important;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) :is(.score-tempo,.score-measure-count) > svg,
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-setting-inline-icon {
  position:static;
  display:block;
  flex:0 0 18px;
  width:18px;
  height:18px;
  color:var(--muted);
  fill:none;
  stroke:currentColor;
  pointer-events:none;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-tempo-number {
  flex:1 1 auto;
  grid-column:auto;
  grid-row:auto;
  display:block;
  min-width:0;
  width:100%;
  height:40px;
  min-height:40px;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  color:var(--ink);
  text-align:center;
  font-size:15px;
  font-weight:700;
  font-variant-numeric:tabular-nums;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-tempo-unit {
  display:block;
  flex:0 0 auto;
  grid-column:auto;
  grid-row:auto;
  min-height:0;
  height:auto;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:var(--muted);
  font-size:10px;
  font-weight:700;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) :is(.score-meter-control,.score-pen-length) > select {
  flex:1 1 auto;
  min-width:0;
  width:100%;
  max-width:none;
  height:42px;
  min-height:42px;
  margin:0;
  padding:0 4px;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  color:var(--ink);
  font-size:13px;
  font-weight:600;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-measure-count > input {
  flex:1 1 auto;
  min-width:0;
  width:100%;
  height:40px;
  min-height:40px;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  text-align:center;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle:not([hidden]) {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  align-self:stretch;
  gap:8px;
  width:100%;
  min-width:106px;
  height:44px;
  min-height:44px;
  margin:0;
  padding:0 12px;
  border:1px solid var(--glass-border);
  border-radius:11px;
  background:var(--dropdown-control-surface);
  box-shadow:none;
  color:var(--ink);
  font-size:13px;
  font-weight:600;
  white-space:nowrap;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle > span {
  display:inline!important;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle svg {
  width:18px;
  height:18px;
  flex:none;
  color:var(--muted);
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle.active {
  border-color:color-mix(in srgb,var(--accent) 45%,var(--glass-border));
  background:color-mix(in srgb,var(--accent) 10%,var(--panel));
  color:var(--accent);
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle.active svg {
  color:var(--accent);
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-below-actions > .score-meter-status:not([hidden]) {
  grid-column:1/-1;
  margin:0;
}

@media screen and (max-width:900px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    margin:10px 0 4px;
    padding:10px;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle:not([hidden]) {
    min-width:0;
  }
}
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
    border:0;
    border-top:1px solid var(--glass-border);
    border-radius:0;
    background:transparent;
    padding:10px 0 0;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) :is(.score-meter-control,.score-pen-length) > .studio-native-music-select {
    display:none!important;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) :is(.score-meter-control,.score-pen-length) > .studio-mobile-select-trigger {
    display:flex;
    flex:1 1 auto;
    align-items:center;
    justify-content:flex-start;
    gap:6px;
    min-width:0;
    width:100%;
    height:42px;
    min-height:42px;
    margin:0;
    padding:0;
    border:0;
    border-radius:0;
    background:transparent;
    box-shadow:none;
    color:var(--ink);
    text-align:start;
    font-size:13px;
    font-weight:600;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) :is(.score-meter-control,.score-pen-length) > .studio-mobile-select-trigger > svg {
    display:none;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .studio-mobile-select-value {
    flex:1 1 auto;
    min-width:0;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-free-timeline-toggle > span {
    display:inline!important;
    overflow:hidden;
    text-overflow:ellipsis;
  }
}
@media screen and (max-width:355px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
    grid-template-columns:minmax(0,1fr);
  }
}


/* Pen duration belongs to the Pen tool, not to a second Score setting.
   One floating palette is shared by desktop, mobile and fullscreen modes. */
#app[data-page="studio"] .score-tool-button[data-score-tool="pen"] {
  position:relative;
}
#app[data-page="studio"] .score-tool-button[data-score-tool="pen"] .score-pen-current-value {
  position:absolute;
  right:1px;
  bottom:0;
  display:grid;
  place-items:center;
  width:17px;
  height:19px;
  padding:1px;
  border-radius:5px;
  background:var(--dropdown-control-surface);
  color:var(--accent);
  pointer-events:none;
}
#app[data-page="studio"] .score-tool-button[data-score-tool="pen"] .score-pen-current-value svg {
  display:block;
  width:13px;
  height:17px;
  fill:none;
  stroke:none;
}
/* The palette occupies its own slot BEFORE the staff, not an overlay.
   This keeps the writing area uncovered even near the top of the viewport. */
#app[data-page="studio"] .studio-score-surface > .score-note-palette {
  position:relative;
  z-index:1;
  display:block;
  flex:0 0 auto;
  width:min(320px,100%);
  max-width:100%;
  margin:8px auto 0;
  padding:12px;
  border:1px solid var(--glass-border);
  border-radius:17px;
  background:var(--dropdown-menu-surface);
  color:var(--ink);
  box-shadow:0 18px 46px rgb(0 0 0 / 20%),
    inset 0 1px 0 color-mix(in srgb,white 14%,transparent);
  direction:ltr;
}
.score-note-palette[hidden] {
  display:none!important;
}
.score-note-palette-heading {
  margin:0 2px 10px;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
  line-height:1.5;
  text-align:start;
  direction:rtl;
}
html[lang="en"] .score-note-palette-heading {
  direction:ltr;
}
.score-note-palette-grid {
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:6px;
}
.score-note-palette-choice {
  display:grid;
  place-items:center;
  width:100%;
  min-width:0;
  height:58px;
  min-height:58px;
  margin:0;
  padding:4px;
  border:1px solid var(--glass-border);
  border-radius:11px;
  background:var(--glass-control);
  color:var(--ink);
  box-shadow:none;
  cursor:pointer;
  touch-action:manipulation;
  transition:background 140ms ease,border-color 140ms ease;
}
.score-note-palette-choice svg {
  display:block;
  width:29px;
  height:43px;
  overflow:visible;
  fill:none;
  stroke:none;
  pointer-events:none;
}
.score-note-palette-choice.active {
  border-color:var(--accent);
  background:color-mix(in srgb,var(--accent) 13%,var(--panel));
  color:var(--accent);
}
#app[data-page="studio"] .score[data-tool="accidental"] [data-score-note] {
  cursor: crosshair;
  touch-action: manipulation;
}
.score-accidental-palette .score-note-palette-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.score-accidental-palette .score-note-palette-heading button,
.score-accidental-choice > button:last-child {
  width: 100%;
  min-height: 28px;
  padding: 2px;
  font-size: 12px;
}
.score-accidental-palette .score-note-palette-heading button {
  width: auto;
  padding-inline: 8px;
}
.score-accidental-palette .score-note-palette-heading button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.score-accidental-choice {
  display: grid;
  flex: 1 1 0;
  min-width: 0;
  gap: 4px;
}
.score-accidental-choice > button:last-child svg {
  width: 13px;
  height: 13px;
  vertical-align: middle;
}
.score-accidental-palette .score-accidental-choice .score-note-palette-choice {
  height: 35px;
  min-height: 35px;
  font-size: 24px;
  line-height: 1;
}
.score-accidental-palette .score-accidental-choice .score-note-palette-choice svg {
  width: 18px;
  height: 25px;
}
.score-accidental-dialog form {
  display: grid;
  gap: 14px;
}
.score-accidental-dialog form > label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.score-accidental-dialog .signature-tuner-actions {
  justify-content: flex-end;
}

@media (hover:hover) {
  .score-note-palette-choice:not(.active):hover {
    border-color:color-mix(in srgb,var(--accent) 52%,var(--glass-border));
    background:color-mix(in srgb,var(--accent) 8%,var(--glass-control));
  }
}
/* The canonical Score settings dock now has three entries:
   Tempo, Meter, and Measures (or Timeline in Free meter). */
@media screen and (min-width:901px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
    grid-template-columns:minmax(120px,150px) minmax(170px,1fr) minmax(110px,160px);
  }
}
@media screen and (max-width:900px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-below-actions > :is(.score-measure-count,.score-free-timeline-toggle:not([hidden])) {
    grid-column:1/-1;
  }
}
@media screen and (max-width:355px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
    grid-template-columns:minmax(0,1fr);
  }
}
/* The palette follows the Pen button even in fullscreen. The old, separate
   Pen-value control is not reintroduced into the condensed mobile toolbar. */

/* Keep the Score's upper border clearly below the open palette.
   The existing panel/score flex layout supplies room instead of overlapping. */
#app[data-page="studio"] .studio-score-surface > .score-note-palette:not([hidden]) ~ .score {
  margin-block-start:8px;
}
/* Compact horizontal selection for short landscape fullscreen viewports:
   preserve the same ten choices, without consuming the entire staff height. */
@media screen and (max-height:520px) and (orientation:landscape) {
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-note-palette {
    width:min(500px,100%);
    padding:9px 10px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-note-palette-grid {
    display:flex;
    gap:5px;
    overflow-x:auto;
    scrollbar-width:none;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-note-palette-grid::-webkit-scrollbar {
    display:none;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-note-palette-choice {
    flex:0 0 45px;
    height:48px;
    min-height:48px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-note-palette-choice svg {
    height:37px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-note-palette-heading {
    margin-bottom:4px;
  }
}

/* Etude Studio piano heading: icon-only in both embedded and fullscreen modes. */
:is(#app[data-page="studio"], body > .instrument.studio-piano-fullscreen)
  .studio-piano-title-icon {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  flex:none;
  color:var(--accent);
}
:is(#app[data-page="studio"], body > .instrument.studio-piano-fullscreen)
  .studio-piano-title-icon svg {
  display:block;
  width:26px;
  height:26px;
}

/* Full Size touch toolbar: retain the horizontal strip and give each
   note symbol its full visible height (overriding the older landscape rule). */
@media (pointer:coarse) {
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-actions,
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-actions > .studio-score-toolbar-left,
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-actions > .studio-score-toolbar-right {
    min-height:52px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-actions > .studio-score-toolbar-left {
    overflow:hidden;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .studio-score-toolbar-left > .score-note-palette {
    position:relative;
    z-index:auto;
    display:block;
    flex:1 1 0;
    width:auto;
    min-width:0;
    max-width:none;
    height:48px;
    margin:0;
    padding:3px 5px;
    border-radius:9px;
    box-shadow:none;
    overflow:hidden;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .studio-score-toolbar-left > .score-note-palette[hidden] {
    display:none!important;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-note-palette-heading {
    display:none;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-note-palette-grid {
    display:flex;
    flex-wrap:nowrap;
    gap:4px;
    height:100%;
    min-width:0;
    overflow-x:auto;
    overflow-y:hidden;
    touch-action:pan-x;
    overscroll-behavior-x:contain;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-note-palette-grid::-webkit-scrollbar {
    display:none;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-note-palette-choice {
    flex:0 0 41px;
    width:41px;
    min-width:41px;
    height:40px;
    min-height:40px;
    padding:2px;
    border-radius:8px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-note-palette-choice svg {
    width:27px;
    height:34px;
    flex:none;
  }
  /* The staff is scrollable in Pen mode; only the dedicated touch rectangle
     captures drawing gestures. The score notes cannot be inserted by taps. */
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score[data-tool="pen"],
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score[data-tool="pen"] > svg {
    touch-action:pan-x pan-y;
    overscroll-behavior:contain;
  }
  /* Native touch highlight / selection must not cover Score notes while
     Eraser is active. Empty staff space keeps its existing pan behavior. */
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score[data-tool="eraser"],
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score[data-tool="eraser"] svg,
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score[data-tool="eraser"] svg * {
    -webkit-tap-highlight-color:transparent;
    -webkit-touch-callout:none;
    -webkit-user-select:none;
    user-select:none;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score[data-tool="eraser"] [data-score-note] {
    touch-action:none;
  }
  /* A stationary flex sibling fills the remaining phone width/height.
     This is never part of the Score's scrollable SVG content. */
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-touch-pad {
    display:flex;
    flex:1 1 0;
    align-items:center;
    justify-content:center;
    width:100%;
    min-width:0;
    min-height:76px;
    margin:0;
    padding:12px;
    border:1px dashed color-mix(in srgb,var(--accent) 32%,var(--glass-border));
    border-radius:12px;
    background:color-mix(in srgb,var(--accent) 5%,var(--glass-elevated));
    color:var(--muted);
    text-align:center;
    font-size:12px;
    user-select:none;
    -webkit-user-select:none;
    -webkit-touch-callout:none;
    -webkit-tap-highlight-color:transparent;
    -webkit-user-drag:none;
    touch-action:none;
    overscroll-behavior:contain;
  }
}

/* Canonical in-app error presentation. Apply `goosh-error` only to real
   validation, generation, playback or data-loading failures; never to
   informational or in-progress messages. Uses the existing theme danger
   token for equivalent contrast in light and dark mode. */
.goosh-error {
  box-sizing:border-box;
  max-width:100%;
  padding:9px 12px;
  border:1px solid color-mix(in srgb,var(--danger) 55%,var(--glass-border)) !important;
  border-inline-start:4px solid var(--danger) !important;
  border-radius:9px;
  background:color-mix(in srgb,var(--danger) 11%,var(--panel)) !important;
  color:var(--danger) !important;
  font-weight:700 !important;
  line-height:1.55;
  box-shadow:0 3px 12px color-mix(in srgb,var(--danger) 10%,transparent);
}
.goosh-error[hidden],
.goosh-error:empty {
  display:none !important;
}


/* Score accidental palette — exactly the symbol sizing used in the Key Signature editor. */
#app[data-page="studio"] .score-accidental-palette .score-note-palette-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  gap: 6px;
}
#app[data-page="studio"] .score-accidental-palette .score-accidental-choice {
  display: grid;
  grid-template-rows: 42px 28px;
  align-content: start;
  gap: 5px;
  min-width: 0;
}
#app[data-page="studio"] .score-accidental-palette .score-accidental-choice .score-note-palette-choice {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  margin: 0;
  padding: 3px;
  border-radius: 10px;
  font-size: 25px;
  line-height: 1;
}
#app[data-page="studio"] .score-accidental-palette .score-accidental-choice > button:last-child {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  height: 28px;
  padding: 2px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.2;
}
#app[data-page="studio"] .score-accidental-palette .signature-mark-glyph {
  display: grid;
  place-items: center;
  width: 28px;
  height: 30px;
  margin: auto;
  line-height: 1;
  pointer-events: none;
}
#app[data-page="studio"] .score-accidental-palette .signature-mark-glyph .signature-western-symbol,
#app[data-page="studio"] .score-accidental-palette .signature-mark-glyph .signature-natural-symbol {
  display: grid;
  place-items: center;
  width: 24px;
  height: 28px;
  font-family: "Noto Music", "Bravura", "Segoe UI Symbol", serif;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}
#app[data-page="studio"] .score-accidental-palette .signature-mark-glyph .signature-natural-symbol {
  transform: translate(1px, -10px);
}
#app[data-page="studio"] .score-accidental-palette .signature-mark-glyph .signature-flat-symbol {
  transform: translateY(-7px);
}
#app[data-page="studio"] .score-accidental-palette .signature-mark-glyph .signature-sharp-symbol {
  transform: translateY(-7px);
}
#app[data-page="studio"] .score-accidental-palette .score-accidental-choice .score-note-palette-choice .signature-mark-glyph svg[data-persian-accidental] {
  display: block;
  flex: none;
  width: 18px;
  height: 22px;
  max-width: none;
  max-height: none;
  overflow: visible;
  pointer-events: none;
}
#app[data-page="studio"] .score-accidental-palette .signature-mark-glyph svg[data-persian-accidental="کرن"] {
  transform: translateY(2px);
}
#app[data-page="studio"] .score-accidental-palette .signature-mark-glyph svg[data-persian-accidental="سری"] {
  transform: translateY(1px);
}

/* Score pitch settings: one compact surface with the established signature tuner controls.
   Do not inherit the large, double-layer Key Signature modal shell. */
#app[data-page="studio"] dialog.studio-mobile-signature-dialog.score-accidental-dialog,
html:not(.dark) #app[data-page="studio"] dialog.studio-mobile-signature-dialog.score-accidental-dialog {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: min(376px, calc(100vw - 24px));
  min-width: 0;
  max-width: 376px;
  height: fit-content;
  min-height: 0;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: var(--glass-elevated);
  color: var(--ink);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
#app[data-page="studio"] dialog.score-accidental-dialog form.studio-mobile-signature-card,
html:not(.dark) #app[data-page="studio"] dialog.score-accidental-dialog form.studio-mobile-signature-card {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 15px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#app[data-page="studio"] dialog.score-accidental-dialog .studio-mobile-signature-header,
html:not(.dark) #app[data-page="studio"] dialog.score-accidental-dialog .studio-mobile-signature-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--glass-border);
  direction: inherit;
}
#app[data-page="studio"] .score-accidental-dialog-title {
  min-width: 0;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
#app[data-page="studio"] .score-accidental-dialog .studio-mobile-signature-close,
html:not(.dark) #app[data-page="studio"] .score-accidental-dialog .studio-mobile-signature-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-control);
  color: var(--ink);
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
  box-shadow: none;
}
#app[data-page="studio"] .score-accidental-tuner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "heading" "adjust" "scale";
  gap: 12px;
  min-width: 0;
}
#app[data-page="studio"] .score-accidental-tuner-heading {
  grid-area: heading;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 650;
}
#app[data-page="studio"] .score-accidental-tuner-value {
  color: var(--accent);
  font-size: .97rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
#app[data-page="studio"] .score-accidental-tuner .signature-tuner-adjust,
html:not(.dark) #app[data-page="studio"] .score-accidental-tuner .signature-tuner-adjust {
  grid-area: adjust;
  display: grid;
  grid-template-columns: 42px minmax(72px, 1fr) 42px;
  align-items: center;
  justify-self: center;
  gap: 8px;
  width: min(100%, 250px);
  max-width: 100%;
  min-width: 0;
  margin: 0;
}
#app[data-page="studio"] .score-accidental-tuner .signature-tuner-step {
  display: grid;
  place-items: center;
  min-height: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
  font-size: 19px;
}
#app[data-page="studio"] .score-accidental-tuner .signature-tuning-number {
  width: 100%;
  min-height: 42px;
  height: 42px;
  padding: 4px 8px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-control);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
#app[data-page="studio"] .score-accidental-tuner .signature-tuner-scale {
  grid-area: scale;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 8px 0 2px;
  /* The fill gradient and scale ticks are drawn left-to-right. */
  direction: ltr;
}
#app[data-page="studio"] .score-accidental-tuner .signature-tuner-adjust {
  /* Decrease on the left, increase on the right, as in Key Signature. */
  direction: ltr;
}
#app[data-page="studio"] .score-accidental-tuner .signature-tuning-slider {
  width: 100%;
  max-width: 100%;
}
#app[data-page="studio"] .score-accidental-tuner .signature-tuner-ticks {
  width: 100%;
}
#app[data-page="studio"] .score-accidental-dialog .signature-tuner-actions,
html:not(.dark) #app[data-page="studio"] .score-accidental-dialog .signature-tuner-actions {
  grid-area: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  justify-content: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 13px 0 0;
  border-top: 1px solid var(--glass-border);
}
#app[data-page="studio"] .score-accidental-dialog .signature-tuner-actions > button,
html:not(.dark) #app[data-page="studio"] .score-accidental-dialog .signature-tuner-actions > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: .83rem;
  font-weight: 650;
  line-height: 1.4;
  white-space: normal;
  box-shadow: none;
}
#app[data-page="studio"] .score-accidental-dialog .signature-tuner-actions .signature-editor-listen svg {
  display: block;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
}
#app[data-page="studio"] .score-accidental-dialog .signature-tuner-actions button.primary {
  background: var(--action-fill);
  color: var(--action-ink);
  border-color: transparent;
}
@media (max-width: 350px) {
  #app[data-page="studio"] dialog.score-accidental-dialog form.studio-mobile-signature-card {
    padding: 14px;
  }
  #app[data-page="studio"] .score-accidental-dialog .signature-tuner-actions > button {
    font-size: .76rem;
  }
}

/* Pen: independent note/rest values with a separate augmentation-dot control. */
.score-pen-section + .score-pen-section {
  margin-block-start:12px;
  padding-block-start:12px;
  border-top:1px solid var(--glass-border);
}
.score-pen-section-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-block-end:7px;
  font-size:12px;
  font-weight:700;
}
.score-pen-duration-grid { grid-template-columns:repeat(6,minmax(0,1fr)); }
.score-pen-dot {
  width:32px;
  min-width:32px;
  min-height:32px;
  padding:0;
  margin:0;
  font-size:26px;
  line-height:1;
}
.score-pen-dot.active {
  color:var(--accent);
  border-color:var(--accent);
  background:color-mix(in srgb,var(--accent) 13%,var(--panel));
}
html[lang="fa"] .score-pen-section-heading { direction:rtl; }
/* Score settings: compact meter value, no redundant fixed 4/4 symbol. */
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-meter-control > span:not(.studio-mobile-select-value) {
  display:block!important;
  flex:0 0 auto;
  font-size:11px;
  font-weight:600;
  color:var(--muted);
  white-space:nowrap;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-meter-control > select {
  width:auto;
  min-width:0;
  font-variant-numeric:tabular-nums;
}
@media screen and (min-width:901px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
    grid-template-columns:minmax(120px,150px) minmax(145px,190px) minmax(110px,150px);
  }
}
/* Keep the meter's normal border on focus; do not affect other controls. */
#app[data-page="studio"] .score-meter-control > :is(select,.studio-mobile-select-trigger):is(:focus,:focus-visible) {
  box-shadow:none;
}
/* Home uses three mobile destinations, all other routes use four.
   Desktop navigation and footer keep the shared original route buttons. */
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  body.home-screen > header > #nav {
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  body.home-screen > header > #nav > button:is([data-route="studio"],[data-route="practice"]),
  body:not(.home-screen) > header > #nav > button[data-route="account"] {
    display:none;
  }
}
/* Shared original Goosh loading mark: 1900ms wave, 220/210px rings and
   145px wordmark. CSS adapts the old native animation to the web runtime. */
dialog.goosh-loading-dialog[open] {
  position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;
  margin:0;padding:0;border:0;border-radius:0;box-shadow:none;
  background:transparent;display:grid;place-items:center;overflow:hidden;
}
dialog.goosh-loading-dialog::backdrop {background:rgba(232,239,243,.55)}
html.dark dialog.goosh-loading-dialog::backdrop {background:rgba(4,15,25,.55)}
.goosh-loading-mark {position:relative;width:min(320px,100%);height:260px;display:grid;place-items:center}
.goosh-loading-wave,.goosh-loading-ring {position:absolute;pointer-events:none;border-radius:50%}
.goosh-loading-wave {width:220px;height:220px;border:1px solid var(--accent);background:var(--accent);animation:goosh-loading-wave 1900ms cubic-bezier(.25,.46,.45,.94) infinite}
.goosh-loading-ring {width:210px;height:210px;border:1px solid var(--line);opacity:.3}
.goosh-loading-logo {position:relative;width:145px;height:58px;object-fit:contain}
.goosh-loading-logo-dark,html.dark .goosh-loading-logo-light {display:none}
html.dark .goosh-loading-logo-dark {display:block}
@keyframes goosh-loading-wave {
  0% {opacity:.015;transform:scale(.83)}
  45% {opacity:.065}
  100% {opacity:0;transform:scale(1.18)}
}
@media(prefers-reduced-motion:reduce) {.goosh-loading-wave {animation:none;opacity:.035}}
.goosh-error-dialog-heading {display:flex;align-items:center;justify-content:space-between;gap:12px}
.goosh-error-dialog-heading h2 {margin:0}
.goosh-error-dialog-close {flex:none;min-width:40px;min-height:40px;padding:0;font-size:24px;background:transparent}
.goosh-error-dialog > p {overflow-wrap:anywhere;white-space:pre-wrap}
#app[data-page="studio"] .score-edit-tools {display:contents}
#app[data-page="studio"] .score-edit-tools > button {display:inline-flex;align-items:center;justify-content:center;gap:8px}
#app[data-page="studio"] .score-edit-tools > button[hidden] {display:none!important}
#app[data-page="studio"] .score-actions .score-generate {display:none}
/* Both workflows share the piano and Record controls.
   The AI workflow additionally exposes Generate in the Score toolbar. */
#app[data-page="studio"] .studio-compose.studio-ai-mode .studio-compose-actions {display:none!important}
#app[data-page="studio"] .studio-score-surface.studio-ai-mode .score-actions .score-generate {
  display:inline-flex!important;align-items:center;justify-content:center;gap:6px;
  width:auto;min-width:0;min-height:44px;padding:6px 9px;white-space:nowrap;
  font-size:12px;font-weight:700;
  background:var(--standard-primary-fill);color:var(--standard-primary-ink);
  border-color:var(--accent);
}
#app[data-page="studio"] .studio-score-surface.studio-ai-mode .score-actions .score-generate:disabled {
  opacity:.5;cursor:not-allowed;box-shadow:none;
}
#app[data-page="studio"] .studio-score-surface.studio-ai-mode .score-actions .score-generate > svg {width:17px;height:17px;flex:none}
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  #app[data-page="studio"]:not(:has(> .shelves)) .studio-score-surface:not(.studio-score-fullscreen) > .score-actions {
    grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto;gap:7px;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-actions > .score-edit-tools {
    grid-row:2;grid-column:1/-1;display:flex;align-items:center;gap:6px;
    min-width:0;width:100%;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;
    scrollbar-color:var(--glass-border) transparent;overscroll-behavior-x:contain;
    padding:2px 0 5px;-webkit-overflow-scrolling:touch;
  }
  #app[data-page="studio"] .score-edit-tools > button {
    flex:0 0 auto;width:auto;min-width:44px;min-height:44px;margin:0;padding:7px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-ai-mode:not(.studio-score-fullscreen) > .score-actions > .score-transport-actions {
    grid-template-columns:repeat(4,44px) minmax(0,1fr);
  }
  #app[data-page="studio"] .studio-score-surface.studio-ai-mode:not(.studio-score-fullscreen) > .score-actions > .score-transport-actions:has(.score-metronome[hidden]) {
    grid-template-columns:repeat(3,44px) minmax(0,1fr);
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-actions > .studio-score-toolbar-left {
    overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:var(--glass-border) transparent;
  }
  #app[data-page="studio"] .studio-score-toolbar-left::-webkit-scrollbar,
  #app[data-page="studio"] .score-edit-tools::-webkit-scrollbar {display:block;height:3px}
  #app[data-page="studio"] .studio-score-toolbar-left::-webkit-scrollbar-thumb,
  #app[data-page="studio"] .score-edit-tools::-webkit-scrollbar-thumb {background:var(--glass-border);border-radius:4px}
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .studio-score-toolbar-left > .score-note-palette:not([hidden]) {
    flex:0 0 auto;min-width:250px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-ai-mode.studio-score-fullscreen .score-actions .score-generate {
    flex:0 0 auto;min-height:38px;
  }
}
/* Phone preview keeps playback and settings only; all notation tools are
   restored in the original full-size workspace without duplicating handlers. */
.studio-score-edit-label {display:none}
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-actions {
    grid-template-rows:auto;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-actions > .score-edit-tools,
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions > .score-free-timeline-toggle {
    display:none!important;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .studio-score-fullscreen-toggle {
    display:inline-flex;align-items:center;justify-content:center;gap:6px;
    width:auto;min-width:36px;min-height:36px;padding:0 10px;
    font-size:12px;font-weight:650;white-space:nowrap;
  }
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .studio-score-edit-label {display:inline}
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .studio-score-toolbar-left > :is(.score-tool-button,.score-wrap-button,.score-zoom-button):not([hidden]) {
    display:inline-flex;align-items:center;justify-content:center;
    flex:0 0 44px;width:44px;min-width:44px;height:44px;min-height:44px;
    padding:7px;margin:0;border-radius:10px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .studio-score-toolbar-left {
    overflow-x:auto;overflow-y:hidden;
    scrollbar-width:thin;scrollbar-color:var(--glass-border) transparent;
  }
}
/* Portrait fallback needs a full-width edit strip even when the named
   Generate action occupies most of the transport row. */
@media screen and (max-width:520px) and (orientation:portrait) {
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen > .score-actions {
    flex-wrap:wrap;
  }
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen > .score-actions > .studio-score-toolbar-left {
    order:2;flex:1 1 100%;width:100%;min-width:0;
  }
  #app[data-page="studio"] > .studio-score-surface.studio-score-fullscreen > .score-actions > .studio-score-toolbar-right {
    order:1;flex:1 1 100%;width:100%;justify-content:flex-end;
  }
}
/* In phone Full Size, both selection palettes sit above the staff. The
   note/rest grid stays separate from the scrolling edit toolbar. */
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > #score-note-palette {
    width:min(420px,100%);
    padding:9px 10px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > #score-note-palette .score-pen-duration-grid {
    display:grid;
    grid-template-columns:repeat(6,minmax(0,1fr));
    gap:5px;
    height:auto;
    overflow:visible;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > #score-note-palette .score-note-palette-choice {
    width:100%;
    min-width:0;
    height:44px;
    min-height:44px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-accidental-palette .score-note-palette-heading {
    display:flex;
  }
}
/* Compact phone palette glyphs, with equal cells for each accidental and
   its pitch control. Keep the touch targets independent of icon size. */
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > #score-note-palette {
    width:min(340px,100%);
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > #score-note-palette .score-note-palette-choice > svg {
    width:20px;
    height:25px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-accidental-palette {
    width:min(340px,100%);
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-accidental-palette .score-note-palette-grid {
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    align-items:stretch;
    gap:5px;
    height:auto;
    overflow:visible;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-accidental-choice {
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:44px 28px;
    justify-items:stretch;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-accidental-choice .score-note-palette-choice {
    display:grid;
    place-items:center;
    width:100%;
    min-width:0;
    height:44px;
    min-height:44px;
    padding:0;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-accidental-choice .signature-mark-glyph {
    display:grid;
    place-items:center;
    width:24px;
    height:24px;
    margin:0;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-accidental-choice .signature-mark-glyph :is(.signature-western-symbol,.signature-natural-symbol) {
    width:24px;
    height:24px;
    font-family:"DejaVu Sans","Segoe UI Symbol",sans-serif;
    font-size:20px;
    line-height:24px;
    text-align:center;
    transform:none;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen .score-accidental-choice .score-note-palette-choice .signature-mark-glyph svg[data-persian-accidental] {
    width:14px;
    height:18px;
    transform:none;
  }
}
/* Keep note selection and browsing on the staff, with touch drag reserved
   for the stationary move pad in the phone full-size workspace. */
@media (pointer:coarse) {
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score[data-tool="select"],
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score[data-tool="select"] > svg {
    touch-action:pan-x pan-y;
    overscroll-behavior:contain;
  }
}
/* Full-size phone palettes float above an unchanged staff. Keep the
   original panels, compact glyphs and their controls; block click-through. */
.score-palette-backdrop {display:none}
@media screen and (max-width:700px),
       screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-palette-backdrop:not([hidden]) {
    display:block;
    position:absolute;
    inset:0;
    z-index:1390;
    background:rgb(0 0 0 / 24%);
    touch-action:none;
    -webkit-tap-highlight-color:transparent;
  }
  #app[data-page="studio"] .studio-score-surface.studio-score-fullscreen > .score-note-palette:not([hidden]) {
    position:absolute;
    z-index:1391;
    inset:50% auto auto 50%;
    transform:translate(-50%,-50%);
    box-sizing:border-box;
    width:min(340px,calc(100% - 24px));
    max-width:calc(100% - 24px);
    max-height:calc(100% - 28px);
    margin:0;
    overflow-y:auto;
    overscroll-behavior:contain;
    touch-action:pan-y;
    box-shadow:0 18px 46px rgb(0 0 0 / 28%);
  }
}

/* Semantic informational text: shared by every viewport and theme.
   Keep errors, warnings, ordinary descriptions and disabled labels distinct.
   Existing explicit hint classes use the same token without layout changes. */
:is(.goosh-info,[data-tone="info"],.studio-compose-music-hint,.studio-ai-meter-hint,.studio-compose-description,.practice-method-hint,.practice-support-note,.learner-timer-help,.learner-live-hint):not(.goosh-error):not([data-tone="error"]) {
  color:var(--info) !important;
  font-weight:700 !important;
}

/* UI rule: every nonempty informational message starts with exactly one
   decorative circle-info icon, inheriting the semantic info color.
   Logical spacing places the icon correctly in both RTL and LTR. */
:is(.goosh-info,[data-tone="info"],.studio-compose-music-hint,.studio-ai-meter-hint,.studio-compose-description,.practice-method-hint,.practice-support-note,.learner-timer-help,.learner-live-hint):not(.goosh-error):not([data-tone="error"]):not(:empty):not([hidden])::before {
  content:"";
  display:inline-block;
  width:1em;
  height:1em;
  margin-inline-end:.42em;
  vertical-align:-.12em;
  background-color:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 11v5M12 7h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 11v5M12 7h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* The Score dock no longer contains a meter picker in either mode.
   Keep tempo and measure count / timeline compact, without a vacant column. */
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
  grid-template-columns:repeat(2,minmax(0,1fr));
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-below-actions > :is(.score-measure-count,.score-free-timeline-toggle:not([hidden])) {
  grid-column:auto;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]):not(:has(> :is(.score-measure-count,.score-free-timeline-toggle):not([hidden]))) {
  grid-template-columns:minmax(0,150px);
}
body > .instrument.studio-piano-fullscreen .studio-piano-meter:not(:has(.score-meter-status:not([hidden]))) {display:none!important}
@media screen and (min-width:901px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
    grid-template-columns:minmax(120px,150px) minmax(110px,150px);
  }
}
@media screen and (max-width:355px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {grid-template-columns:minmax(0,1fr)}
}

/* Studio workspace: lightweight lower controls and semantic tool groups. */
#app[data-page="studio"]:not(:has(> .shelves)) .studio-score-surface:not(.studio-score-fullscreen) > .score-below-actions:not([hidden]) {
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
  margin:12px 0 4px;
}
#app[data-page="studio"] .score-actions .score-ottava-actions {
  padding-inline:0;
  border-inline:0;
}
#app[data-page="studio"] .score-actions :is([data-score-tool="pen"],[data-score-tool="accidental"],.score-wrap-button,.score-reset-etude):not([hidden]) {
  position:relative;
  margin-inline-start:9px;
}
#app[data-page="studio"] .score-actions :is([data-score-tool="pen"],[data-score-tool="accidental"],.score-wrap-button,.score-reset-etude):not([hidden])::before {
  content:"";
  position:absolute;
  inset-inline-start:-10px;
  inset-block:8px;
  width:1px;
  background:var(--glass-border);
  pointer-events:none;
}
#app[data-page="studio"] .score-actions .score-tool-button.active:not([hidden]),
#app[data-page="studio"] .score-actions .score-wrap-button.active:not([hidden]) {
  border-color:var(--accent);
  color:var(--accent);
  background:color-mix(in srgb,var(--accent) 18%,var(--panel));
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 30%,transparent);
}
/* Distinguish selected notes from currently sounding notes without affecting
   the actual held-key/down state, pointer input or the piano sound engine. */
:is(#app[data-page="studio"],body > .instrument.studio-piano-fullscreen) .board button.score-pitch-selected {
  outline:3px solid #246699;
  outline-offset:-3px;
}
:is(#app[data-page="studio"],body > .instrument.studio-piano-fullscreen) .board button.black.score-pitch-selected {
  outline-color:#84C7F8;
}
:is(#app[data-page="studio"],body > .instrument.studio-piano-fullscreen) .board button.score-pitch-playing {
  background:linear-gradient(180deg,#94F7FB,#10AAB8);
  border-color:#00869B;
}
:is(#app[data-page="studio"],body > .instrument.studio-piano-fullscreen) .board button.score-pitch-playing .piano-key-note {
  color:#102333;
  text-shadow:none;
}

/* Record guidance occupies the existing piano heading, not another row. */
:is(#app[data-page="studio"] .instrument,body > .instrument.studio-piano-fullscreen) > .row > .studio-piano-record-hint {
  flex:1 1 0;
  min-width:0;
  margin:0;
  font-size:.82rem;
  line-height:1.5;
  text-align:start;
  white-space:normal;
  overflow-wrap:break-word;
}
:is(#app[data-page="studio"] .instrument,body > .instrument.studio-piano-fullscreen) > .row > .studio-piano-record-hint[hidden] {
  display:none!important;
}
@media screen and (max-width:700px) {
  :is(#app[data-page="studio"] .instrument,body > .instrument.studio-piano-fullscreen) > .row > .studio-piano-record-hint {
    font-size:.75rem;
  }
}

/* Keep Generate legible when the restored Record control shares a narrow row. */
@media screen and (max-width:420px) {
  #app[data-page="studio"] .studio-score-surface.studio-ai-mode:not(.studio-score-fullscreen) .score-transport-actions > .score-generate {
    white-space:normal;
    line-height:1.2;
    padding-inline:5px;
  }
  #app[data-page="studio"] .studio-score-surface.studio-ai-mode:not(.studio-score-fullscreen) .score-transport-actions > .score-generate > span {
    min-width:0;
    overflow-wrap:break-word;
  }
}

/* Live recording replaces the inline guidance in the same header slot. */
.studio-piano-record-hint.studio-piano-recording-status {
  color:var(--danger);
  font-weight:700;
}
.studio-piano-record-hint.studio-piano-recording-status::before {
  content:"";
  display:inline-block;
  width:.7em;
  height:.7em;
  margin-inline-end:.55em;
  border-radius:50%;
  background:currentColor;
  vertical-align:.03em;
  animation:studio-piano-record-indicator 1.5s ease-in-out infinite;
}
@keyframes studio-piano-record-indicator {
  0%,100% {opacity:1}
  50% {opacity:.45}
}
@media (prefers-reduced-motion:reduce) {
  .studio-piano-record-hint.studio-piano-recording-status::before {animation:none}
}

/* Keep the live keyboard stationary when wrapped notation grows. Only the
   recording staff scrolls; outside recording the original layout is retained. */
#app[data-page="studio"] .studio-score-surface > .score.score-recording-follow,
body > .instrument.studio-piano-fullscreen .studio-piano-score > .score.score-recording-follow {
  scroll-behavior:auto;
  overflow-anchor:none;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score.score-recording-wrap {
  max-height:clamp(180px,32dvh,330px);
  overflow:auto;
}
@media screen and (max-width:700px), screen and (pointer:coarse) and (orientation:landscape) and (max-height:520px) {
  #app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) > .score.score-recording-wrap {
    max-height:180px;
  }
}

/* Two-line label for the existing note selection / Select All tool. */
#app[data-page="studio"] .score-tool-button[data-score-tool="range"] .score-select-note-label {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:1px;
  direction:ltr;
  font-size:10px;
  font-weight:650;
  line-height:1.05;
  text-transform:none;
  white-space:nowrap;
  pointer-events:none;
}

/* Tempo retains its normal border while editing and never stretches when
   the timeline control is absent (including mobile's hidden timeline). */
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-tempo {
  max-width:150px;
}
#app[data-page="studio"] .studio-score-surface:not(.studio-score-fullscreen) .score-tempo-number:focus {
  border:0;
  box-shadow:none;
}
