:root { color-scheme: dark; font-family: system-ui, "Hiragino Sans", sans-serif; }
#hud .combo, #play-hint, #result-copy, #result-stats { display: none; }
* { box-sizing: border-box; }
html, body, #game-shell, #game { overscroll-behavior: none; }
#game { touch-action: none; -webkit-user-select: none; -webkit-touch-callout: none; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #03131b; touch-action: none; user-select: none; }
#game-shell { position: relative; width: 100%; height: 100%; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; }
#hud { position: absolute; inset: max(16px, env(safe-area-inset-top)) 18px auto; display: flex; justify-content: space-between; align-items: start; pointer-events: none; text-shadow: 0 2px 7px #001; }
#hud > div { display: flex; flex-direction: column; }
#hud > div:last-child { text-align: right; }
#hud #countdown { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2; text-align: center; align-items: center; }
#countdown .label { display: none; }
#countdown strong { color: #efffd0; font-size: clamp(56px, 17vw, 92px); line-height: .88; letter-spacing: -.08em; text-shadow: 0 3px 0 #123f42, 0 5px 18px #001b; }
#countdown small { margin-left: 5px; font-size: .26em; letter-spacing: .02em; }
#countdown.urgent strong { color: #ffe16b; animation: countdown-alert .55s ease-in-out infinite alternate; }
@keyframes countdown-alert { from { color: #ffe878; text-shadow: 0 3px 0 #633a24, 0 5px 16px #000; } to { color: #ff6a55; text-shadow: 0 3px 0 #651f28, 0 0 24px #ff624c; } }
.label { font-size: 10px; letter-spacing: .16em; color: #9adbd1; }
#hud strong { font-size: 23px; font-variant-numeric: tabular-nums; }
.combo { position: absolute; left: 50%; transform: translateX(-50%); color: #ffe991; white-space: nowrap; }
.combo strong { font-style: italic; }
#sound-button { position: absolute; z-index: 3; top: max(58px, calc(env(safe-area-inset-top) + 48px)); right: 15px; min-width: 0; width: 42px; height: 42px; margin: 0; padding: 0; border: 1px solid #9adbd166; background: #062f3dcc; color: #fff; font-size: 20px; box-shadow: 0 3px 12px #0018; }
#sound-button:active { transform: scale(.92); box-shadow: 0 2px 8px #0018; }
.panel { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; padding: 32px; text-align: center; background: radial-gradient(circle at 50% 42%, rgba(7,76,82,.35), rgba(2,14,22,.88)); }
.panel.hidden { display: none; }
.eyebrow { margin: 0 0 4px; color: #8cf1ce; font-size: 13px; font-weight: 800; letter-spacing: .18em; }
h1, h2 { margin: 0; font-size: clamp(48px, 15vw, 78px); line-height: 1; letter-spacing: -.08em; text-shadow: 0 4px #07534f, 0 8px 20px #000; }
h2 { font-size: clamp(42px, 13vw, 68px); }
.panel p:not(.eyebrow) { line-height: 1.8; color: #d9f7ef; }
button { min-width: 190px; margin-top: 24px; padding: 15px 28px; border: 0; border-radius: 99px; background: #f4e569; color: #09272a; font: 900 18px inherit; box-shadow: 0 7px 0 #9d8536, 0 12px 30px #0008; }
button:active { transform: translateY(5px); box-shadow: 0 2px 0 #9d8536; }
.gesture { display: flex; align-items: center; gap: 10px; margin: 10px 0 -10px; color: #8cf1ce; font-size: 25px; }
.gesture i { display: block; width: 90px; height: 4px; border-radius: 9px; background: linear-gradient(90deg, transparent, #fff, transparent); animation: flick 1s ease-in-out infinite alternate; }
@keyframes flick { from { transform: translateX(-22px); } to { transform: translateX(22px); } }
.hidden { display: none !important; }
#hud { inset: max(16px, env(safe-area-inset-top)) 20px auto; }
#hud strong { font-size: 25px; }
.label { color: #d2f5e7; letter-spacing: .05em; }
#hud .timer { position: absolute; top: 57px; left: 0; right: 0; height: 5px; background: #07354b88; border-radius: 9px; overflow: hidden; }
#timer-fill { width: 100%; height: 100%; background: #ffdf96; transform-origin: left; }
#play-hint { position: fixed; bottom: max(32px, env(safe-area-inset-bottom)); left: 10px; right: 10px; text-align: center; font-size: 13px; color: #dbfff0; }
#sound-button { top: max(88px, calc(env(safe-area-inset-top) + 80px)); }
#music-button { position: absolute; z-index: 3; left: 16px; top: max(90px, calc(env(safe-area-inset-top) + 80px)); margin: 0; padding: 9px 12px; min-width: 0; font: 700 12px system-ui; color: #e2fff1; border: 1px solid #b8ede844; background: #164f6588; box-shadow: none; }
#start-panel { background: transparent; display: flex; flex-direction: column; justify-content: flex-start; pointer-events: none; padding: 21vh 16px max(30px, env(safe-area-inset-bottom)); }
#start-panel button { pointer-events: auto; }
.title-top { width: 100%; }
h1 { font-family: "メイリオ", "Hiragino Maru Gothic ProN", system-ui, sans-serif; font-size: clamp(72px, 21vw, 126px); font-weight: 900; letter-spacing: -.08em; color: #fff; text-shadow: 0 4px 0 #56727c, 0 10px 24px #00151dcc; margin-top: 0; white-space: nowrap; }
h1 span { color: #caffdf; }
.panel .subtitle { margin: 14px 0 0; font-size: 13px; font-weight: 700; }
.title-top .subtitle { margin: 16px 0 0; font-family: "メイリオ", "Hiragino Maru Gothic ProN", system-ui, sans-serif; font-size: clamp(28px, 7vw, 42px); font-weight: 900; letter-spacing: .03em; color: #fff; text-shadow: 0 3px 10px #001b; }
.eyebrow { font-size: 12px; letter-spacing: .07em; }
.title-bottom { position: absolute; left: 16px; right: 16px; bottom: max(9vh, 70px); display: flex; flex-direction: column; align-items: center; }
.title-bottom p { font-size: 13px; margin: 8px 0; }
.title-bottom .intro { max-width: 100%; font-size: clamp(28px, 7.2vw, 36px); line-height: 1.25; font-weight: 900; color: #edfff3; text-shadow: 0 2px 8px #001b; }
button { font: 900 17px system-ui; background: #ffe4a0; box-shadow: 0 5px #bb9561, 0 10px 22px #133c4966; }
.title-bottom button { margin-top: 6px; min-width: 250px; padding: 18px 30px; font-size: clamp(22px, 6vw, 30px); }
.panel p.mini { font-size: 11px; opacity: .85; margin-top: 18px; }
#result-panel { inset: auto 12px max(18px, env(safe-area-inset-bottom)); padding: 25px 18px; border-radius: 30px; border: 1px solid #b2e9d966; background: #10495bf2; box-shadow: 0 15px 55px #002b4c88; }
#result-panel h2 { font-size: 58px; color: #ffe4a0; margin: 12px 0 0; }
#result-panel p { margin: 5px 0; font-size: 13px; }
#result-panel #result-unit { font-weight: 800; color: #ffe4a0; }
#result-panel #result-stats, #result-panel #best-score { font-size: 12px; color: #bce8d8; }
#result-panel #best-score { white-space: pre-line; margin: 20px 0 4px; font-size: clamp(30px, 8vw, 48px); line-height: 1.25; font-weight: 900; color: #fff1b8; text-shadow: 0 3px 10px #001b; }
#result-panel button { margin-top: 15px; }
#result-panel #share-button { margin-top: 12px; padding: 8px 15px; font-size: 12px; color: #d9ffee; background: transparent; border: 1px solid #c3eddb55; box-shadow: none; }
@media (max-height: 620px) { .panel .subtitle { display: none; } h1 { font-size: 39px; } #start-panel { padding-top: 15px; padding-bottom: 12px; } .title-bottom p { margin: 3px; font-size: 11px; } #result-panel { padding: 15px; } #result-panel h2 { font-size: 38px; } }

.damage-track { display: block; width: 150px; height: 12px; margin-top: 5px; border: 1px solid #d5ffe055; border-radius: 8px; background: #55d478; overflow: hidden; box-shadow: inset 0 1px 4px #001b; }
#damage-fill { display: block; width: 100%; height: 100%; background: linear-gradient(90deg,#63e27d 0%,#dce466 48%,#f06a55 78%,#c83e50 100%); transform: scaleX(0); transform-origin: left; transition: transform .12s ease-out; }
#hud #countdown strong { font-size: clamp(56px, 17vw, 92px); }

/* Gameplay HUD: make the shared HP read like a fighting-game life bar. */
#hud > div:first-child { position: fixed; top: max(58px, calc(env(safe-area-inset-top) + 50px)); left: 20px; right: 20px; width: auto; }
#hud > div:first-child .label { font-size: clamp(24px, 5.4vw, 34px); line-height: 1; font-weight: 1000; letter-spacing: .02em; color: #f1fff0; }
#hud > div:first-child > #score { font-size: clamp(26px, 6.5vw, 40px); line-height: 1.05; color: #eaffd7; }
.damage-track { width: 100%; height: 56px; margin-top: 7px; border: 2px solid #d5ffe099; border-radius: 14px; background: #4bd36c; overflow: hidden; box-shadow: inset 0 2px 8px #001b, 0 0 10px #55e68a33; }
#damage-fill { height: 100%; background: linear-gradient(90deg,#ffb34e 0%,#fa6e4e 45%,#cf3042 100%); transform-origin: right; transition: transform .12s ease-out; }
.damage-track.danger { animation: hp-danger .45s ease-in-out infinite alternate; }
.damage-track.danger #damage-fill { background: linear-gradient(90deg,#ffd86a 0%,#ff8651 42%,#d52e3f 100%); }
@keyframes hp-danger { from { background: #51d86e; box-shadow: inset 0 2px 8px #001b, 0 0 12px #ffe86a66; } to { background: #ffe45d; box-shadow: inset 0 2px 8px #001b, 0 0 24px #ffe45dcc; } }

/* Keep the countdown between the swimmers and the bottom edge, not on the bezel. */
#hud #countdown { bottom: max(86px, calc(env(safe-area-inset-bottom) + 78px)); }
#hud #countdown strong { font-size: clamp(92px, 28vw, 160px); line-height: .82; letter-spacing: -.09em; }
#sound-button { top: max(10px, env(safe-area-inset-top)); }
#hud .timer { display: none !important; }

/* The clear result is intentionally sparse and easy to read at a glance. */
#result-panel h2 { font-size: clamp(96px, 27vw, 142px); line-height: .9; white-space: nowrap; }
#result-panel h2 small { margin-left: .08em; font-size: .34em; letter-spacing: .02em; }
#result-panel #result-unit { display: inline; margin: 0; font-size: .34em; }
#result-panel button { min-width: 320px; margin-top: 28px; padding: 24px 42px; font-size: clamp(28px, 7vw, 42px); }

/* 2026-10-24 judge fixes: tap-anywhere start, readable title text, flat sound icon, keyboard focus. */
#start-panel { pointer-events: auto; cursor: pointer; }
h1 { text-shadow: 0 0 2px #0b3440, 0 0 6px #0b3440, 0 4px 0 #2f4f59, 0 10px 24px #00151dcc; -webkit-text-stroke: 2px #0b3440; paint-order: stroke fill; }
.title-top .subtitle, .title-bottom .intro { display: inline-block; padding: 6px 16px; border-radius: 14px; background: #032631d9; text-shadow: none; }
.title-top .subtitle { margin-top: 18px; }
.title-bottom .intro { font-size: clamp(22px, 6vw, 30px); line-height: 1.35; word-break: keep-all; overflow-wrap: anywhere; }
.panel p.mini { font-size: 13px; opacity: 1; padding: 3px 10px; border-radius: 8px; background: #032631cc; color: #e6fff4; }
#sound-button { right: max(20px, calc(env(safe-area-inset-right) + 14px)); display: grid; place-items: center; color: #eafff6; }
#sound-button .mute, #sound-button.muted .wave { display: none; }
#sound-button.muted .mute { display: inline; }
button:focus-visible { outline: 4px solid #fff; outline-offset: 4px; }
@media (max-height: 620px) { .title-top .subtitle { display: none; } .title-bottom { bottom: 14px; } .title-bottom .intro { font-size: 17px; padding: 4px 12px; } .title-bottom button { padding: 12px 26px; font-size: 22px; } .panel p.mini { margin-top: 8px; font-size: 12px; } }
