@layer tokens {
  /* ===================================================
     Dark Theme – The Gnostic Key (Global Base)
     Version: 2.5  Luxe Dark Refresh (2026) — REVISED
     Changes:
     • Full aliasing of legacy --gold-* tokens for system compatibility
     • Consistent token usage and structure with all pillar themes
     • Minor clean-up of redundant declarations
     • Maintained rich warm mystical gold + violet undertones
     • Full token parity with Indigo, Lightgold, Obsidian, Plum Wine, Teal, Vault & Tyrian Purple
     =================================================== */

  html[data-theme="dark"] {
    /* ✦ Core */
    --bg-opacity: 0.17;
    --bg-primary: #0f0c14;
    --bg-secondary: #1a1622;
    --bg-wash: rgba(12, 10, 18, 0.94);
    --bg-color: var(--bg-primary);
    --bg: var(--bg-primary);

    --text-primary: #f4f1ea;
    --text-secondary: #d0c4b8;
    --text-muted: #a38f72;
    --text-base: var(--text-primary);

    /* ✦ Accents (warm mystical gold + violet undertones) */
    --text-accent: #d9a646;
    --accent: var(--text-accent);
    --accent-page: #dfb85c;
    --highlight: #e6c37f;

    --glyph-color: #e0ad67;
    --strong-text: #dfb85c;
    --cite-color: #d9a646;

    /* ✦ Shadows & Glows (premium modern feel) */
    --shadow-glow: rgba(232, 185, 90, 0.28);
    --page-shadow-soft: 0 12px 30px rgba(0,0,0,0.35);
    --page-box-shadow: 0 0 24px rgba(232, 185, 90, 0.22);
    --glow-soft: 0 12px 26px rgba(232, 185, 90, 0.20);
    --glow-strong: 0 20px 36px rgba(232, 185, 90, 0.30);

    /* ✦ Sections & Surfaces */
    --section-bg-top: #1a1622;
    --section-bg-bottom: #261f2e;
    --section-border: rgba(217, 166, 70, 0.34);
    --divider-border: rgba(217, 166, 70, 0.42);
    --divider-border-soft: rgba(217, 166, 70, 0.30);
    --section-subtitle-color: var(--text-secondary);

    --bg-alt: rgba(26, 22, 34, 0.96);
    --bg-surface: rgba(15, 12, 20, 0.90);
    --surface-elevated: #1a1622;
    --card-surface: color-mix(in srgb, var(--bg-secondary) 94%, var(--highlight) 6%);

    /* ✦ Gradients */
    --card-gradient: color-mix(in srgb, var(--bg-secondary) 94%, var(--highlight) 6%);

    /* ✦ Borders & Helpers */
    --border-accent: rgba(217, 166, 70, 0.30);
    --border-soft: rgba(217, 166, 70, 0.20);

    /* Legacy gold token aliases (full system compatibility) */
    --gold-border: var(--border-accent);
    --gold-tone: var(--glyph-color);
    --soft-gold: var(--highlight);
    --golden-blaze: #ead6a0;

    --accent-soft: rgba(217, 166, 70, 0.18);
    --accent-soft-glow: rgba(217, 166, 70, 0.24);
    --accent-glow: rgba(230, 195, 127, 0.30);

    /* ✦ Links */
    --link-color: var(--text-accent);
    --link-hover: var(--accent-page);
    --link-active: #f0cf85;
    --link-visited: #e0bb72;

    /* ✦ Inputs & Forms */
    --input-bg: #1a1622;
    --input-bg-focus: #261f2e;
    --input-border: rgba(255, 255, 255, 0.16);
    --input-focus-border: var(--highlight);
    --input-text: var(--text-primary);
    --input-placeholder: rgba(244, 241, 231, 0.58);
    --input-disabled-bg: rgba(26, 22, 34, 0.72);
    --input-disabled-text: rgba(244, 241, 231, 0.54);

    /* ✦ Badges */
    --badge-bg: rgba(232, 185, 90, 0.38);
    --badge-text: #ffe8b8;
    --badge-border: rgba(232, 185, 90, 0.45);
    --badge-shadow: 0 2px 8px rgba(232, 185, 90, 0.24);

    /* ✦ Footer & Overlay */
    --footer-opacity: 0.83;
    --overlay-bg-gradient: linear-gradient(
      to right,
      rgba(26, 22, 34, 0.38),
      rgba(60, 40, 70, 0.34)
    );

    --bg-gradient: var(--overlay-bg-gradient);

    /* ✦ Quiz & Special Elements */
    --quiz-wrong-bg: rgba(255, 90, 60, 0.18);
    --quiz-wrong-text: #ff8a7a;
    --quiz-outline-selected: rgba(255, 232, 184, 0.35);
    --quiz-reveal-text: var(--text-secondary);

    /* Compatibility aliases */
    --text-light: var(--text-primary);
    --text-primary-dark: var(--text-primary);
    --text-accent-dark: var(--text-accent);

    /* Table helpers */
    --table-head-bg-dark: rgba(255, 232, 184, 0.12);
    --table-row-odd-dark: rgba(255, 255, 255, 0.06);
    --table-row-even-dark: rgba(255, 255, 255, 0.02);
    --highlight-dark: rgba(255, 232, 184, 0.16);
  }
}
