* { box-sizing: border-box; }
body { margin: 0; height: 100svh; display: flex; flex-direction: column; background: #fff; color: #2a2328; font-family: -apple-system,BlinkMacSystemFont,"Hiragino Sans",sans-serif; }
main { width: 100%; max-width: 450px; flex: 1; min-height: 0; margin: auto; padding: 4px 12px max(8px,env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
button { font: inherit; color: inherit; border: 0; border-radius: 8px; background: #f3f4f6; min-width: 44px; min-height: 44px; font-weight: 700; padding: 8px 14px; touch-action: manipulation; }
button:disabled { opacity: .4; }
button:focus-visible { outline: 2px solid #675776; outline-offset: 2px; }
.game-nav-header { flex-shrink: 0; }
.game-nav-header .game-sound-toggle { width: 44px; min-width: 44px; height: 44px; }
.companion { flex-shrink: 0; display: flex; align-items: center; gap: 8px; min-height: 64px; padding-bottom: 4px; }
.companion img { width: 48px; height: 56px; object-fit: cover; object-position: top; border-radius: 8px; }
.companion div { flex: 1; min-width: 0; }
.companion strong { font-size: 13px; }
.companion p { font-size: 12px; line-height: 1.5; margin: 3px 0 0; }
.stage { position: relative; display: flex; flex: 1; flex-direction: column; min-height: 0; }
.hud,.progress { flex-shrink: 0; display: flex; justify-content: space-between; padding: 4px 4px 0; font-size: 12px; }
.hud b { font-size: 18px; font-variant-numeric: tabular-nums; }
.progress { color: #6e626a; padding-top: 4px; }
canvas { display: block; width: 100%; height: 0; flex: 1; min-height: 0; touch-action: none; }
#hint { flex-shrink: 0; font-size: 12px; line-height: 1.5; text-align: center; margin: 0; padding: 4px 0; }
.controls { flex-shrink: 0; display: flex; gap: 8px; margin-top: 6px; }
.controls button { flex: 1; min-height: 48px; border: 1px solid transparent; font-size: 14px; }
.controls button[aria-pressed=true] { background: #eef0f3; border-color: #6e626a; }
#overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #fff; padding: 12px; }
#overlay[hidden] { display: none; }
.panel { text-align: center; width: 100%; max-width: 330px; }
h1 { font-size: 19px; margin: 0 0 12px; }
#detail { font-size: 13px; line-height: 1.8; margin: 8px 0; }
#go { width: 100%; min-height: 48px; margin-top: 8px; }
#best,#result { font-size: 13px; margin: 8px 0; }
#result:empty,#save:empty { display: none; }
#save { flex-shrink: 0; font-size: 11px; color: #6e626a; margin: 4px 0 0; }
@media(prefers-reduced-motion:reduce) { * { scroll-behavior: auto; } }
