* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif; color: #2a2328; background: #fff; }
body { height: 100dvh; display: flex; flex-direction: column; overscroll-behavior: none; }
main { width: 100%; max-width: 450px; margin: 0 auto; flex: 1; min-height: 0; padding-bottom: env(safe-area-inset-bottom); }
.stage { position: relative; height: 100%; min-height: 0; overflow: hidden; background: #396f89; isolation: isolate; }
canvas { display: block; width: 100%; height: calc(100% - 60px); touch-action: none; }
.hud { position: absolute; top: 0; left: 0; right: 0; height: 60px; padding: 8px 12px; display: flex; align-items: center; gap: 16px; color: #2a2328; background: #fff; pointer-events: none; }
.hud small { display: block; font-size: 10px; letter-spacing: 1px; color: #6e626a; }
.hud strong { font-size: 23px; font-variant-numeric: tabular-nums; }
.flight { flex: 1; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.flight progress { display: block; width: 100%; height: 4px; margin-top: 7px; accent-color: #39718b; }
.hud button { pointer-events: auto; width: 44px; height: 44px; border: 0; border-radius: 8px; background: #f3f4f6; color: #2a2328; font-size: 20px; }
.hud button:disabled { opacity: .45; }
.integrity { position: absolute; top: 60px; left: 0; right: 0; height: 28px; padding: 0 12px 8px; display: flex; justify-content: space-between; pointer-events: none; font-size: 12px; background: #fff; }
#lives { color: #ae4e64; letter-spacing: 3px; }
#combo { color: #52616b; }
.buddy { position: absolute; bottom: 0; left: 0; right: 0; height: 60px; display: flex; gap: 10px; align-items: center; padding: 8px 12px; pointer-events: none; background: #fff; }
.buddy img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.buddy p { margin: 0; display: grid; gap: 4px; font-size: 13px; }
.buddy b { font-size: 11px; font-weight: 500; color: #6e626a; }
.overlay { position: absolute; inset: 0; z-index: 3; background: #173b5299; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.overlay[hidden] { display: none; }
.stage:has(.overlay:not([hidden])) :is(.hud, .integrity, .buddy) { visibility: hidden; }
.panel { width: 100%; max-width: 330px; padding: 20px; background: #fff; border-radius: 12px; text-align: center; }
.panel-identity { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; }
.portrait { display: block; width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.panel h2 { font-size: 18px; margin: 16px 0 10px; }
.panel p { font-size: 13px; line-height: 1.8; margin: 10px 0; }
#instructions { color: #6e626a; margin-bottom: 16px; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.primary { width: 100%; min-height: 48px; border: 0; border-radius: 8px; background: #f3f4f6; color: #2a2328; font-weight: 700; font-size: 15px; }
.primary:active { background: #e4e7eb; }
#best { font-size: 12px; color: #6e626a; margin: 12px 0 0; }
#result { font-variant-numeric: tabular-nums; font-weight: 700; white-space: pre-line; margin-bottom: 16px; }
#storage { font-size: 11px; color: #8b462f; }
button:focus-visible { outline: 3px solid #39718b; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
