/* Shared compact HUD. Values follow their shield arcs; controls retain generous hit areas. */
:root {
  --hud-font: 11px;
  --own-art-size: 80px;
  --own-diagram-width: 180px;
  --own-diagram-height: 108px;
  --own-label-width: 46px;
  --target-art-size: 48px;
  --target-shield-width: 148px;
  --target-shield-height: 58px;
  --target-label-width: 44px;
}
main {
  /* A zoomed roster must scroll within the single available row, never size it. */
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  grid-template-columns: clamp(200px, 7.3vw, 280px) minmax(0, 1fr);
  padding-right: 0;
}
.viewport {
  grid-column: auto;
  grid-row: auto;
  height: auto;
  min-height: 0;
  min-width: 0;
  --hud-mission: 0px;
}
.viewport .map-label {
  top: calc(var(--hud-mission) + 8px);
  transform: none !important;
  left: 14px;
  font-size: var(--hud-font);
  line-height: 16px;
  padding: 3px 10px;
  pointer-events: none;
}
.viewport .view-controls {
  top: calc(var(--hud-mission) + 8px);
  transform: none !important;
  right: 14px;
}
.viewport .map-label small {
  font-size: var(--hud-font);
  line-height: 16px;
  margin: 3px 0 0;
}
.viewport .view-controls button {
  font-size: var(--hud-font);
  padding: 5px 8px;
}
#terrain-status {
  color: #bfe9ef;
  flex: 1 1 100%;
  line-height: 1.35;
  text-align: center;
}
.map-footer:has(#terrain-status:not(:empty)) {
  align-items: flex-start;
  flex-wrap: wrap;
}
.map-footer #terrain-status {
  max-width: min(100%, 1100px);
}
#terrain-legend {
  position: absolute;
  z-index: 8;
  top: calc(var(--hud-mission) + 48px);
  right: 14px;
  width: min(460px, calc(100% - 28px));
  max-height: min(48vh, 380px);
  overflow: auto;
  padding: 9px;
  border: 1px solid #668596;
  border-radius: 5px;
  background: #091722ed;
  color: #dce6ef;
  font-size: var(--hud-font);
  pointer-events: auto;
}
.terrain-legend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #41617366;
  line-height: 1.35;
}
.terrain-legend-row:last-child {
  border-bottom: 0;
}
#terrain-legend button {
  min-height: 26px;
}
#terrain-tooltip {
  position: absolute;
  z-index: 9;
  max-width: min(340px, calc(100% - 16px));
  padding: 7px 9px;
  border: 1px solid #8aa5ba;
  border-radius: 4px;
  background: #08131ded;
  color: #f0f4fb;
  font-size: var(--hud-font);
  line-height: 1.35;
  pointer-events: none;
}
#terrain-legend[hidden],
#terrain-tooltip[hidden] {
  display: none;
}
#mission-bar {
  height: auto;
  min-height: 52px;
  max-height: min(34vh, 260px);
  gap: 16px;
  padding: 7px 14px;
  flex-wrap: wrap;
  overflow-y: auto;
}
#rescue-controls,
#bombardment-controls,
#derelict-controls,
#depot-controls,
#duel-controls {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#minefield-controls {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#minefield-controls[hidden] {
  display: none;
}
.minefield-readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  align-items: baseline;
  gap: 3px 10px;
  flex: 1 1 420px;
  min-width: 180px;
  overflow-wrap: anywhere;
}
.minefield-readout small {
  grid-column: 1 / -1;
  opacity: 0.85;
}
#minefield-controls button {
  min-height: 34px;
  flex: 0 0 auto;
  white-space: normal;
}
#minefield-controls button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
#rescue-controls[hidden],
#bombardment-controls[hidden],
#derelict-controls[hidden],
#depot-controls[hidden],
#duel-controls[hidden] {
  display: none;
}
.depot-readout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 3px 10px;
  min-width: 260px;
}
.depot-readout small {
  grid-column: 1 / -1;
}
.depot-structures {
  display: flex;
  flex: 1 1 760px;
  gap: 5px;
  min-width: 0;
}
.depot-row {
  display: grid;
  flex: 1 1 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 6px;
  min-width: 150px;
  padding: 4px 6px;
  border: 1px solid #668596;
  border-radius: 4px;
}
.depot-row b {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}
.depot-row.destroyed {
  opacity: 0.75;
  border-style: dashed;
}
.depot-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
#depot-controls button {
  min-height: 34px;
  font-size: max(12px, var(--hud-font));
}
.duel-readout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 3px 10px;
  flex: 1 1 520px;
  min-width: 260px;
}
.duel-readout small {
  grid-column: 1 / -1;
}
#duel-honor[data-honor='intact'] {
  color: #f0c75e;
}
#duel-honor:not([data-honor='intact']) {
  color: #ff9a80;
  text-decoration: underline dashed;
}
.duel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
#duel-controls button {
  min-height: 34px;
  font-size: max(12px, var(--hud-font));
}
.derelict-readout {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 3px 10px;
  min-width: 220px;
}
.derelict-readout small {
  grid-column: 1 / -1;
}
.derelict-lots {
  display: flex;
  flex: 1 1 620px;
  gap: 5px;
  overflow: auto;
  min-width: 0;
}
.derelict-lots button {
  display: grid;
  flex: 1 0 155px;
  min-height: 40px;
  text-align: left;
  white-space: normal;
}
.derelict-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.derelict-work {
  flex: 1 1 100px;
  min-width: 80px;
  height: 8px;
  overflow: hidden;
  border: 1px solid currentColor;
}
.derelict-work span {
  display: block;
  height: 100%;
  width: 0;
  background: #55d2c0;
}
#derelict-controls button {
  min-height: 34px;
  font-size: max(12px, var(--hud-font));
}
.rescue-readout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 2px 10px;
  min-width: 180px;
}
.rescue-readout small {
  grid-column: 1 / -1;
  opacity: 0.8;
}
.rescue-track {
  flex: 1 1 90px;
  min-width: 70px;
  max-width: 180px;
}
#rescue-controls button {
  min-height: 34px;
  flex: 0 0 auto;
  white-space: nowrap;
}
#bombardment-readout {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
  flex: 1 1 700px;
  min-width: 0;
  font-size: max(12px, var(--hud-font));
}
.bombardment-districts,
.bombardment-manifest {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}
.bombardment-districts span,
.bombardment-manifest button,
.bombardment-actions button {
  font-size: max(12px, var(--hud-font));
  min-height: 30px;
}
.bombardment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#rescue-controls button:focus-visible,
#bombardment-controls button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.mission-service-controls {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(0, 2fr) auto auto;
  align-items: center;
  gap: 8px;
  flex: 1 1 100%;
  min-width: 0;
  max-height: min(32vh, 210px);
  overflow: auto;
}
.mission-service-controls[hidden] {
  display: none;
}
.mission-service-readout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  min-width: 0;
  font-size: max(12px, 0.85em);
}
.mission-service-readout :is(b, span, small) {
  overflow-wrap: anywhere;
}
.mission-service-choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.mission-service-controls button {
  min-height: 34px;
  white-space: normal;
}
.mission-service-controls button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.evacuation-controls {
  display: grid;
  grid-template-columns: minmax(230px, 0.7fr) minmax(820px, 2fr) minmax(430px, 1.4fr);
  align-items: center;
  gap: 8px 14px;
  flex: 1 1 100%;
  min-width: 0;
}
.evacuation-controls[hidden] {
  display: none;
}
.evacuation-readout,
.evacuation-order-controls {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-size: max(12px, var(--hud-font));
}
.evacuation-readout :is(b, span, small),
.evacuation-order-controls span {
  overflow-wrap: anywhere;
}
.evacuation-manifest {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  padding: 3px;
}
.evacuation-manifest button {
  flex: 1 0 150px;
  min-height: 42px;
  white-space: normal;
  font-size: max(12px, var(--hud-font));
}
.evacuation-manifest button[aria-pressed='true'] {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}
.evacuation-order-controls > div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.evacuation-order-controls button {
  min-height: 38px;
  white-space: normal;
  font-size: max(12px, var(--hud-font));
}
.evacuation-controls button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 900px) {
  #rescue-controls,
  #minefield-controls,
  .mission-service-controls {
    flex-wrap: wrap;
  }
  .mission-service-controls {
    grid-template-columns: 1fr;
  }
  .minefield-readout {
    grid-template-columns: 1fr;
    flex-basis: 100%;
  }
  .rescue-readout {
    flex: 1 1 100%;
  }
}
#last-ditch-banner {
  position: absolute;
  z-index: 7;
  top: 46px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 9px 14px;
  transform: translateX(-50%);
  border: 1px solid #c87353;
  border-radius: 4px;
  background: #271b1cf2;
  box-shadow: 0 8px 28px #0009;
  color: #ffe0c2;
}
#last-ditch-banner[hidden] {
  display: none;
}
#last-ditch-banner strong {
  min-width: 0;
  text-align: center;
  overflow-wrap: anywhere;
  font:
    600 16px/1.3 'IBM Plex Mono',
    monospace;
}
#last-ditch-banner button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 12px;
  border-color: #c87353;
  white-space: nowrap;
}
.viewport.has-mission-bar #last-ditch-banner {
  top: calc(var(--mission-bar, 52px) + 46px);
}
#mission-bar small,
#mission-bar button,
.battle-console :is(button, select, label, p, small, span, b, summary, .module-status),
.hud-target :is(p, small, span, b),
.own-controls .stats small,
.left :is(strong, small, .roster-health, .section-title, #fleet-filters button),
.left .section-title span,
#target-info,
#target-sectors > div span {
  font-size: var(--hud-font);
}
#mission-bar .mission-service-readout small {
  font-size: max(12px, var(--hud-font));
}
#mission-bar #hold-line-controls button {
  font-size: max(12px, var(--hud-font));
}
.left .legend {
  gap: 8px;
  margin-top: 6px;
  font-size: var(--hud-font);
}
#mission-objective {
  font-size: var(--hud-font);
  white-space: normal;
}
#campaign-alert {
  font-size: var(--hud-font);
  flex: 0 1 280px;
  line-height: 1.3;
}
#mission-bar .mission-bar-clock b,
#command-content .captain-card strong {
  font-size: 15px;
}
.battle-console {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  background: #091722f2;
  border: 1px solid #416173;
  border-radius: 5px;
  box-shadow: 0 8px 24px #0008;
  color: #dce6ef;
  font-size: var(--hud-font);
  text-align: left;
  backdrop-filter: blur(10px);
  bottom: 26px;
  width: min(960px, calc(100% - 16px));
  max-width: 960px;
}
.hud-target {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  background: #091722f2;
  border: 1px solid #416173;
  border-radius: 5px;
  box-shadow: 0 8px 24px #0008;
  color: #dce6ef;
  font-size: var(--hud-font);
  text-align: left;
  backdrop-filter: blur(10px);
  border-color: #8a514e;
  width: min(900px, calc(100% - 24px));
  min-height: 0;
  max-height: calc(100% - 64px);
  overflow: auto;
}
.battle-console *,
.hud-target * {
  box-sizing: border-box;
}
.battle-console button {
  padding: 4px 6px;
  font-size: var(--hud-font);
  min-height: 22px;
  padding-top: 1px;
  padding-bottom: 1px;
  line-height: 18px;
}
.battle-console .section-title {
  font:
    var(--hud-font)/16px 'Barlow Condensed',
    sans-serif;
  letter-spacing: 1px;
  margin: 4px 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
}
.battle-console .command-section {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
  min-width: 0;
}
.battle-console .hint {
  font-size: var(--hud-font);
  line-height: 1.3;
  min-height: 0;
  margin: 4px 0;
}
.console-main {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  /* Scroll the controls, leaving the absolute diagnostics drawer free to open
     above the console rather than clipping it inside a scroll container. */
  max-height: calc((100dvh - 180px) / var(--gui-size, 1));
  overflow: auto;
}
.own-wing {
  min-width: 0;
  border-top: 2px solid var(--cyan);
  padding: 4px 8px;
}
.firing-spine {
  min-width: 0;
  border-top: 2px solid var(--cyan);
  border-left: 1px solid var(--line);
  border-top-color: #698b9c;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}
.battle-console.hostile .own-wing {
  border-top-color: var(--red);
}
.command-identity {
  align-items: center;
  background: none;
  display: block;
}
#ship-name {
  font:
    14px/1 'Barlow Condensed',
    sans-serif;
  overflow-wrap: anywhere;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.command-identity .meter {
  height: 4px;
  margin: 1px 0 0;
}
#hull-number {
  color: var(--cyan);
  flex: 0 0 auto;
  line-height: 18px;
  font-size: 13px;
}
.own-body {
  display: grid;
  align-items: center;
  gap: 6px;
  margin-top: 0;
  grid-template-columns: var(--own-diagram-width) minmax(0, 1fr);
}
.own-controls .stats {
  display: flex;
  padding: 0;
  flex-wrap: wrap;
  margin: 0 0 2px;
  gap: 8px;
  line-height: 14px;
}
.own-controls .stats > div {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}
.own-controls .stats strong {
  margin-top: 0;
  font-size: 13px;
  white-space: nowrap;
}
#power,
#orders {
  display: flex;
  margin: 0;
  flex-wrap: nowrap;
  gap: 3px;
}
#power button,
#orders button {
  font-size: var(--hud-font);
  flex: 1 1 0;
  flex-basis: 0;
  min-width: 0;
  padding: 1px 3px;
  min-height: 22px;
  padding-top: 1px;
  padding-bottom: 1px;
  line-height: 18px;
}
.own-controls .command-section {
  margin-top: 3px;
}
#ship-diagram {
  position: relative;
  margin: 0;
  border: 0;
  background: none;
  aspect-ratio: auto;
  height: var(--own-diagram-height);
  width: var(--own-diagram-width);
}
.target-shields {
  margin: 0;
  border: 0;
  background: none;
  aspect-ratio: auto;
  position: relative;
  width: var(--target-shield-width);
  height: var(--target-shield-height);
}
#command-art {
  filter: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  z-index: 2;
  left: 50%;
  width: var(--own-art-size);
  height: var(--own-art-size);
}
#shield-diagram {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
  z-index: 1;
  left: 50%;
  width: calc(var(--own-art-size) + 48px);
  height: 100%;
}
#shield-diagram path,
#target-shield-diagram path {
  fill: none;
  stroke: #69e0f1;
  stroke-width: 4;
  stroke-linecap: round;
}
#shield-diagram [data-state='damaged'],
#target-shield-diagram [data-state='damaged'] {
  stroke: #edbb67;
}
#shield-diagram [data-state='critical'],
#target-shield-diagram [data-state='critical'] {
  stroke: #ff8d83;
}
#shield-diagram :is([data-state='collapsed'], [data-state='unequipped']),
#target-shield-diagram :is([data-state='collapsed'], [data-state='unequipped']) {
  stroke: #98524f;
  stroke-dasharray: 4 6;
}
#shield-diagram .facing,
#target-shield-diagram .facing {
  stroke-width: 7;
}
#shield-sectors {
  position: absolute;
  margin: 0;
  display: block;
  pointer-events: auto;
  inset: 0;
}
#target-sectors {
  position: absolute;
  inset: 0;
  margin: 0;
  pointer-events: none;
}
#shield-sectors button {
  border: 0;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: auto;
  font-size: var(--hud-font);
  position: absolute;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-width: var(--own-label-width);
  line-height: 14px;
  white-space: nowrap;
  text-align: left;
  gap: 3px;
  padding: 0;
  transform: none;
}
#target-sectors > div {
  border: 0;
  background: transparent !important;
  box-shadow: none !important;
  position: absolute;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: center;
  padding: 0;
  white-space: nowrap;
  transform: none;
  z-index: 3;
  line-height: 14px;
  text-align: left;
  gap: 2px;
  font-size: var(--hud-font);
}
#shield-sectors button strong {
  flex: 0 0 auto;
  font-size: var(--hud-font);
  line-height: 14px;
}
#target-sectors strong {
  font-size: var(--hud-font);
  line-height: 14px;
}
#shield-sectors button[aria-pressed='true'] {
  outline: none;
  font-weight: 600;
}
#target-sectors [data-facing='true'],
#shield-sectors button[data-facing='true'],
.ship-card.surrendered .roster-state,
.ship-card.prize .roster-state {
  color: var(--gold);
}
#target-sectors [data-facing='true'] span::before {
  content: '▸';
  margin-right: 1px;
}
#command-tabs {
  position: static;
  display: flex;
  margin: 0;
  box-shadow: none;
  min-height: 0;
  padding: 0;
  gap: 4px;
  border: 0;
  background: transparent;
}
#command-tabs button {
  flex: 1;
  font-size: var(--hud-font);
  white-space: nowrap;
  min-width: 0;
  padding: 0 3px;
  padding-top: 1px;
  padding-bottom: 1px;
  line-height: 18px;
  min-height: 22px;
}
#command-content {
  position: absolute;
  bottom: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  background: #0b1c28fa;
  border: 1px solid #527384;
  border-radius: 5px;
  max-height: 220px;
  font-size: var(--hud-font);
  scrollbar-gutter: stable;
  width: min(960px, calc(100vw - 24px));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  padding: 8px 12px;
  overflow-y: scroll;
  scrollbar-width: auto;
  scrollbar-color: #7babbc #10212e;
}
#command-content:focus-visible {
  outline: 2px solid var(--cyan);
}
#command-content > .command-section {
  margin: 6px 0;
}
#close-command-detail {
  position: sticky;
  top: 0;
  float: right;
  z-index: 1;
  margin-left: 10px;
}
#command-content :is(p, small, span, b, button, select, summary) {
  font-size: var(--hud-font);
  line-height: 1.4;
}
#command-content .weapon-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 12px;
  margin: 5px 0;
  overflow-wrap: anywhere;
}
#command-content .system {
  padding: 4px 0;
}
.hud-badge {
  display: inline-block;
  font-size: var(--hud-font);
  color: var(--cyan);
  border: 1px solid #376271;
  border-radius: 3px;
  margin: 0 3px 2px 0;
  padding: 0 3px;
  line-height: 13px;
}
.hud-badge.unmet {
  color: var(--gold);
  border-color: #765f38;
}
.firing-spine .toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--hud-font);
  margin: 0;
  white-space: nowrap;
}
#torpedo {
  width: 100%;
  font-size: var(--hud-font);
  grid-column: 1/-1;
  margin: 0;
  padding: 1px 6px;
  padding-top: 1px;
  padding-bottom: 1px;
  line-height: 18px;
  min-height: 22px;
}
kbd {
  font: inherit;
  border: 1px solid #657787;
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 5px;
}
.hud-target:not(.has-target) {
  border-radius: 24px;
  width: max-content;
  max-width: calc(100% - 24px);
}
#target-empty {
  text-align: center;
  color: var(--muted);
  font-size: var(--hud-font);
  min-height: 0;
  padding: 3px 10px;
  line-height: 14px;
}
#target-body {
  display: grid;
  align-items: center;
  min-height: 0;
  grid-template-columns: minmax(180px, 1fr) auto minmax(220px, 1fr);
  gap: 6px;
  padding: 1px 8px;
}
#target-name {
  font:
    14px/16px 'Barlow Condensed',
    sans-serif;
  color: #edf7fa;
  overflow-wrap: anywhere;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 15px;
  font-size: 13px;
}
#target-faction {
  color: var(--red);
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--hud-font);
}
#target-class {
  color: var(--red);
  line-height: 16px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--hud-font);
}
#target-captain {
  color: var(--cyan);
  font-size: var(--hud-font);
  line-height: 16px;
}
.friendly-target #target-faction,
.friendly-target #target-class,
.ship-card.selected .roster-state {
  color: var(--cyan);
}
#target-hull-number {
  color: var(--red);
  white-space: nowrap;
  line-height: 14px;
  font-size: 13px;
}
.target-identity .meter {
  height: 4px;
  margin: 0;
}
#target-hull-fill {
  background: var(--red);
  height: 100%;
}
#target-range {
  display: inline;
  font:
    15px/16px 'Barlow Condensed',
    sans-serif;
  white-space: nowrap;
  margin: 0;
  line-height: 15px;
  font-size: 13px;
}
.own-controls .section-title,
.firing-spine .section-title {
  display: none;
}
.firing-spine .command-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 2px 6px;
}
.target-heading {
  display: flex;
  align-items: baseline;
  min-width: 0;
  white-space: nowrap;
  gap: 4px;
}
.target-hull {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 0;
  line-height: 16px;
}
.target-metrics {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  gap: 0 4px;
}
#target-badges {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}
#target-badges .hud-badge {
  white-space: nowrap;
  margin: 0 2px 0 0;
  padding: 0 3px;
  line-height: 14px;
}
#target-motion {
  grid-column: 1/-1;
  line-height: 14px;
  white-space: nowrap;
  font-size: var(--hud-font);
}
.command-title {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
  line-height: 16px;
}
#condition {
  color: var(--cyan);
  min-width: 0;
  font-size: var(--hud-font);
  overflow: hidden;
  text-overflow: ellipsis;
}
#command-access {
  color: #9bb8c7;
  font:
    600 var(--hud-font)/18px 'IBM Plex Mono',
    monospace;
  letter-spacing: 1px;
  margin-left: auto;
  font-size: var(--hud-font);
  white-space: nowrap;
}
#shield-sectors button span {
  line-height: 14px;
  flex: 0 0 auto;
  overflow: visible;
  text-overflow: clip;
}
#shield-sectors button[data-facing='true'] span::before {
  content: '▸ ';
}
.target-heading #target-name {
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ship-card[data-targeted='true'] {
  border-color: var(--red);
  width: 100%;
}
.battle-console [hidden],
.hud-target [hidden] {
  display: none !important;
}
.viewport #banner {
  top: var(--brief-top, 48%);
  max-height: var(--brief-height, 60%);
  width: min(540px, calc(100% - 32px));
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 8;
}
.viewport.has-mission-bar #banner {
  top: var(--brief-top, 48%);
  max-height: var(--brief-height, 60%);
  width: min(540px, calc(100% - 32px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
#command-content::-webkit-scrollbar {
  width: 12px;
}
#command-content::-webkit-scrollbar-thumb {
  background: #7babbc;
  border: 2px solid #10212e;
  border-radius: 8px;
}
#command-content::-webkit-scrollbar-track {
  background: #10212e;
}
.viewport #result {
  z-index: 8;
}
#banner #engage {
  position: sticky;
  bottom: 0;
  z-index: 1;
}
.hud-target.has-target {
  width: min(900px, calc(100% - 16px));
  max-width: 900px;
  max-height: 62px;
}
#shield-sectors [data-sector='0'] {
  top: 0;
  left: 50%;
  width: max-content;
  transform: translateX(-50%);
  align-items: flex-start;
}
#shield-sectors [data-sector='1'] {
  top: 50%;
  right: 0;
  width: var(--own-label-width);
  transform: translateY(-50%);
}
#shield-sectors [data-sector='2'] {
  bottom: 0;
  left: 50%;
  width: max-content;
  transform: translateX(-50%);
  align-items: flex-end;
}
#shield-sectors [data-sector='3'] {
  top: 50%;
  left: 0;
  width: var(--own-label-width);
  transform: translateY(-50%);
}
#target-art {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  z-index: 2;
  left: 50%;
  height: calc(var(--target-shield-height) - 32px);
  width: calc(var(--target-shield-height) - 32px);
}
#target-shield-diagram {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
  z-index: 1;
  left: 50%;
  width: calc(var(--target-art-size) + 28px);
  height: calc(var(--target-shield-height) - 32px);
}
#target-sectors > [data-sector-index='0'] {
  top: 2px;
  left: 50%;
  right: auto;
  width: max-content;
  transform: translateX(-50%);
  justify-content: center;
}
#target-sectors > [data-sector-index='1'] {
  top: 50%;
  right: 0;
  width: var(--target-label-width);
  transform: translateY(-50%);
  justify-content: flex-end;
}
#target-sectors > [data-sector-index='2'] {
  bottom: 2px;
  left: 50%;
  right: auto;
  width: max-content;
  transform: translateX(-50%);
  justify-content: center;
}
#target-sectors > [data-sector-index='3'] {
  top: 50%;
  left: 0;
  width: var(--target-label-width);
  transform: translateY(-50%);
  justify-content: flex-start;
}
#shield-number,
#ammo-number {
  font-size: 13px;
  white-space: nowrap;
}
.left {
  padding: 4px;
  min-width: 0;
}
.left .section-title {
  min-height: 14px;
  align-items: center;
  margin: 4px 0;
  font-size: var(--hud-font);
  line-height: 14px;
}
#fleet-filters {
  display: flex;
  gap: 3px;
  margin: 2px 0 4px;
}
#fleet-filters button {
  min-width: 0;
  min-height: 22px;
  line-height: 18px;
  flex: 1 0 auto;
  padding: 1px 2px;
  white-space: nowrap;
  font-size: var(--hud-font);
}
.ship-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  width: 100%;
  height: 30px;
  min-height: 30px;
  padding: 1px 4px;
  margin: 1px 0;
  text-align: left;
  overflow: hidden;
}
.ship-card canvas {
  display: block;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
}
.roster-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 13px 11px 2px;
  align-items: center;
  min-width: 0;
  height: 26px;
  column-gap: 3px;
  overflow: hidden;
}
.ship-card strong {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--hud-font);
  line-height: 13px;
}
.roster-state {
  grid-column: 2;
  grid-row: 1;
  max-width: none;
  overflow: visible;
  color: var(--cyan);
  font-size: var(--hud-font);
  line-height: 13px;
  white-space: nowrap;
}
.roster-health {
  grid-column: 1/-1;
  grid-row: 2;
  min-width: 0;
  overflow: hidden;
  color: #b7c9d6;
  font-size: var(--hud-font);
  line-height: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ship-card .bar {
  display: block;
  height: 2px;
  min-width: 0;
  margin: 0;
  grid-row: 3;
}
.ship-card .bar:not(.shield-bar) {
  grid-column: 1;
}
.ship-card .shield-bar {
  grid-column: 2;
}
.ship-card.enemy .bar i {
  background: var(--red);
}
.ship-card.destroyed {
  opacity: 0.48;
  filter: grayscale(0.75);
}
.ship-card.surrendered {
  border-style: dashed;
  border-color: #e5bc74;
}
.ship-card.retreated {
  border-style: dashed;
  border-color: #8e9aab;
}
.ship-card.ai-controlled {
  border-left: 2px solid #85b8d0;
}
.ship-card.prize {
  box-shadow: inset 0 0 0 1px #e5bc7450;
}
.ship-card.inspect-only {
  background-image: repeating-linear-gradient(135deg, #172737 0 8px, #142330 8px 16px);
}
.ship-card.target .roster-state,
.ship-card.destroyed .roster-state {
  color: var(--red);
}
.ship-card.retreated .roster-state,
.ship-card.retreating .roster-state,
.ship-card.inspect-only .roster-state {
  color: #aebdca;
}
.ship-card.ai-controlled .roster-state {
  color: #85d5e6;
}
#shield-sectors button:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 1px;
}

@media (min-width: 2560px) {
  .battle-console button,
  #shield-sectors button,
  #command-tabs button,
  #torpedo,
  #power button,
  #orders button,
  #fleet-filters button {
    min-height: 24px;
    line-height: 20px;
  }
  .hud-target.has-target {
    max-height: 76px;
  }
  #ship-name {
    font-size: 13px;
  }
  :root {
    --hud-font: 12px;
  }
}

@media (max-width: 1100px) {
  main {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .left {
    height: auto;
    min-height: 0;
  }
}

@media (min-width: 2560px) and (min-height: 1200px) {
  :root {
    --own-art-size: 96px;
    --own-diagram-width: 216px;
    --own-diagram-height: 128px;
    --own-label-width: 50px;
    --target-art-size: 56px;
    --target-shield-width: 160px;
    --target-shield-height: 72px;
    --target-label-width: 50px;
  }
  .ship-card {
    height: 34px;
    min-height: 34px;
  }
  .ship-card canvas {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
  .roster-copy {
    height: 30px;
    grid-template-rows: 14px 12px 2px;
  }
  .ship-card strong,
  .roster-state {
    line-height: 14px;
  }
  .roster-health {
    line-height: 12px;
  }
}

@media (max-height: 1199px), (max-width: 2200px) {
  footer {
    height: 36px;
  }
  .ship-card canvas {
    flex-basis: 26px;
  }
  .ship-card .roster-health {
    font-size: var(--hud-font);
  }
  .viewport #banner {
    padding: 12px 18px;
  }
  #banner h1 {
    font-size: 28px;
    margin: 5px 0;
  }
  #banner p {
    line-height: 1.3;
    margin: 6px 0;
  }
  #banner #engage {
    padding: 7px 12px;
    margin-top: 5px;
  }
}

@media (max-width: 2559px) {
  #ship-name,
  #command-content .captain-card strong {
    font-size: 13px;
  }
  #target-name {
    font-size: 12px;
  }
  .evacuation-controls {
    grid-template-columns: 1fr;
    max-height: min(46vh, 350px);
    overflow-y: auto;
  }
  .evacuation-manifest {
    display: grid;
    grid-template-columns: 1fr;
    max-height: 150px;
    overflow: auto;
  }
  .evacuation-manifest button {
    text-align: left;
  }
}
