:root {
  /* Global primary color — Mars-red tint */
  --primary: #e2643f;
  --primary-rgb: 226, 100, 63;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  margin: 0;
  height: 100%;
  width: 100%;
}

body {
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  background: #000007;
  color: #eaf2ff;
  overflow: hidden;
}

/* Form controls don't inherit font by default — make the font truly everywhere. */
button,
input,
select,
textarea {
  font-family: inherit;
}
.home {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(var(--primary-rgb), 0.18), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, rgba(var(--primary-rgb), 0.1), transparent 55%),
    #07060a;
  color: #ece6e3;
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
}

/* Brand (title + motto, top-left) and nav (top-right) reuse the Explore-page
   classes for identical placement; fixed so they stay put while the page scrolls.
   line-height is reset to `normal` so the title matches Explore exactly (the
   page's 1.6 line-height would otherwise shift it). */
.home .title,
.home .explore-nav {
  position: fixed;
}
.home .title {
  line-height: normal;
}

/* ---- Nav (shared) — plain text links, underlined when active ---- */
.nav {
  display: flex;
  gap: 18px;
}
.nav__link {
  appearance: none;
  border: none;
  background: none;
  padding: 2px 0;
  color: #cbd3df;
  font-size: 14px;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: color 0.15s;
}
.nav__link:hover {
  color: #fff;
}
.nav__link--active {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
}

/* Mobile hamburger menu */
.nav--mobile {
  position: relative;
}
.nav__toggle {
  appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  background: rgba(40, 16, 10, 0.55);
  color: var(--primary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.nav__menu {
  position: absolute;
  top: 48px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(20, 10, 8, 0.92);
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 20;
}
.nav__menu .nav__link {
  width: 120px;
  text-align: center;
}

/* ---- Hero ---- */
.home__hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 200px 28px 40px; /* clears the fixed title + 50px lower */
  text-align: center;
}
.home__hero h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 60px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.5px;
}
.accent {
  color: var(--primary);
  text-shadow: 0 0 28px rgba(var(--primary-rgb), 0.55);
}
.home__lead {
  margin: 18px auto 28px;
  max-width: 640px;
  font-size: 16px;
  color: #c6bdb8;
}
.home__cta {
  appearance: none;
  border: none;
  background: var(--primary);
  color: #1a0c06;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 26px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(var(--primary-rgb), 0.45);
  transition: transform 0.08s, box-shadow 0.15s;
}
.home__cta:hover {
  box-shadow: 0 10px 38px rgba(var(--primary-rgb), 0.6);
}
.home__cta:active {
  transform: scale(0.97);
}
.home__note {
  font-size: 13px;
  color: #9b938e;
}

/* ---- Content ---- */
.home__content {
  max-width: 820px;
  margin: 0 auto;
  padding: 20px 28px 80px;
}
.home__section {
  padding: 26px 0;
  border-top: 1px solid rgba(var(--primary-rgb), 0.07);
}
.home__section h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 12px;
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 600;
}
.home__num {
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  font-size: 0.7em;
  opacity: 0.9;
}
.home__intro {
  margin: 0 0 12px;
  color: #c6bdb8;
}
.home__group {
  margin: 14px 0;
}
.home__group h3 {
  margin: 0 0 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  opacity: 0.85;
}
.home__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}
.home__list li {
  position: relative;
  padding-left: 20px;
  color: #ddd4cf;
}
.home__list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.6);
}
.home__conclusion {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-left: 3px solid var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
  border-radius: 0 10px 10px 0;
  color: #f1e9e5;
}
.home__conclusion-tag {
  display: inline-block;
  margin-right: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
}

/* ---- Chain schema (connected nodes) ---- */
.schema {
  position: relative;
  list-style: none;
  margin: 6px 0 22px;
  padding: 0;
  display: grid;
  gap: 14px;
}
/* the connecting line running through the node centres */
.schema::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(
    180deg,
    rgba(var(--primary-rgb), 0.6),
    rgba(var(--primary-rgb), 0.15)
  );
}
.schema__node {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}
.schema__num {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  background: #120a08;
  border: 1px solid rgba(var(--primary-rgb), 0.45);
  box-shadow: 0 0 14px rgba(var(--primary-rgb), 0.3);
}
.schema__label {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(var(--primary-rgb), 0.06);
  border: 1px solid rgba(var(--primary-rgb), 0.12);
  font-size: 14px;
  color: #e9e1dd;
}
/* highlight the end goal */
.schema__node:last-child .schema__num {
  color: #1a0c06;
  background: var(--primary);
  box-shadow: 0 0 18px rgba(var(--primary-rgb), 0.55);
}

/* ---- Roadmap flow ---- */
.home__flow {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 10px;
}
.home__flow li {
  position: relative;
  padding: 12px 16px;
  background: rgba(var(--primary-rgb), 0.07);
  border: 1px solid rgba(var(--primary-rgb), 0.11);
  border-radius: 10px;
  font-weight: 500;
}
.home__flow li:not(:last-child)::after {
  content: '↓';
  position: absolute;
  left: 50%;
  bottom: -13px;
  transform: translateX(-50%);
  color: var(--primary);
  font-size: 12px;
}

/* ---- Settings ---- */
.settings {
  display: grid;
  gap: 14px;
  max-width: 560px;
}
.settings__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(var(--primary-rgb), 0.05);
  border: 1px solid rgba(var(--primary-rgb), 0.12);
}
.settings__text h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}
.settings__text p {
  margin: 0;
  font-size: 13px;
  color: #c6bdb8;
}

/* ---- Blog list ---- */
.blog__list {
  display: grid;
  gap: 16px;
}
.blog__card {
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(var(--primary-rgb), 0.05);
  border: 1px solid rgba(var(--primary-rgb), 0.12);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.blog__card:hover {
  border-color: rgba(var(--primary-rgb), 0.3);
  background: rgba(var(--primary-rgb), 0.09);
}
.blog__card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.blog__card-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}
.blog__excerpt {
  margin: 8px 0 12px;
  color: #c6bdb8;
}
.blog__read {
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}

/* ---- Blog two-column layout + NASA news widget ---- */
.home__content--blog {
  max-width: 1140px;
}
.blog__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: start;
}
.news {
  position: sticky;
  top: 20px;
  padding: 14px 14px 10px;
  border-radius: 14px;
  background: rgba(var(--primary-rgb), 0.05);
  border: 1px solid rgba(var(--primary-rgb), 0.12);
}
.news__title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--primary);
}
.news__state {
  font-size: 12px;
  line-height: 1.5;
  color: #c6bdb8;
  padding: 4px 0 10px;
}
.news__item {
  display: flex;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid rgba(var(--primary-rgb), 0.1);
  text-decoration: none;
  color: inherit;
  /* it's a <button> now — strip native chrome */
  width: 100%;
  text-align: left;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  font: inherit;
  cursor: pointer;
}
.news__item:first-of-type {
  border-top: none;
}
.news__thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}
.news__thumb--blank {
  display: grid;
  place-items: center;
  font-size: 22px;
}
.news__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.news__headline {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  color: #ece6e2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s;
}
.news__info {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
  color: #b0a7a2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news__item:hover .news__headline {
  color: var(--primary);
}
.news__more {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}
.news__more:hover {
  text-decoration: underline;
}

/* ---- NASA news modal ---- */
.news-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 4, 3, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: news-fade 0.15s ease;
}
@keyframes news-fade {
  from {
    opacity: 0;
  }
}
.news-modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 70vw;
  height: 90vh;
  max-width: 70vw;
  max-height: 90vh;
  border-radius: 16px;
  background: rgba(24, 12, 9, 0.96);
  border: 1px solid rgba(var(--primary-rgb), 0.18);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.news-modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(var(--primary-rgb), 0.25);
  background: rgba(0, 0, 0, 0.45);
  color: #f3e6e1;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.news-modal__close:hover {
  background: rgba(var(--primary-rgb), 0.3);
}
.news-modal__frame {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  background: #fff;
}
.news-modal__loading {
  flex: 1;
  display: grid;
  place-items: center;
  color: #c6bdb8;
  font-size: 14px;
}
.news-modal__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 36px 24px;
  color: #e8ded9;
  line-height: 1.65;
}
.news-modal__hero {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 18px;
}
.news-modal__title {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.2;
  color: #fff;
}
.news-modal__date {
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 18px;
}
.news-modal__content {
  font-size: 15px;
}
.news-modal__content :is(p, ul, ol) {
  margin: 0 0 14px;
}
.news-modal__content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 10px 0;
}
.news-modal__content a {
  color: var(--primary);
}
.news-modal__content h2,
.news-modal__content h3 {
  color: #fff;
  margin: 22px 0 8px;
}
.news-modal__footer {
  flex: 0 0 auto;
  padding: 14px 24px;
  border-top: 1px solid rgba(var(--primary-rgb), 0.15);
  background: rgba(0, 0, 0, 0.25);
  text-align: center;
}
.news-modal__cta {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
}
.news-modal__cta:hover {
  filter: brightness(1.08);
}
@media (max-width: 768px) {
  .news-modal__panel {
    width: 94vw;
    height: 92vh;
    max-width: 94vw;
  }
  .news-modal__scroll {
    padding: 24px 18px 18px;
  }
  .news-modal__title {
    font-size: 21px;
  }
}

/* ---- Blog post ---- */
.blog__post {
  padding-top: 150px;
}
.blog__back {
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 18px;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
}
.blog__post-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.blog__post-head h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 600;
}
.blog__post-intro {
  margin: 0 0 8px;
  font-size: 17px;
  color: #d8cfca;
}
.blog__section {
  padding: 14px 0;
  border-top: 1px solid rgba(var(--primary-rgb), 0.07);
}
.blog__section h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}
.blog__section p {
  margin: 0;
  color: #ddd4cf;
}
.blog__cta {
  appearance: none;
  border: none;
  margin-top: 22px;
  background: var(--primary);
  color: #1a0c06;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 22px;
  border-radius: 999px;
  cursor: pointer;
}

/* anchor targets clear the fixed title/nav when jumped to */
.home__hero,
.home__content,
.home__roadmap {
  scroll-margin-top: 96px;
}

/* ---- Footer ---- */
.home__footer {
  margin-top: 40px;
  padding: 48px 28px 28px;
  border-top: 1px solid rgba(var(--primary-rgb), 0.12);
  background: rgba(7, 6, 10, 0.6);
  color: #b7afa9;
  font-size: 13px;
}
.home__footer-grid {
  max-width: 940px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.4fr;
  gap: 28px;
}
.home__footer-name {
  font-size: 18px;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: 0.4px;
}
.home__footer-tag {
  margin: 8px 0 0;
  color: var(--primary);
  font-size: 12px;
  opacity: 0.85;
}
.home__footer-about {
  margin: 10px 0 0;
  max-width: 320px;
  line-height: 1.5;
}
.home__footer-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.home__footer-col h4 {
  margin: 0 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #ece6e3;
}
.home__footer-col a,
.home__footer-col button {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  color: #b7afa9;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}
.home__footer-col a:hover,
.home__footer-col button:hover {
  color: var(--primary);
}
.home__footer-bottom {
  max-width: 940px;
  margin: 32px auto 0;
  padding-top: 18px;
  border-top: 1px solid rgba(var(--primary-rgb), 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: #837c77;
}

@media (max-width: 768px) {
  .home__footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  .home__footer-brand {
    grid-column: 1 / -1;
  }
  .home__footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  /* Blog news widget drops below the article list */
  .blog__layout {
    grid-template-columns: 1fr;
  }
  .news {
    position: static;
  }
}
.app {
  position: fixed;
  inset: 0;
  background: #000007;
  overflow: hidden;
}

.app canvas {
  display: block;
  touch-action: none; /* let OrbitControls own trackpad/touch gestures */
}

/* HUD overlay. Desktop: transparent pass-through; children keep absolute
   positions and re-enable pointer events. (Mobile turns it into a stack below.) */
.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.explore-nav,
.objects,
.hud {
  pointer-events: auto;
}

/* ---- Title ---- */
.title {
  position: absolute;
  top: 24px;
  left: 28px;
  color: #eaf2ff;
  pointer-events: none;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
}
/* Page nav — top-right corner (matches the Home page) */
.explore-nav {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 10;
}
.title h1 {
  margin: 0;
  font-size: 44px;
  font-weight: 300;
  line-height: 1; /* drop the large heading's leading so its cap-top lines up
                     with the nav links at the same top offset */
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.6),
    0 0 36px rgba(255, 255, 255, 0.35),
    0 0 60px rgba(var(--primary-rgb), 0.25);
}
/* Brand title is a clickable link (unstyled button inheriting the heading). */
.title__brand {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto; /* .title sets pointer-events:none for canvas drags */
  letter-spacing: inherit;
  transition: color 0.15s, text-shadow 0.15s;
}
.title__brand:hover {
  color: #fff;
}

/* DEMO badge (the pill keeps its orange outline; tooltip is the reusable one) */
.demo-badge {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 12px;
}
.demo-tag {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  color: var(--primary);
  /* match the widget bodies' brightness/material (glassy, full-opacity) */
  background: rgba(40, 16, 10, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.5px;
  cursor: help;
  text-shadow: 0 0 10px rgba(var(--primary-rgb), 0.7);
  box-shadow: 0 0 14px rgba(var(--primary-rgb), 0.45),
    inset 0 0 10px rgba(var(--primary-rgb), 0.25);
}

/* ---- Reusable Tooltip (components/Tooltip.jsx) — plain, borderless popover ---- */
.tip {
  position: relative;
  display: inline-flex;
  pointer-events: auto; /* hoverable even inside pointer-events:none parents */
  outline: none;
}
.tip__pop {
  position: absolute;
  top: calc(100% + 8px);
  width: 220px;
  max-width: 80vw;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(24, 12, 9, 0.55);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: #f3e6e1;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.1px;
  text-align: left;
  text-transform: none;
  text-shadow: none;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 90;
}
.tip__pop--left {
  left: 0;
}
.tip__pop--center {
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
}
.tip__pop--wide {
  width: 340px;
}
.tip:hover .tip__pop,
.tip:focus-within .tip__pop {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.tip:hover .tip__pop--center,
.tip:focus-within .tip__pop--center {
  transform: translateX(-50%) translateY(0);
}
.tip__pop p {
  margin: 0;
}
.tip__title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}
.tip__h {
  display: block;
  margin-top: 12px;
  margin-bottom: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--primary);
}
.tip__cta {
  display: block;
  margin-top: 14px;
  color: #ffd9cb;
}
.tip__cta strong {
  color: #fff;
}
.title p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--primary);
  text-shadow: 0 0 10px rgba(var(--primary-rgb), 0.8),
    0 0 22px rgba(var(--primary-rgb), 0.5);
}
.sound-toggle {
  margin-top: 14px;
  pointer-events: auto; /* re-enable inside the pointer-events:none header */
}

/* ---- Shared HUD ---- */
.hud {
  position: absolute;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #f3e6e1;
  user-select: none;
}
.hud--bottom-left {
  left: 24px;
  align-items: flex-start;
}
.hud--bottom-right {
  right: 24px;
  align-items: center;
}
/* Lay a HUD cluster out horizontally: speed buttons + clock (bottom-left),
   map controls + grid buttons (bottom-right). */
.hud--row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.speed-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.map-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.hud--top-center {
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  bottom: auto;
  align-items: center;
  /* transform makes this a stacking context — lift the whole cluster (incl. the
     mode tooltips) above the focus-label and the rest of the HUD. */
  z-index: 80;
}

/* Prominent mode buttons (same look as the rest), ~20% smaller */
.btn-group--modes .btn {
  font-size: 10px;
  padding: 8px 14px;
  letter-spacing: 0.3px;
}


/* Focus / mode status chip under the mode buttons */
.focus-label {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--primary);
  background: rgba(40, 16, 10, 0.42);
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  padding: 5px 12px;
  border-radius: 999px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: none;
  white-space: nowrap;
}

.hud__label {
  font-size: 11px;
  letter-spacing: 0.4px;
  opacity: 0.6;
}

.clock {
  font-family: 'Space Grotesk', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  opacity: 0.85;
  background: rgba(40, 16, 10, 0.42);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---- Buttons ---- */
.btn {
  appearance: none;
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  background: rgba(40, 16, 10, 0.42);
  color: #f3e6e1;
  font-size: 8.5px;
  line-height: 1;
  padding: 6px 7px;
  border-radius: 6px;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 0 30px rgba(var(--primary-rgb), 0.06);
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover {
  background: rgba(var(--primary-rgb), 0.18);
  border-color: rgba(var(--primary-rgb), 0.125);
}
.btn:active {
  transform: scale(0.94);
}
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn:disabled:hover {
  background: rgba(40, 16, 10, 0.42);
  border-color: rgba(var(--primary-rgb), 0.125);
}
.btn--active {
  background: rgba(var(--primary-rgb), 0.38);
  border-color: rgba(var(--primary-rgb), 0.125);
  color: #fff;
  box-shadow: 0 0 14px rgba(var(--primary-rgb), 0.25);
}

.btn-group {
  display: flex;
  gap: 5px;
}
.btn-group--zoom .btn {
  width: 26px;
  font-size: 11px;
}
.btn-group--grids {
  flex-direction: column;
  width: 58px;
}
.btn-group--grids .btn {
  width: 100%;
  font-size: 7px;
  text-align: left;
}

/* ---- Pan pad (bottom-right) ---- */
.pad {
  display: grid;
  grid-template-columns: repeat(3, 24px);
  grid-template-rows: repeat(3, 24px);
  gap: 4px;
}
.pad .btn {
  padding: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 7px;
}
.pad__up { grid-area: 1 / 2; }
.pad__left { grid-area: 2 / 1; }
.pad__home { grid-area: 2 / 2; }
.pad__right { grid-area: 2 / 3; }
.pad__down { grid-area: 3 / 2; }

/* ---- Objects list (left, below the title/sound toggle) ---- */
/* Left column: search list + Ask Me messenger, stacked. Sits below the title;
   z-index keeps it above the bottom-left timing controls. */
.left-stack {
  position: absolute;
  top: 126px; /* below the title + motto */
  left: 24px;
  width: 278px; /* ~20% wider */
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20;
  pointer-events: none; /* gaps let canvas drags through */
}
.left-stack > * {
  pointer-events: auto;
}
.objects {
  /* the list scrolls; leave room below for the Ask bar */
  max-height: calc(100vh - 260px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(40, 16, 10, 0.42);
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #f3e6e1;
}
.objects__bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.objects__panel-toggle {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary);
  font-size: 11px;
  cursor: pointer;
}
.objects__panel-toggle:hover {
  background: rgba(var(--primary-rgb), 0.2);
}
.objects__search {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  border-radius: 8px;
  padding: 7px 10px;
  color: #f3e6e1;
  font-size: 12px;
  outline: none;
}
.objects__search::placeholder {
  color: rgba(243, 230, 225, 0.5);
}
.objects__search:focus {
  border-color: rgba(var(--primary-rgb), 0.125);
}
.objects__list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.objects__group {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}
.objects__header {
  display: flex;
  align-items: center;
}
.objects__caret {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: 10px;
  width: 18px;
  padding: 4px 0;
  border-radius: 6px;
}
.objects__caret:hover {
  background: rgba(var(--primary-rgb), 0.15);
}
.objects__planet {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 4px 6px;
  border-radius: 6px;
}
.objects__planet:hover {
  background: rgba(var(--primary-rgb), 0.15);
}
.objects__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: #e9dfda;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
}
.objects__item:hover {
  background: rgba(var(--primary-rgb), 0.14);
}
.objects__item--active {
  background: rgba(var(--primary-rgb), 0.3);
  color: #fff;
}
.objects__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.objects__dot--station {
  background: #e2643f;
}
.objects__dot--sat {
  background: #1fdcb4;
}
.objects__dot--cargo {
  background: #3aa0ff;
}
.objects__dot--asteroid {
  background: #9aa6b3;
}

/* ---- Ask Me messenger (below the search list) ---- */
.ask {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: rgba(40, 16, 10, 0.42);
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #f3e6e1;
  overflow: hidden;
}
.ask__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}
.ask__toggle {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary);
  font-size: 11px;
  cursor: pointer;
}
.ask__toggle:hover {
  background: rgba(var(--primary-rgb), 0.2);
}
.ask__messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 38vh;
  overflow-y: auto;
  padding: 4px 2px;
}
.ask__msg {
  max-width: 85%;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}
.ask__msg--bot {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.3);
  border-bottom-left-radius: 4px;
}
.ask__msg--user {
  align-self: flex-end;
  background: rgba(var(--primary-rgb), 0.28);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ask__form {
  display: flex;
  gap: 8px;
}
.ask__input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  border-radius: 8px;
  padding: 7px 10px;
  color: #f3e6e1;
  font-size: 12px;
  outline: none;
}
.ask__input::placeholder {
  color: rgba(243, 230, 225, 0.5);
}
.ask__send {
  flex: 0 0 auto;
  width: 34px;
  border-radius: 8px;
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  background: rgba(var(--primary-rgb), 0.14);
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
}
.ask__send:hover {
  background: rgba(var(--primary-rgb), 0.28);
}
.objects__empty {
  font-size: 12px;
  opacity: 0.6;
  padding: 6px;
}

/* ---- Top-right panel stack (mission + selected-object widget) ---- */
.panel-stack {
  position: absolute;
  top: 80px; /* clear the top-right nav (+20px lower) */
  right: 24px;
  width: 330px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 20; /* keep the details widget above the map controls (bottom HUD) */
  pointer-events: none; /* gaps let canvas drags through */
}
.panel-stack > * {
  pointer-events: auto;
}

/* ---- Info widget ---- */
.widget {
  width: 100%;
  padding: 18px 20px 16px;
  border-radius: 16px;
  background: rgba(40, 16, 10, 0.42);
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5),
    inset 0 0 40px rgba(var(--primary-rgb), 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #f3e6e1;
  font-size: 13px;
  line-height: 1.5;
}
.widget__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: rgba(var(--primary-rgb), 0.18);
  color: var(--primary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.widget__close:hover {
  background: rgba(var(--primary-rgb), 0.35);
}
.widget__title {
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}
.widget__sub {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  opacity: 0.7;
}

/* Collapsible header for object detail widgets */
.widget__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0 26px 0 0; /* clear the close button */
}
.widget__headtext {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.widget__headtext .widget__title {
  margin: 0;
}
.widget__headtext .widget__sub {
  margin: 0;
}
.widget__chevron {
  flex: 0 0 auto;
  margin-top: 4px;
  color: var(--primary);
  font-size: 12px;
}
.widget__body {
  margin-top: 14px;
}
.widget__image {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
  margin: 0 0 14px;
  border: 1px solid rgba(var(--primary-rgb), 0.125);
}
.widget p {
  margin: 0 0 10px;
}
.widget strong {
  color: var(--primary);
  font-weight: 600;
}
.widget__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(var(--primary-rgb), 0.1);
}

.widget__params {
  margin: 12px 0 0;
  display: grid;
  gap: 5px;
  font-size: 12px;
}
.widget__params > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 5px;
  border-bottom: 1px dashed rgba(var(--primary-rgb), 0.09);
}
.widget__params > div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.widget__params dt {
  opacity: 0.7;
}
.widget__params dd {
  margin: 0;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* ---- Toggle switch ---- */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  padding: 0;
  transition: background 0.18s, border-color 0.18s;
}
.toggle--on {
  background: rgba(var(--primary-rgb), 0.85);
  border-color: rgba(var(--primary-rgb), 0.125);
}
.toggle__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
}
.toggle--on .toggle__knob {
  transform: translateX(20px);
}

/* Satellite widget: reuse .widget but in the green-teal accent by locally
   overriding the primary custom properties (border / title / toggle / strong
   all read from them). Placed last so its background wins over .widget. */
.widget--sat {
  --primary: #1fdcb4;
  --primary-rgb: 31, 220, 180;
  background: rgba(8, 34, 28, 0.46);
}
/* Transfer ships (cargo / passenger) — `--primary`/-rgb are set inline per ship
   (its own colour), so the whole panel re-skins; only the backdrop is fixed. */
.widget--transfer {
  background: rgba(10, 18, 34, 0.5);
}
/* Asteroid (16 Psyche) — metallic blue-grey theme. */
.widget--asteroid {
  --primary: #9aa6b3;
  --primary-rgb: 154, 166, 179;
  background: rgba(20, 24, 30, 0.55);
}

/* ---- Mission panel (collapsible) ---- */
.mission {
  padding: 0;
  overflow: hidden;
}
.mission__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 18px 16px;
  color: inherit;
}
.mission__headtext {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mission .widget__title {
  font-size: 12.5px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.mission .widget__sub {
  margin: 0;
  text-transform: none;
  font-size: 12px;
  letter-spacing: 0.2px;
  opacity: 0.8;
}
.mission__chevron {
  color: var(--primary);
  font-size: 12px;
  flex: 0 0 auto;
}
.mission__body {
  padding: 0 16px 16px;
  display: grid;
  gap: 14px;
}
.mission__h {
  margin: 14px 0 12px;
  font-size: 12.5px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
}
.mission__nodes {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.mission__nodes li {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-left: 16px;
  color: #ece3de;
}
.mission__nodes li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.mission__more {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.mission__more:hover {
  text-decoration: underline;
}
.mission__tech {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.mission__tech li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tag {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag--invented {
  color: #5fe39a;
  background: rgba(95, 227, 154, 0.14);
}
.tag--lab {
  color: #f2c44d;
  background: rgba(242, 196, 77, 0.14);
}
.tag--todo {
  color: #ef7d5a;
  background: rgba(239, 125, 90, 0.16);
}

/* ====================  MOBILE EXPLORE LAYOUT  ==================== */
@media (max-width: 768px) {
  /* The 3D canvas stays a fixed background; the HUD becomes a scrollable,
     vertically-stacked control panel laid out in DOM order:
     top line → mission → search → modes → bottom controls. */
  .overlay {
    position: fixed;
    inset: 0;
    pointer-events: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
  }

  /* Top line: title + motto (left), menu (right) */
  .overlay__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }
  .overlay .title {
    position: static;
    pointer-events: auto;
  }
  .overlay .title h1 {
    font-size: 24px;
  }
  .overlay .title p {
    font-size: 11px;
  }
  .overlay .explore-nav {
    position: static;
    flex: 0 0 auto;
  }

  /* Stacked panels flow full-width */
  .overlay .panel-stack {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
  }
  .overlay .left-stack {
    position: static;
    width: 100%;
  }
  .overlay .objects {
    max-height: 46vh;
  }

  /* Control groups flow inline (no fixed corners) */
  .overlay .hud {
    position: static;
    bottom: auto;
    transform: none;
  }
  .overlay .hud--top-center {
    top: auto;
    left: auto;
    align-items: flex-start;
  }
  .overlay .hud--bottom-left {
    left: auto;
  }
  .overlay .hud--bottom-right {
    right: auto;
    align-items: flex-start;
  }
  .overlay .btn-group {
    flex-wrap: wrap;
  }
  .overlay .focus-label {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    align-self: flex-start;
  }

  /* A selected object's widget becomes a centered modal over everything */
  .overlay .widget:not(.mission) {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  }
}

/* ---- Feedback widget (fixed, right edge, vertically centred) ---- */
.feedback {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  width: 134px;
  padding: 14px 12px;
  border-radius: 14px;
  text-align: center;
  background: rgba(40, 16, 10, 0.5);
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #f3e6e1;
}
.feedback__q {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.4;
}
.feedback__btns {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.feedback__btns button {
  appearance: none;
  width: 42px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(var(--primary-rgb), 0.125);
  background: rgba(var(--primary-rgb), 0.08);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.feedback__btns button:hover {
  background: rgba(var(--primary-rgb), 0.2);
}
.feedback__btns button:active {
  transform: scale(0.92);
}
.feedback__thanks {
  margin: 0;
  font-size: 12px;
  color: var(--primary);
}
