/* ==========================================================================
   CELESTE — Design System
   "The Glowing Volume"

   Inspired by:
   - Vernor Vinge's Peace War: "the glowing volume of the Celest",
     "tiny golden spark", colored disks of light against black
   - The solar system: the darkness of space, starlight, planetary colors
   - 1980s spacecraft interiors: Alien, Blade Runner, 2001
   - Elite: Dangerous HUD language
   ========================================================================== */


/* ==========================================================================
   Layer 0 — Design Tokens (Custom Properties)
   ========================================================================== */

:root {
  /* --- Space: the fundamental black ---
     Not pure black — the faintest blue-violet tint of deep space,
     like looking at the sky between stars */
  --void:           oklch(0.08 0.015 270);
  --void-shallow:   oklch(0.11 0.015 270);
  --void-surface:   oklch(0.14 0.018 265);
  --void-raised:    oklch(0.17 0.020 260);
  --void-overlay:   oklch(0.20 0.022 260);

  /* --- Starlight: text and foreground ---
     Off-white with the faintest blue cast, like starlight
     filtered through a ship's viewport */
  --star:           oklch(0.95 0.010 250);
  --star-dim:       oklch(0.75 0.015 250);
  --star-faint:     oklch(0.55 0.015 260);
  --star-ghost:     oklch(0.38 0.015 265);

  /* --- Gold: the spacecraft, the primary accent ---
     "The tiny golden spark that represented his spacecraft"
     Warm amber-gold, the color of thruster fire and triumph */
  --gold:           oklch(0.78 0.16 75);
  --gold-bright:    oklch(0.85 0.18 75);
  --gold-dim:       oklch(0.65 0.14 75);
  --gold-ghost:     oklch(0.45 0.08 75);
  --gold-glow:      oklch(0.78 0.16 75 / 0.25);

  /* --- Cyan: HUD, data, instruments ---
     The cool blue-green of spacecraft displays and readouts,
     like LCARS panels or Elite's HUD */
  --cyan:           oklch(0.78 0.14 195);
  --cyan-bright:    oklch(0.85 0.16 195);
  --cyan-dim:       oklch(0.60 0.10 195);
  --cyan-ghost:     oklch(0.40 0.06 195);
  --cyan-glow:      oklch(0.78 0.14 195 / 0.20);

  /* --- Planetary colors ---
     Drawn from Vinge: "green disk of the departure world",
     "reddish disk of the destination", "yellow sun" */
  --planet-green:   oklch(0.68 0.18 155);
  --planet-red:     oklch(0.62 0.20 25);
  --planet-blue:    oklch(0.62 0.16 250);
  --planet-amber:   oklch(0.72 0.16 60);
  --planet-violet:  oklch(0.58 0.18 300);
  --planet-ice:     oklch(0.72 0.08 220);

  /* --- Semantic colors --- */
  --success:        var(--planet-green);
  --danger:         oklch(0.62 0.22 25);
  --warning:        var(--gold);
  --info:           var(--cyan);

  /* --- Borders and dividers ---
     Thin, low-opacity — like orbit lines in the display */
  --border:         oklch(0.30 0.015 265);
  --border-subtle:  oklch(0.22 0.012 265);
  --border-focus:   var(--gold);

  /* --- Typography --- */
  --font-sans:      "Inter", "SF Pro Display", system-ui, -apple-system, sans-serif;
  --font-mono:      "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, monospace;

  --text-xs:        0.75rem;    /* 12px */
  --text-sm:        0.8125rem;  /* 13px */
  --text-base:      0.9375rem;  /* 15px */
  --text-lg:        1.125rem;   /* 18px */
  --text-xl:        1.375rem;   /* 22px */
  --text-2xl:       1.75rem;    /* 28px */
  --text-3xl:       2.25rem;    /* 36px */
  --text-4xl:       3rem;       /* 48px */

  --leading-tight:  1.2;
  --leading-normal: 1.55;
  --leading-loose:  1.75;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide:  0.05em;
  --tracking-mega:  0.15em;

  --weight-normal:  400;
  --weight-medium:  500;
  --weight-semi:    600;
  --weight-bold:    700;

  /* --- Spacing ---
     Based on a 4px grid, with a spatial progression
     that echoes the logarithmic scale of orbital distances */
  --space-1:   0.25rem;   /* 4px */
  --space-2:   0.5rem;    /* 8px */
  --space-3:   0.75rem;   /* 12px */
  --space-4:   1rem;      /* 16px */
  --space-5:   1.25rem;   /* 20px */
  --space-6:   1.5rem;    /* 24px */
  --space-8:   2rem;      /* 32px */
  --space-10:  2.5rem;    /* 40px */
  --space-12:  3rem;      /* 48px */
  --space-16:  4rem;      /* 64px */
  --space-20:  5rem;      /* 80px */
  --space-24:  6rem;      /* 96px */

  /* --- Radii --- */
  --radius-sm:    4px;
  --radius-md:    8px;
  --radius-lg:    12px;
  --radius-xl:    16px;
  --radius-full:  9999px;

  /* --- Shadows and glows ---
     Colored glows rather than dark shadows — things emit light in space */
  --glow-gold-sm:   0 0 8px oklch(0.78 0.16 75 / 0.15);
  --glow-gold-md:   0 0 16px oklch(0.78 0.16 75 / 0.2), 0 0 4px oklch(0.78 0.16 75 / 0.3);
  --glow-gold-lg:   0 0 32px oklch(0.78 0.16 75 / 0.2), 0 0 8px oklch(0.78 0.16 75 / 0.4);
  --glow-cyan-sm:   0 0 8px oklch(0.78 0.14 195 / 0.15);
  --glow-cyan-md:   0 0 16px oklch(0.78 0.14 195 / 0.2), 0 0 4px oklch(0.78 0.14 195 / 0.3);
  --glow-danger:    0 0 12px oklch(0.62 0.22 25 / 0.25);
  --glow-success:   0 0 12px oklch(0.68 0.18 155 / 0.25);

  /* --- Elevation: layered panel depth --- */
  --elevation-1:    0 1px 3px oklch(0 0 0 / 0.4);
  --elevation-2:    0 2px 8px oklch(0 0 0 / 0.5), 0 1px 2px oklch(0 0 0 / 0.3);
  --elevation-3:    0 4px 16px oklch(0 0 0 / 0.6), 0 2px 4px oklch(0 0 0 / 0.3);

  /* --- Transitions --- */
  --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:    cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast:  120ms;
  --duration-base:  200ms;
  --duration-slow:  350ms;

  /* --- Layout --- */
  --content-width:    72rem;   /* 1152px */
  --content-width-md: 56rem;   /* 896px */
  --content-width-sm: 48rem;   /* 768px */
  --nav-height:       3.5rem;
  --sidebar-width:    16rem;
}


/* ==========================================================================
   Layer 1 — Reset & Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--leading-normal);
  color: var(--star);
  background: var(--void);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-size: var(--text-base);
  background:
    radial-gradient(ellipse 120% 60% at 50% 0%, oklch(0.12 0.03 270 / 0.5) 0%, transparent 70%),
    var(--void);
}

/* Inline SVG icons: size them to match surrounding text by default */
svg:not([width]):not([class*="star"]) {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

::selection {
  background: oklch(0.78 0.16 75 / 0.3);
  color: var(--star);
}

:focus-visible {
  outline: 1.5px solid var(--gold);
  outline-offset: 2px;
}

a {
  color: var(--gold);
  text-decoration: none;
}

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font: inherit;
  color: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  line-height: var(--leading-tight);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-tight);
}


/* ==========================================================================
   Layer 2 — Layout Containers
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container-md {
  width: 100%;
  max-width: var(--content-width-md);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container-sm {
  width: 100%;
  max-width: var(--content-width-sm);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.page-section {
  padding-block: var(--space-12);
}


/* ==========================================================================
   Layer 3 — Navigation
   The nav bar: a thin instrument panel strip at the top of the viewport,
   like the status bar in a spacecraft cockpit
   ========================================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  border-bottom: 1px solid var(--border-subtle);
  background: oklch(0.08 0.015 270 / 0.85);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
}

.site-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.site-nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.site-nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* --- Brand mark --- */
.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--star);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.nav-brand svg {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--gold);
}

.nav-brand:hover {
  color: var(--gold-bright);
}

.nav-brand:hover svg {
  filter: drop-shadow(0 0 6px oklch(0.78 0.16 75 / 0.5));
}

/* --- Nav links --- */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--star-dim);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.nav-link:hover {
  color: var(--star);
  background: oklch(1 0 0 / 0.05);
}

.nav-link:active {
  background: oklch(1 0 0 / 0.08);
}

/* --- Nav user and actions --- */
.nav-user {
  color: var(--star-faint);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

.nav-action {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--star-dim);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.nav-action:hover {
  color: var(--star);
  background: oklch(1 0 0 / 0.05);
}

.nav-action-primary {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--gold-ghost);
  border-radius: var(--radius-full);
  color: var(--gold);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.nav-action-primary:hover {
  border-color: var(--gold);
  background: var(--gold-glow);
  box-shadow: var(--glow-gold-sm);
}


/* ==========================================================================
   Layer 4 — Flash Messages
   ========================================================================== */

.flash-notice,
.flash-alert {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}

.flash-notice {
  color: var(--planet-green);
  background: oklch(0.68 0.18 155 / 0.08);
  border-bottom-color: oklch(0.68 0.18 155 / 0.15);
}

.flash-alert {
  color: var(--danger);
  background: oklch(0.62 0.22 25 / 0.08);
  border-bottom-color: oklch(0.62 0.22 25 / 0.15);
}


/* ==========================================================================
   Layer 5 — Buttons
   ========================================================================== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: 1px solid var(--gold);
  border-radius: var(--radius-full);
  background: linear-gradient(
    180deg,
    oklch(0.78 0.16 75 / 0.15) 0%,
    oklch(0.78 0.16 75 / 0.05) 100%
  );
  color: var(--gold-bright);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--glow-gold-sm);
}

.btn-primary:hover {
  background: linear-gradient(
    180deg,
    oklch(0.78 0.16 75 / 0.25) 0%,
    oklch(0.78 0.16 75 / 0.10) 100%
  );
  box-shadow: var(--glow-gold-md);
  color: var(--gold-bright);
}

.btn-primary:active {
  background: oklch(0.78 0.16 75 / 0.20);
  box-shadow: var(--glow-gold-sm);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--star-dim);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--star-ghost);
  color: var(--star);
  background: oklch(1 0 0 / 0.04);
}

.btn-secondary:active {
  background: oklch(1 0 0 / 0.07);
}


/* ==========================================================================
   Layer 6 — Cards
   Dark glass panels — like instrument displays set into a cockpit bulkhead.
   Thin borders glow faintly, surfaces are near-black with subtle depth.
   ========================================================================== */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--void-surface);
  box-shadow: var(--elevation-1);
  overflow: hidden;
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.card-header h2,
.card-header h3 {
  font-size: var(--text-lg);
  color: var(--star);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}


/* ==========================================================================
   Layer 7 — Hero
   The opening vista: like looking out a viewport into deep space.
   Sparse, vast, with a single point of light drawing your eye.
   ========================================================================== */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60dvh;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 30%, oklch(0.15 0.04 270 / 0.6), transparent 70%),
    radial-gradient(circle at 20% 60%, oklch(0.12 0.03 300 / 0.3), transparent 40%),
    radial-gradient(circle at 80% 40%, oklch(0.10 0.03 200 / 0.3), transparent 40%);
  z-index: 0;
}

/* Starfield: CSS-generated sparse dots of varying brightness */
.hero-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, oklch(0.9 0 0 / 0.7), transparent),
    radial-gradient(1px 1px at 30% 70%, oklch(0.8 0 0 / 0.5), transparent),
    radial-gradient(1.5px 1.5px at 50% 10%, oklch(0.95 0.05 75 / 0.8), transparent),
    radial-gradient(1px 1px at 70% 50%, oklch(0.7 0 0 / 0.4), transparent),
    radial-gradient(1px 1px at 85% 80%, oklch(0.85 0.03 200 / 0.6), transparent),
    radial-gradient(1.5px 1.5px at 15% 85%, oklch(0.9 0.04 25 / 0.5), transparent),
    radial-gradient(1px 1px at 60% 35%, oklch(0.8 0 0 / 0.5), transparent),
    radial-gradient(1px 1px at 90% 15%, oklch(0.75 0 0 / 0.4), transparent),
    radial-gradient(1px 1px at 40% 90%, oklch(0.85 0 0 / 0.3), transparent),
    radial-gradient(1.5px 1.5px at 25% 45%, oklch(0.9 0.02 195 / 0.6), transparent);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: var(--space-8);
  max-width: 40rem;
}

.hero-title {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--star);
  margin-bottom: var(--space-4);
  text-shadow: 0 0 40px oklch(0.78 0.16 75 / 0.15);
}

.hero-subtitle {
  font-size: var(--text-lg);
  color: var(--star-faint);
  line-height: var(--leading-loose);
  max-width: 32rem;
  margin-inline: auto;
}

.hero-tagline {
  font-size: var(--text-base);
  color: var(--star-medium);
  font-style: italic;
  max-width: 28rem;
  margin-inline: auto;
}

.hero-actions,
.hero-actions-guest {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}


/* ==========================================================================
   Layer 8 — Stats Grid (Dashboard)
   Instrument readouts — monospaced values that glow with their accent color
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-8);
}

.stat-card {
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--void-surface);
  text-align: center;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}

/* Stat accent colors — each readout glows with its own hue,
   like different instruments on a panel */
.stat-value-indigo {
  color: oklch(0.70 0.18 280);
  text-shadow: 0 0 20px oklch(0.70 0.18 280 / 0.3);
}

.stat-value-purple {
  color: var(--planet-violet);
  text-shadow: 0 0 20px oklch(0.58 0.18 300 / 0.3);
}

.stat-value-cyan {
  color: var(--cyan);
  text-shadow: 0 0 20px oklch(0.78 0.14 195 / 0.3);
}

.stat-label {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--star-ghost);
  letter-spacing: var(--tracking-mega);
  text-transform: uppercase;
}


/* ==========================================================================
   Layer 9 — Featured Section & Mission Grid
   ========================================================================== */

/* --- Pitch section ---
   Three-column value props below the hero */
.pitch-section {
  max-width: 64rem;
  margin-inline: auto;
  padding: var(--space-16) var(--space-6) var(--space-8);
}

.pitch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
}

.pitch-card h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  color: var(--star);
  margin-bottom: var(--space-2);
}

.pitch-card p {
  font-size: var(--text-sm);
  color: var(--star-faint);
  line-height: var(--leading-loose);
}

/* --- Featured section --- */
.featured-section {
  max-width: 64rem;
  margin-inline: auto;
  padding: var(--space-12) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

.featured-section h2 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semi);
  color: var(--star);
  margin-bottom: var(--space-2);
}

.featured-subtitle {
  font-size: var(--text-base);
  color: var(--star-faint);
  margin-bottom: var(--space-8);
}

.featured-cta {
  margin-top: var(--space-8);
  text-align: center;
}

/* --- Mission card header (badge + time) --- */
.mission-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.mission-card-time {
  font-size: var(--text-xs);
  color: var(--star-ghost);
}

/* --- Vinge quote section --- */
.vinge-section {
  max-width: 40rem;
  margin-inline: auto;
  padding: var(--space-16) var(--space-6);
  text-align: center;
}

.vinge-quote {
  margin: 0;
  padding: 0;
}

.vinge-quote p {
  font-size: var(--text-lg);
  color: var(--star-medium);
  font-style: italic;
  line-height: var(--leading-loose);
  margin-bottom: var(--space-3);
}

.vinge-quote cite {
  font-size: var(--text-sm);
  color: var(--star-ghost);
  font-style: normal;
}

.vinge-cite-link {
  color: var(--star-ghost);
  text-decoration: underline;
  text-decoration-color: var(--border-subtle);
  text-underline-offset: 2px;
}

.vinge-cite-link:hover {
  color: var(--star-faint);
}

/* --- Vinge full-page styles --- */
.vinge-page-header {
  margin-bottom: var(--space-10);
}

.vinge-page-header h1 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--star);
  margin-bottom: var(--space-3);
}

.vinge-page-header p {
  font-size: var(--text-base);
  color: var(--star-faint);
  line-height: var(--leading-loose);
}

.vinge-passage p {
  font-size: var(--text-base);
  color: var(--star-dim);
  line-height: var(--leading-loose);
  margin-bottom: var(--space-4);
}

.vinge-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin-block: var(--space-8);
}

.vinge-page-footer {
  margin-top: var(--space-10);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--star-ghost);
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: var(--space-5);
}

.mission-grid-sm {
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}

/* --- Mission card ---
   Each mission is a dark panel with a subtle colored top edge
   that hints at its difficulty level */
.mission-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--void-surface);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.mission-card:hover {
  border-color: var(--gold-ghost);
  background: var(--void-raised);
  box-shadow: var(--glow-gold-sm);
}

.mission-card-compact {
  padding: var(--space-4) var(--space-5);
}

.mission-card h3 {
  font-size: var(--text-base);
  font-weight: var(--weight-semi);
  color: var(--star);
  margin-bottom: var(--space-2);
}

.mission-card-badge {
  margin-bottom: var(--space-3);
}

.mission-card-description {
  font-size: var(--text-sm);
  color: var(--star-faint);
  line-height: var(--leading-normal);
  flex: 1;
}

.mission-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
}

.mission-card-info {
  color: var(--star-ghost);
}


/* ==========================================================================
   Layer 10 — Badges (Difficulty Levels)
   Colored pips, like status indicators on a console.
   Each difficulty has its own color from the planetary palette.
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-lg {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

/* Each difficulty maps to a celestial color:
   Tutorial  = ice blue (safe, calm — like a distant gas giant)
   Beginner  = green (the departure world)
   Intermediate = amber (the sun's influence grows)
   Advanced  = blue-violet (deep space)
   Expert    = planet red (the destination, Mars-like)
   Insane    = white-hot (stellar intensity) */

.badge-tutorial {
  color: var(--planet-ice);
  background: oklch(0.72 0.08 220 / 0.12);
  border-color: oklch(0.72 0.08 220 / 0.25);
}

.badge-beginner {
  color: var(--planet-green);
  background: oklch(0.68 0.18 155 / 0.10);
  border-color: oklch(0.68 0.18 155 / 0.25);
}

.badge-intermediate {
  color: var(--planet-amber);
  background: oklch(0.72 0.16 60 / 0.10);
  border-color: oklch(0.72 0.16 60 / 0.25);
}

.badge-advanced {
  color: var(--planet-violet);
  background: oklch(0.58 0.18 300 / 0.10);
  border-color: oklch(0.58 0.18 300 / 0.25);
}

.badge-expert {
  color: var(--planet-red);
  background: oklch(0.62 0.20 25 / 0.10);
  border-color: oklch(0.62 0.20 25 / 0.25);
}

.badge-insane {
  color: oklch(0.92 0.05 75);
  background: oklch(0.92 0.05 75 / 0.10);
  border-color: oklch(0.92 0.05 75 / 0.25);
  text-shadow: 0 0 8px oklch(0.92 0.05 75 / 0.5);
}


/* ==========================================================================
   Layer 11 — Stars (Score Display)
   Five-point rating rendered as small glowing dots
   ========================================================================== */

.stars {
  display: inline-flex;
  gap: var(--space-1);
  font-size: var(--text-lg);
}

.stars-sm {
  font-size: var(--text-sm);
  gap: 2px;
}

.star-filled {
  color: var(--gold);
  text-shadow: 0 0 6px oklch(0.78 0.16 75 / 0.5);
}

.star-empty {
  color: var(--star-ghost);
}


/* ==========================================================================
   Layer 12 — Page Headers & Breadcrumbs
   ========================================================================== */

.page-header {
  margin-bottom: var(--space-8);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--star);
  letter-spacing: var(--tracking-tight);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}

.breadcrumb a {
  color: var(--star-faint);
}

.breadcrumb a:hover {
  color: var(--gold);
}

.breadcrumb-sep {
  color: var(--star-ghost);
}

.breadcrumb-current {
  color: var(--star-dim);
}


/* ==========================================================================
   Layer 13 — Filter Tabs (Missions Index)
   Toggle switches along a panel strip
   ========================================================================== */

.filter-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--void-shallow);
  margin-bottom: var(--space-8);
  overflow-x: auto;
  flex-wrap: wrap;
}

.filter-tab {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--star-faint);
  white-space: nowrap;
  border: none;
  background: transparent;
  cursor: pointer;
  letter-spacing: var(--tracking-wide);
}

.filter-tab:hover {
  color: var(--star);
  background: oklch(1 0 0 / 0.05);
}

.filter-tab-active {
  color: var(--gold);
  background: oklch(0.78 0.16 75 / 0.10);
}


/* ==========================================================================
   Layer 14 — Difficulty Groups (Missions Index)
   ========================================================================== */

.difficulty-group {
  margin-bottom: var(--space-10);
}

.difficulty-group-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.difficulty-group-header h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semi);
  color: var(--star);
}

.difficulty-group-count {
  font-size: var(--text-sm);
  color: var(--star-ghost);
  font-family: var(--font-mono);
}


/* ==========================================================================
   Layer 15 — Mission Detail (Crux Show)
   ========================================================================== */

.mission-detail {
  margin-bottom: var(--space-6);
}

.mission-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.meta-text {
  font-size: var(--text-sm);
  color: var(--star-dim);
}

.meta-muted {
  font-size: var(--text-sm);
  color: var(--star-ghost);
}

.mission-detail-description {
  font-size: var(--text-base);
  color: var(--star-dim);
  line-height: var(--leading-loose);
}

/* --- Conditions sections --- */
.conditions-section {
  margin-top: var(--space-6);
}

.conditions-heading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--weight-semi);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.conditions-heading-victory {
  color: var(--success);
}

.conditions-heading-failure {
  color: var(--danger);
}

.conditions-heading-hints {
  color: var(--cyan);
}

.conditions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.conditions-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--void-shallow);
  font-size: var(--text-sm);
  color: var(--star-dim);
}

.icon-victory {
  color: var(--success);
  flex-shrink: 0;
}

.icon-failure {
  color: var(--danger);
  flex-shrink: 0;
}

.icon-hint {
  color: var(--cyan);
  flex-shrink: 0;
}

.hint-item {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--void-shallow);
  font-size: var(--text-sm);
  color: var(--star-faint);
}

/* --- Launch footer --- */
.launch-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.best-score {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.score-value {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--gold);
}

.score-stars {
  display: inline-flex;
  align-items: center;
}

.section-link {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--cyan);
  letter-spacing: var(--tracking-wide);
}

.section-link:hover {
  color: var(--cyan-bright);
  text-shadow: var(--glow-cyan-sm);
}


/* ==========================================================================
   Layer 16 — Simulation HUD (Crux Play)
   A cockpit instrument bar above the 3D canvas. The HUD sits in normal
   document flow as a horizontal strip; the canvas fills remaining height.
   ========================================================================== */

.sim-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--void);
}

.sim-canvas {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* --- HUD bar --- */
.sim-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--void-shallow);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.sim-hud-left,
.sim-hud-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* --- HUD elements --- */
.sim-back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--star-faint);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
}

.sim-back-link:hover {
  color: var(--star);
  background: oklch(1 0 0 / 0.05);
}

.sim-back-link svg {
  width: 1rem;
  height: 1rem;
}

.sim-mission-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semi);
  color: var(--star);
}

/* --- Clock display ---
   Like a digital mission elapsed timer on a cockpit panel */
.sim-clock {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sim-clock-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--star-ghost);
  letter-spacing: var(--tracking-mega);
  text-transform: uppercase;
}

.sim-clock-value {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--cyan);
  letter-spacing: var(--tracking-wide);
  text-shadow: 0 0 12px oklch(0.78 0.14 195 / 0.3);
}

/* --- Time controls --- */
.sim-time-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background: oklch(0.08 0.015 270 / 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
}

.sim-time-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  color: var(--star-faint);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  border: none;
  background: transparent;
  cursor: pointer;
}

.sim-time-btn:hover {
  color: var(--star);
  background: oklch(1 0 0 / 0.08);
}

.sim-time-btn.active {
  color: var(--gold);
  background: oklch(0.78 0.16 75 / 0.12);
}

/* --- Fuel gauge ---
   A critical instrument: the fuel bar glows gold when healthy,
   fades to red as it depletes — like the 0.001 reading Wili saw */
.sim-fuel {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-left: var(--space-3);
  border-left: 1px solid var(--border);
}

.sim-fuel-gauge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sim-fuel-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--star-ghost);
  letter-spacing: var(--tracking-mega);
  text-transform: uppercase;
}

.sim-fuel-bar-track {
  width: 5rem;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--void-overlay);
  overflow: hidden;
}

.sim-fuel-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gold);
  box-shadow: 0 0 8px oklch(0.78 0.16 75 / 0.4);
  transition: width var(--duration-base) var(--ease-out);
}

/* --- Delta-V readout --- */
.sim-dv {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding-left: var(--space-3);
  border-left: 1px solid var(--border);
}

.sim-dv-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--star-ghost);
  letter-spacing: var(--tracking-mega);
  text-transform: uppercase;
}

.sim-dv-value {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--gold);
  text-shadow: 0 0 10px oklch(0.78 0.16 75 / 0.25);
}

.sim-dv-unit {
  font-size: var(--text-xs);
  color: var(--star-ghost);
  margin-left: var(--space-1);
}

/* --- Mission result overlay --- */
.sim-message-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.sim-message-panel {
  background: oklch(0.08 0.015 270 / 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  max-width: 24rem;
}

.sim-message--success {
  border-color: var(--planet-green);
  box-shadow: var(--glow-success);
}

.sim-message--failure {
  border-color: var(--danger);
  box-shadow: var(--glow-danger);
}

.sim-message-heading {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-2);
}

.sim-message--success .sim-message-heading {
  color: var(--planet-green);
}

.sim-message--failure .sim-message-heading {
  color: var(--danger);
}

.sim-message-text {
  color: var(--star-dim);
  margin-bottom: var(--space-5);
}

/* --- Completion overlay --- */

.completion-panel {
  max-width: 28rem;
  min-width: 22rem;
}

.completion-crux-name {
  color: var(--star-dim);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.completion-stars {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
}

.completion-stars .star-filled {
  color: var(--gold);
  filter: drop-shadow(0 0 4px oklch(0.78 0.16 75 / 0.5));
}

.completion-stars .star-empty {
  color: var(--star-ghost);
}

.completion-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
  padding: var(--space-4);
  background: oklch(0.06 0.01 270 / 0.5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.completion-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.completion-stat-label {
  font-size: var(--text-xs);
  color: var(--star-ghost);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mega);
}

.completion-stat-value {
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  color: var(--star);
}

.completion-section-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  color: var(--star-dim);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mega);
}

.completion-leaderboard {
  margin-bottom: var(--space-5);
}

.completion-leaderboard-table {
  font-size: var(--text-sm);
}

.completion-leaderboard-table th {
  padding: var(--space-2) var(--space-3);
}

.completion-leaderboard-table td {
  padding: var(--space-2) var(--space-3);
}

.completion-leaderboard-empty {
  color: var(--star-ghost);
  font-size: var(--text-sm);
  font-style: italic;
}

.completion-loading {
  color: var(--star-ghost);
  font-size: var(--text-sm);
}

.completion-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

.completion-signup-box {
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  background: oklch(0.06 0.01 270 / 0.5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.completion-signup-text {
  font-size: var(--text-sm);
  color: var(--star-dim);
  margin-bottom: var(--space-3);
  line-height: 1.5;
}

.completion-signup-form {
  display: flex;
  gap: var(--space-2);
}

.completion-signup-form .form-input {
  flex: 1;
  font-size: var(--text-sm);
}

.completion-signup-btn {
  white-space: nowrap;
}

.completion-signup-status {
  font-size: var(--text-sm);
  margin-top: var(--space-2);
}

.completion-signup-success {
  color: var(--planet-green);
}

/* --- Burn planner debug panel --- */
.sim-burn-panel {
  position: absolute;
  bottom: var(--space-4);
  right: var(--space-4);
  z-index: 15;
  width: 18rem;
  padding: var(--space-4);
  background: oklch(0.08 0.015 270 / 0.90);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--star-dim);
}

.sim-burn-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: var(--space-3);
}

.sim-burn-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 2.5rem 2rem;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.sim-burn-row label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--star-ghost);
}

.sim-burn-row input[type="range"] {
  width: 100%;
  height: 4px;
  appearance: none;
  background: var(--void-overlay);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.sim-burn-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  border: none;
  cursor: pointer;
}

.sim-burn-row input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  border: none;
  cursor: pointer;
}

.sim-burn-value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--cyan-bright);
  text-align: right;
}

.sim-burn-unit {
  font-size: var(--text-xs);
  color: var(--star-ghost);
}

.sim-burn-info {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--star-faint);
  margin: var(--space-3) 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.sim-burn-info strong {
  color: var(--gold);
}

.sim-burn-position {
  display: block;
  margin-top: var(--space-1);
}

.sim-burn-position strong {
  color: var(--cyan-bright);
}

/* --- Orbital info readout --- */
.sim-orbit-info {
  margin: var(--space-2) 0 var(--space-3);
  padding: var(--space-2);
  background: var(--void-shallow);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.sim-orbit-info-row {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
  margin-bottom: 2px;
}

.sim-orbit-info-row:last-child {
  margin-bottom: 0;
}

.sim-orbit-info-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: var(--weight-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--star-ghost);
  width: 3.5rem;
  flex-shrink: 0;
}

.sim-orbit-info-data {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--gold-dim);
}

.sim-orbit-info-preview {
  color: var(--cyan);
}

.sim-burn-hint {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--star-ghost);
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

/* --- Vertical burn-position slider (left edge) --- */
.sim-burn-at {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  height: 60%;
}

.sim-burn-at-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  appearance: slider-vertical;
  width: 28px;
  height: 100%;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

/* Track styling */
.sim-burn-at-slider::-webkit-slider-runnable-track {
  width: 4px;
  height: 100%;
  background: var(--void-overlay);
  border-radius: var(--radius-full);
}

.sim-burn-at-slider::-moz-range-track {
  width: 4px;
  height: 100%;
  background: var(--void-overlay);
  border-radius: var(--radius-full);
}

/* Thumb styling */
.sim-burn-at-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid var(--void);
  box-shadow: 0 0 6px oklch(0.78 0.14 195 / 0.4);
  margin-left: -7px;
  cursor: pointer;
}

.sim-burn-at-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid var(--void);
  box-shadow: 0 0 6px oklch(0.78 0.14 195 / 0.4);
  cursor: pointer;
}

.sim-burn-actions {
  display: flex;
  gap: var(--space-2);
}

.sim-burn-btn {
  flex: 1;
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sim-burn-btn--commit {
  color: var(--gold);
  border-color: var(--gold-ghost);
}

.sim-burn-btn--commit:hover {
  background: oklch(0.78 0.16 75 / 0.12);
  border-color: var(--gold-dim);
}

.sim-burn-btn--reset {
  color: var(--star-ghost);
}

.sim-burn-btn--reset:hover {
  color: var(--star-dim);
  background: oklch(1 0 0 / 0.05);
}


/* ==========================================================================
   Layer 17 — Auth Forms (Sign In / Sign Up)
   A single luminous panel floating in the void, like a terminal
   in the corner of Tellman's shop
   ========================================================================== */

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - var(--nav-height));
  padding: var(--space-6);
}

.auth-box {
  width: 100%;
  max-width: 24rem;
  padding: var(--space-8);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--void-surface);
  box-shadow: var(--elevation-2);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-header h1 {
  font-size: var(--text-2xl);
  color: var(--star);
  letter-spacing: var(--tracking-wide);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.form-errors {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: oklch(0.62 0.22 25 / 0.08);
  border: 1px solid oklch(0.62 0.22 25 / 0.2);
  color: var(--danger);
  font-size: var(--text-sm);
}

.form-label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--star-dim);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--void-shallow);
  color: var(--star);
  font-size: var(--text-base);
}

.form-input::placeholder {
  color: var(--star-ghost);
}

.form-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px oklch(0.78 0.16 75 / 0.15);
}

.form-submit {
  width: 100%;
  padding: var(--space-3) var(--space-6);
  border: 1px solid var(--gold);
  border-radius: var(--radius-full);
  background: linear-gradient(
    180deg,
    oklch(0.78 0.16 75 / 0.15) 0%,
    oklch(0.78 0.16 75 / 0.05) 100%
  );
  color: var(--gold-bright);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--glow-gold-sm);
}

.form-submit:hover {
  background: linear-gradient(
    180deg,
    oklch(0.78 0.16 75 / 0.25) 0%,
    oklch(0.78 0.16 75 / 0.10) 100%
  );
  box-shadow: var(--glow-gold-md);
}

.form-footer {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--star-faint);
}

.form-footer a {
  color: var(--gold);
  font-weight: var(--weight-medium);
}

.form-footer a:hover {
  color: var(--gold-bright);
}


/* ==========================================================================
   Layer 18 — Lessons
   ========================================================================== */

.lessons-header {
  margin-bottom: var(--space-8);
}

.lessons-header h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--star);
}

/* --- Module list --- */
.module-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.module-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--void-surface);
  overflow: hidden;
}

.module-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: var(--void-shallow);
  border-bottom: 1px solid var(--border-subtle);
}

.module-header h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  color: var(--star);
}

.module-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: oklch(0.78 0.14 195 / 0.10);
  border: 1px solid oklch(0.78 0.14 195 / 0.25);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
}

/* --- Lesson list --- */
.lesson-list {
  list-style: none;
}

.lesson-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  color: var(--star-dim);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
}

.lesson-link:last-child {
  border-bottom: none;
}

.lesson-link:hover {
  background: oklch(1 0 0 / 0.03);
  color: var(--star);
}

.lesson-link-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.lesson-number {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--star-ghost);
  min-width: 1.75rem;
}

.lesson-title {
  font-weight: var(--weight-medium);
}

/* --- Lesson show --- */
.lesson-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--star-faint);
  margin-bottom: var(--space-4);
}

.lesson-content {
  padding: var(--space-6);
  font-size: var(--text-base);
  color: var(--star-dim);
  line-height: var(--leading-loose);
}

.lesson-content h2 {
  font-size: var(--text-xl);
  color: var(--star);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

.lesson-content h3 {
  font-size: var(--text-lg);
  color: var(--star);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

.lesson-content p {
  margin-bottom: var(--space-4);
}

.lesson-content ul,
.lesson-content ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

.lesson-content li {
  margin-bottom: var(--space-2);
}

.lesson-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  background: var(--void-raised);
  color: var(--cyan);
}

.lesson-content pre {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--void-shallow);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

.lesson-content pre code {
  padding: 0;
  background: none;
}

.lesson-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.lesson-practice {
  padding: var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: oklch(0.78 0.16 75 / 0.03);
}


/* ==========================================================================
   Layer 19 — Leaderboard
   A ranked table — the arcade scoreboard at Tellman's shop.
   Top 3 get their own glow colors: gold, silver, bronze.
   ========================================================================== */

.leaderboard {
  margin-bottom: var(--space-4);
}

.leaderboard h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--star);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  color: var(--star-ghost);
  letter-spacing: var(--tracking-mega);
  text-transform: uppercase;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--star-dim);
  border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-row-highlight td {
  background: oklch(0.78 0.16 75 / 0.04);
}

/* Rank badges: the top 3 glow like medals */
.rank-gold {
  color: var(--gold);
  font-weight: var(--weight-bold);
  text-shadow: 0 0 8px oklch(0.78 0.16 75 / 0.4);
}

.rank-silver {
  color: oklch(0.80 0.02 250);
  font-weight: var(--weight-bold);
  text-shadow: 0 0 8px oklch(0.80 0.02 250 / 0.3);
}

.rank-bronze {
  color: oklch(0.68 0.10 55);
  font-weight: var(--weight-bold);
  text-shadow: 0 0 8px oklch(0.68 0.10 55 / 0.3);
}

.rank-default {
  color: var(--star-ghost);
  font-family: var(--font-mono);
}

.player-name {
  font-weight: var(--weight-medium);
  color: var(--star);
}

.score-text {
  font-family: var(--font-mono);
  color: var(--cyan);
}

.text-right {
  text-align: right;
}

.mono-text {
  font-family: var(--font-mono);
}


/* ==========================================================================
   Layer 20 — Empty States
   ========================================================================== */

.empty-state {
  padding: var(--space-16) var(--space-8);
  text-align: center;
  color: var(--star-faint);
  font-size: var(--text-base);
}


/* ==========================================================================
   Layer 21 — Transitions
   Applied via the .transition utility class
   ========================================================================== */

.transition {
  transition-property: color, background-color, border-color, box-shadow, opacity, transform, filter;
  transition-duration: var(--duration-base);
  transition-timing-function: var(--ease-out);
}


/* ==========================================================================
   Layer 22 — Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
  :root {
    --text-4xl: 2.25rem;
    --text-3xl: 1.75rem;
    --text-2xl: 1.5rem;
  }

  .hero {
    min-height: 50dvh;
  }

  .hero-content {
    padding: var(--space-6);
  }

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

  .pitch-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

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

  .site-nav-inner {
    padding-inline: var(--space-4);
  }

  .nav-links {
    display: none;
  }

  .sim-hud {
    flex-wrap: wrap;
    padding: var(--space-2) var(--space-3);
  }

  .filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .container,
  .container-md,
  .container-sm {
    padding-inline: var(--space-4);
  }

  .auth-box {
    padding: var(--space-6);
  }

  .module-header {
    padding: var(--space-3) var(--space-4);
  }

  .lesson-link {
    padding: var(--space-3) var(--space-4);
  }

  .launch-footer {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  :root {
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
  }

  .hero-actions,
  .hero-actions-guest {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn-primary,
  .hero-actions .btn-secondary,
  .hero-actions-guest .btn-primary,
  .hero-actions-guest .btn-secondary {
    width: 100%;
  }

  .sim-hud {
    flex-wrap: wrap;
  }
}


/* ==========================================================================
   Layer 23 — Scrollbar Styling
   Thin, subtle — part of the cockpit aesthetic
   ========================================================================== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--star-ghost);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}


/* ==========================================================================
   Visual Assets Needed (Placeholders)
   --------------------------------------------------------------------------
   The following visual elements are referenced or anticipated by this design
   system and should be provided in later iterations:

   1. LOGO
      - SVG mark for the nav brand (currently inline SVG with orbit rings)
      - Should evoke: orbital paths, the "glowing volume", celestial mechanics
      - Colors: gold (#d4a843-ish) on void background

   2. FAVICON / APP ICON
      - Simplified version of logo for 16px, 32px, 180px sizes
      - The golden spark against black

   3. HERO ILLUSTRATION
      - Optional: a subtle background illustration for the dashboard hero
      - Could be: a stylized solar system diagram, or the "two-meter screen"
        from Vinge's description

   4. DIFFICULTY ICONS
      - Small icons (16px) for each difficulty tier
      - Could be: planetary symbols, orbit complexity diagrams

   5. EMPTY STATE ILLUSTRATIONS
      - Light, line-art illustrations for empty states
      - Themes: empty orbit, quiet solar system, spacecraft at rest

   6. ENGINE TYPE ICONS
      - Icons for each propulsion type in the ship catalog
      - Chemical, Ion, Nuclear, Fusion, Antimatter, Exotic

   7. ACHIEVEMENT / COMPLETION MARKS
      - Small marks for completed lessons and missions
      - Gold ring or checkmark with glow effect
   ========================================================================== */


/* ==========================================================================
   Pricing Page
   ========================================================================== */

.pricing-header {
  text-align: center;
  margin-bottom: var(--space-16);
}

.pricing-subtitle {
  color: var(--star-dim);
  font-size: var(--text-lg);
  margin-top: var(--space-3);
  max-width: 36rem;
  margin-inline: auto;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 48rem;
  margin: var(--space-8) auto;
}

.pricing-card {
  position: relative;
  background: var(--void-shallow);
  border: 1px solid var(--border);
  padding: var(--space-8) var(--space-6);
  display: flex;
  flex-direction: column;
}

/* Connected card edges: only round the outer corners */
.pricing-card:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  border-right: none;
}

.pricing-card:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  border-left: none;
}

.pricing-card:not(:first-child):not(:last-child) {
  border-radius: 0;
}

.pricing-card-featured {
  border: 1px solid var(--gold);
  box-shadow: var(--glow-gold-md);
  z-index: 1;
  margin: calc(-1 * var(--space-6)) 0;
  padding-top: calc(var(--space-8) + var(--space-6));
  padding-bottom: calc(var(--space-8) + var(--space-6));
  border-radius: var(--radius-lg);
}

.pricing-card-badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--gold);
  color: var(--void);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.pricing-card-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.pricing-card-header h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  color: var(--star-dim);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

.pricing-price {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  color: var(--star);
  line-height: var(--leading-tight);
}

.pricing-card-featured .pricing-price {
  color: var(--gold-bright);
}

.pricing-period {
  font-size: var(--text-sm);
  color: var(--star-ghost);
  margin-top: var(--space-1);
}

.pricing-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  flex: 1;
  text-align: left;
}

.pricing-features li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--star-dim);
}

.pricing-features li svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  color: var(--planet-green);
  margin-top: 0.25em;
}

.pricing-feature-disabled {
  opacity: 0.4;
}

.pricing-feature-disabled svg {
  color: var(--star-ghost) !important;
}

.pricing-cta {
  width: 100%;
  text-align: center;
  justify-content: center;
  margin-top: auto;
  white-space: nowrap;
}

.pricing-active-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: oklch(0.68 0.18 155 / 0.1);
  border: 1px solid oklch(0.68 0.18 155 / 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-6);
  color: var(--planet-green);
  font-weight: var(--weight-semi);
  max-width: 36rem;
  margin-inline: auto;
}

.pricing-active-banner svg {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}

.pricing-manage {
  text-align: center;
  margin-top: var(--space-6);
}


/* Pricing widget — landing page section wrapping the shared pricing cards */

.pricing-widget-section {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

.pricing-widget-section h2 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-2);
}

.pricing-widget-subtitle {
  color: var(--star-dim);
  margin-bottom: var(--space-16);
}


/* ==========================================================================
   Mission Lock Indicator
   ========================================================================== */

.mission-card-locked {
  opacity: 0.55;
  pointer-events: auto;
}

.mission-card-locked .mission-lock {
  display: flex;
}

.mission-lock {
  display: none;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--star-ghost);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.mission-lock svg {
  width: 0.9em;
  height: 0.9em;
}

/* Ship Picker */

.ship-picker {
  border-top: 1px solid var(--border-subtle);
}

.ship-tabs {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0;
}

.ship-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--star-ghost);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  margin-bottom: -1px;
}

.ship-tab:hover {
  color: var(--star-dim);
}

.ship-tab-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.ship-tab-count {
  font-size: var(--text-xs);
  color: var(--star-ghost);
  background: var(--void);
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-full);
  min-width: 1.2rem;
  text-align: center;
}

.ship-tab-active .ship-tab-count {
  background: oklch(0.78 0.16 75 / 0.12);
  color: var(--gold-dim);
}

.ship-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.ship-picker-grid.hidden {
  display: none;
}

.ship-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--void);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  color: var(--star-dim);
  font-family: inherit;
  font-size: var(--text-sm);
  min-width: 0;
}

.ship-card:hover {
  border-color: var(--gold-ghost);
  color: var(--star);
}

.ship-card-active {
  border-color: var(--gold-dim);
  background: oklch(0.78 0.16 75 / 0.06);
  color: var(--star);
  box-shadow: var(--glow-gold-sm);
}

.ship-card-name {
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.ship-card-class {
  font-size: var(--text-xs);
  color: var(--star-ghost);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ship-stats {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--void);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.ship-stats-header {
  margin-bottom: var(--space-3);
}

.ship-stats-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  color: var(--gold);
}

.ship-stats-class {
  font-size: var(--text-sm);
  color: var(--star-ghost);
}

.ship-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: var(--space-3);
}

.ship-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.ship-stat-wide {
  grid-column: span 2;
}

.ship-stat-label {
  font-size: var(--text-xs);
  color: var(--star-ghost);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ship-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--cyan);
  text-shadow: var(--glow-cyan-sm);
}

.premium-gate {
  display: flex;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
}

.premium-gate-card {
  text-align: center;
  background: var(--void);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-10);
  max-width: 22rem;
  width: 100%;
}

.premium-gate-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  background: oklch(0.78 0.16 75 / 0.08);
  border: 1px solid oklch(0.78 0.16 75 / 0.2);
  border-radius: var(--radius-full);
}

.premium-gate-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--gold-dim);
}

.premium-gate-card h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  margin-bottom: var(--space-2);
}

.premium-gate-card p {
  color: var(--star-dim);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}


/* Responsive pricing */
@media (max-width: 768px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 24rem;
  }

  .pricing-card,
  .pricing-card:first-child,
  .pricing-card:last-child {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  }

  .pricing-card-featured {
    border-color: var(--gold);
  }
}
