:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #edf8f9;
  background: #24264a;
  --stage-ratio: 600 / 340;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
main, #player { width: 100%; height: 100%; }
#player { display: grid; place-items: center; }
#stage {
  position: relative;
  width: min(100%, calc(100vh * var(--stage-ratio)));
  aspect-ratio: var(--stage-ratio);
  overflow: hidden;
  background: #171426;
}
#stage ruffle-player {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  touch-action: none;
}
#touch-controls { display: none; }
@media (any-pointer: coarse) {
  #player:has(#touch-controls:not([hidden])) {
    align-content: center;
    grid-template-rows: auto auto;
    gap: .5rem;
  }
  #player:has(#touch-controls:not([hidden])) #stage {
    width: min(100%, calc((100vh - 64px) * var(--stage-ratio)));
  }
  #touch-controls:not([hidden]) { display: flex; gap: .5rem; }
  #touch-controls button {
    width: clamp(44px, 18vw, 64px);
    min-height: 48px;
    border: 1px solid #80a4b0;
    border-radius: .5rem;
    background: #23444f;
    color: #fff;
    font: 600 1.4rem system-ui, sans-serif;
    touch-action: none;
    user-select: none;
  }
  #touch-controls button[data-key="Space"] { font-size: 1rem; }
}
#stage[aria-busy="false"] .player-loading-progress { display: none; }

button:focus-visible { outline: 2px solid #ffe299; outline-offset: 3px; }
