:root { --s: 1; --or: #ff9a3c; --tq: #3fe8d6; --navy: #0a1730; --mg: #ff3d8b; --font: "Arial Black", "Trebuchet MS", sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050b18; color: #fff; font-family: var(--font); user-select: none; -webkit-user-select: none; touch-action: none; }
#game, #overlay { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { pointer-events: none; }
.hidden { display: none !important; }

.panel { border-style: solid; border-width: calc(14px * var(--s)); border-image: url(../assets/ui-panel.webp) 30% fill / calc(14px * var(--s)) stretch; }
.btn { font-family: var(--font); font-weight: 900; color: #fff; font-size: calc(15px * var(--s)); min-height: 46px; padding: 6px calc(20px * var(--s)); cursor: pointer; background: none;
  border-style: solid; border-width: 12px; border-image: url(../assets/ui-button.webp) 34% fill / 12px stretch;
  text-shadow: 0 2px 0 #4a1c00, 0 0 3px #4a1c00, 2px 0 0 #4a1c00, -2px 0 0 #4a1c00; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, filter .15s; outline: none; }
.btn:hover, .btn:focus-visible { filter: brightness(1.18); transform: scale(1.04); }
.btn:active { transform: scale(.94); }
.btn.dim { filter: saturate(.25) brightness(.85); }
.btn.small { font-size: calc(13px * var(--s)); min-height: 44px; padding: 4px 14px; }
.btn img { width: calc(26px * var(--s)); height: calc(26px * var(--s)); object-fit: contain; }
.btn[disabled] { filter: grayscale(1) brightness(.6); pointer-events: none; }
.outline { text-shadow: 0 3px 0 #0a1730, 0 0 4px #0a1730, 2px 0 0 #0a1730, -2px 0 0 #0a1730, 0 -2px 0 #0a1730; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hudLeft { position: absolute; left: calc(8px + env(safe-area-inset-left)); top: 8px; width: calc(196px * var(--s)); padding: 2px; }
.hpRow, .meterRow { display: flex; align-items: center; gap: 6px; }
.hpIcon, .meterIcon { width: calc(20px * var(--s)); height: calc(20px * var(--s)); flex: none; background-size: contain; background-repeat: no-repeat; background-position: center; }
.hpIcon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V5z' fill='%233fe8d6' stroke='%230a1730' stroke-width='2'/%3E%3C/svg%3E"); }
.meterIcon { background-image: url(../assets/ui-burst.webp); }
.bar { flex: 1; height: calc(12px * var(--s)); background: rgba(5, 12, 30, .8); border: 2px solid #0a1730; border-radius: 3px; overflow: hidden; transform: skewX(-18deg); }
.bar > div { height: 100%; width: 100%; transform-origin: left; transition: width .15s; }
#hpFill { background: linear-gradient(180deg, #8ffff0, #19b8a8); }
#hpFill.low { background: linear-gradient(180deg, #ffb08a, #ff3d3d); animation: blink .4s infinite alternate; }
.meter > div { background: linear-gradient(90deg, #ff3d8b, #ffb43c); }
.meter.full > div { background: linear-gradient(90deg, #fff, #ffe27a, #fff); background-size: 200% 100%; animation: shine 0.8s linear infinite; }
.meter.locked > div { filter: grayscale(1) brightness(.7); }
#team { display: flex; gap: 6px; margin: 5px 0 5px 2px; }
.ally { position: relative; width: calc(34px * var(--s)); height: calc(34px * var(--s)); border-radius: 50%; background: #13294d; border: 3px solid var(--tq); overflow: hidden; }
.ally img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.ally.chased { border-color: #ff3d3d; animation: blink .25s infinite alternate; }
.ally.out { border-color: #555; }
.ally.out img { filter: grayscale(1) brightness(.45); }
.ally.out i::after { content: "✕"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #ff5050; font-size: calc(20px * var(--s)); text-shadow: 0 0 3px #000; }
#hudTop { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; }
#score { font-size: calc(26px * var(--s)); color: #fff; letter-spacing: 1px; text-shadow: 0 3px 0 #0a1730, 0 0 5px #0a1730, 2px 0 0 #0a1730, -2px 0 0 #0a1730, 0 -2px 0 #0a1730; }
#score.bump { animation: bump .18s; }
#goldRow { display: flex; align-items: center; gap: 4px; font-size: calc(15px * var(--s)); color: #ffe27a; text-shadow: 0 2px 0 #0a1730, 0 0 4px #0a1730; }
#goldRow img { width: calc(20px * var(--s)); height: calc(20px * var(--s)); object-fit: contain; }
#bossBar { display: flex; align-items: center; gap: 6px; width: calc(250px * var(--s)); font-size: calc(13px * var(--s)); color: #ffb0d0; text-shadow: 0 2px 0 #0a1730, 0 0 3px #0a1730; white-space: nowrap; }
#bossFill { background: linear-gradient(180deg, #ff7ab0, #c4105a); }
#bossBar.shield #bossFill { background: linear-gradient(180deg, #ffe9a0, #e0a020); }
#ringCount { font-size: calc(16px * var(--s)); color: #9fd4ff; text-shadow: 0 2px 0 #0a1730, 0 0 4px #0a1730; }
#comm { position: absolute; left: 50%; transform: translateX(-50%); top: calc(76px * var(--s)); width: calc(300px * var(--s)); display: flex; align-items: center; gap: 8px; padding: 0; animation: slideIn .25s cubic-bezier(.3, 1.5, .6, 1); }
#commFace { width: calc(56px * var(--s)); height: calc(56px * var(--s)); flex: none; background: radial-gradient(#2a4a7a, #0a1730); border: 2px solid var(--tq); border-radius: 6px; }
.commText { flex: 1; min-width: 0; }
#commName { font-size: calc(12px * var(--s)); color: var(--or); text-shadow: 0 1px 0 #000; }
#commLine { font-size: calc(14px * var(--s)); line-height: 1.25; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000; font-family: sans-serif; font-weight: 700; }
#hint { position: absolute; left: 50%; top: 34%; transform: translateX(-50%); max-width: 80vw; text-align: center; font-size: calc(16px * var(--s)); padding: 6px 14px; background: rgba(10, 23, 48, .7); border: 2px solid rgba(63, 232, 214, .7); border-radius: 8px; text-shadow: 0 2px 0 #000; animation: fadeIn .3s; }
#banner { position: fixed; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; animation: slam .45s cubic-bezier(.2, 1.6, .5, 1); }
#bannerMain { font-size: calc(40px * var(--s)); color: #fff; font-style: italic; letter-spacing: 2px; text-shadow: 0 4px 0 #b4380a, 0 7px 0 #0a1730, 0 0 12px rgba(255, 154, 60, .8), 3px 0 0 #0a1730, -3px 0 0 #0a1730; }
#bannerSub { font-size: calc(16px * var(--s)); color: var(--tq); margin-top: 6px; text-shadow: 0 2px 0 #0a1730, 0 0 4px #0a1730; }
#banner::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; bottom: -10px; background: linear-gradient(90deg, transparent, rgba(10, 23, 48, .65) 25%, rgba(10, 23, 48, .65) 75%, transparent); z-index: -1; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#vignette { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, transparent 50%, rgba(255, 30, 30, .7) 100%); }

/* Title */
#title { position: fixed; inset: 0; overflow: hidden; }
#titleArt { position: absolute; inset: -3%; background: #0a1730 url(../assets/title-bg.webp) center / cover no-repeat; animation: drift 18s ease-in-out infinite alternate; }
#logo { position: absolute; left: 6%; top: 7%; width: 46%; max-height: 36%; object-fit: contain; object-position: left center; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); animation: logoIn .7s cubic-bezier(.2, 1.6, .5, 1) both, float 4s ease-in-out .7s infinite; }
#prompt { position: absolute; left: 0; right: 0; bottom: 9%; text-align: center; font-size: calc(18px * var(--s)); color: #fff; letter-spacing: 1px; text-shadow: 0 3px 0 #0a1730, 0 0 6px #0a1730, 2px 0 0 #0a1730, -2px 0 0 #0a1730; animation: pulse 1.6s ease-in-out infinite; }
.cornerBtn { position: absolute; top: calc(10px + env(safe-area-inset-top)); height: 48px; min-width: 48px; border: 2px solid rgba(255, 255, 255, .5); background: rgba(10, 23, 48, .45); color: #fff; font-family: var(--font); font-size: 14px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 24px; cursor: pointer; text-shadow: 0 2px 0 #000; backdrop-filter: blur(3px); }
.cornerBtn.left { left: calc(10px + env(safe-area-inset-left)); }
.cornerBtn.right { right: calc(10px + env(safe-area-inset-right)); }
.cornerBtn.round { width: 48px; padding: 0; justify-content: center; }
.cornerBtn:hover { background: rgba(255, 154, 60, .5); }
.cornerBtn:active { transform: scale(.92); }
.ic { width: 24px; height: 24px; background-size: contain; background-repeat: no-repeat; background-position: center; }
.trophyIc { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 3h10v3h4c0 4-2 6-5 6.5-.7 1.6-2 2.6-3 2.9V18h3v3H8v-3h3v-2.6c-1-.3-2.3-1.3-3-2.9C5 12 3 10 3 6h4z' fill='%23ffd27a' stroke='%230a1730' stroke-width='1.3'/%3E%3C/svg%3E"); }
.hangarIc { background-image: url(../assets/ui-dash.webp); }

/* Intro */
#intro { position: fixed; inset: 0; background: #000 url(../assets/title-bg.webp) center / cover; }
#introVideo { width: 100%; height: 100%; object-fit: cover; background: transparent; }
#skipBtn { position: absolute; right: calc(14px + env(safe-area-inset-right)); top: 14px; }

/* Modals */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(4, 8, 20, .55); z-index: 50; }
.dialog { width: min(92vw, calc(380px * var(--s))); max-height: 92vh; padding: calc(8px * var(--s)); text-align: center; animation: pop .28s cubic-bezier(.3, 1.6, .6, 1); display: flex; flex-direction: column; }
.dialog.wide { width: min(94vw, calc(600px * var(--s))); }
.dialog h2 { margin: 2px 0 6px; font-size: calc(22px * var(--s)); color: var(--or); text-shadow: 0 3px 0 #0a1730, 0 0 4px #0a1730, 2px 0 0 #0a1730, -2px 0 0 #0a1730; }
.dialog .note { margin: 0 0 8px; font-size: calc(13px * var(--s)); color: #bfe; font-family: sans-serif; font-weight: 700; }
.col { display: flex; flex-direction: column; gap: 8px; }
.price { display: inline-flex; align-items: center; gap: 3px; color: #ffe27a; font-style: normal; }
.price img { width: 20px !important; height: 20px !important; }
.price em { font-style: normal; }
.howList { text-align: left; margin: 0 0 10px; padding-left: 18px; font-family: sans-serif; font-weight: 700; font-size: calc(13.5px * var(--s)); line-height: 1.45; overflow-y: auto; }
.hgHead { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.hgHead h2 { margin: 0; flex: 1; text-align: left; }
.hgGold { display: flex; align-items: center; gap: 4px; font-size: calc(18px * var(--s)); color: #ffe27a; text-shadow: 0 2px 0 #0a1730; }
.hgGold img { width: 26px; height: 26px; object-fit: contain; }
#hgList { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(170px * var(--s)), 1fr)); gap: 8px; padding: 2px; touch-action: pan-y; }
.hgSec { grid-column: 1 / -1; text-align: left; font-size: calc(14px * var(--s)); color: var(--tq); margin-top: 2px; text-shadow: 0 2px 0 #0a1730; }
.card { display: flex; gap: 8px; align-items: center; padding: 6px; background: rgba(20, 40, 80, .6); border: 2px solid rgba(63, 232, 214, .35); border-radius: 8px; text-align: left; }
.card img.icon { width: calc(48px * var(--s)); height: calc(48px * var(--s)); object-fit: contain; flex: none; }
.card .info { flex: 1; min-width: 0; }
.card .nm { font-size: calc(13px * var(--s)); color: #fff; }
.card .ds { font-size: calc(11.5px * var(--s)); color: #bcd; font-family: sans-serif; font-weight: 700; line-height: 1.25; }
.card .btn { min-height: 44px; font-size: calc(12px * var(--s)); padding: 2px 10px; margin-top: 4px; }
.card .tag { display: inline-block; margin-top: 4px; font-size: calc(12px * var(--s)); color: var(--tq); }
.hgFoot { margin-top: 8px; }

@keyframes blink { from { opacity: 1; } to { opacity: .45; } }
@keyframes shine { from { background-position: 0 0; } to { background-position: 200% 0; } }
@keyframes bump { 50% { transform: scale(1.18); } }
@keyframes slideIn { from { transform: translate(-50%, -30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slam { 0% { transform: scale(2.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes logoIn { 0% { transform: translateY(-60px) scale(.7); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes pulse { 50% { opacity: .55; transform: scale(.97); } }
@keyframes drift { from { transform: scale(1.02) translateX(-1%); } to { transform: scale(1.06) translateX(1%); } }
