/* ==========================================================================
   IRON FRONT — interface
   ========================================================================== */

:root {
  --bg: #060b08;
  --bg-soft: #0a120d;
  --panel: #0c1510;
  --panel-raised: #111c15;
  --line: rgba(208, 193, 153, 0.16);
  --line-strong: rgba(208, 193, 153, 0.28);
  --ink: #f0e8d5;
  --ink-dim: #adb3a0;
  --muted: #77806f;
  --amber: #f2c14e;
  --amber-hot: #ffd36a;
  --amber-dark: #b8862c;
  --teal: #68d8b8;
  --danger: #ec6b4a;
  --font-ui: "Trebuchet MS", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-display: "Bahnschrift Condensed", "Arial Narrow", "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 15% -10%, rgba(190, 145, 56, 0.13), transparent 38%),
    radial-gradient(ellipse at 92% 105%, rgba(39, 112, 88, 0.14), transparent 44%),
    radial-gradient(ellipse at 50% 50%, rgba(13, 27, 19, 0.6), transparent 60%),
    var(--bg);
  font-family: var(--font-ui);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.page-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(210, 196, 157, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210, 196, 157, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse at center, #000 10%, transparent 76%);
}

.app {
  width: min(1100px, 94vw, calc((100svh - 200px) * 1.5));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 56px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--amber);
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(242, 193, 78, 0.1), transparent 55%),
    rgba(10, 18, 13, 0.85);
  box-shadow: inset 0 0 0 3px rgba(5, 10, 7, 0.8);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
}

.brand-mark svg {
  width: 28px;
  height: 28px;
}

.brand-copy {
  min-width: 0;
}

.brand-kicker {
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--muted);
  white-space: nowrap;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.brand-en {
  margin-left: 7px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.14em;
  vertical-align: 2px;
}

.hud {
  margin-left: auto;
  display: flex;
  align-items: stretch;
  min-height: 42px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    rgba(8, 15, 10, 0.72);
}

.hud-item {
  min-width: 76px;
  padding: 7px 13px 6px;
  border-left: 1px solid var(--line);
}

.hud-item:first-child {
  border-left: 0;
}

.hud-label {
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--muted);
  white-space: nowrap;
}

.hud-label em {
  margin-left: 3px;
  font-style: normal;
  opacity: 0.6;
}

.hud-item strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.hud-item--score strong {
  color: var(--amber);
}

.hud-item--lives strong {
  color: var(--teal);
}

.top-actions {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink-dim);
  background: rgba(8, 15, 10, 0.72);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-btn:hover:not(:disabled) {
  color: var(--amber);
  border-color: var(--line-strong);
  background: rgba(242, 193, 78, 0.06);
}

.icon-btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn .icon-muted,
.icon-btn .icon-play {
  display: none;
}

.icon-btn.is-muted .icon-unmuted,
.icon-btn.is-paused .icon-pause {
  display: none;
}

.icon-btn.is-muted .icon-muted,
.icon-btn.is-paused .icon-play {
  display: block;
}

/* --------------------------------------------------------------------------
   Game frame
   -------------------------------------------------------------------------- */

.game-shell {
  position: relative;
  padding: 5px;
  border: 1px solid #35402f;
  background: #0a100c;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(236, 220, 178, 0.035);
}

.game-shell::before,
.game-shell::after {
  content: "";
  position: absolute;
  z-index: 30;
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.game-shell::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--amber);
  border-left: 2px solid var(--amber);
}

.game-shell::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid var(--amber);
  border-bottom: 2px solid var(--amber);
}

.canvas-wrap {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #0b130e;
  isolation: isolate;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}

.canvas-grain {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.72;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 2px,
      rgba(1, 6, 3, 0.12) 3px,
      rgba(1, 6, 3, 0.12) 4px
    ),
    radial-gradient(ellipse at 50% 42%, transparent 42%, rgba(2, 7, 4, 0.44) 100%);
}

/* --------------------------------------------------------------------------
   Shared screens
   -------------------------------------------------------------------------- */

.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 240ms ease, visibility 240ms ease;
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.screen--menu {
  align-items: stretch;
  overflow-y: auto;
  background:
    linear-gradient(90deg, rgba(3, 8, 5, 0.97) 0%, rgba(3, 8, 5, 0.92) 44%, rgba(3, 8, 5, 0.5) 74%, rgba(3, 8, 5, 0.2) 100%),
    linear-gradient(0deg, rgba(3, 8, 5, 0.55), transparent 45%);
}

.screen--menu::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 0 72%, rgba(242, 193, 78, 0.045) 72% 72.2%, transparent 72.2%);
}

.screen--modal {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 7, 5, 0.72);
  backdrop-filter: blur(7px) saturate(0.7);
}

.menu-inner {
  position: relative;
  z-index: 2;
  width: min(690px, 100%);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(26px, 5vw, 58px);
}

.status-chip {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: clamp(16px, 2.4vw, 24px);
  padding: 6px 10px;
  border: 1px solid rgba(104, 216, 184, 0.24);
  background: rgba(16, 49, 38, 0.18);
  color: #a9c9b9;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.12em;
}

.status-chip i {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px rgba(104, 216, 184, 0.9);
  animation: status-pulse 2.1s ease-out infinite;
}

.status-chip span {
  color: #657c6e;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.title-lockup {
  position: relative;
}

.title-overline {
  margin: 0 0 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
}

.game-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(64px, 9.2vw, 104px);
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: -0.055em;
  color: var(--ink);
  text-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
}

.game-title span {
  color: var(--amber);
}

.game-title-en {
  margin: 11px 0 0;
  color: rgba(230, 220, 193, 0.29);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.55em;
}

.game-title-en span {
  color: var(--amber);
  animation: caret-blink 1.25s steps(1) infinite;
}

@keyframes caret-blink {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0; }
}

.menu-lead {
  max-width: 500px;
  margin: clamp(16px, 2.6vw, 25px) 0 0;
  color: #aeb5a3;
  font-size: 13px;
  line-height: 1.8;
  letter-spacing: 0.03em;
}

.menu-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: clamp(19px, 3vw, 30px);
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 13px 22px;
  border: 1px solid transparent;
  font-family: var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.btn--primary {
  min-width: 224px;
  color: #141a0d;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.24), transparent 40%),
    var(--amber);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow: 0 8px 28px rgba(242, 193, 78, 0.12);
}

.btn--primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -55%;
  width: 34%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
  transform: skewX(-20deg);
  transition: left 450ms ease;
}

.btn--primary:hover {
  background-color: var(--amber-hot);
  transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(242, 193, 78, 0.2);
}

.btn--primary:hover::before {
  left: 125%;
}

.btn--primary:active {
  transform: translateY(0);
}

.btn-copy {
  display: flex;
  align-items: baseline;
  gap: 13px;
  white-space: nowrap;
}

.btn-copy strong {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.btn-copy small {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  opacity: 0.58;
}

.btn-arrow {
  font-family: var(--font-mono);
  font-size: 19px;
  line-height: 1;
  transition: transform 180ms ease;
}

.btn--primary:hover .btn-arrow {
  transform: translateX(4px);
}

.btn--ghost {
  min-width: 132px;
  justify-content: center;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--line);
}

.btn--ghost:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
}

.btn--compact {
  min-width: 196px;
  padding: 11px 19px;
}

.btn:focus-visible,
.text-btn:focus-visible,
.icon-btn:focus-visible,
.touch-btn:focus-visible,
.fire-btn:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.best-score {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.best-score span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.best-score strong {
  color: #d8cfb9;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.controls-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 20px;
  margin-top: clamp(20px, 3vw, 30px);
  padding: 11px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.control-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.keycap {
  display: inline-grid;
  place-items: center;
  min-width: 23px;
  height: 21px;
  padding: 0 5px;
  border: 1px solid rgba(208, 193, 153, 0.2);
  border-bottom-color: rgba(208, 193, 153, 0.32);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.04em;
}

.keycap--wide {
  min-width: 44px;
}

.mission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-top: 16px;
  color: #616b5d;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.mission-meta em {
  color: var(--amber-dark);
  font-style: normal;
}

.menu-watermark {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: clamp(-18px, 1.2vw, 20px);
  transform: translateY(-50%);
  color: transparent;
  -webkit-text-stroke: 1px rgba(217, 201, 158, 0.14);
  font-family: var(--font-display);
  font-size: clamp(60px, 8vw, 110px);
  font-weight: 900;
  line-height: 0.78;
  letter-spacing: -0.03em;
  text-align: right;
  pointer-events: none;
}

.menu-corner {
  position: absolute;
  right: 18px;
  bottom: 14px;
  z-index: 2;
  color: rgba(208, 196, 165, 0.26);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.14em;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Pause & result
   -------------------------------------------------------------------------- */

.modal-card {
  position: relative;
  width: min(500px, 100%);
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(242, 193, 78, 0.055), transparent 38%),
    linear-gradient(180deg, #111b14, #0a110d);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.modal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 78px;
  height: 2px;
  background: var(--amber);
}

.screen-kicker {
  margin: 0 0 10px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.modal-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
}

.modal-desc {
  margin: 12px 0 0;
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 25px;
}

.modal-actions--row {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.text-btn {
  align-self: flex-start;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 160ms ease;
}

.text-btn:hover {
  color: var(--ink);
}

.result-card.is-victory .screen-kicker {
  color: var(--teal);
}

.result-card.is-victory::before {
  background: var(--teal);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 24px;
  border: 1px solid var(--line);
  background: var(--line);
}

.result-stats > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px 14px;
  background: #0b130e;
}

.result-stats span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.result-stats strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.result-stats > div:first-child strong {
  color: var(--amber);
}

/* --------------------------------------------------------------------------
   In-game overlays
   -------------------------------------------------------------------------- */

.boss-hud {
  position: absolute;
  z-index: 7;
  top: 15px;
  left: 50%;
  width: min(390px, 46%);
  padding: 8px 11px 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(236, 107, 74, 0.34);
  background: rgba(13, 8, 6, 0.84);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.boss-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 6px;
}

.boss-heading span {
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.12em;
  animation: status-pulse 1.1s ease-out infinite;
}

.boss-heading strong {
  color: #e7d7ca;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.boss-bar {
  height: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.boss-bar i {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, #a52f20, var(--danger), #ffb080);
  transition: transform 100ms linear;
}

.toast {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 22px;
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  transform: translate(-50%, 8px);
  border: 1px solid rgba(242, 193, 78, 0.3);
  background: rgba(7, 13, 9, 0.92);
  color: #e8ddc2;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.toast.is-danger {
  border-color: rgba(236, 107, 74, 0.42);
  color: #ffc6b1;
}

/* --------------------------------------------------------------------------
   Touch controls & footer
   -------------------------------------------------------------------------- */

.touch-controls {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: min(500px, 100%);
  margin: 2px auto 0;
  padding: 0 10px;
  user-select: none;
  touch-action: none;
}

.dpad {
  position: relative;
  display: grid;
  grid-template: repeat(3, 40px) / repeat(3, 40px);
  gap: 3px;
}

.touch-btn {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(208, 193, 153, 0.2);
  border-radius: 3px;
  background: rgba(16, 27, 20, 0.9);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-btn.is-active,
.touch-btn:active {
  color: #11170d;
  border-color: var(--amber);
  background: var(--amber);
}

.touch-up { grid-area: 1 / 2; }
.touch-left { grid-area: 2 / 1; }
.touch-right { grid-area: 2 / 3; }
.touch-down { grid-area: 3 / 2; }

.dpad-center {
  grid-area: 2 / 2;
  width: 8px;
  height: 8px;
  place-self: center;
  border: 1px solid rgba(208, 193, 153, 0.16);
  border-radius: 50%;
}

.fire-btn {
  width: 82px;
  height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid rgba(242, 193, 78, 0.5);
  border-radius: 50%;
  color: var(--amber);
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.08), transparent 45%),
    rgba(72, 45, 13, 0.28);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 0 0 5px rgba(8, 14, 9, 0.45);
}

.fire-btn small {
  color: var(--amber-dark);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.12em;
}

.fire-btn.is-active,
.fire-btn:active {
  color: #12180d;
  background: var(--amber);
}

.fire-btn.is-active small,
.fire-btn:active small {
  color: rgba(18, 24, 13, 0.58);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 24px;
  color: #5c6659;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.control-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 17px;
}

.control-hints kbd {
  color: #9ba391;
  font-family: inherit;
}

.build-mark {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #697266;
  white-space: nowrap;
}

.build-mark i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 6px rgba(104, 216, 184, 0.55);
}

.build-mark span {
  color: #454e43;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .app {
    width: min(940px, 95vw);
  }

  .brand-kicker,
  .menu-watermark {
    display: none;
  }

  .hud-item {
    min-width: 68px;
    padding-inline: 10px;
  }

  .hud-label em {
    display: none;
  }
}

@media (max-width: 760px) {
  body {
    align-items: flex-start;
    padding: 10px;
  }

  .app {
    width: 100%;
    gap: 8px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 8px 10px;
    min-height: 0;
  }

  .brand {
    gap: 9px;
  }

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

  .brand-mark svg {
    width: 23px;
    height: 23px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .brand-en {
    display: none;
  }

  .top-actions {
    margin-left: auto;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .hud {
    order: 3;
    width: 100%;
    margin-left: 0;
    min-height: 38px;
  }

  .hud-item {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 8px;
  }

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

  .hud-label {
    font-size: 7px;
    letter-spacing: 0.07em;
  }

  .hud-item--score {
    flex-grow: 1.35;
  }

  .game-shell {
    padding: 3px;
  }

  .game-shell::before,
  .game-shell::after {
    width: 15px;
    height: 15px;
  }

  .screen--menu {
    background:
      linear-gradient(180deg, rgba(3, 8, 5, 0.82), rgba(3, 8, 5, 0.94) 52%, rgba(3, 8, 5, 0.98));
  }

  .menu-inner {
    justify-content: flex-start;
    padding: clamp(17px, 5vw, 26px);
  }

  .status-chip {
    margin-bottom: 14px;
    font-size: 7px;
    padding: 5px 8px;
  }

  .title-overline {
    margin-bottom: 6px;
    font-size: 7px;
    letter-spacing: 0.16em;
  }

  .game-title {
    font-size: clamp(44px, 13.5vw, 68px);
  }

  .game-title-en {
    margin-top: 7px;
    font-size: 8px;
    letter-spacing: 0.36em;
  }

  .menu-lead {
    margin-top: 13px;
    font-size: 11px;
    line-height: 1.65;
  }

  .lead-break {
    display: none;
  }

  .menu-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 11px;
    margin-top: 15px;
  }

  .btn--primary {
    min-width: 0;
    width: 100%;
    padding: 11px 16px;
  }

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

  .best-score {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
    border-left: 0;
  }

  .best-score strong {
    font-size: 14px;
  }

  .controls-panel {
    gap: 8px 12px;
    margin-top: 14px;
    padding: 8px 0;
  }

  .control-item {
    font-size: 8px;
  }

  .keycap {
    height: 18px;
  }

  .mission-meta {
    display: none;
  }

  .menu-corner {
    display: none;
  }

  .screen--modal {
    padding: 14px;
  }

  .modal-card {
    padding: 22px 19px;
  }

  .modal-card h2 {
    font-size: 34px;
  }

  .modal-desc {
    font-size: 11px;
  }

  .modal-actions {
    margin-top: 18px;
    gap: 8px;
  }

  .result-stats {
    margin-top: 17px;
  }

  .result-stats > div {
    padding: 10px;
  }

  .result-stats span {
    font-size: 7px;
  }

  .btn--compact {
    min-width: 0;
    flex: 1;
  }

  .modal-actions--row {
    align-items: stretch;
    flex-direction: column;
  }

  .toast {
    bottom: 12px;
    font-size: 8px;
    padding: 6px 10px;
  }

  .boss-hud {
    top: 8px;
    width: 56%;
    padding: 5px 8px 7px;
  }

  .boss-heading span {
    font-size: 6px;
  }

  .boss-heading strong {
    font-size: 9px;
  }

  .touch-controls {
    display: flex;
    margin-top: 5px;
    padding: 0 6px;
  }

  .footer {
    display: none;
  }
}

@media (max-width: 440px) {
  .controls-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .game-title {
    font-size: clamp(40px, 14vw, 56px);
  }

  .screen--modal .modal-card {
    max-height: 100%;
    overflow-y: auto;
  }
}

@media (max-height: 620px) and (min-width: 761px) {
  .app {
    width: min(880px, 92vw, calc((100svh - 125px) * 1.5));
  }

  .menu-inner {
    padding-block: 20px;
  }

  .status-chip {
    margin-bottom: 10px;
  }

  .game-title {
    font-size: 64px;
  }

  .menu-lead {
    margin-top: 12px;
    line-height: 1.55;
  }

  .menu-actions {
    margin-top: 14px;
  }

  .controls-panel {
    margin-top: 14px;
    padding: 8px 0;
  }

  .mission-meta {
    display: none;
  }
}

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

  .footer {
    display: none;
  }
}

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

  .screen {
    transition-duration: 0.01ms;
  }
}
