/* ============================================================
   Thoria Campaign v3 — cinematic codex (long-scroll)
   ============================================================ */

/* ----------------------------------------------------------------
   DEFAULT — DAY mode. Warm parchment off-white + verdant green magic.
   The world of Thoria by daylight: ink on vellum, green flame in
   the windows, the second moon still palely visible.
   ---------------------------------------------------------------- */
:root {
  --bg:           #ece3c9;
  --bg-rise:      #e5dabe;
  --bg-deep:      #d7caa7;
  --bg-card:      #f5eed5;
  --bg-card-2:    #ece3c9;
  --bg-elev:      #faf3da;

  --border:       #c2b58e;
  --border-strong:#9a8d68;
  --border-soft:  #d4c8a3;

  --text:         #1a1812;
  --text-soft:    #4a4232;
  --text-dim:     #7c7053;
  --text-fade:    #a59a7a;

  /* --gold == primary magical accent. In day: verdant green. */
  --gold:         #2c7a4a;
  --gold-bright:  #46a36c;
  --gold-deep:    #194f2c;
  --gold-wash:    rgba(44, 122, 74, 0.10);

  /* HP / damage / blood — kept rusty so it never collides with primary. */
  --crimson:      #8a2828;
  --crimson-deep: #5a1414;
  --crimson-wash: rgba(138, 40, 40, 0.06);

  /* Secondary scholarly amber (items, coin). Distinct from primary green. */
  --emerald:      #8a6920;
  --azure:        #2f6298;

  --dm:           #6c3da0;
  --dm-deep:      #4a2070;
  --dm-bright:    #9468c6;
  --dm-wash:      rgba(108, 61, 160, 0.06);

  /* Magic RGB (for rgba glows in components / SVG) */
  --magic-rgb:    44, 122, 74;

  /* Hero illustration tokens — re-themed per mode below */
  --hero-sky-top:    #c7ba94;
  --hero-sky-mid:    #b6a880;
  --hero-sky-bot:    #d6c9a4;
  --hero-mountain:   #847859;
  --hero-city-back:  #5a5240;
  --hero-city-front: #3a3526;
  --hero-moon-warm:  #f6efd5;
  --hero-moon-warm-2:#c4b690;
  --hero-moon-cool:  #a691c4;
  --hero-moon-cool-2:#7158a3;
  --hero-spire-light:#46a36c;
  --hero-spire-glow: #5fcf8a;
  --hero-star:       #5a5240;
  --hero-fog:        #ece3c9;

  --font-display: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --font-body:    "Lora", "Cormorant Garamond", Georgia, serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;
  --font-hand:    "Caveat", cursive;

  --max-w: 1180px;
}

/* ----------------------------------------------------------------
   NIGHT mode. Deep black + blood red. The kingdom after curfew —
   when the lanterns have gone out and the red moon rises alone.
   ---------------------------------------------------------------- */
[data-theme="night"] {
  --bg:           #08060a;
  --bg-rise:      #110a0d;
  --bg-deep:      #040203;
  --bg-card:      #17090d;
  --bg-card-2:    #1c0e13;
  --bg-elev:      #221019;

  --border:       #2a1a20;
  --border-strong:#3d2730;
  --border-soft:  #1a0e12;

  --text:         #ece1d8;
  --text-soft:    #b3a89c;
  --text-dim:     #75645c;
  --text-fade:    #4a3e3a;

  /* --gold == primary magical accent. At night: blood red. */
  --gold:         #c83f3c;
  --gold-bright:  #e36461;
  --gold-deep:    #7a1d1c;
  --gold-wash:    rgba(200, 63, 60, 0.10);

  /* HP shifted to ember so it stays legible against red-dominant UI. */
  --crimson:      #d68a40;
  --crimson-deep: #8a5520;
  --crimson-wash: rgba(214, 138, 64, 0.08);

  --emerald:      #6a8a52;
  --azure:        #6090b8;

  --dm:           #b18fd9;
  --dm-deep:      #6f4a9c;
  --dm-bright:    #d3b4f0;
  --dm-wash:      rgba(177, 143, 217, 0.07);

  --magic-rgb:    200, 63, 60;

  --hero-sky-top:    #060206;
  --hero-sky-mid:    #100306;
  --hero-sky-bot:    #1a0709;
  --hero-mountain:   #1c0a0d;
  --hero-city-back:  #140609;
  --hero-city-front: #080304;
  --hero-moon-warm:  #d44542;
  --hero-moon-warm-2:#7a1d1c;
  --hero-moon-cool:  #c9a8e8;
  --hero-moon-cool-2:#7a5da8;
  --hero-spire-light:#e36461;
  --hero-spire-glow: #ff7c78;
  --hero-star:       #ece1d8;
  --hero-fog:        #08060a;
}

/* ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: rgba(var(--magic-rgb), 0.28); color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }

a { color: var(--gold); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover { color: var(--gold-bright); border-bottom-color: var(--gold); }

/* Atmospheric body backdrop — subtle magic glow + vignette */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(var(--magic-rgb), 0.10), transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(var(--magic-rgb), 0.05), transparent 50%),
    radial-gradient(ellipse at 50% 50%, transparent 30%, var(--bg-deep) 100%);
}

/* A faint pulse of magic — slowed and very subtle */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 50% 30%, rgba(var(--magic-rgb), 0.06), transparent 40%);
  animation: magic-pulse 9s ease-in-out infinite;
}
@keyframes magic-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* ============================================================
   TOP NAV — slim, floats over hero, sticks
   ============================================================ */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--bg-deep) 0%, rgba(0, 0, 0, 0) 100%);
  transition: background 0.3s, border-bottom-color 0.3s;
  border-bottom: 1px solid transparent;
}
.topnav.scrolled {
  background: var(--bg-deep);
  backdrop-filter: blur(8px);
  border-bottom-color: var(--border);
}
/* Night mode override (default :root is day) */
.topnav { background: linear-gradient(180deg, var(--bg-deep) 0%, rgba(215, 202, 167, 0.7) 70%, transparent 100%); }
.topnav.scrolled { background: rgba(236, 227, 201, 0.92); }
[data-theme="night"] .topnav { background: linear-gradient(180deg, var(--bg-deep) 0%, rgba(8, 6, 10, 0.7) 70%, transparent 100%); }
[data-theme="night"] .topnav.scrolled { background: rgba(8, 6, 10, 0.92); }

.topnav-brand {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
  cursor: pointer;
  border-bottom: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.topnav-brand em { font-style: italic; color: var(--gold); }

.topnav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}

.topnav-link {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  background: none;
}
.topnav-link:hover { color: var(--gold); }
.topnav-link.active { color: var(--gold); border-color: var(--border-strong); }

/* Theme toggle in topnav — a tiny moon/sun marker */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  cursor: pointer;
  margin-left: 10px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle:hover { color: var(--gold); border-color: var(--gold); }

.theme-toggle-glyph {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  transition: background 0.25s, box-shadow 0.25s;
}
/* Day: a small green sun-disc with verdant halo */
.theme-toggle-glyph.is-day {
  background: radial-gradient(circle at 35% 35%, var(--gold-bright), var(--gold) 60%, var(--gold-deep));
  box-shadow: 0 0 0 1px var(--gold-deep), 0 0 10px rgba(var(--magic-rgb), 0.55);
}
/* Night: blood moon with a crescent shadow */
.theme-toggle-glyph.is-night {
  background: radial-gradient(circle at 35% 35%, var(--gold-bright), var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 0 0 1px var(--gold-deep), 0 0 12px rgba(var(--magic-rgb), 0.7);
}
.theme-toggle-glyph.is-night::after {
  content: "";
  position: absolute;
  inset: -2px -6px -2px 4px;
  border-radius: 50%;
  background: var(--bg);
}

.theme-toggle-label {
  font-weight: 500;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px 24px 60px;
  overflow: hidden;
}

.hero-illustration {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-illustration svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 900px;
}
/* Soft halo behind hero text so it reads cleanly over the city silhouette */
.hero-content::before {
  content: "";
  position: absolute;
  inset: -100px -200px;
  z-index: -1;
  background: radial-gradient(ellipse 55% 65% at center, var(--bg) 0%, var(--bg) 25%, color-mix(in oklab, var(--bg) 75%, transparent) 55%, transparent 85%);
  pointer-events: none;
  filter: blur(8px);
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 28px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(64px, 11vw, 156px);
  font-weight: 400;
  line-height: 1.05;
  color: var(--text);
  margin: 0 0 36px;
  letter-spacing: -0.015em;
  padding-bottom: 4px;
}
.hero-title .word {
  display: inline-block;
}
.hero-title em {
  font-style: italic;
  color: var(--gold);
  font-weight: 400;
}

.hero-sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(20px, 2.2vw, 28px);
  color: var(--text-soft);
  margin: 0 auto 36px;
  max-width: 640px;
  line-height: 1.4;
}

.hero-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: inline-flex;
  gap: 18px;
  align-items: center;
  padding: 10px 22px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: color-mix(in oklab, var(--bg-deep) 70%, transparent);
}
.hero-meta { background: var(--bg-card); }
[data-theme="night"] .hero-meta { background: rgba(8, 6, 10, 0.55); }
.hero-meta strong { color: var(--gold); font-weight: 500; }
.hero-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-fade); }

/* Scroll cue */
.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: float 2.5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.6; }
  50% { transform: translate(-50%, 6px); opacity: 1; }
}
.scroll-cue-line {
  width: 1px;
  height: 32px;
  background: linear-gradient(180deg, var(--text-fade), transparent);
}

/* Twinkling stars */
@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.star { animation: twinkle 4s ease-in-out infinite; }

/* Magic-pulse: lit window in the spire breathes */
@keyframes hero-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
.hero-pulse { animation: hero-pulse 3.2s ease-in-out infinite; transform-origin: center; }

/* Lanterns flicker softly */
@keyframes hero-lantern {
  0%, 100% { opacity: 0.85; }
  40%      { opacity: 1; }
  70%      { opacity: 0.7; }
}
.hero-lantern { animation: hero-lantern 4.5s ease-in-out infinite; }

/* ============================================================
   CHAPTER WRAPPER
   ============================================================ */
.chapter {
  position: relative;
  padding: 120px 24px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.chapter--wide { max-width: 1480px; }
.chapter--full { max-width: none; padding-left: 0; padding-right: 0; }

.chapter-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.chapter-title {
  font-family: var(--font-display);
  font-size: clamp(44px, 6.5vw, 88px);
  font-weight: 400;
  line-height: 1;
  color: var(--text);
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}
.chapter-title em { font-style: italic; color: var(--gold); }

.chapter-deck {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(18px, 1.7vw, 22px);
  color: var(--text-soft);
  max-width: 680px;
  margin-bottom: 56px;
  line-height: 1.5;
}

/* Decorative divider */
.divider {
  position: relative;
  text-align: center;
  margin: 0 auto;
  padding: 60px 0;
  max-width: var(--max-w);
}
.divider::before, .divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}
.divider::before { left: 10%; }
.divider::after { right: 10%; }
.divider-glyph {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--gold);
  position: relative;
}

/* Pull quote — large italic, dropped into the page */
.pullquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 400;
  line-height: 1.3;
  color: var(--text);
  max-width: 800px;
  margin: 72px auto;
  text-align: center;
  position: relative;
  padding: 24px 24px;
}
.pullquote::before {
  content: "\201C";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 90px;
  color: var(--gold);
  opacity: 0.4;
  line-height: 0.8;
}
.pullquote-attr {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 18px;
  display: block;
}

/* ============================================================
   STORY (Chapter I)
   ============================================================ */
.story-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 64px;
  align-items: start;
}
@media (max-width: 880px) { .story-grid { grid-template-columns: 1fr; gap: 36px; } }

.story-prose {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.7;
  color: var(--text);
}
.story-prose p:first-child::first-letter {
  font-size: 72px;
  font-weight: 500;
  float: left;
  line-height: 0.85;
  padding: 6px 14px 0 0;
  color: var(--gold);
}
.story-prose p {
  margin: 0 0 18px;
}

.story-sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.threads-box {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px 24px;
  background: var(--bg-card);
}
.threads-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.thread-row { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.thread-row:last-child { border-bottom: none; padding-bottom: 0; }
.thread-row:first-child { padding-top: 0; }
.thread-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.thread-note {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.5;
}

/* Fact tile */
.fact-tile {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 22px;
  background: var(--bg-card);
}
.fact-tile-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.fact-tile-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

/* ============================================================
   WORLD / MAP (Chapter II)
   ============================================================ */
.world-banner {
  position: relative;
  width: 100%;
  margin: 0 auto 80px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.world-banner-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 80px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 880px) { .world-banner-inner { grid-template-columns: 1fr; gap: 32px; } }

.world-prose {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.65;
  color: var(--text);
}

.almanac {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) { .almanac { grid-template-columns: 1fr; } }

.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin: 40px 0;
}
.region-card {
  padding: 22px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}
.region-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.region-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 8px;
}
.region-desc {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--text-soft);
  margin: 0;
}

/* Map */
.map-wrap {
  position: relative;
  background: var(--bg-rise);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.5);
}
.map-wrap svg { display: block; width: 100%; height: 100%; }

.map-pin {
  position: absolute;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  margin-top: -22px;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  transition: transform 0.15s;
  background: none;
  border: none;
  padding: 0;
}
.map-pin:hover { transform: scale(1.25); }
.map-pin.dm-pin { filter: drop-shadow(0 0 8px var(--dm)); }

.map-pin-label {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.map-pin:hover .map-pin-label { opacity: 1; }

.map-legend {
  display: flex; gap: 18px; margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  flex-wrap: wrap;
  justify-content: center;
}
.map-legend i {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

/* ============================================================
   THE COMPANY (Chapter III)
   ============================================================ */
.company-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-top: 40px;
}
@media (max-width: 980px) { .company-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .company-grid { grid-template-columns: 1fr; } }

.pc-portrait-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px 18px 22px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.pc-portrait-card::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 60%;
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--gold-deep), transparent);
}
.pc-portrait-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 20px 40px -20px rgba(var(--magic-rgb), 0.3);
}
.pc-portrait-card:hover::before {
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
}

.pc-medallion {
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--bg-elev), var(--bg-card-2));
  border: 2px solid var(--gold);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 500;
  color: var(--gold);
  box-shadow: 0 0 0 4px var(--bg-card), 0 0 24px rgba(var(--magic-rgb), 0.25);
  position: relative;
}
.pc-medallion::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid var(--gold-deep);
  opacity: 0.4;
}

.pc-portrait-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.05;
}
.pc-portrait-class {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 14px;
}
.pc-portrait-tagline {
  font-size: 13px;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-soft);
  line-height: 1.4;
  min-height: 60px;
}
.pc-portrait-cta {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.15s;
}
.pc-portrait-card:hover .pc-portrait-cta { color: var(--gold); }

/* ============================================================
   CHARACTER SHEET (in modal)
   ============================================================ */
.sheet-modal {
  background: var(--bg-rise);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  max-width: 1180px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.7);
  position: relative;
}

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, var(--bg-rise) 80%, transparent);
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 28px 36px 22px;
  border-bottom: 1px solid var(--border);
}

.sheet-portrait {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--bg-elev), var(--bg-card));
  border: 2px solid var(--gold);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  color: var(--gold);
  box-shadow: 0 0 18px rgba(var(--magic-rgb), 0.25);
}

.sheet-name {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
  margin: 0 0 6px;
}

.sheet-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.sheet-meta strong { color: var(--gold); font-weight: 500; }
.sheet-meta .sep { color: var(--text-fade); margin: 0 8px; }

.sheet-tags-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.inspiration-badge {
  appearance: none;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 8px 14px;
  border: 1px solid var(--gold);
  border-radius: 3px;
  background: var(--gold-wash);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.inspiration-badge:hover { transform: translateY(-1px); border-color: var(--gold-bright); }
.inspiration-badge.off { color: var(--text-dim); border-color: var(--border); background: transparent; }

.sheet-body { padding: 28px 36px 40px; }

.ability-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
@media (max-width: 720px) { .ability-row { grid-template-columns: repeat(3, 1fr); } }

.ability-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 12px 12px;
  text-align: center;
}
.ability-name {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--text-dim);
}
.ability-mod {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 500;
  color: var(--gold);
  line-height: 1;
  margin: 6px 0 2px;
}
.ability-score {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
  display: inline-block;
}
.save-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--text-fade);
  margin-right: 6px;
  vertical-align: middle;
}
.save-dot.prof { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 6px rgba(var(--magic-rgb),0.5); }
.ability-save {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
}
.ability-save strong { color: var(--text); font-weight: 500; margin-left: 4px; }

.sheet-grid {
  display: grid;
  grid-template-columns: 220px 1fr 1fr;
  gap: 22px;
}
@media (max-width: 1100px) { .sheet-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .sheet-grid { grid-template-columns: 1fr; } }

.sheet-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px 16px;
}
.panel-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.combat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.combat-stat {
  text-align: center;
  padding: 10px 6px;
  background: var(--bg);
  border-radius: 4px;
  border: 1px solid var(--border-soft);
}
.combat-stat-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
}
.combat-stat-num.hp { color: var(--crimson); }
.combat-stat-num.ac { color: var(--gold); }
.combat-stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 4px;
}
.hp-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.hp-bar-fill { height: 100%; background: linear-gradient(90deg, var(--crimson-deep), var(--crimson)); }

.stat-block {
  font-family: var(--font-mono);
  font-size: 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  color: var(--text);
}
.stat-block dt { color: var(--text-dim); letter-spacing: 0.12em; text-transform: uppercase; font-size: 10px; padding-top: 1px; }
.stat-block dd { margin: 0; color: var(--text); }

.skill-list { display: flex; flex-direction: column; gap: 2px; }
.skill-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  padding: 4px 0;
  align-items: center;
  font-size: 12px;
  border-bottom: 1px dashed var(--border-soft);
}
.skill-row:last-child { border-bottom: none; }
.skill-row .skill-name { color: var(--text-soft); }
.skill-row.prof .skill-name { color: var(--text); }
.skill-row.expert .skill-name { color: var(--gold); font-weight: 500; }
.skill-row .skill-mod {
  font-family: var(--font-mono);
  color: var(--text);
  font-size: 11px;
  min-width: 28px;
  text-align: right;
}
.skill-row .skill-mod.bonus { color: var(--gold); }
.skill-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1px solid var(--text-fade);
  background: transparent;
}
.skill-dot.prof { background: var(--gold); border-color: var(--gold); }
.skill-dot.expert { background: var(--gold-bright); border-color: var(--gold-bright); box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3px var(--gold); }
.skill-ability {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-fade);
  letter-spacing: 0.1em;
  margin-left: 6px;
}

.attack-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-soft);
  align-items: baseline;
}
.attack-row:last-child { border-bottom: none; }
.attack-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}
.attack-bonus {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gold);
  white-space: nowrap;
}
.attack-damage {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--crimson);
  white-space: nowrap;
}
.attack-note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: -2px;
}

.feature-row {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.feature-row:last-child { border-bottom: none; }
.feature-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.feature-desc {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.5;
}

.spell-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}
.slot-pill {
  text-align: center;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
}
.slot-pill-lvl {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.slot-pill-count {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--gold);
  line-height: 1;
  margin-top: 2px;
}
.spell-list { display: flex; flex-direction: column; gap: 3px; }
.spell-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
  color: var(--text);
}
.spell-lvl {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  padding-top: 2px;
}
.spell-lvl.cantrip { color: var(--azure); }
.cast-info {
  display: flex; gap: 16px; margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  flex-wrap: wrap;
}
.cast-info strong { color: var(--text); font-weight: 500; margin-left: 4px; }

.eq-list { display: flex; flex-direction: column; gap: 4px; }
.eq-row {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-soft);
  border-bottom: 1px dashed var(--border-soft);
}
.eq-row:last-child { border-bottom: none; }
.eq-row::before {
  content: "◇";
  color: var(--gold-deep);
  font-size: 10px;
  padding-top: 2px;
}
.coin-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-soft);
}
.coin-row .coin-amt { color: var(--gold); font-weight: 500; }

.prof-list { font-size: 13px; line-height: 1.6; }
.prof-list .plabel {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
  display: block;
}
.prof-list .pval { color: var(--text); margin-bottom: 8px; }

.tibf { display: flex; flex-direction: column; gap: 10px; }
.tibf-row { border-left: 2px solid var(--gold); padding: 4px 0 4px 14px; }
.tibf-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.tibf-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--text);
  line-height: 1.45;
  margin-top: 2px;
}

.backstory-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 28px 32px;
  margin-top: 28px;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
}
.backstory-block p:first-child::first-letter {
  font-size: 52px;
  font-weight: 600;
  float: left;
  line-height: 0.9;
  padding: 4px 10px 0 0;
  color: var(--gold);
}

.hook-list { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.hook-row {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--text);
  padding: 6px 0 6px 14px;
  border-left: 2px solid var(--gold-deep);
}

/* ============================================================
   CAST (Chapter IV)
   ============================================================ */
.cast-toolbar {
  display: flex;
  gap: 8px;
  margin: 24px 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.toggle-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 9px 16px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}
.toggle-btn:hover { border-color: var(--gold); color: var(--gold); }
.toggle-btn.active { background: var(--gold-wash); color: var(--gold-bright); border-color: var(--gold); }

.npc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.npc-card {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.npc-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.npc-card.has-secret { border-style: dashed; }
body.dm-mode .npc-card.has-secret { border-color: var(--dm); border-style: solid; }
body.dm-mode .npc-card.has-secret::after {
  content: "";
  position: absolute;
  top: 8px; right: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--dm);
  box-shadow: 0 0 8px var(--dm);
}

.npc-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-card-2);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--gold);
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
}
body.dm-mode .npc-card.has-secret .npc-avatar { border-color: var(--dm); color: var(--dm); }

.npc-info { flex: 1; min-width: 0; }
.npc-info h4 {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}
.npc-info .role {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.relationship-graph {
  background: var(--bg-rise);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 18px;
  overflow: hidden;
}
.relationship-graph svg { display: block; width: 100%; height: 600px; }

/* ============================================================
   CODEX (Chapter V) — factions, bestiary, items, sessions, rules
   ============================================================ */
.codex-tabs {
  display: flex;
  gap: 4px;
  margin: 20px 0 32px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}
.codex-tab {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.codex-tab:hover { color: var(--text); }
.codex-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.faction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.faction-card {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  position: relative;
}
.faction-sigil {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--gold);
  background: var(--gold-wash);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.inspiration-badge:hover { transform: translateY(-1px); border-color: var(--gold-bright); }
.faction-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  padding-right: 60px;
  margin: 0 0 4px;
  color: var(--text);
}
.faction-motto {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--gold);
  margin-bottom: 12px;
}

.beast-grid, .item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.beast-card, .item-card {
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.item-card { border-left: 3px solid var(--gold); }
.beast-name, .item-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.item-name { color: var(--gold-bright); }
.beast-type, .item-kind {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.beast-desc, .item-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 30px;
  max-width: 820px;
  margin: 0 auto;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 8px; top: 4px; bottom: 4px;
  width: 1px;
  background: linear-gradient(180deg, var(--gold), var(--border-strong));
}
.timeline-entry { position: relative; margin-bottom: 32px; }
.timeline-entry::before {
  content: "";
  position: absolute;
  left: -27px; top: 8px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--gold-deep);
}
.timeline-entry.latest::before {
  background: var(--gold);
  border-color: var(--gold-bright);
  box-shadow: 0 0 12px var(--gold);
}
.timeline-date {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.timeline-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.1;
}
.timeline-summary {
  font-family: var(--font-display);
  font-size: 17px;
  font-style: italic;
  color: var(--text-soft);
  line-height: 1.55;
  margin: 0;
}

/* House rules */
.rule-list { counter-reset: rule; max-width: 800px; margin: 0 auto; }
.rule-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 22px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.rule-item:last-child { border-bottom: none; }
.rule-item::before {
  counter-increment: rule;
  content: counter(rule, upper-roman) ".";
  font-family: var(--font-display);
  font-size: 38px;
  color: var(--gold);
  font-weight: 500;
  line-height: 1;
  text-align: right;
}
.rule-item h4 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
}
.rule-item p {
  font-size: 15px;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-soft);
  margin: 0;
  line-height: 1.55;
}

/* ============================================================
   DM elements
   ============================================================ */
.moon-toggle {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--text-dim), var(--text-fade) 60%, var(--bg));
  cursor: pointer;
  z-index: 60;
  opacity: 0.35;
  transition: opacity 0.3s, box-shadow 0.3s, background 0.3s;
  border: none;
  padding: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04);
}
.moon-toggle:hover { opacity: 1; }
body.dm-mode .moon-toggle {
  background: radial-gradient(circle at 30% 30%, var(--dm-bright), var(--dm) 60%, var(--dm-deep));
  box-shadow: 0 0 16px var(--dm), 0 0 0 1px var(--dm-bright);
  opacity: 1;
}

.dm-banner {
  display: none;
  position: sticky;
  top: 0;
  z-index: 55;
  background: linear-gradient(90deg, var(--dm-deep), var(--dm), var(--dm-deep));
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 8px 24px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--dm-bright);
}
body.dm-mode .dm-banner { display: flex; }

.dm-banner-exit {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 3px;
}
.dm-banner-exit:hover { background: rgba(255,255,255,0.22); }

.dm-only { display: none; }
body.dm-mode .dm-only { display: block; }

.dm-block {
  position: relative;
  background: var(--dm-wash);
  border: 1px solid rgba(177, 143, 217, 0.25);
  border-left: 3px solid var(--dm);
  border-radius: 4px;
  padding: 18px 22px;
  margin: 20px 0;
}
.dm-block::before {
  content: "DM";
  position: absolute;
  top: -8px;
  left: 14px;
  background: var(--dm-deep);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  padding: 2px 8px;
  border-radius: 2px;
}
.dm-block h4 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--dm-bright);
}
.dm-block p {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: 16px;
  font-style: italic;
}
.dm-block p:last-child { margin-bottom: 0; }
.dm-block ul { margin: 0; padding-left: 18px; color: var(--text-soft); }
.dm-block li { margin-bottom: 4px; font-family: var(--font-display); font-style: italic; }

/* Editable */
[contenteditable="true"] {
  outline: none;
  background: rgba(var(--magic-rgb), 0.06);
  box-shadow: 0 0 0 1px rgba(var(--magic-rgb), 0.25);
  border-radius: 2px;
  padding: 0 4px;
  margin: 0 -4px;
}
[contenteditable="true"]:focus {
  background: rgba(var(--magic-rgb), 0.14);
  box-shadow: 0 0 0 1px var(--gold);
}
body:not(.dm-mode) [contenteditable] { pointer-events: none; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in oklab, var(--bg-deep) 75%, transparent);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-rise);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.7);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  z-index: 4;
}
.modal-close:hover { background: var(--crimson-deep); color: #fff; border-color: var(--crimson); }

.modal-head {
  padding: 30px 36px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
}
.modal-portrait {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--bg-card-2);
  border: 2px solid var(--gold);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--gold);
  font-weight: 600;
}
.modal-name {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--text);
}
.modal-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.modal-body { padding: 24px 36px 32px; }

.modal-body h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--gold);
  margin: 18px 0 6px;
}
.modal-body p { color: var(--text); font-size: 15px; }
.modal-body p.lead {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  color: var(--text);
  line-height: 1.55;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px 9px;
  background: var(--bg-card-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.tag.gold { background: var(--gold-wash); color: var(--gold); border-color: rgba(var(--magic-rgb), 0.3); }
.tag.dm { background: var(--dm-wash); color: var(--dm); border-color: rgba(177, 143, 217, 0.3); }

/* Password modal */
.pwd-modal {
  background: var(--bg-rise);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 40px 44px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.7);
}
.pwd-modal .moon-emblem {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--dm-bright), var(--dm) 60%, var(--dm-deep));
  box-shadow: 0 0 28px var(--dm);
}
.pwd-modal h3 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  margin: 0 0 4px;
  color: var(--text);
}
.pwd-modal p.hint {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--text-soft);
  margin-bottom: 20px;
}
.pwd-modal input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  border-radius: 4px;
  text-align: center;
  letter-spacing: 0.18em;
}
.pwd-modal input:focus { border-color: var(--dm); box-shadow: 0 0 0 2px var(--dm-wash); }
.pwd-modal .pwd-actions { display: flex; gap: 10px; margin-top: 16px; }
.pwd-modal button {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  border-radius: 4px;
}
.pwd-modal button.primary { background: var(--dm); color: #fff; border-color: var(--dm); }
.pwd-modal button.primary:hover { background: var(--dm-deep); }
.pwd-modal .pwd-err {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--crimson);
  letter-spacing: 0.06em;
  margin-top: 10px;
  min-height: 14px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  margin-top: 120px;
  padding: 60px 24px 80px;
  border-top: 1px solid var(--border);
  text-align: center;
  background: var(--bg-deep);
}
.footer-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 6px;
}
.footer-title em { font-style: italic; color: var(--gold); }
.footer-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 30px;
}
.footer-glyph {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--gold-deep);
}

/* ============================================================
   LANDING — section overview cards
   ============================================================ */
.landing-pulse {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 100px 24px 0;
}
.landing-pulse-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.landing-pulse-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 28px 32px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
  align-items: start;
  box-shadow: 0 20px 40px -28px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}
.landing-pulse-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
@media (max-width: 720px) { .landing-pulse-card { grid-template-columns: 1fr; gap: 20px; } }

.landing-pulse-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.1;
}
.landing-pulse-title em { font-style: italic; color: var(--gold); }
.landing-pulse-where {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: var(--text-soft);
  margin: 0 0 16px;
  line-height: 1.5;
}
.landing-pulse-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.landing-pulse-stat {
  border-left: 2px solid var(--gold);
  padding: 4px 0 4px 14px;
}
.landing-pulse-stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 3px;
}
.landing-pulse-stat-value {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
  line-height: 1.3;
}

/* Section grid */
.section-overview {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 100px 24px;
}
.section-overview-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
  text-align: center;
}
.section-overview-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 400;
  color: var(--text);
  text-align: center;
  margin: 0 0 56px;
  letter-spacing: -0.01em;
}
.section-overview-title em { font-style: italic; color: var(--gold); }

.section-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
@media (max-width: 980px) { .section-card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .section-card-grid { grid-template-columns: 1fr; } }

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px 28px 26px;
  text-decoration: none;
  color: var(--text);
  border-bottom: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
  min-height: 240px;
}
.section-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: 0 20px 40px -20px rgba(var(--magic-rgb), 0.35);
  color: var(--text);
}
.section-card::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 50%;
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--gold-deep), transparent);
  transition: background 0.25s;
}
.section-card:hover::before {
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
}

.section-card-glyph {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: var(--gold-wash);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--gold);
  margin-bottom: 18px;
}

.section-card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.section-card-name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  margin: 0 0 10px;
  color: var(--text);
  line-height: 1.05;
}
.section-card-blurb {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.55;
  margin: 0 0 18px;
  flex: 1;
}
.section-card-cta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-card-cta::after {
  content: "→";
  font-family: var(--font-display);
  font-size: 18px;
  transition: transform 0.2s;
}
.section-card:hover .section-card-cta::after { transform: translateX(4px); }

/* ============================================================
   PAGE HEADER (wiki pages, forum)
   ============================================================ */
.page-header {
  padding: 130px 24px 60px;
  position: relative;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(var(--magic-rgb), 0.10), transparent 60%),
    var(--bg);
}
.page-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--text-soft);
  border-bottom: none;
}
.breadcrumb a:hover { color: var(--gold); }
.crumb-sep { color: var(--text-fade); }
.crumb-current { color: var(--gold); }

.page-header-chapter {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.page-header-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.page-header-title {
  font-family: var(--font-display);
  font-size: clamp(48px, 7vw, 88px);
  font-weight: 400;
  color: var(--text);
  margin: 0 0 16px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.page-header-title em { font-style: italic; color: var(--gold); }
.page-header-deck {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(18px, 2vw, 22px);
  color: var(--text-soft);
  max-width: 720px;
  line-height: 1.5;
  margin: 0;
}

/* Wiki pages skip the top hero, so chapter padding can be tighter */
.wiki-body { padding-top: 0; }
.wiki-body .chapter { padding-top: 80px; }

/* Inline chapter section heading inside wiki pages */
.subchapter-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 0 0 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.subchapter-head .num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
}
.subchapter-head h2 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 500;
  margin: 0;
  color: var(--text);
  line-height: 1;
}

/* ============================================================
   FORUM
   ============================================================ */
.forum-layout {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 60px 24px 100px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 36px;
  align-items: start;
}
@media (max-width: 880px) { .forum-layout { grid-template-columns: 1fr; gap: 24px; } }

.forum-sidebar {
  position: sticky;
  top: 92px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  padding: 18px 20px 22px;
}
@media (max-width: 880px) { .forum-sidebar { position: static; } }

.forum-sidebar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}
.forum-cat-list { display: flex; flex-direction: column; gap: 2px; }
.forum-cat {
  font-family: var(--font-display);
  font-size: 17px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-soft);
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.forum-cat:hover { color: var(--text); background: var(--bg-rise); }
.forum-cat.active {
  color: var(--gold);
  background: var(--gold-wash);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.inspiration-badge:hover { transform: translateY(-1px); border-color: var(--gold-bright); }
.forum-cat-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.forum-cat.active .forum-cat-count {
  color: var(--gold);
  border-color: var(--gold-deep);
}

.forum-identity {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.forum-identity-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.forum-identity input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.forum-identity input:focus { border-color: var(--gold); }

.forum-main { min-width: 0; }

.forum-cat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.forum-cat-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  margin: 0 0 4px;
  color: var(--text);
  line-height: 1;
}
.forum-cat-deck {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--text-soft);
  margin: 0;
  max-width: 540px;
}
.forum-new-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: var(--gold-wash);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 10px 18px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.forum-new-btn:hover { background: var(--gold); color: var(--bg); }

.forum-thread-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.forum-thread {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 22px;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 18px;
  align-items: baseline;
  transition: border-color 0.15s, transform 0.15s;
}
.forum-thread:hover { border-color: var(--gold); transform: translateY(-1px); }
.forum-thread.pinned { border-left: 3px solid var(--gold); }
.forum-thread.dm-only-thread { border-left: 3px solid var(--dm); background: var(--dm-wash); }
body:not(.dm-mode) .forum-thread.dm-only-thread { display: none; }

.forum-thread-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.forum-thread-pin {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 2px 7px;
  border-radius: 3px;
}
.forum-thread-meta {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.forum-thread-meta strong { color: var(--text); font-weight: 500; }
.forum-thread-stats {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  letter-spacing: 0.06em;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
}
.forum-thread-stats strong { color: var(--gold); font-weight: 500; }

.forum-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
}

/* Thread detail view */
.thread-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 28px 32px;
}
.thread-detail-head {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.thread-back {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.thread-back:hover { color: var(--gold); }
.thread-detail-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  margin: 0 0 8px;
  color: var(--text);
  line-height: 1.15;
}
.thread-detail-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.thread-detail-meta strong { color: var(--text); font-weight: 500; }

.thread-posts { display: flex; flex-direction: column; gap: 18px; }
.thread-post {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--border);
}
.thread-post:last-child { border-bottom: none; }
.thread-post.is-op { background: var(--bg-rise); padding: 16px; border: 1px solid var(--border); border-radius: 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.thread-post-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-card-2);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
}
.thread-post.is-dm .thread-post-avatar {
  background: var(--dm-wash);
  border-color: var(--dm);
  color: var(--dm);
}
.thread-post-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.thread-post-author {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
}
.thread-post.is-dm .thread-post-author { color: var(--dm-bright); }
.thread-post-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.thread-post-tag.dm { color: var(--dm-bright); border-color: var(--dm); background: var(--dm-wash); }
.thread-post-time {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.thread-post-body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.thread-reply {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.thread-reply-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}
.thread-reply textarea, .thread-new textarea, .thread-new input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  outline: none;
  resize: vertical;
}
.thread-reply textarea:focus,
.thread-new textarea:focus,
.thread-new input:focus { border-color: var(--gold); }
.thread-reply textarea { min-height: 90px; }
.thread-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.thread-actions-info {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.thread-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: var(--gold);
  border: 1px solid var(--gold);
  color: var(--bg);
  padding: 9px 18px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}
.thread-btn:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
.thread-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.thread-btn.secondary {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--border-strong);
}
.thread-btn.secondary:hover { color: var(--text); border-color: var(--gold); background: transparent; }

/* New thread form */
.thread-new {
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 24px 28px;
  margin-bottom: 18px;
}
.thread-new-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 12px;
}
.thread-new-row { margin-bottom: 12px; }
.thread-new-row label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.thread-new textarea { min-height: 120px; }
.thread-dm-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dm-bright);
  cursor: pointer;
}
.thread-dm-toggle input { width: auto; }


.redacted-title { filter: blur(3px); user-select: none; }
.redacted-title:hover { filter: blur(2px); }

.forum-sync { margin-top: 12px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 4px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); }
.forum-sync.online { color: var(--emerald); border-color: color-mix(in srgb, var(--emerald) 45%, var(--border)); }
.forum-sync.offline { color: var(--gold); }
.forum-sync-error { margin-top: 8px; color: var(--crimson); font-size: 12px; line-height: 1.5; }
