@import url("./tokens.css");

* {
  box-sizing: border-box
}

html {
  color-scheme: dark;
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  background: radial-gradient(1200px 700px at 50% 45%, rgba(255, 255, 255, .05), transparent 60%), var(--bg0);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow: hidden;
}

/* Header */
header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbarH);
  z-index: 30;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(10, 15, 31, .55), rgba(10, 15, 31, .10));
  border-bottom: 1px solid rgba(241, 245, 249, .08);
}

.nav {
  height: 100%;
  padding: 12px clamp(14px, 2.8vw, 34px);
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--fg);
  min-width: 260px;
}

.brand strong {
  display: block;
  letter-spacing: .04em
}

.brand span {
  display: block;
  font-size: .84rem;
  color: rgba(241, 245, 249, .60);
  margin-top: 2px
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(241, 245, 249, .10);
  background: rgba(0, 0, 0, .22);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

/* Header brand logo (global) — bigger, no orbit ring */
.logo--big {
  width: 132px;
  height: 132px;
  border-radius: 999px;
}

.logo--big img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  display: block;
}

.brandSub {
  opacity: .72;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  font-size: .72em;
  margin-left: 6px;
}

.logoOrbit {
  position: absolute;
  inset: -60%;
  border-radius: 999px;
  border: 1px solid rgba(111, 231, 210, .22);
  animation: logoOrbit 5.5s linear infinite;
}

@keyframes logoOrbit {
  to {
    transform: rotate(-360deg)
  }
}

html.rm .logoOrbit {
  animation: none
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: 4px;
}

.navlinks a {
  color: rgba(241, 245, 249, .70);
  text-decoration: none;
  letter-spacing: .12em;
  font-size: .78rem;
  text-transform: uppercase;
}

.navlinks a:hover {
  color: rgba(241, 245, 249, .92)
}

.cta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.kbd {
  color: rgba(241, 245, 249, .55);
  font-size: .78rem;
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(0, 0, 0, .18);
  padding: 8px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.kbd strong {
  color: rgba(241, 245, 249, .92)
}

.btn {
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(241, 245, 249, .06);
  color: rgba(241, 245, 249, .92);
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: .86rem;
  letter-spacing: .02em;
  transition: transform .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(241, 245, 249, .08);
  border-color: rgba(241, 245, 249, .18)
}

.btn:active {
  transform: translateY(0)
}

.btn.primary {
  border-color: rgba(111, 231, 210, .28);
  background: rgba(111, 231, 210, .10);
}

.btn.primary:hover {
  border-color: rgba(111, 231, 210, .40);
  background: rgba(111, 231, 210, .14)
}

.btn:focus-visible {
  outline: 2px solid rgba(241, 245, 249, .22);
  outline-offset: 3px;
}

/* Stage */
#stage {
  position: relative;
  height: 100%;
  padding-top: var(--topbarH);
}

#stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#universe {
  position: absolute;
  inset: var(--topbarH) 0 0 0;
  z-index: 1;
  overflow: hidden;
}

/* Hero */
#hero {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  z-index: 6;
  /* must be above #map so Hero UI is clickable */
  width: min(980px, calc(100% - 2*clamp(14px, 2.8vw, 34px)));
  border-radius: 26px;
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(0, 0, 0, .26);
  box-shadow: 0 16px 60px rgba(0, 0, 0, .40);
  padding: 24px 22px 26px;
  backdrop-filter: blur(10px);
  transition: opacity .42s ease, transform .42s ease, filter .42s ease;

  /* Prevent cutoff when the "What each planet unlocks" details expand.
     The universe stage uses overflow hidden, so the panel must scroll internally. */
  max-height: min(76vh, calc(100vh - var(--topbarH) - 24px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(111, 231, 210, .35) transparent;
}

#hero::-webkit-scrollbar {
  width: 10px;
}

#hero::-webkit-scrollbar-thumb {
  background: rgba(111, 231, 210, .22);
  border-radius: 999px;
  border: 3px solid rgba(0, 0, 0, 0);
  background-clip: padding-box;
}

#hero::-webkit-scrollbar-track {
  background: transparent;
}

/* Accent highlights inside the story panel (design-only, no wording changes) */
#hero .lead strong,
#hero details summary strong,
#hero .label strong {
  color: var(--logo333);
  text-shadow: 0 0 18px rgba(111, 231, 210, .22);
}

#hero.isHidden {
  opacity: 0;
  filter: blur(2px);
  pointer-events: none;
  transform: translate(-50%, -50%) translateY(-10px) scale(.985);
}

/* Hero can be dismissed to reveal the planets */
#hero.hero--hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) translateY(-10px) scale(.985);
  transition: opacity .35s ease, transform .35s ease;
}

#hero {
  transition: opacity .35s ease, transform .35s ease;
}

.pulse {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: rgba(241, 245, 249, .75);
  font-size: .86rem;
  letter-spacing: .06em;
}

.pulse .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--logo333);
  box-shadow: 0 0 18px rgba(111, 231, 210, .25);
}

.heroTitle {
  margin-top: 10px;
  text-align: center;
}

.heroTitle .line1 {
  font-size: clamp(18px, 2.2vw, 26px);
  color: rgba(241, 245, 249, .78);
  letter-spacing: .04em;
}

.heroTitle .line2 {
  margin-top: 6px;
  font-size: clamp(34px, 5.2vw, 64px);
  font-weight: 760;
  letter-spacing: .05em;
}

.lead {
  margin: 10px auto 0;
  text-align: center;
  color: rgba(241, 245, 249, .78);
  line-height: 1.55;
  max-width: 74ch;
  font-size: 1.02rem;
}

.hero-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Map + planets */
#map {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.mapAnchor {
  position: absolute;
  top: 10%;
  left: 0;
  width: 1px;
  height: 1px;
}

.planet {
  position: absolute;
  left: 50%;
  top: 55%;
  width: var(--planetSize);
  height: var(--planetSize);
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(0, 0, 0, .16);
  border: 1px solid rgba(241, 245, 249, .12);
  cursor: pointer;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .42);
  transition: transform .22s var(--ease), border-color .22s var(--ease), filter .22s var(--ease);
  will-change: transform, left, top;
  perspective: 900px;
}

.planet:hover {
  border-color: rgba(241, 245, 249, .22);
  filter: brightness(1.05);
}

.planet:focus-visible {
  outline: 2px solid rgba(241, 245, 249, .22);
  outline-offset: 4px;
}

.planet .halo {
  position: absolute;
  inset: -22px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, rgba(var(--glow-rgb), .14), transparent 60%);
  filter: blur(2px);
  opacity: .85;
  pointer-events: none;
}

.planet .sphere {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .22), transparent 38%),
    radial-gradient(circle at 70% 70%, rgba(0, 0, 0, .28), transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(var(--glow-rgb), .10), rgba(0, 0, 0, .12) 60%, rgba(0, 0, 0, .20));
  box-shadow: inset 0 0 0 1px rgba(241, 245, 249, .08), inset 0 0 28px rgba(255, 255, 255, .06);
  pointer-events: none;
  z-index: 2;
}

.orbitPath {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--planetSize) * 1.45);
  height: calc(var(--planetSize) * .42);
  transform: translate(-50%, -50%) rotateZ(-14deg) rotateX(68deg);
  border-radius: 999px;
  border: var(--beltStroke) solid rgba(241, 245, 249, calc(var(--beltOpacity) * 0.95));
  pointer-events: none;
  opacity: .95;
  z-index: 1;
  /* behind sphere */
}

/* Front arc overlay (brighter) to fake 3D depth */
.orbitPath::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 999px;
  border: var(--beltStroke) solid rgba(241, 245, 249, calc(var(--beltOpacity) * 1.65));
  clip-path: inset(50% 0 0 0 round 999px);
  /* bottom half = "front" */
  z-index: 3;
}

/* Single orbit dot */
.orbitDot {
  position: absolute;
  width: var(--orbitDot);
  height: var(--orbitDot);
  border-radius: 999px;
  background: var(--logo333);
  box-shadow: 0 0 var(--orbitGlow) rgba(111, 231, 210, .24);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  /* JS toggles front/back */
}

/* remove legacy two-dot styling if present */
.orbitDotFront,
.orbitDotBack {
  display: none !important;
}

.orbitDotFront,
.orbitDotBack {
  position: absolute;
  width: var(--orbitDot);
  height: var(--orbitDot);
  border-radius: 999px;
  background: var(--logo333);
  box-shadow: 0 0 var(--orbitGlow) rgba(111, 231, 210, .24);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* Dots are positioned by JS per planet; keep back dimmer */
.orbitDotBack {
  opacity: .55;
  filter: blur(.2px);
}

.label {
  position: absolute;
  left: 50%;
  top: calc(100% + 12px);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}

.planet:hover .label,
.planet.isHot .label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.label strong {
  display: block;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: .78rem;
}

.label span {
  display: block;
  margin-top: 4px;
  font-size: .82rem;
  color: rgba(241, 245, 249, .60);
}

/* Soul + Teleport FX */
#soul {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(900px 560px at 50% 35%, rgba(111, 231, 210, .10), transparent 60%),
    radial-gradient(820px 520px at 40% 70%, rgba(30, 144, 255, .06), transparent 60%),
    radial-gradient(820px 520px at 70% 60%, rgba(120, 60, 220, .05), transparent 60%);
  filter: blur(18px);
  opacity: .55;
  z-index: 1;
  pointer-events: none;
}

#teleport {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s var(--ease);
}

#teleport.on {
  opacity: 1;
}

#teleport .warp {
  position: absolute;
  inset: 0;
  background: radial-gradient(800px 420px at 50% 50%, rgba(255, 255, 255, .10), transparent 60%);
}

#teleport .teleRing {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(760px, 80vw);
  height: min(760px, 80vw);
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 1px solid rgba(241, 245, 249, .18);
  box-shadow: 0 0 60px rgba(111, 231, 210, .08);
}

#teleport .scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent, rgba(111, 231, 210, .10), transparent);
  animation: scan 700ms linear infinite;
  mix-blend-mode: screen;
}

@keyframes scan {
  to {
    transform: translateY(18%);
  }
}

html.rm #teleport .scan {
  animation: none;
}

/* Hintbar */
#hintbar {
  position: absolute;
  left: 50%;
  bottom: clamp(10px, 2.4vw, 24px);
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(0, 0, 0, .22);
  backdrop-filter: blur(10px);
  z-index: 12;
  color: rgba(241, 245, 249, .72);
}

#hintbar span {
  font-size: .86rem;
  letter-spacing: .02em;
}

/* Lens overlay */
#lensOverlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(10px);
  display: none;
}

#lensOverlay.on {
  display: grid;
  place-items: center;
  padding: 14px;
}

.lensPanel {
  width: min(980px, calc(100% - 2*clamp(14px, 2.6vw, 34px)));
  border-radius: 28px;
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(10, 15, 31, .86);
  box-shadow: 0 18px 80px rgba(0, 0, 0, .55);
  /* Critical for mobile: give the panel a real height so inner columns can scroll */
  height: min(860px, calc(100dvh - 28px));
  max-height: calc(100dvh - 28px);
  overflow: hidden;
}

@supports not (height: 100dvh) {
  .lensPanel {
    height: min(860px, calc(100vh - 28px));
    max-height: calc(100vh - 28px);
  }
}

.lensGrid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  height: 100%;
}

.lensLeft {
  padding: 18px 18px 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.lensRight {
  padding: 18px 18px 16px;
  border-left: 1px solid rgba(241, 245, 249, .08);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.closeX {
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(241, 245, 249, .06);
  color: rgba(241, 245, 249, .86);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  cursor: pointer;
}

.closeX:hover {
  border-color: rgba(241, 245, 249, .18);
  background: rgba(241, 245, 249, .08);
}

.stepPills {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.pill {
  border-radius: 999px;
  padding: 10px 12px;
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(241, 245, 249, .04);
  color: rgba(241, 245, 249, .82);
  cursor: pointer;
  letter-spacing: .06em;
  font-size: .82rem;
  text-transform: uppercase;
}

.pill.active {
  border-color: rgba(111, 231, 210, .35);
  background: rgba(111, 231, 210, .10);
}

form {
  margin-top: 0;
}

.formRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  margin-bottom: 12px;
}

label {
  display: block;
  color: rgba(241, 245, 249, .70);
  font-size: .82rem;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(241, 245, 249, .04);
  color: rgba(241, 245, 249, .92);
  padding: 11px 16px;
  outline: none;
}

/* Improve native select menus in dark UI (where supported) */
select {
  color-scheme: dark;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(241, 245, 249, .22);
}

.err {
  display: none;
  margin-top: 4px;
  color: rgba(255, 160, 160, .92);
  font-size: .88rem;
}

.err.on {
  display: block;
}

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

.actions .btn {
  flex: 1;
  justify-content: center;
  display: inline-flex;
}

.req {
  margin-top: 10px;
  font-size: .84rem;
  color: rgba(241, 245, 249, .58);
  line-height: 1.45;
}

/* Mobile */
@media (max-width: 920px) {
  .navlinks {
    display: none;
  }

  .brand {
    min-width: unset;
  }

  #hero {
    top: 36%;
  }

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

  .lensRight {
    border-left: none;
    border-top: 1px solid rgba(241, 245, 249, .08);
  }
}

@media (max-height: 760px) {
  .lensGrid {
    grid-template-columns: 1fr;
  }

  .lensRight {
    border-left: none;
    border-top: 1px solid rgba(241, 245, 249, .08);
  }

  .lensLeft,
  .lensRight {
    padding: 14px 14px 12px;
  }
}

@media (max-width: 820px) {
  :root {
    --planetSize: clamp(84px, 21vw, 112px);
    --orbitDot: 7px;
    --beltOpacity: .16;
  }

  header {
    height: auto;
  }

  .nav {
    flex-wrap: wrap;
  }

  .cta {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .kbd {
    display: none;
  }

  #hero {
    top: 34%;
    padding: 16px 14px 18px;
  }

  .label span {
    display: none;
  }

  #hintbar {
    display: none;
  }
}

@media (max-width: 420px) {
  :root {
    --planetSize: clamp(78px, 23vw, 104px);
  }
}


/* ==========================
   HERO: Portal Details
   ========================== */
.portalDetails {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(241, 245, 249, .08);
  background: rgba(10, 15, 31, .35);
  backdrop-filter: blur(10px);
}

.portalDetails>summary {
  cursor: pointer;
  list-style: none;
  font-weight: 650;
  color: rgba(241, 245, 249, .88);
  outline: none;
}

.portalDetails>summary::-webkit-details-marker {
  display: none;
}

.portalDetails>summary:after {
  content: " ▾";
  opacity: .65;
}

.portalDetails[open]>summary:after {
  content: " ▴";
}

.portalGrid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.portalCard {
  padding: 12px 12px 10px;
  border-radius: 16px;
  border: 1px solid rgba(241, 245, 249, .08);
  background: rgba(17, 24, 39, .35);
}

.portalTop {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.portalKey {
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(111, 231, 210, .95);
}

.portalCard p {
  margin: 0 0 8px;
  color: rgba(241, 245, 249, .70);
  font-size: .92rem;
  line-height: 1.45;
}

.portalCard ul {
  margin: 0;
  padding-left: 18px;
  color: rgba(241, 245, 249, .68);
  font-size: .88rem;
  line-height: 1.45;
}

.portalCard li {
  margin: 4px 0;
}

@media (max-width: 1100px) {
  .portalGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .portalGrid {
    grid-template-columns: 1fr;
  }
}

/* ==========================
   LENS: Dark selects + chat + preview
   ========================== */
.select,
select {
  background: rgba(17, 24, 39, .70);
  color: rgba(241, 245, 249, .92);
  border: 1px solid rgba(241, 245, 249, .12);
}

select option {
  background: #0A0F1F;
  color: rgba(241, 245, 249, .92);
}

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

.lensBrand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.lensIntro {
  margin-top: 14px;
  color: rgba(241, 245, 249, .66);
  text-align: center;
  line-height: 1.6;
}

.lensTip {
  margin-top: 12px;
  color: rgba(241, 245, 249, .55);
  font-size: .9rem;
  line-height: 1.55;
}

.chatBox {
  margin-top: 16px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(241, 245, 249, .10);
  background: rgba(10, 15, 31, .34);
  backdrop-filter: blur(10px);
}

.chatHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.chatTools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.miniBtn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(17, 24, 39, .45);
  color: rgba(241, 245, 249, .85);
  font-size: .82rem;
}

.miniBtn:hover {
  border-color: rgba(111, 231, 210, .35);
}

.chatLog {
  height: 180px;
  overflow: auto;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(241, 245, 249, .08);
  background: rgba(17, 24, 39, .35);
}

.chatMsg {
  display: flex;
  gap: 10px;
  margin: 8px 0;
  line-height: 1.45;
  font-size: .92rem;
  color: rgba(241, 245, 249, .84);
}

.chatMsg .who {
  min-width: 56px;
  opacity: .65;
  font-weight: 650;
}

.chatQuick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.chatQuick .q {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(17, 24, 39, .45);
  color: rgba(241, 245, 249, .86);
  font-size: .86rem;
}

.chatQuick .q:hover {
  border-color: rgba(111, 231, 210, .35);
}

.chatRow {
  display: flex;
  gap: 8px;
}

.chatRow .input {
  flex: 1;
}

.routeBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(241, 245, 249, .10);
  background: rgba(10, 15, 31, .34);
  backdrop-filter: blur(10px);
  margin-bottom: 12px;
}

.routeText {
  color: rgba(241, 245, 249, .86);
  font-size: .95rem;
  line-height: 1.35;
}

.routeWhy {
  display: block;
  color: rgba(241, 245, 249, .62);
  font-weight: 500;
  margin-top: 2px;
}

.previewWrap {
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(241, 245, 249, .10);
  background: rgba(10, 15, 31, .30);
  backdrop-filter: blur(10px);
}

.previewBox {
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(241, 245, 249, .08);
  background: rgba(17, 24, 39, .34);
  color: rgba(241, 245, 249, .80);
  font-size: .86rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

/* On smaller screens, stack Lens columns */
@media (max-width: 980px) {
  .lensGrid {
    grid-template-columns: 1fr;
  }

  .chatLog {
    height: 160px;
  }
}

/* ==========================
   PLANETS: Ring depth (front arc above sphere)
   ========================== */
.planet {
  position: absolute;
}

.orbitPath {
  /* back arc only */
  clip-path: inset(0 0 50% 0 round 999px);
  opacity: .75;
}

.planet::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--planetSize) * 1.45);
  height: calc(var(--planetSize) * .42);
  transform: translate(-50%, -50%) rotateZ(-14deg) rotateX(68deg);
  border-radius: 999px;
  border: var(--beltStroke) solid rgba(241, 245, 249, calc(var(--beltOpacity) * 1.35));
  clip-path: inset(50% 0 0 0 round 999px);
  pointer-events: none;
  z-index: 3;
  /* above sphere for the front arc */
  filter: drop-shadow(0 0 10px rgba(111, 231, 210, .10));
}

/* single orbit dot should pass in front/behind */
.orbitDot {
  width: var(--orbitDot);
  height: var(--orbitDot);
  border-radius: 999px;
}

/* Slightly tighter map spacing on mobile */
@media (max-width: 820px) {
  #hero {
    max-width: 92vw;
    top: calc(var(--topbarH) + 18px);
    transform: translateX(-50%);
  }
}



/* ==========================
   FINAL STABILITY PATCHES (v7)
   - Fallback topbar height (JS will sync exact height)
   - Logo orbit DOT (not just ring)
   ========================== */
:root {
  --topbarH: 84px;
}

/* Orbit dot around the big logo (anticlockwise). Keeps existing ring. */
.logo--big {
  position: relative;
}

.logo--big::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--logo333);
  box-shadow: 0 0 14px rgba(111, 231, 210, .55), 0 0 28px rgba(111, 231, 210, .22);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) translateX(54px);
}

.logo--big {
  animation: logoDotOrbit 7.5s linear infinite;
  transform-origin: 50% 50%;
}

@keyframes logoDotOrbit {
  to {
    transform: rotate(-360deg);
  }
}

html.rm .logo--big {
  animation: none;
}



/* === v9 UI polish: logo orbit split, planet labels always visible, story widget === */

/* Logo: circular, logo spins anticlockwise; dot orbits clockwise (opposite) */
.logo--big {
  border-radius: 999px !important;
  overflow: visible !important;
}

.logo--big img {
  animation: hfaiLogoSpinACW 18s linear infinite;
  transform-origin: 50% 50%;
}

@keyframes hfaiLogoSpinACW {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(-360deg);
  }
}

.logo--big::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--logo333);
  box-shadow: 0 0 18px rgba(111, 231, 210, .55);
  animation: hfaiLogoDotOrbitCW 7.5s linear infinite;
  pointer-events: none;
}

@keyframes hfaiLogoDotOrbitCW {
  from {
    transform: translate(-50%, -50%) rotate(0deg) translateX(74px);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg) translateX(74px);
  }
}

/* Planet labels: title always visible; tagline appears on hover/focus */
.label {
  opacity: .90 !important;
  transform: translateX(-50%) translateY(0) !important;
  white-space: normal !important;
  width: min(240px, 70vw);
}

.label span {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(-2px);
  transition: opacity .18s var(--ease), max-height .18s var(--ease), transform .18s var(--ease);
}

.planet:hover .label span,
.planet:focus-within .label span,
.planet.isHot .label span {
  opacity: 1;
  max-height: 44px;
  transform: translateY(0);
}

/* Orbit belt layering: allow dot z-index to pass above sphere */
.orbitPath {
  z-index: auto !important;
}

/* Story widget (intro audio) */
.storyWidget {
  position: fixed;
  right: 16px;
  top: 56%;
  transform: translateY(-50%);
  z-index: 20;
  display: grid;
  gap: 10px;
  justify-items: end;
}

.storyOrb {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(241, 245, 249, .18);
  background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .18), rgba(0, 0, 0, .28) 55%, rgba(0, 0, 0, .34));
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
  cursor: pointer;
  position: relative;
}

.storyOrb .orbDot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--logo333);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 16px rgba(111, 231, 210, .40);
}

.storyMenu {
  display: none;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 60px rgba(0, 0, 0, .40);
  width: 168px;
}

.storyMenu .miniBtn {
  width: 100%;
  margin: 6px 0 0 0;
}

.storyHint {
  display: none;
  margin-top: -6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(241, 245, 249, .12);
  background: rgba(0, 0, 0, .36);
  color: rgba(241, 245, 249, .70);
  font-size: .82rem;
  white-space: nowrap;
}

.storyWidget.isMenuOpen #storyMenu {
  display: block;
}

.storyWidget.needsTap #storyHint {
  display: inline-block;
}

.storyWidget.needsTap .storyOrb {
  animation: hfaiOrbPulse 1.4s ease-in-out infinite;
}

@keyframes hfaiOrbPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }
}

@media (max-width: 560px) {
  .storyWidget {
    right: 10px;
    top: auto;
    bottom: 96px;
    transform: none;
  }

  .logo--big {
    width: 96px;
    height: 96px;
  }

  @keyframes hfaiLogoDotOrbitCW {
    from {
      transform: translate(-50%, -50%) rotate(0deg) translateX(56px);
    }

    to {
      transform: translate(-50%, -50%) rotate(360deg) translateX(56px);
    }
  }
}


/* Audio autoplay helper toast */
.audioToast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 25;
  border-radius: 999px;
  border: 1px solid rgba(0, 210, 150, .32);
  background: rgba(7, 11, 20, .62);
  backdrop-filter: blur(10px);
  color: rgba(241, 245, 249, .90);
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .45);
  display: none;
}

.audioToast.on {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.audioToast .tDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgb(0, 210, 150);
  box-shadow: 0 0 10px rgba(0, 210, 150, .65);
}

/* === v10 fine-tune: keep logo DOT independent ===
   Prevent the outer logo container rotation (which can make the dot feel "stuck" to it).
   The logo image spins anticlockwise; the dot orbits clockwise.
*/
.logo--big {
  animation: none !important;
}

html.rm .logo--big img {
  animation: none !important;
}

html.rm .logo--big::after {
  animation: none !important;
}