:is(.mhfd-toggle,.mhfd-stand-toggle) {
  display:inline-flex; align-items:center; justify-content:center; min-height:44px;
  padding:.28rem .74rem; border:1px solid #749b8c; border-radius:.48rem;
  color:#195743; background:#eef5ed; font:650 .88rem/1.45 Tahoma,Arial,sans-serif; cursor:pointer;
}
:is(.mhfd-toggle,.mhfd-stand-toggle):focus-visible { outline:3px solid #9b722d; outline-offset:2px; }
:is(.mhfd-toggle,.mhfd-stand-toggle)[aria-pressed=true] { color:white; background:#225f4e; border-color:#225f4e; }

.mhfd-inert-fallback[inert] { display:none !important; }
html.mhfd-page, html.mhfd-page body, html.mhfd-shell, html.mhfd-shell body { overflow:hidden; }
html.mhfd-shell iframe.mhfd-frame {
  position:fixed !important; inset:0 !important; z-index:2147483000;
  display:block; width:100% !important; max-width:none !important;
  height:100vh !important; height:100dvh !important; max-height:none !important;
  border:0 !important; border-radius:0; background:#fffefa; margin:0;
}
#testStudio.mhfd-active {
  --mhfd-head-height:48px;
  box-sizing:border-box; position:fixed; inset:0; z-index:2000; width:100%; max-width:none;
  height:100vh; height:100dvh; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable;
  margin:0; border:0; border-radius:0;
  padding:0 max(.45rem,env(safe-area-inset-right)) max(.5rem,env(safe-area-inset-bottom)) max(.45rem,env(safe-area-inset-left));
  background:#fffefa; text-align:start;
}
#testStudio.mhfd-active > :not(.studioHead):not(.studioPlaybackBar):not(#studioPlayingArea),
#testStudio.mhfd-active .studioHeadLinks > :not(.mhfd-toggle),
#testStudio.mhfd-active .studioViewTools { display:none; }

#testStudio.mhfd-active .studioHead {
  position:sticky; top:0; z-index:6; display:flex; flex-wrap:nowrap; align-items:center;
  justify-content:space-between; gap:.25rem .55rem; background:#fffefa; color:#153d32;
  margin:0; padding:max(.13rem,env(safe-area-inset-top)) .1rem .15rem; border:0;
}
#testStudio.mhfd-active .studioHead > div:first-child { min-width:0; }
#testStudio.mhfd-active .studioHead h1 { margin:0; font-size:1rem; line-height:1.35; }
#testStudio.mhfd-active .studioHead h1:has(+ #studioPiece:not([hidden])) {
  position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap;
}
#testStudio.mhfd-active #studioPiece {
  display:block; margin:0; color:#24483c; font-weight:700; font-size:.94rem; line-height:1.35;
}
#testStudio.mhfd-active .studioHeadLinks { display:flex; flex:none; margin-inline-start:auto; }
#testStudio.mhfd-active .studioPlaybackBar {
  position:sticky; top:var(--mhfd-head-height); z-index:5; margin:0 0 .42rem;
  padding:.28rem .45rem; background:#f2f6ed; border:1px solid #b8cabd;
}
#testStudio.mhfd-active .studioExampleClick { display:none; }
#testStudio.mhfd-active #studioPlayingArea { scroll-margin-block-start:calc(var(--mhfd-head-height) + 7rem); }
#testStudio.mhfd-active #studioTransport, #testStudio.mhfd-active #studioScore, #testStudio.mhfd-active #studioLive { min-width:0; }
#testStudio.mhfd-active .mhts-top { margin:0; }
#testStudio.mhfd-active .mhts-hint { margin:.18rem 0 .24rem; padding:.12rem .4rem; line-height:1.4; }
#testStudio.mhfd-active .mhts-controls { padding:.06rem 0; }
#testStudio.mhfd-active .mhsl-strip { margin:.18rem 0 .32rem; padding:.25rem .4rem .34rem; }
#testStudio.mhfd-active .mhsl-cell { min-height:2rem; }
#testStudio.mhfd-active .mhsl-cell b { font-size:1.35rem; }
#testStudio.mhfd-active .mhsl-header { margin:0; min-height:1.25rem; }
#testStudio.mhfd-active .mhtf-live { margin:.25rem 0; padding:.35rem .5rem; gap:.22rem; }
#testStudio.mhfd-active .mhtf-verdict { min-height:1.4em; }

@media(max-width:650px) {
  #testStudio.mhfd-active .studioPlaybackBar { display:flex; gap:.15rem .4rem; padding:.2rem .35rem; }
  #testStudio.mhfd-active #studioTransport { flex:1 1 100%; }
  #testStudio.mhfd-active .studioSpeed { width:100%; }
  #testStudio.mhfd-active .studioSpeedRail button { min-width:38px; min-height:38px; }
  #testStudio.mhfd-active .studioMusicDesk:has(.mhtf-live[data-phase=record]:not([hidden])) { display:flex; }
  #testStudio.mhfd-active .studioMusicDesk #studioLive { order:0; }
}
/* A short landscape display has room beside the notation for beat and tuning feedback. */
@media(min-width:850px), (min-width:555px) and (max-height:560px) {
  #testStudio.mhfd-active #studioPlayingArea:has(.mhsl-strip:not([hidden]),.mhtf-live:not([hidden])) {
    display:grid; grid-template-columns:minmax(9.4rem,22%) minmax(0,1fr); grid-template-rows:auto 1fr;
    gap:0 .55rem; align-items:start;
  }
  #testStudio.mhfd-active #studioPlayingArea .studioMusicDesk { display:contents; }
  #testStudio.mhfd-active #studioScore { grid-column:2; grid-row:1/3; }
  #testStudio.mhfd-active #studioLights { grid-column:1; grid-row:1; }
  #testStudio.mhfd-active #studioLive { grid-column:1; grid-row:2; }
  #testStudio.mhfd-active .mhsl-header { flex-wrap:wrap; gap:0 .4rem; }
  #testStudio.mhfd-active .mhsl-beats { gap:.2rem; }
  #testStudio.mhfd-active .mhsl-marker { display:none; }
  #testStudio.mhfd-active .studioPlaybackBar { display:flex; align-items:center; flex-wrap:wrap; gap:.2rem .52rem; }
  #testStudio.mhfd-active #studioTransport { flex:1 1 auto; }
  #testStudio.mhfd-active .studioSpeed { width:auto; max-width:100%; }
  #testStudio.mhfd-active .studioSpeedRail input { width:clamp(5rem,14vw,11rem); flex:auto; }
}
@media(max-height:350px) {
  #testStudio.mhfd-active .studioHead, #testStudio.mhfd-active .studioPlaybackBar { position:static; }
}
@media(forced-colors:active) {
  :is(.mhfd-toggle,.mhfd-stand-toggle)[aria-pressed=true] { outline:2px solid Highlight; outline-offset:-3px; }
}
/* Keep the live pitch and the next staff in the same glance on portrait phones. */
@media(max-width:650px) and (min-height:500px) {
  #testStudio.mhfd-active .studioMusicDesk:has(.mhtf-live[data-phase=record]:not([hidden])) #studioLive { order:-1; }
  #testStudio.mhfd-active .mhtf-live[data-phase=record] .mhtf-readout { flex-flow:row wrap; align-items:baseline; gap:.12rem .32rem; padding:.14rem .32rem; }
  #testStudio.mhfd-active .mhtf-live[data-phase=record] .mhtf-tuner { padding:0 .3rem; }
}
#testStudio.mhfd-active .mhts[data-mode=locked] .mhts-hint {
  position:absolute; width:1px; height:1px; margin:0; padding:0; overflow:hidden; clip-path:inset(50%);
}
@media(min-width:555px) and (max-height:560px) {
  #testStudio.mhfd-active #studioPlayingArea:has(.mhsl-strip:not([hidden]),.mhtf-live:not([hidden])) { grid-template-columns:minmax(11.8rem,28%) minmax(0,1fr); }
  #testStudio.mhfd-active .mhtf-readouts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.2rem; }
  #testStudio.mhfd-active .mhtf-readout { display:grid; gap:0; padding:.12rem .2rem; }
  #testStudio.mhfd-active .mhtf-phase, #testStudio.mhfd-active .mhtf-decision { font-size:.88rem; }
}

#expandStand[hidden], .mhfd-toggle[hidden] { display:none; }
.scorehead #expandStand { margin-inline-start:auto; }
#rehearsalRoom.mhfd-stand {
  position:fixed; inset:0; z-index:2000; display:block; box-sizing:border-box;
  margin:0; padding:max(.24rem,env(safe-area-inset-top)) max(.4rem,env(safe-area-inset-right)) max(.25rem,env(safe-area-inset-bottom)) max(.4rem,env(safe-area-inset-left));
  background:#fbfbf6; width:100%; max-width:none; height:100vh; height:100dvh; overflow:auto;
}
#rehearsalRoom.mhfd-stand > .col:first-child { display:block; height:100%; }
#rehearsalRoom.mhfd-stand > .settings,
#rehearsalRoom.mhfd-stand .col:first-child > :not(.mainpanel),
#rehearsalRoom.mhfd-stand .mainpanel > :not(.scorehead):not(#standQuickTone):not(.standReadingBody):not(#practice):not(.statusrow):not(.controls),
#rehearsalRoom.mhfd-stand:not(.mhfd-sound-open) #standQuickTone,
#rehearsalRoom.mhfd-stand .controls > :not(.playerrow):not(.statusrow),
#rehearsalRoom.mhfd-stand #seekhint { display:none; }
#rehearsalRoom.mhfd-stand .mainpanel {
  display:grid; grid-template-rows:auto minmax(7rem,1fr) auto auto; height:100%; min-height:0;
  padding:0; margin:0; gap:.22rem; border:0; border-radius:0; box-shadow:none; background:transparent;
}
#rehearsalRoom.mhfd-stand .scorehead { margin:0; padding:0; gap:.2rem .5rem; }
#rehearsalRoom.mhfd-stand .scorehead h2 { margin:0; font-size:clamp(.95rem,2.2vw,1.15rem); line-height:1.3; }
#rehearsalRoom.mhfd-stand .scorehead label { order:1; }
#rehearsalRoom.mhfd-stand #expandStand { order:2; margin-inline-start:auto; flex:none; }
#rehearsalRoom.mhfd-stand #scoreViewport { width:100%; height:100%; min-height:0; overscroll-behavior:contain; }
#rehearsalRoom.mhfd-stand .mainpanel > .statusrow { margin:0; min-height:26px; }
#rehearsalRoom.mhfd-stand .controls {
  display:flex; align-items:center; flex-wrap:wrap; justify-content:space-between;
  gap:.2rem .65rem; padding:.24rem 0 0; margin:0; border:0; border-top:1px solid #c5d3c8;
}
#rehearsalRoom.mhfd-stand .controls > .playerrow { display:flex; gap:.25rem; margin:0; flex-wrap:wrap; }
#rehearsalRoom.mhfd-stand .controls > .statusrow { min-height:0; margin:0; }
#rehearsalRoom.mhfd-stand .mobiletempo { display:flex; gap:.25rem; direction:ltr; }
#rehearsalRoom.mhfd-stand .mobiletempo button, #rehearsalRoom.mhfd-stand .playerrow button { min-height:44px; }
#rehearsalRoom.mhfd-stand .mobiletempo button { min-width:42px; }
@media(max-width:650px) {
  #rehearsalRoom.mhfd-stand .scorehead label { display:none; }
  #rehearsalRoom.mhfd-stand .controls { gap:.18rem .32rem; }
  #rehearsalRoom.mhfd-stand .playerrow button { padding:.2rem .55rem; }
  #rehearsalRoom.mhfd-stand #restart { display:none; }
  #rehearsalRoom.mhfd-stand .mobiletempo span { min-width:3.45rem; }
}
#standFocusSound[hidden] { display:none; }
#rehearsalRoom.mhfd-stand .mainpanel {
  grid-template-areas:"head" "sound" "notation" "status" "transport";
  grid-template-rows:auto auto minmax(7rem,1fr) auto auto;
}
#rehearsalRoom.mhfd-stand .scorehead { grid-area:head; }
#rehearsalRoom.mhfd-stand #standFocusSound { order:1; min-height:44px; padding:.2rem .66rem; }
#rehearsalRoom.mhfd-stand .scorehead h2 { flex:1; }
#rehearsalRoom.mhfd-stand #expandStand { margin-inline-start:0; }
#rehearsalRoom.mhfd-stand #standFocusSound[aria-expanded=true] { color:#17513d; border-color:#67927b; background:#e3efdf; }
#rehearsalRoom.mhfd-stand.mhfd-sound-open .mainpanel > #standQuickTone {
  display:block; grid-area:sound; margin:0; max-height:36vh; max-height:36dvh; overflow:auto;
  border:1px solid #c7d4c9; border-radius:.55rem; padding:.25rem .45rem; background:#f3f6ef;
}
#rehearsalRoom.mhfd-stand #scoreViewport { grid-area:notation; }
#rehearsalRoom.mhfd-stand .mainpanel > .statusrow { grid-area:status; }
#rehearsalRoom.mhfd-stand .controls { grid-area:transport; }
@media(min-width:650px) and (max-height:520px) {
  #rehearsalRoom.mhfd-stand .mainpanel {
    grid-template-areas:"head head" "sound sound" "notation notation" "status transport";
    grid-template-columns:minmax(8rem,.92fr) minmax(0,2fr);
    grid-template-rows:auto auto minmax(7rem,1fr) auto;
    column-gap:.5rem;
  }
  #rehearsalRoom.mhfd-stand .mainpanel > .statusrow { align-content:center; justify-content:flex-start; gap:.05rem .42rem; }
  #rehearsalRoom.mhfd-stand .mainpanel > .statusrow .status { font-size:.8rem; }
  #rehearsalRoom.mhfd-stand .mainpanel > .statusrow #returnScore { min-height:36px; padding:.07rem .35rem; font-size:.74rem; }
  #rehearsalRoom.mhfd-stand .controls { padding:0; border:0; }
  #rehearsalRoom.mhfd-stand #restart { display:none; }
}
