/* ═══════════════════════════════════════════════════════════
   GLOBAL STYLESHEET — Ashes of Command Interactive GDD v5.9.1
   ───────────────────────────────────────────────────────────
   Dark sci-fi command-console theme for the interactive
   Game Design Document browser. All visual styling lives here;
   no component-level CSS files exist.

   Sections:
     1. Imports & Variables   – Fonts, faction colors, spacing tokens
     2. Reset & Base          – Box-model reset, scrollbars, body
     3. Typography            – Headings, code, links
     4. Layout                – App shell, sidebar, main content
     5. Navigation            – Sidebar nav tree, chapter links
     6. Cards & Components    – Generic cards, faction cards, stat bars
     7. Dashboard             – Landing-page header & summary bar
     8. Search Overlay        – Ctrl+K command-palette search
     9. Back to Top           – Floating scroll-to-top button
    10. Hamburger / Mobile    – Mobile nav toggle & responsive rules
    11. Utility Classes       – Shared helpers, animations, scanline FX

   Dependencies: Google Fonts (Rajdhani, Orbitron, JetBrains Mono,
                 Share Tech Mono) loaded via @import below.
   ═══════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════
   1. IMPORTS & VARIABLES
   ═══════════════════════════════════════════════════════════ */

/* ── Font Import ──
   Rajdhani     → body text
   Orbitron     → headings, UI labels
   JetBrains    → code, stats, monospace data
   Share Tech   → decorative mono (version tags, footers)       */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@300;400;500;600;700&family=Orbitron:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@300;400;500;600;700&family=Share+Tech+Mono&display=swap');

/* ── CSS Custom Properties ──
   Faction colors map 1-to-1 with the seven playable factions.
   Background scale goes from darkest (base) to lightest (hover).
   Text scale goes from dimmest (dim) to brightest (hi).          */
:root {
  /* Faction accent colors */
  --terran: #00b4ff;
  --shards: #00ffee;
  --horde: #ff6622;
  --necro: #44ff66;
  --accord: #ffaa22;
  --vorax: #ff2266;
  --guardians: #cc44ff;

  /* Background scale (dark → light) */
  --bg-base: #07080c;
  --bg-panel: #0c0e14;
  --bg-card: #10131b;
  --bg-hover: #161a26;

  /* Border opacity levels */
  --border: rgba(255,255,255,0.05);
  --border-hi: rgba(255,255,255,0.12);

  /* Text luminance scale (dim → bright) */
  --text-dim: #445566;
  --text-mid: #778899;
  --text-body: #b8beca;
  --text-hi: #e0e4ec;

  /* Primary UI accent (Terran blue) */
  --accent: #00b4ff;

  /* Layout tokens */
  --sidebar-w: 260px;
  --transition: 0.2s ease;
}


/* ═══════════════════════════════════════════════════════════
   2. RESET & BASE
   ═══════════════════════════════════════════════════════════ */

/* ── Box-Model Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Custom Scrollbar ──
   Thin, dark scrollbar that blends with the console theme.
   Webkit rules for Chrome/Edge, standard props for Firefox.    */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

html {
  scrollbar-color: var(--border-hi) var(--bg-base);
  scrollbar-width: thin;
}

/* ── Body ── */
html, body {
  height: 100%;
}

body {
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg-base);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}


/* ═══════════════════════════════════════════════════════════
   3. TYPOGRAPHY
   ═══════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  font-family: 'Orbitron', sans-serif;
  color: var(--text-hi);
  letter-spacing: 0.04em;
  line-height: 1.3;
}

h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 500; }

code, pre, .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
}

.tech-mono {
  font-family: 'Share Tech Mono', monospace;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--text-hi);
}


/* ═══════════════════════════════════════════════════════════
   4. LAYOUT — App shell: sidebar + main content flex pair
   ═══════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──
   Fixed-position left panel. On mobile, slides off-screen via
   transform and is toggled by the hamburger button.             */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-subtitle {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 2px;
  letter-spacing: 0.06em;
}

.sidebar-subtitle-sm {
  font-family: 'Orbitron', monospace;
  font-size: 0.55rem;
  color: var(--accent);
  letter-spacing: 0.25em;
  opacity: 0.6;
  margin-top: -2px;
}

/* ── Dashboard "The Reclamation" subtitle ── */
.subtitle-reclamation {
  font-family: 'Orbitron', monospace;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.35em;
  opacity: 0.7;
  margin-top: -4px;
  margin-bottom: 8px;
}

/* ── Sidebar Filter ──
   Quick-filter input that narrows the chapter nav tree.         */
.sidebar-filter {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-filter input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 10px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  color: var(--text-body);
  outline: none;
  transition: border-color var(--transition);
}

.sidebar-filter input::placeholder {
  color: var(--text-dim);
}

.sidebar-filter input:focus {
  border-color: var(--accent);
}


/* ═══════════════════════════════════════════════════════════
   5. NAVIGATION — Sidebar chapter tree
   ═══════════════════════════════════════════════════════════ */

/* ── Nav Container ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* ── Part Group ──
   Each "Part" is a collapsible group of chapters.               */
.nav-part {
  margin-bottom: 2px;
}

.nav-part-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}

.nav-part-header:hover {
  color: var(--text-mid);
}

.nav-part-header .chevron {
  font-size: 0.5rem;
  transition: transform 0.2s ease;
  color: var(--text-dim);
}

.nav-part-header.collapsed .chevron {
  transform: rotate(-90deg);
}

/* ── Chapter List (collapsible) ── */
.nav-part-chapters {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.nav-part-chapters.collapsed {
  max-height: 0 !important;
}

/* ── Individual Chapter Link ── */
.nav-chapter {
  position: relative;
  display: block;
  padding: 5px 16px 5px 20px;
  font-size: 0.78rem;
  color: var(--text-mid);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.nav-chapter:hover {
  color: var(--text-hi);
  background: var(--bg-hover);
  border-left-color: var(--text-dim);
}

.nav-chapter.active {
  color: var(--text-hi);
  background: var(--bg-hover);
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-chapter .ch-num {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-right: 6px;
  min-width: 22px;
  display: inline-block;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── Sidebar Collapse Toggle ──
   Desktop-only button that slides the sidebar off-screen.       */
.sidebar-toggle {
  position: fixed;
  top: 12px;
  left: calc(var(--sidebar-w) + 8px);
  width: 28px;
  height: 28px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 101;
  transition: all 0.3s ease;
}

.sidebar-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

body.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}

body.sidebar-collapsed .sidebar-toggle {
  left: 8px;
}

body.sidebar-collapsed .main-content {
  margin-left: 0;
}

/* ── Main Content Area ──
   Offset by sidebar width on desktop; fills remaining space.    */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 24px 32px 60px;
  transition: margin-left 0.3s ease;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0,180,255,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0,180,255,0.02) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(204,68,255,0.015) 0%, transparent 50%),
    var(--bg-base);
}


/* ═══════════════════════════════════════════════════════════
   6. CARDS & COMPONENTS
   ═══════════════════════════════════════════════════════════ */

/* ── Generic Card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-hi);
  background: var(--bg-hover);
}

/* ── Faction Cards ──
   Moved to Section 7 (Dashboard) — see .faction-grid,
   .faction-card and related rules in the Dashboard section.
   Kept here as section marker only.                              */

/* ── Stat Bars ──
   Horizontal progress bars showing early/mid/late power curves. */
.stat-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-dim);
  width: 36px;
  text-transform: uppercase;
}

.stat-bar-track {
  flex: 1;
  height: 4px;
  background: var(--bg-base);
  border-radius: 2px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--faction-color, var(--accent));
  transition: width 0.6s ease;
}

.stat-value {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-mid);
  width: 24px;
  text-align: right;
}

/* ── NPC Badge ──
   Corner tag on non-playable factions (e.g. Core Guardians).   */
.npc-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--vorax);
  background: rgba(255, 34, 102, 0.1);
  border: 1px solid rgba(255, 34, 102, 0.3);
  padding: 2px 8px;
  border-radius: 2px;
  letter-spacing: 0.15em;
}


/* ═══════════════════════════════════════════════════════════
   7. DASHBOARD — Cinematic Hero Landing Page
   ═══════════════════════════════════════════════════════════ */

/* ── 7a. Hero Section — Full-Viewport Starfield ────────── */

.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: -24px -32px 0;
  padding: 60px 32px 40px;
}

/* CSS-only starfield — three layers of radial-gradient dots
   at different sizes and animation speeds for depth parallax.
   No canvas, no JS — pure CSS animation.                       */
.hero-starfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    /* Layer 1 — tiny distant stars (slow) */
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 25% 35%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 40% 8%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 55% 42%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 70% 22%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 85% 48%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 15% 55%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 30% 72%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 48% 60%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 62% 78%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 78% 65%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 92% 85%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 5% 90%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 35% 88%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 50% 95%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 68% 92%, rgba(255,255,255,0.6), transparent),
    /* Layer 2 — medium stars (medium speed) */
    radial-gradient(1.5px 1.5px at 8% 28%, rgba(180,220,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 22% 12%, rgba(180,220,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 38% 52%, rgba(180,220,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 52% 18%, rgba(180,220,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 68% 38%, rgba(180,220,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 82% 55%, rgba(180,220,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 95% 12%, rgba(180,220,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 18% 75%, rgba(180,220,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 45% 82%, rgba(180,220,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 75% 88%, rgba(180,220,255,0.7), transparent),
    /* Layer 3 — bright nearby stars (fast twinkle) */
    radial-gradient(2px 2px at 12% 45%, rgba(0,180,255,0.8), transparent),
    radial-gradient(2px 2px at 33% 25%, rgba(0,255,238,0.6), transparent),
    radial-gradient(2px 2px at 58% 70%, rgba(255,170,34,0.5), transparent),
    radial-gradient(2px 2px at 77% 15%, rgba(204,68,255,0.6), transparent),
    radial-gradient(2px 2px at 90% 45%, rgba(0,180,255,0.7), transparent),
    radial-gradient(2px 2px at 20% 85%, rgba(255,102,34,0.5), transparent),
    radial-gradient(2px 2px at 65% 55%, rgba(68,255,102,0.4), transparent);
  animation: starfieldDrift 120s linear infinite;
}

@keyframes starfieldDrift {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-20px); }
}

/* ── Hero Content ── */
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  animation: heroFadeIn 1.5s ease forwards;
}

@keyframes heroFadeIn {
  0%   { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Hero Title — Main game title with animated glow ── */
.hero-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.2em;
  margin-bottom: 8px;
  text-shadow:
    0 0 20px rgba(0,180,255,0.4),
    0 0 60px rgba(0,180,255,0.15),
    0 0 100px rgba(0,180,255,0.05);
  animation: titleGlow 4s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  0% {
    text-shadow:
      0 0 20px rgba(0,180,255,0.3),
      0 0 60px rgba(0,180,255,0.1),
      0 0 100px rgba(0,180,255,0.03);
  }
  100% {
    text-shadow:
      0 0 30px rgba(0,180,255,0.6),
      0 0 80px rgba(0,180,255,0.25),
      0 0 120px rgba(0,180,255,0.1);
  }
}

/* ── Hero Subtitle ── */
.hero-subtitle {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  color: var(--accent);
  letter-spacing: 0.4em;
  opacity: 0.75;
  margin-bottom: 8px;
}

/* ── Hero Version Tag ── */
.hero-version {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-bottom: 32px;
}

/* ── Hero Lore Quote — Cycles with fade animation ── */
.hero-lore-quote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 600px;
  margin: 0 auto;
  transition: opacity 0.5s ease;
}

.hero-lore-quote.quote-fading {
  opacity: 0;
}

.hero-lore-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-style: italic;
  color: var(--text-mid);
  line-height: 1.6;
  text-align: center;
}

.hero-lore-source {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

/* ── Scroll Indicator — Bouncing arrow at bottom of hero ── */
.hero-scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.5;
  transition: opacity 0.5s ease;
}

.hero-scroll-indicator.hidden {
  opacity: 0;
  pointer-events: none;
}

.hero-scroll-arrow {
  font-size: 0.8rem;
  color: var(--accent);
  animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

.hero-scroll-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.55rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}


/* ── 7b. Galactic Overview — SVG Spiral Galaxy ─────────── */

.galaxy-section {
  margin: 0;
  padding: 48px 24px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(0,180,255,0.04) 0%, rgba(204,68,255,0.02) 40%, transparent 70%);
  border-top: 1px solid rgba(0,180,255,0.08);
  border-bottom: 1px solid rgba(0,180,255,0.08);
}

.galaxy-map-container {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

.galaxy-svg {
  width: 100%;
  max-width: 560px;
  height: auto;
}

/* Slow rotation of the spiral arms */
.galaxy-rotation {
  transform-origin: 300px 300px;
  animation: galaxySpin 180s linear infinite;
}

@keyframes galaxySpin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── Homeworld Dots — Pulse and label hover ── */

.galaxy-homeworld .homeworld-glow-outer {
  animation: homeworldPulse 3s ease-in-out infinite alternate;
}

.galaxy-homeworld .homeworld-ping {
  animation: homeworldPing 3s ease-out infinite;
}

@keyframes homeworldPulse {
  0%   { r: 14; opacity: 0.05; }
  100% { r: 20; opacity: 0.12; }
}

@keyframes homeworldPing {
  0%   { r: 5; opacity: 0.6; stroke-width: 1.5; }
  100% { r: 18; opacity: 0; stroke-width: 0.5; }
}

/* Show faction name on hover */
.galaxy-homeworld:hover .homeworld-label {
  opacity: 1;
  transition: opacity 0.2s ease;
}

.galaxy-homeworld:hover .homeworld-dot {
  r: 7;
  transition: r 0.2s ease;
}


/* ── 7c. Enhanced Faction Cards ────────────────────────── */

.faction-section {
  margin: 0;
  padding: 48px 24px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  border-top: 1px solid rgba(0,180,255,0.08);
}

/* 2-column desktop, 1-column mobile */
.faction-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.faction-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid var(--faction-color, var(--accent));
  border-radius: 4px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.faction-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--faction-color, var(--accent));
}

.faction-card:hover {
  border-color: var(--faction-color, var(--accent));
  box-shadow:
    0 0 20px color-mix(in srgb, var(--faction-color, var(--accent)) 20%, transparent),
    0 0 50px color-mix(in srgb, var(--faction-color, var(--accent)) 8%, transparent),
    inset 0 0 30px color-mix(in srgb, var(--faction-color, var(--accent)) 3%, transparent);
  transform: translateY(-2px) scale(1.02);
}

/* ── Faction Card Header — Emblem + Titles ── */
.faction-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.faction-emblem {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.faction-card:hover .faction-emblem {
  opacity: 1;
}

.faction-emblem svg {
  display: block;
}

.faction-card-titles {
  flex: 1;
  min-width: 0;
}

.faction-card .faction-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--faction-color, var(--text-hi));
  margin-bottom: 2px;
}

.faction-card .faction-subtitle {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.faction-card .faction-desc {
  font-size: 0.8rem;
  color: var(--text-mid);
  line-height: 1.5;
  margin-bottom: 14px;
}

.faction-card .faction-mechanic {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: var(--faction-color, var(--accent));
  background: color-mix(in srgb, var(--faction-color, var(--accent)) 8%, transparent);
  padding: 3px 8px;
  border-radius: 2px;
  display: inline-block;
  margin-bottom: 12px;
}

.faction-card .faction-meta {
  display: flex;
  gap: 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.faction-card .faction-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}


/* ── 7d. Command-Console Statistics Banner ─────────────── */

.stats-section {
  margin: 0;
  padding: 48px 24px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  border-top: 1px solid rgba(0,180,255,0.08);
}

.summary-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin: 0;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Console readout enhancement — monospace aesthetic with scan line */
.console-readout {
  position: relative;
  overflow: hidden;
  border-color: rgba(0,180,255,0.15);
  background:
    linear-gradient(180deg, var(--bg-card) 0%, rgba(0,180,255,0.02) 50%, var(--bg-card) 100%);
}

/* Animated scanning line that sweeps across the readout */
.console-scan-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0,180,255,0.3) 30%,
    rgba(0,180,255,0.6) 50%,
    rgba(0,180,255,0.3) 70%,
    transparent 100%);
  animation: consoleScan 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes consoleScan {
  0%   { top: 0; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.summary-stat {
  text-align: center;
}

.summary-stat .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(0,180,255,0.3);
}

.summary-stat .label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}


/* ── 7e. Footer Lore Quote ─────────────────────────────── */

.footer-quote-section {
  margin: 0;
  padding: 48px 24px 24px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  border-top: 1px solid rgba(0,180,255,0.08);
}

.footer-quote-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-hi), transparent);
  margin: 16px 0;
}

.footer-quote {
  text-align: center;
  padding: 20px 0;
}

.footer-quote-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-style: italic;
  color: var(--text-mid);
  line-height: 1.8;
  max-width: 640px;
  margin: 0 auto 12px;
}

.footer-quote-source {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  font-style: normal;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}


/* ── 7f. Dashboard Section Spacing & Shared Elements ───── */

/* ── Smooth scroll behavior ── */
html {
  scroll-behavior: smooth;
}

/* ── Dashboard Section — consistent vertical rhythm ── */
.dashboard-section {
  padding: 48px 24px;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  border-top: 1px solid rgba(0,180,255,0.08);
}

/* Alternating subtle backgrounds for visual separation */
.dashboard-section:nth-child(odd) {
  background: rgba(0,180,255,0.02);
}

.dashboard-section:nth-child(even) {
  background: rgba(0,180,255,0.04);
}

/* ── Section Label — small uppercase pre-heading ── */
.section-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.6;
  margin-bottom: 6px;
  text-align: center;
}

/* ── Section Heading — enhanced Orbitron heading with dim divider ── */
.section-heading {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  text-shadow: 0 0 12px rgba(0,180,255,0.2);
}

/* ── Divider — gradient horizontal rule between sections ── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-hi), transparent);
  margin: 48px 0 0;
}


/* ── 7g. Epigraph & Quotes ──────────────────────────────── */

.quote-block {
  text-align: center;
  padding: 24px 32px;
  max-width: 680px;
  margin: 0 auto;
  position: relative;
}

/* Decorative top/bottom lines */
.quote-block::before,
.quote-block::after {
  content: '';
  display: block;
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-hi), transparent);
  margin: 0 auto 20px;
}

.quote-block::after {
  margin: 20px auto 0;
}

.quote-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-mid);
  line-height: 1.8;
}

.quote-attr {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin-top: 12px;
  text-transform: uppercase;
}


/* ── 7h. Game Description — Title & Elevator Pitch ──────── */

.page-title-wrap {
  text-align: center;
  margin-bottom: 32px;
}

.page-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-hi);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
  text-shadow: 0 0 20px rgba(0,180,255,0.15);
}

.page-subtitle {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.body-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  color: var(--text-body);
  line-height: 1.85;
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}


/* ── 7i. By The Numbers — Stat Cards Grid ───────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.stat-block {
  background: rgba(0,180,255,0.06);
  border: 1px solid rgba(0,180,255,0.12);
  border-radius: 4px;
  padding: 24px 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Subtle top glow line */
.stat-block::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,180,255,0.3), transparent);
}

.stat-block:hover {
  border-color: rgba(0,180,255,0.3);
  box-shadow: 0 0 24px rgba(0,180,255,0.12), inset 0 0 20px rgba(0,180,255,0.04);
  transform: translateY(-3px);
}

.stat-block .stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
  width: auto;
  text-align: center;
  text-shadow: 0 0 16px currentColor, 0 0 40px currentColor;
}

.stat-block .stat-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-hi);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
  width: auto;
}

.stat-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}


/* ── 7j. Core Loop — Phase Cards ────────────────────────── */

.phase-loop {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 32px;
  /* Snap scrolling on mobile */
  scroll-snap-type: x mandatory;
}

.phase-block {
  flex: 1;
  min-width: 180px;
  padding: 22px 18px 18px;
  border-radius: 6px;
  border: 1px solid rgba(0,180,255,0.15);
  border-top: 3px solid rgba(0,180,255,0.4);
  background: var(--bg-card);
  position: relative;
  transition: all 0.3s ease;
  scroll-snap-align: start;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  text-align: center;
}

.phase-block:hover {
  border-color: rgba(0,180,255,0.3);
  border-top-color: var(--accent);
  box-shadow: 0 4px 24px rgba(0,180,255,0.15);
  transform: translateY(-3px);
}

.phase-num {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-bottom: 10px;
  display: inline-block;
  padding: 4px 12px;
  background: rgba(0,180,255,0.12);
  border: 1px solid rgba(0,180,255,0.2);
  border-radius: 3px;
  color: var(--accent);
}

.phase-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.phase-desc {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.6;
}

.phase-arrow {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: var(--text-dim);
  z-index: 1;
}


/* ── 7k. Game Systems — Navigation Grid ─────────────────── */

.systems-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.system-card {
  background: var(--bg-card);
  border: 1px solid rgba(0,180,255,0.15);
  border-left: 4px solid rgba(0,180,255,0.45);
  border-radius: 6px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.system-card:hover {
  border-color: rgba(0,180,255,0.3);
  border-left-color: var(--accent);
  background: var(--bg-hover);
  box-shadow:
    0 4px 24px rgba(0,180,255,0.15),
    inset 0 0 20px rgba(0,180,255,0.03);
  transform: translateY(-3px);
}

.system-card-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.system-card-desc {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  color: var(--text-mid);
  line-height: 1.6;
}


/* ── 7l. Differentiator Cards — Accent Left Border ──────── */

.card-accent {
  padding: 20px 24px;
  line-height: 1.7;
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px solid rgba(0,180,255,0.12);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  text-align: left;
  transition: all 0.3s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.card-accent:hover {
  border-left-color: var(--text-hi);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,180,255,0.15);
}

.card-accent:nth-child(odd) {
  background: rgba(0,180,255,0.04);
}

.card-accent:nth-child(even) {
  background: var(--bg-card);
}

/* ── 7l-b. Document Structure Cards ─────────────────────── */

.dashboard-section .card {
  background: var(--bg-card);
  border: 1px solid rgba(0,180,255,0.12);
  border-radius: 6px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

.dashboard-section .card:hover {
  border-color: rgba(0,180,255,0.25);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,180,255,0.12);
}


/* ── 7m. Dashboard Responsive Overrides ─────────────────── */

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .systems-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-section {
    padding: 32px 0 0;
  }

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

  .phase-loop {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .phase-block {
    min-width: 220px;
    flex: 0 0 auto;
  }

  .phase-arrow {
    display: none;
  }

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

  .page-title {
    font-size: 1.1rem;
    letter-spacing: 0.06em;
  }

  .quote-block {
    padding: 16px;
  }

  .stat-block .stat-value {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .stat-block .stat-value {
    font-size: 1.6rem;
  }

  .page-title {
    font-size: 0.95rem;
  }
}


/* ═══════════════════════════════════════════════════════════
   8. SEARCH OVERLAY — Ctrl+K command-palette search
   ═══════════════════════════════════════════════════════════ */

/* ── Backdrop ──
   Full-screen dark overlay; starts hidden (opacity 0, no pointer
   events) and activates when .active is added by Search.open(). */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.search-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ── Search Box ── */
.search-box {
  width: 560px;
  max-width: 90vw;
  background: var(--bg-panel);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

/* ── Search Input Row ── */
.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.search-input-wrap .search-icon {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.search-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  color: var(--text-hi);
  outline: none;
}

.search-input-wrap input::placeholder {
  color: var(--text-dim);
}

.search-input-wrap .search-hint {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-dim);
  background: var(--bg-base);
  padding: 2px 6px;
  border-radius: 2px;
}

/* ── Search Results List ── */
.search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition);
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--bg-hover);
}

.search-result-item .result-type {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-base);
  padding: 2px 6px;
  border-radius: 2px;
  text-transform: uppercase;
  min-width: 48px;
  text-align: center;
}

.search-result-item .result-text {
  font-size: 0.85rem;
  color: var(--text-body);
}

.search-result-item .result-text mark {
  background: none;
  color: var(--accent);
  font-weight: 600;
}

.search-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
}


/* ═══════════════════════════════════════════════════════════
   9. BACK TO TOP — Floating scroll-to-top button
   ═══════════════════════════════════════════════════════════ */

/* ── Back to Dashboard Button ────────────────────────────── */
.back-to-dashboard-wrap {
  display: flex;
  justify-content: center;
  padding: 48px 0 32px 0;
}

.back-to-dashboard {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 14px 32px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 12px rgba(0, 180, 255, 0.1), inset 0 0 12px rgba(0, 180, 255, 0.03);
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.back-to-dashboard::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 180, 255, 0.08), transparent);
  transition: left 0.5s ease;
}

.back-to-dashboard:hover::before {
  left: 100%;
}

.back-to-dashboard:hover {
  background: linear-gradient(135deg, var(--bg-hover), var(--bg-card));
  border-color: var(--text-hi);
  color: var(--text-hi);
  box-shadow: 0 0 24px rgba(0, 180, 255, 0.25), inset 0 0 16px rgba(0, 180, 255, 0.06);
  transform: translateY(-1px);
}

.dash-btn-icon {
  font-size: 0.5rem;
  opacity: 0.5;
}

.back-to-dashboard:hover .dash-btn-icon {
  opacity: 1;
}

/* ── Audio Controls Container ────────────────────────────── */
.audio-controls {
  position: fixed;
  bottom: 24px;
  right: 68px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.audio-toggle {
  width: 36px;
  height: 36px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.audio-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.audio-controls.active .audio-toggle {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(0,180,255,0.3);
}

/* ── Audio Panel (sliders) ──────────────────────────────── */
.audio-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  display: none;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.audio-controls.active .audio-panel {
  display: flex;
}

.audio-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-slider-row label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  width: 40px;
  text-align: right;
}

.audio-slider-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.audio-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  box-shadow: 0 0 6px rgba(0,180,255,0.4);
}

.audio-slider-row input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  box-shadow: 0 0 6px rgba(0,180,255,0.4);
}

/* ── Back to Top Button ─────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 36px;
  height: 36px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: all;
}

.back-to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
}


/* ═══════════════════════════════════════════════════════════
   10. HAMBURGER / MOBILE — Mobile nav toggle & responsive
   ═══════════════════════════════════════════════════════════ */

/* ── Hamburger Button ──
   Hidden on desktop; shown at ≤768px. Three <span> bars
   animate into an X when .open is toggled.                      */
.hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-mid);
  border-radius: 1px;
  transition: all 0.3s ease;
}

/* Animated X state */
.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
}
.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* ── Mobile Overlay ──
   Dark scrim behind the sidebar when open on mobile.            */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}

.mobile-overlay.active {
  display: block;
}

/* ── Responsive Breakpoints ── */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: 56px;
  }

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

  .summary-bar {
    gap: 12px;
  }

  /* Hero responsive — smaller title, tighter spacing */
  .hero-section {
    min-height: 85vh;
    margin: -16px -16px 0;
    padding: 40px 16px 30px;
  }

  .hero-title {
    font-size: 1.6rem;
    letter-spacing: 0.1em;
  }

  .hero-subtitle {
    font-size: 0.8rem;
    letter-spacing: 0.2em;
  }

  .hero-lore-text {
    font-size: 0.85rem;
  }

  .hero-version {
    font-size: 0.6rem;
  }

  /* Galaxy map — constrain on mobile */
  .galaxy-svg {
    max-width: 340px;
  }

  /* Faction cards — single column */
  .faction-card-header {
    gap: 10px;
  }

  .faction-emblem {
    width: 36px;
    height: 36px;
  }

  .faction-emblem svg {
    width: 36px;
    height: 36px;
  }

  .search-box {
    width: 95vw;
  }
}

@media (max-width: 480px) {
  .summary-bar {
    gap: 8px;
    padding: 10px;
  }

  .summary-stat .num {
    font-size: 0.9rem;
  }

  .hero-title {
    font-size: 1.3rem;
  }

  .hero-subtitle {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
  }
}


/* ═══════════════════════════════════════════════════════════
   11. UTILITY CLASSES — Shared helpers & animations
   ═══════════════════════════════════════════════════════════ */

/* ── Section Heading ──
   Moved to Section 7f (Dashboard shared elements).
   See .section-heading in the Dashboard block.                  */

/* ── Animations ── */
.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Scanline Effect ──
   Subtle CRT-style horizontal lines overlaid on an element.
   Used on the dashboard header for atmosphere.                  */
.scanline {
  position: relative;
}

.scanline::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 180, 255, 0.015) 2px,
    rgba(0, 180, 255, 0.015) 4px
  );
  pointer-events: none;
}


/* ═══════════════════════════════════════════════════════════
   12. DEVELOPER MODE — Toast, edit bar, priming/unlock glow
   ═══════════════════════════════════════════════════════════ */

/* ── Dev Mode Toast Notification ──
   Fixed bar that slides down from the top when dev mode unlocks.
   Hidden by default; .show triggers the slide-in animation.       */
#dev-mode-toast {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 20px;
  background: linear-gradient(90deg, rgba(7,8,12,0.95) 0%, rgba(0,180,255,0.12) 50%, rgba(7,8,12,0.95) 100%);
  border-bottom: 1px solid var(--accent);
  color: var(--accent);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-align: center;
  z-index: 9999;
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
  pointer-events: none;
}

#dev-mode-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ── Toast Badge (SYS label) ── */
.toast-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--bg-base);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 2px;
  margin-right: 8px;
  letter-spacing: 0.12em;
  vertical-align: middle;
}

/* ── Sidebar Title — Priming Glow ──
   Pulsing glow while the user is clicking toward the 10-click
   threshold. Removed if the timer expires or unlock triggers.     */
.sidebar-title.dev-priming {
  animation: devPriming 0.6s ease-in-out infinite alternate;
}

@keyframes devPriming {
  from { text-shadow: 0 0 4px rgba(0,180,255,0.3); }
  to   { text-shadow: 0 0 12px rgba(0,180,255,0.7), 0 0 24px rgba(0,180,255,0.3); }
}

/* ── Sidebar Title — Unlocked Glow ──
   Permanent subtle glow after dev mode is activated.              */
.sidebar-title.dev-unlocked {
  text-shadow: 0 0 8px rgba(0,180,255,0.5), 0 0 20px rgba(0,180,255,0.2);
}

/* ── Hidden Chapters (ch44–ch46) ──
   Dev-only chapters are hidden by default in the nav.
   Revealed when body.dev-mode-active is present.                  */
.nav-chapter[data-id="ch44"],
.nav-chapter[data-id="ch45"],
.nav-chapter[data-id="ch46"] {
  display: none;
}

body.dev-mode-active .nav-chapter[data-id="ch44"],
body.dev-mode-active .nav-chapter[data-id="ch45"],
body.dev-mode-active .nav-chapter[data-id="ch46"] {
  display: block;
}

/* ── Edit Bar ──
   Fixed bottom toolbar shown only in dev mode + edit active.
   Houses the edit toggle, field counter, and export button.       */
#edit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 42px;
  background: linear-gradient(180deg, var(--bg-panel) 0%, rgba(7,8,12,0.98) 100%);
  border-top: 1px solid var(--border-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 20px;
  z-index: 500;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

#edit-bar.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Edit Bar Buttons ── */
#edit-toggle,
#export-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mid);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all var(--transition);
}

#edit-toggle:hover,
#export-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

#edit-toggle.active {
  color: var(--bg-base);
  background: var(--accent);
  border-color: var(--accent);
}

/* ── Edit Count Label ── */
#edit-count {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* ── Editable Field Highlight ──
   When edit mode is active, editable elements get a subtle
   left-border indicator and highlight on focus.                   */
body.edit-mode [data-editable] {
  outline: 1px dashed rgba(0,180,255,0.15);
  outline-offset: 2px;
  transition: outline-color 0.2s ease, background 0.2s ease;
  cursor: text;
}

body.edit-mode [data-editable]:hover {
  outline-color: rgba(0,180,255,0.35);
}

[data-editable]:focus {
  outline: 1px solid var(--accent) !important;
  outline-offset: 2px;
  background: rgba(0,180,255,0.04);
}


/* ═══════════════════════════════════════════════════════════
   13. VISUAL EFFECTS — Faction backgrounds, particles, CRT
   ═══════════════════════════════════════════════════════════ */

/* ── Procedural Background Layer ──
   Full-page fixed div behind all content. Faction classes
   apply multi-layer radial gradient washes keyed to faction colors.
   Ported from monolith GDD v5.9.1 — gradients are carefully tuned. */
#procedural-bg {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: -2;
  transition: background 1.5s ease, opacity 1.5s ease;
  background: #07080c;
  pointer-events: none;
}
#procedural-bg.bg-terran {
  background:
    radial-gradient(ellipse at 20% 80%, rgba(0,180,255,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0,100,180,0.08) 0%, transparent 45%),
    repeating-linear-gradient(0deg,   transparent, transparent 40px, rgba(0,180,255,0.025) 40px, rgba(0,180,255,0.025) 41px),
    repeating-linear-gradient(90deg,  transparent, transparent 40px, rgba(0,180,255,0.018) 40px, rgba(0,180,255,0.018) 41px),
    #060c14;
}
#procedural-bg.bg-horde {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(180,50,0,0.18) 0%, transparent 60%),
    radial-gradient(circle at 90% 90%, rgba(255,102,34,0.1) 0%, transparent 35%),
    repeating-linear-gradient(45deg,  transparent, transparent 18px, rgba(255,80,0,0.03) 18px, rgba(255,80,0,0.03) 20px),
    repeating-linear-gradient(-45deg, transparent, transparent 18px, rgba(200,40,0,0.02) 18px, rgba(200,40,0,0.02) 20px),
    #0d0602;
}
#procedural-bg.bg-shards {
  background:
    radial-gradient(circle at 25% 30%, rgba(0,255,238,0.12) 0%, transparent 40%),
    radial-gradient(circle at 75% 70%, rgba(162,0,255,0.10) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(0,100,255,0.06) 0%, transparent 60%),
    repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg, rgba(0,255,238,0.015) 30deg, transparent 60deg),
    #04050e;
}
#procedural-bg.bg-necro {
  background:
    radial-gradient(circle at 50% -10%, rgba(68,255,136,0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 15% 90%, rgba(0,180,80,0.06) 0%, transparent 35%),
    repeating-linear-gradient(90deg, transparent, transparent 60px, rgba(68,255,100,0.02) 60px, rgba(68,255,100,0.02) 61px),
    repeating-linear-gradient(0deg,  transparent, transparent 80px, rgba(68,255,80,0.015) 80px, rgba(68,255,80,0.015) 81px),
    #010402;
}
#procedural-bg.bg-accord {
  background:
    radial-gradient(ellipse at 70% 20%, rgba(255,170,34,0.12) 0%, transparent 45%),
    radial-gradient(circle at 30% 80%, rgba(255,200,100,0.07) 0%, transparent 40%),
    repeating-linear-gradient(60deg,  transparent, transparent 28px, rgba(255,170,34,0.022) 28px, rgba(255,170,34,0.022) 29px),
    repeating-linear-gradient(-60deg, transparent, transparent 28px, rgba(255,150,0,0.015) 28px, rgba(255,150,0,0.015) 29px),
    #080700;
}
#procedural-bg.bg-vorax {
  background:
    radial-gradient(ellipse at 40% 60%, rgba(200,0,60,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,34,102,0.08) 0%, transparent 35%),
    radial-gradient(circle at 20% 20%, rgba(120,0,40,0.08) 0%, transparent 30%),
    repeating-radial-gradient(circle at 50% 50%, transparent 0px, transparent 28px, rgba(200,0,60,0.015) 28px, rgba(200,0,60,0.015) 30px),
    #060001;
}
#procedural-bg.bg-guardians {
  background:
    radial-gradient(ellipse at 50% -20%, rgba(204,68,255,0.14) 0%, transparent 55%),
    radial-gradient(circle at 85% 85%, rgba(180,100,255,0.07) 0%, transparent 35%),
    repeating-linear-gradient(0deg,  transparent, transparent 50px, rgba(180,80,255,0.02) 50px, rgba(180,80,255,0.02) 51px),
    repeating-linear-gradient(90deg, transparent, transparent 65px, rgba(160,60,255,0.015) 65px, rgba(160,60,255,0.015) 66px),
    #04030a;
}

/* ── Non-Faction Part Backgrounds ── */
#procedural-bg.bg-cosmic {
  background: radial-gradient(ellipse at 50% 30%,rgba(20,30,80,.95) 0%,transparent 65%),
    radial-gradient(ellipse at 80% 80%,rgba(10,0,40,.6) 0%,transparent 45%),#04050f;
}
#procedural-bg.bg-foundation {
  background: radial-gradient(ellipse at 30% 20%,rgba(0,60,120,.14) 0%,transparent 50%),
    repeating-linear-gradient(0deg,transparent,transparent 48px,rgba(0,130,255,.04) 48px,rgba(0,130,255,.04) 49px),
    repeating-linear-gradient(90deg,transparent,transparent 48px,rgba(0,130,255,.04) 48px,rgba(0,130,255,.04) 49px),
    repeating-linear-gradient(0deg,transparent,transparent 8px,rgba(0,100,200,.015) 8px,rgba(0,100,200,.015) 9px),#03060e;
}
#procedural-bg.bg-galactic {
  background: radial-gradient(ellipse at 15% 40%,rgba(120,20,200,.14) 0%,transparent 40%),
    radial-gradient(ellipse at 85% 60%,rgba(0,80,180,.12) 0%,transparent 45%),
    radial-gradient(ellipse at 50% 10%,rgba(200,80,0,.07) 0%,transparent 35%),#030408;
}
#procedural-bg.bg-combat {
  background: radial-gradient(ellipse at 20% 80%,rgba(180,30,0,.12) 0%,transparent 45%),
    repeating-linear-gradient(0deg,transparent,transparent 36px,rgba(255,60,0,.025) 36px,rgba(255,60,0,.025) 37px),
    repeating-linear-gradient(90deg,transparent,transparent 36px,rgba(255,40,0,.018) 36px,rgba(255,40,0,.018) 37px),
    repeating-linear-gradient(45deg,transparent,transparent 80px,rgba(180,0,0,.015) 80px,rgba(180,0,0,.015) 82px),#080200;
}
#procedural-bg.bg-strategy {
  background: radial-gradient(ellipse at 60% 30%,rgba(0,160,140,.10) 0%,transparent 45%),
    repeating-linear-gradient(30deg,transparent,transparent 60px,rgba(0,180,160,.022) 60px,rgba(0,180,160,.022) 61px),
    repeating-linear-gradient(-30deg,transparent,transparent 60px,rgba(0,160,200,.018) 60px,rgba(0,160,200,.018) 61px),#020808;
}
#procedural-bg.bg-finalwar {
  background: radial-gradient(ellipse at 50% 100%,rgba(220,30,0,.22) 0%,transparent 55%),
    radial-gradient(ellipse at 20% 20%,rgba(180,10,0,.12) 0%,transparent 40%),
    repeating-linear-gradient(0deg,transparent,transparent 24px,rgba(200,0,0,.025) 24px,rgba(200,0,0,.025) 25px),#0a0100;
}
#procedural-bg.bg-presentation {
  background: radial-gradient(ellipse at 50% 50%,rgba(30,30,50,.40) 0%,transparent 70%),
    radial-gradient(ellipse at 100% 0%,rgba(0,100,200,.05) 0%,transparent 40%),#060608;
}
#procedural-bg.bg-appendix {
  background: radial-gradient(ellipse at 50% 0%,rgba(0,180,80,.10) 0%,transparent 50%),
    repeating-linear-gradient(0deg,transparent,transparent 3px,rgba(0,200,80,.012) 3px,rgba(0,200,80,.012) 4px),
    repeating-linear-gradient(90deg,transparent,transparent 72px,rgba(0,180,60,.02) 72px,rgba(0,180,60,.02) 73px),#010603;
}

/* ── Body Faction Background Classes ──
   Applied to <body> for faction-specific accents on sidebar,
   nav, search, scrollbar, cards, headings, quotes, power bars.
   Ported from monolith GDD v5.9.1 — full premium visual system. */
body.faction-bg-terran    { --faction-active: var(--terran); }
body.faction-bg-shards    { --faction-active: var(--shards); }
body.faction-bg-horde     { --faction-active: var(--horde); }
body.faction-bg-necro     { --faction-active: var(--necro); }
body.faction-bg-accord    { --faction-active: var(--accord); }
body.faction-bg-vorax     { --faction-active: var(--vorax); }
body.faction-bg-guardians { --faction-active: var(--guardians); }

/* ── Main-Content Faction Backgrounds ── */
.faction-bg-terran .main-content {
  background: radial-gradient(ellipse at 20% 30%, rgba(0,180,255,0.04) 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(0,180,255,0.02) 40px, rgba(0,180,255,0.02) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(0,180,255,0.015) 40px, rgba(0,180,255,0.015) 41px);
}
.faction-bg-shards .main-content {
  background: radial-gradient(ellipse at 70% 20%, rgba(0,255,238,0.05) 0%, transparent 50%),
    radial-gradient(circle at 30% 80%, rgba(0,255,238,0.03) 0%, transparent 40%),
    repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg, rgba(0,255,238,0.01) 30deg, transparent 60deg);
}
.faction-bg-horde .main-content {
  background: radial-gradient(ellipse at 50% 50%, rgba(255,102,34,0.05) 0%, transparent 60%),
    repeating-linear-gradient(45deg, transparent, transparent 20px, rgba(255,102,34,0.02) 20px, rgba(255,102,34,0.02) 22px),
    repeating-linear-gradient(-45deg, transparent, transparent 20px, rgba(255,102,34,0.015) 20px, rgba(255,102,34,0.015) 22px);
}
.faction-bg-necro .main-content {
  background: radial-gradient(ellipse at 50% 0%, rgba(68,255,136,0.04) 0%, transparent 50%),
    repeating-linear-gradient(90deg, transparent, transparent 60px, rgba(68,255,136,0.015) 60px, rgba(68,255,136,0.015) 61px),
    repeating-linear-gradient(0deg, transparent, transparent 80px, rgba(68,255,136,0.01) 80px, rgba(68,255,136,0.01) 81px);
}
.faction-bg-accord .main-content {
  background: radial-gradient(ellipse at 80% 20%, rgba(255,170,34,0.04) 0%, transparent 50%),
    repeating-linear-gradient(60deg, transparent, transparent 30px, rgba(255,170,34,0.015) 30px, rgba(255,170,34,0.015) 31px),
    repeating-linear-gradient(-60deg, transparent, transparent 30px, rgba(255,170,34,0.012) 30px, rgba(255,170,34,0.012) 31px);
}
.faction-bg-vorax .main-content {
  background: radial-gradient(ellipse at 40% 60%, rgba(255,34,102,0.05) 0%, transparent 50%),
    radial-gradient(circle at 70% 30%, rgba(255,34,102,0.03) 0%, transparent 35%),
    repeating-radial-gradient(circle at 50% 50%, transparent 0px, transparent 30px, rgba(255,34,102,0.01) 30px, rgba(255,34,102,0.01) 32px);
}
.faction-bg-guardians .main-content {
  background: radial-gradient(ellipse at 50% 30%, rgba(204,68,255,0.04) 0%, transparent 50%),
    repeating-linear-gradient(0deg, transparent, transparent 50px, rgba(204,68,255,0.015) 50px, rgba(204,68,255,0.015) 51px),
    repeating-linear-gradient(90deg, transparent, transparent 70px, rgba(204,68,255,0.012) 70px, rgba(204,68,255,0.012) 71px);
}

/* ── Sidebar Faction Glow ── */
.faction-bg-terran    .sidebar { box-shadow: inset -1px 0 0 rgba(0,180,255,.15), 3px 0 20px rgba(0,180,255,.07); }
.faction-bg-shards    .sidebar { box-shadow: inset -1px 0 0 rgba(0,255,238,.15), 3px 0 20px rgba(0,255,238,.07); }
.faction-bg-horde     .sidebar { box-shadow: inset -1px 0 0 rgba(255,102,34,.15),3px 0 20px rgba(255,102,34,.07); }
.faction-bg-necro     .sidebar { box-shadow: inset -1px 0 0 rgba(68,255,102,.15), 3px 0 20px rgba(68,255,102,.07); }
.faction-bg-accord    .sidebar { box-shadow: inset -1px 0 0 rgba(255,170,34,.15),3px 0 20px rgba(255,170,34,.07); }
.faction-bg-vorax     .sidebar { box-shadow: inset -1px 0 0 rgba(255,34,102,.15), 3px 0 20px rgba(255,34,102,.07); }
.faction-bg-guardians .sidebar { box-shadow: inset -1px 0 0 rgba(204,68,255,.15),3px 0 20px rgba(204,68,255,.07); }

/* ── Sidebar Title Faction Glow ── */
.faction-bg-terran    .sidebar-title { color: var(--terran); text-shadow: 0 0 12px var(--terran); }
.faction-bg-shards    .sidebar-title { color: var(--shards); text-shadow: 0 0 12px var(--shards); }
.faction-bg-horde     .sidebar-title { color: var(--horde);  text-shadow: 0 0 12px var(--horde); }
.faction-bg-necro     .sidebar-title { color: var(--necro);  text-shadow: 0 0 12px var(--necro); }
.faction-bg-accord    .sidebar-title { color: var(--accord); text-shadow: 0 0 12px var(--accord); }
.faction-bg-vorax     .sidebar-title { color: var(--vorax);  text-shadow: 0 0 12px var(--vorax); }
.faction-bg-guardians .sidebar-title { color: var(--guardians); text-shadow: 0 0 12px var(--guardians); }

/* ── Nav Active Items — Faction Color ── */
.faction-bg-terran    .nav-chapter.active { color: var(--terran); border-left-color: var(--terran); background: rgba(0,180,255,.06); --fx-nav: var(--terran); }
.faction-bg-shards    .nav-chapter.active { color: var(--shards); border-left-color: var(--shards); background: rgba(0,255,238,.06); --fx-nav: var(--shards); }
.faction-bg-horde     .nav-chapter.active { color: var(--horde);  border-left-color: var(--horde);  background: rgba(255,102,34,.06); --fx-nav: var(--horde); }
.faction-bg-necro     .nav-chapter.active { color: var(--necro);  border-left-color: var(--necro);  background: rgba(68,255,102,.06); --fx-nav: var(--necro); }
.faction-bg-accord    .nav-chapter.active { color: var(--accord); border-left-color: var(--accord); background: rgba(255,170,34,.06); --fx-nav: var(--accord); }
.faction-bg-vorax     .nav-chapter.active { color: var(--vorax);  border-left-color: var(--vorax);  background: rgba(255,34,102,.06); --fx-nav: var(--vorax); }
.faction-bg-guardians .nav-chapter.active { color: var(--guardians); border-left-color: var(--guardians); background: rgba(204,68,255,.06); --fx-nav: var(--guardians); }
.faction-bg-terran    .nav-chapter.active::before { --fx-nav: var(--terran); }
.faction-bg-shards    .nav-chapter.active::before { --fx-nav: var(--shards); }
.faction-bg-horde     .nav-chapter.active::before { --fx-nav: var(--horde);  }
.faction-bg-necro     .nav-chapter.active::before { --fx-nav: var(--necro);  }
.faction-bg-accord    .nav-chapter.active::before { --fx-nav: var(--accord); }
.faction-bg-vorax     .nav-chapter.active::before { --fx-nav: var(--vorax);  }
.faction-bg-guardians .nav-chapter.active::before { --fx-nav: var(--guardians); }

/* ── Search Box — Faction Tint ── */
.faction-bg-terran    .search-box { border-color: var(--terran); box-shadow: 0 8px 48px rgba(0,180,255,.22), 0 0 0 1px rgba(0,180,255,.2); }
.faction-bg-shards    .search-box { border-color: var(--shards); box-shadow: 0 8px 48px rgba(0,255,238,.22), 0 0 0 1px rgba(0,255,238,.2); }
.faction-bg-horde     .search-box { border-color: var(--horde);  box-shadow: 0 8px 48px rgba(255,102,34,.22),0 0 0 1px rgba(255,102,34,.2); }
.faction-bg-necro     .search-box { border-color: var(--necro);  box-shadow: 0 8px 48px rgba(68,255,102,.22), 0 0 0 1px rgba(68,255,102,.2); }
.faction-bg-accord    .search-box { border-color: var(--accord); box-shadow: 0 8px 48px rgba(255,170,34,.22),0 0 0 1px rgba(255,170,34,.2); }
.faction-bg-vorax     .search-box { border-color: var(--vorax);  box-shadow: 0 8px 48px rgba(255,34,102,.22), 0 0 0 1px rgba(255,34,102,.2); }
.faction-bg-guardians .search-box { border-color: var(--guardians); box-shadow: 0 8px 48px rgba(204,68,255,.22),0 0 0 1px rgba(204,68,255,.2); }

/* ── Scrollbar — Faction Color ── */
.faction-bg-terran    .main-content::-webkit-scrollbar-thumb { background: rgba(0,180,255,.28); }
.faction-bg-shards    .main-content::-webkit-scrollbar-thumb { background: rgba(0,255,238,.28); }
.faction-bg-horde     .main-content::-webkit-scrollbar-thumb { background: rgba(255,102,34,.28); }
.faction-bg-necro     .main-content::-webkit-scrollbar-thumb { background: rgba(68,255,102,.28); }
.faction-bg-accord    .main-content::-webkit-scrollbar-thumb { background: rgba(255,170,34,.28); }
.faction-bg-vorax     .main-content::-webkit-scrollbar-thumb { background: rgba(255,34,102,.28); }
.faction-bg-guardians .main-content::-webkit-scrollbar-thumb { background: rgba(204,68,255,.28); }

/* ── Cards — Faction Color Variable ── */
.faction-bg-terran    .card { --fx: var(--terran); }
.faction-bg-shards    .card { --fx: var(--shards); }
.faction-bg-horde     .card { --fx: var(--horde); }
.faction-bg-necro     .card { --fx: var(--necro); }
.faction-bg-accord    .card { --fx: var(--accord); }
.faction-bg-vorax     .card { --fx: var(--vorax); }
.faction-bg-guardians .card { --fx: var(--guardians); }

/* ── System Cards — Faction Color Variable ── */
.faction-bg-terran    .system-card { --fx: var(--terran); }
.faction-bg-shards    .system-card { --fx: var(--shards); }
.faction-bg-horde     .system-card { --fx: var(--horde); }
.faction-bg-necro     .system-card { --fx: var(--necro); }
.faction-bg-accord    .system-card { --fx: var(--accord); }
.faction-bg-vorax     .system-card { --fx: var(--vorax); }
.faction-bg-guardians .system-card { --fx: var(--guardians); }

/* ── Section Headings — Shimmer Pass ── */
.faction-bg-terran    .section-heading { background: linear-gradient(90deg,#fff 15%,var(--terran) 50%,#fff 85%) 0/300%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: p7-shimmer 5.5s linear infinite; }
.faction-bg-shards    .section-heading { background: linear-gradient(90deg,#fff 15%,var(--shards) 50%,#fff 85%) 0/300%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: p7-shimmer 5.5s linear infinite; }
.faction-bg-horde     .section-heading { background: linear-gradient(90deg,#fff 15%,var(--horde) 50%,#fff 85%)  0/300%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: p7-shimmer 5.5s linear infinite; }
.faction-bg-necro     .section-heading { background: linear-gradient(90deg,#fff 15%,var(--necro) 50%,#fff 85%)  0/300%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: p7-shimmer 5.5s linear infinite; }
.faction-bg-accord    .section-heading { background: linear-gradient(90deg,#fff 15%,var(--accord) 50%,#fff 85%) 0/300%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: p7-shimmer 5.5s linear infinite; }
.faction-bg-vorax     .section-heading { background: linear-gradient(90deg,#fff 15%,var(--vorax) 50%,#fff 85%)  0/300%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: p7-shimmer 5.5s linear infinite; }
.faction-bg-guardians .section-heading { background: linear-gradient(90deg,#fff 15%,var(--guardians) 50%,#fff 85%) 0/300%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: p7-shimmer 5.5s linear infinite; }

/* ── Quote Blocks — Faction Color ── */
.faction-bg-terran    .quote-block { border-left-color: var(--terran); background: rgba(0,180,255,.025); }
.faction-bg-shards    .quote-block { border-left-color: var(--shards); background: rgba(0,255,238,.025); }
.faction-bg-horde     .quote-block { border-left-color: var(--horde);  background: rgba(255,102,34,.025); }
.faction-bg-necro     .quote-block { border-left-color: var(--necro);  background: rgba(68,255,102,.025); }
.faction-bg-accord    .quote-block { border-left-color: var(--accord); background: rgba(255,170,34,.025); }
.faction-bg-vorax     .quote-block { border-left-color: var(--vorax);  background: rgba(255,34,102,.025); }
.faction-bg-guardians .quote-block { border-left-color: var(--guardians); background: rgba(204,68,255,.025); }

/* ── Power Bars — Faction Color ── */
.faction-bg-terran    .power-bar-fill { background: var(--terran) !important; box-shadow: 0 0 6px var(--terran); }
.faction-bg-shards    .power-bar-fill { background: var(--shards) !important; box-shadow: 0 0 6px var(--shards); }
.faction-bg-horde     .power-bar-fill { background: var(--horde)  !important; box-shadow: 0 0 6px var(--horde); }
.faction-bg-necro     .power-bar-fill { background: var(--necro)  !important; box-shadow: 0 0 6px var(--necro); }
.faction-bg-accord    .power-bar-fill { background: var(--accord) !important; box-shadow: 0 0 6px var(--accord); }
.faction-bg-vorax     .power-bar-fill { background: var(--vorax)  !important; box-shadow: 0 0 6px var(--vorax); }
.faction-bg-guardians .power-bar-fill { background: var(--guardians) !important; box-shadow: 0 0 6px var(--guardians); }

/* ── Page Title Wrap — Faction Underline ── */
.faction-bg-terran    .page-title-wrap::after { --fx: var(--terran); }
.faction-bg-shards    .page-title-wrap::after { --fx: var(--shards); }
.faction-bg-horde     .page-title-wrap::after { --fx: var(--horde); }
.faction-bg-necro     .page-title-wrap::after { --fx: var(--necro); }
.faction-bg-accord    .page-title-wrap::after { --fx: var(--accord); }
.faction-bg-vorax     .page-title-wrap::after { --fx: var(--vorax); }
.faction-bg-guardians .page-title-wrap::after { --fx: var(--guardians); }

/* ── Domain Tabs — Faction Color ── */
.faction-bg-terran    .domain-tab { --fx: var(--terran); }
.faction-bg-shards    .domain-tab { --fx: var(--shards); }
.faction-bg-horde     .domain-tab { --fx: var(--horde); }
.faction-bg-necro     .domain-tab { --fx: var(--necro); }
.faction-bg-accord    .domain-tab { --fx: var(--accord); }
.faction-bg-vorax     .domain-tab { --fx: var(--vorax); }
.faction-bg-guardians .domain-tab { --fx: var(--guardians); }

/* ── Data Rows — Faction Hover ── */
.faction-bg-terran    .data-row:hover { border-left-color: var(--terran); background: rgba(0,180,255,.04); }
.faction-bg-shards    .data-row:hover { border-left-color: var(--shards); background: rgba(0,255,238,.04); }
.faction-bg-horde     .data-row:hover { border-left-color: var(--horde);  background: rgba(255,102,34,.04); }
.faction-bg-necro     .data-row:hover { border-left-color: var(--necro);  background: rgba(68,255,102,.04); }
.faction-bg-accord    .data-row:hover { border-left-color: var(--accord); background: rgba(255,170,34,.04); }
.faction-bg-vorax     .data-row:hover { border-left-color: var(--vorax);  background: rgba(255,34,102,.04); }
.faction-bg-guardians .data-row:hover { border-left-color: var(--guardians); background: rgba(204,68,255,.04); }

/* ── Back-to-Top Button — Faction Color ── */
body[class*="faction-bg-"] .back-to-top {
  border-color: var(--faction-active);
  color: var(--faction-active);
}
body[class*="faction-bg-"] .back-to-top:hover {
  background: var(--faction-active);
  color: #000;
}

/* ── Category Body Classes (non-faction part tinting) ── */
.page-bg-cosmic,.page-bg-foundation { --fc:#4488ff; }
.page-bg-galactic { --fc:#9944ff; }
.page-bg-combat   { --fc:#ff4422; }
.page-bg-strategy { --fc:#00ccaa; }

/* ── Nav Chapter Active Glow Bar ── */
.nav-chapter.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--fx-nav, var(--accent));
  --fx: var(--fx-nav, var(--accent));
  animation: p7-pulse-glow 2.8s ease-in-out infinite;
}

/* ── Keyframes for Faction Visual System ── */
@keyframes p7-shimmer { 0%{background-position:-300% center} 100%{background-position:300% center} }
@keyframes p7-pulse-glow {0%,100%{box-shadow:0 0 4px var(--fx,var(--accent))}50%{box-shadow:0 0 14px var(--fx,var(--accent)),0 0 28px color-mix(in srgb,var(--fx,var(--accent)) 40%,transparent)}}

/* ── Ambient Particles Container ──
   Full-viewport container for floating particle elements.
   Individual .ambient-particle divs are spawned by JS.            */
#ambient-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient-particle {
  position: absolute;
  border-radius: 50%;
  animation: particleFloat var(--dur, 6s) linear forwards;
  will-change: transform, opacity;
  pointer-events: none;
}

@keyframes particleFloat {
  0% {
    transform: translateY(0) translateX(0);
    opacity: var(--particle-opacity, 0.3);
  }
  100% {
    transform: translateY(-100vh) translateX(var(--drift, 0px));
    opacity: 0;
  }
}

/* ── Faction Cursor Glow ──
   Soft radial glow that follows the mouse cursor.
   Color set inline by JS based on active faction.                 */
#faction-cursor-glow {
  position: fixed;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  display: none;
  will-change: left, top;
  transition: background 0.6s ease;
}

/* ── Faction Flag Badge ──
   Fixed-position faction glyph in the bottom-left corner.
   Displays the current faction's Unicode symbol.                  */
#faction-flag-badge {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 40px;
  height: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: var(--bg-panel);
  z-index: 50;
  transition: color 0.4s ease, text-shadow 0.4s ease, border-color 0.4s ease;
}

/* ── Lore Quote Rotator ──
   Positioned in the sidebar footer or a dedicated slot.
   Fades between faction-themed lore quotes on a timer.            */
#lore-quote-rotator {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-mid);
  text-align: center;
  padding: 12px 16px;
  min-height: 48px;
  line-height: 1.5;
  transition: opacity 0.4s ease;
}

.lore-quote-faction {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  font-style: normal;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

/* ── Scanline Overlay ──
   Full-page repeating horizontal lines for CRT atmosphere.
   Very low opacity — visible but not distracting.                 */
#scanline-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 180, 255, 0.012) 2px,
    rgba(0, 180, 255, 0.012) 4px
  );
}

/* ── CRT Overlay ──
   Vignette + subtle curve effect for a monitor look.
   Hidden by default; .active class enables it.                    */
#crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 9991;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#crt-overlay.active {
  opacity: 1;
  background:
    radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.35) 100%);
  box-shadow: inset 0 0 80px rgba(0,0,0,0.3);
}

body.crt-active {
  /* Subtle text rendering shift for CRT feel */
  text-shadow: 0 0 1px rgba(0,180,255,0.08);
}

/* ── Holo-Tilt Card Transition ──
   Smooth transform transitions for the JS-driven tilt effect.
   The transform itself is applied inline by HoloTilt._onMove().  */
.card,
.faction-card {
  transition: all 0.3s ease, transform 0.15s ease-out;
}


/* ═══════════════════════════════════════════════════════════
   14. CHAPTER INDEX — Full document index overlay
   ═══════════════════════════════════════════════════════════ */

/* ── Index Toggle Button (sidebar) ──
   Compact button placed above the filter input.               */
.chapter-index-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
}

.chapter-index-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.chapter-index-toggle-icon {
  font-size: 0.75rem;
}

/* ── Index Overlay ──
   Full-screen dark backdrop with centered scrollable panel.
   Hidden by default; .active shows it.                        */
.chapter-index-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.chapter-index-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ── Index Panel ──
   Contained card within the overlay.                          */
.chapter-index-panel {
  width: 640px;
  max-width: 92vw;
  max-height: 84vh;
  background: var(--bg-panel);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  overflow: hidden;
}

/* ── Panel Header ── */
.chapter-index-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.chapter-index-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chapter-index-close {
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.chapter-index-close:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Panel Search ── */
.chapter-index-search {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}

.chapter-index-search input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 7px 12px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  color: var(--text-body);
  outline: none;
  transition: border-color var(--transition);
}

.chapter-index-search input::placeholder {
  color: var(--text-dim);
}

.chapter-index-search input:focus {
  border-color: var(--accent);
}

/* ── Chapter Tree Container ── */
.chapter-index-tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* ── Part Header ── */
.ci-part {
  margin-bottom: 2px;
}

.ci-part-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition), background var(--transition);
}

.ci-part-header:hover {
  background: rgba(255,255,255,0.02);
}

.ci-chevron {
  font-size: 0.5rem;
  color: var(--text-dim);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.ci-part-header.collapsed .ci-chevron {
  transform: rotate(-90deg);
}

.ci-part-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex: 1;
}

.ci-part-count {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.55rem;
  color: var(--text-dim);
  background: var(--bg-base);
  padding: 1px 6px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Chapter List (collapsible) ── */
.ci-chapters {
  overflow: hidden;
  transition: max-height 0.3s ease;
  max-height: 2000px;
}

.ci-chapters.collapsed {
  max-height: 0 !important;
}

/* ── Individual Chapter Link ── */
.ci-chapter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px 6px 32px;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
}

.ci-chapter:hover {
  background: var(--bg-hover);
  border-left-color: var(--text-dim);
}

.ci-chapter.active {
  background: var(--bg-hover);
  border-left-color: var(--accent);
}

.ci-num {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-dim);
  min-width: 24px;
  flex-shrink: 0;
}

.ci-title {
  font-size: 0.78rem;
  color: var(--text-mid);
  line-height: 1.4;
}

.ci-chapter.active .ci-title {
  color: var(--text-hi);
  font-weight: 600;
}

.ci-chapter:hover .ci-title {
  color: var(--text-hi);
}

/* ── Empty State ── */
.ci-empty {
  padding: 24px 18px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ── Mobile adjustments ── */
@media (max-width: 768px) {
  .chapter-index-panel {
    width: 96vw;
    max-height: 90vh;
  }

  .chapter-index-overlay {
    padding-top: 3vh;
  }
}


/* ═══════════════════════════════════════════════════════════
   15. GLOSSARY — Auto-linked term tooltips
   ═══════════════════════════════════════════════════════════ */

/* ── Glossary Term (inline) ──
   Dotted underline and help cursor indicate a defined term.
   Hover shows a tooltip with the definition.                  */
.glossary-term {
  border-bottom: 1px dotted var(--text-dim);
  cursor: help;
  position: relative;
  transition: border-color var(--transition), color var(--transition);
}

.glossary-term:hover {
  border-bottom-color: var(--accent);
  color: var(--text-hi);
}

/* ── Glossary Tooltip ──
   CSS-only tooltip via ::after using the data-definition attr.
   Appears above the term on hover with a subtle fade-in.       */
.glossary-term::after {
  content: attr(data-definition);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 320px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-body);
  line-height: 1.5;
  white-space: normal;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  z-index: 950;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.glossary-term:hover::after {
  opacity: 1;
}

/* ── Tooltip Arrow ──
   Small triangle pointing down toward the term.               */
.glossary-term::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--border-hi);
  z-index: 951;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.glossary-term:hover::before {
  opacity: 1;
}

/* ── Mobile: position tooltip differently to avoid overflow ── */
@media (max-width: 768px) {
  .glossary-term::after {
    left: 0;
    transform: none;
    max-width: 260px;
  }

  .glossary-term::before {
    left: 12px;
    transform: none;
  }
}


/* ═══════════════════════════════════════════════════════════
   16. PLANET CARDS — Expandable planet type rows
   ═══════════════════════════════════════════════════════════ */

/* ── Planet Row ──
   Expandable row in the planet type catalog table.
   Header is always visible; detail panel toggles open/closed. */
.planet-row:last-child {
  border-bottom: none !important;
}

/* ── Planet Detail (collapsed by default) ── */
.planet-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.planet-detail.planet-detail-open {
  max-height: 600px;
}

.planet-detail-inner {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  padding: 12px 14px 18px;
  border-top: 1px solid var(--border);
  background: rgba(0, 180, 255, 0.015);
}

/* ── Planet SVG Artwork ── */
.planet-svg-wrap {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: #04060e;
}

.planet-svg-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Planet Detail Text ── */
.planet-detail-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.planet-detail-section {
  line-height: 1.55;
}

.planet-detail-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.planet-detail-body {
  font-size: 0.75rem;
  color: var(--text-mid);
}

/* ── Territory Bar Chart ── */
.territory-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 60px;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
}

.territory-bar-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  text-align: right;
}

.territory-bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  overflow: hidden;
}

.territory-bar-fill {
  height: 100%;
  border-radius: 2px;
  opacity: 0.7;
  transition: width 0.4s ease;
}

.territory-bar-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* ── Mobile: stack planet detail vertically ── */
@media (max-width: 768px) {
  .planet-detail-inner {
    grid-template-columns: 1fr;
  }

  .planet-svg-wrap {
    max-width: 200px;
  }

  .territory-bar-row {
    grid-template-columns: 90px 1fr 50px;
  }
}


/* ═══════════════════════════════════════════════════════════
   17. FORMATION CARDS — Fleet formation display
   ═══════════════════════════════════════════════════════════ */

/* ── Formation Grid ──
   Responsive grid for formation cards. Dark sci-fi style
   with accent-colored borders and inline SVG diagrams.      */
.formation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.formation-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.formation-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 180, 255, 0.08);
}

/* ── Formation Diagram ── */
.formation-diagram {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  border: 1px solid var(--border);
}

.formation-svg {
  width: 80px;
  height: 60px;
}

/* ── Formation Text ── */
.formation-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.formation-desc {
  font-size: 0.75rem;
  color: var(--text-mid);
  line-height: 1.55;
  margin-bottom: 10px;
}

.formation-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.formation-tag {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.formation-tag-best {
  background: rgba(68, 255, 102, 0.12);
  color: #44ff66;
  border: 1px solid rgba(68, 255, 102, 0.25);
}

.formation-tag-weak {
  background: rgba(255, 34, 102, 0.12);
  color: #ff2266;
  border: 1px solid rgba(255, 34, 102, 0.25);
}

/* ── Mobile: single-column formations ── */
@media (max-width: 768px) {
  .formation-grid {
    grid-template-columns: 1fr;
  }
}


/* ═══════════════════════════════════════════════════════════
   18. MOBILE OPTIMIZATION — Touch targets, font scaling,
       layout fixes for phones and small tablets
   ═══════════════════════════════════════════════════════════ */

/* ── 18a. Touch-Friendly Targets ──
   All interactive elements meet the 44×44px minimum tap target
   per WCAG / Apple HIG guidelines.                              */
@media (max-width: 768px) {

  /* Body text 16px minimum to prevent iOS auto-zoom on focus */
  body {
    font-size: 16px;
  }

  /* Sidebar: full-width overlay on mobile with smooth slide */
  .sidebar {
    width: 85vw;
    max-width: 320px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }

  /* Nav links: larger touch targets with min 44px height */
  .nav-chapter {
    padding: 12px 16px 12px 20px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-part-header {
    padding: 12px 16px;
    min-height: 44px;
  }

  /* Hamburger: ensure 44×44 minimum */
  .hamburger {
    width: 44px;
    height: 44px;
  }

  /* Sidebar toggle (desktop only — hidden on mobile, but defensive) */
  .sidebar-toggle {
    width: 44px;
    height: 44px;
  }

  /* Audio controls: reposition above back-to-top, away from hamburger */
  .audio-controls {
    bottom: 70px;
    right: 16px;
  }

  .audio-toggle {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }

  /* Audio panel: position to left of toggle so it doesn't overflow right */
  .audio-panel {
    min-width: 180px;
  }

  /* Back to top: 44px touch target */
  .back-to-top {
    width: 44px;
    height: 44px;
    bottom: 16px;
    right: 16px;
    font-size: 1rem;
  }

  /* Back to dashboard: full-width on mobile */
  .back-to-dashboard-wrap {
    padding: 32px 0 24px;
  }

  .back-to-dashboard {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 0.75rem;
  }

  /* Search: full-width overlay on mobile */
  .search-overlay {
    padding-top: 8vh;
    align-items: flex-start;
  }

  .search-box {
    width: 96vw;
    max-width: 96vw;
  }

  .search-input-wrap {
    padding: 14px 12px;
  }

  .search-input-wrap input {
    font-size: 16px; /* Prevent iOS zoom */
  }

  .search-result-item {
    padding: 12px 16px;
    min-height: 44px;
  }

  /* Faction cards: single column (already done), ensure touch target */
  .faction-card {
    padding: 16px;
  }

  /* Tables in chapters: horizontal scroll wrapper */
  .page table,
  .body-text table,
  [id^="page-"] table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* Stat cards (By the Numbers): already 1-col at 768px via earlier rule */

  /* Phase cards: horizontal scroll with snap (already handled) */
  .phase-block {
    min-width: 240px;
  }

  /* System cards: already 1-col at 768px via earlier rule */

  /* Remove hover-only effects on mobile — use active states */
  .card:hover,
  .faction-card:hover,
  .system-card:hover,
  .phase-block:hover,
  .stat-block:hover,
  .formation-card:hover {
    transform: none;
    box-shadow: none;
  }

  .card:active {
    border-color: var(--border-hi);
    background: var(--bg-hover);
  }

  .faction-card:active {
    border-color: var(--faction-color, var(--accent));
    box-shadow:
      0 0 20px color-mix(in srgb, var(--faction-color, var(--accent)) 20%, transparent),
      inset 0 0 30px color-mix(in srgb, var(--faction-color, var(--accent)) 3%, transparent);
  }

  .system-card:active {
    border-color: var(--border-hi);
    border-left-color: var(--accent);
    background: var(--bg-hover);
  }

  .stat-block:active {
    border-color: var(--border-hi);
    box-shadow: 0 0 20px rgba(0,180,255,0.06), inset 0 0 20px rgba(0,180,255,0.02);
  }

  .formation-card:active {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(0,180,255,0.08);
  }

  .back-to-dashboard:hover {
    transform: none;
  }

  .back-to-dashboard:active {
    background: linear-gradient(135deg, var(--bg-hover), var(--bg-card));
    border-color: var(--text-hi);
    color: var(--text-hi);
    box-shadow: 0 0 24px rgba(0,180,255,0.25), inset 0 0 16px rgba(0,180,255,0.06);
  }

  /* Glossary tooltip: tap-friendly, no hover dependency */
  .glossary-term:hover::after,
  .glossary-term:hover::before {
    /* Keep hover behavior for hybrid devices but don't rely on it */
  }

  /* Chapter index items: larger touch targets */
  .ci-chapter {
    padding: 10px 18px 10px 32px;
    min-height: 44px;
  }

  .ci-part-header {
    padding: 12px 18px;
    min-height: 44px;
  }

  /* Chapter index close button */
  .chapter-index-close {
    width: 44px;
    height: 44px;
  }

  /* Chapter index toggle */
  .chapter-index-toggle {
    min-height: 44px;
    padding: 10px;
  }

  /* Sidebar filter input: prevent iOS zoom */
  .sidebar-filter input {
    font-size: 16px;
  }

  /* Prevent horizontal overflow on narrow viewports */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .main-content {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Faction flag badge: reposition on mobile */
  #faction-flag-badge {
    bottom: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
  }

  /* Edit bar: ensure touch targets */
  #edit-toggle,
  #export-btn {
    min-height: 36px;
    padding: 8px 14px;
  }
}

/* ── 18b. Tablet Breakpoint (≤1024px) ──
   Two-column stat cards on tablets.                              */
@media (max-width: 1024px) and (min-width: 769px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── 18c. Small Phone Breakpoint (≤480px) ──
   Extra-tight layouts for iPhone SE (375px) and similar.         */
@media (max-width: 480px) {

  /* Dashboard cards: single-column stack */
  .faction-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

  .systems-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Tighter main content padding */
  .main-content {
    padding: 12px 10px 60px;
    padding-top: 52px;
  }

  /* Hero section: tight padding */
  .hero-section {
    margin: -12px -10px 0;
    padding: 36px 12px 24px;
  }

  /* Phase cards: narrower for small screens */
  .phase-block {
    min-width: 200px;
  }

  /* Quote block: reduce padding */
  .quote-block {
    padding: 12px 10px;
  }

  /* Body text: constrain width */
  .body-text {
    font-size: 0.95rem;
  }

  /* Planet detail: tight layout */
  .planet-detail-inner {
    padding: 10px;
  }

  .planet-svg-wrap {
    max-width: 160px;
  }

  /* Territory bar: tighter */
  .territory-bar-row {
    grid-template-columns: 80px 1fr 44px;
    gap: 6px;
  }

  .territory-bar-label {
    font-size: 0.6rem;
  }

  /* Summary bar: stack on very small screens */
  .summary-bar {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
  }

  /* Prevent any element from causing horizontal overflow */
  img, svg, video, canvas, iframe {
    max-width: 100%;
    height: auto;
  }

  pre, code {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-all;
  }

  /* Section heading: smaller on phones */
  .section-heading {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
  }

  .section-label {
    font-size: 0.55rem;
  }
}


/* ═══════════════════════════════════════════════════════════
   15. CHAPTER CONTENT STYLING — Visual polish for chapter pages
   ═══════════════════════════════════════════════════════════
   Targets elements inside #content-area to style the chapter
   reading experience without modifying chapter HTML files.
   ═══════════════════════════════════════════════════════════ */

/* ── 15a. Content Wrapper — Constrain & Center ────────── */

#content-area > .fade-in {
  background: var(--bg-panel);
  border: 1px solid rgba(0,180,255,0.08);
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.5), inset 0 1px 0 rgba(0,180,255,0.05);
}

#content-area .fade-in {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  padding: 48px 40px;
  padding: 0 16px;
}

/* ── 15b. Section Labels — Monospace Pre-Heading ──────── */

#content-area .section-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.7;
  margin-bottom: 6px;
  margin-top: 48px;
  text-align: center;
}

/* ── 15c. Section Headings — Orbitron Glow ────────────── */

#content-area .section-heading {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  text-shadow: 0 0 14px rgba(0,180,255,0.25);
}

/* ── 15d. Paragraphs — Readable Body Text ─────────────── */

#content-area p {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.92rem;
  line-height: 1.85;
  color: var(--text-mid);
  margin-bottom: 20px;
  max-width: 800px;
}

#content-area .body-text {
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--text-body);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

/* ── 15e. Cards & Panels Inside Chapters ──────────────── */

#content-area .card {
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

#content-area .card:hover {
  border-color: rgba(0,180,255,0.2);
  background: var(--bg-hover);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(0,180,255,0.06);
}

/* ── 15f. Dividers — Gradient Line ────────────────────── */

#content-area .divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-hi), transparent);
  margin: 48px 0;
  border: none;
}

/* ── 15g. Bold/Strong Text — High Contrast ────────────── */

#content-area strong {
  color: var(--text-hi);
  font-weight: 600;
}

/* ── 15h. Links Inside Chapters ───────────────────────── */

#content-area a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

#content-area a:hover {
  color: var(--text-hi);
  text-decoration: underline;
  text-shadow: 0 0 8px rgba(0,180,255,0.3);
}

/* ── 15i. Lists — Accent Bullets & Spacing ────────────── */

#content-area ul,
#content-area ol {
  margin: 16px 0 20px 24px;
  max-width: 800px;
}

#content-area ul li,
#content-area ol li {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-mid);
  margin-bottom: 6px;
  padding-left: 4px;
}

#content-area ul li::marker {
  color: var(--accent);
}

#content-area ol li::marker {
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

/* ── 15j. Tables — Dark Header, Alternating Rows ─────── */

#content-area table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 0.82rem;
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  overflow: hidden;
}

#content-area table thead tr,
#content-area table tr:first-child {
  background: rgba(0,180,255,0.06);
}

#content-area table th {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-hi);
}

#content-area table td {
  padding: 8px 14px;
  color: var(--text-mid);
  border-bottom: 1px solid var(--border);
  line-height: 1.55;
}

#content-area table tbody tr:nth-child(even) {
  background: rgba(0,180,255,0.02);
}

#content-area table tbody tr:hover {
  background: rgba(0,180,255,0.05);
}

/* ── 15k. Blockquotes — Accent Border, Dim Background ── */

#content-area blockquote {
  border-left: 3px solid var(--accent);
  background: rgba(0,180,255,0.03);
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 0 4px 4px 0;
  font-style: italic;
  color: var(--text-mid);
  line-height: 1.75;
}

#content-area blockquote p {
  margin-bottom: 0;
}

/* ── 15l. Code & Pre Blocks — Monospace Terminal ──────── */

#content-area code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
  background: rgba(0,180,255,0.06);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  color: var(--accent);
}

#content-area pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  padding: 16px 20px;
  margin: 16px 0 24px;
  overflow-x: auto;
  line-height: 1.6;
  color: var(--text-body);
}

#content-area pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ── 15m. Headings Inside Chapters ────────────────────── */

#content-area h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: 0.08em;
  text-shadow: 0 0 14px rgba(0,180,255,0.2);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-top: 48px;
  margin-bottom: 24px;
}

#content-area h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-hi);
  letter-spacing: 0.06em;
  margin-top: 32px;
  margin-bottom: 16px;
  opacity: 0.9;
}

#content-area h4 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 24px;
  margin-bottom: 12px;
}

/* ── 15n. Quote Blocks Inside Chapters ────────────────── */

#content-area .quote-block {
  border-left: 3px solid var(--accent);
  background: rgba(0,180,255,0.03);
  border-radius: 0 4px 4px 0;
  padding: 16px 24px;
  margin: 20px 0;
  text-align: left;
}

/* ── 15o. Accordion / Expandable Sections ─────────────── */

#content-area [onclick] {
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

#content-area [onclick]:hover {
  background: var(--bg-hover);
}

/* ── 15p. Data Grids — Inline Grid Layouts ────────────── */

#content-area [style*="display:grid"],
#content-area [style*="display: grid"] {
  gap: 12px;
}

/* Style grid rows used as data tables (with border styling) */
#content-area [style*="grid-template-columns"] > div {
  transition: background 0.2s ease;
}

/* ── 15q. Proto Badge — Status Tag ────────────────────── */

.proto-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  color: var(--accent);
  background: rgba(0,180,255,0.08);
  border: 1px solid rgba(0,180,255,0.2);
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: 0.1em;
  margin-left: 8px;
  vertical-align: middle;
}

/* ── 15r. Page Title & Subtitle in Chapters ───────────── */

#content-area .page-title {
  text-shadow: 0 0 20px rgba(0,180,255,0.2);
}

#content-area .page-subtitle {
  margin-bottom: 4px;
}

/* ── 15s. General Polish — Transitions & Spacing ──────── */

#content-area .page {
  padding-bottom: 48px;
}

#content-area .page > .card,
#content-area .page > [style*="display:grid"],
#content-area .page > [style*="display: grid"] {
  margin-bottom: 24px;
}

/* Smooth transitions on all interactive chapter elements */
#content-area .card,
#content-area .section-label,
#content-area .section-heading,
#content-area .divider,
#content-area a,
#content-area strong {
  transition: all 0.25s ease;
}


/* ═══════════════════════════════════════════════════════════
   16. FACTION-SPECIFIC CHAPTER THEMING
   ═══════════════════════════════════════════════════════════
   When a faction chapter is active, body receives a faction
   class (e.g. faction-terran). Override --accent and apply
   faction-colored glows to chapter elements.
   ═══════════════════════════════════════════════════════════ */

/* ── Faction Accent Overrides ── */
body.faction-terran    { --accent: #00b4ff; }
body.faction-shards    { --accent: #00ffee; }
body.faction-horde     { --accent: #ff6622; }
body.faction-necro     { --accent: #44ff66; }
body.faction-accord    { --accent: #ffaa22; }
body.faction-vorax     { --accent: #ff2266; }
body.faction-guardians { --accent: #cc44ff; }

/* ── Section Heading Glow — Faction Color ── */
body.faction-terran    #content-area .section-heading { text-shadow: 0 0 14px rgba(0,180,255,0.3); }
body.faction-shards    #content-area .section-heading { text-shadow: 0 0 14px rgba(0,255,238,0.3); }
body.faction-horde     #content-area .section-heading { text-shadow: 0 0 14px rgba(255,102,34,0.3); }
body.faction-necro     #content-area .section-heading { text-shadow: 0 0 14px rgba(68,255,102,0.3); }
body.faction-accord    #content-area .section-heading { text-shadow: 0 0 14px rgba(255,170,34,0.3); }
body.faction-vorax     #content-area .section-heading { text-shadow: 0 0 14px rgba(255,34,102,0.3); }
body.faction-guardians #content-area .section-heading { text-shadow: 0 0 14px rgba(204,68,255,0.3); }

/* ── Card Borders — Faction Color on Hover ── */
body.faction-terran    #content-area .card:hover { border-color: rgba(0,180,255,0.25); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(0,180,255,0.08); }
body.faction-shards    #content-area .card:hover { border-color: rgba(0,255,238,0.25); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(0,255,238,0.08); }
body.faction-horde     #content-area .card:hover { border-color: rgba(255,102,34,0.25); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(255,102,34,0.08); }
body.faction-necro     #content-area .card:hover { border-color: rgba(68,255,102,0.25); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(68,255,102,0.08); }
body.faction-accord    #content-area .card:hover { border-color: rgba(255,170,34,0.25); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(255,170,34,0.08); }
body.faction-vorax     #content-area .card:hover { border-color: rgba(255,34,102,0.25); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(255,34,102,0.08); }
body.faction-guardians #content-area .card:hover { border-color: rgba(204,68,255,0.25); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(204,68,255,0.08); }

/* ── Links — Faction Color ── */
body[class*="faction-"] #content-area a {
  color: var(--accent);
}

body[class*="faction-"] #content-area a:hover {
  color: var(--text-hi);
  text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ── Section Label — Faction Color ── */
body[class*="faction-"] #content-area .section-label {
  color: var(--accent);
}

/* ── Blockquote & Quote Block — Faction Border ── */
body[class*="faction-"] #content-area blockquote {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 3%, transparent);
}

/* ── Table Header — Faction Tint ── */
body[class*="faction-"] #content-area table thead tr,
body[class*="faction-"] #content-area table tr:first-child {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

body[class*="faction-"] #content-area table th {
  color: var(--accent);
}

/* ── Code — Faction Accent ── */
body[class*="faction-"] #content-area code {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-color: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ── Proto Badge — Faction Color ── */
body[class*="faction-"] .proto-badge {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-color: color-mix(in srgb, var(--accent) 20%, transparent);
}


/* ── 16b. Chapter Content Responsive ──────────────────── */

@media (max-width: 768px) {
  #content-area .fade-in {
    padding: 0 8px;
  }

  #content-area .section-heading {
    font-size: 0.85rem;
    letter-spacing: 0.08em;
  }

  #content-area .section-label {
    margin-top: 32px;
  }

  #content-area h2 {
    font-size: 1.05rem;
    margin-top: 32px;
  }

  #content-area h3 {
    font-size: 0.88rem;
    margin-top: 24px;
  }

  #content-area pre {
    padding: 12px 14px;
    font-size: 0.75rem;
  }

  #content-area table {
    font-size: 0.75rem;
  }

  #content-area table th,
  #content-area table td {
    padding: 6px 10px;
  }
}

@media (max-width: 480px) {
  #content-area .fade-in {
    padding: 0 4px;
  }

  #content-area .section-heading {
    font-size: 0.72rem;
  }

  #content-area .card {
    padding: 14px;
  }

  #content-area .divider {
    margin: 32px 0;
  }
}
