/*
 * The deep-space look for the public pages: home page, roadmap, founders,
 * rules, log in, sign up and the setup wizard, always dark. Anything inside
 * .earth gets this palette, including the shared components (buttons, inputs,
 * choice cards), because it redefines the app's own tokens. The stars are
 * components/starfield.js.
 */

.earth {
  --e-paper: #050816;
  --e-ink: #eef2ff;
  --e-ink-soft: #aeb8d6;
  --e-ink-faint: #7a84a6;
  --e-line: rgb(170 190 255 / 0.14);
  --e-glass: rgb(18 26 58 / 0.55);
  --e-glass-edge: rgb(170 195 255 / 0.16);
  --e-forest: #2e9a5c;
  --e-moss: #7ee2a2;
  --e-fern: #4cc47a;
  --e-sage: #9fdcb0;
  --e-mist: #e3f3dc;
  --e-sky: #7cc6ff;
  --e-sun: #ffb27a;

  /* Shared components pick these up. */
  --bg: var(--e-paper);
  --surface: rgb(20 29 64 / 0.72);
  --surface-muted: rgb(16 24 54 / 0.72);
  --surface-sunken: rgb(8 12 32 / 0.6);
  --ink: var(--e-ink);
  --ink-soft: var(--e-ink-soft);
  --ink-faint: var(--e-ink-faint);
  --line: var(--e-line);
  --line-strong: rgb(170 190 255 / 0.26);
  --accent: var(--e-forest);
  --accent-hover: var(--e-fern);
  --accent-ink: #ffffff;
  --accent-soft: rgb(110 220 150 / 0.14);
  --accent-text: var(--e-moss);
  --success: var(--e-fern);
  --success-soft: rgb(110 220 150 / 0.14);
  --focus-ring: 0 0 0 3px rgb(126 226 162 / 0.35);
  --danger: #ff7a7a;
  --danger-soft: rgb(255 122 122 / 0.14);
  --avatar-bg-l: 32%;
  --avatar-ink-l: 86%;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.25), 0 10px 30px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 24px 60px rgb(0 0 0 / 0.5);

  --ease-calm: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Always dark, whatever the device or the in-app theme is set to. */
  color-scheme: dark;
  /* Its own stacking layer, so the fixed starfield (z-index -1) sits above this background but under everything else. */
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  background: var(--e-paper);
  color: var(--e-ink);
}

/* Glassy cards, lit faintly along the top like starlight on a window. */
.space-card,
.goal,
.roadmap__column,
.roadmap-card,
.roadmap__add,
.rules__item,
.setup__summary li {
  border: 1px solid var(--e-glass-edge);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.05), transparent 40%),
    var(--surface);
}

/* ---------- Buttons ---------- */

.btn--earth {
  background: linear-gradient(180deg, #3dbb72, var(--e-forest));
  color: var(--accent-ink);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.25),
    0 0 0 1px rgb(126 226 162 / 0.3),
    0 8px 28px rgb(46 154 92 / 0.45);
}

.btn--earth:hover:not(:disabled) {
  background: linear-gradient(180deg, #4cd083, #33a865);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.3),
    0 0 0 1px rgb(126 226 162 / 0.45),
    0 10px 36px rgb(76 196 122 / 0.6);
  transform: translateY(-1px);
}

.btn--earth-ghost {
  border: 1px solid var(--e-line);
  background: var(--e-glass);
  color: var(--e-ink);
  backdrop-filter: blur(10px);
}

.btn--earth-ghost:hover {
  border-color: var(--line-strong);
  background: rgb(40 54 104 / 0.7);
}

.earth .btn .icon {
  transition: transform 0.3s var(--ease-calm);
}

.earth .btn:hover .icon {
  transform: translateX(3px);
}

/* ---------- Space ---------- */

/* Fixed behind the whole page: the nebula glows are CSS, the stars are drawn on the canvas. */
/* Sized to the tallest the screen gets (100lvh, or 100vh where lvh is new), so a phone's address
   bar sliding in and out doesn't stretch the stars or make them redraw. */
.starfield {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  background:
    radial-gradient(ellipse 60% 50% at 82% 12%, rgb(106 76 255 / 0.16), transparent 70%),
    radial-gradient(ellipse 55% 45% at 8% 70%, rgb(40 160 255 / 0.12), transparent 70%),
    radial-gradient(ellipse 50% 40% at 60% 105%, rgb(60 200 140 / 0.1), transparent 70%),
    linear-gradient(180deg, #070b20, var(--e-paper) 60%);
  pointer-events: none;
}

.starfield__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* The still stars, baked once into three layers. Each twinkles on its own slow beat; a fade
   of a whole layer is done by the graphics chip, so it costs nothing per frame. */
.starfield__layer {
  animation: twinkle 5s ease-in-out infinite alternate;
}

.starfield__layer--1 {
  animation-duration: 7s;
  animation-delay: -2.5s;
}

.starfield__layer--2 {
  animation-duration: 9s;
  animation-delay: -6s;
}

@keyframes twinkle {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.55;
  }
}

.starfield--still .starfield__layer {
  animation: none;
}

/* Touch screens: a live blur behind glass re-blurs every frame over moving stars, which is the
   heaviest thing on the page. Use a slightly stronger tint instead of the blur. */
@media (pointer: coarse) {
  .earth *,
  .earth *::before,
  .earth *::after {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .earth {
    --e-glass: rgb(16 22 50 / 0.8);
  }

  .landing[data-scrolled] .landing__nav {
    background: rgb(5 8 22 / 0.94);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* ---------- Scroll reveals ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity 1s var(--ease-calm),
    transform 1s var(--ease-calm);
  transition-delay: calc(var(--delay, 0) * 110ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Home page ---------- */

.landing {
  --landing-width: 1160px;
  overflow-x: clip;
}

.landing__nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 18px max(24px, calc((100vw - var(--landing-width)) / 2));
  transition:
    background 0.4s,
    box-shadow 0.4s,
    padding 0.4s;
}

.landing[data-scrolled] .landing__nav {
  padding-block: 12px;
  background: rgb(5 8 22 / 0.7);
  box-shadow: 0 1px 0 var(--e-line);
  backdrop-filter: blur(16px) saturate(1.3);
}

.landing__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  color: var(--e-ink);
}

.landing__links {
  display: flex;
  gap: 28px;
  margin-left: auto;
  color: var(--e-ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
}

.landing__links a {
  position: relative;
}

.landing__links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 0.35s var(--ease-calm);
}

.landing__links a:hover {
  color: var(--e-ink);
}

.landing__links a:hover::after {
  transform: scaleX(1);
}

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

.eyebrow {
  color: var(--e-moss);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100svh;
  padding: 96px 24px 120px;
  overflow: hidden;
  text-align: center;
}

/* The world above the name. */
.hero__mark {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(1100px, 100%);
}

.hero__earth {
  width: clamp(260px, 38vw, 500px);
  height: auto;
  aspect-ratio: 1;
  opacity: 0;
  pointer-events: none;
  user-select: none;
  animation: earth-rise 2.4s var(--ease-calm) 0.2s forwards;
}

/* Safari's MP4 is on black; screen-blending it into the dark page hides the black. */
.hero__earth--blend {
  mix-blend-mode: screen;
}

/* Holds the globe, plus (for the blended MP4) a black disc right behind it. Screen-blending
   adds whatever is behind the video, so without the disc the fixed stars show through the
   world and stay put while it spins. Not its own stacking layer, so the blend still reaches
   the stars around the globe's edge. */
.hero__globe {
  position: relative;
  display: grid;
}

.hero__globe:has(> .hero__earth--blend)::before {
  position: absolute;
  inset: 0;
  /* The world's edge is 44% of the video's width; stop just inside it. */
  background: radial-gradient(circle closest-side, #000 85%, transparent 87%);
  content: "";
  opacity: 0;
  pointer-events: none;
  animation: earth-rise 2.4s var(--ease-calm) 0.2s forwards;
}

@keyframes earth-rise {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* The name, in solid starlit letters. */
.hero__wordmark {
  margin: 4px 0 18px;
  color: #f4f8ff;
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(3rem, 10vw, 7.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  text-shadow:
    0 0 18px rgb(150 205 255 / 0.55),
    0 0 60px rgb(90 150 255 / 0.4),
    0 2px 0 rgb(0 0 0 / 0.3);
}

.hero__copy {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 20px;
  max-width: 760px;
}

.hero__title {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 4.2vw, 3.2rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero__title em {
  background: linear-gradient(90deg, var(--e-moss), var(--e-sky));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Inline blocks so each half can rise on its own but still share a line when there's room. */
.hero__line {
  display: inline-block;
}

.hero__lead {
  max-width: 600px;
  color: var(--e-ink-soft);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.6;
}

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

.hero__rise {
  opacity: 0;
  animation: rise 1.2s var(--ease-calm) forwards;
  animation-delay: calc(var(--delay, 0) * 140ms + 200ms);
}

@media (prefers-reduced-motion: reduce) {
  .hero__rise,
  .hero__earth,
  .hero__globe::before {
    opacity: 1;
    animation: none;
  }
}

.section {
  display: grid;
  gap: 18px;
  max-width: var(--landing-width);
  margin: 0 auto;
  padding: 120px 24px;
  scroll-margin-top: 60px;
}

.section--tinted {
  max-width: none;
  padding-inline: max(24px, calc((100vw - var(--landing-width)) / 2));
  background: linear-gradient(180deg, transparent, rgb(80 110 220 / 0.08) 18%, rgb(80 110 220 / 0.08) 82%, transparent);
}

.section__title {
  max-width: 820px;
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.section__lead {
  max-width: 600px;
  color: var(--e-ink-soft);
  font-size: 1.12rem;
  line-height: 1.65;
}

/* Spaces showcase */

.spaces-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 8px;
  color: var(--e-ink-soft);
  font-size: 0.95rem;
}

/* Plain text with the icon and label inline, so a long line wraps like a sentence. */
.spaces-legend__item .icon {
  display: inline-block;
  margin-right: 6px;
  vertical-align: -2px;
}

.spaces-legend__item strong {
  margin-right: 6px;
  color: var(--e-ink);
}

.spaces-legend__item--public .icon {
  color: var(--e-sky);
}

.spaces-legend__item--private .icon {
  color: var(--e-moss);
}

/* Six cards, three by two, so neither group leaves a card on its own. */
.spaces-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.space-card {
  --group: var(--e-sky);
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 24px;
  overflow: hidden;
  border-radius: 24px;
  box-shadow: var(--shadow);
  transition:
    transform 0.5s var(--ease-calm),
    box-shadow 0.5s var(--ease-calm),
    border-color 0.5s var(--ease-calm),
    opacity 1s var(--ease-calm);
}

.space-card--private {
  --group: var(--e-moss);
}

/* A soft wash of the group's colour in the top corner. */
.space-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--group) 18%, transparent), transparent 55%);
  pointer-events: none;
}

.space-card:hover {
  border-color: color-mix(in srgb, var(--group) 45%, transparent);
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg), 0 0 40px color-mix(in srgb, var(--group) 15%, transparent);
}

.space-card__top {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.space-card__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--e-mist);
  box-shadow: 0 0 24px color-mix(in srgb, var(--group) 25%, transparent);
}

.space-card__group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--group) 14%, transparent);
  color: var(--group);
  font-size: 0.75rem;
  font-weight: 700;
}

.space-card h3 {
  position: relative;
  font-size: 1.25rem;
}

.space-card p {
  position: relative;
  color: var(--e-ink-soft);
  font-size: 0.95rem;
}

/* Promises */

.goals {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.goal {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 28px;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.goal__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.goal__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--e-mist);
  box-shadow: 0 0 24px rgb(159 220 176 / 0.25);
}

.goal__number {
  color: rgb(159 220 176 / 0.55);
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
}

.goal__title {
  font-size: 1.15rem;
  line-height: 1.25;
}

.goal__text {
  color: var(--e-ink-soft);
  line-height: 1.6;
}

/* Algorithm and ads */

.split {
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 64px;
}

.split--reverse > :first-child {
  order: 2;
}

.split__copy {
  display: grid;
  gap: 16px;
}

.rule-board {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid var(--e-glass-edge);
  background: linear-gradient(160deg, rgb(24 36 80 / 0.85), rgb(10 16 40 / 0.85));
  box-shadow: var(--shadow-lg);
}

.rule-board__row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgb(255 255 255 / 0.06);
  color: var(--e-ink);
}

.rule-board__row code {
  color: var(--e-sky);
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

.rule-board__tag {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--e-moss);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.list-title {
  margin-top: 6px;
  font-size: 0.85rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
}

.chip--yes {
  background: var(--accent-soft);
  color: var(--e-moss);
}

.chip--no {
  background: var(--surface-sunken);
  color: var(--e-ink-soft);
  text-decoration: line-through;
  text-decoration-color: var(--e-ink-faint);
}

/* A feed with one ad in it (pages/landing.js Ads). */
.feed-demo {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--e-glass-edge);
  border-radius: 28px;
  background: #0b1130;
  box-shadow: var(--shadow-lg);
}

.feed-demo__post {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface);
}

.feed-demo__post--photo::after {
  content: "";
  grid-column: 1 / -1;
  height: 90px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgb(124 198 255 / 0.35), rgb(126 226 162 / 0.3));
}

.feed-demo__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.15);
}

.feed-demo__lines {
  height: 36px;
  background:
    linear-gradient(rgb(255 255 255 / 0.18), rgb(255 255 255 / 0.18)) 0 4px / 70% 10px no-repeat,
    linear-gradient(rgb(255 255 255 / 0.1), rgb(255 255 255 / 0.1)) 0 22px / 45% 10px no-repeat;
}

.feed-demo__ad {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 16px 14px 14px;
  border: 1px solid rgb(255 210 63 / 0.5);
  border-radius: 16px;
  background: rgb(255 210 63 / 0.08);
}

.feed-demo__ad span {
  color: var(--e-ink-soft);
  font-size: 0.85rem;
}

.feed-demo__badge {
  justify-self: start;
  padding: 1px 8px;
  border-radius: 6px;
  background: #ffd23f;
  color: #1c1300 !important;
  font-size: 0.75rem !important;
  font-weight: 800;
}

/* No-bots band */

.band {
  margin: 40px 0;
  padding: 0 24px;
}

.band__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: var(--landing-width);
  margin: 0 auto;
  padding: 56px clamp(24px, 5vw, 64px);
  border-radius: 32px;
  border: 1px solid rgb(126 226 162 / 0.25);
  background:
    radial-gradient(ellipse 60% 120% at 0% 0%, rgb(76 196 122 / 0.25), transparent 70%),
    linear-gradient(135deg, rgb(16 48 44 / 0.9), rgb(14 22 56 / 0.9));
  color: var(--e-ink);
}

.band__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: var(--e-mist);
}

.band__title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.15;
}

.band__text {
  max-width: 680px;
  margin-top: 12px;
  color: var(--e-ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Final call */

.final {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 78svh;
  margin-top: 60px;
  padding: 80px 24px 200px;
  text-align: center;
  overflow: hidden;
}

/* A sunrise of green and blue light along the bottom edge. */
.final__glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% 100%, rgb(76 196 122 / 0.28), transparent 70%),
    radial-gradient(ellipse 40% 30% at 50% 100%, rgb(124 198 255 / 0.3), transparent 70%);
  pointer-events: none;
}

.final__copy {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 16px;
}

.landing__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  max-width: var(--landing-width);
  margin: 0 auto;
  padding: 28px 24px 40px;
  color: var(--e-ink-faint);
  font-size: 0.9rem;
}

/* Site links, then the "Legal" group under its own small heading. */
.footer-links {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.footer-links__legal strong {
  margin-right: 10px;
  color: var(--e-ink-soft);
  font-weight: 700;
}

@media (max-width: 760px) {
  .footer-links {
    justify-items: start;
  }
}

.landing__footer .landing__brand {
  font-family: var(--font-serif);
  font-weight: 700;
}

/* ---------- Log in / sign up ---------- */

.auth {
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
}

.auth__brand {
  position: absolute;
  top: 24px;
  left: 28px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--e-ink);
}

.auth__main {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 22px;
  padding: 96px 20px 48px;
}

.auth__card {
  display: grid;
  gap: 8px;
  width: min(420px, 100%);
  padding: 40px 36px 32px;
  border: 1px solid var(--e-glass-edge);
  border-radius: 32px;
  background: var(--e-glass);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08), 0 40px 90px rgb(0 0 0 / 0.55);
  backdrop-filter: blur(22px) saturate(1.25);
  animation: rise 1.1s var(--ease-calm) both;
}

.auth__mark {
  justify-self: center;
  margin-bottom: 8px;
  border-radius: 50%;
  animation: glow 5s ease-in-out infinite;
}

@keyframes glow {
  50% {
    box-shadow: 0 0 0 10px rgb(124 198 255 / 0.12), 0 0 40px rgb(124 198 255 / 0.45);
  }
}

.auth__title {
  font-family: var(--font-serif);
  font-size: 2rem;
  letter-spacing: -0.015em;
  text-align: center;
}

.auth__subtitle {
  margin-bottom: 16px;
  color: var(--e-ink-soft);
  text-align: center;
}

.earth .input {
  height: 50px;
  border-color: var(--e-line);
  border-radius: 14px;
  background: rgb(6 10 30 / 0.6);
}

/* The earth background shorthand above would wipe the drop-down arrow, so put it back. */
.earth select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa4c7' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}
.earth select.input:hover {
  border-color: var(--e-moss);
}
.earth select.input:has(option[value=""]:checked) {
  color: var(--e-ink-soft);
}
.earth select.input option {
  background: #0b1230;
  color: var(--e-ink);
}

/* Custom dropdown on the starry pages. */
.earth .dropdown__button {
  height: 50px;
  border-color: var(--e-line);
  border-radius: 14px;
  background: rgb(6 10 30 / 0.6);
  color: var(--e-ink);
}
.earth .dropdown__button:hover,
.earth .dropdown.is-open .dropdown__button,
.earth .dropdown__button:focus-visible {
  border-color: var(--e-moss);
}
.earth .dropdown__button:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--e-moss) 35%, transparent);
}
.earth .dropdown__value.is-placeholder,
.earth .dropdown__chevron {
  color: var(--e-ink-soft);
}
.earth .dropdown__list {
  border-color: var(--e-line);
  background: #0b1230;
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.55);
  scrollbar-color: var(--e-line) transparent;
}
@supports (backdrop-filter: blur(1px)) {
  .earth .dropdown__list {
    background: rgb(11 18 48 / 0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}
.earth .dropdown__list::-webkit-scrollbar-thumb {
  background: var(--e-line);
}
.earth .dropdown__option {
  color: var(--e-ink);
}
.earth .dropdown__option:hover,
.earth .dropdown__option.is-active {
  background: color-mix(in srgb, var(--e-moss) 18%, transparent);
}
.earth .dropdown__option[aria-selected="true"]::after {
  background: var(--e-moss);
}

.auth__footer {
  margin-top: 16px;
  color: var(--e-ink-soft);
  text-align: center;
}

.auth__footer a {
  color: var(--e-moss);
  font-weight: 600;
}

.auth__points {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: var(--e-glass);
  backdrop-filter: blur(12px);
  color: var(--e-ink-soft);
  font-size: 0.85rem;
  font-weight: 500;
  animation: rise 1.1s var(--ease-calm) 0.3s both;
}

.auth__points li {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .auth__card,
  .auth__points,
  .auth__mark {
    animation: none;
  }
}

/* ---------- Setup wizard ---------- */

.setup {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 24px 16px;
}

.setup__card {
  position: relative;
  display: grid;
  gap: 20px;
  width: min(680px, 100%);
  max-height: calc(100svh - 48px);
  overflow-y: auto;
  padding: 28px 36px 28px;
  border: 1px solid var(--e-glass-edge);
  border-radius: 32px;
  background: var(--e-glass);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08), 0 40px 90px rgb(0 0 0 / 0.55);
  backdrop-filter: blur(22px) saturate(1.25);
  animation: rise 1s var(--ease-calm) both;
}

.setup__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.setup__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
}

.setup__skip {
  color: var(--e-ink-faint);
  font-size: 0.85rem;
}

.setup__skip:hover {
  color: var(--e-ink);
  text-decoration: underline;
}

.setup__progress {
  display: flex;
  gap: 6px;
}

.setup__dot {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--e-line);
  transition: background 0.6s var(--ease-calm);
}

.setup__dot.is-done {
  background: var(--e-moss);
}

.setup__step {
  display: grid;
  gap: 10px;
}

.setup__step--forward {
  animation: step-in 0.6s var(--ease-calm) both;
}

.setup__step--back {
  animation: step-back 0.6s var(--ease-calm) both;
}

@keyframes step-in {
  from {
    opacity: 0;
    transform: translateX(32px);
  }
}

@keyframes step-back {
  from {
    opacity: 0;
    transform: translateX(-32px);
  }
}

.setup__count {
  color: var(--e-moss);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.setup__title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.setup__lead {
  margin-bottom: 10px;
  color: var(--e-ink-soft);
  font-size: 1.05rem;
}

.setup__actions {
  position: sticky;
  bottom: -28px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 -36px -28px;
  padding: 16px 36px 24px;
  background: linear-gradient(180deg, transparent, var(--e-glass) 35%);
  backdrop-filter: blur(8px);
}

/* Sign-up page only (/register, its form holds .signup__step): buttons centred, no tinted bar behind
   them, more room above and below. The welcome setup page shares .setup__actions and is left alone. */
.form:has(.signup__step) .setup__actions {
  position: static;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 32px 0 36px;
  background: none;
  backdrop-filter: none;
}

.form:has(.signup__step) .setup__actions .spacer {
  display: none;
}

/* Wider on desktop so the settings are easier to scan: the sign-up card (/register) and the setup
   card (/setup). Phones and small windows keep the narrow layout exactly as it was. */
@media (min-width: 900px) {
  .auth__card:has(.signup__step) {
    width: min(860px, 100%);
    padding-inline: 56px;
  }

  .setup__card {
    width: min(860px, 100%);
    padding-inline: 56px;
  }

  .setup__actions {
    margin-inline: -56px;
    padding-inline: 56px;
  }

  .form:has(.signup__step) .setup__actions {
    margin-inline: 0;
    padding-inline: 0;
  }

  /* Sign-up "Fine-tune each setting": two columns, so all four settings fit side by side. */
  .signup__fine-tune .pref-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 14px 20px;
  }
}

.setup__photo {
  display: flex;
  align-items: center;
  gap: 20px;
}

.setup__summary {
  display: grid;
  gap: 10px;
}

.setup__summary li {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
}

.setup__summary span:last-child {
  color: var(--e-ink-soft);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  .setup__card,
  .setup__step--forward,
  .setup__step--back {
    animation: none;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 1200px) {
  .goals {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

@media (max-width: 860px) {
  .landing__links {
    display: none;
  }
  .landing__auth,
  .landing__nav > .btn {
    margin-left: auto;
  }
  .split {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .split--reverse > :first-child {
    order: 0;
  }
  .section {
    padding: 80px 16px;
  }
  .band {
    padding: 0 16px;
  }
  .band__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .landing__nav {
    padding: 14px 16px;
  }
  .landing__auth .btn--earth-ghost {
    display: none;
  }
  .goals {
    grid-template-columns: 1fr;
  }
  .spaces-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .rule-board__row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .auth__card,
  .setup__card {
    padding: 28px 22px 22px;
    border-radius: 26px;
  }
  .setup__actions {
    margin: 0 -22px -22px;
    padding: 14px 22px 18px;
  }
}

/* ---------- Signed in, on the public pages (components/earth-nav.js) ---------- */

.landing__auth {
  align-items: center;
}

.landing__me {
  display: inline-flex;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--e-glass-edge);
  transition: box-shadow 0.3s var(--ease-calm);
}

.landing__me:hover {
  box-shadow: 0 0 0 2px var(--e-moss);
}

.landing__links a[aria-current="page"] {
  color: var(--e-ink);
}

@media (max-width: 560px) {
  /* The globe alone, so the sign-in buttons or "Open Globe Social" fit beside it. */
  .landing__nav .wordmark {
    display: none;
  }
  .landing__nav {
    gap: 12px;
  }
}

/* ---------- Stats and the founders bar (pages/landing.js) ---------- */

.stats {
  display: grid;
  gap: 16px;
  max-width: var(--landing-width);
  margin: -40px auto 0;
  padding: 0 24px;
}

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

.stat {
  display: grid;
  gap: 2px;
  padding: 18px 16px;
  border: 1px solid var(--e-glass-edge);
  border-radius: 20px;
  background: var(--e-glass);
  backdrop-filter: blur(10px);
}

a.stat:hover {
  border-color: rgb(126 200 255 / 0.4);
}

.stat__value {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.1;
}

.stat__label {
  color: var(--e-ink-soft);
  font-size: 0.9rem;
}

.founders-bar {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid rgb(255 178 122 / 0.3);
  border-radius: 20px;
  background: linear-gradient(90deg, rgb(255 178 122 / 0.1), transparent 60%), var(--e-glass);
}

.founders-bar__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  color: var(--e-ink-soft);
  font-size: 0.9rem;
}

.founders-bar__top strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--e-sun);
  font-size: 1rem;
}

.founders-bar__track {
  height: 12px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.08);
}

.founders-bar__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb27a, #ffd23f);
  box-shadow: 0 0 12px rgb(255 178 122 / 0.6);
}

.founders-bar__caption {
  color: var(--e-ink-soft);
  font-size: 0.85rem;
}

@media (max-width: 760px) {
  /* Five tiles on one line, even on phones. */
  .stats__tiles {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }
  .stats__tiles > .stat {
    min-width: 0;
    padding: 12px 6px;
    text-align: center;
  }
  .stats__tiles .stat__value {
    font-size: 1.05rem;
    overflow-wrap: anywhere;
  }
  .stats__tiles .stat__label {
    font-size: 0.7rem;
    overflow-wrap: anywhere;
  }
  .stats {
    margin-top: 0;
    padding: 0 16px;
  }
}

/* ---------- Invite links (/join, pages/landing.js) ---------- */

.hero__invite {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  padding: 6px 14px;
  border: 1px solid var(--e-glass-edge);
  border-radius: var(--radius-pill);
  background: var(--e-glass);
  color: var(--e-moss);
  font-weight: 600;
}

/* ---------- A shared post, for visitors (pages/shared.js) ---------- */

.shared__main {
  max-width: 640px;
  padding: 110px 16px 160px;
}

.shared__card {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.shared__byline {
  display: flex;
  gap: 10px;
  align-items: center;
}

.shared__byline > div {
  display: grid;
}

.shared__meta {
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.shared__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  line-height: 1.2;
}

.shared__body {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.shared__card .slideshow {
  overflow: hidden;
  border-radius: var(--radius);
}

.shared__counts {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.shared__counts:empty {
  display: none;
}

/* Stays on screen at the bottom, so joining is always one tap away. */
.shared__join {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--e-glass-edge);
  background: rgb(8 12 32 / 0.92);
  backdrop-filter: blur(10px);
}

.shared__join p {
  margin: 0;
  color: var(--e-ink-soft);
}

.shared__join strong {
  color: var(--e-ink);
}

.shared__join-actions {
  display: flex;
  gap: 8px;
}

/* ---------- Sign-up "Terms and Community rules" pop-up (pages/auth.js) ---------- */
/* The dialog sits on <body>, outside .earth, so its own colours are literal; the scroller is .earth. */

.terms-dialog {
  width: min(760px, 94vw);
  height: min(86vh, 900px);
  max-width: none;
  max-height: none;
  overflow: hidden;
  border: 1px solid rgb(170 190 255 / 0.18);
  border-radius: 20px;
  background: #0b1230;
  color: #eef2ff;
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.06);
}

.terms-dialog::backdrop {
  background: rgb(3 5 16 / 0.72);
  backdrop-filter: blur(3px);
}

.terms-dialog .dialog__body {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  padding: 0;
}

.terms-dialog .dialog__title {
  padding: 22px 28px 0;
  color: #eef2ff;
  font-family: var(--font-serif);
  font-size: 1.35rem;
}

.terms-dialog .dialog__message {
  padding: 6px 28px 16px;
  color: #aeb8d6;
  font-size: 0.95rem;
  line-height: 1.5;
}

.terms-dialog [role="progressbar"] {
  flex: none;
}

.terms-dialog__scroller.rules {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 24px 28px 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: rgb(170 190 255 / 0.3) transparent;
}

.terms-dialog__scroller::-webkit-scrollbar {
  width: 8px;
}

.terms-dialog__scroller::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgb(170 190 255 / 0.3);
}

.terms-dialog__scroller > * {
  flex: none;
  margin: 0;
}

.terms-dialog__scroller .info__part {
  display: grid;
  gap: 14px;
  padding-top: 28px;
  border-top: 1px solid var(--e-line);
}

.terms-dialog__scroller .info__draft + .info__part {
  padding-top: 0;
  border-top: 0;
}

.terms-dialog__scroller .info__part > * {
  margin: 0;
}

.terms-dialog__scroller .rules__title {
  font-size: 1.6rem;
  line-height: 1.2;
}

.terms-dialog__scroller .rules__lead {
  font-size: 1rem;
  line-height: 1.6;
}

.terms-dialog__scroller .info__part > section {
  display: grid;
  gap: 4px;
}

.terms-dialog__scroller .rules__subtitle {
  margin: 0;
  color: var(--e-ink);
  font-size: 1.1rem;
  line-height: 1.35;
}

.terms-dialog__scroller .rules__list,
.terms-dialog__scroller .rules__plain {
  margin: 0;
}

.terms-dialog .dialog__actions {
  flex: none;
  align-items: center;
  margin: 0;
  padding: 14px 28px;
  border-top: 1px solid rgb(170 190 255 / 0.14);
  background: rgb(8 12 32 / 0.9);
}

.terms-dialog .dialog__actions > :first-child:not(.btn) {
  margin-right: auto;
  color: #aeb8d6 !important;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .terms-dialog {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }

  .terms-dialog .dialog__title {
    padding: 16px 16px 0;
    font-size: 1.2rem;
  }

  .terms-dialog .dialog__message {
    padding: 4px 16px 12px;
  }

  .terms-dialog__scroller.rules {
    gap: 24px;
    padding: 20px 16px 24px;
  }

  .terms-dialog__scroller .rules__title {
    font-size: 1.4rem;
  }

  .terms-dialog .dialog__actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px;
  }

  .terms-dialog .dialog__actions > :first-child:not(.btn) {
    margin: 0;
    text-align: center;
  }

  .terms-dialog .dialog__actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* The terms pop-up's "35% read" line: left of the buttons on wide screens, its own row on phones. */
.terms-dialog__status {
  margin: 0 auto 0 0;
}
@media (max-width: 640px) {
  .terms-dialog__status {
    margin: 0;
    text-align: center;
  }
}
