:root {
  --ink: #14284c;
  --cream: #fff7db;
  --yellow: #ffd34e;
  --orange: #ff7d3b;
  --pink: #ff5678;
  --mint: #4fe1b6;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #10274f; }
body { color: var(--ink); font-family: Arial, Helvetica, sans-serif; overflow: hidden; }
button, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 4px solid white; outline-offset: 3px; }
.hidden { display: none !important; }

.game-shell {
  width: 100%; min-height: 100vh; min-height: 100dvh; display: grid;
  grid-template-rows: 94px minmax(480px, 1fr) 45px; background: var(--cream);
}
.topbar {
  z-index: 50; display: grid; grid-template-columns: auto minmax(190px, .7fr) minmax(430px, 1.5fr) auto;
  align-items: center; gap: 20px; padding: 12px 28px; border-bottom: 4px solid var(--ink);
  background: rgba(255,247,219,.98); box-shadow: 0 7px 0 rgba(20,40,76,.12);
}
.home-link {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 13px; border: 3px solid var(--ink);
  border-radius: 13px; color: var(--ink); background: white; box-shadow: 3px 3px 0 var(--ink);
  text-decoration: none; font-size: 10px; font-weight: 1000; letter-spacing: 1.4px;
}
.home-link:hover { transform: translateY(-2px); }
.brand-block { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  position: relative; width: 55px; height: 55px; flex: 0 0 auto; border: 3px solid var(--ink);
  border-radius: 17px; background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); transform: rotate(-4deg);
}
.brand-mark::before, .brand-mark::after, .brand-mark i { content: ""; position: absolute; left: 50%; transform: translateX(-50%); }
.brand-mark::before { top: 8px; width: 13px; height: 31px; border: 3px solid var(--ink); border-radius: 50% 50% 35% 35%; background: var(--pink); }
.brand-mark::after { bottom: 5px; width: 24px; height: 12px; border: 3px solid var(--ink); background: var(--pink); clip-path: polygon(50% 0,100% 100%,0 100%); }
.brand-mark i { bottom: -5px; width: 7px; height: 14px; border-radius: 50%; background: var(--orange); }
.brand-block p { margin: 0 0 1px; color: #51709a; font-size: 9px; font-weight: 900; letter-spacing: 2.2px; }
.brand-block h1 { margin: 0; font-size: clamp(20px,2vw,29px); font-weight: 1000; letter-spacing: -1.4px; line-height: .9; transform: skew(-4deg); }

.hud {
  justify-self: center; width: min(600px,100%); height: 60px; display: flex; align-items: stretch;
  border: 3px solid var(--ink); border-radius: 18px; background: #fffdf2; box-shadow: 5px 5px 0 rgba(20,40,76,.18); overflow: hidden;
}
.hud-stat { min-width: 90px; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; border-right: 2px solid rgba(20,40,76,.15); }
.hud-stat:last-child { border-right: 0; }
.hud-stat > span { color: #61799b; font-size: 9px; font-weight: 900; letter-spacing: 1.8px; }
.hud-stat strong { font-size: 24px; font-weight: 1000; font-variant-numeric: tabular-nums; letter-spacing: 1px; line-height: 1.05; }
.hud-stat small { margin-left: 2px; color: #61799b; font-size: 11px; }
.hud-stat b { font: inherit; }
.score-stat strong { color: #ff476d; }
.time-stat { background: #fff6b8; }
.shield-row { display: flex; gap: 6px; margin-top: 4px; }
.shield-row i { width: 16px; height: 19px; display: block; border: 2px solid var(--ink); border-radius: 8px; background: var(--mint); clip-path: polygon(50% 0,100% 18%,88% 75%,50% 100%,12% 75%,0 18%); }
.shield-row i.off { background: #d8d6cb; opacity: .5; }
.top-actions { justify-self: end; display: flex; gap: 10px; }
.round-button {
  width: 48px; height: 48px; border: 3px solid var(--ink); border-radius: 50%; color: var(--ink); background: white;
  box-shadow: 3px 3px 0 var(--ink); cursor: pointer; font-size: 22px; font-weight: 1000; transition: transform .12s,box-shadow .12s;
}
.round-button:hover:not(:disabled) { transform: translateY(-2px); }
.round-button:active:not(:disabled) { transform: translate(3px,3px); box-shadow: none; }
.round-button:disabled { opacity: .42; cursor: default; }
.pause-button { background: var(--yellow); font-size: 18px; }

.sky-arena {
  position: relative; min-height: 480px; overflow: hidden; isolation: isolate; cursor: crosshair; touch-action: none; user-select: none;
  background: linear-gradient(105deg,rgba(255,255,255,.18) 0 11%,transparent 11% 25%,rgba(255,255,255,.11) 25% 37%,transparent 37%),linear-gradient(#37b4ef,#80dcf8 57%,#d6f8ff);
}
.sky-arena::before { content: ""; position: absolute; inset: 0; z-index: -3; opacity: .18; background-image: radial-gradient(#fff 1.2px,transparent 1.2px); background-size: 28px 28px; }
.sun-glow { position: absolute; top: -150px; right: 8%; z-index: -2; width: 430px; height: 430px; border-radius: 50%; background: radial-gradient(circle,rgba(255,255,222,.9),rgba(255,240,124,.35) 36%,transparent 70%); }
.speed-lines { position: absolute; inset: 0; z-index: -1; opacity: 0; background: repeating-linear-gradient(165deg,transparent 0 76px,rgba(255,255,255,.16) 77px 79px,transparent 80px 138px); animation: lines-slide 1.8s linear infinite; transition: opacity .3s; }
.sky-arena.playing .speed-lines { opacity: 1; }
.cloud { position: absolute; z-index: -1; height: 46px; border: 3px solid rgba(23,55,110,.22); border-radius: 40px; background: rgba(255,255,255,.8); filter: drop-shadow(0 9px 0 rgba(30,95,153,.08)); animation: cloud-drift 18s linear infinite; }
.cloud i { position: absolute; bottom: 12px; display: block; border: 3px solid rgba(23,55,110,.22); border-bottom: 0; border-radius: 50% 50% 0 0; background: rgba(255,255,255,.85); }
.cloud i:nth-child(1) { left: 20px; width: 47px; height: 52px; }
.cloud i:nth-child(2) { left: 61px; width: 65px; height: 70px; }
.cloud i:nth-child(3) { right: 18px; width: 48px; height: 46px; }
.cloud-one { top: 21%; left: -3%; width: 185px; opacity: .72; animation-duration: 24s; }
.cloud-two { top: 51%; right: 9%; width: 205px; opacity: .62; animation-delay: -11s; }
.cloud-three { top: 9%; left: 48%; width: 155px; opacity: .45; animation-duration: 31s; animation-delay: -20s; transform: scale(.7); }

.plane-wrap { position: absolute; z-index: 7; width: 78px; height: 50px; transform: translate(-50%,-50%); pointer-events: none; }
.plane-sprite { position: relative; width: 78px; height: 50px; display: block; filter: drop-shadow(0 5px 0 rgba(20,40,76,.22)); animation: plane-bob .65s ease-in-out infinite alternate; }
.plane-sprite.left { transform: scaleX(-1); }
.plane-body { position: absolute; top: 19px; left: 5px; z-index: 3; width: 70px; height: 19px; display: block; border: 3px solid var(--ink); border-radius: 65% 80% 55% 50%; background: #ff6e88; clip-path: polygon(0 28%,73% 5%,100% 46%,76% 85%,20% 100%); }
.cockpit { position: absolute; top: -10px; left: 39px; width: 18px; height: 14px; display: block; border: 3px solid var(--ink); border-radius: 50% 70% 15% 15%; background: #d9fbff; }
.wing { position: absolute; left: 25px; z-index: 2; width: 31px; height: 22px; display: block; border: 3px solid var(--ink); background: var(--yellow); clip-path: polygon(20% 0,100% 72%,85% 100%,0 65%); }
.wing-top { top: 3px; }
.wing-bottom { top: 29px; transform: scaleY(-1); }
.plane-sprite em { position: absolute; top: -17px; left: 28px; z-index: 5; padding: 2px 6px; border: 2px solid var(--ink); border-radius: 10px; color: var(--ink); background: #fffdf3; font-size: 9px; font-style: normal; font-weight: 1000; }
.plane-wrap.jet .plane-body { background: #a96eff; }
.plane-wrap.jet .wing { background: #62e3c0; }
.plane-wrap.jet .plane-sprite { scale: 1.08; }
.plane-wrap.ace .plane-body { background: #ffb52f; }
.plane-wrap.ace .wing { background: #ff5372; }
.plane-wrap.ace .plane-sprite { scale: 1.16; }

.giant-missile { position: absolute; z-index: 14; width: 42px; height: 92px; transform-origin: 50% 50%; pointer-events: none; filter: drop-shadow(0 8px 0 rgba(20,40,76,.26)); }
.missile-core { position: absolute; left: 7px; top: 3px; z-index: 2; width: 28px; height: 70px; display: block; border: 3px solid var(--ink); border-radius: 50% 50% 28% 28%; background: linear-gradient(90deg,#fff4d8 0 23%,#ff5b73 24% 78%,#bd304f 79%); }
.missile-core b { position: absolute; top: 31px; left: 5px; width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 50%; background: #baf4ff; }
.missile-fin { position: absolute; top: 52px; z-index: 1; width: 19px; height: 28px; display: block; border: 3px solid var(--ink); background: var(--yellow); }
.missile-fin.left { left: 0; clip-path: polygon(100% 0,100% 100%,0 100%,30% 30%); }
.missile-fin.right { right: 0; clip-path: polygon(0 0,100% 100%,0 100%); }
.missile-flame { position: absolute; left: 14px; bottom: -13px; width: 14px; height: 31px; display: block; border: 3px solid var(--ink); border-radius: 20% 20% 50% 50%; background: linear-gradient(var(--yellow) 0 36%,#ff6a3d 37% 72%,#ff3b69 73%); animation: flame .1s linear infinite alternate; }

.burst { position: absolute; z-index: 18; width: 100px; height: 100px; pointer-events: none; transform: translate(-50%,-50%); }
.burst::before, .burst::after, .burst i { content: ""; position: absolute; inset: 12px; border: 4px solid var(--ink); background: var(--yellow); clip-path: polygon(50% 0,61% 31%,86% 14%,73% 40%,100% 50%,70% 61%,86% 86%,60% 72%,50% 100%,40% 71%,14% 86%,29% 60%,0 50%,30% 40%,14% 14%,40% 29%); animation: burst-pop .45s ease-out both; }
.burst::after { inset: 26px; background: #fff9d8; animation-delay: .03s; }
.burst i { inset: -3px; border: 0; background: rgba(255,255,255,.7); }
.burst.miss { width: 56px; height: 56px; filter: saturate(.25); }
.burst strong { position: absolute; top: -20px; left: 50%; z-index: 5; color: white; font-size: 24px; font-weight: 1000; white-space: nowrap; text-shadow: -2px -2px 0 var(--ink),2px -2px 0 var(--ink),-2px 2px 0 var(--ink),3px 3px 0 var(--ink); transform: translateX(-50%); animation: score-float .45s ease-out both; }

.crosshair { position: absolute; left: 50%; top: 46%; z-index: 20; width: 48px; height: 48px; border: 3px solid rgba(255,255,255,.9); border-radius: 50%; pointer-events: none; transform: translate(-50%,-50%); filter: drop-shadow(2px 2px 0 var(--ink)); }
.crosshair::before, .crosshair::after, .crosshair i, .crosshair b { content: ""; position: absolute; display: block; background: white; }
.crosshair::before { left: 50%; top: -9px; width: 3px; height: 16px; transform: translateX(-50%); }
.crosshair::after { left: 50%; bottom: -9px; width: 3px; height: 16px; transform: translateX(-50%); }
.crosshair i { top: 50%; left: -9px; width: 16px; height: 3px; transform: translateY(-50%); }
.crosshair b { top: 50%; right: -9px; width: 16px; height: 3px; transform: translateY(-50%); }
.combo-pill { position: absolute; top: 22px; left: 24px; z-index: 25; display: flex; align-items: center; gap: 7px; padding: 7px 12px; border: 3px solid var(--ink); border-radius: 15px; background: rgba(255,255,255,.82); box-shadow: 3px 3px 0 rgba(20,40,76,.22); opacity: .55; transition: transform .2s,opacity .2s; }
.combo-pill.active { opacity: 1; background: var(--yellow); transform: scale(1.08) rotate(-2deg); }
.combo-pill span { font-size: 9px; font-weight: 1000; letter-spacing: 1.4px; }
.combo-pill strong { color: var(--pink); font-size: 20px; font-weight: 1000; }

.ground { position: absolute; inset: auto 0 0; z-index: 2; height: 120px; overflow: hidden; pointer-events: none; background: linear-gradient(transparent 0 42%,#45d2a5 43%); }
.hill { position: absolute; bottom: -96px; width: 420px; height: 180px; border: 4px solid var(--ink); border-radius: 50%; background: #79e39d; }
.hill-left { left: -100px; }
.hill-right { right: -70px; bottom: -115px; background: #52cf91; }
.city { position: absolute; right: 10%; bottom: 29px; display: flex; align-items: end; gap: 5px; }
.city i { width: 18px; height: 38px; display: block; border: 3px solid var(--ink); background: #8a72dd; box-shadow: inset 5px 8px 0 rgba(255,255,255,.24); }
.city i:nth-child(2n) { height: 60px; background: #ff7e79; }
.city i:nth-child(3n) { height: 82px; background: #ffd350; }
.launcher { position: absolute; bottom: 10px; left: 50%; z-index: 28; width: 132px; height: 115px; pointer-events: none; transform: translateX(-50%); filter: drop-shadow(0 8px 0 rgba(20,40,76,.22)); }
.launcher-barrel { position: absolute; bottom: 34px; left: 50%; z-index: 1; width: 32px; height: 90px; border: 4px solid var(--ink); border-radius: 15px 15px 5px 5px; background: linear-gradient(90deg,#fff3bd 0 20%,#ff536f 21% 76%,#c72d50 77%); transform-origin: 50% 100%; translate: -50% 0; transition: transform .08s linear; }
.launcher-barrel i { position: absolute; left: -4px; bottom: 22px; width: 32px; height: 11px; border-block: 3px solid var(--ink); background: var(--yellow); }
.launcher-base { position: absolute; bottom: 0; left: 50%; z-index: 2; width: 118px; height: 65px; border: 4px solid var(--ink); border-radius: 55px 55px 16px 16px; background: var(--yellow); transform: translateX(-50%); }
.launcher-base::before, .launcher-base::after { content: ""; position: absolute; bottom: -7px; width: 27px; height: 16px; border: 4px solid var(--ink); border-radius: 5px; background: #ff5b74; }
.launcher-base::before { left: 13px; }
.launcher-base::after { right: 13px; }
.launcher-base i { position: absolute; left: 45px; top: 13px; width: 20px; height: 20px; border: 3px solid var(--ink); border-radius: 50%; background: #baf4ff; }
.launcher-base b { position: absolute; right: 14px; top: 21px; width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 50%; background: var(--mint); }

.game-overlay { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; cursor: default; background: linear-gradient(90deg,rgba(19,48,97,.12),rgba(19,48,97,.02)); }
.intro-card, .pause-card, .results-card { width: min(530px,92vw); padding: 34px 48px 31px; border: 4px solid var(--ink); border-radius: 34px; text-align: center; background: rgba(255,250,230,.96); box-shadow: 13px 13px 0 rgba(20,40,76,.27); transform: rotate(-.6deg); }
.mission-tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border: 2px solid var(--ink); border-radius: 12px; background: var(--yellow); font-size: 10px; font-weight: 1000; letter-spacing: 2px; box-shadow: 3px 3px 0 var(--ink); }
.mission-tag i { width: 8px; height: 8px; border: 2px solid var(--ink); border-radius: 50%; background: var(--pink); }
.intro-card h2, .pause-card h2, .results-card h2 { margin: 17px 0 12px; font-size: clamp(40px,6vw,66px); font-weight: 1000; letter-spacing: -4px; line-height: .83; text-shadow: 3px 3px 0 white,6px 6px 0 rgba(20,40,76,.1); transform: skew(-4deg); }
.intro-card h2 em { color: var(--pink); font-style: normal; }
.intro-card p { margin: 18px 0 22px; color: #49658d; font-size: 15px; font-weight: 700; line-height: 1.55; }
.launch-button { width: min(340px,100%); height: 61px; display: inline-flex; align-items: center; justify-content: space-between; padding: 0 9px 0 24px; border: 3px solid var(--ink); border-radius: 18px; color: white; background: var(--pink); box-shadow: 6px 6px 0 var(--ink); cursor: pointer; font-size: 14px; font-weight: 1000; letter-spacing: 1.5px; transition: transform .12s,box-shadow .12s; }
.launch-button i { width: 42px; height: 42px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 12px; color: var(--ink); background: var(--yellow); font-size: 25px; font-style: normal; }
.launch-button:hover { transform: translateY(-3px); }
.launch-button:active { transform: translate(5px,5px); box-shadow: 1px 1px 0 var(--ink); }
.control-hints { display: flex; justify-content: center; gap: 23px; margin-top: 24px; color: #5b7191; font-size: 9px; font-weight: 1000; letter-spacing: 1px; }
.control-hints span { display: flex; align-items: center; gap: 6px; }
.control-hints i { width: 21px; height: 21px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 5px; color: var(--ink); background: white; font-style: normal; }
.mouse-icon { border-radius: 50% 50% 7px 7px !important; }
#pause-overlay, #results-overlay { background: rgba(20,40,76,.32); backdrop-filter: blur(5px); }
.pause-card, .results-card { width: min(500px,92vw); padding-block: 40px; }
.pause-card h2 { font-size: clamp(37px,5vw,56px); margin-bottom: 27px; }
.results-card h2 { color: var(--pink); font-size: clamp(41px,5vw,60px); margin-block: 20px 25px; }
.result-line { display: flex; align-items: center; justify-content: space-between; max-width: 340px; margin: 0 auto; padding: 10px 14px; border-bottom: 2px solid rgba(20,40,76,.16); }
.result-line span { color: #61799b; font-size: 10px; font-weight: 1000; letter-spacing: 1.5px; }
.result-line strong { color: var(--pink); font-size: 29px; font-weight: 1000; font-variant-numeric: tabular-nums; }
.result-line b { font-size: 18px; font-variant-numeric: tabular-nums; }
.results-card .launch-button { margin-top: 24px; }
.mission-footer { z-index: 50; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; border-top: 4px solid var(--ink); background: var(--cream); font-size: 10px; font-weight: 800; letter-spacing: .6px; }
.mission-footer p { margin: 0; }
.mission-footer p:first-child { display: flex; align-items: center; gap: 7px; }
.mission-footer p:first-child i { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 3px rgba(255,86,120,.2); }
.mission-footer p:last-child { color: #67809e; font-size: 8px; letter-spacing: 1.6px; }
.mission-footer p:last-child span { color: var(--pink); }

@keyframes cloud-drift { 0%,100% { translate: 0 0; } 50% { translate: 55px 3px; } }
@keyframes lines-slide { from { background-position: 0 0; } to { background-position: 190px 80px; } }
@keyframes plane-bob { from { translate: 0 -2px; } to { translate: 0 3px; } }
@keyframes flame { from { scale: .82 1; } to { scale: 1.08 1.22; } }
@keyframes burst-pop { 0% { scale: .2; rotate: 0deg; } 70% { scale: 1.2; rotate: 12deg; } 100% { scale: .95; rotate: 18deg; } }
@keyframes score-float { from { translate: -50% 18px; scale: .7; } to { translate: -50% -24px; scale: 1.15; } }

@media (max-width: 1000px) {
  body { overflow: auto; }
  .game-shell { grid-template-rows: auto minmax(550px,1fr) 42px; }
  .topbar { grid-template-columns: auto 1fr auto; grid-template-areas: "home brand actions" "hud hud hud"; gap: 10px; padding: 10px 16px 13px; }
  .home-link { grid-area: home; }
  .brand-block { grid-area: brand; }
  .top-actions { grid-area: actions; }
  .hud { grid-area: hud; width: 100%; height: 54px; }
  .hud-stat { min-width: 0; }
  .hud-stat strong { font-size: 20px; }
  .mission-footer { padding-inline: 15px; }
}

@media (max-width: 600px) {
  .game-shell { grid-template-rows: auto minmax(510px,1fr) 38px; }
  .topbar { padding-inline: 9px; }
  .home-link { padding: 8px 9px; font-size: 0; }
  .home-link span { font-size: 19px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 13px; }
  .brand-mark::before { height: 24px; width: 10px; }
  .brand-mark::after { width: 19px; height: 10px; }
  .brand-block p { display: none; }
  .brand-block h1 { font-size: 20px; }
  .round-button { width: 40px; height: 40px; }
  .hud-stat > span { font-size: 7px; letter-spacing: 1px; }
  .hud-stat strong { font-size: 17px; }
  .wave-stat { display: none; }
  .shield-row { gap: 3px; }
  .shield-row i { width: 13px; height: 16px; }
  .intro-card, .pause-card, .results-card { padding: 29px 19px 27px; border-radius: 25px; }
  .intro-card h2 { font-size: 43px; letter-spacing: -3px; }
  .intro-card p { font-size: 13px; }
  .control-hints { flex-direction: column; align-items: center; gap: 8px; margin-top: 18px; }
  .plane-wrap { transform: translate(-50%,-50%) scale(.88); }
  .launcher { transform: translateX(-50%) scale(.82); transform-origin: bottom center; }
  .city { right: 2%; transform: scale(.7); transform-origin: bottom right; }
  .mission-footer { justify-content: center; font-size: 8px; text-align: center; }
  .mission-footer p:last-child { display: none; }
  .combo-pill { top: 12px; left: 12px; scale: .85; transform-origin: top left; }
}

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