:root {
  --bg: #050b18;
  --bg-alt: #0d1527;
  --panel: rgba(13, 21, 39, 0.8);
  --panel-strong: rgba(15, 25, 47, 0.95);
  --panel-soft: rgba(16, 26, 46, 0.72);
  --line: rgba(141, 171, 211, 0.2);
  --text: #ebf2ff;
  --muted: #a8b8d6;
  --cyan: #76d7ff;
  --blue: #3f7bff;
  --orange: #ff9b3d;
  --orange-soft: rgba(255, 155, 61, 0.18);
  --shadow: rgba(10, 16, 29, 0.8);
  /* OPERATIONS MEGASHIP MAPS: the largest size that fits the sidebar
     header on one line. Sidebar section titles sit 2pt below it. */
  --sidebar-brand-size: 15.5px;
  --sidebar-title-size: calc(var(--sidebar-brand-size) - 2pt);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top, rgba(63, 123, 255, 0.32), transparent 30%),
    radial-gradient(
      circle at bottom right,
      rgba(255, 155, 61, 0.2),
      transparent 25%
    ),
    linear-gradient(180deg, #040913 0%, #07111f 45%, #030911 100%);
  color: var(--text);
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 14, 24, 0.7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 18px;
  z-index: 20;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.22);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #05111c;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 0 24px rgba(118, 215, 255, 0.45);
}

.brand-name {
  font-size: 0.96rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 0.92rem;
}

.main-nav a {
  transition: color 180ms ease;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange), #ffbf66);
  color: #180f06;
  box-shadow: 0 12px 30px rgba(255, 155, 61, 0.3);
}

.btn-secondary {
  border-color: var(--line);
  background: rgba(8, 14, 24, 0.6);
  color: var(--text);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 26px;
  align-items: center;
  padding: 72px 0 42px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 20px;
  color: var(--cyan);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 700;
}

.hero-copy h1,
.section-heading h2,
.mission-copy h2,
.cta-band h2 {
  margin: 0;
  line-height: 0.97;
  letter-spacing: -0.06em;
}

.hero-copy h1 {
  font-size: clamp(3.3rem, 6vw, 6rem);
  max-width: 12ch;
}

.lede {
  margin: 20px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.75;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 28px;
}

.hero-stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 0;
  margin: 34px 0 0;
}

.hero-stats li {
  min-width: 130px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(17, 27, 43, 0.65);
}

.hero-stats strong {
  display: block;
  font-size: 1.35rem;
  color: var(--text);
}

.hero-stats span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.visual-frame {
  position: relative;
  width: min(520px, 100%);
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: linear-gradient(
    180deg,
    rgba(12, 18, 29, 0.9),
    rgba(11, 17, 28, 0.7)
  );
  box-shadow: 0 28px 80px rgba(8, 13, 23, 0.7);
  overflow: hidden;
}

.visual-glow {
  position: absolute;
  inset: 5% 8% auto 8%;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(118, 215, 255, 0.32),
    transparent 65%
  );
  filter: blur(28px);
}

.ship {
  position: absolute;
  inset: auto 0 0 0;
  width: min(82%, 380px);
  margin: 0 auto;
  opacity: 0.96;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.45));
}

.ship-command {
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  bottom: 28px;
}

.ship-engineering {
  right: 10%;
  bottom: 18px;
  width: min(44%, 220px);
  opacity: 0.75;
}

.floating-panel {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(118, 215, 255, 0.4);
  border-radius: 16px;
  background: rgba(7, 12, 21, 0.82);
  box-shadow: 0 10px 28px rgba(7, 15, 26, 0.6);
}

.floating-panel span {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.floating-panel strong {
  font-size: 1.2rem;
}

.panel-top {
  left: 26px;
  top: 42px;
}

.panel-bottom {
  right: 24px;
  bottom: 54px;
}

.tool-showcase,
.map-browser,
.mission-grid {
  padding-top: 56px;
}

.section-heading {
  margin-bottom: 28px;
}

.section-intro {
  max-width: 56ch;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.map-browser-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: 20px;
  align-items: stretch;
}

.map-list {
  display: grid;
  gap: 10px;
}

.map-option {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 18, 31, 0.72);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.map-option:hover,
.map-option:focus-visible {
  border-color: rgba(118, 215, 255, 0.55);
  transform: translateX(3px);
}

.map-option.is-active {
  border-color: var(--orange);
  background: linear-gradient(
    100deg,
    rgba(255, 155, 61, 0.18),
    rgba(16, 27, 45, 0.9)
  );
}

.map-index {
  color: var(--cyan);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.map-option-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.map-option-copy strong {
  font-size: 1.05rem;
}

.map-option-copy small,
.map-arrow {
  color: var(--muted);
}

.map-arrow {
  font-size: 1.3rem;
}

.map-viewer {
  min-width: 0;
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(118, 215, 255, 0.28);
  border-radius: 20px;
  background: rgba(8, 15, 26, 0.84);
  box-shadow: 0 24px 60px rgba(4, 8, 16, 0.38);
}

.map-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 4px 16px;
}

.map-viewer h3 {
  margin: 6px 0 0;
  font-size: 1.35rem;
}

.map-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.map-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #78e6a2;
  box-shadow: 0 0 12px #78e6a2;
}

.map-canvas {
  display: grid;
  place-items: center;
  min-height: 440px;
  padding: 22px;
  border: 1px solid var(--line);
  background-color: #080e18;
  background-image:
    linear-gradient(rgba(118, 215, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(118, 215, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  overflow: hidden;
}

.map-canvas img {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.map-canvas img.is-changing {
  opacity: 0;
  transform: scale(0.98);
}

.map-viewer figcaption {
  padding: 14px 4px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-heading h2,
.mission-copy h2,
.cta-band h2 {
  font-size: clamp(2.1rem, 4vw, 3.5rem);
}

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

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 240px;
  padding: 22px 20px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(
    180deg,
    rgba(12, 18, 29, 0.85),
    rgba(8, 15, 25, 0.8)
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.feature-card {
  background: linear-gradient(
    180deg,
    rgba(27, 42, 59, 0.92),
    rgba(10, 17, 28, 0.82)
  );
  border-color: rgba(118, 215, 255, 0.3);
}

.card-icon {
  display: inline-flex;
  width: fit-content;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(118, 215, 255, 0.25);
  border-radius: 999px;
  background: rgba(118, 215, 255, 0.08);
  color: var(--cyan);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

.tool-card h3 {
  margin: 18px 0 12px;
  font-size: 1.5rem;
  line-height: 1.15;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.card-tag {
  display: inline-flex;
  align-self: flex-start;
  margin-top: auto;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  background: var(--orange-soft);
  color: #ffc07a;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mission-grid {
  display: grid;
  grid-template-columns: 1fr 0.95fr;
  gap: 26px;
  align-items: stretch;
}

.mission-copy {
  padding: 30px 0 0;
}

.mission-copy p {
  color: var(--muted);
  line-height: 1.8;
  font-size: 1.02rem;
}

.mission-copy ul {
  margin: 24px 0 0;
  padding-left: 1.2rem;
  color: var(--text);
  line-height: 1.8;
}

.mission-panels {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.mini-panel {
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(13, 24, 38, 0.9),
    rgba(7, 12, 22, 0.8)
  );
}

.accent-panel {
  background: linear-gradient(
    180deg,
    rgba(34, 48, 73, 0.9),
    rgba(13, 21, 33, 0.8)
  );
  border-color: rgba(255, 155, 61, 0.25);
}

.panel-label {
  display: block;
  color: var(--cyan);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mini-panel h3 {
  margin: 12px 0 8px;
  font-size: 1.7rem;
}

.mini-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.cta-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 64px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(
    135deg,
    rgba(14, 22, 36, 0.9),
    rgba(10, 15, 24, 0.92)
  );
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 4px 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Full-screen map workspace */
.maps-page {
  --map-bg: #151515;
  --map-surface: rgba(24, 24, 24, 0.98);
  --map-surface-strong: #000;
  --map-surface-soft: rgba(17, 17, 17, 0.94);
  --map-surface-translucent: rgba(0, 0, 0, 0.9);
  --line: rgba(200, 200, 200, 0.2);
  --text: #f2f2f2;
  --muted: #b8b8b8;
  overflow: hidden;
  background: var(--map-bg);
}

.map-app {
  position: relative;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  min-height: 0;
}

.map-app.is-sidebar-collapsed {
  grid-template-columns: 24px minmax(0, 1fr);
}

.map-sidebar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  width: auto;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: linear-gradient(
    180deg,
    var(--map-surface),
    var(--map-surface-strong)
  );
  z-index: 3;
}

.map-app.is-sidebar-collapsed .map-sidebar {
  grid-template-columns: 24px;
  width: 24px;
}

.map-sidebar-content {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

/* Each sidebar section sits in its own rounded container spanning the
   sidebar's 8px content inset; the border matches the deck buttons' hover
   color, and the 8px flex gap separates the containers on all sides. */
.sidebar-settings,
.mission-controls,
.layer-controls {
  border: 1px solid rgba(118, 215, 255, 0.55);
  border-radius: 10px;
}

.sidebar-settings {
  padding: 8px 12px 12px 8px;
}

.mission-controls {
  padding: 8px 12px 12px 8px;
}

/* Match the perceived eyebrow-to-first-title gap to the mission titles'
   own spacing: 7px box gap + 3px button padding = the 10px text gap the
   titles have between each other (4px grid gap + 3px padding per side). */
.mission-controls .layer-controls-heading {
  margin-bottom: 7px;
}

.mission-controls .layer-controls-heading .eyebrow {
  margin-bottom: 0;
}

/* Match the MISSION MODE-to-toggle gap to the mission selector's
   title-to-first-title gap (10px). */
.sidebar-settings .layer-controls-heading {
  margin-bottom: 10px;
}

.sidebar-settings .layer-controls-heading .eyebrow {
  margin-bottom: 0;
}

/* An unselected mission is the sidebar's call to action: the container's
   border turns orange and pulses over a slow under-glow until a mission
   is chosen. The halo pools light under the section, and the small
   downward shadow spills it out from beneath. */
.mission-controls.is-awaiting-mission {
  animation: mission-await-pulse 2.8s ease-in-out infinite;
}

@keyframes mission-await-pulse {
  0%,
  100% {
    border-color: rgba(255, 134, 13, 0.4);
    box-shadow:
      0 0 18px -4px rgba(255, 134, 13, 0.2),
      0 7px 20px -7px rgba(255, 134, 13, 0.3);
  }
  50% {
    border-color: rgba(255, 134, 13, 0.85);
    box-shadow:
      0 0 24px -4px rgba(255, 134, 13, 0.36),
      0 9px 26px -7px rgba(255, 134, 13, 0.52);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mission-controls.is-awaiting-mission {
    animation: none;
    border-color: rgba(255, 134, 13, 0.6);
    box-shadow:
      0 0 22px -4px rgba(255, 134, 13, 0.3),
      0 9px 26px -7px rgba(255, 134, 13, 0.42);
  }
}

.map-sidebar-content[hidden] {
  display: none;
}

.map-sidebar-toggle {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--map-surface-soft);
  color: var(--cyan);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
}

.map-sidebar-toggle:hover,
.map-sidebar-toggle:focus-visible {
  background: rgba(118, 215, 255, 0.13);
  color: var(--text);
}

.map-sidebar-toggle span {
  transition: transform 180ms ease;
}

.map-app.is-sidebar-collapsed .map-sidebar-toggle {
  grid-column: 1;
  border-left: 0;
}

.map-app.is-sidebar-collapsed .map-sidebar-toggle span {
  transform: rotate(180deg);
}

.map-app-brand,
.map-app-brand > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.map-app-brand > div {
  gap: 9px;
  color: var(--text);
  font-size: var(--sidebar-brand-size);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.map-app-brand > div span,
.layer-controls-heading .eyebrow,
#open-about {
  color: var(--orange);
}

/* The brand row vertically centers its title against the 32px logo; pull
   the title up so its top gap matches the section containers' title gap. */
.map-app-brand > div span {
  position: relative;
  top: -5px;
}

.map-app-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0.72rem;
}

.map-credits {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.credit-name {
  white-space: nowrap;
}

.map-brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.map-back {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 1.1rem;
  transition:
    color 180ms ease,
    border-color 180ms ease;
}

.map-back:hover,
.map-back:focus-visible {
  border-color: var(--cyan);
  color: var(--text);
}

.layer-controls {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 12px 8px 8px;
  scrollbar-color: rgba(118, 215, 255, 0.12) transparent;
  scrollbar-width: thin;
}

.layer-controls::-webkit-scrollbar {
  width: 8px;
}

.layer-controls::-webkit-scrollbar-track {
  background: transparent;
}

.layer-controls::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.layer-controls::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: rgba(118, 215, 255, 0.12);
  background-clip: padding-box;
}

.layer-controls-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.mission-mode-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--map-surface-soft);
}

.mission-mode-option {
  flex: 1 1 0;
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
}

.mission-mode-option:hover,
.mission-mode-option:focus-visible,
.mission-mode-option.is-active {
  background: rgba(118, 215, 255, 0.13);
  color: var(--text);
}

.mission-selector {
  display: grid;
  gap: 4px;
}

.mission-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: left;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.mission-option:hover,
.mission-option:focus-visible {
  border-color: rgba(118, 215, 255, 0.55);
  color: var(--text);
}

.mission-option.is-active {
  border-color: var(--orange);
  background: linear-gradient(
    100deg,
    rgba(255, 155, 61, 0.18),
    var(--map-surface-soft)
  );
  color: var(--text);
}

.layer-controls-heading .eyebrow {
  margin-bottom: 6px;
  font-size: var(--sidebar-title-size);
}

/* The layer heading row is just "MAP LAYERS" + the All button: center both
   on the same line and drop the eyebrow's bottom margin so the alignment
   is exact. */
.layer-controls .layer-controls-heading {
  align-items: center;
}

.layer-controls .layer-controls-heading .eyebrow {
  margin-bottom: 0;
}

.layer-controls-heading h2 {
  margin: 0;
  font-size: var(--sidebar-title-size);
}

.layer-reset {
  padding: 4px 7px;
  border: 1px solid rgba(208, 21, 225, 0.55);
  border-radius: 5px;
  background: transparent;
  color: #d015e1;
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
}

.layer-reset:hover,
.layer-reset:focus-visible {
  border-color: #d015e1;
  color: var(--text);
}

.layer-reset.is-active {
  border-color: #d015e1;
  background: rgba(208, 21, 225, 0.2);
  color: var(--text);
}

.layer-tree {
  display: grid;
  gap: 4px;
}

.layer-group {
  padding: 0;
}

.layer-group-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px;
}

.layer-disclosure {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
}

.layer-disclosure span:first-child {
  width: 10px;
  color: var(--cyan);
  font-size: 0;
  transition: transform 180ms ease;
}

.layer-disclosure span:first-child::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin: 0 auto;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 7px solid currentColor;
}

.layer-disclosure[aria-expanded="false"] span:first-child {
  transform: rotate(-90deg);
}

.layer-disclosure:hover,
.layer-disclosure:focus-visible {
  color: var(--cyan);
}

.layer-group > .layer-group-heading > .layer-disclosure span:first-child::before {
  border-left-width: 5px;
  border-right-width: 5px;
  border-top-width: 9px;
}

.layer-children {
  display: grid;
  gap: 2px;
  padding: 2px 0 0 17px;
}

.layer-subgroup {
  padding: 3px 0;
}

.layer-subgroup > .layer-group-heading > .layer-disclosure {
  padding-left: 7px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.layer-subgroup .layer-children {
  padding-left: 28px;
}

.layer-subgroup.has-single-child {
  border-top: 0;
  padding: 0;
}

.layer-subgroup.has-single-child > .layer-group-heading {
  display: none;
}

.layer-subgroup.has-single-child > .layer-children {
  padding: 0;
}

.layer-children[hidden] {
  display: none;
}

.layer-parent {
  width: 28px;
  justify-content: center;
  padding: 6px 4px;
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.layer-toggle[hidden],
.layer-group[hidden] {
  display: none;
}

.layer-toggle:hover,
.layer-toggle:focus-visible {
  border-color: var(--line);
  color: var(--text);
}

.layer-tree > .layer-toggle[data-layer="labels"] {
  justify-content: space-between;
  padding: 4px 0 4px 4px;
  border-right: 0;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
}

.layer-tree > .layer-toggle[data-layer="labels"]:not(.is-visible) {
  opacity: 1;
  text-decoration: none;
}

.labels-tick {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
}

.layer-tree > .layer-toggle[data-layer="labels"].is-visible .labels-tick {
  border-color: #ff860d;
  background: rgba(255, 134, 13, 0.2);
}

.layer-tree
  > .layer-toggle[data-layer="labels"]:not(.is-visible)
  .labels-tick
  .layer-swatch {
  border: 1px solid #ff860d;
  background: transparent;
  box-shadow: none;
}

.layer-toggle:not(.is-visible) {
  opacity: 0.45;
  text-decoration: line-through;
}

.layer-toggle:disabled {
  cursor: default;
  pointer-events: none;
  opacity: 0.45;
}

.layer-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--muted);
  box-shadow: 0 0 10px currentColor;
}

.architecture-swatch {
  color: var(--cyan);
  background: var(--cyan);
}
.consumables-swatch {
  color: #8a5cff;
  background: #8a5cff;
}
.operations-layer-swatch {
  color: var(--swatch-color);
  background: var(--swatch-color);
}

.operations-branch {
  padding: 3px 0;
}

.operations-branch-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
}

.operations-branch-heading > .layer-disclosure {
  min-width: 0;
  padding-left: 7px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.operations-poi-group > .operations-branch-heading > .layer-disclosure {
  padding-left: 4px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
}

.operations-depth-2 > .operations-branch-heading > .layer-disclosure {
  font-size: 0.72rem;
  font-weight: 500;
}

.operations-branch-heading > .layer-toggle,
.layer-subgroup > .layer-group-heading > .layer-toggle {
  width: 28px;
  justify-content: center;
}

.layer-parent.is-visible {
  border-color: var(--tick-color, transparent);
  background: color-mix(in srgb, var(--tick-color, transparent) 20%, transparent);
}

.layer-parent:not(.is-visible) {
  opacity: 1;
  text-decoration: none;
}

.layer-parent:not(.is-visible) .layer-swatch {
  border: 1px solid var(--tick-color, transparent);
  background: transparent;
  box-shadow: none;
}

.layer-group[data-layer-group="architecture"] .layer-parent {
  --tick-color: var(--cyan);
}

.layer-group[data-layer-group="consumables"] .layer-parent {
  --tick-color: #8a5cff;
}

.layer-group[data-layer-group="text"] .layer-parent {
  --tick-color: #ff860d;
}
.energy-swatch {
  color: #ffff00;
  background: #ffff00;
}
.battery-swatch {
  color: #ffbf00;
  background: #ffbf00;
}
.ammo-swatch {
  color: #ffffff;
  background: #ffffff;
}
.grenade-swatch {
  color: #ff0000;
  background: #ff0000;
}
.medkit-swatch {
  color: #00a933;
  background: #00a933;
}
.text-swatch {
  color: #ff860d;
  background: #ff860d;
}
.labels-swatch {
  color: #ff860d;
  background: #ff860d;
}

.map-sidebar-note {
  margin: auto 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.7;
}

.map-sidebar-note span {
  color: var(--orange);
  padding: 0 4px;
}

.about-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 0;
  padding: 5px 0;
  border: 0;
  border-top: 1px solid rgba(141, 171, 211, 0.12);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: left;
  transition: color 180ms ease;
}

.about-cta:hover,
.about-cta:focus-visible {
  color: var(--cyan);
}

#open-about:hover,
#open-about:focus-visible {
  color: #ffbf66;
}

.map-sidebar-footer {
  flex: 0 0 auto;
}

.map-fine-print {
  width: auto;
  margin-left: auto;
  text-align: right;
  text-transform: none;
  letter-spacing: 0;
}

.map-fine-print p {
  margin: 0;
  color: rgba(168, 184, 214, 0.52);
  font-size: 0.46rem;
  line-height: 1.35;
  white-space: nowrap;
}

.map-watermark {
  position: absolute;
  right: 16px;
  bottom: 14px;
  z-index: 1;
  width: min(8.333vw, 8.333vh);
  height: min(8.333vw, 8.333vh);
  object-fit: contain;
  opacity: 0.42;
  pointer-events: none;
}

.about-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(255, 155, 61, 0.35);
  border-radius: 16px;
  background: var(--map-surface-strong);
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65);
}

.about-dialog::backdrop {
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(5px);
}

.about-dialog-content {
  position: relative;
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 26px;
  padding: 34px;
}

.shortcuts-dialog-content {
  position: relative;
  padding: 34px;
}

.shortcuts-dialog-content h2 {
  margin: 0 0 20px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.shortcuts-dialog-content h3 {
  margin: 24px 0 10px;
  color: var(--text);
  font-size: 0.9rem;
}

.shortcut-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.shortcut-list > div {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) 1fr;
  gap: 16px;
  align-items: center;
}

.shortcut-list dt,
.shortcut-list dd {
  margin: 0;
}

.shortcut-list dd,
.shortcut-letters {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

.shortcuts-dialog kbd {
  display: inline-block;
  min-width: 24px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-color: rgba(255, 155, 61, 0.45);
  border-radius: 5px;
  background: rgba(255, 155, 61, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  text-align: center;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.dialog-close:hover,
.dialog-close:focus-visible {
  border-color: var(--orange);
  color: var(--text);
}

.about-logo {
  width: 112px;
  height: 112px;
  object-fit: contain;
}

.about-copy h2 {
  margin: 0 0 18px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.about-copy p:not(.eyebrow) {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.7;
}

.about-copy p:last-child {
  margin-bottom: 0;
  color: var(--cyan);
  font-weight: 700;
}

.inara-link {
  display: inline-flex;
  gap: 8px;
  margin-top: 4px;
  color: var(--orange);
  font-size: 0.85rem;
  font-weight: 700;
}

.inara-link:hover,
.inara-link:focus-visible {
  color: #ffbf66;
}

.map-stage {
  position: relative;
  grid-column: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  container-name: map-stage;
  container-type: inline-size;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-width: 0;
  min-height: 82px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--map-surface);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 2;
}

.map-title-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.deck-selector {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: hidden;
  padding-bottom: 2px;
}

.deck-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.deck-option:hover,
.deck-option:focus-visible {
  border-color: rgba(118, 215, 255, 0.55);
  color: var(--text);
}

.deck-option[hidden] {
  display: none;
}

.deck-option.is-active {
  border-color: var(--orange);
  background: linear-gradient(
    100deg,
    rgba(255, 155, 61, 0.18),
    var(--map-surface-soft)
  );
  color: var(--text);
}

.deck-index {
  color: var(--cyan);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.map-toolbar-actions,
.zoom-controls,
.orientation-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-toolbar-actions {
  flex: 0 0 auto;
  min-width: 0;
}

.orientation-controls {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--map-surface-soft);
}

.orientation-option {
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
}

.orientation-option:hover,
.orientation-option:focus-visible,
.orientation-option.is-active {
  background: rgba(118, 215, 255, 0.13);
  color: var(--text);
}

.zoom-controls {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--map-surface-soft);
}

.zoom-controls button,
.reset-button {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 30px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.zoom-controls button {
  font-size: 1.2rem;
}

.zoom-controls button:hover,
.zoom-controls button:focus-visible,
.reset-button:hover,
.reset-button:focus-visible {
  background: rgba(118, 215, 255, 0.13);
}

.zoom-controls span {
  min-width: 50px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.reset-button {
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.map-viewport {
  --map-width-limit: 84cqw;
  position: relative;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--map-bg);
  container-type: size;
  cursor: grab;
  touch-action: none;
}

.map-viewport.is-dragging {
  cursor: grabbing;
}

.map-grid {
  position: absolute;
  inset: 0;
  opacity: 0.7;
  background-image:
    linear-gradient(rgba(118, 215, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(118, 215, 255, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
}

.map-viewport #map-image {
  --map-aspect-ratio: 0.68832;
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(
    var(--map-width-limit),
    calc(88cqh * var(--map-aspect-ratio)),
    1100px
  );
  height: auto;
  max-height: none;
  aspect-ratio: var(--map-aspect-ratio);
  object-fit: contain;
  transform-origin: center;
  -webkit-user-select: none;
  user-select: none;
  filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.42));
  will-change: transform;
  transition: transform 260ms ease;
}

.map-viewport #map-image.is-landscape {
  width: min(
    88cqh,
    calc(var(--map-width-limit) * var(--map-aspect-ratio)),
    calc(1100px * var(--map-aspect-ratio))
  );
  transform: translate(
      calc(-50% + var(--map-offset-x, 0px)),
      calc(-50% + var(--map-offset-y, 0px))
    )
    scale(var(--map-scale, 1)) rotate(90deg);
}

.map-viewport #map-image svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  user-select: none;
  pointer-events: none;
}

.map-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(255, 155, 61, 0.7);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.map-stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 6px 24px;
  border-top: 1px solid var(--line);
  background: var(--map-surface-strong);
  color: var(--muted);
  font-size: 0.8rem;
  z-index: 2;
}

.map-stage-footer > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

@container map-stage (max-width: 980px) {
  .map-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    padding: 8px 12px;
  }

  .deck-selector {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    overflow-x: hidden;
    padding-bottom: 0;
  }

  .deck-option {
    justify-content: center;
    min-width: 0;
    min-height: 32px;
    padding: 3px 6px;
  }

  .map-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 6px;
    width: 100%;
    justify-content: space-between;
  }

  .orientation-controls,
  .zoom-controls {
    padding: 1px;
  }

  .orientation-option {
    min-height: 26px;
  }

  .zoom-controls button {
    height: 26px;
  }

  .map-toolbar-actions .reset-button {
    width: auto;
    height: 28px;
  }
}

@media (max-width: 720px) {
  .maps-page {
    overflow: hidden;
  }

  .map-app,
  .map-app.is-sidebar-collapsed {
    position: relative;
    display: flex;
    width: 100vw;
    height: 100vh;
    min-height: 0;
  }

  .map-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(360px, calc(100vw - 24px));
    z-index: 3;
  }

  .map-app.is-sidebar-collapsed .map-sidebar {
    width: 24px;
  }

  .map-sidebar-content {
    gap: 8px;
    padding: 8px;
  }

  .map-sidebar-note {
    display: none;
  }

  .about-cta {
    margin-top: 0;
  }

  .map-watermark {
    right: 10px;
    bottom: 10px;
  }

  .about-dialog-content {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 28px 24px 24px;
  }

  .about-logo {
    width: 76px;
    height: 76px;
  }

  .map-stage {
    flex: 1 1 auto;
    margin-left: 24px;
    min-width: 0;
    min-height: 0;
  }

  .map-viewport #map-image {
    --map-width-limit: 92cqw;
  }

  .layer-controls {
    padding: 0;
  }

  .layer-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layer-children {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layer-subgroup .layer-children {
    grid-template-columns: 1fr;
  }

  .map-stage-footer {
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
  }

  .map-fine-print {
    max-width: 52%;
    white-space: normal;
  }

  .map-fine-print p {
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .deck-option {
    gap: 0;
    padding: 2px 3px;
    line-height: 1.05;
    white-space: normal;
  }

  .deck-index {
    display: none;
  }

  .orientation-option {
    padding: 0 5px;
  }

  .zoom-controls button {
    min-width: 26px;
  }

  .zoom-controls span {
    min-width: 40px;
  }

  .reset-button {
    padding: 0 6px;
  }
}

@media (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero,
  .mission-grid,
  .tool-grid,
  .map-browser-layout {
    grid-template-columns: 1fr 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-top: 48px;
  }

  .tool-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mission-grid {
    grid-template-columns: 1fr;
  }

  .map-browser-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 18px, 1200px);
  }

  .topbar {
    padding: 16px 18px;
  }

  .brand-name {
    letter-spacing: 0.08em;
    font-size: 0.8rem;
  }

  .main-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 16px;
  }

  .btn {
    width: 100%;
  }

  .cta-row {
    flex-direction: column;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .map-canvas {
    min-height: 300px;
    padding: 12px;
  }

  .map-viewer-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .cta-band,
  .site-footer {
    flex-direction: column;
    text-align: center;
  }

  .visual-frame {
    min-height: 440px;
  }
}
