/* ==========================================================================
   The Illuminati Network — Core Design System
   Dark Occult / Spiritual Gaming Aesthetic
   ========================================================================== */

:root {
  --bg-void: #0a0a0f;
  --bg-obsidian: #12121a;
  --bg-plum: #16131e;
  --bg-elevated: #1a1625;
  --bg-hover: #211c30;

  --accent-gold: #c9a84c;
  --accent-gold-deep: #b8962e;
  --accent-gold-bright: #dfc06a;
  --accent-gold-glow: rgba(201, 168, 76, 0.15);
  --accent-gold-soft: rgba(201, 168, 76, 0.1);

  --accent-violet: #6b5b95;
  --accent-violet-light: #7c6dab;
  --accent-violet-soft: rgba(107, 91, 149, 0.16);

  --text-primary: #f5f4f2;
  --text-body: #e8e6e3;
  --text-muted: #9893a3;
  --text-faint: #676274;

  --danger: #8b2500;
  --danger-bright: #c44323;
  --danger-soft: rgba(139, 37, 0, 0.22);
  --success: #5a7a5a;
  --success-bright: #7aa37a;
  --success-soft: rgba(90, 122, 90, 0.18);
  --warning: #b8962e;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.11);
  --border-gold: rgba(201, 168, 76, 0.3);

  --font-display: 'Space Grotesk', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;

  --nav-height: 68px;
  --container-max: 1320px;
  --transition-fast: 200ms cubic-bezier(0.22, 1, 0.36, 1);
  --transition-smooth: 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

img {
  max-width: 100%;
  height: auto;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-void);
  color: var(--text-body);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-body);
  background-color: var(--bg-void);
  background-image: linear-gradient(180deg, #09090d 0%, #0d0c13 55%, #09090d 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.density-compact {
  font-size: 0.9rem;
  line-height: 1.5;
}

::selection {
  background: var(--accent-gold);
  color: #0a0a0f;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-void);
}
::-webkit-scrollbar-thumb {
  background: #272336;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold-deep);
}

/* Skip Link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  padding: 10px 18px;
  background: var(--accent-gold);
  color: var(--bg-void);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
}

/* Typography */
h1, h2, h3, h4, h5, h6,
.font-display {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.18;
  margin-top: 0;
}

h1 { font-size: clamp(2rem, 3.4vw, 2.85rem); font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.38rem, 2.1vw, 1.85rem); }
h3 { font-size: 1.18rem; letter-spacing: -0.015em; }
h4 { font-size: 1.02rem; }

p { margin: 0 0 1rem; }

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

code, pre, .font-mono {
  font-family: var(--font-mono);
}

hr.occult-rule {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
  margin: 2rem 0;
}

.section-divider-art {
  width: 100%;
  max-width: 900px;
  height: 44px;
  margin: 2.75rem auto;
  background: url('/images/decorative/section-divider.webp') center center / contain no-repeat;
  mix-blend-mode: screen;
  opacity: 0.65;
  pointer-events: none;
}

/* Layout Containers */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.main-content {
  flex: 1 0 auto;
  padding-bottom: 4.5rem;
}

.hero-sanctum-art {
  position: absolute;
  inset: 0;
  background: linear-gradient(98deg, rgba(9,9,13,0.97) 24%, rgba(9,9,13,0.68) 60%, rgba(9,9,13,0.92) 100%),
    url('/images/backgrounds/hero-bg.webp') center/cover no-repeat;
}

.hero-sanctum-content {
  position: relative;
  z-index: 2;
  padding: 5.25rem 1.5rem 4.5rem;
}

.hero-sanctum-title {
  font-size: clamp(2.5rem, 5vw, 4.15rem);
  line-height: 1.03;
  margin-bottom: 1.15rem;
  max-width: 16ch;
}

.hero-sanctum-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

.hero-join {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1.15rem;
}

.hero-join p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

.hero-join strong {
  color: var(--text-primary);
}

@media (max-width: 600px) {
  .hero-sanctum-content { padding-top: 0.5rem; }
  .hero-sanctum-eyebrow { margin-bottom: 0.65rem; }
  .hero-sanctum-title { font-size: 2rem; margin-bottom: 0.55rem; }
}

.page-header {
  padding: 2.75rem 0 2.15rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2.25rem;
  background:
    linear-gradient(90deg, rgba(10, 10, 15, 0.96) 26%, rgba(10, 10, 15, 0.72) 66%, rgba(10, 10, 15, 0.9) 100%),
    url('/images/ui/ui-header-strip.png') right center / cover no-repeat;
}

.page-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-gold);
  margin-bottom: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.page-subtitle {
  color: var(--text-muted);
  max-width: 68ch;
  margin-bottom: 0;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}
.breadcrumbs a {
  color: var(--text-muted);
}
.breadcrumbs a:hover {
  color: var(--accent-gold);
}

/* Cards & Surfaces */
.panel {
  position: relative;
  background-color: var(--bg-obsidian);
  background-image: linear-gradient(rgba(18, 18, 26, 0.94), rgba(22, 19, 30, 0.96)), url('/images/decorative/panel-texture.png');
  background-size: auto, 240px 240px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.panel-elevated {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-medium);
}

.panel-interactive:hover {
  border-color: rgba(201, 168, 76, 0.44);
  background-color: #16141e;
}

.panel-ornate {
  position: relative;
  overflow: hidden;
}
.panel-ornate::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 108px;
  height: 108px;
  background: url('/images/ui/ui-corner-ornament.png') top left / contain no-repeat;
  mix-blend-mode: screen;
  opacity: 0.78;
  pointer-events: none;
  z-index: 1;
}

.ui-seal-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  mix-blend-mode: lighten;
  flex-shrink: 0;
}

.realm-card {
  position: relative;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.realm-card-media {
  position: relative;
  height: 128px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--border-subtle);
}
.realm-card-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 10, 15, 0.25) 0%, rgba(16, 15, 22, 0.94) 100%);
}
.realm-card-body {
  padding: 1.1rem 1.25rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.75rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-obsidian);
  border-radius: var(--radius-md);
}
.empty-state-art {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin: 0 auto 1.15rem;
  display: block;
}

.panel-codex {
  background: linear-gradient(160deg, #171420 0%, #111018 100%);
  border: 1px solid rgba(201, 168, 76, 0.22);
  border-left: 3px solid var(--accent-gold);
  padding: 1.75rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.95rem;
  margin-bottom: 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-primary);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

/* Grids */
.grid {
  display: grid;
  gap: 1.5rem;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-asymmetric { grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.85fr); }
.grid-sidebar-left { grid-template-columns: 270px minmax(0, 1fr); }
.grid-sidebar-right { grid-template-columns: minmax(0, 1fr) 310px; }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-asymmetric,
  .grid-sidebar-left,
  .grid-sidebar-right { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Navigation Bar */
.site-navbar {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--nav-height);
  background: rgba(10, 10, 15, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}

.navbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}
.brand-logo-img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border-gold);
}
.brand-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.brand-domain {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.78rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}
.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}
.nav-link.active {
  color: var(--accent-gold);
  box-shadow: inset 0 -2px 0 var(--accent-gold);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Global Search */
.nav-search-wrap {
  position: relative;
}
.nav-search-form {
  display: flex;
  align-items: center;
  background: var(--bg-obsidian);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0 0.6rem;
  transition: border-color var(--transition-fast);
}
.nav-search-form:focus-within {
  border-color: var(--border-gold);
}
.nav-search-input {
  background: transparent;
  border: none;
  color: var(--text-body);
  font-size: 0.84rem;
  padding: 0.42rem 0.5rem;
  width: 175px;
  outline: none;
}
.search-suggestions-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 310px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65);
  z-index: 950;
  display: none;
  overflow: hidden;
}
.search-suggestions-dropdown.open {
  display: block;
}
.search-suggest-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-body);
  font-size: 0.84rem;
}
.search-suggest-item:hover {
  background: var(--bg-hover);
}
.search-suggest-group {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-gold);
  text-transform: uppercase;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0.52rem 1.15rem;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-sm {
  min-height: 31px;
  padding: 0.32rem 0.78rem;
  font-size: 0.79rem;
}

.btn-lg {
  min-height: 46px;
  padding: 0.75rem 1.6rem;
  font-size: 0.95rem;
}

.btn-gold {
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-deep) 100%);
  color: #0a0a0f;
  font-weight: 600;
  border-color: var(--accent-gold);
}
.btn-gold:hover {
  color: #0a0a0f;
  background: linear-gradient(135deg, var(--accent-gold-bright) 0%, var(--accent-gold) 100%);
  box-shadow: 0 0 22px rgba(201, 168, 76, 0.28);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-body);
  border-color: var(--border-medium);
}
.btn-ghost:hover {
  color: var(--accent-gold);
  border-color: var(--border-gold);
  background: var(--accent-gold-soft);
}

.btn-violet {
  background: var(--accent-violet-soft);
  color: #cdc3eb;
  border-color: rgba(107, 91, 149, 0.45);
}
.btn-violet:hover {
  background: rgba(107, 91, 149, 0.3);
  color: #fff;
}

.btn-danger {
  background: var(--danger-soft);
  color: #f3a68e;
  border-color: rgba(139, 37, 0, 0.55);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.icon-btn:hover {
  color: var(--accent-gold);
  border-color: var(--border-gold);
  background: var(--accent-gold-soft);
}

.badge-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent-gold);
  color: #0a0a0f;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-body);
}
.badge-gold {
  border-color: var(--border-gold);
  background: var(--accent-gold-soft);
  color: var(--accent-gold-bright);
}
.badge-violet {
  border-color: rgba(107, 91, 149, 0.45);
  background: var(--accent-violet-soft);
  color: #c8bef0;
}
.badge-success {
  border-color: rgba(90, 122, 90, 0.5);
  background: var(--success-soft);
  color: #a5cca5;
}
.badge-danger {
  border-color: rgba(139, 37, 0, 0.6);
  background: var(--danger-soft);
  color: #f09f87;
}

/* Status Pulse Indicator */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.online {
  background: #73b073;
  box-shadow: 0 0 0 0 rgba(115, 176, 115, 0.6);
  animation: pulse-sage 2.6s infinite;
}
.status-dot.restarting {
  background: var(--accent-gold);
}
.status-dot.offline {
  background: #a84020;
}

@keyframes pulse-sage {
  0% { box-shadow: 0 0 0 0 rgba(115, 176, 115, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(115, 176, 115, 0); }
  100% { box-shadow: 0 0 0 0 rgba(115, 176, 115, 0); }
}

/* Forms — Completely Custom Styled */
.form-group {
  margin-bottom: 1.15rem;
}
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}
.form-hint {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.form-control,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: #0d0c13;
  color: var(--text-body);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.16);
}

.form-select {
  background-image: linear-gradient(45deg, transparent 50%, var(--accent-gold) 50%),
    linear-gradient(135deg, var(--accent-gold) 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.55;
}

.form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-size: 0.88rem;
  user-select: none;
}

.form-check input[type='checkbox'],
.form-check input[type='radio'] {
  appearance: none;
  width: 17px;
  height: 17px;
  border: 1px solid var(--border-medium);
  background: #0d0c13;
  border-radius: 2px;
  display: grid;
  place-content: center;
  cursor: pointer;
  margin: 0;
}
.form-check input[type='radio'] {
  border-radius: 50%;
}
.form-check input[type='checkbox']:checked,
.form-check input[type='radio']:checked {
  border-color: var(--accent-gold);
  background: var(--accent-gold);
}
.form-check input[type='checkbox']:checked::before {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 2px solid #0a0a0f;
  border-bottom: 2px solid #0a0a0f;
  transform: rotate(-45deg) translateY(-1px);
}
.form-check input[type='radio']:checked::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0a0a0f;
}

input[type='file'].form-control {
  padding: 0.45rem;
}
input[type='file'].form-control::file-selector-button {
  background: var(--bg-elevated);
  color: var(--accent-gold);
  border: 1px solid var(--border-gold);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-right: 0.8rem;
  cursor: pointer;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-obsidian);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.85rem 1rem;
  background: rgba(26, 22, 37, 0.55);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Avatars */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-medium);
  background: var(--bg-elevated);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent-gold);
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar-xl { width: 104px; height: 104px; font-size: 2.2rem; }

/* Dropdowns & Popovers */
.dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.75);
  z-index: 960;
  display: none;
  padding: 0.4rem 0;
}
.dropdown-menu.open {
  display: block;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.58rem 1rem;
  background: none;
  border: none;
  color: var(--text-body);
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}
.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--accent-gold);
}
.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.35rem 0;
}

/* Modals (sparse glass-morphism overlay) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 10, 0.78);
  backdrop-filter: blur(6px);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.modal-backdrop.open {
  display: flex;
}
.modal-dialog {
  width: 100%;
  max-width: 540px;
  background: var(--bg-obsidian);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
}

/* Toasts & Alerts */
.toast-stack {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 380px;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
  border-left: 3px solid var(--accent-gold);
  color: var(--text-primary);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  font-size: 0.86rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  animation: fadeSlideUp 250ms ease;
}
.toast-error { border-left-color: var(--danger-bright); }
.toast-success { border-left-color: var(--success-bright); }

.alert {
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.alert-error { background: var(--danger-soft); border-color: rgba(196, 67, 35, 0.5); color: #f6b39d; }
.alert-success { background: var(--success-soft); border-color: rgba(122, 163, 122, 0.45); color: #b7dbb7; }
.alert-info { background: var(--accent-gold-soft); border-color: var(--border-gold); color: #efe0b4; }

/* Rich Content Typography (Forums / Wiki / Bios) */
.rich-content {
  color: var(--text-body);
  word-wrap: break-word;
}
.rich-content h1, .rich-content h2, .rich-content h3 {
  margin-top: 1.6rem;
  margin-bottom: 0.75rem;
}
.rich-content .heading-anchor {
  opacity: 0;
  margin-right: 0.4rem;
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-size: 0.85em;
}
.rich-content .content-heading:hover .heading-anchor {
  opacity: 0.85;
}
.rich-content blockquote,
.rich-content .quote-block {
  margin: 1rem 0;
  padding: 0.85rem 1.15rem;
  border-left: 3px solid var(--accent-gold);
  background: rgba(26, 22, 37, 0.5);
  color: var(--text-muted);
}
.rich-content .quote-block cite {
  display: block;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-gold);
  margin-bottom: 0.4rem;
}
.rich-content .code-block {
  background: #0b0a10;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 1rem 0;
}
.rich-content .code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.rich-content .code-copy-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
}
.rich-content .code-block code {
  display: block;
  padding: 0.9rem;
  overflow-x: auto;
  font-size: 0.84rem;
}
.rich-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}
.rich-content .spoiler-block {
  border: 1px solid var(--border-subtle);
  background: rgba(18, 18, 26, 0.8);
  padding: 0.55rem 0.9rem;
  margin: 0.75rem 0;
}
.rich-content .spoiler-block summary {
  cursor: pointer;
  color: var(--accent-gold);
  font-weight: 500;
}
.rich-content .callout {
  padding: 1rem 1.15rem;
  border: 1px solid var(--border-medium);
  border-left: 3px solid var(--accent-violet);
  background: rgba(107, 91, 149, 0.09);
  margin: 1rem 0;
}
.rich-content .callout-warning {
  border-left-color: var(--danger-bright);
  background: rgba(139, 37, 0, 0.14);
}
.rich-content .callout-tip,
.rich-content .callout-codex {
  border-left-color: var(--accent-gold);
  background: rgba(201, 168, 76, 0.08);
}
.rich-content .callout-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}
.rich-content .media-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin: 1rem 0;
  border: 1px solid var(--border-subtle);
}
.rich-content .media-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.rich-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
.rich-content th, .rich-content td {
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 0.75rem;
}

/* Custom Markdown Editor Toolbar */
.editor-shell {
  border: 1px solid var(--border-medium);
  background: #0d0c13;
  border-radius: var(--radius-sm);
}
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.45rem 0.6rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}
.editor-tool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.editor-tool-btn:hover {
  color: var(--accent-gold);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
}
.editor-shell textarea {
  border: none !important;
  box-shadow: none !important;
  min-height: 180px;
}
.editor-preview-pane {
  padding: 1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-obsidian);
  display: none;
}
.editor-preview-pane.open {
  display: block;
}
.editor-emoji-popover {
  display: none;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.35rem;
  flex-wrap: wrap;
}
.editor-emoji-popover.open {
  display: flex;
}
.emoji-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  padding: 0.2rem 0.45rem;
  font-size: 0.82rem;
  cursor: pointer;
}

/* Empty & Skeleton States */
.empty-state-icon {
  color: var(--accent-gold);
  opacity: 0.7;
  margin-bottom: 0.9rem;
}
.skeleton {
  background: linear-gradient(90deg, #16131e 25%, #201c2d 50%, #16131e 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Scroll Reveal (subtle 26px translate, 400ms ease) */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 400ms ease, transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

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

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
}
.page-link {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-obsidian);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.page-link.active,
.page-link:hover {
  border-color: var(--border-gold);
  color: var(--accent-gold);
  background: var(--accent-gold-soft);
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: #08080c;
  border-top: 1px solid var(--border-subtle);
  padding: 3.25rem 0 2rem;
  color: var(--text-muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 2rem;
}
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.footer-links a {
  color: var(--text-muted);
  font-size: 0.87rem;
}
.footer-links a:hover {
  color: var(--accent-gold);
}

/* Mobile Nav Drawer */
.mobile-menu-toggle {
  display: none;
}
.mobile-drawer {
  display: none;
  position: fixed;
  inset: var(--nav-height) 0 0 0;
  background: rgba(10, 10, 15, 0.97);
  z-index: 980;
  padding: 1.5rem;
  overflow-y: auto;
}
.mobile-drawer.open {
  display: block;
}

@media (max-width: 1024px) {
  .nav-links,
  .nav-search-wrap {
    display: none;
  }
  .mobile-menu-toggle {
    display: inline-flex;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* Admin Layout */
.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}
.admin-sidebar {
  background: #0d0c13;
  border-right: 1px solid var(--border-subtle);
  padding: 1.25rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.admin-sidebar-section-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  padding: 0 0.7rem;
  margin-bottom: 0.35rem;
}
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.52rem 0.75rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  margin-bottom: 0.15rem;
}
.admin-nav-link:hover,
.admin-nav-link.active {
  background: var(--bg-elevated);
  color: var(--accent-gold);
}
.admin-topbar {
  height: 62px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(12, 11, 18, 0.9);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-main {
  padding: 1.75rem;
  min-width: 0;
}

@media (max-width: 960px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 1100;
    overflow-y: auto;
  }
  .admin-sidebar.open {
    display: flex;
  }
}

/* Impersonation Banner */
.impersonation-banner {
  background: linear-gradient(90deg, #5a1800, #8b2500);
  color: #fce8df;
  padding: 0.45rem 1.25rem;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

/* Print-friendly Codex stylesheet */
@media print {
  .site-navbar, .site-footer, .wiki-sidebar, .no-print {
    display: none !important;
  }
  body {
    background: #fff !important;
    color: #111 !important;
  }
  .panel {
    border: none !important;
    background: #fff !important;
  }
}

/* Keep the established navigation usable with additional community modules. */
.site-navbar { height: auto; min-height: var(--nav-height); }
.navbar-inner { min-height: var(--nav-height); flex-wrap: wrap; padding-top: .65rem; padding-bottom: .65rem; }
.navbar-inner > nav { order: 3; flex: 0 0 100%; min-width: 0; }
.nav-links { flex-wrap: wrap; justify-content: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.leaderboard-filters { display: flex; flex-wrap: wrap; gap: .5rem; max-width: 100%; }
.leaderboard-filters .form-control { width: auto; min-width: 0; }
@media (max-width: 1024px) {
  .navbar-inner { flex-wrap: nowrap; gap: .5rem; }
  .navbar-inner > nav { display: none; }
}
@media (max-width: 480px) {
  .brand-wordmark { display: none; }
  .nav-actions { gap: .35rem; }
  .leaderboard-filters { width: 100%; }
  .leaderboard-filters select { flex: 1 1 100%; }
  .leaderboard-filters input[type="search"] { flex: 1 1 10rem; }
}
