:root {
  color-scheme: dark;
  --ink: #0b0e0e;
  --panel: #121616;
  --panel-raised: #191e1d;
  --line: #303735;
  --line-soft: #242a29;
  --text: #f2f4ef;
  --muted: #9da6a2;
  --mint: #73dfc6;
  --amber: #f0bd4f;
  --coral: #f06c5f;
  --blue: #6eb7d6;
  --header-height: 72px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

body {
  color: var(--text);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.game-shell {
  display: flex;
  width: 100%;
  height: 100dvh;
  min-height: 420px;
  flex-direction: column;
  background: var(--ink);
}

.mission-bar {
  position: relative;
  z-index: 20;
  display: grid;
  min-height: var(--header-height);
  grid-template-columns: minmax(190px, 1fr) auto minmax(92px, 1fr);
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  padding: 0 20px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #4a5552;
  border-radius: 5px;
  color: var(--mint);
  background: #171c1b;
}

.brand-mark svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
  stroke: none;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  color: var(--muted);
  font-size: 11px;
}

.hud-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(78px, 104px));
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.hud-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 0 15px;
  border-right: 1px solid var(--line-soft);
}

.hud-item:last-child {
  border-right: 0;
}

.hud-item span {
  color: var(--muted);
  font-size: 10px;
}

.hud-item strong {
  overflow: hidden;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-item.is-low strong {
  color: var(--coral);
}

.shield-meter {
  display: grid;
  width: 69px;
  height: 13px;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  transition:
    outline-color 160ms ease,
    box-shadow 160ms ease;
}

.shield-meter.has-guard {
  outline: 1px solid var(--blue);
  outline-offset: 3px;
  box-shadow: 0 0 10px rgba(110, 183, 214, 0.42);
}

.shield-meter i {
  display: block;
  border: 1px solid #36534c;
  background: var(--mint);
}

.shield-meter i.is-empty {
  border-color: #3b3e3d;
  background: #2a2e2d;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 18px;
}

.wallet-button {
  display: inline-flex;
  height: 38px;
  min-width: 66px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid #5d5134;
  border-radius: 5px;
  color: var(--amber);
  background: #211d14;
  cursor: pointer;
}

.wallet-button:hover {
  border-color: #8b7442;
  background: #2b2518;
}

.wallet-button svg {
  width: 17px;
  height: 17px;
}

.wallet-button strong {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.icon-button {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #cfd5d2;
  background: #171b1a;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    color 140ms ease,
    background-color 140ms ease;
}

.icon-button:hover:not(:disabled) {
  border-color: #52605d;
  color: var(--text);
  background: #202624;
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.icon-button .mute-line,
.icon-button .play-icon {
  display: none;
}

.icon-button.is-muted .sound-wave {
  display: none;
}

.icon-button.is-muted .mute-line,
.pause-button.is-paused .play-icon {
  display: block;
}

.pause-button.is-paused .pause-icon {
  display: none;
}

.bomb-button span {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  padding: 0 4px;
  border: 1px solid #8f7541;
  border-radius: 8px;
  color: #1a160e;
  background: var(--amber);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
}

.bomb-button:not(:disabled) {
  border-color: #6f623f;
  color: var(--amber);
}

.stage {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  background: var(--ink);
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.screen-layer {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background: rgba(8, 11, 10, 0.76);
  backdrop-filter: blur(2px);
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

.screen-layer.is-hidden {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.screen-content {
  width: min(620px, 100%);
  text-align: center;
}

.screen-kicker {
  margin: 0 0 12px;
  color: var(--mint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  font-weight: 700;
}

.screen-content h1 {
  margin: 0;
  color: #f8faf5;
  font-size: 50px;
  font-weight: 760;
  line-height: 1.12;
}

.screen-copy {
  margin: 12px 0 28px;
  color: #bac2be;
  font-size: 16px;
}

.briefing {
  display: grid;
  margin: 0 auto 30px;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #4c5653;
  border-bottom: 1px solid #4c5653;
}

.briefing > div {
  display: flex;
  min-width: 0;
  min-height: 76px;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-right: 1px solid #3a4240;
}

.briefing > div:last-child {
  border-right: 0;
}

.briefing span {
  color: var(--muted);
  font-size: 11px;
}

.briefing strong {
  overflow: hidden;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  display: inline-flex;
  min-width: 158px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid #8de9d3;
  color: #10231f;
  background: var(--mint);
}

.primary-button:hover {
  background: #8cebd5;
}

.primary-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: none;
}

.secondary-button {
  min-width: 122px;
  padding: 0 16px;
  border: 1px solid #56615e;
  color: #dde2df;
  background: #1a211f;
}

.secondary-button:hover {
  border-color: #77827f;
  background: #242c2a;
}

.chain-pop {
  position: absolute;
  z-index: 5;
  top: 24px;
  left: 50%;
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 8px 13px;
  border: 1px solid #5f593d;
  border-radius: 5px;
  color: #eadb9c;
  background: rgba(30, 28, 18, 0.9);
  transform: translateX(-50%);
  animation: chain-in 420ms ease-out;
  pointer-events: none;
}

.chain-pop span {
  font-size: 10px;
  font-weight: 700;
}

.chain-pop strong {
  color: var(--amber);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
}

@keyframes chain-in {
  from {
    opacity: 0;
    transform: translate(-50%, -9px) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.stage-alert {
  position: absolute;
  z-index: 6;
  top: 24px;
  right: 24px;
  max-width: min(300px, calc(100% - 48px));
  padding: 9px 13px;
  border-left: 3px solid var(--coral);
  color: #f2d2cf;
  background: rgba(41, 24, 23, 0.92);
  font-size: 11px;
  font-weight: 650;
  pointer-events: none;
}

.shop-layer {
  position: absolute;
  z-index: 15;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 10, 9, 0.84);
  backdrop-filter: blur(3px);
}

.shop-dialog {
  display: flex;
  width: min(650px, 100%);
  max-height: 100%;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #424c48;
  border-radius: 7px;
  background: #141918;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

.shop-header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.shop-header p {
  margin: 0 0 4px;
  color: var(--mint);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
}

.shop-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.shop-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-wallet {
  display: inline-flex;
  height: 35px;
  min-width: 72px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid #5d5134;
  border-radius: 5px;
  color: var(--amber);
  background: #211d14;
}

.shop-wallet svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.shop-wallet strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.shop-close {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #cbd1cd;
  background: #191f1d;
  cursor: pointer;
}

.shop-close:hover {
  border-color: #59645f;
  background: #232a27;
}

.shop-items {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 18px;
}

.shop-item {
  display: grid;
  min-width: 0;
  min-height: 92px;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #191f1d;
}

.shop-item-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #67583a;
  border-radius: 5px;
  color: var(--amber);
  background: #292217;
}

.shop-item-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.plane-shop-icon {
  border-color: #3d6672;
  color: var(--blue);
  background: #18272b;
}

.ammo-shop-icon {
  border-color: #3e6170;
  color: var(--blue);
  background: #17262c;
}

.repair-shop-icon {
  border-color: #3d6b5e;
  color: var(--mint);
  background: #172923;
}

.overdrive-shop-icon {
  border-color: #755f32;
  color: var(--amber);
  background: #292214;
}

.reward-shop-icon {
  border-color: #5a6840;
  color: #b9dc73;
  background: #202719;
}

.shield-module-shop-icon {
  border-color: #4f776b;
  color: #9ae8cf;
  background: #183029;
}

.ammo-boost-shop-icon {
  border-color: #54758d;
  color: #8fc9ec;
  background: #172a35;
}

.armor-chip-shop-icon {
  border-color: #8a6540;
  color: #ffc66d;
  background: #302318;
}

.bomb-pack-shop-icon {
  border-color: #8a4e49;
  color: #ff8b78;
  background: #321d1b;
}

.thunder-shop-icon {
  border-color: #7a5c36;
  color: var(--amber);
  background: #2a2116;
}

.shadow-shop-icon {
  border-color: #734a47;
  color: var(--coral);
  background: #291b1b;
}

.frost-shop-icon {
  border-color: #5d91a5;
  color: #c4f2ff;
  background: #18313b;
}

.nova-shop-icon {
  border-color: #a26045;
  color: #ffd15c;
  background: #3a211c;
}

.meteor-shop-icon {
  border-color: #6c5d94;
  color: #c4a8ff;
  background: #251f35;
}

.titan-shop-icon {
  border-color: #767b82;
  color: #d8dde2;
  background: #292d31;
}

.arc-shop-icon {
  border-color: #59799c;
  color: #83c5ff;
  background: #192a3a;
}

.lance-shop-icon {
  border-color: #6b7799;
  color: #d7e1ff;
  background: #202638;
}

.shop-item-copy {
  min-width: 0;
}

.shop-item-copy h3 {
  overflow: hidden;
  margin: 0 0 5px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-item-copy p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-item-copy p strong {
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.buy-button {
  display: inline-flex;
  min-width: 55px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid #806b3d;
  border-radius: 5px;
  color: var(--amber);
  background: #282217;
  cursor: pointer;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 750;
}

.buy-button:hover:not(:disabled) {
  border-color: #b08d46;
  background: #332a19;
}

.buy-button:disabled {
  cursor: default;
  opacity: 0.48;
}

.buy-button svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.plane-buy-button.is-owned {
  min-width: 64px;
  border-color: #426a73;
  color: var(--blue);
  background: #18282c;
  font-family: inherit;
}

.plane-buy-button.is-owned svg {
  display: none;
}

.shop-feedback {
  flex: 0 0 auto;
  min-height: 31px;
  margin: 0;
  padding: 0 18px 16px;
  color: #b9c2bd;
  font-size: 10px;
  text-align: right;
}

.shop-feedback.is-error {
  color: var(--coral);
}

.mobile-controls {
  position: absolute;
  z-index: 7;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  padding: 14px max(16px, env(safe-area-inset-right))
    calc(14px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  pointer-events: none;
}

.move-controls {
  display: flex;
  gap: 10px;
}

.control-button,
.fire-button {
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #ecf1ee;
  background: rgba(22, 28, 26, 0.9);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.control-button {
  width: 58px;
  height: 54px;
  border: 1px solid #4b5853;
}

.fire-button {
  width: 64px;
  height: 64px;
  border: 1px solid #91743b;
  color: var(--amber);
  background: rgba(48, 39, 20, 0.92);
}

.control-button.is-active {
  border-color: #7edbc5;
  background: rgba(37, 81, 70, 0.94);
}

.fire-button.is-active {
  border-color: #f4c866;
  background: rgba(83, 61, 20, 0.95);
}

@media (hover: none), (pointer: coarse) {
  .mobile-controls {
    display: flex;
  }

  #gameCanvas {
    cursor: default;
  }
}

@media (max-width: 980px) {
  .mission-bar {
    grid-template-columns: minmax(150px, 0.8fr) auto minmax(86px, 0.5fr);
  }

  .brand {
    padding: 0 14px;
  }

  .hud-metrics {
    grid-template-columns: repeat(5, minmax(68px, 86px));
  }

  .hud-item {
    padding: 0 10px;
  }

  .header-actions {
    padding: 0 12px;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 92px;
  }

  .game-shell {
    min-height: 460px;
  }

  .mission-bar {
    min-height: var(--header-height);
    grid-template-columns: 1fr auto;
    grid-template-rows: 44px 48px;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    padding: 0 12px;
  }

  .brand-mark {
    width: 29px;
    height: 29px;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .brand-copy small {
    font-size: 9px;
  }

  .header-actions {
    grid-column: 2;
    grid-row: 1;
    gap: 5px;
    padding: 0 9px;
  }

  .icon-button,
  .wallet-button {
    width: 32px;
    height: 32px;
  }

  .wallet-button {
    min-width: 52px;
    gap: 5px;
    padding: 0 7px;
  }

  .wallet-button svg {
    width: 15px;
    height: 15px;
  }

  .bomb-button span {
    top: -3px;
    right: -3px;
  }

  .hud-metrics {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--line);
    border-right: 0;
    border-left: 0;
  }

  .hud-item {
    padding: 0 9px;
  }

  .hud-item strong {
    font-size: 15px;
  }

  .shield-meter {
    width: min(58px, 100%);
    gap: 2px;
  }

  .screen-layer {
    padding: 18px 16px 94px;
  }

  .screen-content h1 {
    font-size: 38px;
  }

  .screen-copy {
    margin: 9px 0 19px;
    font-size: 14px;
  }

  .briefing {
    margin-bottom: 22px;
  }

  .briefing > div {
    min-height: 66px;
    padding: 8px;
  }

  .briefing strong {
    font-size: 12px;
  }

  .mobile-controls {
    display: flex;
  }

  .stage-alert {
    top: 12px;
    right: 12px;
  }

  .chain-pop {
    top: 12px;
  }

  .shop-layer {
    padding: 14px;
  }

  .shop-dialog {
    width: min(470px, 100%);
  }

  .shop-header {
    min-height: 66px;
    padding: 11px 13px;
  }

  .shop-header h2 {
    font-size: 19px;
  }

  .shop-items {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .shop-item {
    min-height: 72px;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    padding: 9px 10px;
  }

  .shop-item-icon {
    width: 40px;
    height: 40px;
  }

  .shop-feedback {
    padding: 0 12px 12px;
  }
}

@media (max-width: 440px) {
  .brand-copy small {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hud-item span {
    font-size: 9px;
  }

  .hud-item strong {
    font-size: 14px;
  }

  .screen-content h1 {
    font-size: 34px;
  }

  .screen-actions {
    gap: 8px;
  }

  .primary-button,
  .secondary-button {
    min-width: 0;
    padding: 0 14px;
  }

  .control-button {
    width: 53px;
    height: 50px;
  }

  .fire-button {
    width: 58px;
    height: 58px;
  }
}

@media (max-width: 360px) {
  .brand-copy {
    display: none;
  }

  .brand {
    gap: 0;
  }

  .shop-wallet {
    min-width: 62px;
  }
}

@media (max-height: 580px) and (min-width: 761px) {
  .screen-content h1 {
    font-size: 38px;
  }

  .screen-copy {
    margin: 8px 0 16px;
  }

  .briefing {
    margin-bottom: 18px;
  }

  .briefing > div {
    min-height: 58px;
  }
}

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