body.flight-focused { overflow: hidden; overscroll-behavior: none; }

.mission-layout[data-focus="true"] {
  --broadcast-bg: #07121e;
  --console-bg: #0d1c2a;
  --console-rule: #263b4d;
  --console-ink: #eef6fc;
  --console-muted: #a4b9cb;
  --console-teal: #80eccb;
  --console-blue: #82b9f7;
  --broadcast-gap: clamp(8px, 1.05vw, 16px);
  --broadcast-gutter: clamp(10px, 1.5vw, 24px);
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  grid-template:
    "mast mast" minmax(57px, auto)
    "feed rail" minmax(0, 1fr)
    "commands rail" auto
    "events events" auto / minmax(0, 1fr) clamp(285px, 27vw, 438px);
  gap: var(--broadcast-gap);
  padding: max(6px, env(safe-area-inset-top)) max(var(--broadcast-gutter), env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(var(--broadcast-gutter), env(safe-area-inset-left));
  background: radial-gradient(ellipse at top left, #12273b, var(--broadcast-bg) 45%);
  color: var(--console-ink);
}
.mission-layout[data-focus="true"][data-display="camera"] {
  grid-template:
    "mast" minmax(57px, auto)
    "feed" minmax(0, 1fr)
    "commands" auto
    "events" auto / minmax(0, 1fr);
}
[data-focus="true"] .flight-card { display: contents; }
[data-focus="true"] .plan-card,
[data-focus="true"] #compactTools { display: none; }

.broadcast-header {
  grid-area: mast;
  align-self: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px 14px;
}
.broadcast-ident { display: flex; align-items: center; gap: 11px; min-width: 0; }
.broadcast-ident .app-mark {
  flex: none;
  border: 1px solid #517ca16b;
  background: linear-gradient(155deg, #224767, #14314c 78%);
  box-shadow: inset 0 1px 0 #b7deff2b;
}
.broadcast-ident .app-mark i { background: #f0f8ff; }
.broadcast-ident strong,
.broadcast-ident div > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.broadcast-ident strong { font-size: clamp(1rem, 1.6vw, 1.45rem); line-height: 1.12; letter-spacing: -.037em; }
.broadcast-ident div { min-width: 0; }
.broadcast-ident div > span { margin-top: 3px; color: var(--console-muted); font-size: .78rem; }
.broadcast-clock {
  display: grid;
  text-align: center;
  gap: 1px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.broadcast-clock span { color: #a8bfd1; font-size: .7rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
.broadcast-clock strong { font: 700 clamp(1.22rem, 2.35vw, 2rem)/1.08 ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: -.055em; }
.broadcast-end { justify-self: end; display: flex; align-items: center; gap: 11px; }
.broadcast-button,
[data-focus="true"] .glass-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 41px;
  border: 1px solid var(--console-rule);
  border-radius: 10px;
  background: #132539;
  color: var(--console-ink);
  font-size: .82rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}
.broadcast-button { padding-inline: 11px; white-space: nowrap; }
[data-focus="true"] .glass-button { width: 41px; }
[data-focus="true"] .view-tools { gap: 5px; }
.broadcast-button[aria-pressed="true"] { border-color: #457c8d; color: #a5f4df; background: #143647; }
.broadcast-button:hover,
[data-focus="true"] .glass-button:hover { background: #244259; }
.trace-icon {
  display: inline-block;
  width: 15px;
  height: 14px;
  background: currentColor;
  clip-path: polygon(0 100%, 0 65%, 20% 65%, 20% 100%, 38% 100%, 38% 39%, 60% 39%, 60% 100%, 79% 100%, 79% 8%, 100% 8%, 100% 100%);
}

.mission-layout[data-focus="true"] .viewport {
  grid-area: feed;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #334f63;
  border-radius: 16px;
  background: #091726;
  box-shadow: 0 12px 38px #03071192;
}
[data-focus="true"] .viewport-shade {
  background: linear-gradient(0deg, #030a14e4, #06152235 32%, transparent 52%, transparent 80%, #05101c88);
}
[data-focus="true"] .view-top { z-index: 5; inset: 14px 16px auto; align-items: center; }
[data-focus="true"] .view-label,
.camera-tag {
  padding: 7px 9px;
  border: 1px solid #b4d2ec4d;
  border-radius: 7px;
  background: #071322c7;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}
[data-focus="true"] .view-label { font-size: .76rem; }
[data-focus="true"] .view-label > span:first-child { background: var(--console-teal); box-shadow: 0 0 10px #75e8c498; }
.camera-tag { color: #dceefa; font: 640 .72rem/1.1 ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: .04em; text-transform: uppercase; }

.mission-layout[data-focus="true"] .view-title {
  top: auto;
  bottom: 17px;
  left: 18px;
  max-width: min(56%, 560px);
  gap: 5px;
}
.mission-layout[data-focus="true"] .view-title span { color: #bbd5eb; font-size: .72rem; letter-spacing: .09em; }
.mission-layout[data-focus="true"] .view-title strong { font-size: clamp(1.35rem, 3.35vw, 3.1rem); }
.mission-layout[data-focus="true"][data-phase="countdown"] .view-title strong { font-size: clamp(2.5rem, 7vw, 6rem); }
[data-focus="true"] .telemetry { display: none; }
[data-focus="true"][data-display="camera"] .telemetry {
  display: flex;
  inset: 54px 15px auto auto;
  padding: 8px 10px;
}
[data-focus="true"] .telemetry div:last-child { display: none; }

.camera-switch {
  position: absolute;
  z-index: 3;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid #9fc6e544;
  border-radius: 10px;
  background: #071321da;
  backdrop-filter: blur(10px);
}
.camera-switch button {
  min-height: 36px;
  padding: 4px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #c1d5e5;
  font-size: .78rem;
  font-weight: 660;
}
.camera-switch button:hover { background: #1e3a54; }
.camera-switch button[aria-pressed="true"] { background: #275674; color: #effbff; box-shadow: 0 1px 6px #0107144f; }

[data-focus="true"] .command-deck {
  grid-area: commands;
  z-index: 2;
  min-height: 92px;
  gap: 8px 16px;
  padding: 13px 15px;
  border: 1px solid var(--console-rule);
  border-radius: 13px;
  background: linear-gradient(155deg, #11263a, #0c1b2a);
  color: var(--console-ink);
}
[data-focus="true"] .command-copy h2 { font-size: clamp(1.04rem, 2vw, 1.25rem); }
[data-focus="true"] .command-copy p,
[data-focus="true"] .stage-count,
[data-focus="true"] #stageClock { color: #bad0e1; }
[data-focus="true"] .flight-action { min-height: 51px; min-width: clamp(138px, 16vw, 216px); box-shadow: none; }
[data-focus="true"] .flight-action:disabled { background: #22384c; color: #bdcfe2; }
[data-focus="true"] .flight-action.in-window,
[data-focus="true"] .flight-action.is-held { color: #052a24; background: #82efd0; }
[data-focus="true"] .flight-action.in-window:hover,
[data-focus="true"] .flight-action.is-held:hover { background: #a4f5dc; }
[data-focus="true"] .flight-action.in-window kbd,
[data-focus="true"] .flight-action.is-held kbd { border-color: #0c584a64; }
[data-focus="true"] .meter,
[data-focus="true"] .stage-track { max-width: none; background: #2d4156; }
[data-focus="true"] .stage-progress { max-width: none; }
[data-focus="true"] .meter-band { background: #63c6a0; }
[data-focus="true"] .meter-marker { background: #f1f6ff; box-shadow: 0 0 9px #d8eaff5a; }

.broadcast-rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  gap: var(--broadcast-gap);
  scrollbar-width: thin;
  scrollbar-color: #426076 transparent;
}
[data-display="camera"] .broadcast-rail { display: none; }
.flight-instruments,
.flight-systems {
  flex: none;
  padding: clamp(10px, 1.25vw, 18px);
  border: 1px solid var(--console-rule);
  border-radius: 13px;
  background: var(--console-bg);
}
.flight-instruments h2,
.flight-systems h2 { color: #e7f2fa; font-size: .92rem; font-weight: 710; letter-spacing: -.025em; }
.flight-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 11px 0 0;
  border-top: 1px solid #345068;
}
.flight-metrics > div { min-width: 0; padding: 10px 4px; border-bottom: 1px solid #34506877; }
.flight-metrics > div:not(:nth-child(3n + 1)) { padding-left: 10px; border-left: 1px solid #34506877; }
.flight-metrics > div:nth-child(n+4) { padding-bottom: 0; border-bottom: 0; }
.flight-metrics dt { color: var(--console-muted); font-size: .71rem; font-weight: 640; white-space: nowrap; }
.flight-metrics dd {
  margin: 5px 0 0;
  color: #f3faff;
  font: 650 clamp(.96rem, 1.5vw, 1.4rem)/1.12 ui-monospace, "Cascadia Code", Consolas, monospace;
  letter-spacing: -.07em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.flight-metrics dd small { color: var(--console-muted); font: 650 .69rem/1 system-ui, sans-serif; letter-spacing: -.035em; }
.flight-metrics > div:nth-child(2) dd { color: var(--console-teal); }
.flight-metrics > div:nth-child(3) dd { color: #bedbf8; }
.broadcast-rail .mission-trace { flex: 1 0 auto; }
.systems-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.systems-heading strong { color: var(--console-teal); font: 680 .79rem ui-monospace, "Cascadia Code", Consolas, monospace; }
.thrust-meter { height: 5px; overflow: hidden; margin-top: 9px; border-radius: 6px; background: #263c50; }
.thrust-meter > span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #4c9de8, #78e9c7); }
.flight-callout { display: flex; align-items: center; gap: 7px; margin-top: 11px; color: #b9ccdc; font-size: .76rem; line-height: 1.3; }
.flight-callout > span:first-child { flex: none; width: 5px; height: 5px; border-radius: 100%; background: #76cafe; }

.event-strip { grid-area: events; min-width: 0; }
.event-timeline {
  display: grid;
  grid-template-columns: repeat(var(--event-count, 6), minmax(114px, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #426076 transparent;
  list-style: none;
  border: 1px solid var(--console-rule);
  border-radius: 13px;
  background: #0b1a28;
}
.event-step {
  position: relative;
  min-height: 58px;
  min-width: 0;
  border-top: 2px solid #364c62;
  border-right: 1px solid #263a4a;
}
.event-step > button {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-content: center;
  align-items: center;
  gap: 4px 8px;
  width: 100%;
  height: 100%;
  min-height: inherit;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  text-align: left;
}
.event-step > button:not(:disabled):hover { background: #39788e53; }
.event-step > button:focus-visible { outline-offset: -3px; }
.event-step:last-child { border-right: 0; }
.event-step[data-state="done"] { border-top-color: #438e8b; }
.event-step[data-state="current"] { border-top-color: var(--console-teal); background: linear-gradient(170deg, #16414b, #112b3b); }
.event-step[data-state="missed"] { border-top-color: #ed9f81; background: #422a2c; }
.event-step[data-state="current"]::after {
  content: "";
  position: absolute;
  inset: auto auto 0 0;
  width: var(--step-progress, 0%);
  height: 2px;
  background: #80eccba0;
  pointer-events: none;
}
.event-step .event-light {
  grid-row: 1 / span 2;
  width: 10px;
  height: 10px;
  border: 1px solid #8195aa;
  border-radius: 50%;
}
.event-step[data-state="done"] .event-light { background: #77d2ba; border-color: #77d2ba; }
.event-step[data-state="current"] .event-light { background: #9cffdf; border-color: #9cffdf; box-shadow: 0 0 11px #83efd093; }
.event-step[data-state="missed"] .event-light { background: #ffb598; border-color: #ffb598; }
.event-step strong {
  overflow: hidden;
  color: #dce8f4;
  font-size: .8rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-step small {
  color: var(--console-muted);
  font: 600 .71rem/1.05 ui-monospace, "Cascadia Code", Consolas, monospace;
  white-space: nowrap;
}
.event-step[data-state="current"] small { color: #afe8db; }

[data-focus="true"] .result-layer { z-index: 4; padding: 12px; }
[data-focus="true"] .result {
  max-height: 100%;
  overflow: auto;
  padding: 16px 18px 13px;
  border-color: #527185;
  background: #0b1d2bf7;
  color: var(--console-ink);
  box-shadow: 0 20px 44px #030a14ad;
}
[data-focus="true"] .result p { color: #bfd0e1; }
[data-focus="true"] .result-mark { color: var(--console-teal); }
[data-focus="true"] .result-link { color: #aad9ff; }
[data-focus="true"][data-phase="success"] .result-layer,
[data-focus="true"][data-phase="failed"] .result-layer { justify-items: center; background: #03091187; }
.result-report { display: flex; justify-content: space-evenly; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 8px 4px; border: 1px solid #577b965c; border-radius: 8px; }
.result-report div { display: grid; gap: 4px; }
.result-report dt { font-size: .69rem; color: #8299ae; }
.result-report dd { margin: 0; white-space: nowrap; font-size: .86rem; font-weight: 720; font-variant-numeric: tabular-nums; }
.result-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 12px; }

.replay-deck {
  grid-area: commands;
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 82px;
  padding: 12px 15px;
  border: 1px solid var(--console-rule);
  border-radius: 13px;
  background: linear-gradient(155deg, #11263a, #0c1b2a);
}
#replayPlay { min-width: 76px; }
.replay-slider { min-width: 0; }
.replay-slider > div { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 3px 6px; }
.replay-slider label { color: var(--console-ink); font-size: .93rem; font-weight: 690; }
#replayTime { color: var(--console-muted); white-space: nowrap; font: 650 .73rem ui-monospace, "Cascadia Code", Consolas, monospace; }
#replayScrub { display: block; width: 100%; height: 27px; margin: 1px 0 0; accent-color: var(--console-teal); cursor: pointer; }
[data-review="true"] .view-label > span:first-child { background: #ffd78c; box-shadow: none; }

@media (min-width: 851px) and (min-height: 581px) and (max-height: 760px) {
  .flight-instruments,
  .flight-systems { padding: 10px 12px; }
  .flight-metrics { margin-top: 8px; }
  .flight-metrics > div { padding-block: 7px; }
  .flight-metrics > div:nth-child(n+4) { padding-bottom: 0; }
  .flight-metrics dd { margin-top: 4px; }
  .broadcast-rail .mission-trace { --trace-plot-height: clamp(136px, 21vh, 159px); gap: 8px; padding: 10px; }
  .flight-callout { margin-top: 8px; }
}
@media (max-width: 850px), (max-height: 580px) {
  .mission-layout[data-focus="true"],
  .mission-layout[data-focus="true"][data-display="camera"] {
    grid-template:
      "mast" minmax(50px, auto)
      "feed" minmax(0, 1fr)
      "commands" auto
      "events" auto / minmax(0, 1fr);
  }
  [data-focus="true"] .broadcast-rail { display: none; }
  [data-focus="true"][data-display="telemetry"] .broadcast-rail { display: flex; grid-area: feed; }
  [data-focus="true"][data-display="telemetry"] .viewport { visibility: hidden; }
  [data-focus="true"]:not([data-display="telemetry"]) .telemetry {
    display: flex;
    inset: 53px 12px auto auto;
    gap: 11px;
    padding: 6px 8px;
  }
  [data-focus="true"] .telemetry span { font-size: .68rem; }
  [data-focus="true"] .telemetry strong { font-size: .95rem; }
  .flight-metrics dd { font-size: clamp(1.02rem, 3.8vw, 1.45rem); }
}
@media (min-width: 601px) and (max-width: 760px) {
  .broadcast-header { grid-template-columns: minmax(0, 1fr) auto auto; }
}
@media (max-width: 600px) {
  .broadcast-header { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-self: center; }
  .broadcast-ident { gap: 7px; }
  .broadcast-ident .app-mark { width: 28px; height: 28px; border-radius: 8px; }
  .broadcast-ident div > span { font-size: .69rem; }
  .broadcast-clock { justify-self: end; grid-column: 2; }
  .broadcast-end { grid-column: 1 / -1; justify-self: stretch; justify-content: space-between; margin-top: 3px; }
  .broadcast-button,
  [data-focus="true"] .glass-button { height: 39px; }
  [data-focus="true"] .glass-button { width: 39px; }
  [data-focus="true"] .view-top { inset: 9px 10px auto; }
  .mission-layout[data-focus="true"] .view-title { left: 12px; bottom: 62px; max-width: calc(100% - 24px); }
  .camera-switch { right: 9px; bottom: 8px; }
  .camera-switch button { min-height: 42px; }
  [data-focus="true"] .command-deck { gap: 5px 9px; padding: 9px 10px; }
  [data-focus="true"] .command-copy p { font-size: .81rem; }
  [data-focus="true"] .flight-action { min-width: 100px; padding-inline: 10px; }
  .event-step { min-height: 51px; }
  .event-step > button { padding-inline: 8px; }
  .event-step strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .replay-deck { grid-template-columns: auto minmax(65px, 1fr) auto auto; padding: 8px; gap: 6px; }
  #replayPlay { min-width: 52px; padding-inline: 8px; }
  .replay-slider label { font-size: .83rem; }
  .replay-deck .broadcast-button { padding-inline: 7px; font-size: .77rem; }
}
@media (max-width: 315px) {
  .trace-toggle-label { display: none; }
  [data-focus="true"] .result-links { flex-wrap: nowrap; gap: 4px; }
  [data-focus="true"] .result-link { min-width: 0; }
}
@media (max-height: 520px) {
  [data-focus="true"]:is([data-phase="paused"], [data-phase="failed"], [data-phase="success"]):not([data-review="true"]) .command-deck {
    display: none;
  }
  [data-focus="true"] .result-layer { z-index: 6; padding: 8px; }
  [data-focus="true"] .result { width: min(498px, 100%); padding: 8px 12px; }
  [data-focus="true"] .result-mark { min-height: 0; margin: 0; font-size: 1.12rem; line-height: 1.1; }
  [data-focus="true"] .result h2 { font-size: 1.18rem; }
  [data-focus="true"] .result p { min-height: 0; margin: 4px 0 7px; font-size: .82rem; }
  [data-focus="true"] .result-report { margin-bottom: 7px; padding: 5px 4px; }
  [data-focus="true"] .result .primary { min-height: 40px; padding: 7px 12px; }
  [data-focus="true"] .result-link { min-height: 34px; padding: 5px 4px; }
}
@media (min-width: 460px) and (max-height: 430px) {
  [data-focus="true"] .result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 12px;
  }
  [data-focus="true"] .result-mark { grid-area: 1 / 2; justify-self: end; }
  [data-focus="true"] .result h2 { grid-area: 1 / 1 / 2 / -1; padding-right: 76px; text-align: left; }
  [data-focus="true"] .result > :is(p, .result-report) { grid-column: 1 / -1; }
  [data-focus="true"] .result-links { justify-content: flex-end; }
}
@media (min-width: 460px) and (max-height: 300px) {
  [data-focus="true"] .result-layer { padding: 4px; }
  [data-focus="true"] .result p { margin-block: 2px 4px; }
  [data-focus="true"] .result-report { margin-bottom: 4px; padding-block: 3px; }
}
@media (max-height: 430px) and (orientation: landscape) {
  .mission-layout[data-focus="true"],
  .mission-layout[data-focus="true"][data-display="camera"] {
    --broadcast-gap: 5px;
    grid-template-rows: minmax(42px, auto) minmax(0, 1fr) auto auto;
    padding-block: 4px 6px;
  }
  .broadcast-ident div > span,
  .broadcast-clock span { display: none; }
  .broadcast-header { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .broadcast-end { grid-column: 3; justify-self: end; margin: 0; gap: 4px; }
  .broadcast-button { padding-inline: 7px; }
  .broadcast-button,
  [data-focus="true"] .glass-button { height: 34px; }
  [data-focus="true"] .glass-button { width: 34px; }
  .trace-toggle-label { display: none; }
  [data-focus="true"] .command-deck { min-height: 58px; padding: 6px 9px; }
  [data-focus="true"] .flight-action { min-height: 42px; }
  [data-focus="true"] .command-heading { gap: 3px 8px; }
  [data-focus="true"] .command-copy p { margin-top: 2px; }
  [data-focus="true"] .meter { margin-top: 5px; height: 6px; }
  [data-focus="true"] .meter-marker { height: 10px; }
  [data-focus="true"] .stage-progress { margin-top: 3px; }
  [data-focus="true"]:not([data-display="telemetry"]) .telemetry { display: none; }
  .mission-layout[data-focus="true"] .view-title { bottom: 9px; max-width: 47%; }
  .mission-layout[data-focus="true"][data-phase="countdown"] .view-title strong { font-size: 2.3rem; }
  .camera-switch { bottom: 6px; right: 7px; }
  .camera-switch button { padding-inline: 7px; min-height: 33px; }
  .event-step { min-height: 37px; }
  .event-step > button { gap: 3px 5px; padding-block: 4px; }
  .event-step strong { display: block; white-space: nowrap; }
  .replay-deck { min-height: 55px; padding-block: 5px; }
}
@media (max-width: 365px) {
  [data-focus="true"] .command-deck { grid-template-columns: minmax(0, 1fr) auto; }
  [data-focus="true"] .flight-action { width: auto; max-width: 126px; }
}
