/* Planetfall + LOGH wiki theme.
   Loaded from /wiki/wiki-theme.css by every transformed wiki article. */

:root {
  --bg-primary: #000;
  --bg-elevated: #0a0d14;
  --text-primary: #fff;
  --text-secondary: #a8b2d1;
  --text-tertiary: #6b7385;
  --accent-cyan: #00ffff;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-gold: #c9a44c;
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-bg-hover: rgba(255, 255, 255, 0.05);
  --card-border: rgba(0, 255, 255, 0.15);
  --card-border-hover: rgba(0, 255, 255, 0.6);
  --rule: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 28px rgba(0, 255, 255, 0.08);
  --sidebar-width: 240px;
  --nav-height: 60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0, 255, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
  line-height: 1.65;
  font-size: 16px;
}

/* ── Top nav ───────────────────────────────────────────────────── */
.planetfall-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  height: var(--nav-height);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 255, 255, 0.1);
}
.planetfall-nav .logo a {
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(45deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  font-size: 19px;
  text-decoration: none;
}
.planetfall-nav .nav-links {
  list-style: none;
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 0;
}
.planetfall-nav .nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color 0.2s ease;
}
.planetfall-nav .nav-links a:hover { color: var(--accent-cyan); }

/* ── Search box in nav ─────────────────────────────────────────── */
.nav-search {
  position: relative;
  max-width: 480px;
  width: 100%;
  justify-self: center;
}
.nav-search input[type="search"] {
  width: 100%;
  height: 36px;
  padding: 0 14px 0 38px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.nav-search input[type="search"]::placeholder { color: var(--text-tertiary); }
.nav-search input[type="search"]:focus {
  border-color: var(--accent-cyan);
  background: rgba(0, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.1);
}
.nav-search::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8b2d1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat center / contain;
  pointer-events: none;
  opacity: 0.7;
}
.nav-search .search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.4);
  max-height: min(420px, 70vh);
  overflow-y: auto;
  font-size: 14px;
  z-index: 200;
}
.nav-search .search-results li { padding: 0; }
.nav-search .search-results a {
  display: block;
  padding: 8px 12px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.1s;
}
.nav-search .search-results a:hover {
  background: rgba(0, 255, 255, 0.08);
  color: var(--accent-cyan);
}
.nav-search .search-results::-webkit-scrollbar { width: 8px; }
.nav-search .search-results::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 4px;
}

/* ── Layout: sidebar + content ─────────────────────────────────── */
.wiki-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - var(--nav-height));
}

.wiki-sidebar {
  border-right: 1px solid var(--rule);
  padding: 24px 0;
  position: sticky;
  top: var(--nav-height);
  align-self: start;
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  font-size: 13.5px;
}
.wiki-sidebar::-webkit-scrollbar { width: 6px; }
.wiki-sidebar::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 3px; }

.sidebar-section { padding: 0 18px 18px; }
.sidebar-section h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--accent-cyan);
  margin: 14px 0 8px;
  padding: 0;
  border: none;
  font-family: inherit;
}
.sidebar-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-section li { margin: 0; }
.sidebar-section a {
  display: block;
  padding: 5px 8px;
  margin-left: -8px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 4px;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.sidebar-section a:hover {
  color: var(--text-primary);
  background: rgba(0, 255, 255, 0.05);
  border-left-color: var(--accent-cyan);
}

/* ── Article container ─────────────────────────────────────────── */
.wiki-article {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 36px 60px;
  width: 100%;
}

.article-header {
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}

.article-header h1 {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: clamp(34px, 4.5vw, 50px);
  line-height: 1.05;
  margin: 0 0 8px;
  letter-spacing: -0.5px;
  background: linear-gradient(45deg, var(--accent-cyan), var(--accent-purple), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.article-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 88px;
  height: 2px;
  background: var(--accent-gold);
  box-shadow: 0 0 12px rgba(201, 164, 76, 0.4);
}

.article-source {
  color: var(--text-tertiary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  margin: 0;
}

/* ── Article body ──────────────────────────────────────────────── */
.article-body { font-size: 15.5px; }
.article-body::after { content: ''; display: block; clear: both; }
.article-body p { margin: 0 0 14px; }
.article-body a {
  color: var(--accent-cyan);
  text-decoration: none;
  border-bottom: 1px dotted rgba(0, 255, 255, 0.32);
  transition: color 0.15s, border-color 0.15s;
}
.article-body a:hover {
  color: var(--accent-pink);
  border-color: var(--accent-pink);
}
.article-body a.new { color: #d97757; border-color: rgba(217, 119, 87, 0.4); }

.article-body h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 28px;
  margin: 36px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  letter-spacing: -0.2px;
}
.article-body h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 21px;
  margin: 26px 0 8px;
}
.article-body h4 { font-size: 17px; font-weight: 700; margin: 20px 0 6px; }
.article-body h5 { font-size: 15px; font-weight: 700; margin: 16px 0 4px; }
.article-body h6 { font-size: 14px; font-weight: 700; margin: 14px 0 4px; }
.article-body h1, .article-body h2, .article-body h3,
.article-body h4, .article-body h5, .article-body h6 {
  scroll-margin-top: calc(var(--nav-height) + 16px);
}

.article-body .editsection,
.article-body .mw-editsection,
.article-body .mw-headline-anchor,
.article-body .printfooter,
.article-body #jump-to-nav,
.article-body #siteSub,
.article-body #contentSub { display: none !important; }

/* TOC */
.article-body #toc, .article-body .toc, .article-body table.toc {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 14px 20px;
  margin: 16px 0;
  display: inline-block;
  font-size: 14px;
  min-width: 280px;
}
.article-body .toctitle h2 {
  font-family: inherit;
  font-size: 14px !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-cyan);
  margin: 0 0 8px !important;
  padding: 0 !important;
  border: none !important;
}
.article-body #toc ul, .article-body .toc ul {
  list-style: none;
  padding-left: 14px;
  margin: 4px 0;
}
.article-body #toc li, .article-body .toc li { margin: 3px 0; }
.article-body #toc .tocnumber, .article-body .toc .tocnumber {
  color: var(--text-tertiary);
  margin-right: 6px;
}

/* Tables */
.article-body table {
  border-collapse: collapse;
  margin: 12px 0;
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 14px;
  max-width: 100%;
}
.article-body table th, .article-body table td {
  padding: 6px 10px;
  border: 1px solid var(--rule);
  vertical-align: top;
}
.article-body table th {
  background: rgba(0, 255, 255, 0.06);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
}

.article-body table.infobox {
  float: right;
  width: 320px;
  margin: 4px 0 16px 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  font-size: 13px;
  border-radius: 8px;
  overflow: hidden;
}
.article-body table.infobox td, .article-body table.infobox th {
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 7px 10px;
}
.article-body table.infobox tr:last-child td,
.article-body table.infobox tr:last-child th { border-bottom: none; }
.article-body table.infobox td.sb-both,
.article-body table.infobox td.center { text-align: center; }
.article-body table.infobox td.sb-left {
  background: rgba(0, 0, 0, 0.4);
  color: var(--accent-cyan);
  font-weight: 600;
  width: 40%;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.article-body table.infobox td.sb-right { color: var(--text-primary); }
.article-body table.infobox img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
}

.article-body table.wikitable th { background: rgba(0, 255, 255, 0.08); }
.article-body table.wikitable td:nth-child(odd) { background: rgba(255, 255, 255, 0.01); }
.article-body table.navbox {
  font-size: 12.5px;
  margin-top: 24px;
  border-top: 2px solid var(--card-border);
}
.article-body table.navbox th { background: rgba(139, 92, 246, 0.12); color: var(--text-primary); }

/* Images */
.article-body img { max-width: 100%; height: auto; }
.article-body a.image { display: inline-block; line-height: 0; }
.article-body div.thumb {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  padding: 6px;
  border-radius: 6px;
}
.article-body div.thumbinner { display: inline-block; }
.article-body div.thumbcaption,
.article-body div.thumbinner > .thumbcaption {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px 4px 2px;
  font-style: italic;
  line-height: 1.4;
}
.article-body div.tright { float: right; clear: right; margin: 4px 0 14px 22px; }
.article-body div.tleft { float: left; clear: left; margin: 4px 22px 14px 0; }
.article-body div.tnone { margin: 12px auto; }
.article-body div.center { text-align: center; }

/* Categories */
.article-body #catlinks {
  margin-top: 36px;
  padding: 14px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 13px;
  clear: both;
}
.article-body #catlinks::before {
  content: 'Categories';
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}
.article-body #catlinks ul { display: inline; padding: 0; margin: 0; list-style: none; }
.article-body #catlinks ul li {
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 3px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(0, 255, 255, 0.04);
}
.article-body #catlinks ul li a { border-bottom: none; }

.article-body div.information {
  margin: 0 0 24px;
  padding: 12px 16px;
  background: rgba(194, 78, 87, 0.1);
  border-left: 3px solid #c24e57;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: 4px;
}
.article-body div.information div { border: none !important; }

.article-body ul, .article-body ol { margin: 8px 0 14px; padding-left: 28px; }
.article-body li { margin: 3px 0; }
.article-body dl { margin: 8px 0 14px; }
.article-body dt { font-weight: 700; margin-top: 8px; }
.article-body dd { margin: 0 0 6px 28px; }

.article-body blockquote {
  margin: 14px 0;
  padding: 10px 18px;
  border-left: 3px solid var(--accent-purple);
  background: rgba(139, 92, 246, 0.06);
  font-style: italic;
  color: var(--text-secondary);
}

.article-body pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 12px;
  overflow-x: auto;
  font-size: 13px;
  font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
}
.article-body code {
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
}

.article-body sup.reference, .article-body .mw-cite-backlink { font-size: 0.75em; }
.article-body sup.reference a { border-bottom: none; padding: 0 2px; }

.article-body .redirectMsg {
  padding: 10px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 18px;
}
.article-body .hatnote, .article-body .dablink {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 6px 0 12px;
  border-bottom: 1px dashed var(--rule);
  margin-bottom: 14px;
}
.article-body small, .article-body .small { font-size: 0.86em; color: var(--text-secondary); }
.article-body i, .article-body em { font-style: italic; }

/* ── Footer ────────────────────────────────────────────────────── */
.wiki-footer {
  border-top: 1px solid var(--rule);
  padding: 22px 24px 32px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 1.7;
}
.wiki-footer a { color: var(--accent-cyan); text-decoration: none; }
.wiki-footer a:hover { text-decoration: underline; }
.wiki-footer p { margin: 4px 0; }

/* ── Portal page (landing) styles ──────────────────────────────── */
.portal-welcome {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.portal-welcome::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 88px;
  height: 2px;
  background: var(--accent-gold);
  box-shadow: 0 0 12px rgba(201, 164, 76, 0.4);
}
.portal-welcome h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
  margin: 0 0 8px;
  letter-spacing: -0.5px;
  background: linear-gradient(45deg, var(--accent-cyan), var(--accent-purple), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}
.portal-welcome p { margin: 0; color: var(--text-secondary); font-size: 15px; max-width: 640px; }
.portal-welcome p a { color: var(--accent-cyan); text-decoration: none; }
.portal-welcome p a:hover { color: var(--accent-pink); }
.portal-stat {
  text-align: right;
  color: var(--text-tertiary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  white-space: nowrap;
}
.portal-stat .num {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 44px;
  font-weight: 700;
  background: linear-gradient(45deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  line-height: 1;
  letter-spacing: -1px;
}

.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.portal-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 18px 20px;
  transition: border-color 0.2s, background 0.2s;
}
.portal-card:hover { border-color: var(--card-border-hover); background: var(--card-bg-hover); }
.portal-card h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.portal-card h2 .icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  flex-shrink: 0;
}
.portal-card.gold h2 .icon { background: var(--accent-gold); box-shadow: 0 0 8px var(--accent-gold); }
.portal-card.purple h2 .icon { background: var(--accent-purple); box-shadow: 0 0 8px var(--accent-purple); }
.portal-card p { margin: 0 0 8px; color: var(--text-secondary); font-size: 14px; line-height: 1.55; }
.portal-card a { color: var(--accent-cyan); text-decoration: none; }
.portal-card a:hover { color: var(--accent-pink); text-decoration: underline; }
.portal-card ul { margin: 4px 0 0; padding-left: 18px; }
.portal-card li { margin: 3px 0; color: var(--text-secondary); font-size: 14px; }
.portal-card .featured-thumb {
  float: right;
  margin: 0 0 6px 14px;
  max-width: 130px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
}
.portal-card.featured-article { grid-column: span 1; }
.portal-card .small { font-size: 12px; color: var(--text-tertiary); }

.portal-events {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13.5px;
}
.portal-events li {
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--text-secondary);
}
.portal-events li:last-child { border-bottom: none; }
.portal-events .date {
  display: inline-block;
  width: 86px;
  color: var(--accent-gold);
  font-feature-settings: 'tnum';
  font-weight: 600;
  font-size: 12.5px;
}

.portal-section-heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-cyan);
  margin: 28px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.browse-card {
  display: block;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.browse-card:hover {
  transform: translateY(-2px);
  border-color: var(--card-border-hover);
  background: var(--card-bg-hover);
}
.browse-card .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}
.browse-card h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary);
}
.browse-card p { font-size: 13px; color: var(--text-secondary); margin: 0; line-height: 1.45; }

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 920px) {
  .planetfall-nav { grid-template-columns: auto 1fr; padding: 0 16px; gap: 12px; }
  .planetfall-nav .nav-links { display: none; }
  .planetfall-nav .logo a { font-size: 16px; letter-spacing: 1.5px; }
  .nav-search input[type="search"] { font-size: 13px; height: 32px; padding-left: 32px; }
  .nav-search::before { left: 10px; width: 12px; height: 12px; margin-top: -6px; }

  .wiki-layout { grid-template-columns: 1fr; }
  .wiki-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0 8px;
  }
  .sidebar-section { padding: 0 14px 6px; flex: 1 1 200px; }
  .sidebar-section h3 { margin: 6px 0 4px; }

  .wiki-article { padding: 24px 18px 40px; }
  .article-body table.infobox { float: none; width: 100%; margin: 12px 0; }
  .article-body div.tright, .article-body div.tleft { float: none; margin: 12px auto; display: block; }

  .portal-welcome { grid-template-columns: 1fr; gap: 8px; }
  .portal-welcome .portal-stat { text-align: left; }
  .portal-grid { grid-template-columns: 1fr; }
}

/* ──────────────────────────────────────────────────────────────── */
/* Phase 3: Dark Reader compat, backgrounds, faction & character     */
/* page treatments, music players, easter eggs                       */
/* ──────────────────────────────────────────────────────────────── */

:root { color-scheme: dark; }

/* Body's own background = color tint only (was a static SVG starfield;
   stars now live on body::before so they can be animated). */
body {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0, 255, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* Starfield — every circle inside stars.svg carries its own SMIL
   <animate> on opacity, so each star twinkles on its own random cycle.
   The whole layer also drifts slowly so the field never sits still. */
.stars-svg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -3;
  pointer-events: none;
  user-select: none;
  animation: starsDrift 240s linear infinite;
  will-change: transform;
}
@keyframes starsDrift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-120px, 70px, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .stars-svg { animation: none; }
}

/* Character backdrop — wrapper holds the URL via --char-img so the
   inner ::before can be blurred without blurring the vignette. */
.char-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.char-bg::before {
  content: '';
  position: absolute;
  inset: -8%;
  background-image: var(--char-img);
  background-position: center 20%;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(45px) saturate(0.95);
  opacity: 0.36;
  transform: scale(1.18);
}
.char-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 28%, transparent 18%, rgba(0,0,0,0.55) 75%),
    linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.4) 100%);
}

/* Faction emblem: a large, faint crest/flag rendered fixed in the
   page corner. Hidden by default, populated only when body has a
   matching data-faction. */
.faction-emblem {
  position: fixed;
  top: 80px;
  right: -40px;
  width: 480px;
  height: 480px;
  pointer-events: none;
  z-index: -1;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0;
  transition: opacity 1.5s ease;
}

/* Per-faction palette tints overlay on top of body's color background.
   Stars live on body::before (animated) — these gradients add the
   atmosphere. The .faction-emblem div renders a faint crest/flag. */
body[data-faction="empire"] {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201, 164, 76, 0.14) 0%, transparent 60%),
    radial-gradient(circle at 15% 85%, rgba(180, 0, 30, 0.07) 0%, transparent 50%),
    radial-gradient(circle at 85% 60%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
}
body[data-faction="empire"] .faction-emblem {
  background-image: url('/w/images/thumb/3/3b/Goldenbaum_Crest_flag.png/300px-Goldenbaum_Crest_flag.png');
  opacity: 0.075;
  filter: brightness(2.2) saturate(0.5) sepia(0.3) hue-rotate(-10deg);
}
body[data-faction="empire"] .article-header h1 {
  background: linear-gradient(45deg, #d4a849, #c9a44c, #ffd97a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
body[data-faction="empire"] .article-header::after {
  background: linear-gradient(90deg, var(--accent-gold), transparent);
  width: 120px;
}

body[data-faction="fpa"] {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(56, 132, 255, 0.13) 0%, transparent 60%),
    radial-gradient(circle at 15% 75%, rgba(0, 255, 255, 0.07) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
}
body[data-faction="fpa"] .faction-emblem {
  background-image: url('/w/images/thumb/6/66/Flag_of_the_Free_Planets_Alliance.svg/300px-Flag_of_the_Free_Planets_Alliance.svg.png');
  opacity: 0.10;
  filter: brightness(1.1) saturate(1.2);
}
body[data-faction="fpa"] .article-header h1 {
  background: linear-gradient(45deg, #6ba3ff, #00ffff, #c5e4ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body[data-faction="phezzan"] {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(180, 130, 60, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(80, 40, 20, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 20% 30%, rgba(40, 30, 20, 0.06) 0%, transparent 50%);
}
body[data-faction="phezzan"] .faction-emblem {
  background-image: url('/w/images/thumb/d/d9/Fezzanflagsketch.jpg/160px-Fezzanflagsketch.jpg');
  opacity: 0.10;
  filter: brightness(1.4) sepia(0.5) saturate(1.2);
}
body[data-faction="phezzan"] .article-header h1 {
  background: linear-gradient(45deg, #c08c4a, #d4a849, #ffe0a3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body[data-faction="iserlohn"] {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'><g fill='none' stroke='rgba(0,255,255,0.05)' stroke-width='0.7'><polygon points='45,4 80,24 80,64 45,84 10,64 10,24'/></g></svg>"),
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0, 255, 255, 0.10) 0%, transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(56, 132, 255, 0.07) 0%, transparent 50%);
  background-size: 90px 78px, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat;
}
body[data-faction="iserlohn"] .faction-emblem {
  background-image: url('/w/images/thumb/9/9a/Iserlohn_Fortress.jpg/300px-Iserlohn_Fortress.jpg');
  opacity: 0.13;
  filter: brightness(1.4) saturate(0.7) hue-rotate(180deg);
}
body[data-faction="iserlohn"] .article-header h1 {
  background: linear-gradient(45deg, #6ba3ff, #00ffff, #aae3ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body[data-faction="earth"] {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(60, 130, 90, 0.10) 0%, transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(40, 80, 140, 0.08) 0%, transparent 50%);
}

/* Battle pages: red-tinged starfield + crisscross fleet trajectories */
body[data-page-type="battle"] {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'><g stroke='rgba(236,72,153,0.07)' stroke-width='0.5' fill='none'><line x1='0' y1='80' x2='400' y2='340'/><line x1='0' y1='340' x2='400' y2='80'/><line x1='100' y1='0' x2='340' y2='400'/><line x1='340' y1='0' x2='100' y2='400'/></g><g fill='white'><circle cx='40' cy='80' r='0.6' opacity='0.6'/><circle cx='160' cy='200' r='0.5' opacity='0.5'/><circle cx='280' cy='90' r='0.45' opacity='0.5'/><circle cx='90' cy='280' r='0.55' opacity='0.55'/><circle cx='340' cy='320' r='0.5' opacity='0.5'/></g></svg>"),
    radial-gradient(circle at 30% 30%, rgba(180, 0, 30, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(0, 255, 255, 0.04) 0%, transparent 50%);
}

/* Ship pages: subtle technical-schematic overlay */
body[data-page-type="ship"] {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'><g stroke='rgba(0,255,255,0.05)' stroke-width='0.4' fill='none'><line x1='0' y1='80' x2='160' y2='80'/><line x1='80' y1='0' x2='80' y2='160'/><circle cx='80' cy='80' r='40'/><circle cx='80' cy='80' r='60'/></g></svg>"),
    radial-gradient(circle at 20% 30%, rgba(0, 255, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
}

/* ── Easter eggs (specific characters) ────────────────────────── */
body[data-character]::after {
  position: fixed;
  bottom: 18px;
  right: 22px;
  font-size: 26px;
  opacity: 0.32;
  z-index: 0;
  pointer-events: none;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.6);
  transition: opacity 0.4s, transform 0.4s;
}
body[data-character]:hover::after { opacity: 0.55; transform: scale(1.1); }

body[data-character="yang"]::after { content: '☕'; }
body[data-character="reinhard"]::after { content: '👑'; color: var(--accent-gold); }
body[data-character="kircheis"]::after { content: '🔥'; }
body[data-character="oberstein"]::after { content: '👁'; color: #aac8e0; }
body[data-character="julian"]::after { content: '★'; color: var(--accent-cyan); }
body[data-character="hilda"]::after { content: '♟'; color: var(--accent-gold); }
body[data-character="rubinsky"]::after { content: '♛'; }
body[data-character="schenkopp"]::after { content: '⚔'; }
body[data-character="fischer"]::after { content: '✦'; }
body[data-character="poplan"]::after { content: '✈'; }
body[data-character="annerose"]::after { content: '✿'; color: #f5a3c9; }

/* ── Music player widget ──────────────────────────────────────── */
.article-body .music-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 16px;
}
.article-body .music-list li.music-track {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  margin: 5px 0;
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.article-body .music-list li.music-track:hover {
  border-color: var(--card-border);
  background: var(--card-bg-hover);
}
.article-body .music-list .track-text {
  flex: 1;
  font-size: 14.5px;
  line-height: 1.45;
}
.article-body .music-list .track-time {
  color: var(--text-tertiary);
  font-feature-settings: 'tnum';
  font-size: 12.5px;
  margin-left: 6px;
}
.yt-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--card-border);
  background: rgba(0, 255, 255, 0.05);
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  flex-shrink: 0;
}
.yt-play:hover {
  background: rgba(0, 255, 255, 0.15);
  border-color: var(--accent-cyan);
}
.yt-play.unmapped {
  color: var(--text-tertiary);
  background: transparent;
}
.yt-play.unmapped:hover {
  color: var(--accent-cyan);
  border-color: var(--card-border-hover);
}
.yt-play.yt-loaded {
  color: var(--accent-pink);
  border-color: rgba(236, 72, 153, 0.5);
  background: rgba(236, 72, 153, 0.08);
}
.yt-icon {
  font-size: 12px;
  line-height: 1;
  display: inline-block;
  width: 12px;
  text-align: center;
}
.yt-frame {
  width: 100%;
  max-width: 540px;
  margin: 6px 0 14px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: #000;
}
.yt-frame iframe {
  display: block;
  width: 100%;
  border: none;
}

/* Theme song / OP-ED list inline players (compact) */
.theme-list .yt-play { margin-left: 8px; }

/* Inline player button (used next to theme song links / anthem text) */
.yt-play.yt-inline {
  margin-left: 8px;
  padding: 3px 9px;
  font-size: 10.5px;
  letter-spacing: 1px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* Large player button at the top of a dedicated theme/anthem page */
.theme-page-player {
  margin: 6px 0 22px;
}
.yt-play.yt-large {
  font-size: 13px;
  padding: 10px 18px;
  letter-spacing: 1.4px;
  background: rgba(0, 255, 255, 0.10);
  border-color: var(--accent-cyan);
}
.yt-play.yt-large:hover {
  background: rgba(0, 255, 255, 0.20);
}
.yt-play.yt-large .yt-icon { font-size: 14px; }

@media (max-width: 600px) {
  .article-body .music-list li.music-track {
    flex-wrap: wrap;
    gap: 8px;
  }
}
