/* The toolbar owns one row; transient notes overlay the sky without resizing the scene. */
html, body { height: auto; min-height: 100%; overflow: auto; }
body { overflow-x: hidden; }
#toastPlayArea { height: calc(100vh - 36px - var(--dy-count-space, 0px)); height: calc(100svh - 36px - var(--dy-count-space, 0px)); min-height: 270px; display: flex; flex-direction: column; }
.toast-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; padding: max(10px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 4px max(12px, env(safe-area-inset-left, 0px)); flex: none; }
.toast-toolbar .site { position: relative; inset: auto; z-index: 20; }
.site-title { margin: 0; font: inherit; }
.site ul { max-height: min(380px, 75vh); overflow: auto; }
.toast-toolbar .tools { position: static; gap: 2px; z-index: 11; flex-wrap: wrap; }
#toyShare, .toast-toolbar #howBtn { display: inline-flex; align-items: center; font: inherit; font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 8px; background: none; border: 0; border-radius: 4px; color: var(--ink); text-decoration: none; cursor: pointer; opacity: .7; }
#toyShare:hover, #toyShare:focus-visible, .toast-toolbar #howBtn:hover, .toast-toolbar #howBtn:focus-visible { opacity: 1; }
#toyShare:focus-visible, .toast-toolbar #howBtn:focus-visible { outline: 3px solid #d79a4f; outline-offset: 1px; }
#toastNotices { position: absolute; z-index: 9; top: 6px; left: 0; right: 0; pointer-events: none; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 4px; padding: 0 12px; }
#toastNotices .fullnote { position: static; transform: none; width: auto; max-width: 100%; margin: 2px 0; }
#toastNotices .toy-sound-cue { pointer-events: auto; box-sizing: border-box; min-width: 0; position: static; transform: none; max-width: 100%; margin: 2px 0; }
/* Urgent game notes take priority; do not stack messages over the controls. */
#toastNotices:has(#fullNote:not([hidden])) #beatNote, #toastNotices:has(#fullNote:not([hidden])) .toy-sound-cue { display: none; }
/* Short screens show the goal before the sound hint. */
@media (max-height: 440px) { #toastNotices:has(#beatNote:not([hidden])) .toy-sound-cue { display: none; } }
#toastScene { position: relative; flex: 1 1 auto; min-height: 0; }
#stage { display: contents; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
#scene [data-hit] { touch-action: none; }
.toast-skip { position: absolute; top: -100px; left: 12px; z-index: 50; background: var(--white); padding: 10px; color: var(--ink); }
.toast-skip:focus { top: 8px; }
#toastFooter { scroll-margin-top: 12px; }
@media (max-width: 520px) { .toast-toolbar { gap: 0 6px; } .toast-toolbar .tools { margin-left: auto; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }

/* Keep phone controls independent of the scale of the illustrated table. */
#mobileControls { display: none; }
@media (max-width: 700px), (max-width: 1024px) and (max-height: 500px), (pointer: coarse) and (max-width: 1024px) {
  #toastPlayArea { height: auto; min-height: 0; }
  #toastScene { flex: none; min-height: 260px; height: 320px; height: clamp(260px, 40vh, 400px); height: clamp(260px, 40svh, 400px); }
  #mobileControls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px max(12px, env(safe-area-inset-right, 0px)) 20px max(12px, env(safe-area-inset-left, 0px)); border-top: 1px solid #d5d3cb; background: var(--page); }
  .toast-setting { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 16px; font-weight: 600; }
  .toast-setting > span { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; }
  .toast-setting output { font-weight: 400; font-size: 14px; }
  #mobileControls button, #mobileControls select { width: 100%; min-width: 0; min-height: 48px; box-sizing: border-box; font: inherit; font-size: 16px; color: var(--ink); background: var(--white); border: 1.5px solid var(--ink); border-radius: 7px; padding: 8px; touch-action: manipulation; }
  #mobileControls button { font-weight: 600; }
  #mobileControls .toast-primary, #mobileButter[aria-pressed="true"] { background: var(--tint); }
  #mobileControls input[type="range"] { appearance: none; -webkit-appearance: none; display: block; width: 100%; min-width: 0; height: 48px; margin: 0; background: transparent; accent-color: var(--ink); touch-action: pan-y; }
  #mobileControls input::-webkit-slider-runnable-track { height: 6px; background: #dedbd2; border: 1px solid var(--ink); border-radius: 3px; }
  #mobileControls input::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 30px; height: 30px; margin-top: -13px; border: 2px solid var(--ink); border-radius: 50%; background: var(--tint); }
  #mobileControls input::-moz-range-track { height: 4px; background: #dedbd2; border: 1px solid var(--ink); border-radius: 3px; }
  #mobileControls input::-moz-range-thumb { width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 50%; background: var(--tint); }
  #mobileControls :is(button, select, input):focus-visible { outline: 3px solid #d79a4f; outline-offset: 3px; }
  .toast-toolbar #snapBtn, .toast-toolbar #sound, .toast-toolbar #clear { min-width: 44px; min-height: 44px; }
}
