html, body { margin: 0; height: 100%; overflow: hidden; background: #2f97cc; 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; }

.hud { position: absolute; inset: 0; }
.hud .xp { position: absolute; top: env(safe-area-inset-top, 0); left: 0; right: 0; height: 9px; background: rgba(10, 30, 60, .45); }
.hud .xp i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #5ff0ff, #7dffb0); box-shadow: 0 0 8px #7dffb0; transition: width .15s; }
.hud .xp .lvl { position: absolute; left: 8px; top: 12px; font-size: 13px; background: #1d3b5c; border: 2px solid #7dffb0; border-radius: 12px; padding: 0 8px; line-height: 20px; }
.hud .top { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 46px; right: 10px; display: flex; align-items: center; gap: 10px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.hud .hp { position: relative; width: 110px; height: 16px; background: rgba(10, 30, 60, .5); border-radius: 9px; overflow: hidden; border: 2px solid rgba(255,255,255,.8); }
.hud .hp i { display: block; height: 100%; background: linear-gradient(#ff7b6b, #e8483b); transition: width .2s; }
.hud .hp span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 16px; font-weight: 800; }
.hud .clock { flex: 1; text-align: center; font-size: 20px; font-weight: 900; letter-spacing: 1px; }
.hud .tally { font-size: 13px; font-weight: 800; text-align: right; }
.hud .tally em { font-style: normal; opacity: .75; font-weight: 400; font-size: 11px; }
.hud .boss { display: none; position: absolute; top: calc(env(safe-area-inset-top, 0px) + 40px); left: 50%; transform: translateX(-50%); width: min(70vw, 420px); text-align: center; font-weight: 900; font-size: 13px; letter-spacing: 1px; color: #ffd23f; text-shadow: 0 1px 3px #000; }
.hud .boss div { height: 10px; margin-top: 3px; background: rgba(10,10,20,.55); border: 2px solid #ffd23f; border-radius: 6px; overflow: hidden; }
.hud .boss i { display: block; height: 100%; background: linear-gradient(#ff5a8a, #c2185b); }
.hud .wind { position: absolute; left: 10px; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.hud .wind svg { width: 42px; height: 42px; }
.hud .wind circle { fill: rgba(10,30,60,.4); stroke: rgba(255,255,255,.8); stroke-width: 2; }
.hud .wind path { fill: #fff; transition: transform .3s; }
.hud .wind b { display: block; color: #0b2a4a; background: #bff6ff; border-radius: 6px; padding: 0 5px; font-size: 11px; animation: pulse .5s infinite alternate; }
.hud .wind.gusty circle { stroke: #bff6ff; fill: rgba(30,90,160,.6); }
.hud .kit { position: absolute; right: 8px; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: 4px; max-width: 60vw; }
.hud .slot { position: relative; width: 30px; height: 30px; border-radius: 7px; overflow: hidden; border: 2px solid rgba(255,255,255,.85); }
.hud .slot.p { border-color: rgba(125,255,176,.85); }
.hud .slot img { width: 100%; height: 100%; display: block; }
.hud .slot b { position: absolute; right: 1px; bottom: 0; font-size: 10px; text-shadow: 0 0 3px #000; }
.hud .pause { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 38px); right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); background: rgba(10,30,60,.4); color: #fff; font-weight: 900; font-size: 12px; }

.banners { position: absolute; top: 24%; left: 0; right: 0; text-align: center; }
.banner { font-size: clamp(26px, 8vw, 54px); font-weight: 900; letter-spacing: 2px; text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 20px rgba(0,0,0,.3); animation: bannerIn 2.6s ease-out forwards; -webkit-text-stroke: 1.5px rgba(20,30,50,.6); }
.banner small { display: block; font-size: .36em; letter-spacing: 2px; color: #fff; margin-top: 4px; -webkit-text-stroke: 0; }
@keyframes bannerIn { 0% { transform: scale(2.6); opacity: 0 } 10% { transform: scale(.95); opacity: 1 } 16% { transform: scale(1.05) } 22%, 82% { transform: scale(1); opacity: 1 } 100% { transform: scale(1.1) translateY(-20px); opacity: 0 } }

.modal { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; box-sizing: border-box; }
.modal.on { display: flex; pointer-events: auto; }
.modal.cards, .modal.paused, .modal.shop { background: radial-gradient(ellipse at center, rgba(10,30,60,.55), rgba(5,15,35,.85)); }
.modal h2 { margin: 0; font-size: clamp(30px, 9vw, 56px); font-weight: 900; letter-spacing: 2px; text-shadow: 0 3px 0 rgba(0,0,0,.35); color: #ffd23f; -webkit-text-stroke: 1.5px rgba(20,30,50,.6); }
.modal .sub { margin: -6px 0 4px; opacity: .9; text-align: center; }
.modal .row { display: flex; flex-direction: column; gap: 10px; width: min(94vw, 460px); }
.card { display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px; border-radius: 14px; border: 3px solid #fff; background: linear-gradient(180deg, #fffaf0, #f2e5c8); color: #1d2a3a; box-shadow: 0 6px 0 rgba(0,0,0,.25); animation: cardIn .35s cubic-bezier(.2,1.6,.4,1) both; }
.card:active { transform: scale(.97); }
.card.weapon { border-color: #ffd23f; }
.card.passive { border-color: #7dffb0; }
.card img { width: 64px; height: 64px; border-radius: 10px; flex: none; }
.card h3 { margin: 0; font-size: 17px; }
.card small { font-weight: 900; font-size: 11px; letter-spacing: 1px; color: #e8483b; }
.card p { margin: 3px 0 0; font-size: 14px; line-height: 1.25; }
.card .cost { font-weight: 900; color: #b07a10; }
.card.dim { opacity: .55; }
@keyframes cardIn { from { transform: translateY(40px) scale(.8); opacity: 0 } }
.pop { animation: popIn .5s cubic-bezier(.2,1.8,.4,1) both; }
@keyframes popIn { from { transform: scale(.3); opacity: 0 } }
@keyframes pulse { to { transform: scale(1.12) } }

.menu { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.menu button { border: 3px solid #fff; border-radius: 30px; padding: 10px 24px; background: rgba(10,30,60,.55); color: #fff; font-weight: 800; font-size: 15px; min-width: 200px; }
.menu button.big { background: linear-gradient(#ff7b5b, #e8483b); font-size: 22px; font-weight: 900; letter-spacing: 2px; padding: 14px 34px; box-shadow: 0 6px 0 #9c2a20; }
.menu button.big:active { transform: translateY(4px); box-shadow: 0 2px 0 #9c2a20; }

.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,.25), rgba(0,0,0,0) 30%, rgba(0,0,0,0) 50%, rgba(5,20,40,.85)); }
.modal.title .logo { margin-top: calc(env(safe-area-inset-top, 0px) + 7vh); text-align: center; }
.modal.title h1 { margin: 0; font-size: clamp(40px, 13vw, 96px); font-weight: 900; letter-spacing: 2px; color: #fff; text-shadow: 0 5px 0 #e8483b, 0 9px 0 rgba(0,0,0,.25); -webkit-text-stroke: 2px #1d2a3a; }
.modal.title .logo p { margin: 6px 0 0; font-size: 16px; letter-spacing: 4px; text-transform: uppercase; text-shadow: 0 1px 4px #000; }
.modal .tip { max-width: 340px; text-align: center; font-size: 13px; line-height: 1.4; opacity: .9; margin: 4px 16px 0; text-shadow: 0 1px 3px #000; }
.modal .best { margin: 0; font-size: 13px; opacity: .8; }
.modal.over { background: radial-gradient(ellipse at center, rgba(10,30,60,.5), rgba(5,15,35,.9)); }
.modal.over.lost h2 { color: #ff6b5b; }
.stats { display: flex; gap: 18px; margin: 6px 0 10px; }
.stats div { text-align: center; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: .9; }
.stats b { display: block; font-size: 30px; letter-spacing: 0; }
