:root {
  color-scheme: dark;
  --ink: #f3fbff;
  --muted: #8ea8bd;
  --cyan: #53f6ff;
  --blue: #4d7dff;
  --violet: #a66cff;
  --pink: #ff4db8;
  --orange: #ff9a46;
  --red: #ff4f68;
  --panel: rgba(6, 13, 35, .82);
  --line: rgba(98, 226, 255, .26);
  --safe-top: max(14px, env(safe-area-inset-top));
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #03050f;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button { font: inherit; }

button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

#app {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 15% 15%, rgba(39, 83, 171, .2), transparent 32%),
    radial-gradient(circle at 85% 75%, rgba(123, 36, 157, .15), transparent 34%),
    linear-gradient(135deg, #02040b, #090d22 55%, #02040b);
}

#app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .22;
  background-image:
    linear-gradient(rgba(88, 164, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 164, 255, .08) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(600px) rotateX(55deg) scale(1.5);
}

#game-shell {
  position: relative;
  width: min(100vw, calc(100vh * .5625));
  height: min(100vh, calc(100vw * 1.77778));
  overflow: hidden;
  background: #050817;
  box-shadow: 0 0 0 1px rgba(114, 224, 255, .2), 0 0 80px rgba(35, 97, 255, .2);
  touch-action: none;
}

#webgl-stage,
#webgl-stage canvas,
#zone-wash,
.scanlines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#webgl-stage canvas { display: block; }

#zone-wash {
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(27, 93, 153, .1), transparent 43%, rgba(22, 12, 70, .12));
  transition: background 1s ease;
}

#zone-wash.asteroid { background: linear-gradient(180deg, rgba(137, 64, 31, .14), transparent 45%, rgba(65, 21, 54, .18)); }
#zone-wash.ruins { background: linear-gradient(180deg, rgba(88, 26, 138, .15), transparent 44%, rgba(17, 71, 91, .16)); }

.scanlines {
  z-index: 3;
  pointer-events: none;
  opacity: .18;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(145, 236, 255, .045) 4px);
  mix-blend-mode: screen;
}

#side-decor { pointer-events: none; }

.side-copy {
  position: fixed;
  top: 50%;
  color: rgba(101, 188, 255, .14);
  font: 900 clamp(36px, 6vw, 96px)/.78 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: -.08em;
}

.side-copy--left { left: clamp(20px, 5vw, 100px); transform: translateY(-50%) rotate(-90deg); }
.side-copy--right { right: clamp(20px, 5vw, 100px); transform: translateY(-50%) rotate(90deg); text-align: right; }

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  padding: var(--safe-top) clamp(18px, 5.5vw, 34px) var(--safe-bottom);
  overflow: hidden;
}

.screen--active { display: flex; }

#loading-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    radial-gradient(circle at 50% 42%, rgba(54, 145, 255, .19), transparent 32%),
    #050817;
}

#loading-screen h1 { margin: 0 0 15px; font-size: clamp(22px, 6vw, 34px); letter-spacing: .08em; }

.loader-mark { position: relative; width: 76px; height: 76px; margin-bottom: 14px; animation: spin 8s linear infinite; }
.loader-mark i { position: absolute; inset: 9px; border: 2px solid var(--cyan); transform: rotate(45deg); box-shadow: 0 0 16px var(--cyan); }
.loader-mark i:nth-child(2) { inset: 21px; border-color: var(--violet); box-shadow: 0 0 12px var(--violet); animation: spin-reverse 2s linear infinite; }
.loader-mark i:nth-child(3) { inset: 31px; background: #fff; border: 0; box-shadow: 0 0 18px #fff; }

.loading-track,
.progress-track,
.boss-track {
  width: min(74%, 330px);
  height: 5px;
  overflow: hidden;
  border-radius: 100px;
  background: rgba(109, 159, 193, .18);
}

.loading-track span,
.progress-track span,
.boss-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 14px var(--cyan);
  transition: width .28s ease;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font: 800 clamp(9px, 2.5vw, 12px)/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.muted { margin: 7px 0; color: var(--muted); font-size: 12px; }

.home-screen {
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(180deg, rgba(1, 5, 17, .75), transparent 31%, transparent 60%, rgba(3, 5, 16, .92)),
    radial-gradient(circle at 50% 39%, rgba(53, 132, 255, .08), transparent 38%);
}

.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.icon-button,
.back-button,
.pause-button,
.modal-close {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(3, 10, 27, .65);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.icon-button { min-height: 36px; padding: 0 13px; border-radius: 100px; font: 700 10px/1 ui-monospace, monospace; letter-spacing: .08em; }
.signal { color: #9eb5c8; font: 700 9px/1 ui-monospace, monospace; letter-spacing: .08em; }
.signal i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #6affaa; box-shadow: 0 0 9px #6affaa; }

.hero-copy { position: absolute; top: 12%; left: clamp(20px, 7vw, 40px); right: 20px; }
.hero-copy h1 { margin: 0; line-height: .88; letter-spacing: -.05em; }
.hero-copy h1 span { display: block; font-size: clamp(38px, 12vw, 69px); font-weight: 300; }
.hero-copy h1 b { display: block; margin-left: 13%; font-size: clamp(42px, 13vw, 76px); font-weight: 950; background: linear-gradient(105deg, #fff 6%, #68f6ff 44%, #798cff 75%, #e25bff); color: transparent; -webkit-background-clip: text; background-clip: text; text-shadow: 0 0 30px rgba(73, 186, 255, .16); }
.subtitle { margin: 9px 0 0 14%; color: #8aa8bc; font: 800 clamp(10px, 3vw, 15px)/1 ui-monospace, monospace; letter-spacing: .62em; }
.hero-lead { width: 76%; margin: 22px 0 0; color: #b8c8d5; font-size: clamp(12px, 3.3vw, 16px); line-height: 1.75; }

#hangar-fighter { position: absolute; inset: 30% 5% 25%; pointer-events: none; }

.home-actions { position: relative; z-index: 2; display: grid; gap: 10px; margin: auto 0 23px; }

.button {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(8, 16, 39, .72);
  backdrop-filter: blur(16px);
  font-weight: 800;
  letter-spacing: .04em;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.button:hover:not(:disabled), .button:active:not(:disabled) { transform: translateY(-1px); border-color: rgba(100, 242, 255, .72); }
.button:disabled { cursor: not-allowed; opacity: .42; }
.button--primary { border-color: rgba(98, 246, 255, .72); background: linear-gradient(110deg, rgba(28, 111, 190, .92), rgba(70, 58, 188, .88)); box-shadow: inset 0 0 24px rgba(90, 246, 255, .12), 0 8px 30px rgba(43, 78, 219, .23); }
.button--ghost { background: rgba(9, 17, 38, .72); }
.button--large { min-height: 67px; text-align: left; padding-left: 24px; }
.button--large span { display: block; font-size: 17px; }
.button--large small { display: block; margin-top: 3px; color: #b7eaff; font: 700 8px/1 ui-monospace, monospace; letter-spacing: .2em; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.version { position: absolute; bottom: 4px; left: 0; width: 100%; margin: 0; color: rgba(150, 182, 201, .55); text-align: center; font: 600 8px/1 ui-monospace, monospace; letter-spacing: .18em; }

.panel-screen {
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, rgba(5, 9, 27, .94), rgba(5, 8, 24, .89));
  overflow-y: auto;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(95, 225, 255, .28) transparent;
}

.panel-header { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding-top: 3px; }
.panel-header h2 { margin: 0; font-size: clamp(22px, 6vw, 31px); }
.back-button { width: 44px; height: 44px; border-radius: 12px; font-size: 31px; line-height: 1; }
.currency { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 11px; border: 1px solid rgba(255, 209, 77, .24); border-radius: 100px; background: rgba(27, 25, 23, .64); }
.currency span, .coin-chip span { color: #ffd45c; text-shadow: 0 0 10px #ffb12e; }
.currency b { font: 800 12px/1 ui-monospace, monospace; }

.campaign-progress { padding: 14px 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.campaign-progress > div:first-child { display: flex; justify-content: space-between; margin-bottom: 10px; color: #9eb8ca; font-size: 11px; }
.campaign-progress b { color: var(--cyan); font-family: ui-monospace, monospace; }
.campaign-progress .progress-track { width: 100%; }

.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; padding-bottom: 4px; }
.level-button { position: relative; aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid rgba(98, 200, 255, .2); border-radius: 11px; color: #dff8ff; background: linear-gradient(145deg, rgba(20, 38, 74, .82), rgba(9, 15, 36, .93)); cursor: pointer; }
.level-button::before { content: ""; position: absolute; inset: 0; opacity: .17; background: linear-gradient(135deg, transparent 48%, var(--level-color, var(--cyan)) 49% 51%, transparent 52%); }
.level-button b { position: relative; z-index: 1; display: block; font: 850 clamp(15px, 4.5vw, 24px)/1 ui-monospace, monospace; }
.level-button small { position: relative; z-index: 1; display: block; min-height: 10px; margin-top: 6px; color: #ffe472; font-size: clamp(7px, 2vw, 10px); letter-spacing: .04em; }
.level-button.locked { color: #54697a; border-color: rgba(113, 135, 151, .12); background: rgba(11, 18, 31, .8); }
.level-button.locked::after { content: "◇"; position: absolute; right: 6px; top: 4px; color: #4f6270; font-size: 10px; }
.level-button.boss { border-color: rgba(255, 84, 161, .52); box-shadow: inset 0 0 16px rgba(255, 47, 142, .08); }
.level-button.boss b { color: #ff8bc6; }
.level-button.current { border-color: var(--cyan); box-shadow: 0 0 0 1px rgba(83, 246, 255, .2), inset 0 0 20px rgba(44, 186, 236, .13); }
.level-button:not(.locked):hover { transform: translateY(-2px); }
.panel-footer { display: grid; margin-top: auto; padding-bottom: 4px; }

.section-lead { margin: 0; color: #a7bdcc; font-size: 12px; line-height: 1.65; }
.upgrade-list { display: grid; gap: 10px; }
.upgrade-card { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; min-height: 78px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.upgrade-icon { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(84, 236, 255, .35); border-radius: 12px; color: var(--cyan); background: rgba(35, 99, 143, .16); font: 900 18px/1 ui-monospace, monospace; }
.upgrade-info h3 { margin: 0 0 4px; font-size: 14px; }
.upgrade-info p { margin: 0; color: #8199aa; font-size: 10px; }
.upgrade-pips { display: flex; gap: 3px; margin-top: 7px; }
.upgrade-pips i { width: 14px; height: 3px; background: rgba(121, 155, 178, .18); }
.upgrade-pips i.active { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.upgrade-buy { min-width: 66px; min-height: 42px; padding: 0 8px; border: 1px solid rgba(255, 211, 85, .28); border-radius: 10px; color: #ffe899; background: rgba(68, 51, 25, .34); font: 800 10px/1 ui-monospace, monospace; cursor: pointer; }
.arsenal-ship { position: relative; width: 180px; height: 80px; margin: auto; opacity: .55; }
.arsenal-ship span { position: absolute; inset: 25px 45px; background: linear-gradient(180deg, #9ff9ff, #176fd0); clip-path: polygon(50% 0, 70% 70%, 100% 100%, 50% 80%, 0 100%, 30% 70%); filter: drop-shadow(0 0 12px #48d9ff); }
.arsenal-ship::before, .arsenal-ship::after { content: ""; position: absolute; top: 45px; width: 38px; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan)); }
.arsenal-ship::before { left: 0; }.arsenal-ship::after { right: 0; transform: scaleX(-1); }

.battle-ui { position: absolute; inset: 0; z-index: 10; display: none; pointer-events: none; padding: var(--safe-top) 11px var(--safe-bottom); }
.battle-ui.active { display: block; }
.battle-ui button { pointer-events: auto; }
.hud-top { display: grid; grid-template-columns: 1.15fr .8fr 1fr 38px; gap: 6px; align-items: center; }
.hud-cell { min-width: 0; min-height: 42px; padding: 7px 8px; border: 1px solid rgba(94, 202, 244, .19); border-radius: 9px; background: rgba(3, 9, 27, .6); backdrop-filter: blur(8px); }
.hud-cell small { display: block; overflow: hidden; color: #7e9db1; font: 700 clamp(6px, 1.8vw, 9px)/1 ui-monospace, monospace; letter-spacing: .08em; text-overflow: ellipsis; white-space: nowrap; }
.hud-cell b { display: block; margin-top: 4px; font: 850 clamp(9px, 2.8vw, 14px)/1 ui-monospace, monospace; white-space: nowrap; }
.hud-level { text-align: center; }.hud-level b { color: var(--cyan); }
.hud-score { text-align: right; }
#shield-cells { display: flex; gap: 3px; margin-top: 5px; }
.shield-cell { width: clamp(10px, 3vw, 16px); height: 7px; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); background: #66f3ff; box-shadow: 0 0 7px #48cfff; }
.shield-cell.empty { background: #263448; box-shadow: none; }
.pause-button { width: 38px; height: 42px; border-radius: 9px; color: var(--cyan); font-weight: 900; }
.battle-progress { position: relative; height: 3px; margin: 6px 42px 0 2px; background: rgba(120, 164, 190, .15); }
.battle-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 9px var(--cyan); transition: width .2s linear; }
.battle-progress i { position: absolute; right: -4px; top: 50%; width: 7px; height: 7px; transform: translateY(-50%) rotate(45deg); border: 1px solid #ff78bc; }

.boss-hud { display: none; margin: 10px 13% 0; padding: 7px 9px; border: 1px solid rgba(255, 75, 166, .32); border-radius: 8px; background: rgba(29, 4, 29, .67); }
.boss-hud.active { display: block; animation: fade-in .3s ease both; }
.boss-hud > div:first-child { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.boss-hud span { color: #ff9ece; font-size: 10px; font-weight: 800; }
.boss-hud small { color: #bd75a5; font: 700 7px/1 ui-monospace, monospace; letter-spacing: .1em; }
.boss-track { width: 100%; height: 4px; }.boss-track span { width: 100%; background: linear-gradient(90deg, #ff4d9e, #ff9b52); box-shadow: 0 0 9px #ff4d9e; }

.combo-display { position: absolute; top: 17%; right: 12px; display: none; text-align: right; filter: drop-shadow(0 0 10px rgba(72, 224, 255, .5)); }
.combo-display.active { display: block; animation: combo-pop .22s ease both; }
.combo-display b { display: block; color: var(--cyan); font: 950 clamp(25px, 8vw, 42px)/.8 ui-monospace, monospace; }
.combo-display span { color: #aad8e3; font: 800 7px/1 ui-monospace, monospace; letter-spacing: .18em; }

.mission-banner { position: absolute; top: 23%; left: 50%; min-width: 60%; transform: translateX(-50%); color: #e5fdff; text-align: center; font: 850 clamp(10px, 2.8vw, 14px)/1.35 ui-monospace, monospace; letter-spacing: .12em; opacity: 0; }
.mission-banner.show { animation: banner 2.2s ease both; }

.hud-bottom { position: absolute; left: 11px; right: 11px; bottom: var(--safe-bottom); display: grid; grid-template-columns: auto 1fr auto; gap: 7px; align-items: end; }
.element-slots { display: flex; align-items: center; gap: 4px; padding: 5px; border: 1px solid rgba(98, 202, 241, .18); border-radius: 10px; background: rgba(3, 9, 27, .62); backdrop-filter: blur(8px); }
.element-slot { position: relative; width: 32px; text-align: center; }
.element-slot i { display: block; width: 25px; height: 25px; margin: auto; clip-path: polygon(50% 0, 95% 25%, 82% 82%, 50% 100%, 18% 82%, 5% 25%); border: 1px solid #35516a; background: rgba(54, 77, 97, .42); }
.element-slot.filled i { background: var(--element-color); box-shadow: 0 0 11px var(--element-color); }
.element-slot small { display: block; margin-top: 3px; color: #6f899d; font-size: 6px; }
.element-slot.filled small { color: #c6e8f4; }
.fusion-plus { color: #68879a; font-size: 10px; }
.weapon-chip { min-width: 0; min-height: 45px; padding: 7px 9px; overflow: hidden; border: 1px solid rgba(102, 208, 245, .2); border-radius: 10px; background: rgba(3, 9, 27, .62); backdrop-filter: blur(8px); }
.weapon-chip small { display: block; color: #6e8fa4; font-size: 6px; letter-spacing: .1em; }
.weapon-chip b { display: block; overflow: hidden; margin-top: 4px; color: #dffbff; font-size: clamp(8px, 2.3vw, 11px); text-overflow: ellipsis; white-space: nowrap; }
.weapon-chip span { display: block; width: 0; height: 2px; margin-top: 5px; background: var(--cyan); box-shadow: 0 0 7px var(--cyan); }
.weapon-chip.active { border-color: rgba(98, 244, 255, .62); box-shadow: inset 0 0 18px rgba(61, 198, 255, .1); }
.coin-chip { min-width: 44px; min-height: 45px; display: grid; place-content: center; text-align: center; border: 1px solid rgba(255, 210, 83, .2); border-radius: 10px; background: rgba(19, 17, 18, .66); }
.coin-chip b { display: block; margin-top: 3px; font: 800 9px/1 ui-monospace, monospace; }

.countdown { position: absolute; z-index: 25; inset: 0; display: none; place-items: center; pointer-events: none; color: #fff; font: 950 clamp(70px, 24vw, 130px)/1 ui-monospace, monospace; text-shadow: 0 0 18px var(--cyan), 0 0 60px #325cff; }
.countdown.active { display: grid; animation: count-pop .62s ease both; }
#damage-flash { position: absolute; z-index: 12; inset: 0; pointer-events: none; opacity: 0; border: 7px solid var(--red); box-shadow: inset 0 0 75px rgba(255, 26, 72, .55); }
#damage-flash.active { animation: damage .42s ease; }

.modal { position: absolute; z-index: 40; inset: 0; display: none; align-items: center; justify-content: center; padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); background: rgba(1, 4, 14, .76); backdrop-filter: blur(11px); }
.modal.active { display: flex; animation: fade-in .18s ease both; }
.modal-card { position: relative; width: 100%; max-height: 94%; overflow-y: auto; padding: 25px; border: 1px solid rgba(93, 225, 255, .35); border-radius: 19px; background: linear-gradient(160deg, rgba(13, 31, 61, .97), rgba(8, 10, 31, .98)); box-shadow: 0 24px 80px rgba(0, 0, 0, .55), inset 0 0 35px rgba(41, 144, 219, .06); }
.modal-card::before { content: ""; position: absolute; inset: 8px; pointer-events: none; border: 1px solid rgba(83, 241, 255, .08); border-radius: 13px; }
.modal-card h2 { position: relative; margin: 0 0 9px; font-size: clamp(25px, 7vw, 36px); }
.modal-card p:not(.eyebrow) { position: relative; color: #a7bdcc; font-size: 12px; line-height: 1.65; }
.modal-card .button { position: relative; width: 100%; margin-top: 10px; }
.modal-close { position: absolute; z-index: 2; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; font-size: 23px; }
.help-card { padding-top: 29px; }
.control-demo { position: relative; height: 96px; margin: 13px 0; overflow: hidden; border: 1px solid rgba(86, 206, 247, .18); border-radius: 12px; background: radial-gradient(circle, rgba(67, 154, 213, .12), transparent 70%); }
.control-demo .finger { position: absolute; top: 37px; left: 27%; color: var(--cyan); font-size: 25px; animation: demo-drag 2s ease-in-out infinite; }
.control-demo i { position: absolute; left: 32%; right: 32%; top: 49px; height: 1px; background: linear-gradient(90deg, var(--cyan), transparent); }
.mini-ship { position: absolute; left: 57%; top: 28px; width: 43px; height: 43px; background: linear-gradient(180deg, #c2fdff, #268eea); clip-path: polygon(50% 0, 66% 60%, 100% 90%, 52% 76%, 0 90%, 34% 60%); filter: drop-shadow(0 0 10px #45d9ff); }
.help-list { position: relative; display: grid; gap: 11px; margin: 15px 0; padding: 0; list-style: none; }
.help-list li { display: grid; grid-template-columns: 80px 1fr; gap: 9px; padding-bottom: 10px; border-bottom: 1px solid rgba(120, 183, 215, .1); }
.help-list b { color: #e4fbff; font-size: 11px; }.help-list span { color: #8ea8b9; font-size: 10px; line-height: 1.5; }
.compact-card { text-align: center; }.compact-card .button { display: block; }

.result-card { text-align: center; }
.result-stars { position: relative; display: flex; justify-content: center; gap: 10px; margin: 20px 0; }
.result-star { color: #253650; font-size: 45px; line-height: 1; text-shadow: none; transform: scale(.8); }
.result-star.earned { color: #ffe56c; text-shadow: 0 0 17px #ffa433; animation: star-in .5s cubic-bezier(.16,.9,.3,1.4) both; }
.result-star:nth-child(2) { animation-delay: .18s; }.result-star:nth-child(3) { animation-delay: .36s; }
.result-stats { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.result-stats div { padding: 11px; border: 1px solid rgba(103, 188, 226, .14); border-radius: 10px; background: rgba(2, 9, 25, .4); }
.result-stats dt { color: #7894a8; font-size: 8px; letter-spacing: .1em; }.result-stats dd { margin: 5px 0 0; color: #effdff; font: 850 15px/1 ui-monospace, monospace; }
.record-label { min-height: 18px; margin: 12px 0 2px !important; color: #ffdf64 !important; font-weight: 800; }

.ending-card { text-align: center; }
.ending-core { position: relative; width: 105px; height: 105px; margin: 0 auto 22px; animation: core-float 3s ease-in-out infinite; }
.ending-core i { position: absolute; inset: 14px; border: 2px solid var(--cyan); transform: rotate(45deg); box-shadow: 0 0 18px var(--cyan); }
.ending-core i:nth-child(2) { inset: 28px; border-color: var(--violet); animation: spin 4s linear infinite; }.ending-core i:nth-child(3) { inset: 42px; border: 0; background: #fff; box-shadow: 0 0 28px #fff; }
.ending-summary { padding: 10px; border: 1px solid rgba(96, 228, 255, .15); border-radius: 10px; font-family: ui-monospace, monospace; }

.toast { position: absolute; z-index: 60; left: 50%; bottom: calc(var(--safe-bottom) + 72px); width: max-content; max-width: calc(100% - 34px); transform: translate(-50%, 16px); padding: 10px 15px; border: 1px solid rgba(101, 232, 255, .4); border-radius: 100px; color: #eaffff; background: rgba(6, 17, 37, .91); font-size: 10px; text-align: center; opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(405deg); } }
@keyframes spin-reverse { to { transform: rotate(-315deg); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes count-pop { 0% { opacity: 0; transform: scale(1.8); } 30% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(.72); } }
@keyframes damage { 0%, 100% { opacity: 0; } 15% { opacity: 1; } }
@keyframes combo-pop { from { transform: scale(1.5); opacity: 0; } }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, 12px); } 18%, 72% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -12px); } }
@keyframes demo-drag { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(130px); } }
@keyframes star-in { from { opacity: 0; transform: scale(2.2) rotate(-25deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes core-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

@media (max-aspect-ratio: 9/16) {
  #game-shell { width: 100vw; height: 100vh; }
}

@media (min-aspect-ratio: 9/16) {
  #game-shell { width: 56.25vh; height: 100vh; }
}

@media (max-height: 650px) {
  .hero-copy { top: 9%; }
  .hero-copy h1 span { font-size: 34px; }.hero-copy h1 b { font-size: 40px; }
  .hero-lead { margin-top: 13px; line-height: 1.5; }
  .home-actions { margin-bottom: 13px; }
  .button--large { min-height: 56px; }
  .panel-screen { gap: 10px; }
  .level-grid { gap: 6px; }
  .modal-card { padding: 19px; }
  .control-demo { height: 70px; }.control-demo .finger { top: 24px; }.control-demo i { top: 36px; }.mini-ship { top: 15px; }
  .help-list { gap: 6px; }.help-list li { padding-bottom: 6px; }
}

@media (max-width: 420px) {
  .side-copy { display: none; }
  #game-shell { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

noscript { position: absolute; z-index: 100; inset: 0; display: grid; place-items: center; padding: 30px; color: #fff; background: #050817; text-align: center; }
