/* Paint the canvas too: Safari's side/overscroll areas must match the app. */
html{background:#101210;color-scheme:dark}
/* The keyboard/zoom changes the visual viewport, not the app's layout viewport.
   Do not feed that smaller height back into the whole instrument layout. */
html:has(body.redesign) {
  --new-height:100vh;
  --new-top:0px;
  height:100%;overflow:hidden;
  -webkit-text-size-adjust:100%;text-size-adjust:100%;
}
@supports (height:100dvh) {
  html:has(body.redesign) {--new-height:100dvh}
}
body.redesign {
  position:fixed;inset:0;margin:0;
  width:100%;height:100%;min-width:0;
  overflow:hidden;overscroll-behavior-x:none;
}
/* Long home screens keep their own vertical scroll inside the stationary page. */
body.redesign #newShell.daily-home {
  height:var(--new-height);min-height:0;overflow-y:auto;overflow-x:hidden;
}

/* The idle coach occupies the existing fourth grid row. Its picture can shrink
   with that row, and cannot paint over the header, score or tempo controls. */
body.redesign #newShell:not(.session-active) #newStage .console>#characterStage,
body.redesign #newShell:not(.session-active) #metroStage .metro-panel>#characterStage {
  display:grid!important;grid-area:4/1!important;
  position:relative!important;inset:auto!important;
  width:100%!important;height:100%!important;
  min-width:0;min-height:0;max-width:100%;max-height:100%;
  place-items:center;overflow:hidden;pointer-events:none;
}
body.redesign #newShell:not(.session-active) #newStage #characterStage>#character {
  display:grid!important;place-items:center;
  width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;
}
body.redesign #newShell:not(.session-active) #newStage #characterStage #characterImg {
  display:block!important;width:100%!important;height:100%!important;
  min-width:0!important;min-height:0!important;
  max-width:180px!important;max-height:180px!important;
  object-fit:contain;object-position:center;transform:none!important;
}
body.redesign #newShell:not(.session-active) #newStage #characterStage #characterLine {display:none!important}
body.redesign #newShell:is(.course-mode,.rudiment-mode,.daily-home,.phrases-mode):not(.session-active) #characterStage {display:none!important}

@media (max-width:899px) and (max-height:500px) {
  body.redesign #newShell:not(.session-active) #newStage {overflow-y:auto}
  body.redesign #newShell.metro-mode:not(.session-active) #metroStage .metro-panel {min-height:380px}
  body.redesign #newShell:not(.session-active):not(.daily-home):not(.phrases-mode) #newStage .console {min-height:360px}
}

/* Avoid focus zoom for editable fields outside the settings sheet as well. */
@media (max-width:899px), (hover:none) and (pointer:coarse) {
  body.redesign .new-dialog {
    --new-height:var(--sheet-height,100dvh);
    --new-top:var(--sheet-top,0px);
  }
  body.redesign input:not([type=range]):not([type=checkbox]):not([type=radio]),
  body.redesign select,body.redesign textarea {font-size:max(16px,1em)}
}

/* viewport-fit=cover fills the screen; controls stay clear of the notch. */
body.redesign #newShell{
 padding-left:max(18px,env(safe-area-inset-left));
 padding-right:max(18px,env(safe-area-inset-right));
}
body.redesign .new-dialog{max-width:calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right))}
