:root {
  --bg: #03060b;
  --bg-2: #071018;
  --ink: #e8f2f4;
  --ink-dim: #8da3ac;
  --ink-faint: #556c76;
  --pearl: #f4efe2;
  --cyan: #8fe8ff;
  --cyan-2: #4db7d2;
  --cyan-dim: rgba(143, 232, 255, .28);
  --orange: #ff8a3d;
  --orange-hot: #ffd08a;
  --orange-deep: #c95b1d;
  --red: #ff4d4d;
  --violet: #b06cff;
  --panel: rgba(3, 10, 17, .78);
  --panel-2: rgba(5, 14, 23, .92);
  --line: rgba(143, 232, 255, .22);
  --line-bright: rgba(143, 232, 255, .62);
  --line-orange: rgba(255, 138, 61, .55);
  --display: "Bahnschrift", "DIN Alternate", "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --body: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: rgba(0, 0, 0, .18); }
*::-webkit-scrollbar-thumb { background: rgba(143, 232, 255, .22); }
*::-webkit-scrollbar-thumb:hover { background: rgba(143, 232, 255, .4); }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}
button, input { font: inherit; }
button { color: inherit; }
img, svg, canvas { display: block; }
.hidden { display: none !important; }

#app {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 72% 38%, rgba(45, 96, 130, .12), transparent 55%),
    radial-gradient(ellipse at 22% 78%, rgba(160, 75, 28, .08), transparent 50%),
    var(--bg);
  overflow: hidden;
}
#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  outline: none;
}
#app.in-battle #game { cursor: none; }

/* ============ generic UI ============ */
.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--cyan);
  opacity: .85;
}
h1, h2, h3, p { margin: 0; }
h2 {
  font-family: var(--display);
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: 1;
  letter-spacing: .04em;
  font-weight: 800;
  color: var(--pearl);
}
.screen-lead {
  max-width: 440px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-dim);
  text-align: right;
}
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 26px;
  padding: 0 8px;
  margin-right: 4px;
  border: 1px solid var(--line);
  background: rgba(143, 232, 255, .06);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .03em;
  white-space: nowrap;
}

/* ============ buttons ============ */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 11px 17px;
  border: 0;
  color: var(--ink);
  background: linear-gradient(100deg, rgba(9, 23, 33, .96), rgba(7, 16, 24, .68));
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 0 100%);
  font-size: 13px;
  letter-spacing: .12em;
  text-align: left;
  cursor: pointer;
  transition: background .18s, box-shadow .18s, transform .18s, color .18s;
  outline: none;
}
.btn::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 6px;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--line-bright);
  border-right: 1px solid var(--line-bright);
  opacity: .6;
}
.btn:hover, .btn:focus-visible {
  background: linear-gradient(100deg, rgba(14, 38, 53, .98), rgba(9, 24, 35, .82));
  box-shadow: inset 0 0 0 1px var(--line-bright), 0 0 26px rgba(90, 210, 240, .1);
  transform: translateX(3px);
}
.btn:active { transform: translateX(1px) translateY(1px); }
.btn.primary {
  color: #180d06;
  background: linear-gradient(100deg, #ffb168, #ff7a2e 52%, #d9561a);
  box-shadow: inset 0 0 0 1px rgba(255, 220, 170, .42), 0 0 34px rgba(255, 122, 46, .18);
  font-weight: 700;
}
.btn.primary:hover, .btn.primary:focus-visible {
  background: linear-gradient(100deg, #ffd09a, #ff984c 52%, #ff6c28);
  box-shadow: inset 0 0 0 1px rgba(255, 240, 210, .6), 0 0 42px rgba(255, 122, 46, .3);
}
.btn small {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .18em;
  color: var(--ink-faint);
  font-weight: 400;
}
.lock-note {
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .1em;
  color: #ff8a7a;
  opacity: .85;
}
.btn.primary small { color: rgba(34, 16, 4, .55); }
.btn-index {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--orange);
  letter-spacing: .08em;
}
.btn.primary .btn-index { color: rgba(34, 16, 4, .55); }
.btn.ghost { background: rgba(4, 11, 18, .6); }
.btn.small { min-height: 36px; padding: 8px 12px; font-size: 11px; }
.btn.danger { color: #ffb4a8; box-shadow: inset 0 0 0 1px rgba(255, 90, 70, .35); }
.btn.danger:hover { box-shadow: inset 0 0 0 1px rgba(255, 100, 80, .7), 0 0 24px rgba(255, 60, 40, .12); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none !important; }

.icon-btn {
  width: 34px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(3, 11, 18, .66);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.icon-btn:hover { border-color: var(--line-bright); background: rgba(16, 40, 52, .7); }
.icon-btn.muted { color: var(--ink-faint); }

/* ============ screens ============ */
#screens {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4.2vh 5.5vw;
  overflow-y: auto;
  pointer-events: auto;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(26, 68, 87, .16), transparent 58%),
    linear-gradient(180deg, rgba(2, 6, 11, .72), rgba(2, 6, 11, .9));
  z-index: 20;
}
.screen-inner {
  position: relative;
  width: min(1120px, 94vw);
  max-height: 92vh;
  overflow: auto;
  padding: clamp(24px, 3.4vw, 52px);
  background:
    linear-gradient(135deg, rgba(7, 19, 28, .94), rgba(3, 9, 15, .97) 60%),
    var(--panel-2);
  box-shadow:
    inset 0 0 0 1px rgba(143, 232, 255, .2),
    inset 0 1px 0 rgba(255, 255, 255, .05),
    0 30px 90px rgba(0, 0, 0, .55);
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 26px 100%, 0 calc(100% - 26px));
  animation: screenIn .38s cubic-bezier(.2, .7, .2, 1) both;
}
.screen-inner.narrow { width: min(760px, 92vw); }
.screen-inner::before {
  content: "";
  position: absolute;
  left: 0;
  right: 26px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--orange), rgba(143, 232, 255, .35), transparent 80%);
}
.screen-inner::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 42px;
  height: 42px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px) scale(.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.screen-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(143, 232, 255, .14);
}
.screen-head h2 { margin-top: 8px; }
.screen-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.screen-actions .btn { min-width: 128px; justify-content: center; }
.refit-summary {
  margin-right: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--ink-faint);
}

/* ============ menu ============ */
.menu-screen {
  justify-content: flex-start;
  align-items: center;
  padding-left: clamp(34px, 7vw, 110px);
  background: transparent;
  overflow: hidden;
}
.menu-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 5, 10, .96) 0%, rgba(2, 5, 10, .84) 28%, rgba(2, 5, 10, .15) 62%, rgba(2, 5, 10, .5) 100%),
    linear-gradient(0deg, rgba(2, 5, 10, .75), transparent 35%);
  pointer-events: none;
}
.menu-content {
  position: relative;
  z-index: 2;
  width: min(620px, 52vw);
  animation: menuIn .8s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.menu-kicker {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .22em;
  color: var(--cyan);
  opacity: .8;
  margin-bottom: 24px;
}
.menu-kicker::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--orange);
}
.menu-kicker span { color: var(--ink-faint); }
.menu-screen h1 {
  font-family: var(--display);
  font-size: clamp(50px, 7.6vw, 108px);
  line-height: .84;
  letter-spacing: .015em;
  font-weight: 800;
  color: var(--pearl);
  text-shadow: 0 0 48px rgba(143, 232, 255, .08);
}
.menu-screen h1 em {
  font-style: normal;
  color: transparent;
  background: linear-gradient(92deg, #ffd9a5, var(--orange) 38%, #e36222 72%, #8e3816);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(255, 122, 46, .12));
}
.menu-sub {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--ink-dim);
}
.menu-sub b { color: var(--cyan); font-weight: 500; }
.menu-sub i { color: var(--orange); font-style: normal; }
.menu-sub span { color: var(--ink-faint); }
.menu-blurb {
  margin-top: 22px;
  font-size: 13px;
  line-height: 1.9;
  color: #9bb0b8;
  max-width: 380px;
}
.menu-buttons {
  display: grid;
  gap: 8px;
  width: min(420px, 100%);
  margin-top: 30px;
}
.menu-versions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: min(420px, 100%);
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .12em;
  color: var(--ink-faint);
}
.version-label { margin-right: 4px; opacity: .65; }
.version-link {
  padding: 6px 9px;
  border: 1px solid rgba(143, 232, 255, .16);
  color: rgba(175, 215, 215, .7);
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.version-link:hover { border-color: rgba(107, 255, 200, .5); color: var(--hud-green); }
.version-link.active {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(255, 138, 61, .08);
}
.menu-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(420px, 100%);
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .12em;
  color: var(--ink-faint);
}
.menu-ship-tag {
  position: absolute;
  right: 4.5vw;
  bottom: 10vh;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
  padding-right: 12px;
  opacity: .85;
}
.menu-ship-tag .tag-line {
  width: 140px;
  height: 1px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, transparent, var(--orange));
}
.menu-ship-tag b {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: .18em;
  color: var(--pearl);
}
.menu-ship-tag small {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .14em;
  line-height: 1.6;
  color: var(--ink-faint);
}
.menu-scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(160, 230, 255, .022) 3px 4px);
  pointer-events: none;
  z-index: 3;
  animation: scanShift 9s linear infinite;
}
@keyframes scanShift {
  from { background-position-y: 0; }
  to { background-position-y: 80px; }
}

/* ============ campaign ============ */
.mission-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.mission-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 270px;
  padding: 22px 20px;
  border: 0;
  color: var(--ink);
  text-align: left;
  background:
    linear-gradient(160deg, rgba(13, 31, 43, .9), rgba(4, 11, 18, .86)),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(143, 232, 255, .025) 39px 40px);
  box-shadow: inset 0 0 0 1px rgba(143, 232, 255, .14);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s;
  overflow: hidden;
}
.mission-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 0;
  background: var(--orange);
  transition: height .25s;
}
.mission-card:hover:not(:disabled) {
  transform: translateY(-4px);
  box-shadow: inset 0 0 0 1px rgba(255, 138, 61, .45), 0 22px 50px rgba(0, 0, 0, .35);
  background: linear-gradient(160deg, rgba(21, 45, 58, .92), rgba(6, 16, 24, .9));
}
.mission-card:hover:not(:disabled)::before { height: 100%; }
.mission-card:disabled { opacity: .42; cursor: not-allowed; filter: saturate(.5); }
.mission-num {
  font-family: var(--mono);
  font-size: 34px;
  line-height: 1;
  color: var(--orange);
  opacity: .9;
}
.mission-status {
  position: absolute;
  top: 22px;
  right: 18px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .18em;
  color: var(--cyan);
  padding: 4px 6px;
  border: 1px solid rgba(143, 232, 255, .24);
}
.mission-card:disabled .mission-status { color: var(--ink-faint); border-color: rgba(120, 140, 148, .2); }
.mission-title {
  margin-top: 30px;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--pearl);
}
.mission-en {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .2em;
  color: var(--cyan-2);
}
.mission-desc {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-dim);
}
.mission-meta {
  margin-top: auto;
  padding-top: 18px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .07em;
  color: var(--ink-faint);
}
.mission-meta i { color: var(--orange); font-style: normal; margin: 0 4px; }
.mission-arrow {
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: var(--orange);
  font-size: 18px;
  opacity: .5;
  transition: transform .2s, opacity .2s;
}
.mission-card:hover:not(:disabled) .mission-arrow { transform: translateX(4px); opacity: 1; }

/* ============ briefing ============ */
.briefing-head { position: relative; padding-bottom: 20px; margin-bottom: 26px; border-bottom: 1px solid rgba(143, 232, 255, .14); }
.briefing-id {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--orange);
}
.briefing-id small { color: var(--ink-faint); }
.briefing-head h2 {
  margin-top: 12px;
  font-size: clamp(34px, 4.4vw, 60px);
}
.briefing-head > p {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--ink-dim);
}
.briefing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .9fr);
  gap: clamp(24px, 4vw, 52px);
}
.briefing-story > p {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.95;
  color: #aec1c7;
}
.radio-quote {
  margin: 24px 0;
  padding: 12px 0 12px 18px;
  border-left: 1px solid var(--orange);
  font-size: 13px;
  line-height: 1.8;
  font-style: italic;
  color: #d6c3a8;
}
.radio-quote::before { content: "◈ "; color: var(--orange); font-style: normal; }
.ship-dossier {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 28px;
  padding: 16px;
  background: rgba(143, 232, 255, .035);
  border: 1px solid rgba(143, 232, 255, .12);
}
.dossier-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  position: relative;
  border: 1px solid rgba(255, 138, 61, .35);
  transform: rotate(45deg) scale(.68);
}
.dossier-mark::before, .dossier-mark::after {
  content: "";
  position: absolute;
  background: var(--orange);
}
.dossier-mark::before { width: 1px; height: 100%; left: 50%; top: 0; }
.dossier-mark::after { height: 1px; width: 100%; top: 50%; left: 0; }
.ship-dossier b { display: block; font-family: var(--display); font-size: 14px; letter-spacing: .1em; color: var(--pearl); }
.ship-dossier span { display: block; margin-top: 4px; font-size: 11px; color: var(--cyan-2); }
.ship-dossier small { display: block; margin-top: 6px; font-family: var(--mono); font-size: 8px; line-height: 1.6; color: var(--ink-faint); }
.briefing-meta { display: flex; flex-direction: column; gap: 18px; }
.meta-block {
  padding: 16px 18px;
  background: rgba(2, 8, 14, .45);
  border-top: 1px solid rgba(143, 232, 255, .16);
}
.meta-block h3 {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .18em;
  color: var(--cyan);
  margin-bottom: 10px;
}
.meta-block ul { margin: 0; padding: 0; list-style: none; }
.meta-block li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 7px;
  font-size: 12px;
  line-height: 1.55;
  color: #b8c9cf;
}
.meta-block li::before { content: "▸"; position: absolute; left: 0; color: var(--orange); font-size: 9px; top: 2px; }
.meta-block p { font-size: 12px; line-height: 1.7; color: #aebfc5; }
.meta-block small { display: block; margin-top: 8px; font-size: 9px; color: var(--ink-faint); }
.difficulty-row { display: flex; gap: 6px; }
.diff-btn {
  flex: 1;
  padding: 7px 8px;
  border: 1px solid rgba(143, 232, 255, .16);
  background: transparent;
  color: var(--ink-dim);
  font-size: 10px;
  letter-spacing: .1em;
  cursor: pointer;
}
.diff-btn.active { border-color: var(--orange); color: var(--orange); background: rgba(255, 138, 61, .08); }

/* ============ refit ============ */
.refit-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.refit-card {
  position: relative;
  min-height: 240px;
  padding: 22px;
  border: 0;
  color: var(--ink);
  text-align: left;
  background: linear-gradient(155deg, rgba(14, 33, 45, .92), rgba(4, 11, 18, .9));
  box-shadow: inset 0 0 0 1px rgba(143, 232, 255, .14);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.refit-card:hover, .refit-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: inset 0 0 0 1px rgba(255, 138, 61, .55), 0 20px 50px rgba(0, 0, 0, .35);
  background: linear-gradient(155deg, rgba(24, 46, 57, .95), rgba(7, 17, 25, .92));
  outline: none;
}
.refit-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 22px;
  border: 1px solid rgba(255, 138, 61, .4);
  color: var(--orange);
  font-family: var(--mono);
  font-size: 16px;
  transform: rotate(45deg);
}
.refit-icon span { transform: rotate(-45deg); }
.refit-card h3 { font-family: var(--display); font-size: 20px; letter-spacing: .04em; color: var(--pearl); }
.refit-card p { margin-top: 10px; font-size: 12px; line-height: 1.7; color: var(--ink-dim); }
.refit-effect {
  display: inline-block;
  margin-top: 18px;
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .08em;
  color: var(--cyan);
  border: 1px solid rgba(143, 232, 255, .16);
}
.refit-note { font-family: var(--mono); font-size: 9px; letter-spacing: .16em; color: var(--ink-faint); margin-left: auto; }

/* ============ results / ending ============ */
.result-head { padding-bottom: 26px; border-bottom: 1px solid rgba(143, 232, 255, .14); }
.result-head h2 { margin-top: 12px; }
.result-head p { margin-top: 10px; max-width: 600px; font-size: 13px; line-height: 1.8; color: var(--ink-dim); }
.results-screen.victory .result-head h2 { color: var(--pearl); }
.results-screen.defeat .result-head h2 { color: #ffb0a0; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 26px;
  background: rgba(143, 232, 255, .1);
  border: 1px solid rgba(143, 232, 255, .1);
}
.stat-cell { padding: 18px; background: rgba(3, 10, 16, .9); }
.stat-cell span { display: block; font-family: var(--mono); font-size: 8px; letter-spacing: .14em; color: var(--ink-faint); }
.stat-cell b { display: block; margin-top: 8px; font-family: var(--display); font-size: 24px; font-weight: 600; color: var(--pearl); }
.stat-cell i { display: block; margin-top: 4px; font-style: normal; font-family: var(--mono); font-size: 8px; color: var(--cyan-2); }
.ending-screen .screen-inner {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 165, 80, .12), transparent 48%),
    linear-gradient(135deg, rgba(9, 20, 27, .96), rgba(3, 8, 13, .99));
}
.ending-glow {
  position: absolute;
  left: 50%;
  top: -60px;
  width: 420px;
  height: 180px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(255, 170, 90, .24), transparent 70%);
  pointer-events: none;
}
.ending-screen h2 {
  margin-top: 18px;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 1.12;
  color: var(--pearl);
}
.ending-story {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 26px;
}
.ending-story p { font-size: 13px; line-height: 1.9; color: #b4c4c8; }
.ending-story p:first-child { color: #d9e6e8; }
.ending-screen .stats-grid { margin-top: 30px; }

/* ============ howto ============ */
.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: rgba(143, 232, 255, .1); border: 1px solid rgba(143, 232, 255, .1); }
.howto-block { padding: 24px; background: rgba(3, 10, 16, .9); }
.howto-block h3 { font-family: var(--display); font-size: 17px; letter-spacing: .06em; color: var(--pearl); margin-bottom: 16px; }
.key-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; font-size: 11px; line-height: 1.5; color: var(--ink-dim); }
.key-row span { margin-left: 8px; }
.tips-block p { font-size: 12px; line-height: 1.8; color: var(--ink-dim); margin-bottom: 12px; }
.tips-block p::before { content: "▸ "; color: var(--orange); }
.howto-screen .screen-inner { width: min(1000px, 94vw); }

/* ============ settings ============ */
.settings-list { display: flex; flex-direction: column; gap: 4px; }
.setting-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(160px, 1.2fr) 44px;
  align-items: center;
  gap: 18px;
  padding: 14px 4px;
  border-bottom: 1px solid rgba(143, 232, 255, .08);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink);
}
.setting-row small { margin-left: 8px; font-family: var(--mono); font-size: 7px; letter-spacing: .14em; color: var(--ink-faint); }
.setting-row b { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--cyan); text-align: right; }
.setting-row input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: rgba(143, 232, 255, .16);
  outline: none;
  cursor: pointer;
}
.setting-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 18px;
  background: var(--orange);
  border: 0;
  box-shadow: 0 0 12px rgba(255, 138, 61, .6);
  cursor: pointer;
}
.setting-row input[type=range]::-moz-range-thumb {
  width: 10px;
  height: 18px;
  border: 0;
  border-radius: 0;
  background: var(--orange);
}
.setting-divider { height: 1px; margin: 8px 0; background: rgba(143, 232, 255, .1); }
.toggle-row { grid-template-columns: 1fr auto; cursor: pointer; }
.toggle-row input { display: none; }
.toggle {
  position: relative;
  width: 42px;
  height: 20px;
  border: 1px solid rgba(143, 232, 255, .22);
  background: rgba(143, 232, 255, .04);
  transition: border-color .2s, background .2s;
}
.toggle::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 12px;
  height: 12px;
  background: var(--ink-faint);
  transition: transform .2s, background .2s;
}
.toggle-row input:checked + .toggle { border-color: var(--orange); background: rgba(255, 138, 61, .1); }
.toggle-row input:checked + .toggle::after { transform: translateX(22px); background: var(--orange); }
.settings-screen .screen-actions { justify-content: flex-end; }

/* ============ HUD ============ */
#hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  font-family: var(--body);
}
#hud button { pointer-events: auto; }
.panel {
  position: relative;
  background:
    linear-gradient(160deg, rgba(5, 16, 25, .82), rgba(2, 8, 14, .78));
  box-shadow: inset 0 0 0 1px rgba(143, 232, 255, .19);
  backdrop-filter: blur(7px);
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  pointer-events: none;
}
.panel::before { left: -1px; top: -1px; border-left: 1px solid var(--orange); border-top: 1px solid var(--orange); }
.panel::after { right: -1px; bottom: -1px; border-right: 1px solid var(--cyan-dim); border-bottom: 1px solid var(--cyan-dim); }
.hud-edge {
  position: absolute;
  width: 90px;
  height: 90px;
  pointer-events: none;
  opacity: .5;
}
.hud-edge-tl { left: 12px; top: 12px; border-left: 1px solid rgba(143, 232, 255, .18); border-top: 1px solid rgba(143, 232, 255, .18); }
.hud-edge-br { right: 12px; bottom: 12px; border-right: 1px solid rgba(143, 232, 255, .18); border-bottom: 1px solid rgba(143, 232, 255, .18); }

.objective-bar {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 42vw);
  padding: 12px 22px 12px;
  text-align: center;
  z-index: 2;
}
.objective-kicker {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .22em;
  color: var(--cyan-2);
  opacity: .9;
}
.objective-main { display: flex; align-items: baseline; justify-content: center; gap: 12px; margin-top: 5px; }
.objective-text { font-family: var(--display); font-size: 18px; letter-spacing: .06em; color: var(--pearl); }
.objective-sub {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .12em;
  color: var(--orange);
  border-left: 1px solid rgba(255, 138, 61, .3);
  padding-left: 10px;
}
.objective-tick {
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 46px;
  height: 1px;
  transform: translateX(-50%);
  background: var(--orange);
  box-shadow: 0 0 10px rgba(255, 138, 61, .5);
}
.earth-wrap { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(143, 232, 255, .1); }
.earth-label { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 7px; letter-spacing: .1em; color: var(--ink-dim); }
.earth-label b { color: var(--orange); font-weight: 400; }
.thin-bar { height: 3px; margin-top: 5px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.thin-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ffb168, var(--orange), #ff5a3a); transition: width .25s; }

.player-panel {
  position: absolute;
  top: 20px;
  left: 22px;
  width: 326px;
  padding: 14px 16px 13px;
  z-index: 2;
}
.ship-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(143, 232, 255, .1); }
.ship-mark { position: relative; width: 28px; height: 28px; flex: 0 0 28px; transform: rotate(45deg); border: 1px solid rgba(255, 138, 61, .5); }
.mark-ring { position: absolute; inset: 4px; border: 1px solid rgba(255, 138, 61, .3); }
.mark-core { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; transform: translate(-50%, -50%); background: var(--orange); box-shadow: 0 0 10px var(--orange); }
.ship-id { min-width: 0; flex: 1; }
.ship-name { font-family: var(--display); font-size: 13px; letter-spacing: .08em; color: var(--pearl); white-space: nowrap; }
.ship-name b { color: var(--orange); font-weight: 500; }
.ship-class { margin-top: 2px; font-family: var(--mono); font-size: 6px; letter-spacing: .13em; color: var(--ink-faint); white-space: nowrap; }
.ship-state {
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .1em;
  color: var(--cyan-2);
  border: 1px solid rgba(143, 232, 255, .16);
  padding: 3px 5px;
  white-space: nowrap;
}
.ship-state.alert { color: var(--red); border-color: rgba(255, 77, 77, .4); animation: blink 1s steps(2) infinite; }
.stat-row {
  display: grid;
  grid-template-columns: 44px 1fr 40px;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.stat-label { font-family: var(--mono); font-size: 7px; letter-spacing: .12em; color: var(--ink-faint); }
.stat-val { font-family: var(--mono); font-size: 9px; text-align: right; color: var(--ink-dim); }
.stat-bar { position: relative; height: 5px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.stat-bar i { display: block; height: 100%; width: 100%; transition: width .18s; }
.stat-bar em { display: none; }
.stat-row.hull .stat-bar i { background: linear-gradient(90deg, #ffb168, #ff8a3d 60%, #ff5a3a); box-shadow: 0 0 10px rgba(255, 122, 46, .3); }
.stat-row.shield .stat-bar i { background: linear-gradient(90deg, #b7f4ff, #5ed4f0 60%, #2c9dbf); box-shadow: 0 0 10px rgba(94, 212, 240, .25); }
.stat-row.barrier .stat-bar i { background: linear-gradient(90deg, #f7f1df, #a7e9f4 60%, #62c3dc); box-shadow: 0 0 10px rgba(167, 233, 244, .25); }
.stat-row.low .stat-bar i { background: linear-gradient(90deg, #ff6a5a, #ff2d2d); animation: blink .6s steps(2) infinite; }
.status-icons { display: flex; gap: 4px; height: 12px; margin-top: 8px; }
.status-icon {
  width: 14px;
  height: 12px;
  border: 1px solid rgba(143, 232, 255, .25);
  font-family: var(--mono);
  font-size: 6px;
  line-height: 10px;
  text-align: center;
  color: var(--cyan-2);
}
.status-icon.warn { color: var(--red); border-color: rgba(255, 77, 77, .45); animation: blink .7s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

.hud-right {
  position: absolute;
  top: 20px;
  right: 22px;
  width: 202px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  z-index: 2;
}
.hud-tools { display: flex; align-items: center; gap: 6px; }
.mission-timer { margin-right: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--cyan-2); }
.radar-box { position: relative; width: 196px; height: 196px; padding: 8px; }
#radar { width: 180px; height: 180px; }
.radar-frame { position: absolute; inset: 8px; border: 1px solid rgba(143, 232, 255, .12); border-radius: 50%; pointer-events: none; }
.radar-frame::before, .radar-frame::after {
  content: "";
  position: absolute;
  background: rgba(143, 232, 255, .09);
}
.radar-frame::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.radar-frame::after { top: 50%; left: 0; right: 0; height: 1px; }
.radar-sweep {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(143, 232, 255, .16), transparent 18%);
  animation: sweep 3.6s linear infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.radar-label {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .08em;
  color: var(--ink-faint);
}
.feed {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-height: 92px;
  overflow: hidden;
}
.feed-line {
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.35;
  letter-spacing: .04em;
  color: var(--ink-dim);
  text-align: right;
  text-shadow: 0 1px 4px #000;
  animation: feedIn .25s ease-out both;
}
.feed-line.orange { color: var(--orange); }
.feed-line.cyan { color: var(--cyan-2); }
.feed-line.red { color: #ff8a7a; }
@keyframes feedIn { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }

.boss-bar {
  position: absolute;
  top: 128px;
  left: 50%;
  transform: translateX(-50%);
  width: min(660px, 54vw);
  z-index: 3;
  text-align: center;
  padding: 10px 18px 12px;
  background: linear-gradient(180deg, rgba(20, 6, 18, .8), rgba(5, 4, 10, .68));
  box-shadow: inset 0 0 0 1px rgba(190, 110, 255, .18);
  backdrop-filter: blur(6px);
}
.boss-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.boss-type { font-family: var(--mono); font-size: 7px; letter-spacing: .16em; color: #b98cff; }
.boss-name { font-family: var(--display); font-size: 19px; letter-spacing: .1em; color: var(--pearl); }
.boss-track { position: relative; height: 6px; margin-top: 8px; background: rgba(255, 255, 255, .09); overflow: visible; }
.boss-track > i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff8a5a, #ff4f97 45%, #9d5cff); box-shadow: 0 0 16px rgba(180, 80, 255, .4); transition: width .18s; }
.boss-parts { position: absolute; right: 0; top: -14px; display: flex; gap: 3px; }
.boss-part { width: 10px; height: 4px; background: #b58fff; box-shadow: 0 0 4px rgba(181, 143, 255, .6); transition: opacity .2s, background .2s; }
.boss-part.dead { background: rgba(255, 255, 255, .1); box-shadow: none; }
.boss-hint { margin-top: 6px; font-family: var(--mono); font-size: 7px; letter-spacing: .08em; color: #9a7fb0; }
.boss-intro {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  text-align: center;
  pointer-events: none;
  animation: bossIntro 2.4s ease-out both;
}
.boss-intro-kicker { font-family: var(--mono); font-size: 8px; letter-spacing: .3em; color: #ff6b6b; }
.boss-intro-name { margin-top: 8px; font-family: var(--display); font-size: clamp(34px, 5vw, 64px); letter-spacing: .1em; color: var(--pearl); text-shadow: 0 0 40px rgba(200, 90, 255, .4); }
.boss-intro-line { width: 240px; height: 1px; margin: 12px auto 0; background: linear-gradient(90deg, transparent, #d88cff, transparent); }
@keyframes bossIntro {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.12); }
  15%, 70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.02); }
}

.ability-bar {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  padding: 9px;
  z-index: 4;
  background: linear-gradient(180deg, rgba(4, 13, 21, .8), rgba(2, 7, 12, .9));
  box-shadow: inset 0 0 0 1px rgba(143, 232, 255, .14), 0 12px 40px rgba(0, 0, 0, .35);
  backdrop-filter: blur(8px);
}
.ability {
  position: relative;
  width: 106px;
  height: 62px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 6px;
  background: rgba(143, 232, 255, .035);
  box-shadow: inset 0 0 0 1px rgba(143, 232, 255, .11);
  overflow: hidden;
  transition: box-shadow .15s, background .15s;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}
.ability.cannon { width: 146px; grid-template-columns: 30px 1fr; }
.ability-icon { color: var(--cyan-2); width: 30px; height: 30px; opacity: .9; }
.ability-icon svg { width: 100%; height: 100%; }
.ability-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ability-meta b { font-size: 10px; font-weight: 500; letter-spacing: .03em; color: var(--ink); white-space: nowrap; }
.ability-meta span { font-family: var(--mono); font-size: 7px; letter-spacing: .08em; color: var(--ink-faint); white-space: nowrap; }
.ability-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: rgba(0, 0, 0, .64);
  pointer-events: none;
  transition: height .08s linear;
}
.ability.ready { box-shadow: inset 0 0 0 1px rgba(143, 232, 255, .2); }
.ability.active { background: rgba(255, 138, 61, .1); box-shadow: inset 0 0 0 1px rgba(255, 138, 61, .62), 0 0 18px rgba(255, 138, 61, .12); }
.ability.active .ability-icon, .ability.active .ability-meta b { color: var(--orange-hot); }
.ability.disabled { opacity: .45; }
.charges { position: absolute; right: 7px; bottom: 5px; display: flex; gap: 3px; }
.charges i { width: 5px; height: 5px; transform: rotate(45deg); background: rgba(255, 255, 255, .14); }
.charges i.on { background: var(--orange); box-shadow: 0 0 6px rgba(255, 138, 61, .5); }
.cannon-charge {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 5px;
  height: 3px;
  background: rgba(255, 255, 255, .1);
  overflow: hidden;
}
.cannon-charge i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--orange-deep), var(--orange-hot)); box-shadow: 0 0 8px rgba(255, 160, 80, .4); }
.cannon-state {
  position: absolute;
  top: 5px;
  right: 7px;
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .08em;
  color: var(--ink-faint);
}
.cannon-state.charging { color: var(--orange); }
.cannon-state.full { color: var(--orange-hot); text-shadow: 0 0 8px rgba(255, 180, 100, .6); }
.cannon-state.cooldown { color: var(--ink-faint); }
.ability.cannon.charging { box-shadow: inset 0 0 0 1px rgba(255, 138, 61, .5), 0 0 22px rgba(255, 120, 50, .1); }

.hint {
  position: absolute;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(680px, 70vw);
  padding: 9px 16px;
  background: rgba(2, 8, 14, .88);
  border-left: 2px solid var(--orange);
  box-shadow: inset 0 0 0 1px rgba(255, 138, 61, .1);
  font-size: 11px;
  letter-spacing: .03em;
  line-height: 1.5;
  color: #c7d6da;
  z-index: 5;
  animation: hintIn .22s ease-out both;
}
.hint-key {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .14em;
  color: var(--orange);
  white-space: nowrap;
}
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.radio {
  position: absolute;
  left: 24px;
  bottom: 24px;
  max-width: min(480px, 40vw);
  padding: 9px 14px;
  background: linear-gradient(90deg, rgba(3, 10, 17, .86), rgba(3, 10, 17, .4));
  border-left: 1px solid var(--cyan-2);
  font-size: 11px;
  line-height: 1.5;
  color: #b7cdd3;
  z-index: 4;
  animation: radioIn .3s ease-out both;
}
.radio-icon { color: var(--cyan); margin-right: 8px; }
.radio-speaker { margin-right: 8px; font-family: var(--mono); font-size: 8px; letter-spacing: .1em; color: var(--cyan-2); }
@keyframes radioIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

.toast {
  position: absolute;
  left: 50%;
  top: 23%;
  transform: translate(-50%, -50%);
  z-index: 7;
  padding: 8px 30px;
  font-family: var(--display);
  font-size: clamp(18px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--pearl);
  text-align: center;
  text-shadow: 0 0 30px rgba(143, 232, 255, .18);
  background: linear-gradient(90deg, transparent, rgba(4, 13, 21, .76), transparent);
  animation: toastIn .35s ease-out both;
  white-space: nowrap;
}
.toast small { display: block; margin-top: 5px; font-family: var(--mono); font-size: 8px; letter-spacing: .2em; color: var(--cyan-2); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -46%) scale(1.04); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.crosshair {
  position: fixed;
  left: 0;
  top: 0;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 8;
  color: var(--cyan);
  opacity: .9;
  transition: color .15s, opacity .15s;
  will-change: left, top;
}
.ch-line { position: absolute; background: currentColor; opacity: .7; }
.ch-t, .ch-b { width: 1px; height: 8px; left: 50%; }
.ch-t { top: 0; }
.ch-b { bottom: 0; }
.ch-l, .ch-r { height: 1px; width: 8px; top: 50%; }
.ch-l { left: 0; }
.ch-r { right: 0; }
.ch-dot { position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; transform: translate(-50%, -50%); background: currentColor; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.ch-ring { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%); border: 1px solid currentColor; opacity: .28; border-radius: 50%; }
.crosshair.charge { color: var(--orange); }
.crosshair.charge .ch-ring { width: 28px; height: 28px; opacity: .5; animation: chargePulse .6s ease-in-out infinite alternate; }
.crosshair.locked { color: var(--orange-hot); }
.crosshair.locked .ch-ring { border-color: var(--orange); opacity: .8; width: 26px; height: 26px; }
.crosshair.locked .ch-line { opacity: 1; }
@keyframes chargePulse { from { transform: translate(-50%, -50%) scale(.9); } to { transform: translate(-50%, -50%) scale(1.15); } }
.charge-readout {
  position: fixed;
  z-index: 8;
  padding: 5px 9px;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .1em;
  color: var(--orange);
  background: rgba(3, 8, 13, .7);
  border: 1px solid rgba(255, 138, 61, .3);
  white-space: nowrap;
}
.charge-readout span { color: var(--ink-faint); margin-right: 8px; }
.charge-readout b { font-weight: 400; color: var(--orange-hot); }

.damage-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(160, 20, 20, .42) 100%);
  opacity: 0;
  transition: opacity .3s;
  z-index: 6;
}
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 150px rgba(0, 0, 0, .55);
  z-index: 6;
}
.flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #fff;
  opacity: 0;
  z-index: 9;
  transition: opacity .12s ease-out;
}
.fade {
  position: absolute;
  inset: 0;
  background: #02050a;
  opacity: 0;
  pointer-events: none;
  z-index: 90;
  transition: opacity .4s;
}
.fade.show { opacity: 1; }

/* ============ pause ============ */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 4, 8, .74);
  backdrop-filter: blur(7px);

}
.pause-panel {
  width: min(420px, 90vw);
  padding: 34px 36px;
  text-align: center;
  animation: screenIn .3s ease-out both;
}
.pause-panel h2 { margin-top: 10px; font-size: 46px; }
.pause-panel p { margin-top: 8px; font-size: 12px; color: var(--ink-dim); }
.pause-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 26px; }
.pause-buttons .btn { justify-content: center; }
.pause-tip { margin-top: 18px; font-family: var(--mono); font-size: 7px; letter-spacing: .16em; color: var(--ink-faint); }

/* ============ responsive ============ */
@media (max-width: 1100px) {
  .menu-content { width: min(560px, 56vw); }
  .objective-bar { width: 300px; }
  .player-panel { width: 276px; }
  .ship-state { display: none; }
  .ship-name { font-size: 12px; letter-spacing: .05em; }
  .hud-right { width: 178px; }
  .radar-box { width: 172px; height: 172px; }
  #radar { width: 156px; height: 156px; }
  .ability { width: 94px; }
  .ability.cannon { width: 132px; }
  .ability-meta b { font-size: 9px; }
}

@media (max-width: 900px) {
  .screen { padding: 3vh 3vw; }
  .screen-inner { width: 96vw; max-height: 94vh; padding: 24px; }
  .menu-content { width: min(520px, 70vw); }
  .menu-screen h1 { font-size: clamp(44px, 8vw, 76px); }
  .menu-ship-tag { display: none; }
  .mission-list { grid-template-columns: 1fr; }
  .mission-card { min-height: 190px; }
  .briefing-grid { grid-template-columns: 1fr; }
  .refit-cards { grid-template-columns: 1fr; }
  .refit-card { min-height: 170px; }
  .ending-story { grid-template-columns: 1fr; }
  .howto-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .screen-lead { text-align: left; }
  .screen-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .player-panel { width: 236px; padding: 10px 12px; top: 12px; left: 12px; }
  .ship-class { display: none; }
  .ship-state { display: none; }
  .ship-name { font-size: 11px; letter-spacing: .03em; }
  .stat-row { grid-template-columns: 36px 1fr 34px; margin-top: 6px; }
  .objective-bar { top: 148px; width: 72vw; padding: 8px 12px; }
  .boss-bar { top: 202px; }
  .objective-text { font-size: 13px; }
  .objective-kicker { font-size: 6px; }
  .objective-sub { font-size: 6px; }
  .earth-wrap { display: none !important; }
  .hud-right { top: 12px; right: 12px; width: 128px; }
  .radar-box { width: 128px; height: 128px; padding: 5px; }
  #radar { width: 118px; height: 118px; }
  .radar-label { display: none; }
  .feed { display: none; }
  .mission-timer { font-size: 8px; }
  .boss-bar { top: 104px; width: min(470px, 70vw); }
  .boss-name { font-size: 15px; }
  .ability-bar { bottom: 10px; gap: 4px; padding: 6px; }
  .ability { width: 74px; height: 52px; padding: 5px 6px; grid-template-columns: 22px 1fr; gap: 4px; }
  .ability.cannon { width: 102px; }
  .ability-icon { width: 22px; height: 22px; }
  .ability-meta b { font-size: 8px; }
  .ability-meta span { font-size: 6px; }
  .ability-icon svg { stroke-width: 2.4; }
  .charges { right: 4px; bottom: 3px; }
  .charges i { width: 4px; height: 4px; }
  .hint { bottom: 76px; font-size: 10px; padding: 7px 10px; max-width: 78vw; }
  .radio { left: 12px; bottom: 74px; max-width: 48vw; font-size: 9px; padding: 7px 10px; }
  .toast { font-size: 18px; }
  .crosshair { width: 26px; height: 26px; }
  .menu-meta { font-size: 7px; }
}

@media (max-width: 620px) {
  .menu-content { width: 88vw; }
  .menu-screen h1 { font-size: 44px; }
  .menu-blurb { font-size: 12px; }
  .menu-kicker { font-size: 7px; }
  .menu-buttons { width: 100%; }
  .menu-meta { display: none; }
  .objective-bar { top: 148px; width: 74vw; left: 50%; }
  .boss-bar { top: 202px; }
  .player-panel { width: 200px; }
  .player-panel .stat-row { grid-template-columns: 32px 1fr 30px; }
  .ship-name { font-size: 9px; letter-spacing: .02em; }
  .hud-right { width: 96px; }
  .radar-box { width: 96px; height: 96px; padding: 4px; }
  #radar { width: 88px; height: 88px; }
  .mission-timer { display: none; }
  .boss-bar { width: 72vw; top: 92px; }
  .boss-type { display: none; }
  .ability { width: 56px; height: 46px; grid-template-columns: 18px 1fr; padding: 4px; }
  .ability.cannon { width: 78px; }
  .ability-icon { width: 18px; height: 18px; }
  .ability-meta b { font-size: 7px; }
  .ability-meta span { display: none; }
  .ability-fill { display: none; }
  .cannon-state { display: none; }
  .hint { font-size: 9px; }
  .radio { display: none; }
  .screen-inner { padding: 18px; }
  .screen-actions .btn { min-width: 110px; font-size: 11px; }
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-height: 720px) and (min-width: 901px) {
  .ability-bar { bottom: 12px; padding: 7px; }
  .ability { height: 56px; }
  .hint { bottom: 92px; }
  .player-panel { top: 12px; }
  .hud-right { top: 12px; }
  .objective-bar { top: 12px; }
  .boss-bar { top: 112px; }
}

@media (max-width: 900px) {
  .menu-screen {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 34px;
    overflow-y: auto;
  }
  .menu-content { padding-bottom: 32px; }
  .menu-screen h1 { font-size: clamp(40px, 11vw, 64px); }
}

@media (max-height: 640px) {
  .screen { padding: 2vh 3vw; }
  .screen-inner { max-height: 96vh; padding: 20px 28px; }
  .menu-screen { align-items: flex-start; overflow-y: auto; padding-top: 20px; padding-bottom: 20px; }
  .menu-screen h1 { font-size: 44px; }
  .menu-kicker { margin-bottom: 14px; }
  .menu-blurb { margin-top: 14px; font-size: 12px; }
  .menu-buttons { margin-top: 18px; }
  .menu-meta { margin-top: 12px; }
  .screen-head { padding-bottom: 14px; margin-bottom: 16px; }
  .briefing-head { padding-bottom: 12px; margin-bottom: 16px; }
  .briefing-head h2 { font-size: 36px; margin-top: 6px; }
  .briefing-story > p { font-size: 12px; line-height: 1.7; }
  .radio-quote { margin: 14px 0; font-size: 11px; }
  .ship-dossier { margin-top: 16px; padding: 12px; }
  .ending-screen h2 { font-size: 40px; margin-top: 8px; }
  .ending-story { gap: 16px; margin-top: 16px; }
  .ending-story p { font-size: 11px; line-height: 1.7; }
  .ending-glow { top: -90px; }
  .stats-grid { margin-top: 16px; }
  .stat-cell { padding: 12px; }
  .stat-cell b { font-size: 20px; margin-top: 4px; }
  .screen-actions { margin-top: 16px; }
  .pause-buttons { margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* ============================================================
   FLEET COMMAND HUD
   ============================================================ */
#hud {
  --hud-green: #6bffc8;
  --hud-green-dim: rgba(107, 255, 200, .32);
  --hud-green-line: rgba(107, 255, 200, .16);
  --hud-danger: #ff5f78;
  letter-spacing: .015em;
}
.hud-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(110, 255, 210, .018) 3px 4px);
  z-index: 0;
}
.hq-objective {
  position: absolute;
  pointer-events: auto;
  top: 18px;
  left: 18px;
  width: 340px;
  padding: 13px 17px 11px;
  border-left: 2px solid var(--hud-green);
  background: linear-gradient(105deg, rgba(4, 22, 22, .93), rgba(2, 10, 14, .8));
  box-shadow: inset 0 0 0 1px rgba(107, 255, 200, .14), 0 12px 40px rgba(0, 0, 0, .25);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  pointer-events: none;
  z-index: 3;
}
.hq-objective::before { border-color: var(--hud-green); }
.obj-kicker {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .18em;
  color: rgba(107, 255, 200, .72);
  text-transform: uppercase;
}
.obj-main { display: flex; align-items: baseline; gap: 10px; margin-top: 5px; }
.obj-title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--pearl);
}
.obj-sub {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .08em;
  color: var(--orange);
  padding-left: 8px;
  border-left: 1px solid rgba(255, 138, 61, .3);
}
.hq-objective .earth-wrap { margin-top: 9px; }
.hq-objective .earth-label { color: rgba(185, 225, 220, .7); }
.hq-objective .earth-label b { color: var(--hud-green); }
.hq-objective .thin-bar i { background: linear-gradient(90deg, #6bffc8, #4dd9d0); }
.obj-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(107, 255, 200, .12);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .08em;
  color: rgba(160, 210, 205, .65);
}
.obj-footer span:last-child { color: rgba(255, 205, 150, .75); }

.fleet-roster {
  position: absolute;
  top: 150px;
  left: 18px;
  width: 252px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: auto;
  z-index: 3;
}
.fleet-card {
  position: relative;
  display: grid;
  grid-template-columns: 13px 64px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 6px 8px 6px 5px;
  border: 1px solid rgba(107, 255, 200, .13);
  background: linear-gradient(90deg, rgba(4, 23, 24, .9), rgba(2, 10, 14, .72));
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
  transition: background .15s, border-color .15s, transform .15s;
  overflow: hidden;
}
.fleet-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  border-right: 1px solid rgba(107, 255, 200, .18);
  border-bottom: 1px solid rgba(107, 255, 200, .18);
}
.fleet-card:hover { border-color: var(--hud-green-dim); background: linear-gradient(90deg, rgba(9, 49, 44, .92), rgba(3, 17, 20, .8)); }
.fleet-card.selected { border-color: rgba(107, 255, 200, .72); box-shadow: inset 2px 0 0 var(--hud-green); }
.fleet-card.active { background: linear-gradient(90deg, rgba(13, 72, 60, .92), rgba(3, 24, 24, .86)); }
.fleet-card.dead { opacity: .32; filter: grayscale(1); cursor: default; }
.fleet-card:disabled { pointer-events: none; }
.fc-key {
  align-self: start;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 7px;
  color: rgba(107, 255, 200, .6);
}
.fc-icon { width: 64px; height: 34px; opacity: .95; }
.fc-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fc-name {
  font-family: var(--display);
  font-size: 9.5px;
  letter-spacing: .08em;
  color: var(--pearl);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fc-role {
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .06em;
  color: rgba(120, 190, 180, .6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fc-bars { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.fc-bars i { display: block; height: 2px; background: rgba(255, 255, 255, .06); position: relative; overflow: hidden; }
.fc-bars i::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w, 100%); }
.fc-bars .hull::before { background: var(--hud-green); }
.fc-bars .shield::before { background: #8fe8ff; }
.fc-bars .hull, .fc-bars .shield { width: 100%; }
.fleet-card.dead .fc-bars i::before { background: rgba(255, 255, 255, .15); }

.hud-tools {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  pointer-events: auto;
  z-index: 4;
  box-shadow: inset 0 0 0 1px rgba(107, 255, 200, .13);
}
.hud-tools .mission-timer { margin-right: 4px; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--hud-green); }
.speed-controls { display: flex; border: 1px solid rgba(107, 255, 200, .16); }
.speed-btn {
  width: 26px;
  height: 24px;
  border: 0;
  background: rgba(107, 255, 200, .03);
  color: rgba(170, 220, 215, .65);
  font-family: var(--mono);
  font-size: 8px;
  cursor: pointer;
}
.speed-btn + .speed-btn { border-left: 1px solid rgba(107, 255, 200, .12); }
.speed-btn.active { background: rgba(107, 255, 200, .18); color: #071412; font-weight: 700; }

.enemy-contacts {
  position: absolute;
  pointer-events: auto;
  top: 64px;
  right: 18px;
  width: 256px;
  padding: 9px 11px 8px;
  pointer-events: none;
  z-index: 3;
  box-shadow: inset 0 0 0 1px rgba(255, 95, 120, .13);
  background: linear-gradient(150deg, rgba(23, 5, 10, .8), rgba(5, 8, 12, .7));
}
.contacts-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .12em;
  color: rgba(255, 140, 160, .72);
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 95, 120, .13);
}
.contacts-head b { font-weight: 400; color: #ff8c9c; }
.contact-row { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.contact-name {
  width: 122px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .04em;
  color: rgba(255, 190, 200, .82);
}
.contact-bar { flex: 1; height: 3px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.contact-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff8f6a, #ff4566); }
.contact-empty {
  padding-top: 7px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .1em;
  color: rgba(200, 150, 160, .35);
}

.minimap-wrap {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: 276px;
  height: 207px;
  padding: 8px;
  pointer-events: auto;
  z-index: 4;
  box-shadow: inset 0 0 0 1px rgba(107, 255, 200, .13);
}
.minimap-wrap #radar { width: 260px; height: 180px; }
.radar-sweep { inset: 8px; border-radius: 3px; opacity: .55; }
.minimap-frame {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(107, 255, 200, .14);
  pointer-events: none;
}
.minimap-frame::before, .minimap-frame::after {
  content: "";
  position: absolute;
  background: rgba(107, 255, 200, .09);
}
.minimap-frame::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.minimap-frame::after { top: 50%; left: 0; right: 0; height: 1px; }
.minimap-label {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .08em;
  color: rgba(140, 210, 200, .55);
}

.selected-panel {
  position: absolute;
  pointer-events: auto;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(560px, 40vw);
  min-height: 118px;
  display: flex;
  gap: 11px;
  padding: 9px 11px;
  pointer-events: none;
  z-index: 4;
  box-shadow: inset 0 0 0 1px rgba(107, 255, 200, .16);
  background: linear-gradient(150deg, rgba(3, 20, 21, .93), rgba(2, 9, 13, .86));
}
.selected-portrait {
  position: relative;
  flex: 0 0 190px;
  border-right: 1px solid rgba(107, 255, 200, .13);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#selectedShipCanvas { width: 190px; height: 86px; }
.portrait-tag {
  position: absolute;
  left: 5px;
  bottom: 1px;
  font-family: var(--mono);
  font-size: 5.5px;
  letter-spacing: .12em;
  color: rgba(107, 255, 200, .6);
}
.selected-info { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.sel-head { display: flex; flex-direction: column; gap: 2px; padding-bottom: 5px; border-bottom: 1px solid rgba(107, 255, 200, .1); }
.sel-name {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: .08em;
  color: var(--pearl);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sel-role { font-family: var(--mono); font-size: 6.5px; letter-spacing: .1em; color: rgba(120, 200, 190, .62); }
.sel-bars { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.sel-bar {
  display: grid;
  grid-template-columns: 40px 1fr 38px;
  align-items: center;
  gap: 7px;
}
.sel-bar span { font-family: var(--mono); font-size: 6px; letter-spacing: .1em; color: rgba(140, 200, 195, .6); }
.sel-bar .bar { height: 3px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.sel-bar .bar i { display: block; height: 100%; width: 100%; transition: width .15s; }
.sel-bar.hull .bar i { background: linear-gradient(90deg, #8effc8, #4ee4a4); }
.sel-bar.shield .bar i { background: linear-gradient(90deg, #c4f6ff, #61d3f0); }
.sel-bar.barrier .bar i { background: linear-gradient(90deg, #f6f0db, #a7e9f4); }
.sel-bar b { font-family: var(--mono); font-size: 7px; font-weight: 400; text-align: right; color: rgba(190, 235, 225, .8); }
.sel-status {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  padding-top: 5px;
  border-top: 1px solid rgba(107, 255, 200, .1);
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .05em;
  color: rgba(140, 210, 200, .55);
  white-space: nowrap;
}
.sel-status span:nth-child(2) { color: rgba(255, 205, 150, .6); }

.ability-grid {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-auto-rows: 58px;
  gap: 8px;
  padding: 10px;
  pointer-events: auto;
  z-index: 5;
  background: linear-gradient(155deg, rgba(3, 19, 19, .92), rgba(2, 8, 12, .9));
  box-shadow: inset 0 0 0 1px rgba(107, 255, 200, .15);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.ability-btn {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(107, 255, 200, .25);
  background: radial-gradient(circle at 45% 38%, rgba(20, 72, 66, .9), rgba(3, 15, 18, .94));
  color: rgba(150, 240, 220, .85);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s, color .15s, opacity .15s;
  pointer-events: auto;
  touch-action: none;
}
.ability-btn:hover { border-color: rgba(107, 255, 200, .7); box-shadow: 0 0 18px rgba(107, 255, 200, .12); }
.ability-btn.active {
  border-color: rgba(255, 205, 140, .85);
  color: #ffe4bd;
  box-shadow: 0 0 20px rgba(255, 170, 90, .2), inset 0 0 18px rgba(255, 150, 70, .1);
}
.ability-btn.locked {
  border-color: rgba(255, 226, 170, .98);
  color: #fff3d8;
  box-shadow: 0 0 24px rgba(255, 196, 110, .38), inset 0 0 22px rgba(255, 180, 100, .16);
}
.ability-btn.disabled { opacity: .3; pointer-events: none; }
.ab-icon { position: absolute; left: 50%; top: 13px; width: 25px; height: 25px; transform: translateX(-50%); }
.ab-icon svg { width: 100%; height: 100%; }
.ab-name {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 6px;
  font-family: var(--mono);
  font-size: 5.5px;
  letter-spacing: .02em;
  text-align: center;
  color: rgba(190, 240, 225, .72);
  white-space: nowrap;
  overflow: hidden;
}
.ability-btn kbd {
  position: absolute;
  top: 2px;
  right: 5px;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--mono);
  font-size: 6px;
  color: rgba(255, 205, 150, .8);
}
.ab-cd {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(rgba(0, 0, 0, .72) calc(var(--cd, 0) * 1turn), transparent 0);
}
.ab-charge {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, #ff8a3d, #ffe4b0);
  pointer-events: none;
}

.boss-bar {
  top: 18px;
  width: min(520px, 38vw);
  background: linear-gradient(180deg, rgba(17, 5, 18, .85), rgba(5, 4, 10, .7));
  box-shadow: inset 0 0 0 1px rgba(190, 110, 255, .18);
}
.boss-type { color: #c7a3e8; }
.boss-hint { color: #a78cbb; }

.hint {
  bottom: 158px;
  z-index: 6;
}
.radio {
  left: 18px;
  bottom: 238px;
  max-width: 310px;
  border-left-color: var(--hud-green);
  z-index: 4;
}
.feed {
  position: absolute;
  right: 18px;
  bottom: 178px;
  width: 270px;
  max-height: 90px;
  z-index: 3;
  pointer-events: none;
}
.crosshair.attack { color: var(--hud-danger); }
.crosshair.friendly { color: var(--hud-green); }
.crosshair.locked { color: var(--orange-hot); }

/* HUD-specific responsive */
@media (max-width: 1100px) {
  .hq-objective { width: 300px; top: 14px; left: 14px; }
  .fleet-roster { top: 140px; left: 14px; width: 222px; }
  .fleet-card { grid-template-columns: 12px 52px minmax(0, 1fr); }
  .fc-icon { width: 52px; height: 29px; }
  .fc-name { font-size: 8.5px; }
  .hud-tools { top: 14px; right: 14px; }
  .enemy-contacts { top: 60px; right: 14px; width: 218px; }
  .contact-name { width: 103px; }
  .minimap-wrap { left: 14px; bottom: 14px; width: 240px; height: 181px; }
  .minimap-wrap #radar { width: 224px; height: 154px; }
  .selected-panel { width: min(430px, 38vw); left: 50%; bottom: 14px; }
  .selected-portrait { flex-basis: 140px; }
  #selectedShipCanvas { width: 140px; height: 68px; }
  .sel-name { font-size: 12px; }
  .ability-grid { right: 14px; bottom: 14px; grid-template-columns: repeat(3, 48px); grid-auto-rows: 48px; gap: 6px; padding: 8px; }
  .ability-btn { width: 48px; height: 48px; }
  .ab-icon { top: 9px; width: 21px; height: 21px; }
  .ab-name { bottom: 4px; font-size: 5px; }
  .boss-bar { top: 140px; width: min(430px, 44vw); }
  .feed { display: none; }
  .hint { bottom: 140px; }
  .radio { display: none; }
}
@media (max-width: 900px) {
  .hq-objective { width: 260px; padding: 10px 12px; }
  .obj-title { font-size: 14px; }
  .fleet-roster { top: 126px; width: 194px; }
  .fleet-card { grid-template-columns: 10px 40px minmax(0, 1fr); padding: 5px; }
  .fc-icon { width: 40px; height: 24px; }
  .fc-name { font-size: 8px; }
  .fc-role { font-size: 5px; }
  .enemy-contacts { display: none; }
  .minimap-wrap { width: 194px; height: 143px; }
  .minimap-wrap #radar { width: 178px; height: 118px; }
  .selected-panel { width: min(330px, 42vw); min-height: 96px; padding: 7px 8px; }
  .selected-portrait { flex-basis: 104px; }
  #selectedShipCanvas { width: 104px; height: 54px; }
  .sel-name { font-size: 10px; }
  .sel-bar { grid-template-columns: 34px 1fr 32px; gap: 5px; }
  .sel-bar span { font-size: 5px; }
  .sel-bar b { font-size: 6px; }
  .sel-status { font-size: 5px; }
  .ability-grid { grid-template-columns: repeat(3, 44px); grid-auto-rows: 44px; gap: 5px; padding: 6px; }
  .ability-btn { width: 44px; height: 44px; }
  .ab-icon { top: 8px; width: 19px; height: 19px; }
  .ab-name { display: none; }
  .boss-bar { top: 128px; width: min(360px, 50vw); }
  .hint { bottom: 120px; font-size: 9px; }
  .radio { display: none; }
  .feed { display: none; }
}
@media (max-width: 620px) {
  .hq-objective { width: min(238px, 54vw); top: 10px; left: 10px; padding: 8px 10px; }
  .obj-kicker { font-size: 6px; }
  .obj-main { gap: 6px; }
  .obj-title { font-size: 12px; }
  .obj-sub { font-size: 6px; padding-left: 5px; }
  .obj-footer { margin-top: 5px; padding-top: 4px; font-size: 6px; }
  .fleet-roster { display: none !important; }
  .enemy-contacts { display: none !important; }
  .hud-tools { top: 10px; right: 10px; padding: 4px 6px; gap: 4px; }
  .hud-tools .mission-timer { display: none; }
  .speed-controls { display: none !important; }
  .minimap-wrap { display: none !important; }
  .selected-panel { left: 10px; right: 10px; width: auto; min-width: 0; transform: none; bottom: 10px; min-height: 92px; }
  .selected-portrait { display: none; }
  .sel-name { font-size: 9px; }
  .sel-bar { grid-template-columns: 34px 1fr 32px; }
  .sel-status span:last-child { display: none; }
  .ability-grid { right: 10px; bottom: 118px; grid-template-columns: repeat(3, 40px); grid-auto-rows: 40px; gap: 4px; padding: 5px; }
  .ability-btn { width: 40px; height: 40px; }
  .ab-icon { top: 8px; width: 18px; height: 18px; }
  .boss-bar { top: 98px; width: 76vw; }
  .hint { bottom: 250px; max-width: 88vw; font-size: 9px; }
  .radio { display: none; }
}

@media (max-height: 520px) {
  .fleet-roster { display: none; }
  .minimap-wrap { display: none; }
  .enemy-contacts { display: none; }
  .hq-objective { padding: 8px 10px; }
  .selected-panel { min-height: 84px; padding: 6px 8px; }
  .selected-portrait { display: none; }
  .ability-grid { grid-template-columns: repeat(3, 40px); grid-auto-rows: 40px; gap: 4px; padding: 5px; bottom: 118px; right: 10px; }
  .ability-btn { width: 40px; height: 40px; }
  .ab-icon { top: 8px; width: 18px; height: 18px; }
  .hint { bottom: 238px; }
  .selected-panel { left: 10px; right: 10px; width: auto; transform: none; }
  .radio { display: none; }
}
@media (max-height: 640px) and (min-width: 901px) {
  .hq-objective { top: 10px; left: 10px; padding: 9px 12px; }
  .fleet-roster { top: 116px; left: 10px; width: 222px; }
  .fleet-card { padding: 4px 6px; }
  .fc-icon { width: 48px; height: 26px; }
  .minimap-wrap { left: 10px; bottom: 10px; width: 222px; height: 166px; }
  .minimap-wrap #radar { width: 206px; height: 140px; }
  .selected-panel { bottom: 10px; min-height: 94px; width: min(420px, 38vw); padding: 7px 9px; }
  .selected-portrait { flex-basis: 120px; }
  #selectedShipCanvas { width: 120px; height: 58px; }
  .sel-name { font-size: 11px; }
  .sel-bars { gap: 2px; margin-top: 4px; }
  .sel-bar { grid-template-columns: 34px 1fr 30px; }
  .sel-status { margin-top: 4px; padding-top: 3px; }
  .ability-grid { bottom: 10px; right: 10px; grid-template-columns: repeat(3, 46px); grid-auto-rows: 46px; gap: 5px; padding: 7px; }
  .ability-btn { width: 46px; height: 46px; }
  .ab-icon { top: 8px; width: 20px; height: 20px; }
  .ab-name { display: none; }
  .hint { bottom: 120px; }
  .radio { bottom: 188px; }
  .hud-tools { top: 10px; right: 10px; }
  .enemy-contacts { top: 54px; right: 10px; }
  .boss-bar { top: 122px; }
}

/* ============ control mode picker ============ */
.mode-row {
  grid-template-columns: minmax(150px, 1fr) auto;
  align-items: center;
}
.mode-picker { display: flex; gap: 6px; justify-content: flex-end; }
.mode-btn {
  min-width: 48px;
  padding: 7px 10px;
  border: 1px solid rgba(143, 232, 255, .2);
  background: rgba(2, 12, 18, .4);
  color: rgba(170, 220, 220, .72);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.mode-btn:hover { border-color: rgba(107, 255, 200, .55); color: var(--hud-green); }
.mode-btn.active {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(255, 138, 61, .08);
}
.fleet-card.static { cursor: default; }
.fleet-card.static:hover { border-color: rgba(107, 255, 200, .2); background: linear-gradient(90deg, rgba(5, 27, 27, .8), rgba(2, 11, 15, .72)); }
.fleet-card.wingman .fc-key { color: rgba(130, 190, 185, .6); font-size: 7px; }
.fleet-card.flagship .fc-key { color: var(--hud-green); }
.pause-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 0;
  border-top: 1px solid rgba(143, 232, 255, .1);
  border-bottom: 1px solid rgba(143, 232, 255, .1);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  color: rgba(170, 220, 220, .65);
}
.pause-mode-row .mode-btn { min-width: 40px; padding: 5px 8px; font-size: 8px; }

/* ============ mobile single-ship controls ============ */
.mobile-stick {
  display: none;
  position: absolute;
  left: 18px;
  bottom: 22px;
  z-index: 6;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
body.mode-mobile .mobile-stick { display: block; }
.stick-ring {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 1px solid rgba(107, 255, 200, .32);
  background:
    radial-gradient(circle at 50% 46%, rgba(16, 69, 61, .38), rgba(2, 14, 18, .68) 66%, rgba(2, 8, 12, .35));
  box-shadow: inset 0 0 26px rgba(45, 200, 165, .12), 0 0 28px rgba(0, 0, 0, .35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stick-ring::before {
  content: "";
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  border: 1px dashed rgba(107, 255, 200, .2);
}
.stick-ring::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(107, 255, 200, .4);
}
.stick-knob {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(160, 255, 232, .72);
  background: radial-gradient(circle at 38% 32%, rgba(210, 255, 245, .92), rgba(62, 200, 176, .72) 42%, rgba(5, 42, 40, .94));
  box-shadow: 0 0 20px rgba(92, 255, 190, .24);
  transition: transform .08s linear;
}
.stick-label {
  position: absolute;
  left: 50%;
  bottom: -17px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .18em;
  color: rgba(107, 255, 200, .55);
  white-space: nowrap;
}

body.mode-mobile .fleet-roster,
body.mode-mobile .enemy-contacts,
body.mode-mobile .minimap-wrap {
  display: none !important;
}
body.mode-mobile .radio { display: none !important; }
body.mode-mobile .crosshair,
body.mode-mobile #chargeReadout { display: none !important; }
body.mode-mobile .hud-tools .mission-timer { display: none; }
body.mode-mobile .hud-tools { top: 10px; right: 10px; }
body.mode-mobile .hq-objective {
  width: min(270px, 52vw);
  padding: 8px 10px;
}
body.mode-mobile .obj-title { font-size: 15px; }
body.mode-mobile .obj-sub { font-size: 8px; }
body.mode-mobile .obj-footer { font-size: 7px; }

body.mode-mobile .selected-panel {
  left: 50%;
  right: auto;
  bottom: 12px;
  width: min(300px, 40vw);
  min-height: 72px;
  padding: 7px 10px;
  transform: translateX(-50%);
  z-index: 4;
}
body.mode-mobile .selected-portrait { display: none; }
body.mode-mobile .sel-head { border-bottom: 0; padding-bottom: 3px; }
body.mode-mobile .sel-name { font-size: 12px; letter-spacing: .05em; }
body.mode-mobile .sel-role { font-size: 5.5px; letter-spacing: .05em; }
body.mode-mobile .sel-bars { gap: 3px; margin-top: 4px; }
body.mode-mobile .sel-bar { grid-template-columns: 32px 1fr 30px; gap: 5px; }
body.mode-mobile .sel-bar span { font-size: 5.5px; }
body.mode-mobile .sel-bar b { font-size: 6px; }
body.mode-mobile .sel-status { display: none; }

body.mode-mobile .ability-grid {
  right: 12px;
  bottom: 12px;
  grid-template-columns: repeat(2, 58px);
  grid-auto-rows: 58px;
  gap: 7px;
  padding: 8px;
  z-index: 6;
}
body.mode-mobile .ability-btn { width: 58px; height: 58px; }
body.mode-mobile .ability-btn kbd { display: none; }
body.mode-mobile .ab-icon { top: 11px; width: 23px; height: 23px; }
body.mode-mobile .ab-name { bottom: 6px; font-size: 6px; }

body.mode-mobile .hint {
  top: 96px !important;
  bottom: auto !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  max-width: min(340px, 60vw);
  z-index: 7;
}
body.mode-mobile .boss-bar {
  top: 54px;
  width: min(420px, 62vw);
}
body.mode-mobile .toast { top: 74px; }

@media (orientation: portrait) {
  body.mode-mobile .mobile-stick { left: 14px; bottom: 16px; }
  .stick-ring { width: 112px; height: 112px; }
  .stick-knob { width: 46px; height: 46px; }
  body.mode-mobile .ability-grid {
    right: 12px;
    bottom: 16px;
    grid-template-columns: repeat(2, 54px);
    grid-auto-rows: 54px;
    gap: 6px;
    padding: 7px;
  }
  body.mode-mobile .ability-btn { width: 54px; height: 54px; }
  body.mode-mobile .ab-icon { top: 9px; width: 21px; height: 21px; }
  body.mode-mobile .ab-name { font-size: 5.5px; }
  body.mode-mobile .selected-panel {
    bottom: 205px;
    width: min(340px, calc(100vw - 24px));
  }
  body.mode-mobile .hint { top: 118px !important; max-width: 78vw; }
  body.mode-mobile .hq-objective { width: min(270px, 68vw); }
  body.mode-mobile .boss-bar { top: 92px; width: 84vw; }
}

@media (max-height: 430px) and (orientation: landscape) {
  body.mode-mobile .selected-panel { width: min(245px, 34vw); min-height: 64px; }
  body.mode-mobile .sel-role { display: none; }
  body.mode-mobile .hq-objective { width: min(245px, 42vw); }
  body.mode-mobile .boss-bar { top: 48px; width: 46vw; }
}

@media (max-width: 620px) {
  .screen {
    align-items: flex-start;
    padding: 12px 10px;
  }
  .screen-inner,
  .screen-inner.narrow,
  .howto-screen .screen-inner {
    width: 100%;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 24px);
    padding: 18px 14px;
  }
  .screen-head { gap: 8px; padding-bottom: 12px; margin-bottom: 14px; }
  .screen-head h2 { font-size: 26px; }
  .screen-lead { font-size: 11px; line-height: 1.5; }
  .screen-actions {
    flex-wrap: wrap;
    justify-content: stretch;
    gap: 8px;
    margin-top: 16px;
  }
  .screen-actions .btn { flex: 1 1 140px; min-width: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-cell { padding: 10px 8px; min-height: 74px; }
  .stat-cell b { font-size: 21px; }
  .result-head h2 { font-size: 25px; line-height: 1.15; }
  .briefing-grid { gap: 14px; }
  .briefing-story, .briefing-meta { padding: 0; }
  .mission-list { gap: 8px; }
  .mission-card { min-height: 154px; padding: 14px; }
  .refit-cards { gap: 8px; }
  .refit-card { min-height: 136px; padding: 13px; }
  .howto-grid { gap: 1px; }
  .howto-block { padding: 14px; }
  .settings-list { gap: 0; }
  .setting-row { grid-template-columns: 1fr auto; gap: 8px; padding: 10px 2px; }
  .setting-row input[type=range] { grid-column: 1 / -1; }
  .setting-row b { display: none; }
  .mode-picker { flex-wrap: wrap; justify-content: flex-end; }
  .mode-btn { min-width: 42px; padding: 6px 8px; font-size: 8px; }
  .menu-content { width: min(88vw, 420px); }
  .menu-buttons { gap: 8px; }
  .menu-btn { min-height: 54px; }
  .menu-screen h1 { font-size: clamp(32px, 9vw, 44px); }
  .pause-panel { width: calc(100vw - 24px); padding: 20px 16px; }
  .pause-buttons { flex-direction: column; }
  .pause-buttons .btn { width: 100%; }
}

@media (max-height: 520px) and (orientation: landscape) {
  body.mode-mobile .screen { align-items: center; padding: 8px 16px; }
  body.mode-mobile .menu-content { width: min(480px, 64vw); }
  body.mode-mobile .menu-screen h1 { font-size: 34px; }
  body.mode-mobile .menu-blurb { display: none; }
  body.mode-mobile .menu-meta { display: none; }
  body.mode-mobile .menu-kicker { margin-bottom: 4px; }
  body.mode-mobile .menu-buttons { margin-top: 10px; gap: 6px; }
  body.mode-mobile .menu-btn { min-height: 44px; padding: 8px 12px; }
  body.mode-mobile .menu-btn .btn-index { font-size: 8px; }
  body.mode-mobile .screen-inner { max-height: calc(100vh - 16px); padding: 14px 18px; }
  body.mode-mobile .screen-head { padding-bottom: 8px; margin-bottom: 10px; }
  body.mode-mobile .screen-head h2 { font-size: 22px; }
}

.overlay { overflow-y: auto; padding: 12px; }
.pause-panel { max-height: calc(100vh - 24px); overflow-y: auto; }

@media (max-height: 520px) {
  .overlay { padding: 8px; }
  .pause-panel { padding: 16px 18px; }
  .pause-panel h2 { font-size: 32px; }
  .pause-panel p { margin-top: 4px; }
  .pause-mode-row { margin-top: 8px; padding: 8px 0; }
  .pause-buttons { margin-top: 12px; gap: 6px; }
  .pause-buttons .btn { min-height: 36px; }
  .pause-tip { margin-top: 10px; }
}



