html, body { margin: 0; height: 100%; overflow: hidden; background: #e8c890; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif; color: #fff; }
button { font: inherit; cursor: pointer; pointer-events: auto; color: inherit; }

.hud { position: absolute; top: env(safe-area-inset-top, 0); left: 0; right: 0; display: flex; gap: 8px; align-items: flex-start; padding: 7px 8px; background: linear-gradient(rgba(40,24,12,.75), rgba(40,24,12,0)); text-shadow: 0 1px 2px #000; }
.hud b { display: block; font-size: 10px; letter-spacing: 1.5px; opacity: .85; margin-bottom: 3px; }
.hud .hullbox { width: 26%; }
.hud .hull, .hud .gauge { height: 10px; border-radius: 5px; background: rgba(0,0,0,.45); overflow: hidden; box-shadow: 0 0 0 1.5px rgba(255,255,255,.5); }
.hud .hull i { display: block; height: 100%; background: linear-gradient(#9fe8a8, #4fae5a); transition: width .25s; }
.hud .hull i.low { background: linear-gradient(#ff8a7a, #d33a2a); }
.hud .route { flex: 1; text-align: center; }
.hud .route b { font-size: 12px; letter-spacing: .5px; color: #ffe8b0; opacity: 1; }
.hud .track { position: relative; height: 8px; margin: 4px 10px 0; border-radius: 4px; background: rgba(0,0,0,.4); }
.hud .track i { display: block; height: 100%; border-radius: 4px; background: #e8c048; }
.hud .track span { position: absolute; top: -7px; font-size: 14px; transform: translateX(-50%); }
.hud .track .end { left: 100%; }
.hud .steam { width: 22%; }
.hud .gauge i { display: block; height: 100%; background: linear-gradient(90deg, #e8c048, #ff8a3c); transition: width .15s; }
.hud .gauge i.hot { background: #ff3b2b; animation: blink .3s infinite alternate; }
.hud .gauge i.cold { background: #7a8aa8; }
.hud .pause { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); background: rgba(40,24,12,.5); font-weight: 900; font-size: 11px; flex: none; }
@keyframes blink { to { opacity: .45 } }

.hint { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); transform: translateX(-50%); max-width: 92vw; padding: 7px 14px; border-radius: 16px; background: rgba(40,24,12,.82); font-size: 13px; text-align: center; opacity: 0; transition: opacity .25s; }
.hint.on { opacity: 1; }
.banner { position: absolute; top: 22%; left: 0; right: 0; text-align: center; opacity: 0; transition: opacity .4s; }
.banner.on { opacity: 1; animation: bannerIn 2.8s ease-out; }
.banner div { display: inline-block; font-size: clamp(26px, 8vw, 50px); font-weight: 900; letter-spacing: 2px; color: #fff3d8; text-shadow: 0 3px 0 #8a3a1a, 0 6px 12px rgba(0,0,0,.4); -webkit-text-stroke: 1.5px #2a1a10; }
.banner small { display: block; font-size: .36em; letter-spacing: 3px; -webkit-text-stroke: 0; text-shadow: 0 1px 3px #000; }
@keyframes bannerIn { 0% { transform: scale(1.8); opacity: 0 } 12% { transform: scale(.96); opacity: 1 } 20% { transform: scale(1) } }

.modal { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.modal.on { display: flex; pointer-events: auto; }
.sheet { width: min(92vw, 440px); max-height: 88vh; overflow-y: auto; padding: 16px; border-radius: 16px; background: linear-gradient(#f6ead2, #e9d6b0); color: #2a1e14; box-shadow: 0 10px 30px rgba(0,0,0,.4), inset 0 0 0 3px #8a5a34; }
.sheet h2 { margin: 0 0 8px; font-size: 24px; color: #6a2e1a; }
.sheet p { margin: 6px 0; line-height: 1.4; font-size: 15px; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choice { padding: 10px 12px; border-radius: 10px; border: 2px solid #8a5a34; background: #fff8ea; color: #2a1e14; font-size: 15px; text-align: left; }
.choice b { display: block; font-size: 16px; }
.choice small { display: block; font-size: 13px; margin-top: 2px; }
.choice.big { background: linear-gradient(#e9773a, #c24a22); color: #fff; text-align: center; font-size: 18px; font-weight: 900; border-color: #7a2a12; }
.pop { animation: popIn .45s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes popIn { from { transform: scale(.6); opacity: 0 } }
.modal.over.lost h2 { color: #8a1a1a; }

.modal.title { justify-content: space-between; padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 22px); }
.modal.title .art { position: absolute; inset: 0; background: url(art/keyart.webp) center / cover; z-index: -1; }
.modal.title .art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,0) 28%, rgba(0,0,0,0) 55%, rgba(30,16,6,.88)); }
.modal.title .logo { margin-top: calc(env(safe-area-inset-top, 0px) + 5vh); text-align: center; }
.modal.title h1 { margin: 0; font-size: clamp(40px, 13vw, 92px); letter-spacing: 3px; color: #fff3d8; text-shadow: 0 5px 0 #8a3a1a, 0 9px 0 rgba(0,0,0,.25); -webkit-text-stroke: 2px #2a1a10; }
.modal.title .logo p { margin: 4px 16px 0; letter-spacing: 2px; text-transform: uppercase; font-size: 13px; text-shadow: 0 1px 4px #000; }
.menu { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.menu .big { border: 3px solid #fff3d8; border-radius: 30px; padding: 14px 40px; background: linear-gradient(#e9773a, #c24a22); font-size: 22px; font-weight: 900; letter-spacing: 2px; box-shadow: 0 6px 0 #7a2a12; }
.menu .tip { max-width: 340px; text-align: center; font-size: 13px; line-height: 1.4; margin: 4px 16px 0; text-shadow: 0 1px 3px #000; }
.menu .best { margin: 0; font-size: 13px; opacity: .85; }
