/* Every child is positioned, so the padding moves nothing; it makes the "home" container's height the
   height left between the insets, which the container queries below fit the menu to. */
.home-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  overflow: hidden;
  box-sizing: border-box;
  padding-block: var(--vt-safe-t) var(--vt-safe-b);
  container: home / size;
  background:
    radial-gradient(ellipse at 68% 48%, #22164e 0%, #0d0a28 42%, var(--vt-void) 100%);
  color: var(--vt-text);
  font-family: var(--vt-font-body);
  transition: opacity 0.8s ease-out;
}

/* Live 3D island rendered by MenuBackdrop. */
.home-backdrop {
  position: absolute;
  inset: 0;
}

.home-backdrop canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.4s ease;
}

.home-backdrop.ready canvas {
  opacity: 1;
}

.home-backdrop.quick canvas {
  transition-duration: 0.42s;
}

.home-backdrop.swapping canvas {
  opacity: 0;
}

.home-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 4, 15, 0.94) 0%, rgba(5, 4, 15, 0.78) 28%, rgba(5, 4, 15, 0.2) 56%, rgba(5, 4, 15, 0) 72%),
    linear-gradient(0deg, rgba(5, 4, 15, 0.8) 0%, transparent 26%),
    linear-gradient(180deg, rgba(5, 4, 15, 0.65) 0%, transparent 20%);
}

.home-scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px);
}

/* Edge offsets below grow to clear notches and the home indicator (the --vt-safe-* insets, 0 elsewhere). */
.home-top {
  position: absolute;
  top: max(28px, calc(var(--vt-safe-t) + 12px));
  left: max(clamp(28px, 6vw, 96px), calc(var(--vt-safe-l) + 12px));
  right: calc(80px + var(--vt-safe-r));
  display: flex;
  align-items: center;
  gap: 18px;
}

.home-top .vt-tag {
  color: var(--vt-muted);
}

.home-top .coords {
  font-family: var(--vt-font-display);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--vt-dim);
  font-variant-numeric: tabular-nums;
}

/* Centred a little low between the insets, in the space under the top bar. */
.home-main {
  --home-left: max(clamp(28px, 6vw, 96px), calc(var(--vt-safe-l) + 12px));
  --home-mid: calc(50% + (var(--vt-safe-t) - var(--vt-safe-b)) / 2);
  position: absolute;
  left: var(--home-left);
  top: calc(var(--home-mid) + 16px);
  transform: translateY(-50%);
  width: min(590px, 88vw);
  max-width: calc(100vw - var(--home-left) - var(--vt-safe-r) - 12px);
  display: flex;
  flex-direction: column;
  animation: home-rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes home-rise {
  from { opacity: 0; transform: translateY(calc(-50% + 18px)); }
  to { opacity: 1; transform: translateY(-50%); }
}

/* The wordmark (two lines, or one on short screens) over the crew's name; both scale with --title-size. */
.home-title {
  --title-size: clamp(50px, min(7.2vw, 10.6cqh), 94px);
  display: flex;
  align-items: center;
  margin: 0;
  font-family: var(--vt-font-display);
  font-weight: 700;
  line-height: 0.92;
}

.title-void {
  font-size: var(--title-size);
  letter-spacing: 0.035em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 0%, #d6fbff 42%, #5ff6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(95, 246, 255, 0.32));
}

.title-void > span {
  display: block;
}

/* The full name: the crew's name tracked out under the wordmark, with a rule to its right edge. */
.title-words {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.title-crew {
  display: flex;
  align-items: center;
  gap: 0.8em;
  align-self: stretch;
  margin-top: calc(var(--title-size) * 0.16);
  font-size: max(10px, calc(var(--title-size) * 0.2));
  font-weight: 600;
  letter-spacing: 0.34em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--vt-cyan);
  text-shadow: 0 0 14px rgba(95, 246, 255, 0.45);
}

.title-crew::after {
  content: "";
  flex: 1;
  min-width: 14px;
  height: 1px;
  background: linear-gradient(90deg, rgba(95, 246, 255, 0.65), transparent);
}

.home-tagline {
  max-width: 470px;
  margin: 20px 0 26px;
  font-size: 16px;
  line-height: 1.6;
  color: #b8c5e3;
}

.home-tagline b {
  color: var(--vt-text);
  font-weight: 600;
}

.home-missions > .vt-tag {
  margin-bottom: 10px;
}

.mission-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.mission-card {
  --cut: 9px;
  --accent: var(--vt-cyan);
  --plate-line: rgba(120, 220, 255, 0.22);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  padding: 9px 9px 10px;
  text-align: left;
  background: linear-gradient(180deg, rgba(16, 20, 50, 0.86), rgba(7, 9, 26, 0.88));
  color: var(--vt-text);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.mission-card:hover {
  --plate-line: color-mix(in srgb, var(--accent) 60%, transparent);
  transform: translateY(-2px);
}

.mission-card.selected {
  --plate-line: var(--accent);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(20, 30, 66, 0.88), rgba(8, 12, 32, 0.92));
}

.mission-card.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  --b: var(--accent);
  background:
    linear-gradient(var(--b), var(--b)) right top / 12px 2px no-repeat,
    linear-gradient(var(--b), var(--b)) right top / 2px 12px no-repeat,
    linear-gradient(var(--b), var(--b)) left bottom / 12px 2px no-repeat,
    linear-gradient(var(--b), var(--b)) left bottom / 2px 12px no-repeat;
}

.mc-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  font-family: var(--vt-font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: var(--vt-muted);
}

.mission-card.selected .mc-label {
  color: #ffffff;
}

/* The planet's number with its stars earned, or a lock. */
.mc-num {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.mc-name {
  max-width: 100%;
  margin-top: 6px;
  overflow: hidden;
  font-family: var(--vt-font-display);
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  color: #ffffff;
}

.mc-tier {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.8;
  transition: opacity 0.15s ease;
}

.mission-card.selected .mc-tier {
  opacity: 1;
}

.mc-meta {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
  font-family: var(--vt-font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: #b8c5e3;
}

.mc-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
}

.mc-meta .vt-icon {
  flex: none;
  width: 11px;
  height: 11px;
  color: var(--vt-dim);
}

.mission-brief {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-height: 20px;
  margin: 9px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--vt-muted);
}

.mission-brief b {
  font-weight: 600;
  color: var(--vt-text);
}

.mb-chip {
  --tone: var(--vt-teal);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px 1px 5px;
  font-family: var(--vt-font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tone) 70%, #ffffff);
  background: color-mix(in srgb, var(--tone) 16%, rgba(8, 10, 24, 0.92));
  border: 1px solid color-mix(in srgb, var(--tone) 50%, transparent);
}

.mb-chip .vt-icon {
  width: 12px;
  height: 12px;
}

.mb-chip.best {
  --tone: #ffd36a;
  font-variant-numeric: tabular-nums;
}

.mb-chip.full {
  --tone: #ffd36a;
}

.mission-card.locked {
  background: linear-gradient(180deg, rgba(12, 14, 34, 0.8), rgba(6, 8, 22, 0.86));
}

.mission-card.locked:hover {
  --plate-line: color-mix(in srgb, var(--accent) 35%, transparent);
}

.mission-card.locked.selected {
  --plate-line: color-mix(in srgb, var(--accent) 70%, transparent);
}

.mission-card.locked .mc-name,
.mission-card.locked .mc-tier,
.mission-card.locked .mc-meta {
  opacity: 0.45;
}

.mc-best {
  display: flex;
  flex: none;
  align-items: center;
  gap: 1px;
}

.mc-best .vt-icon {
  flex: none;
  width: 10px;
  height: 10px;
  color: #ffd36a;
}

.mc-best .vt-icon.off {
  color: rgba(255, 255, 255, 0.2);
}

.mc-best.lock .vt-icon {
  width: 12px;
  height: 12px;
  color: var(--vt-dim);
}

/* Planets that come with the full version: a gold lock, unlike the grey one still to be earned. */
.mission-card.paid .mc-best.lock .vt-icon {
  color: #ffd36a;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.home-actions .vt-btn {
  min-height: 52px;
  padding: 12px 26px;
  font-size: 14px;
}

.home-actions .vt-btn.primary {
  padding: 12px 30px;
}

.home-actions .vt-btn.ghost {
  padding-inline: 14px;
  letter-spacing: 0.1em;
}

/* A save adds a second launch button, so the manual and chronicle keep only their icons (as they do
   whenever their labels would wrap the row, see fitHomeActions in main.js). */
.home-actions.has-save .ghost-label,
.home-actions.compact .ghost-label {
  display: none;
}

/* If the icons alone still wrap the row (a save, an Unlock button and Game Center at once, or a phone
   held upright), the buttons close up. */
.home-actions.tight {
  gap: 6px;
}

.home-actions.tight .vt-btn.primary {
  padding-inline: 18px;
  letter-spacing: 0.08em;
}

.home-actions.tight .vt-btn.ghost {
  padding-inline: 11px;
}

.home-actions.tight .rank-button .vt-insignia {
  width: 18px;
  height: 18px;
}

.home-actions .vt-btn .vt-icon {
  width: 18px;
  height: 18px;
}

.home-actions .btn-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.1;
}

.home-actions .btn-sub {
  font-family: var(--vt-font-body);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 0.78;
}

.home-actions .continue-button.primary {
  order: -1;
}

/* A locked planet's launch button explains itself rather than looking broken. */
.home-actions .vt-btn.locked:disabled {
  --plate-line: rgba(255, 255, 255, 0.16);
  opacity: 1;
  filter: none;
  background: linear-gradient(180deg, rgba(18, 22, 50, 0.92), rgba(9, 11, 28, 0.92));
  color: var(--vt-muted);
}

.home-actions .vt-btn.locked .vt-icon {
  color: var(--vt-dim);
}

.continue-button[hidden],
#leaderboardButton[hidden] {
  display: none;
}

/* ------------------------------------------------------------- Ship card */
.home-ship {
  margin-top: 16px;
}

.home-ship > .vt-tag {
  margin-bottom: 8px;
}

.ship-card {
  --cut: 10px;
  --culture: var(--vt-cyan);
  --plate-line: color-mix(in srgb, var(--culture) 45%, transparent);
  --view: 136px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  box-sizing: border-box;
  padding: 10px 16px 10px calc(var(--view) + 15px);
  background:
    radial-gradient(70% 160% at 0% 50%, color-mix(in srgb, var(--culture) 14%, transparent), transparent 62%),
    linear-gradient(180deg, rgba(16, 20, 50, 0.86), rgba(7, 9, 26, 0.88));
  color: var(--vt-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease;
}

/* The outline draws over the ship's viewport. */
.ship-card::before {
  z-index: 1;
}

.ship-card:hover {
  --plate-line: var(--culture);
  transform: translateY(-2px);
}

/* A window in the plate onto the ship, idling on a turntable (ShipPortrait.js). */
.sc-view {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 1px;
  width: var(--view);
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(60% 46% at 50% 86%, color-mix(in srgb, var(--culture) 26%, transparent), transparent 72%),
    radial-gradient(120% 90% at 50% 40%, rgba(40, 56, 110, 0.35), transparent 70%),
    linear-gradient(180deg, rgba(3, 5, 16, 0.92), rgba(9, 12, 32, 0.9));
  box-shadow: inset -1px 0 0 color-mix(in srgb, var(--culture) 32%, transparent);
}

.sc-view canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.sc-view.live canvas {
  opacity: 1;
}

.sc-view.live .vt-badge {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ship-card .vt-badge {
  --badge: var(--culture);
  width: 42px;
  height: 37px;
}

.ship-card .vt-badge .vt-icon {
  width: 21px;
  height: 21px;
}

.sc-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sc-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  font-family: var(--vt-font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
}

.sc-name small {
  overflow: hidden;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--culture);
}

.sc-perk {
  overflow: hidden;
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--vt-muted);
}

.sc-perk .vt-icon {
  width: 14px;
  height: 14px;
  margin-right: 5px;
  color: var(--culture);
}

.sc-perk b {
  margin-right: 7px;
  font-weight: 600;
  color: var(--vt-text);
}

.sc-open {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--vt-font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vt-cyan);
}

.sc-open .vt-icon {
  width: 19px;
  height: 19px;
}

/* The menu steps aside while the hangar is open. `filter` fades it because the entrance animations own `opacity`. */
.home-main,
.home-dossier,
.home-top,
.home-foot {
  transition: filter 0.35s ease, visibility 0s linear 0s;
}

.home-screen.hangar-open :is(.home-main, .home-dossier, .home-top, .home-foot) {
  filter: opacity(0);
  visibility: hidden;
  pointer-events: none;
  transition: filter 0.3s ease, visibility 0s linear 0.3s;
}

/* ---------------------------------------------------------------- Hangar */
.hangar {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.hangar[hidden] {
  display: none;
}

/* Darkens the island around the ship so the close-up reads; centred on the ship by main.js. */
.hangar-stage {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 34% 46% at var(--ship-x, 70%) var(--ship-y, 50%), transparent 0%, rgba(5, 4, 15, 0.18) 55%, rgba(5, 4, 15, 0.62) 100%);
  opacity: 0;
  cursor: grab;
  touch-action: none;
  transition: opacity 0.8s ease;
}

.hangar.show .hangar-stage {
  opacity: 1;
}

.hangar-stage.dragging {
  cursor: grabbing;
}

.hangar-hint {
  position: absolute;
  right: max(clamp(22px, 4vw, 56px), calc(var(--vt-safe-r) + 12px));
  bottom: max(clamp(20px, 5vh, 44px), calc(var(--vt-safe-b) + 8px));
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--vt-font-display);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vt-muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.hangar.show .hangar-hint {
  opacity: 1;
  transition-delay: 1s;
}

.hangar-hint .vt-icon {
  width: 15px;
  height: 15px;
  color: var(--vt-cyan);
}

.hangar-panel {
  --cut: 14px;
  --culture: var(--vt-cyan);
  --plate-line: color-mix(in srgb, var(--culture) 40%, var(--vt-line));
  position: absolute;
  left: max(clamp(20px, 5vw, 80px), calc(var(--vt-safe-l) + 12px));
  top: calc(50% + (var(--vt-safe-t) - var(--vt-safe-b)) / 2);
  display: flex;
  flex-direction: column;
  width: min(450px, 44vw);
  max-height: calc(100% - 48px - var(--vt-safe-t) - var(--vt-safe-b));
  box-sizing: border-box;
  padding: 18px 20px 16px;
  opacity: 0;
  transform: translate(-24px, -50%);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s ease;
}

.hangar.show .hangar-panel {
  opacity: 1;
  transform: translate(0, -50%);
}

.hangar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hangar-tag {
  display: block;
  color: var(--vt-cyan);
}

.hangar-head .vt-close {
  position: relative;
  top: auto;
  right: auto;
  flex: none;
  width: 30px;
  height: 30px;
  margin: -4px -6px -4px 0;
}

.hangar-tabs {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 4px;
  margin: 12px 0 14px;
}

.hangar-tab {
  --cut: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 9px 2px 8px;
  background: rgba(4, 7, 22, 0.62);
  color: var(--vt-muted);
  font-family: var(--vt-font-display);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.hangar-tab span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hangar-tab .vt-icon {
  width: 22px;
  height: 22px;
  color: var(--culture);
  opacity: 0.72;
}

.hangar-tab:hover {
  --plate-line: color-mix(in srgb, var(--culture) 50%, transparent);
  color: var(--vt-text);
}

.hangar-tab.selected {
  --plate-line: var(--culture);
  background: linear-gradient(180deg, color-mix(in srgb, var(--culture) 28%, transparent), color-mix(in srgb, var(--culture) 6%, transparent));
  color: #ffffff;
}

.hangar-tab.selected .vt-icon {
  opacity: 1;
  filter: drop-shadow(0 0 6px var(--culture));
}

.ht-current {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vt-ok);
  box-shadow: 0 0 6px var(--vt-ok);
}

.hangar-tab .ht-lock {
  position: absolute;
  top: 3px;
  right: 4px;
  display: flex;
}

.hangar-tab .ht-lock .vt-icon {
  width: 11px;
  height: 11px;
  color: #ffd36a;
  opacity: 0.9;
  filter: none;
}

.hangar-body {
  min-height: 0;
  margin-right: -8px;
  padding-right: 8px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(95, 246, 255, 0.35) transparent;
}

.hb-culture {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--vt-font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--culture);
}

.hb-culture .vt-icon {
  width: 16px;
  height: 16px;
}

.hb-culture small {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--vt-dim);
}

.hb-name {
  margin: 6px 0 0;
  font-family: var(--vt-font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0 22px color-mix(in srgb, var(--culture) 45%, transparent);
}

.hb-role {
  margin-top: 5px;
  font-family: var(--vt-font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vt-muted);
}

.hb-full {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  padding: 1px 7px 1px 5px;
  font-size: 10px;
  letter-spacing: 0.12em;
  vertical-align: 1px;
  color: #ffe6a6;
  background: rgba(255, 211, 106, 0.14);
  border: 1px solid rgba(255, 211, 106, 0.5);
}

.hb-full .vt-icon {
  width: 11px;
  height: 11px;
}

.hb-quote {
  margin: 10px 0 14px;
  font-size: 14px;
  font-style: italic;
  color: #c9d4ee;
}

.hb-stats {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.hs-row {
  display: grid;
  grid-template-columns: 92px 1fr 86px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--vt-muted);
}

.hs-row b {
  font-family: var(--vt-font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--vt-text);
}

.hs-bar {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.07);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 9px);
  mask: repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 9px);
}

.hs-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--culture) 55%, transparent), var(--culture));
  transition: width 0.35s ease;
}

.hb-perk {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-left: 2px solid var(--culture);
  background: color-mix(in srgb, var(--culture) 10%, rgba(4, 7, 22, 0.6));
}

.hb-perk .vt-badge {
  --badge: var(--culture);
}

.hb-perk b {
  font-family: var(--vt-font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
}

.hb-perk p {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #c3cfe8;
}

.hb-desc,
.hb-lore {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.55;
  color: #aab6d4;
}

.hb-lore b {
  font-weight: 600;
  color: var(--culture);
}

.hangar-foot {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.hangar-foot .vt-btn.primary {
  flex: 1;
  min-width: 0;
}

.hangar-foot .vt-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-dossier {
  --cut: 12px;
  position: absolute;
  right: max(clamp(22px, 4vw, 56px), calc(var(--vt-safe-r) + 12px));
  bottom: max(clamp(22px, 6vh, 56px), calc(var(--vt-safe-b) + 8px));
  width: 272px;
  box-sizing: border-box;
  padding: 14px 16px 13px;
  background: var(--vt-plate-fill);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: home-fade 1.2s 0.3s ease both;
}

@keyframes home-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.home-dossier dl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 11px 0 0;
}

.home-dossier dl div[hidden] {
  display: none;
}

.home-dossier dl div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
}

.home-dossier dt {
  color: var(--vt-muted);
}

.home-dossier dd {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-family: var(--vt-font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.home-dossier dd.critical {
  color: var(--vt-ember);
}

.home-dossier dd.warn {
  color: var(--vt-warn);
}

.home-dossier dd.reserves {
  gap: 12px;
  font-variant-numeric: tabular-nums;
}

.home-dossier dd.reserves span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.home-dossier dd.reserves .vt-icon {
  width: 13px;
  height: 13px;
}

.home-dossier dd.reserves .metal .vt-icon { color: var(--vt-metal); }
.home-dossier dd.reserves .water .vt-icon { color: var(--vt-water); }

.home-dossier dd.cultures {
  gap: 5px;
}

.home-dossier dd.cultures span {
  display: inline-flex;
  color: var(--culture);
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--culture) 50%, transparent));
}

.home-dossier dd.cultures .vt-icon {
  width: 16px;
  height: 16px;
}

.dossier-lore {
  margin: 9px 0 0;
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
  color: #aab6d4;
}

.instability {
  margin-top: 10px;
}

.instability .row {
  display: flex;
  justify-content: space-between;
  font-family: var(--vt-font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vt-muted);
}

.instability .row b {
  color: var(--vt-ember);
  font-variant-numeric: tabular-nums;
}

.instability .meter {
  position: relative;
  height: 5px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.08);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px);
  mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px);
}

.instability .meter span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 87%;
  background: linear-gradient(90deg, #ffd36a, var(--vt-ember) 60%, var(--vt-danger));
  transition: width 0.6s ease;
}

.home-foot {
  position: absolute;
  left: max(clamp(28px, 6vw, 96px), calc(var(--vt-safe-l) + 12px));
  bottom: max(26px, calc(var(--vt-safe-b) + 8px));
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--vt-font-display);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vt-dim);
}

.home-foot .vt-icon {
  width: 14px;
  height: 14px;
}

/* ---------------------------------------------------------- Field manual */
.instructions-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--vt-safe-t) var(--vt-safe-r) var(--vt-safe-b) var(--vt-safe-l);
  box-sizing: border-box;
  background: rgba(3, 2, 12, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.instructions-modal.show {
  opacity: 1;
  visibility: visible;
}

.instructions-content {
  --cut: 18px;
  --plate-line: var(--vt-line-strong);
  display: flex;
  flex-direction: column;
  width: min(900px, calc(92 * var(--vt-safe-vw)));
  max-height: calc(88 * var(--vt-safe-vh));
  padding: 1px;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(95, 246, 255, 0.07), transparent 140px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, rgba(14, 17, 46, 0.98), rgba(6, 7, 22, 0.98));
  transform: translateY(10px) scale(0.98);
  transition: transform 0.3s ease;
}

.instructions-modal.show .instructions-content {
  transform: none;
}

.instructions-body {
  position: relative;
  min-height: 0;
  overflow: auto;
  padding: 24px 28px 26px;
}

.instructions-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 46px 18px 0;
}

.instructions-header .vt-tag {
  margin-bottom: 4px;
  color: var(--vt-cyan);
}

.instructions-title {
  margin: 0;
  font-family: var(--vt-font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
}

.manual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 34px;
}

.instructions-section {
  margin-bottom: 18px;
}

.instructions-section.wide {
  grid-column: 1 / -1;
}

.section-title {
  margin: 0 0 12px;
}

.instructions-text {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.6;
  color: #c3cfe8;
}

.instructions-text strong,
.instruction-text strong {
  color: #ffffff;
  font-weight: 600;
}

.instruction-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.instructions-modal .touch-only {
  display: none;
}

/* Touch-only devices: the manual swaps its mouse and keyboard wording for touch. */
@media (hover: none) and (pointer: coarse) {
  .instructions-modal .desktop-only { display: none; }
  .instructions-modal span.touch-only { display: inline; }
  .instructions-modal .instruction-item.touch-only { display: grid; }
}

.instruction-text {
  font-size: 14px;
  line-height: 1.5;
  color: #c3cfe8;
}

.instruction-item .vt-badge {
  width: 34px;
  height: 30px;
}

.instruction-item .vt-badge.metal { --badge: var(--vt-metal); }
.instruction-item .vt-badge.biomass { --badge: var(--vt-biomass); }
.instruction-item .vt-badge.water { --badge: var(--vt-water); }
.instruction-item .vt-badge.generator { --badge: #33cc88; }
.instruction-item .vt-badge.assembly { --badge: #ff8a4a; }
.instruction-item .vt-badge.storage { --badge: #b07ad6; }
.instruction-item .vt-badge.engineering { --badge: #4aa8e8; }
.instruction-item .vt-badge.synthesizer { --badge: #a58aff; }
.instruction-item .vt-badge.turret { --badge: var(--vt-cyan); }
.instruction-item .vt-badge.raider { --badge: var(--vt-danger); }

.manual-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 34px;
}

/* ------------------------------------------------------------- Chronicle */
.chronicle-modal .instructions-content {
  width: min(860px, calc(92 * var(--vt-safe-vw)));
}

.chronicle-tabs {
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.chron-lead {
  margin: 0 0 16px;
  font-size: 15px;
  font-style: italic;
  color: #c3cfe8;
}

.chron-entries {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 30px;
}

.chron-entry h3 {
  margin: 0 0 6px;
  font-family: var(--vt-font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--vt-cyan);
}

.chron-entry p,
.chron-culture > p,
.chron-world > p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.65;
  color: #c3cfe8;
}

.chron-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.chron-chip {
  --cut: 7px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 10px;
  background: rgba(4, 7, 22, 0.6);
  color: var(--vt-muted);
  font-family: var(--vt-font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.chron-chip .vt-icon {
  width: 18px;
  height: 18px;
  color: var(--culture);
}

.chron-chip:hover {
  --plate-line: color-mix(in srgb, var(--culture) 50%, transparent);
  color: var(--vt-text);
}

.chron-chip.selected {
  --plate-line: var(--culture);
  background: color-mix(in srgb, var(--culture) 18%, rgba(4, 7, 22, 0.6));
  color: #ffffff;
}

.chron-culture header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.chron-culture .vt-badge {
  --badge: var(--culture);
}

.chron-culture h3 {
  margin: 0 0 3px;
  font-family: var(--vt-font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
}

.cc-epithet {
  font-size: 13px;
  color: var(--culture);
}

.chron-culture blockquote {
  margin: 0 0 14px;
  padding: 9px 14px;
  border-left: 2px solid var(--culture);
  background: color-mix(in srgb, var(--culture) 8%, transparent);
  font-family: var(--vt-font-display);
  font-size: 16px;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.chron-culture > p:first-of-type {
  font-size: 16px;
  font-style: italic;
  color: #ffffff;
}

.cc-crew {
  margin: 16px 0 14px;
  padding: 12px 14px;
  background: rgba(95, 246, 255, 0.05);
}

.cc-crew .vt-tag {
  margin-bottom: 6px;
  color: var(--vt-cyan);
}

.cc-crew p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #dfe8fa;
}

.cc-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  margin: 0;
}

.cc-facts dt {
  margin-bottom: 4px;
  font-family: var(--vt-font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vt-muted);
}

.cc-facts dd {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--vt-text);
}

.cc-facts small {
  margin-left: 4px;
  color: var(--vt-dim);
}

.chron-sub {
  margin: 24px 0 12px;
}

.chron-fleet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.chron-ship {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 11px;
  padding: 10px 12px;
  border-left: 2px solid var(--culture);
  background: rgba(4, 7, 22, 0.55);
}

.chron-ship .vt-badge {
  --badge: var(--culture);
}

.chron-ship b {
  display: block;
  font-family: var(--vt-font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
}

.chron-ship small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--culture);
}

.chron-ship p {
  margin: 5px 0 0;
  font-size: 12.5px;
  font-style: italic;
  color: #aab6d4;
}

.chron-world {
  margin-bottom: 12px;
  padding: 14px 16px 12px;
  border-left: 2px solid var(--accent);
  background: rgba(4, 7, 22, 0.5);
}

.chron-world header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}

.chron-world h3 {
  margin: 0;
  font-family: var(--vt-font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
}

.chron-world header span {
  font-family: var(--vt-font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.chron-world header .cw-saved {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  color: var(--vt-ok);
}

.cw-colonies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.cw-colonies li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--vt-muted);
}

.cw-colonies .vt-icon {
  width: 16px;
  height: 16px;
  color: var(--culture);
}

.cw-colonies b {
  font-weight: 600;
  color: var(--vt-text);
}

.cw-epilogue {
  margin: 0;
  font-size: 13px;
  font-style: italic;
  color: var(--vt-dim);
}

.chron-world.saved .cw-epilogue {
  color: #ffe39a;
}

/* ---------------------------------------------------------- Full version */
.store-modal .instructions-content {
  width: min(780px, calc(92 * var(--vt-safe-vw)));
}

.store-modal .instructions-header .vt-badge {
  --badge: #ffd36a;
}

.store-lead {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.55;
  color: #dfe8fa;
}

.store-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 26px;
}

.store-grid h3 {
  margin: 0 0 8px;
}

.store-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.store-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1px 10px;
  padding: 7px 10px;
  border-left: 2px solid var(--tone);
  background: rgba(4, 7, 22, 0.55);
}

.store-list .vt-icon {
  grid-row: span 2;
  width: 20px;
  height: 20px;
  color: var(--tone);
}

.store-list b {
  font-family: var(--vt-font-display);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
}

.store-list span {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--vt-muted);
}

.store-fine {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--vt-dim);
}

.store-note {
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--vt-muted);
}

.store-note:empty {
  display: none;
}

.store-note.ok {
  color: var(--vt-ok);
}

.store-note.warn {
  color: var(--vt-warn);
}

.store-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.store-actions .vt-btn[hidden] {
  display: none;
}

.store-offer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 211, 106, 0.45);
  background: linear-gradient(100deg, rgba(255, 211, 106, 0.16), rgba(255, 211, 106, 0.04));
}

.store-offer[hidden] {
  display: none;
}

.so-text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
  font-size: 13px;
  color: var(--vt-muted);
}

.so-text .vt-tag {
  color: #ffd36a;
}

.so-text b {
  font-family: var(--vt-font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffffff;
}

.so-text code {
  font-family: var(--vt-font-display);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #ffe39a;
}

.store-offer .vt-btn {
  flex: none;
  text-decoration: none;
}

/* -------------------------------------------------------- Service record */
.rank-button .vt-insignia {
  width: 24px;
  height: 24px;
}

.record-modal .instructions-content {
  width: min(860px, calc(92 * var(--vt-safe-vw)));
}

.record-insignia .vt-insignia {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 0 12px var(--rank));
}

.record-modal .instructions-header .vt-tag {
  color: var(--rank);
}

.record-progress {
  margin: -4px 0 18px;
}

.rp-bar {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
}

.rp-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, color-mix(in srgb, var(--rank) 55%, #ffffff), var(--rank));
  box-shadow: 0 0 10px var(--rank);
}

.rp-text {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--vt-muted);
}

.rp-text b {
  font-family: var(--vt-font-display);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #ffffff;
}

.record-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 14px 30px;
}

.record-grid h3,
.record-medals-head h3 {
  margin: 0 0 8px;
}

.rank-ladder,
.xp-rules,
.medal-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-ladder {
  gap: 2px;
}

.rank-ladder li {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 3px 10px 3px 6px;
  font-size: 13px;
  color: var(--vt-dim);
}

.rank-ladder .vt-insignia {
  width: 26px;
  height: 26px;
}

.rank-ladder b {
  font-family: var(--vt-font-display);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rank-ladder span {
  font-variant-numeric: tabular-nums;
}

.rank-ladder li.ahead .vt-insignia {
  opacity: 0.4;
  filter: grayscale(0.7);
}

.rank-ladder li.held {
  color: var(--vt-muted);
}

.rank-ladder li.current {
  color: #ffffff;
  background: linear-gradient(90deg, color-mix(in srgb, var(--rank) 18%, transparent), transparent);
  box-shadow: inset 2px 0 var(--rank);
}

.rank-ladder li.current b {
  color: var(--rank);
}

.xp-rules {
  gap: 8px;
}

.xp-rules li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 1px 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--vt-muted);
}

.xp-rules .vt-icon {
  grid-row: span 2;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: #ffd36a;
}

.xp-rules b {
  font-weight: 600;
  color: #ffffff;
}

.record-medals-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.record-medals-head h3 {
  flex: 1;
}

.record-medals-head .vt-btn[hidden] {
  display: none;
}

.medal-list {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px;
}

.medal-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--vt-dim);
  background: rgba(4, 7, 22, 0.55);
}

.medal-art {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--vt-dim);
  opacity: 0.55;
}

.medal-art .vt-icon {
  width: 22px;
  height: 22px;
}

.medal-art .vt-insignia {
  width: 30px;
  height: 30px;
  filter: grayscale(0.8);
}

.medal-list b {
  display: block;
  font-family: var(--vt-font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vt-muted);
}

.medal-list em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  color: var(--vt-muted);
}

.medal-bar {
  display: block;
  height: 3px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.medal-bar i {
  display: block;
  height: 100%;
  background: #ffd36a;
}

.medal-list li.earned {
  color: var(--vt-muted);
  background: linear-gradient(90deg, rgba(255, 211, 106, 0.12), rgba(4, 7, 22, 0.55));
  box-shadow: inset 2px 0 #ffd36a;
}

.medal-list li.earned .medal-art {
  color: #ffd36a;
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(255, 211, 106, 0.45));
}

.medal-list li.earned .medal-art .vt-insignia {
  filter: none;
}

.medal-list li.earned b {
  color: #ffffff;
}

.medal-check {
  width: 16px;
  height: 16px;
  color: #ffd36a;
}

/* ---------------------------------------------------- First-launch comms */
/* Over the menu and the sound toggle (the menu's music starts once the call is acknowledged), under the field manual. */
.comms {
  position: fixed;
  inset: 0;
  z-index: 2700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, var(--vt-safe-t)) max(16px, var(--vt-safe-r)) max(16px, var(--vt-safe-b)) max(16px, var(--vt-safe-l));
  box-sizing: border-box;
  background: radial-gradient(ellipse at 50% 50%, rgba(5, 4, 15, 0.45), rgba(5, 4, 15, 0.85));
  animation: comms-fade 0.5s ease-out both;
}

.comms[hidden] {
  display: none;
}

.comms-panel {
  --cut: 16px;
  --plate-line: rgba(61, 255, 197, 0.45);
  --bracket-color: var(--vt-teal);
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: 100%;
  box-sizing: border-box;
  padding: 20px 24px 18px;
  animation: comms-open 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.comms-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.vt-badge.comms-badge {
  --badge: var(--vt-teal);
  animation: comms-ping 1.8s ease-in-out infinite;
}

.comms.received .vt-badge.comms-badge {
  animation: none;
}

.comms-id {
  min-width: 0;
}

.comms-id .vt-tag {
  color: var(--vt-teal);
}

.comms-signal {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.comms-signal i {
  width: 3px;
  background: var(--vt-teal);
  opacity: 0.3;
  animation: vt-signal 2.4s steps(1) infinite;
}

.comms-signal i:nth-child(1) { height: 3px; animation-delay: 0s; }
.comms-signal i:nth-child(2) { height: 5px; animation-delay: 0.3s; }
.comms-signal i:nth-child(3) { height: 7px; animation-delay: 0.6s; }
.comms-signal i:nth-child(4) { height: 10px; animation-delay: 0.9s; }

.comms-from {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 9px;
  margin-top: 6px;
  font-family: var(--vt-font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--vt-dim);
}

.comms-from b {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #ffffff;
}

.comms-from span::before {
  content: "// ";
  opacity: 0.6;
}

.comms-text {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  margin: 16px 0 18px;
  padding: 2px 4px 2px 16px;
  border-left: 2px solid rgba(61, 255, 197, 0.4);
  font-size: 15px;
  line-height: 1.6;
  color: #c3d0ec;
  scrollbar-width: thin;
  scrollbar-color: rgba(61, 255, 197, 0.35) transparent;
}

.comms-text p {
  margin: 0 0 0.65em;
}

.comms-text p:last-child {
  margin-bottom: 0;
}

.comms-text p:first-child {
  color: #ffffff;
  font-weight: 500;
}

.ct-ghost {
  opacity: 0;
}

/* The caret takes no room, so it never changes where the words wrap. */
.ct-caret {
  position: relative;
}

.ct-caret::after {
  content: "";
  position: absolute;
  left: 1px;
  bottom: -0.2em;
  width: 0.5em;
  height: 1.15em;
  background: var(--vt-teal);
  box-shadow: 0 0 8px rgba(61, 255, 197, 0.8);
  animation: comms-caret 1s steps(1) infinite;
}

.comms-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.comms-foot .vt-btn.primary {
  min-width: 200px;
}

.comms-foot .vt-btn[hidden] {
  display: none;
}

.comms.closing {
  animation: comms-fade 0.42s ease-in reverse both;
}

.comms.closing .comms-panel {
  animation: comms-close 0.42s ease-in both;
}

@keyframes comms-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* The picture rolls open out of a bright line, like an old screen warming up, and collapses back into one. */
@keyframes comms-open {
  0% { opacity: 0; transform: scale(0.5, 0.01); filter: brightness(2.4); }
  30% { opacity: 1; transform: scale(1, 0.01); filter: brightness(2.4); }
  65% { transform: scale(1, 1.02); filter: brightness(1.4); }
  100% { opacity: 1; transform: none; filter: none; }
}

@keyframes comms-close {
  0% { transform: none; filter: none; }
  45% { opacity: 1; transform: scale(1, 0.01); filter: brightness(2.4); }
  100% { opacity: 0; transform: scale(0.3, 0.01); filter: brightness(2.4); }
}

@keyframes comms-ping {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.8); }
}

@keyframes comms-caret {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

/* ------------------------------------------------------------ Responsive */
@media (max-width: 980px) {
  .home-dossier { display: none; }
  /* The panel narrows below its 450px cap, so Back keeps only its arrow. */
  .hangar-foot #hangarBack { padding-inline: 12px; }
  #hangarBack span { display: none; }
}

@media (max-width: 760px) {
  .manual-grid,
  .manual-pair { grid-template-columns: 1fr; }
  .chron-entries,
  .cc-facts { grid-template-columns: 1fr; }
  .store-grid { grid-template-columns: 1fr; }
  .record-grid { grid-template-columns: 1fr; }
}

@media (max-height: 860px) {
  .home-tagline { margin: 16px 0 20px; }
  .home-ship { margin-top: 12px; }
  .ship-card { --view: 112px; min-height: 64px; padding-block: 8px; padding-right: 14px; }
  .home-actions { margin-top: 18px; }
}

@media (max-height: 820px) {
  .home-foot { display: none; }
}

@media (max-height: 760px) {
  .dossier-lore { display: none; }
  .home-top { top: max(20px, calc(var(--vt-safe-t) + 8px)); }
  .home-main { top: calc(var(--home-mid) + 10px); }
  .home-title { --title-size: clamp(40px, min(5.4vw, 8.6cqh), 64px); }
  .title-void { white-space: nowrap; }
  .title-void > span { display: inline; }
  .home-tagline { margin: 14px 0 18px; font-size: 14.5px; }
  .home-actions { margin-top: 16px; }
  .home-actions .vt-btn { min-height: 46px; }
  .mc-name { font-size: 18px; }
  .mission-brief { margin-top: 7px; font-size: 12.5px; }
  .hangar-panel { padding: 14px 16px 12px; }
  .hb-name { font-size: 28px; }
  .hb-quote { margin: 6px 0 10px; }
  .hb-stats { gap: 5px; margin-bottom: 10px; }
  /* The store's buttons stay in view: a status note takes the fine print's place. */
  .store-modal .instructions-header { margin-bottom: 12px; }
  .store-lead { margin-bottom: 12px; }
  .store-grid h3 { margin-bottom: 6px; }
  .store-list li { padding-block: 5px; }
  .store-modal:has(.store-note:not(:empty)) .store-fine { display: none; }
  .store-actions { margin-top: 12px; }
}

@media (max-height: 520px) {
  .home-top { display: none; }
  .home-main { top: var(--home-mid); width: min(600px, 84vw); }
  .home-title { --title-size: clamp(28px, 8.4cqh, 40px); }
  .home-tagline { display: none; }
  .home-missions { margin-top: 14px; }
  .home-missions > .vt-tag { margin-bottom: 6px; }
  .mission-card { padding: 6px 8px 7px; }
  .mc-name { margin-top: 3px; font-size: 16px; }
  .mc-meta { margin-top: 3px; font-size: 10px; }
  .mission-brief { flex-wrap: nowrap; min-height: 0; margin-top: 5px; font-size: 12px; }
  .mb-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mb-chip { flex: none; font-size: 9px; }
  .home-actions { margin-top: 12px; gap: 8px; }
  .home-actions .vt-btn { min-height: 40px; padding: 8px 18px; font-size: 12.5px; }
  .instructions-body { padding: 16px 18px; }
  .instructions-header { margin-bottom: 10px; }
  /* Phones held sideways: the store keeps both lists side by side, one line per item. */
  .store-modal .instructions-body { padding-block: 14px; }
  .store-modal .instructions-header { margin-bottom: 8px; }
  .store-modal .instructions-header .vt-badge { width: 36px; height: 32px; }
  .store-modal .instructions-header .vt-badge .vt-icon { width: 19px; height: 19px; }
  .store-modal .instructions-title { font-size: 21px; }
  .store-lead { margin-bottom: 8px; font-size: 13.5px; }
  .store-grid { grid-template-columns: 1fr 1fr; gap: 8px 18px; }
  .store-grid h3 { margin-bottom: 5px; }
  .store-list { gap: 3px; }
  .store-list li { padding: 2px 8px; }
  .store-list .vt-icon { grid-row: auto; width: 16px; height: 16px; }
  .store-list span { display: none; }
  .store-fine { margin-top: 8px; font-size: 11.5px; }
  .store-note { margin-top: 8px; font-size: 12.5px; }
  .store-actions { margin-top: 10px; }
  .store-actions .vt-btn { min-height: 38px; padding: 6px 16px; }
  /* With the launch special on show, its headline and the fine print give way so the buttons stay in view. */
  .store-offer { gap: 10px; margin-bottom: 8px; padding: 6px 10px; }
  .so-text { font-size: 12px; }
  .so-text b,
  .store-modal:has(.store-offer:not([hidden])) .store-fine { display: none; }
  .store-offer .vt-btn { min-height: 36px; padding: 6px 14px; }
  .record-insignia .vt-insignia { width: 38px; height: 38px; }
  .record-progress { margin: -2px 0 12px; }
  .rank-ladder li { padding-block: 1px; font-size: 12px; }
  .rank-ladder .vt-insignia { width: 22px; height: 22px; }
  .xp-rules { gap: 5px; }
  .xp-rules li { font-size: 12px; line-height: 1.4; }
  .record-medals-head { margin-top: 12px; }
  .medal-list li { padding: 5px 8px; }
  .home-ship { margin-top: 10px; }
  .home-ship > .vt-tag { display: none; }
  .ship-card { --view: 84px; min-height: 48px; padding: 6px 12px 6px calc(var(--view) + 12px); gap: 10px; }
  .ship-card .vt-badge { width: 32px; height: 28px; }
  .ship-card .vt-badge .vt-icon { width: 17px; height: 17px; }
  .sc-name { font-size: 15px; }
  .sc-perk { font-size: 11.5px; }
  /* A full-height column on the left; the tabs drop their names. */
  .hangar-panel {
    left: max(12px, calc(var(--vt-safe-l) + 8px));
    top: max(10px, var(--vt-safe-t));
    bottom: max(10px, var(--vt-safe-b));
    width: min(400px, 50vw);
    max-height: none;
    padding: 10px 14px 10px;
    transform: translateX(-24px);
  }
  .hangar.show .hangar-panel { transform: none; }
  .hangar-tag { font-size: 9.5px; }
  .hangar-head .vt-close { width: 26px; height: 26px; }
  .hangar-tabs { margin: 8px 0; }
  .hangar-tab { padding: 5px 2px; }
  .hangar-tab span { display: none; }
  .hangar-tab .vt-icon { width: 19px; height: 19px; }
  .hb-name { font-size: 22px; margin-top: 4px; }
  .hb-role { font-size: 10.5px; }
  .hb-quote { display: none; }
  .hb-stats { gap: 4px; margin: 8px 0; }
  .hs-row { grid-template-columns: 78px 1fr 78px; font-size: 11px; }
  .hb-perk { padding: 7px 10px; gap: 9px; margin-bottom: 8px; }
  .hb-perk p { font-size: 12px; }
  .hb-desc, .hb-lore { font-size: 12px; }
  .hangar-foot { margin-top: 8px; padding-top: 8px; }
  .hangar-foot .vt-btn { min-height: 36px; padding: 6px 14px; font-size: 11.5px; }
  .hangar-foot #hangarBack { padding-inline: 12px; }
  #hangarBack span { display: none; }
  .hangar-hint { bottom: max(14px, calc(var(--vt-safe-b) + 4px)); right: max(18px, calc(var(--vt-safe-r) + 8px)); }
}

/* Room between the insets, not the window's height: a window toolbar or the home indicator takes its share. */
@container home (max-height: 600px) {
  .home-tagline { display: none; }
}

/* The shortest screens set the crew's name beside the wordmark rather than under it. */
@container home (max-height: 420px) {
  .title-words { flex-direction: row; align-items: baseline; column-gap: calc(var(--title-size) * 0.34); }
  .title-crew { flex: 1; align-self: auto; margin-top: 0; }
}

/* Then drop the picker's heading, then the cards' clock and cell counts. */
@container home (max-height: 380px) {
  .home-missions { margin-top: 10px; }
  .home-missions > .vt-tag { display: none; }
}

@container home (max-height: 340px) {
  .mc-meta { display: none; }
}

/* Phones held sideways: a tighter call. */
@media (max-height: 520px) {
  .comms { padding: max(10px, var(--vt-safe-t)) max(12px, var(--vt-safe-r)) max(10px, var(--vt-safe-b)) max(12px, var(--vt-safe-l)); }
  .comms-panel { --cut: 12px; padding: 12px 16px; }
  .comms-head { gap: 11px; }
  .comms-head .vt-badge.lg { width: 36px; height: 32px; }
  .comms-head .vt-badge.lg .vt-icon { width: 19px; height: 19px; }
  .comms-from { margin-top: 4px; }
  .comms-from b { font-size: 13px; }
  .comms-text { margin: 10px 0 12px; padding-left: 12px; font-size: 13.5px; line-height: 1.5; }
  .comms-text p { margin-bottom: 0.5em; }
  .comms-foot .vt-btn { min-height: 36px; }
  .comms-foot .vt-btn.primary { min-width: 0; padding: 6px 18px; font-size: 12px; }
}

@media (max-height: 420px) {
  .comms-text { margin: 8px 0 10px; font-size: 12.5px; line-height: 1.45; }
}

@media (max-height: 340px) {
  .comms-panel { padding: 10px 14px; }
  .comms-head .vt-badge.lg { width: 30px; height: 26px; }
  .comms-head .vt-badge.lg .vt-icon { width: 16px; height: 16px; }
  .comms-from { margin-top: 2px; }
  .comms-text { margin: 6px 0 8px; font-size: 12px; line-height: 1.4; }
  .comms-text p { margin-bottom: 0.35em; }
  .comms-foot .vt-btn { min-height: 32px; }
}

/* Phones held upright: the panel's side padding goes to the text. */
@media (max-width: 420px) {
  .comms-panel { padding: 16px 16px 14px; }
  .comms-text { padding-left: 12px; font-size: 14px; line-height: 1.5; }
}

@media (max-width: 600px) {
  .home-shade {
    background:
      linear-gradient(0deg, rgba(5, 4, 15, 0.95) 0%, rgba(5, 4, 15, 0.82) 45%, rgba(5, 4, 15, 0.25) 75%, rgba(5, 4, 15, 0.5) 100%);
  }
  .home-top { left: max(22px, calc(var(--vt-safe-l) + 12px)); right: calc(70px + var(--vt-safe-r)); }
  .home-top .coords { display: none; }
  .home-main {
    left: max(20px, calc(var(--vt-safe-l) + 8px));
    right: max(20px, calc(var(--vt-safe-r) + 8px));
    top: auto;
    bottom: max(26px, calc(var(--vt-safe-b) + 8px));
    width: auto;
    max-width: none;
    transform: none;
    animation: none;
  }
  .home-title { --title-size: clamp(36px, 11vw, 54px); }
  .title-void > span { display: block; }
  .home-tagline { font-size: 14px; margin: 14px 0 18px; }
  .mission-cards { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  /* Three cards to a row: the label closes up so the stars and the tier still share its line. */
  .mission-card { padding-inline: 7px; }
  .mc-label { gap: 4px; letter-spacing: 0.04em; }
  .mc-num { gap: 4px; }
  .mc-tier { font-size: 8.5px; letter-spacing: 0.06em; }
  .home-actions .vt-btn:not(.ghost) { flex: 1 1 auto; }
  .home-foot { display: none; }
  .instructions-body { padding: 18px 16px; }
  .ship-card { --view: 112px; padding-right: 12px; }
  .sc-name { flex-direction: column; align-items: flex-start; gap: 3px; }
  .sc-name small { max-width: 100%; }
  .sc-open span { display: none; }
  /* The hangar becomes a bottom sheet with the ship above it. */
  .hangar-panel {
    left: max(10px, calc(var(--vt-safe-l) + 8px));
    right: max(10px, calc(var(--vt-safe-r) + 8px));
    top: auto;
    bottom: max(10px, var(--vt-safe-b));
    width: auto;
    max-height: 60%;
    padding: 14px 14px 12px;
    transform: translateY(24px);
  }
  .hangar.show .hangar-panel { transform: none; }
  .hangar-hint { display: none; }
  .hangar-yard { display: none; }
  .hangar-tab { padding: 7px 2px; }
  .hangar-tab span { display: none; }
  .hangar-tab .vt-icon { width: 20px; height: 20px; }
  .hb-name { font-size: 26px; }
  .hs-row { grid-template-columns: 80px 1fr 80px; }
  .hangar-foot .vt-btn { padding-inline: 14px; letter-spacing: 0.08em; }
}

/* Narrow but not tall (a phone upright on a small screen, or a Split View half): one line of title, no tagline. */
@media (max-width: 600px) and (max-height: 760px) and (min-height: 521px) {
  .home-title { --title-size: clamp(30px, 8vw, 40px); }
  .title-void > span { display: inline; }
  .home-tagline { display: none; }
  .home-missions { margin-top: 16px; }
}

/* Small phones held sideways: the short-screen sizes win, and the hangar stays a side column. */
@media (max-width: 600px) and (max-height: 520px) {
  .home-main { bottom: max(12px, var(--vt-safe-b)); }
  .mission-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .mission-card { padding-inline: 7px; }
  .mc-label { font-size: 10px; letter-spacing: 0.06em; }
  .mc-tier { font-size: 8.5px; letter-spacing: 0.08em; }
  .mc-name { font-size: 15px; }
  .mc-meta > span { margin-left: 4px; }
  .ship-card { --view: 84px; }
  .sc-name { flex-direction: row; align-items: baseline; gap: 10px; }
  .home-title { --title-size: clamp(24px, 8cqh, 32px); }
  .title-void > span { display: inline; }
  .hangar-panel {
    left: max(10px, calc(var(--vt-safe-l) + 8px));
    right: auto;
    top: max(10px, var(--vt-safe-t));
    bottom: max(10px, var(--vt-safe-b));
    width: 52vw;
    max-height: none;
    padding: 10px 12px;
    transform: translateX(-24px);
  }
  /* The portrait shade darkens the lower half, where the ship sits in this layout. */
  .home-shade { transition: opacity 0.6s ease; }
  .home-screen.hangar-open .home-shade { opacity: 0.3; }
}
