:root {
  color-scheme: dark;
  --bg: #050709;
  --panel: #090e12;
  --line: rgba(157, 205, 222, .16);
  --text: #edf7fa;
  --muted: #8aa0a8;
  --cyan: #26e9ff;
  --magenta: #ff3abf;
  --lime: #a7ff39;
  --amber: #ffb43b;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "Helvetica Neue", Arial, sans-serif; }
body { overflow-x: hidden; background-image: radial-gradient(circle at 50% -20%, #152831 0, transparent 44%), linear-gradient(115deg, rgba(38,233,255,.025) 1px, transparent 1px); background-size: auto, 18px 18px; }
button, a { font: inherit; }
button { color: inherit; }
.shell { width: min(1480px, 100%); min-height: 100svh; margin: 0 auto; padding: 16px clamp(12px, 2.2vw, 34px) 22px; }
.masthead { min-height: 54px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; border: 1px solid var(--line); border-bottom: 0; padding: 0 15px; background: rgba(5,8,10,.86); letter-spacing: .08em; }
.back { color: #a8bbc2; text-decoration: none; font-size: 11px; justify-self: start; }
.back:hover, .back:focus-visible { color: var(--cyan); }
.brand { font-weight: 800; font-size: 13px; white-space: nowrap; }
.brand small { margin-left: 12px; color: var(--muted); font-size: 9px; font-weight: 500; }
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 14px var(--lime); animation: blink 2.1s steps(2) infinite; }
.icon-button { justify-self: end; min-height: 32px; border: 1px solid var(--line); background: transparent; padding: 0 10px; font-size: 9px; letter-spacing: .12em; cursor: pointer; }
.icon-button[aria-pressed="true"] { border-color: var(--cyan); color: var(--cyan); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 360px); min-height: min(72svh, 820px); border: 1px solid var(--line); }
.viewport-wrap { position: relative; min-height: 600px; overflow: hidden; background: #050709; touch-action: none; }
#viewport { position: absolute; inset: 0; display: block; width: 100%; height: 100%; outline: none; }
#viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--cyan); }
.scanlines { pointer-events: none; position: absolute; inset: 0; z-index: 2; opacity: .08; background: repeating-linear-gradient(0deg, transparent 0 3px, #b9f4ff 4px); mix-blend-mode: screen; }
.viewport-label { pointer-events: none; position: absolute; z-index: 3; left: 18px; right: 18px; top: 16px; display: flex; justify-content: space-between; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; letter-spacing: .18em; color: #7f9aa4; }
.viewport-label span:last-child { color: var(--lime); }
.mission-hud { pointer-events: none; position: absolute; z-index: 4; left: 18px; right: 18px; top: 42px; display: grid; grid-template-columns: 1.3fr .65fr .8fr 1fr 1.3fr; gap: 1px; background: rgba(120,165,180,.16); border: 1px solid var(--line); }
.mission-stat { position: relative; min-height: 44px; padding: 7px 9px; background: rgba(6,10,13,.88); }
.mission-stat span { display: block; color: #718991; font: 7px ui-monospace, monospace; letter-spacing: .14em; }
.mission-stat strong { display: block; margin-top: 4px; font: 15px ui-monospace, monospace; letter-spacing: .04em; }
.mission-stat i { position: absolute; left: 9px; right: 9px; bottom: 4px; height: 2px; background: #142127; }
.mission-stat i b { display: block; width: 100%; height: 100%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); transition: width .12s; }
.heat-stat strong { color: var(--amber); }
.heat-stat i b { width: 0; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.heat-stat i b.critical { background: #ff315f; box-shadow: 0 0 12px #ff315f; }
.instruction { pointer-events: none; position: absolute; z-index: 3; left: 50%; top: 12%; transform: translateX(-50%); width: min(88%, 470px); text-align: center; transition: opacity .5s, transform .5s; }
.instruction strong { display: block; font-size: clamp(16px, 2vw, 25px); letter-spacing: .13em; }
.instruction span { display: inline-block; margin-top: 7px; color: #a6bac1; font-size: 11px; letter-spacing: .05em; }
.instruction.dismissed { opacity: 0; transform: translate(-50%, -10px); }
.pulse-button { position: absolute; z-index: 6; right: 18px; bottom: 18px; width: 112px; min-height: 54px; border: 1px solid var(--cyan); background: rgba(5,15,19,.9); color: var(--cyan); cursor: pointer; letter-spacing: .1em; }
.pulse-button span, .pulse-button b { display: block; }
.pulse-button span { font-size: 9px; font-weight: 800; }
.pulse-button b { margin-top: 4px; font: 8px ui-monospace, monospace; color: var(--lime); }
.pulse-button:disabled { cursor: not-allowed; border-color: #304149; color: #66777d; opacity: .72; }
.pulse-button:disabled b { color: #8b6e58; }
.combat-callout { pointer-events: none; position: absolute; z-index: 7; left: 50%; top: 28%; transform: translate(-50%, -12px); min-width: 220px; padding: 9px 14px; border: 1px solid var(--cyan); background: rgba(4,13,17,.88); color: var(--cyan); text-align: center; font: 10px ui-monospace, monospace; letter-spacing: .12em; opacity: 0; transition: opacity .18s, transform .18s; }
.combat-callout.visible { opacity: 1; transform: translate(-50%, 0); }
.combat-callout.danger { border-color: #ff315f; color: #ff657f; }
.combat-callout.success { border-color: var(--lime); color: var(--lime); }
.hold-ring { --hold: 0deg; pointer-events: none; opacity: 0; position: absolute; z-index: 4; left: 50%; bottom: 8%; width: 80px; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; background: conic-gradient(var(--cyan) var(--hold), rgba(38,233,255,.08) 0); padding: 2px; transition: opacity .2s; box-shadow: 0 0 24px rgba(38,233,255,.16); }
.hold-ring span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--bg); }
.hold-ring.visible { opacity: 1; }
.context-alert { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; background: rgba(5,7,9,.92); color: var(--amber); letter-spacing: .12em; }
.context-alert[hidden] { display: none; }
.instrument-panel { position: relative; z-index: 4; min-width: 0; padding: 17px; border-left: 1px solid var(--line); background: linear-gradient(180deg, rgba(12,18,22,.97), rgba(7,11,14,.98)); }
.panel-head, .chart-head { display: flex; justify-content: space-between; color: #718991; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; letter-spacing: .15em; }
#mode-badge { color: var(--lime); }
.hero-meter { margin-top: 28px; }
.meter-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.meter-copy span { font-size: 9px; color: #91a7ae; letter-spacing: .15em; }
.meter-copy strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 34px; font-weight: 300; letter-spacing: -.05em; }
.meter-track { position: relative; height: 6px; margin-top: 8px; overflow: visible; background: #10191d; }
.meter-track i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--cyan); box-shadow: 0 0 15px rgba(38,233,255,.75); transition: width .12s linear; }
.threshold { position: absolute; top: -4px; bottom: -4px; left: 92%; border-left: 1px solid #fff; opacity: .75; }
.energy .meter-copy strong { color: var(--magenta); }
.energy .meter-track i { background: var(--magenta); box-shadow: 0 0 15px rgba(255,58,191,.6); }
.energy-window { position: absolute; left: 6%; width: 78%; top: -3px; bottom: -3px; border: 1px solid rgba(167,255,57,.6); }
.readouts { margin: 26px 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.readouts div { min-height: 57px; padding: 9px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.readouts dt { font-size: 8px; letter-spacing: .13em; color: #728991; }
.readouts dd { margin: 7px 0 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; }
.chart-head { margin-bottom: 7px; }
#telemetry-chart { display: block; width: 100%; height: 92px; border: 1px solid var(--line); }
.diagnostic { min-height: 45px; margin: 13px 0 0; padding: 9px 10px; border-left: 2px solid var(--amber); background: rgba(255,180,59,.055); color: #c5d0d4; font-size: 10px; line-height: 1.55; }
.controls { display: flex; min-height: 62px; border: 1px solid var(--line); border-top: 0; background: #080c0f; }
.controls > div { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border-right: 1px solid var(--line); font-size: 9px; color: #83999f; }
kbd { min-width: 35px; padding: 5px 7px; border: 1px solid #37505a; background: #0c1519; color: #d8e9ed; font: 8px ui-monospace, monospace; text-align: center; }
.operator { margin-left: auto; border-right: 0 !important; }
.operator img { width: 32px; height: 32px; object-fit: contain; filter: grayscale(1) contrast(1.4); opacity: .62; }
.operator b { color: var(--lime); font-weight: 500; }
.summary { width: min(520px, calc(100% - 28px)); border: 1px solid rgba(38,233,255,.45); padding: 0; color: var(--text); background: rgba(5,9,12,.96); box-shadow: 0 0 80px rgba(38,233,255,.17); }
.summary::backdrop { background: rgba(0,4,7,.74); backdrop-filter: blur(8px); }
.summary form { padding: clamp(24px, 6vw, 50px); text-align: center; }
.eyebrow { color: var(--lime); font: 10px ui-monospace, monospace; letter-spacing: .22em; }
.summary h1 { margin: 12px 0 28px; font-size: clamp(46px, 10vw, 78px); line-height: .83; letter-spacing: -.07em; }
.summary-score { padding: 17px; border: 1px solid var(--line); }
.summary-score span { display: block; color: var(--muted); font-size: 9px; letter-spacing: .16em; }
.summary-score strong { display: block; margin-top: 7px; color: var(--cyan); font: 36px ui-monospace, monospace; }
.summary #summary-detail { color: #98abb2; font-size: 11px; }
.summary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 24px; }
.summary-actions button { min-height: 48px; border: 1px solid var(--cyan); background: transparent; cursor: pointer; font-size: 10px; letter-spacing: .1em; }
.summary-actions button:first-child { background: var(--cyan); color: #031014; font-weight: 800; }
@keyframes blink { 50% { opacity: .35; } }

@media (max-width: 760px) {
  .shell { padding: 0; }
  .masthead { grid-template-columns: 1fr auto; min-height: 46px; border-left: 0; border-right: 0; }
  .brand { grid-row: 1; grid-column: 1; font-size: 11px; }
  .brand small, .back { display: none; }
  .workspace { display: flex; min-height: auto; flex-direction: column; border-left: 0; border-right: 0; }
  .viewport-wrap { min-height: 57svh; }
  .instrument-panel { border-left: 0; border-top: 1px solid var(--line); padding: 13px; }
  .hero-meter { display: inline-block; width: calc(50% - 7px); margin-top: 16px; vertical-align: top; }
  .hero-meter + .hero-meter { margin-left: 10px; }
  .meter-copy { align-items: center; }
  .meter-copy strong { font-size: 24px; }
  .readouts { grid-template-columns: repeat(3, 1fr); margin: 16px 0; }
  .readouts div { min-height: 48px; padding: 7px; }
  .readouts dd { font-size: 13px; }
  #telemetry-chart { height: 66px; }
  .diagnostic { min-height: 36px; margin-top: 8px; }
  .controls { display: none; }
  .instruction { top: 9%; }
  .instruction strong { font-size: 14px; }
  .mission-hud { left: 8px; right: 8px; top: 31px; grid-template-columns: 1.1fr .55fr .7fr 1fr 1.1fr; }
  .mission-stat { min-height: 38px; padding: 5px 6px; }
  .mission-stat span { font-size: 6px; }
  .mission-stat strong { font-size: 12px; }
  .pulse-button { right: 10px; bottom: 10px; width: 96px; min-height: 48px; }
  .combat-callout { top: 25%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .scanlines { display: none; }
}
