/* Original's typography, palette, silhouettes, instruments and controls are inherited.
   Only the material and the offsets needed by the full-window battlefield change. */
:root[data-ui-theme='original-glass'] {
  --og-panel: rgba(9, 23, 34, 0.48);
  --og-well: rgba(6, 17, 27, 0.38);
  /* Reading surfaces fully occlude battlefield lettering, even without blur.
     Translucent child cards/wells composite onto these solid foundations. */
  --og-dense: #091722;
  --og-dialog: #0d1520;
  --og-blur: blur(16px) saturate(1.4);
  --og-sheen: linear-gradient(115deg, rgba(220, 246, 255, 0.11), rgba(193, 238, 255, 0.025) 28%, transparent 52%);
  --og-highlight:
    inset 0 1px 0 rgba(220, 246, 255, 0.38), inset 1px 0 0 rgba(193, 238, 255, 0.22),
    inset 0 -1px 0 rgba(174, 224, 242, 0.1), inset -1px 0 0 rgba(174, 224, 242, 0.1);
  --og-roster: calc(clamp(200px, 7.3vw, 280px) * var(--gui-size, 1));
}

/* Shared seven-step Original Glass ramp; stage 1 and stage 2 migrate their named surfaces. */
:root[data-ui-theme='original-glass'] {
  /* 2026-11-02 ramp (see review); stage 1 uses these on the start menu and map decision dialogs only. */
  --og-step-caption: round(nearest, clamp(12px, 0.34vw, 13px), 1px);
  --og-step-secondary: round(nearest, clamp(12px, 0.365vw, 14px), 1px);
  --og-step-body: round(nearest, clamp(14px, 0.417vw, 16px), 1px);
  --og-step-emphasis: round(nearest, clamp(15px, 0.47vw, 18px), 1px);
  --og-step-title: round(nearest, clamp(20px, 0.625vw, 24px), 1px);
  --og-step-screen: round(nearest, clamp(26px, 0.834vw, 32px), 1px);
  --og-step-display: round(nearest, clamp(38px, 1.25vw, 48px), 1px);
}

/* Frontier SVG typography follows the seven-step ramp at each chart's fitted scale. */
:root[data-ui-theme='original-glass'] #result.map svg.route-map.frontier .node-label,
:root[data-ui-theme='original-glass'] .cs-map svg.frontier .node-label {
  font-size: calc(var(--og-step-body) / var(--map-unit, 1));
  stroke-width: calc(3px / var(--map-unit, 1));
}
:root[data-ui-theme='original-glass'] #result.map svg.route-map.frontier .frontier-region text,
:root[data-ui-theme='original-glass'] .cs-map svg.frontier .frontier-region text {
  font-size: calc(var(--og-step-emphasis) / var(--map-unit, 1));
}
:root[data-ui-theme='original-glass'] #result.map svg.route-map.frontier .node-tag,
:root[data-ui-theme='original-glass'] #result.map svg.route-map.frontier .frontier-wall text,
:root[data-ui-theme='original-glass'] #result.map svg.route-map.frontier .frontier-ticks,
:root[data-ui-theme='original-glass'] .cs-map svg.frontier .node-tag,
:root[data-ui-theme='original-glass'] .cs-map svg.frontier .frontier-wall text,
:root[data-ui-theme='original-glass'] .cs-map svg.frontier .frontier-ticks {
  font-size: calc(var(--og-step-caption) / var(--map-unit, 1));
}
:root[data-ui-theme='original-glass'] #result.map svg.route-map.frontier .node-tag,
:root[data-ui-theme='original-glass'] .cs-map svg.frontier .node-tag {
  stroke-width: calc(3px / var(--map-unit, 1));
}
:root[data-ui-theme='original-glass'] #result.map svg.route-map.frontier.dense .frontier-region text,
:root[data-ui-theme='original-glass'] .cs-map svg.frontier.dense .frontier-region text {
  display: none;
}

/* Unsupported frost must not leave small Original captions over a sharp scene. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root[data-ui-theme='original-glass'] {
    --og-panel: var(--og-dense);
  }
}

/* Window and frame. A shrinkable grid still owns the roster; the canvas alone
   leaves that grid. Never zoom or pad the canvas's displayed rectangle. */
:root[data-ui-theme='original-glass'] body {
  height: 100dvh;
  overflow: hidden;
}

:root[data-ui-theme='original-glass'] main {
  position: relative;
  z-index: 1;
  grid-template-columns: var(--og-roster) minmax(0, 1fr);
  padding: 12px 6px 12px 12px;
}

:root[data-ui-theme='original-glass'] .viewport {
  --hud-floating: 1;
  --hud-map-footer: 32px;
  --og-roster-right: var(--hud-roster-right, calc(var(--og-roster) + 6px));
  --og-plot-center: calc((100vw + var(--og-roster-right)) / 2);
  --og-plot-width: calc(100vw - var(--og-roster-right) - 32px);
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

:root[data-ui-theme='original-glass'] .viewport::after {
  /* Retain Original's fine cyan corner marks around the open field. */
  left: calc(var(--og-roster-right) + 6px);
  top: calc(var(--hud-header, 80px) + 6px);
  bottom: calc(var(--hud-footer, 48px) + 6px);
  box-shadow: none;
}

:root[data-ui-theme='original-glass'] #battle {
  width: 100%;
  height: 100%;
}

/* Header, floating fleet rail and log: one blur per frame, never rows.
   Inset one-pixel edges keep Original's dimensions, radii and state borders. */
:root[data-ui-theme='original-glass'] :is(body > header, aside.left, body > footer) {
  position: relative;
  z-index: 2;
  background: var(--og-sheen), var(--og-panel);
  box-shadow:
    var(--og-highlight),
    0 10px 32px rgba(0, 0, 0, 0.28);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: var(--og-blur);
  backdrop-filter: var(--og-blur);
}

/* Let short fleets expose the space below them; long fleets still scroll
   within the definite grid row, with an inset above the footer at every scale. */
:root[data-ui-theme='original-glass'] aside.left {
  align-self: start;
  height: fit-content;
  max-height: 100%;
  overflow-y: auto;
}

:root[data-ui-theme='original-glass'] body > header {
  flex-wrap: wrap;
}

:root[data-ui-theme='original-glass'] body > header .time-controls {
  min-width: 0;
}

:root[data-ui-theme='original-glass'] :is(#squadron-toolbar, #fleet-filters) {
  background-color: var(--og-well);
}

:root[data-ui-theme='original-glass'] .ship-card {
  background: linear-gradient(115deg, rgba(37, 67, 83, 0.2), transparent 55%), var(--og-well);
}

:root[data-ui-theme='original-glass'] .ship-card:hover {
  background: rgba(16, 43, 59, 0.94);
}

:root[data-ui-theme='original-glass'] .ship-card.selected {
  background: linear-gradient(115deg, rgba(30, 82, 100, 0.6), transparent 60%), rgba(9, 35, 48, 0.9);
}

:root[data-ui-theme='original-glass'] .ship-card.inspect-only {
  background-image: repeating-linear-gradient(135deg, rgba(23, 39, 55, 0.9) 0 8px, rgba(20, 35, 48, 0.9) 8px 16px);
}

/* Floating tactical panels. Keep Original's compact central target and command
   console, centred in the field to the right of the roster, with measured edges. */
:root[data-ui-theme='original-glass']
  :is(.map-label, .map-footer, .view-controls, #mission-bar, #target-bar, .battle-console) {
  background: var(--og-sheen), var(--og-panel);
  box-shadow:
    var(--og-highlight),
    0 10px 32px rgba(0, 0, 0, 0.28);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: var(--og-blur);
  backdrop-filter: var(--og-blur);
}

:root[data-ui-theme='original-glass'] .viewport .map-label {
  left: calc(var(--og-roster-right) + 14px);
  top: calc(var(--hud-header, 80px) + var(--hud-mission, 0px) + 8px);
}

:root[data-ui-theme='original-glass'] .viewport .view-controls {
  top: calc(var(--hud-header, 80px) + var(--hud-mission, 0px) + 8px);
  max-width: var(--og-plot-width);
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* The utility frame owns the blur. Its unselected buttons let that same
   frosted scene through instead of covering it with Original's opaque bevel. */
:root[data-ui-theme='original-glass'] .view-controls button:not(:disabled):not([aria-pressed='true']) {
  background: var(--og-sheen), rgba(21, 34, 49, 0.28);
}

:root[data-ui-theme='original-glass'] .view-controls button:not(:disabled):not([aria-pressed='true']):hover {
  background: var(--og-sheen), rgba(30, 51, 67, 0.6);
}

:root[data-ui-theme='original-glass'] #mission-bar {
  top: calc(var(--hud-header, 80px) + 6px);
  left: calc(var(--og-roster-right) + 6px);
  right: 6px;
  max-height: 30dvh;
  overflow: auto;
}

:root[data-ui-theme='original-glass']
  :is(
    #evacuation-controls small,
    #bombardment-controls span,
    #bombardment-controls b,
    #derelict-controls small,
    #derelict-controls span,
    #derelict-controls b,
    #depot-controls small,
    #depot-controls span,
    #depot-controls b,
    #duel-controls small,
    #duel-controls span,
    #duel-controls b
  ) {
  font-size: max(12px, var(--hud-font));
}

@media (max-width: 2559px) {
  :root[data-ui-theme='original-glass'] #mission-bar {
    gap: 6px;
    padding: 6px 8px;
    align-items: center;
  }

  :root[data-ui-theme='original-glass'] #mission-bar #mission-objective {
    font-size: max(12px, var(--hud-font));
  }

  :root[data-ui-theme='original-glass']
    :is(.evacuation-controls, .bombardment-controls, .derelict-controls, .depot-controls, .duel-controls) {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    max-height: none;
    overflow: visible;
  }

  :root[data-ui-theme='original-glass'] :is(#derelict-controls, #depot-controls, #duel-controls):not([hidden]) {
    display: grid;
  }

  :root[data-ui-theme='original-glass'] .derelict-lots {
    display: grid;
  }

  :root[data-ui-theme='original-glass']
    :is(.evacuation-readout, .bombardment-readout, .derelict-readout, .depot-readout, .duel-readout) {
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 2px 8px;
  }

  :root[data-ui-theme='original-glass'] #evacuation-warning:empty {
    display: none;
  }

  :root[data-ui-theme='original-glass']
    :is(.evacuation-manifest, .bombardment-manifest, .bombardment-districts, .derelict-lots, .depot-structures) {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    padding: 0;
  }

  :root[data-ui-theme='original-glass']
    :is(.evacuation-manifest button, .bombardment-manifest button, .bombardment-districts span, .derelict-lots button) {
    min-width: 0;
    min-height: 34px;
    padding: 4px;
    line-height: 1.1;
    font-size: max(12px, var(--hud-font));
  }

  :root[data-ui-theme='original-glass'] .depot-row {
    min-width: 0;
    padding: 3px 4px;
    gap: 1px 4px;
    line-height: 1.1;
    font-size: max(12px, var(--hud-font));
  }

  :root[data-ui-theme='original-glass'] .evacuation-order-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 2px 8px;
  }

  :root[data-ui-theme='original-glass'] .evacuation-order-controls > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :root[data-ui-theme='original-glass'] .evacuation-order-controls > div {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }

  :root[data-ui-theme='original-glass'] :is(.evacuation-order-controls button, .bombardment-actions button) {
    min-width: 0;
    min-height: 34px;
    padding: 4px;
    font-size: max(12px, var(--hud-font));
  }
}

@media (max-width: 1300px) {
  :root[data-ui-theme='original-glass'] #mission-bar {
    gap: 2px;
    padding-block: 0;
  }
}

:root[data-ui-theme='original-glass']
  #mission-bar
  :is(
    button,
    .rescue-readout,
    #rescue-count,
    #rescue-activity,
    .mission-service-readout,
    .minefield-readout,
    #minefield-controls button,
    #minefield-warning,
    #minefield-location,
    #minefield-activity,
    #minefield-hull,
    #minefield-cleared,
    #hold-line-hull,
    #hold-line-waves,
    #hold-line-phase,
    #hold-line-choice-status
  ) {
  font-size: max(12px, var(--hud-font));
}

:root[data-ui-theme='original-glass'] :is(#terrain-legend, #presentation-panel) {
  top: calc(var(--hud-header, 80px) + var(--hud-mission, 0px) + 48px);
  max-width: var(--og-plot-width);
  max-height: min(48vh, 380px);
}

:root[data-ui-theme='original-glass'] .map-footer {
  left: calc(var(--og-roster-right) + 6px);
  bottom: var(--hud-footer, 48px);
  width: calc(100% - var(--og-roster-right) - 12px);
}

:root[data-ui-theme='original-glass'] :is(.battle-console, #target-bar) {
  left: calc(var(--og-plot-center) / var(--gui-size, 1));
  max-width: calc(var(--og-plot-width) / var(--gui-size, 1));
}

:root[data-ui-theme='original-glass'] .battle-console {
  width: min(960px, calc(var(--og-plot-width) / var(--gui-size, 1)));
  bottom: calc((var(--hud-footer, 48px) + var(--hud-map-footer, 32px) + 26px) / var(--gui-size, 1));
}

:root[data-ui-theme='original-glass'] .console-main {
  /* HUD target room is already expressed in GUI-scaled CSS pixels. Reserve
     its tallest Original strip (76px), a small gap and the bottom map ribbon. */
  max-height: max(
    32px,
    calc(var(--hud-target-room, 60dvh) - 80px - (var(--hud-map-footer, 32px) + 42px) / var(--gui-size, 1))
  );
}

:root[data-ui-theme='original-glass'] #target-bar.has-target {
  width: min(900px, calc(var(--og-plot-width) / var(--gui-size, 1)));
}

/* Dense inset wells keep hull/shield readings, power/orders, ordnance and captain
   detail quiet. Existing button and meter finishes, including state cues, win. */
:root[data-ui-theme='original-glass']
  :is(
    .own-wing,
    .firing-spine,
    #power-detail,
    #systems,
    #weapon-readiness,
    #captain-panel,
    .captain-card,
    #squadron-picker,
    .target-identity,
    .target-metrics
  ) {
  background-color: var(--og-well);
}

:root[data-ui-theme='original-glass'] #command-content {
  width: min(960px, calc(var(--og-plot-width) / var(--gui-size, 1)));
  background: var(--og-dense);
  box-shadow:
    var(--og-highlight),
    0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Reading overlays can cover other HUD text: solid fills, no live/nested blur. */
:root[data-ui-theme='original-glass']
  :is(
    #terrain-tooltip,
    #bridge-callouts,
    #last-ditch-banner,
    #terrain-legend,
    #presentation-panel,
    #photo-toolbar,
    #photo-hint
  ) {
  background: var(--og-sheen), var(--og-dense);
  box-shadow:
    var(--og-highlight),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

:root[data-ui-theme='original-glass'] :is(#bridge-callouts, #last-ditch-banner) {
  left: var(--og-plot-center);
  max-width: var(--og-plot-width);
}

:root[data-ui-theme='original-glass'] .viewport #last-ditch-banner {
  top: calc(var(--hud-header, 80px) + var(--hud-mission, 0px) + 46px);
  background: #271b1c;
}

/* Briefing, result and Frontier charts occlude battle text while reading.
   All retain their existing Original placement and sizing. */
:root[data-ui-theme='original-glass'] :is(#banner, #result, #result.map.selection:not(.service)) {
  left: var(--og-plot-center);
  max-width: var(--og-plot-width);
}

:root[data-ui-theme='original-glass'] :is(#banner, #result, #result.map.selection:not(.service)) {
  background: var(--og-sheen), var(--og-dialog);
  box-shadow:
    var(--og-highlight),
    0 20px 65px rgba(0, 0, 0, 0.45);
}

:root[data-ui-theme='original-glass'] #result.map.selection:not(.service) {
  /* This existing fixed chart is window-centred rather than plot-centred. */
  left: 50%;
  max-width: calc(100vw - 48px);
}

:root[data-ui-theme='original-glass'] #result :is(.route-details, .route-report, .result-actions, .er-stat, .er-wreck) {
  background: var(--og-well);
}

:root[data-ui-theme='original-glass'] #result :is(.route-map, .route-map.frontier) {
  background: radial-gradient(ellipse at 30% 40%, rgba(15, 32, 48, 0.7), rgba(10, 21, 32, 0.55) 70%);
}

/* Native modal shells: an opaque reading foundation with the same edge/sheen,
   over a moderately dimmed, recognisable game. Blur cannot prevent text bleed
   reliably in every compositor; the solid shell also protects cards and inputs. */
:root[data-ui-theme='original-glass']
  :is(
    dialog,
    #campaign-dialog,
    #market-dialog,
    #crew-dialog,
    #setup-dialog,
    #almanac-dialog,
    #captain-trait-dialog,
    #last-ditch-dialog,
    #help-dialog,
    #settings-dialog
  ) {
  background: var(--og-sheen), var(--og-dialog);
  box-shadow:
    var(--og-highlight),
    0 24px 80px rgba(0, 0, 0, 0.65);
}

:root[data-ui-theme='original-glass']
  :is(
    dialog,
    #campaign-dialog,
    #market-dialog,
    #crew-dialog,
    #setup-dialog,
    #almanac-dialog,
    #captain-trait-dialog,
    #last-ditch-dialog,
    #help-dialog,
    #settings-dialog
  )::backdrop {
  background: rgba(2, 7, 13, 0.32);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Campaign, market and custom refit keep their original column allocations and
   selected/primary/danger states. Structural containers do not compound opacity. */
:root[data-ui-theme='original-glass'] :is(.cs, .rb) {
  --well: var(--og-well);
}

:root[data-ui-theme='original-glass']
  :is(
    .cs-head,
    .cs-orders,
    .cs-ready,
    .cs-foot,
    .rb-head,
    .rb-roster,
    .rb-picker,
    .rb-foot,
    .setup-header,
    .setup-footer,
    .display-settings-head
  ) {
  background: rgba(9, 23, 34, 0.32);
}

:root[data-ui-theme='original-glass']
  :is(.rb-body, .rb-center, .rb-list, .cs-main, .display-settings, .settings-shell, .almanac-layout, .almanac-detail) {
  background: transparent;
}

:root[data-ui-theme='original-glass'] :is(.cs-hero-art, .cs-map svg.chart, .rb-stage, .almanac-stage) {
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 100% 34px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 34px 100%,
    radial-gradient(ellipse at 38% 50%, rgba(27, 58, 79, 0.6), rgba(11, 22, 34, 0.5) 75%);
}

:root[data-ui-theme='original-glass']
  :is(
    .cs-service-card,
    .cs-record,
    .cs-trait-choices,
    .cs-traits,
    .cs-sector,
    .cs-site,
    .cs-arms,
    .cs-plain,
    .cs-stat,
    .rb-fitted,
    .rb-cargo,
    .rb-swap,
    .rb-details,
    .terrain-picker,
    .fleet-row,
    .trait-dialog-captain,
    .trait-choice-pair,
    .service-record
  ) {
  background-color: var(--og-well);
}

:root[data-ui-theme='original-glass'] body.photo-mode main {
  z-index: 50;
}

:root[data-ui-theme='original-glass'] body.photo-mode .viewport {
  z-index: 50;
}

:root[data-ui-theme='original-glass'] body.photo-mode .viewport::after {
  display: none;
}

/* Reserve a separate utility row when map labels and view buttons would collide. */
@media (max-width: 1700px) {
  :root[data-ui-theme='original-glass'] .viewport .view-controls {
    top: calc(var(--hud-header, 80px) + var(--hud-mission, 0px) + 58px);
  }

  :root[data-ui-theme='original-glass'] .viewport :is(#terrain-legend, #presentation-panel, #last-ditch-banner) {
    top: calc(var(--hud-header, 80px) + var(--hud-mission, 0px) + 100px);
  }
}

/* Campaign Crew fills its rail while keeping the roster in its own scroll area. */
:root[data-ui-theme='original-glass'] .crew-rail {
  overflow-y: auto;
}

:root[data-ui-theme='original-glass'] .crew-roster {
  flex: 0 0 auto;
  align-content: start;
  grid-auto-rows: max-content;
}

:root[data-ui-theme='original-glass'] #crew-workspace-root .crew-workspace .crew-roster > .crew-officer {
  align-self: start;
  height: max-content;
  min-height: max-content;
}

@container crew-workspace (max-width: 1800px) {
  :root[data-ui-theme='original-glass'] .crew-rail {
    height: 100%;
    min-height: 0;
    max-height: none;
  }

  :root[data-ui-theme='original-glass'] .crew-workspace.tab-stations .crew-rail {
    height: auto;
  }

  :root[data-ui-theme='original-glass'] .crew-roster {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }
}

@container crew-workspace (max-width: 1000px) {
  :root[data-ui-theme='original-glass'] .crew-body {
    display: block;
    overflow-y: auto;
  }

  :root[data-ui-theme='original-glass'] .crew-workspace.tab-stations .crew-body {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  :root[data-ui-theme='original-glass'] .crew-rail {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  :root[data-ui-theme='original-glass'] .tab-officer .crew-rail {
    display: none;
  }

  :root[data-ui-theme='original-glass'] .crew-roster {
    flex: 0 0 auto;
    max-height: none;
    overflow: visible;
  }

  :root[data-ui-theme='original-glass'] .crew-stations {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    overflow: visible;
  }

  :root[data-ui-theme='original-glass'] .tab-recruitment .crew-stations > :not(.crew-recruitment) {
    display: none;
  }

  :root[data-ui-theme='original-glass'] .tab-recruitment .crew-detail-wrap {
    display: none;
  }

  :root[data-ui-theme='original-glass'] .crew-station {
    padding: 8px;
    gap: 4px;
  }

  :root[data-ui-theme='original-glass'] .crew-station h3 {
    font-size: var(--og-step-emphasis) !important;
  }

  :root[data-ui-theme='original-glass'] .crew-station button {
    min-height: 36px;
    padding: 5px 8px;
  }

  :root[data-ui-theme='original-glass'] .tab-officer .crew-detail-wrap {
    grid-column: auto;
  }
}

:root[data-ui-theme='original-glass'] body {
  font-size: var(--og-step-body);
}

:root[data-ui-theme='original-glass'] :is(button, select, input:not([type='range']), textarea) {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] :is(p, li, dd, label, dt, summary) {
  font-size: var(--og-step-secondary);
}

/* Small text has the same caption size across panels, including rules written
   with font shorthand in the campaign, Refit Bay and Almanac stylesheets. */
:root[data-ui-theme='original-glass'] small {
  font-size: var(--og-step-caption) !important;
}

:root[data-ui-theme='original-glass'] :is(.section-title) {
  font-size: var(--og-step-emphasis) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    .sector,
    #log,
    #log span,
    .map-label,
    .battle-console,
    .reactor-telemetry,
    .cs-label,
    .cs-kicker,
    .cs span,
    .cs em,
    .cs u,
    .cs .num,
    .rb-tag,
    .rb-label,
    .rb-delta,
    .rb-grade,
    .rb-num,
    .rb-picker h4,
    .rb-stat b i,
    .rb-row-num b i,
    .rb-fitted-main strong i,
    .rb a,
    .rb-facts dd,
    .rb-facts dt,
    .rb-tile-head,
    .rb-chip-head,
    .rb-arc text,
    .rb-dot text,
    .cs-rule,
    .cs-locked,
    .cs-link,
    .cs-label span,
    .cs-seed,
    .er-status,
    .er-meta,
    .er-lv,
    .er-sec span,
    .er-wreck-head,
    .er-cond > span,
    .er-over,
    .er-left,
    .er-note,
    .er-empty,
    .er-save,
    .er-error,
    .almanac-rating,
    .almanac-muted,
    .captain-line
  ) {
  font-size: var(--og-step-secondary) !important;
}

/* Stage 3: battle HUD telemetry and campaign-map text follow their ramp roles. */
:root[data-ui-theme='original-glass'] :is(.brand > div, .brand > div > b, .brand > b) {
  font-size: var(--og-step-title) !important;
}

:root[data-ui-theme='original-glass'] #banner > h1 {
  font-size: var(--og-step-screen) !important;
}

:root[data-ui-theme='original-glass'] #banner > p {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass'] :is(.power-balance-label, .power-balance-label > *, .status-line) {
  font-size: var(--og-step-caption) !important;
}

:root[data-ui-theme='original-glass'] .power-balance-label {
  font-family: 'IBM Plex Mono', monospace !important;
}

@media (max-width: 1500px) {
  :root[data-ui-theme='original-glass'] .power-balance-label {
    gap: 2px;
    letter-spacing: -0.04em;
    white-space: nowrap;
  }

  :root[data-ui-theme='original-glass'] #balance-status {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

:root[data-ui-theme='original-glass'] aside.left .section-title {
  font-size: var(--og-step-caption) !important;
}

:root[data-ui-theme='original-glass'] .roster-copy > .roster-health,
:root[data-ui-theme='original-glass'] .roster-copy > .roster-state,
:root[data-ui-theme='original-glass'] .legend span,
:root[data-ui-theme='original-glass'] .comms-label,
:root[data-ui-theme='original-glass'] .command-title :is(#condition, #command-access),
:root[data-ui-theme='original-glass'] #target-faction,
:root[data-ui-theme='original-glass'] .hud-badge,
:root[data-ui-theme='original-glass'] .map-footer,
:root[data-ui-theme='original-glass'] .map-footer span,
:root[data-ui-theme='original-glass'] .view-controls button,
:root[data-ui-theme='original-glass'] #hull-number,
:root[data-ui-theme='original-glass'] #shield-number,
:root[data-ui-theme='original-glass'] #target-hull-number,
:root[data-ui-theme='original-glass'] #target-range {
  font-size: var(--og-step-caption) !important;
}

:root[data-ui-theme='original-glass'] .roster-copy > .roster-health {
  font-family: 'IBM Plex Mono', monospace !important;
}

:root[data-ui-theme='original-glass']
  :is(body > header button, #squadron-toolbar button, .battle-console button, #command-content button) {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] :is(#power button, #orders button) {
  padding-inline: 0 !important;
  letter-spacing: -0.025em !important;
}

:root[data-ui-theme='original-glass'] #squadron-toolbar > label {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] .roster-copy > strong {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] aside.left .ship-card {
  height: 43px;
  min-height: 43px;
}

:root[data-ui-theme='original-glass'] aside.left .roster-copy {
  height: 39px;
  grid-template-rows: 18px 15px 2px;
  row-gap: 2px;
}

:root[data-ui-theme='original-glass'] aside.left .roster-copy > strong {
  line-height: 18px;
}

:root[data-ui-theme='original-glass'] aside.left .roster-copy > .roster-health {
  line-height: 15px;
}

:root[data-ui-theme='original-glass'] .command-title #ship-name,
:root[data-ui-theme='original-glass'] .target-heading #target-name {
  font-size: var(--og-step-emphasis) !important;
}

@media (min-width: 2560px) {
  :root[data-ui-theme='original-glass'] .command-title #ship-name,
  :root[data-ui-theme='original-glass'] .target-heading #target-name {
    flex: 0 0 auto;
    max-width: none;
    min-width: max-content;
    overflow: visible;
    text-overflow: clip;
  }
}

:root[data-ui-theme='original-glass'] #mission-name {
  font-size: var(--og-step-emphasis) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #banner-note,
    #target-empty,
    #target-class,
    #target-captain,
    #target-motion,
    #mission-objective,
    #result.map details.orders > p,
    #result.map .gauge > em,
    #result.map .map-zoom > span,
    #result.map .map-legend > span,
    #result.map > p.hint.map-foot
  ) {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    .battle-console button > strong,
    .battle-console div > strong,
    #command-content div > strong,
    #target-bar div > strong,
    .command-title > strong,
    .target-hull > strong,
    .target-metrics > strong
  ) {
  font-size: var(--og-step-caption) !important;
}

:root[data-ui-theme='original-glass'] #result.map .gauge > b {
  font-size: var(--og-step-title) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #almanac-list strong,
    .rb-tile-text b,
    .rb-picker b,
    .rb-toggle,
    .captain-heading strong,
    .cs-picker b,
    .er-name b
  ) {
  font-size: var(--og-step-secondary) !important;
}

/* Stage 2: panel titles, section labels and controls follow their ramp roles. */
:root[data-ui-theme='original-glass'] :is(#setup-dialog .rb-chip > b, #market-dialog .rb-chip > b) {
  font-size: var(--og-step-secondary) !important;
}
:root[data-ui-theme='original-glass']
  :is(
    #settings-dialog .setting-control > span,
    #settings-dialog #cinematic-note,
    #help-dialog #help-rules,
    #help-dialog p > b
  ) {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass'] #almanac-dialog .almanac-ship-name {
  font-size: var(--og-step-emphasis) !important;
}

:root[data-ui-theme='original-glass'] #market-dialog .rb-head span > b {
  font-size: var(--og-step-emphasis) !important;
}

:root[data-ui-theme='original-glass'] #crew-workspace-root .crew-head > div > p {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass'] :is(#setup-dialog #ship-name, #market-dialog #ship-name) {
  font-size: var(--og-step-screen) !important;
}

:root[data-ui-theme='original-glass'] :is(#setup-dialog .rb-ship-head h2, #market-dialog .rb-ship-head h2) {
  font-size: var(--og-step-screen) !important;
}
:root[data-ui-theme='original-glass']
  :is(
    #settings-dialog #display-title,
    #help-dialog > h2,
    #setup-dialog .setup-title > h2,
    #market-dialog .rb-title > h2,
    #crew-dialog h1
  ) {
  font-size: var(--og-step-title) !important;
}

:root[data-ui-theme='original-glass'] :is(#cs-title, #almanac-title) {
  font-size: var(--og-step-screen) !important;
}

:root[data-ui-theme='original-glass'] #almanac-dialog #almanac-summary > h3 {
  font-size: var(--og-step-screen) !important;
}

:root[data-ui-theme='original-glass'] #campaign-dialog .cs-hero-copy > h3 {
  font-size: var(--og-step-screen) !important;
}

:root[data-ui-theme='original-glass'] :is(#setup-dialog .setup-title > h2, #market-dialog .rb-title > h2) {
  font-size: var(--og-step-title) !important;
}

:root[data-ui-theme='original-glass'] .almanac-heading button {
  font-size: 24px !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #settings-dialog .settings-section > h3,
    #almanac-dialog h3,
    #almanac-dialog h4,
    #setup-dialog .rb h3,
    #setup-dialog .rb h4,
    #market-dialog .rb h3,
    #market-dialog .rb h4,
    #crew-dialog .crew-station h3
  ) {
  font-size: var(--og-step-emphasis) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #settings-dialog button,
    #help-dialog button,
    #almanac-states button,
    #almanac-dialog .almanac-controls button,
    #setup-dialog button,
    #market-dialog button,
    #crew-dialog button,
    #crew-workspace-root button,
    #campaign-dialog button
  ) {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #settings-dialog .setting-control,
    #help-dialog p,
    #almanac-dialog p,
    #almanac-dialog label,
    #almanac-count,
    #almanac-facts dt,
    #almanac-facts dd
  ) {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #almanac-list .almanac-ship-name,
    #campaign-dialog .cs-picker button > b,
    #campaign-dialog .cs-site > div > b,
    #campaign-dialog .cs-prizes li > b
  ) {
  font-size: var(--og-step-emphasis) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #setup-dialog .rb-ship-text > b,
    #market-dialog .rb-ship-text > b,
    #setup-dialog .rb-tile-text > b,
    #market-dialog .rb-tile-text > b,
    #setup-dialog .rb-row-text > b,
    #market-dialog .rb-row-text > b
  ) {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] :is(#setup-dialog .rb-allgrade button, #market-dialog .rb-allgrade button) {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass'] #setup-dialog .rb-seg button[data-act='tier'] > span {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #setup-dialog .rb-roster > h2,
    #market-dialog .rb-roster > h2,
    #setup-dialog .rb-group > h3,
    #market-dialog .rb-group > h3,
    #setup-dialog .rb-swap-head > h4,
    #market-dialog .rb-swap-head > h4,
    #setup-dialog .rb-list > h4,
    #market-dialog .rb-list > h4,
    #crew-dialog .crew-vessel > label,
    #campaign-dialog .cs-label,
    #campaign-dialog .cs-title > small,
    #campaign-dialog .cs-kicker,
    #campaign-dialog .cs-ledger small,
    #campaign-dialog .cs-facts > div > small,
    #almanac-dialog .almanac-catalog > h3
  ) {
  font-size: var(--og-step-caption) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #setup-dialog .rb p,
    #market-dialog .rb p,
    #setup-dialog .rb small,
    #market-dialog .rb small,
    #setup-dialog .rb dt,
    #setup-dialog .rb dd,
    #market-dialog .rb dt,
    #market-dialog .rb dd,
    #setup-dialog .captain-heading > span,
    #setup-dialog .captain-counters > span,
    #market-dialog .captain-heading > span,
    #market-dialog .captain-counters > span,
    #crew-dialog .crew-vessel > p,
    #crew-dialog .crew-capacity,
    #crew-dialog .crew-foot,
    #crew-dialog .crew-seat-effect,
    #crew-dialog .crew-level-badge,
    #crew-workspace-root .crew-workspace small,
    #campaign-dialog .cs-stat > small,
    #campaign-dialog .cs-hero-copy > h3 > span,
    #campaign-dialog .cs-hero-meta,
    #campaign-dialog .cs-arms,
    #campaign-dialog .cs-difficulty-note,
    #campaign-dialog .cs-record-note,
    #campaign-dialog .cs-ledger small,
    #campaign-dialog .cs-facts > div > b > i,
    #campaign-dialog .cs-go p,
    #campaign-dialog .cs-go em
  ) {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #setup-dialog .rb-stat > b,
    #market-dialog .rb-stat > b,
    #campaign-dialog .cs-ledger b,
    #campaign-dialog .cs-stat > b
  ) {
  font-size: var(--og-step-emphasis) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #setup-dialog .rb-fitted-main > strong,
    #market-dialog .rb-fitted-main > strong,
    #campaign-dialog .cs-facts > div > b
  ) {
  font-size: var(--og-step-title) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #setup-dialog .rb-picker > button > span,
    #setup-dialog .rb-picker > button > small,
    #setup-dialog .rb-picker button > span,
    #setup-dialog .rb-picker button > small,
    #market-dialog .rb-picker button > span,
    #market-dialog .rb-picker button > small,
    #setup-dialog .rb-actions > button,
    #market-dialog .rb-actions > button,
    #setup-dialog .rb-seg > button,
    #market-dialog .rb-seg > button,
    #setup-dialog .rb-quick-end button,
    #market-dialog .rb-quick-end button,
    #setup-dialog .setup-tabs > button,
    #campaign-dialog .cs-head > button,
    #campaign-dialog .cs-difficulty > button,
    #campaign-dialog .cs-link,
    #campaign-dialog .cs-launch
  ) {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #setup-dialog .rb-picker button > em,
    #setup-dialog .rb em,
    #setup-dialog .rb-row-text > small,
    #setup-dialog .rb-row-num > em,
    #setup-dialog .rb-fitted-main strong > i,
    #market-dialog .rb-picker button > em,
    #market-dialog .rb em,
    #market-dialog .rb-row-text > small,
    #market-dialog .rb-row-num > em,
    #market-dialog .rb-fitted-main strong > i,
    #setup-dialog .setup-footer > a,
    #market-dialog .rb-foot
  ) {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #setup-dialog .rb-picker button > span,
    #market-dialog .rb-picker button > span,
    #setup-dialog .rb-seg button,
    #market-dialog .rb-seg button,
    #crew-dialog .crew-head button,
    #crew-dialog .crew-tabs button,
    #crew-dialog .crew-station button,
    #crew-workspace-root .crew-workspace button
  ) {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass']
  :is(#crew-dialog .crew-station-label, #crew-dialog .crew-station-heading > small) {
  font-size: var(--og-step-emphasis) !important;
}

:root[data-ui-theme='original-glass']
  :is(#crew-dialog .crew-empty-seat, #crew-dialog .crew-station > p:not(.crew-seat-effect)) {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass']
  :is(#crew-workspace-root .crew-seat-person > div > b, #crew-workspace-root .crew-officer-copy > b) {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] #campaign-dialog .cs-captain > div > b,
:root[data-ui-theme='original-glass'] #campaign-dialog .cs-socket-head > span > b {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] #campaign-dialog .cs-equip > div > b {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #campaign-dialog .cs-facts > div > small,
    #campaign-dialog .cs-stat > small,
    #campaign-dialog .cs-label > span,
    #campaign-dialog .cs-seed,
    #campaign-dialog .cs-picker button > span,
    #campaign-dialog .cs-prizes li > span,
    #campaign-dialog .cs-prizes li > i
  ) {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass']
  :is(
    #campaign-dialog .cs-facts > div > small,
    #campaign-dialog .cs-label,
    #campaign-dialog .cs-title > small,
    #campaign-dialog .cs-kicker,
    #campaign-dialog .cs-ledger small,
    #almanac-dialog .almanac-catalog > h3
  ) {
  font-size: var(--og-step-caption) !important;
}

/* The start menu now follows the ramp. Other compact controls share one size. */
:root[data-ui-theme='original-glass'] #start-menu .start-menu-panel {
  width: min(600px, 94vw);
  padding: clamp(24px, 3vw, 48px);
}

:root[data-ui-theme='original-glass'] #start-menu #start-menu-title {
  font-size: var(--og-step-display) !important;
}

:root[data-ui-theme='original-glass'] #start-menu .start-menu-kicker {
  font-size: var(--og-step-caption) !important;
}

:root[data-ui-theme='original-glass'] #start-menu .start-menu-subtitle {
  margin-bottom: 12px;
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] #start-menu nav button {
  min-height: calc(var(--og-step-emphasis) * 2.67);
  font-size: var(--og-step-emphasis) !important;
}

:root[data-ui-theme='original-glass'] :is(button, select, input:not([type='range']), textarea) {
  line-height: 1.25;
}

/* The captain stat uses a longer monospace caption than the other two tiles. */
:root[data-ui-theme='original-glass'] #result.er .er-stat[data-stat='captain'] > small {
  letter-spacing: 0.75px;
}

/* Crew follows the shared ramp while retaining its existing layout. */
:root[data-ui-theme='original-glass'] #crew-workspace-root .crew-workspace small {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass'] #crew-workspace-root .crew-workspace :is(button, select, input) {
  font-size: var(--og-step-body) !important;
}

/* Equipment gets a little more room; cargo remains denser than the ship controls. */
:root[data-ui-theme='original-glass'] #market-dialog {
  width: min(1500px, calc(100vw - 32px));
  max-width: min(1500px, calc((100vw - 24px) / var(--gui-size, 1)));
  height: min(1000px, 94vh);
}

@media (min-width: 1600px) {
  :root[data-ui-theme='original-glass'] #market-dialog .rb-body {
    grid-template-columns: 280px minmax(0, 1fr) 388px;
  }
}

/* Location reports leave the entire chart available until a location is selected. */
:root[data-ui-theme='original-glass'] #result.map .route-selection {
  grid-template-columns: minmax(0, 1fr);
}

:root[data-ui-theme='original-glass'] #map-location-dialog {
  box-sizing: border-box;
  width: min(1120px, calc((100vw - 32px) / var(--gui-size, 1)));
  max-width: calc((100vw - 32px) / var(--gui-size, 1));
  max-height: calc((100dvh - 48px) / var(--gui-size, 1));
  margin: auto;
  padding: 20px;
  overflow-y: auto;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
}

:root[data-ui-theme='original-glass'] #map-location-dialog::backdrop {
  background: #050b14bb;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .map-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .map-dialog-head h2 {
  margin: 0;
  font-size: var(--og-step-title) !important;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .route-details {
  min-height: 0;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .details-fit {
  position: static;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .site-body {
  overflow: visible;
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .site-head b {
  font-size: var(--og-step-emphasis) !important;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .site-head span {
  font-size: var(--og-step-caption) !important;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .decision.prize > b,
:root[data-ui-theme='original-glass'] #map-location-dialog .decision.prize > div:not(.route-actions) {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .route-actions button {
  padding: 12px 14px;
  font-size: var(--og-step-body) !important;
  line-height: 1.35;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .route-actions button > span {
  font-family: Inter, sans-serif;
  font-size: var(--og-step-body) !important;
  font-weight: 500;
  line-height: 1.35;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .route-actions button > em {
  font-size: var(--og-step-secondary) !important;
  font-style: normal;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .stake,
:root[data-ui-theme='original-glass'] #map-location-dialog .selected-route-note,
:root[data-ui-theme='original-glass'] #map-location-dialog button {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass'] #map-location-dialog .selected-route-note {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass'] #map-location-dialog [data-map-close] {
  flex: none;
  width: auto;
  background: var(--og-well);
  color: var(--text);
}

:root[data-ui-theme='original-glass']
  #result.map
  :is(.here-actions .route-actions button, #map-market, [data-map-crew])
  > span {
  font-size: var(--og-step-body) !important;
}

:root[data-ui-theme='original-glass']
  #result.map
  :is(.here-actions .route-actions button, #map-market, [data-map-crew])
  > em {
  font-size: var(--og-step-secondary) !important;
}

:root[data-ui-theme='original-glass'] #result.map details.orders > summary {
  font-size: var(--og-step-caption) !important;
}

:root[data-ui-theme='original-glass'] #map-location-dialog.requires-decision :is(.selected-route-note, #map-travel) {
  display: none;
}
