/* ==========================================================================
   RUNIC THEME: Arcane Grimoire Reforged
   Ritual velvet, luminous sigils, gilded circles, occult parchment, and midnight incense.
   ========================================================================= */

[data-theme="arcane-grimoire"] {
    /* Core hue system */
    --hue-primary: 274;
    --hue-accent: 46;
    --hue-gm: 302;
    --hue-danger: 356;
    --hue-warning: 38;
    --hue-success: 150;
    --hue-toxicity: 112;
    --hue-neutral: 30;

    --sat-primary: 70%;
    --lit-primary: 62%;
    --lit-primary-hover: 68%;

    --sat-accent: 78%;
    --lit-accent: 58%;
    --lit-accent-hover: 66%;

    --sat-gm: 72%;
    --lit-gm: 60%;
    --lit-gm-text: 94%;

    --sat-danger: 72%;
    --lit-danger: 54%;
    --lit-danger-hover: 60%;

    --sat-warning: 82%;
    --lit-warning: 58%;

    --sat-success: 42%;
    --lit-success: 42%;

    --sat-toxicity: 52%;
    --lit-toxicity: 54%;

    --lightness-bg: 8%;

    /* Form and timing */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;

    --font-sans: 'Cinzel', 'Cormorant Garamond', 'Palatino Linotype', serif;
    --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

    --duration-75: 100ms;
    --duration-150: 180ms;
    --duration-250: 300ms;
    --duration-300: 400ms;
    --duration-400: 760ms;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

    /* Identity */
    --velvet-night: hsl(276 30% 10%);
    --ritual-plum: hsl(280 34% 16%);
    --ink-violet: hsl(272 28% 20%);
    --rune-violet: hsl(274 78% 72%);
    --glyph-magenta: hsl(302 62% 64%);
    --sigil-gold: hsl(46 86% 68%);
    --gold-leaf: hsl(42 64% 56%);
    --wax-ember: hsl(14 74% 58%);
    --parchment-soft: hsl(38 30% 84%);
    --bone-paper: hsl(40 24% 92%);
    --ash-ink: hsl(276 18% 18%);
    --smoke-lilac: hsl(270 18% 74%);

    /* Surfaces */
    --bg-page: hsl(274 30% 7%);
    --bg-primary: hsl(274 26% 9%);
    --bg-secondary: hsl(274 22% 12% / 0.92);
    --bg-tertiary: hsl(274 20% 15% / 0.96);
    --bg-card: hsl(274 24% 12% / 0.94);
    --bg-hover: hsl(278 28% 20% / 0.56);
    --bg-input: hsl(274 20% 13%);

    --surface-elevated: hsl(274 24% 16%);
    --surface-overlay: hsl(274 26% 16% / 0.98);
    --surface-panel: hsl(274 22% 14% / 0.96);

    /* Text */
    --text-primary: hsl(282 22% 90%);
    --text-secondary: hsl(274 18% 76%);
    --text-label: hsl(46 72% 70%);
    --text-light: hsl(40 48% 96%);
    --text-muted: hsl(272 14% 62% / 0.82);

    /* Borders and shadows */
    --border-color: hsl(46 56% 56% / 0.28);
    --border-subtle: hsl(46 30% 58% / 0.16);
    --border-strong: hsl(46 78% 68% / 0.68);

    --shadow-glow-primary:
        0 16px 34px hsl(270 34% 6% / 0.42),
        0 0 28px hsl(274 78% 72% / 0.14);
    --shadow-glow-accent:
        0 10px 24px hsl(46 86% 68% / 0.2);
    --shadow-glow-danger:
        0 10px 22px hsl(356 62% 56% / 0.16);
    --shadow-glow-gold:
        0 0 24px hsl(46 86% 68% / 0.24);

    /* Icons */
    --icon-color: hsl(46 78% 68%);
    --icon-filter: brightness(0) saturate(100%) invert(83%) sepia(38%)
        saturate(931%) hue-rotate(349deg) brightness(98%) contrast(92%);

    /* Focus and tooltip */
    --color-focus-ring: hsl(274 78% 72% / 0.26);

    --color-tooltip-bg: hsl(274 26% 11% / 0.98);
    --color-tooltip-highlight: hsl(46 86% 72%);
    --color-tooltip-effect-bg: hsl(274 78% 72% / 0.1);
    --color-tooltip-text: hsl(282 20% 90%);
    --color-tooltip-label: hsl(46 64% 70%);
    --color-tooltip-muted: hsl(272 14% 62%);
    --color-tooltip-dim: hsl(270 12% 52%);
    --color-tooltip-pos: hsl(150 42% 58%);
    --color-tooltip-neg: hsl(356 62% 60%);
    --color-tooltip-separator: hsl(46 48% 56% / 0.34);
    --color-tooltip-section-bg: hsl(274 20% 16% / 0.88);

    /* Quality colors */
    --quality-0-color1: rgb(112, 102, 92);
    --quality-0-color2: rgb(78, 70, 64);
    --quality-1-color1: rgb(226, 214, 188);
    --quality-1-color2: rgb(184, 170, 144);
    --quality-2-color1: rgb(152, 214, 182);
    --quality-2-color2: rgb(108, 162, 132);
    --quality-3-color1: rgb(168, 132, 238);
    --quality-3-color2: rgb(124, 90, 192);
    --quality-4-color1: rgb(214, 120, 255);
    --quality-4-color2: rgb(164, 70, 220);
    --quality-5-color1: rgb(255, 216, 104);
    --quality-5-color2: rgb(226, 170, 54);
    --quality-6-color1: rgb(236, 96, 104);
    --quality-6-color2: rgb(184, 54, 64);
    --quality-7-color1: rgb(255, 234, 178);
    --quality-7-color2: rgb(210, 136, 255);

    /* Spell / element system */
    --element-fire-bg: hsl(10 44% 18% / 0.82);
    --element-fire-border: hsl(12 72% 56% / 0.6);
    --element-fire-hover: hsl(10 50% 22% / 0.92);
    --element-fire-glow: hsl(12 74% 60% / 0.18);

    --element-water-bg: hsl(234 28% 18% / 0.82);
    --element-water-border: hsl(230 42% 56% / 0.56);
    --element-water-hover: hsl(234 32% 22% / 0.92);
    --element-water-glow: hsl(230 46% 62% / 0.16);

    --element-earth-bg: hsl(36 20% 18% / 0.82);
    --element-earth-border: hsl(34 34% 48% / 0.54);
    --element-earth-hover: hsl(36 24% 22% / 0.92);
    --element-earth-glow: hsl(34 42% 56% / 0.14);

    --element-wind-bg: hsl(266 22% 18% / 0.8);
    --element-wind-border: hsl(274 30% 54% / 0.52);
    --element-wind-hover: hsl(268 26% 22% / 0.9);
    --element-wind-glow: hsl(274 36% 60% / 0.14);

    --element-light-bg: hsl(46 36% 18% / 0.84);
    --element-light-border: hsl(46 74% 62% / 0.64);
    --element-light-hover: hsl(46 40% 22% / 0.94);
    --element-light-glow: hsl(46 82% 68% / 0.22);

    --element-shadow-bg: hsl(280 26% 18% / 0.84);
    --element-shadow-border: hsl(280 44% 58% / 0.58);
    --element-shadow-hover: hsl(280 30% 22% / 0.94);
    --element-shadow-glow: hsl(280 52% 64% / 0.18);

    --element-death-bg: hsl(330 22% 18% / 0.82);
    --element-death-border: hsl(334 40% 54% / 0.56);
    --element-death-hover: hsl(330 28% 22% / 0.92);
    --element-death-glow: hsl(334 44% 60% / 0.16);

    --element-life-bg: hsl(150 20% 18% / 0.82);
    --element-life-border: hsl(150 34% 50% / 0.54);
    --element-life-hover: hsl(150 24% 22% / 0.92);
    --element-life-glow: hsl(150 40% 58% / 0.16);

    --element-arcane-bg: hsl(282 30% 18% / 0.84);
    --element-arcane-border: hsl(286 56% 62% / 0.6);
    --element-arcane-hover: hsl(282 34% 22% / 0.94);
    --element-arcane-glow: hsl(286 60% 68% / 0.2);

    --element-mind-bg: hsl(248 24% 18% / 0.82);
    --element-mind-border: hsl(248 34% 54% / 0.54);
    --element-mind-hover: hsl(248 28% 22% / 0.92);
    --element-mind-glow: hsl(248 40% 60% / 0.16);

    --element-physical-bg: hsl(34 18% 18% / 0.84);
    --element-physical-border: hsl(36 26% 46% / 0.5);
    --element-physical-hover: hsl(36 22% 22% / 0.94);
    --element-physical-glow: hsl(36 30% 54% / 0.14);

    --spell-temp-bg: hsl(276 24% 16%);
    --spell-temp-border: hsl(46 42% 58% / 0.76);
    --spell-temp-hover-bg: hsl(278 28% 20%);
    --spell-temp-hover-glow: hsl(274 78% 72% / 0.16);
    --spell-temp-badge-bg: hsl(46 64% 52%);
    --spell-temp-header-bg: hsl(276 22% 18%);
    --spell-temp-header-hover-bg: hsl(278 24% 22%);
    --spell-tile-hover-bg: hsl(278 28% 20%);

    /* Inventory / currency / buffs */
    --item-tile-base: hsl(276 22% 16%);
    --item-tile-border: hsl(46 30% 50% / 0.48);
    --item-tile-add-bg: hsl(274 20% 14%);
    --item-tile-add-border: hsl(46 24% 48% / 0.42);
    --item-tile-add-hover: hsl(278 24% 18%);
    --item-tile-add-border-hover: hsl(46 68% 68% / 0.72);

    --weight-display-bg: hsl(274 20% 14%);
    --weight-ok-color: hsl(150 42% 58%);
    --weight-warn-color: hsl(38 72% 60%);
    --weight-crit-color: hsl(356 62% 58%);
    --weight-bar-track-bg: hsl(272 14% 22%);

    --currency-tile-bg: hsl(276 22% 16%);
    --currency-tile-border: hsl(46 30% 50% / 0.48);
    --currency-tile-hover-bg: hsl(278 24% 18%);
    --currency-tile-hover-shadow: hsl(46 86% 68% / 0.16);
    --currency-quantity-bg: hsl(278 20% 22%);
    --currency-add-bg: hsl(274 20% 14%);
    --currency-add-border: hsl(46 24% 48% / 0.42);
    --currency-add-hover-bg: hsl(278 24% 18%);
    --currency-add-hover-border: hsl(46 68% 68% / 0.72);

    --color-buff-tile-bg: hsl(150 18% 18%);
    --color-buff-tile-border: hsl(150 34% 50% / 0.5);
    --color-buff-tile-hover: hsl(150 22% 22%);
    --color-buff-tile-glow: hsl(150 42% 58% / 0.14);
    --color-debuff-tile-bg: hsl(356 18% 18%);
    --color-debuff-tile-border: hsl(356 38% 52% / 0.52);
    --color-debuff-tile-hover: hsl(356 22% 22%);
    --color-debuff-tile-glow: hsl(356 42% 58% / 0.14);
    --color-neutral-tile-bg: hsl(274 18% 18%);
    --color-neutral-tile-border: hsl(274 22% 42% / 0.44);
    --color-neutral-tile-hover: hsl(276 22% 22%);
    --color-neutral-tile-glow: hsl(274 38% 62% / 0.1);
    --color-buff-indicator: hsl(150 42% 58%);
    --color-debuff-indicator: hsl(356 62% 58%);

    /* Common status colors */
    --color-heal: hsl(150 42% 58%);
    --color-gold: hsl(46 78% 64%);
    --color-amber: hsl(34 72% 58%);
    --color-amber-ui: hsl(34 72% 58%);
    --color-crit: hsl(356 62% 58%);
    --border-gold: hsl(46 70% 64% / 0.44);

    /* Overlays */
    --overlay-heavy: hsl(274 30% 6% / 0.82);
    --overlay-dark: hsl(274 22% 8% / 0.56);
    --overlay-medium: hsl(274 18% 10% / 0.3);
    --overlay-light: hsl(276 14% 12% / 0.14);
    --overlay-subtle: hsl(278 12% 12% / 0.08);
}

/* ==========================================================================
   Animations
   ========================================================================= */

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

@keyframes runeBreath {
    0%, 100% {
        box-shadow:
            0 0 0 1px hsl(46 40% 56% / 0.18),
            0 14px 30px hsl(274 30% 6% / 0.42);
    }
    50% {
        box-shadow:
            0 0 0 1px hsl(274 78% 72% / 0.28),
            0 18px 38px hsl(274 30% 6% / 0.5),
            0 0 26px hsl(46 86% 68% / 0.16);
    }
}

@keyframes candlePulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.06); }
}

/* ==========================================================================
   Global Atmosphere
   ========================================================================= */

[data-theme="arcane-grimoire"] body,
[data-theme="arcane-grimoire"] .page-content,
[data-theme="arcane-grimoire"] .main-content,
[data-theme="arcane-grimoire"] .content-wrapper {
    background:
        radial-gradient(circle at 50% 0%, hsl(274 46% 18% / 0.24), transparent 22%),
        radial-gradient(circle at 18% 70%, hsl(46 38% 24% / 0.1), transparent 18%),
        radial-gradient(circle at 82% 20%, hsl(302 38% 20% / 0.12), transparent 18%),
        linear-gradient(180deg, hsl(274 28% 8%), hsl(274 30% 6%) 42%, hsl(270 34% 5%) 100%);
    color: var(--text-primary);
}

[data-theme="arcane-grimoire"] body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 50%, hsl(274 78% 72% / 0.05) 0 1.5px, transparent 3px),
        radial-gradient(circle at 12% 20%, hsl(46 86% 68% / 0.05) 0 1px, transparent 2px),
        radial-gradient(circle at 84% 72%, hsl(302 62% 64% / 0.04) 0 1px, transparent 2px);
    background-size: 280px 280px, 220px 220px, 320px 320px;
    opacity: 0.48;
    z-index: 0;
}

[data-theme="arcane-grimoire"] body::after {
    content: '';
    position: fixed;
    left: 50%;
    top: 16%;
    width: 46rem;
    height: 46rem;
    transform: translateX(-50%);
    border-radius: 50%;
    pointer-events: none;
    background:
        radial-gradient(circle, transparent 44%, hsl(46 56% 56% / 0.08) 45% 46%, transparent 47%),
        radial-gradient(circle, transparent 59%, hsl(274 58% 48% / 0.08) 60% 61%, transparent 62%),
        conic-gradient(from 0deg, transparent 0 10%, hsl(46 86% 68% / 0.05) 12%, transparent 14% 24%, hsl(274 78% 72% / 0.05) 26%, transparent 28% 38%, hsl(46 86% 68% / 0.05) 40%, transparent 42% 52%, hsl(274 78% 72% / 0.05) 54%, transparent 56% 66%, hsl(46 86% 68% / 0.05) 68%, transparent 70% 80%, hsl(274 78% 72% / 0.05) 82%, transparent 84% 100%);
    animation: sigilTurn 48s linear infinite;
    opacity: 0.56;
    z-index: 0;
}

[data-theme="arcane-grimoire"] .navigation-bar,
[data-theme="arcane-grimoire"] .content-box,
[data-theme="arcane-grimoire"] .dashboard-panel,
[data-theme="arcane-grimoire"] .modal-content,
[data-theme="arcane-grimoire"] .character-sheet-panel,
[data-theme="arcane-grimoire"] .inventory-section {
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Shared Panels
   ========================================================================= */

[data-theme="arcane-grimoire"] .content-box,
[data-theme="arcane-grimoire"] .dashboard-panel,
[data-theme="arcane-grimoire"] .modal-content,
[data-theme="arcane-grimoire"] .equipment-panel,
[data-theme="arcane-grimoire"] .inventory-section,
[data-theme="arcane-grimoire"] .spell-tooltip,
[data-theme="arcane-grimoire"] .login-container,
[data-theme="arcane-grimoire"] .widget-tile,
[data-theme="arcane-grimoire"] .character-item,
[data-theme="arcane-grimoire"] .attribute-card,
[data-theme="arcane-grimoire"] .bereich-tile,
[data-theme="arcane-grimoire"] .spell-tile,
[data-theme="arcane-grimoire"] .resistance-tile {
    background:
        linear-gradient(180deg, hsl(276 22% 16% / 0.96), hsl(272 24% 10% / 0.96));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow:
        0 18px 38px hsl(274 30% 6% / 0.46),
        inset 0 1px 0 hsl(46 48% 88% / 0.08);
}

[data-theme="arcane-grimoire"] .content-box::before,
[data-theme="arcane-grimoire"] .dashboard-panel::before,
[data-theme="arcane-grimoire"] .modal-content::before,
[data-theme="arcane-grimoire"] .widget-tile::before,
[data-theme="arcane-grimoire"] .character-item::before,
[data-theme="arcane-grimoire"] .attribute-card::before,
[data-theme="arcane-grimoire"] .login-container::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: calc(var(--radius-xl) - 8px);
    border: 1px solid hsl(46 42% 58% / 0.14);
    pointer-events: none;
}

[data-theme="arcane-grimoire"] .content-box:hover,
[data-theme="arcane-grimoire"] .dashboard-panel:hover,
[data-theme="arcane-grimoire"] .widget-tile:hover,
[data-theme="arcane-grimoire"] .character-item:hover,
[data-theme="arcane-grimoire"] .attribute-card:hover,
[data-theme="arcane-grimoire"] .bereich-tile:hover,
[data-theme="arcane-grimoire"] .spell-tile:hover {
    border-color: var(--border-strong);
    animation: runeBreath 3.2s ease-in-out infinite;
}

/* ==========================================================================
   Typography and Icons
   ========================================================================= */

[data-theme="arcane-grimoire"] h1,
[data-theme="arcane-grimoire"] h2,
[data-theme="arcane-grimoire"] h3,
[data-theme="arcane-grimoire"] .widget-title,
[data-theme="arcane-grimoire"] .character-info h3,
[data-theme="arcane-grimoire"] .bereich-title,
[data-theme="arcane-grimoire"] .attribute-name,
[data-theme="arcane-grimoire"] #charNameLabel {
    color: hsl(46 86% 74%);
    text-shadow:
        0 0 12px hsl(46 86% 68% / 0.26),
        0 0 28px hsl(274 78% 72% / 0.12);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-variant: small-caps;
}

[data-theme="arcane-grimoire"] .icon-themed,
[data-theme="arcane-grimoire"] .spell-icon,
[data-theme="arcane-grimoire"] .resistance-icon,
[data-theme="arcane-grimoire"] .currency-icon,
[data-theme="arcane-grimoire"] .buff-icon,
[data-theme="arcane-grimoire"] .tab_Icon,
[data-theme="arcane-grimoire"] .tab_btn img,
[data-theme="arcane-grimoire"] .nav-icon-btn img,
[data-theme="arcane-grimoire"] #div_iconbar_left img,
[data-theme="arcane-grimoire"] #div_iconbar_right img {
    filter: var(--icon-filter);
}

/* ==========================================================================
   Headers and Category Bars
   ========================================================================= */

[data-theme="arcane-grimoire"] .discipline-header,
[data-theme="arcane-grimoire"] .info-category-header,
[data-theme="arcane-grimoire"] .info-subcategory-header,
[data-theme="arcane-grimoire"] .itemtype-header {
    background:
        linear-gradient(135deg, hsl(278 30% 22%), hsl(272 24% 14%));
    color: hsl(46 82% 74%) !important;
    border: 1px solid hsl(46 56% 56% / 0.32);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 1px 0 hsl(46 48% 88% / 0.08);
}

[data-theme="arcane-grimoire"] .discipline-header:hover,
[data-theme="arcane-grimoire"] .info-category-header:hover,
[data-theme="arcane-grimoire"] .itemtype-header:hover {
    background:
        linear-gradient(135deg, hsl(282 34% 24%), hsl(274 26% 16%));
}

[data-theme="arcane-grimoire"] .subskill-item.passive {
    background: hsl(274 20% 18% / 0.64) !important;
}

/* ==========================================================================
   Navigation
   ========================================================================= */

[data-theme="arcane-grimoire"] .navigation-bar,
[data-theme="arcane-grimoire"] .tab-top-navigation {
    background:
        linear-gradient(180deg, hsl(276 24% 12% / 0.98), hsl(272 28% 8% / 0.98));
    border-bottom: 1px solid hsl(46 48% 56% / 0.24);
    box-shadow:
        0 14px 30px hsl(274 30% 6% / 0.46),
        inset 0 1px 0 hsl(46 48% 88% / 0.08);
}

[data-theme="arcane-grimoire"] .tab_btn,
[data-theme="arcane-grimoire"] .tab_btn_vertical,
[data-theme="arcane-grimoire"] .tab-buttons .tab-btn,
[data-theme="arcane-grimoire"] .tab-navigation .tab-btn,
[data-theme="arcane-grimoire"] .tab_btn_horizontal,
[data-theme="arcane-grimoire"] .tab_btn_original {
    background:
        linear-gradient(180deg, hsl(278 24% 18%), hsl(272 22% 10%)) !important;
    border: 1px solid hsl(46 30% 50% / 0.26) !important;
    color: hsl(46 72% 74%) !important;
    box-shadow:
        inset 0 1px 0 hsl(46 48% 88% / 0.06),
        0 8px 18px hsl(274 30% 6% / 0.28);
}

[data-theme="arcane-grimoire"] .tab_btn:hover,
[data-theme="arcane-grimoire"] .tab_btn_vertical:hover,
[data-theme="arcane-grimoire"] .tab-buttons .tab-btn:hover,
[data-theme="arcane-grimoire"] .tab-navigation .tab-btn:hover,
[data-theme="arcane-grimoire"] .tab_btn_horizontal:hover,
[data-theme="arcane-grimoire"] .tab_btn_original:hover {
    background:
        linear-gradient(180deg, hsl(282 28% 22%), hsl(274 24% 14%)) !important;
    border-color: hsl(46 68% 68% / 0.54) !important;
    box-shadow:
        0 10px 22px hsl(274 30% 6% / 0.32),
        0 0 18px hsl(274 78% 72% / 0.1);
}

[data-theme="arcane-grimoire"] .tab_btn.active,
[data-theme="arcane-grimoire"] .tab_btn.active-tab,
[data-theme="arcane-grimoire"] .tab_btn_vertical.active,
[data-theme="arcane-grimoire"] .tab-buttons .tab-btn.active,
[data-theme="arcane-grimoire"] .tab-navigation .tab-btn.active,
[data-theme="arcane-grimoire"] .tab_btn_horizontal.active,
[data-theme="arcane-grimoire"] .tab_btn_horizontal.main-tab,
[data-theme="arcane-grimoire"] .tab_btn_horizontal.main-tab.active,
[data-theme="arcane-grimoire"] .tab_btn_original.active,
[data-theme="arcane-grimoire"] #navi-btn-combat.tab_btn.combat-active {
    background:
        linear-gradient(135deg, hsl(274 70% 58%), hsl(302 62% 56%)) !important;
    border-color: hsl(46 82% 80%) !important;
    color: hsl(0 0% 100%) !important;
    box-shadow:
        0 0 0 3px hsl(274 70% 58% / 0.16),
        0 14px 28px hsl(274 30% 6% / 0.34),
        0 0 24px hsl(46 86% 68% / 0.16) !important;
}

[data-theme="arcane-grimoire"] .tab_btn.active-tab .tab_Icon,
[data-theme="arcane-grimoire"] .tab_btn.active-tab img,
[data-theme="arcane-grimoire"] .tab_btn_vertical.active img,
[data-theme="arcane-grimoire"] .tab-buttons .tab-btn.active .tab_Icon,
[data-theme="arcane-grimoire"] .tab-navigation .tab-btn.active .tab_Icon,
[data-theme="arcane-grimoire"] .tab_btn_horizontal.active img,
[data-theme="arcane-grimoire"] .tab_btn_horizontal.main-tab img,
[data-theme="arcane-grimoire"] .tab_btn_original.active img,
[data-theme="arcane-grimoire"] #navi-btn-combat.tab_btn.combat-active img {
    filter:
        brightness(0) saturate(100%) invert(100%) sepia(7%)
        saturate(355%) hue-rotate(175deg) brightness(102%) contrast(99%) !important;
}

/* ==========================================================================
   Buttons and Inputs
   ========================================================================= */

[data-theme="arcane-grimoire"] button,
[data-theme="arcane-grimoire"] .btn,
[data-theme="arcane-grimoire"] .roll-button,
[data-theme="arcane-grimoire"] input[type="button"],
[data-theme="arcane-grimoire"] input[type="submit"] {
    background:
        linear-gradient(135deg, hsl(274 70% 58%), hsl(282 60% 46%));
    color: hsl(46 90% 90%);
    border: 1px solid hsl(46 56% 56% / 0.42);
    border-radius: var(--radius-lg);
    box-shadow:
        0 10px 22px hsl(274 30% 6% / 0.34),
        inset 0 1px 0 hsl(46 48% 88% / 0.12);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

[data-theme="arcane-grimoire"] button:hover,
[data-theme="arcane-grimoire"] .btn:hover,
[data-theme="arcane-grimoire"] .roll-button:hover,
[data-theme="arcane-grimoire"] input[type="button"]:hover,
[data-theme="arcane-grimoire"] input[type="submit"]:hover {
    background:
        linear-gradient(135deg, hsl(278 74% 62%), hsl(302 62% 56%));
    box-shadow:
        0 14px 28px hsl(274 30% 6% / 0.38),
        0 0 20px hsl(46 86% 68% / 0.12);
}

[data-theme="arcane-grimoire"] input,
[data-theme="arcane-grimoire"] textarea,
[data-theme="arcane-grimoire"] select,
[data-theme="arcane-grimoire"] .select,
[data-theme="arcane-grimoire"] .form-select,
[data-theme="arcane-grimoire"] .equipment-select {
    background:
        linear-gradient(180deg, hsl(274 20% 16%), hsl(272 20% 12%));
    border: 1px solid hsl(46 30% 50% / 0.24);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 hsl(46 48% 88% / 0.05);
}

[data-theme="arcane-grimoire"] input:focus,
[data-theme="arcane-grimoire"] textarea:focus,
[data-theme="arcane-grimoire"] select:focus,
[data-theme="arcane-grimoire"] .select:focus,
[data-theme="arcane-grimoire"] .form-select:focus,
[data-theme="arcane-grimoire"] .equipment-select:focus {
    border-color: hsl(274 78% 72%);
    box-shadow:
        0 0 0 4px var(--color-focus-ring),
        0 0 18px hsl(274 78% 72% / 0.12);
    outline: none;
}

[data-theme="arcane-grimoire"] select,
[data-theme="arcane-grimoire"] .select,
[data-theme="arcane-grimoire"] .form-select,
[data-theme="arcane-grimoire"] .equipment-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d9b55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 14px;
    padding-right: 2rem;
}

/* ==========================================================================
   Tables
   ========================================================================= */

[data-theme="arcane-grimoire"] table {
    background: hsl(274 20% 12% / 0.96);
    border: 1px solid hsl(46 28% 46% / 0.18);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

[data-theme="arcane-grimoire"] th {
    background: hsl(46 30% 24% / 0.34);
    color: hsl(46 82% 74%);
}

[data-theme="arcane-grimoire"] td {
    background: hsl(274 18% 13% / 0.92);
    color: var(--text-primary);
    border-bottom: 1px solid hsl(46 22% 38% / 0.1);
}

[data-theme="arcane-grimoire"] tr:hover td {
    background: hsl(278 20% 17% / 0.96);
}

/* ==========================================================================
   Cards, Widgets, Login
   ========================================================================= */

[data-theme="arcane-grimoire"] .widget-tile,
[data-theme="arcane-grimoire"] .character-item {
    overflow: hidden;
}

[data-theme="arcane-grimoire"] .character-item:hover,
[data-theme="arcane-grimoire"] .widget-tile:hover {
    transform: translateY(-3px);
}

[data-theme="arcane-grimoire"] .character-item::after,
[data-theme="arcane-grimoire"] .widget-tile::after,
[data-theme="arcane-grimoire"] .login-container::after {
    content: '';
    position: absolute;
    top: 14px;
    right: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 35%, hsl(46 90% 84%), hsl(46 64% 56%) 46%, hsl(274 70% 58%) 100%);
    box-shadow:
        18px 0 0 -4px hsl(274 78% 72% / 0.72),
        0 18px 0 -4px hsl(46 86% 68% / 0.68);
    animation: candlePulse 4s ease-in-out infinite;
}

[data-theme="arcane-grimoire"] .login-container {
    border-radius: var(--radius-2xl);
}

/* ==========================================================================
   Attribute Cards and Stats
   ========================================================================= */

[data-theme="arcane-grimoire"] .attribute-cards-container {
    background:
        linear-gradient(180deg, hsl(274 20% 12% / 0.42), hsl(272 22% 10% / 0.42));
    border-radius: var(--radius-2xl);
}

[data-theme="arcane-grimoire"] .attribute-card {
    position: relative;
}

[data-theme="arcane-grimoire"] .attribute-card::after {
    content: '';
    position: absolute;
    inset: 12px auto auto 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid hsl(46 56% 56% / 0.26);
    box-shadow: 0 0 0 5px hsl(274 78% 72% / 0.04);
    pointer-events: none;
}

[data-theme="arcane-grimoire"] .attribute-icon-container {
    background:
        linear-gradient(135deg, hsl(274 40% 26%), hsl(46 34% 24%));
    color: hsl(46 82% 74%);
}

[data-theme="arcane-grimoire"] .attribute-value,
[data-theme="arcane-grimoire"] .stat-value,
[data-theme="arcane-grimoire"] .tt-total-label,
[data-theme="arcane-grimoire"] .tt-total-value {
    color: hsl(274 78% 76%);
}

[data-theme="arcane-grimoire"] .attribute-bonus {
    background: hsl(150 18% 18%);
    color: hsl(150 42% 64%);
}

[data-theme="arcane-grimoire"] .attribute-subskills,
[data-theme="arcane-grimoire"] .roll-result {
    background: hsl(274 18% 13% / 0.88);
    border: 1px solid hsl(46 28% 46% / 0.16);
    border-radius: var(--radius-lg);
}

[data-theme="arcane-grimoire"] .subskill-item {
    border-bottom-color: hsl(46 22% 38% / 0.1);
}

[data-theme="arcane-grimoire"] .subskill-name {
    color: hsl(302 52% 72%);
}

[data-theme="arcane-grimoire"] .subskill-effect,
[data-theme="arcane-grimoire"] .stat-label {
    color: hsl(274 18% 76%);
}

[data-theme="arcane-grimoire"] .attribute-card.physical {
    border-left-color: hsl(150 42% 58%);
}

[data-theme="arcane-grimoire"] .attribute-card.mental {
    border-left-color: hsl(274 78% 72%);
}

[data-theme="arcane-grimoire"] .attribute-card.social {
    border-left-color: hsl(46 86% 68%);
}

[data-theme="arcane-grimoire"] .attribute-card.special {
    border-left-color: hsl(302 62% 64%);
}

[data-theme="arcane-grimoire"] .stat-item {
    background: hsl(276 18% 14% / 0.9);
    border: 1px solid hsl(46 22% 38% / 0.14);
    border-radius: var(--radius-lg);
}

[data-theme="arcane-grimoire"] .stat-item:hover {
    background: hsl(278 20% 18% / 0.94);
}

/* ==========================================================================
   Inventory, Spellbook, Resistances
   ========================================================================= */

[data-theme="arcane-grimoire"] .currency-tile,
[data-theme="arcane-grimoire"] .resistance-tile,
[data-theme="arcane-grimoire"] .buff-tile,
[data-theme="arcane-grimoire"] .inventory-slot,
[data-theme="arcane-grimoire"] .inventory-item {
    border-radius: var(--radius-lg);
    box-shadow: inset 0 1px 0 hsl(46 48% 88% / 0.04);
}

[data-theme="arcane-grimoire"] .currency-add-icon {
    color: hsl(46 82% 72%);
}

[data-theme="arcane-grimoire"] .buff-duration {
    background-color: hsl(278 18% 20% / 0.72);
    color: hsl(282 18% 82%);
}

[data-theme="arcane-grimoire"] .no-buffs-message,
[data-theme="arcane-grimoire"] .resistance-stat-label {
    color: hsl(272 14% 62%);
}

[data-theme="arcane-grimoire"] .equipped-indicator-icon {
    background-color: hsl(46 64% 52%);
    filter: drop-shadow(0 0 6px hsl(46 86% 68% / 0.44));
}

[data-theme="arcane-grimoire"] .spell-tile.temp-spell {
    border-color: var(--spell-temp-border) !important;
    background:
        linear-gradient(180deg, var(--spell-temp-bg), hsl(274 20% 12%)) !important;
}

[data-theme="arcane-grimoire"] .spell-tile.temp-spell:hover {
    background:
        linear-gradient(180deg, var(--spell-temp-hover-bg), hsl(278 22% 16%)) !important;
}

[data-theme="arcane-grimoire"] .spell-name,
[data-theme="arcane-grimoire"] .spell-progress {
    color: hsl(282 20% 90%);
}

[data-theme="arcane-grimoire"] .spell-cost {
    color: hsl(46 82% 72%);
}

/* ==========================================================================
   Bars and Progress
   ========================================================================= */

[data-theme="arcane-grimoire"] .progress-container,
[data-theme="arcane-grimoire"] .bar-track,
[data-theme="arcane-grimoire"] .resource-bar,
[data-theme="arcane-grimoire"] .weight-bar-container {
    background:
        linear-gradient(180deg, hsl(274 16% 12%), hsl(270 20% 8%)) !important;
    border: 1px solid hsl(46 24% 42% / 0.18) !important;
    border-radius: 999px !important;
    box-shadow:
        inset 0 2px 6px hsl(274 30% 6% / 0.44),
        inset 0 1px 0 hsl(46 48% 88% / 0.03);
}

[data-theme="arcane-grimoire"] #healthText,
[data-theme="arcane-grimoire"] #magicText,
[data-theme="arcane-grimoire"] #enduranceText {
    color: hsl(40 48% 96%);
    text-shadow: 0 0 10px hsl(274 30% 6% / 0.6);
}

[data-theme="arcane-grimoire"] .progress-bar,
[data-theme="arcane-grimoire"] .progress-fill,
[data-theme="arcane-grimoire"] .bar-fill {
    border-radius: 999px !important;
    overflow: hidden;
}

[data-theme="arcane-grimoire"] .health-bar,
[data-theme="arcane-grimoire"] .hp-bar-fill {
    background:
        linear-gradient(90deg, hsl(334 38% 38%) 0%, hsl(356 62% 58%) 56%, hsl(14 74% 58%) 100%) !important;
    box-shadow: 0 0 14px hsl(356 62% 58% / 0.14) !important;
}

[data-theme="arcane-grimoire"] .magic-bar,
[data-theme="arcane-grimoire"] .mana-bar-fill,
[data-theme="arcane-grimoire"] .energy-bar-fill {
    background:
        linear-gradient(90deg, hsl(272 58% 42%) 0%, hsl(286 74% 58%) 56%, hsl(302 62% 64%) 100%) !important;
    box-shadow: 0 0 16px hsl(274 78% 72% / 0.16) !important;
}

[data-theme="arcane-grimoire"] .endurance-bar,
[data-theme="arcane-grimoire"] .stamina-bar-fill {
    background:
        linear-gradient(90deg, hsl(34 58% 42%) 0%, hsl(46 78% 58%) 55%, hsl(52 88% 70%) 100%) !important;
    box-shadow: 0 0 14px hsl(46 78% 58% / 0.14) !important;
}

[data-theme="arcane-grimoire"] .weight-progress-bar.weight-ok,
[data-theme="arcane-grimoire"] .weight-fill,
[data-theme="arcane-grimoire"] .encumbrance-fill {
    background:
        linear-gradient(90deg, hsl(150 32% 42%) 0%, hsl(150 42% 58%) 100%) !important;
}

[data-theme="arcane-grimoire"] .weight-progress-bar.weight-warn {
    background:
        linear-gradient(90deg, hsl(34 58% 42%) 0%, hsl(46 78% 58%) 100%) !important;
}

[data-theme="arcane-grimoire"] .weight-progress-bar.weight-crit {
    background:
        linear-gradient(90deg, hsl(334 38% 38%) 0%, hsl(356 62% 58%) 100%) !important;
}

/* ==========================================================================
   Tooltips
   ========================================================================= */

[data-theme="arcane-grimoire"] .unified-tooltip,
[data-theme="arcane-grimoire"] .spell-tooltip,
[data-theme="arcane-grimoire"] #item-tooltip {
    background:
        linear-gradient(180deg, hsl(274 26% 12% / 0.98), hsl(272 28% 9% / 0.98));
    border: 1px solid hsl(46 36% 54% / 0.28);
    border-radius: var(--radius-xl);
    color: var(--color-tooltip-text);
    box-shadow:
        0 18px 40px hsl(274 30% 6% / 0.5),
        0 0 18px hsl(46 86% 68% / 0.08);
}

[data-theme="arcane-grimoire"] .itooltip-title,
[data-theme="arcane-grimoire"] .skilltooltip-title,
[data-theme="arcane-grimoire"] .attrtooltip-title,
[data-theme="arcane-grimoire"] .stattooltip-title,
[data-theme="arcane-grimoire"] .unified-tooltip .tooltip-title {
    color: hsl(46 86% 74%) !important;
}

[data-theme="arcane-grimoire"] .tt-section {
    background: hsl(274 20% 16% / 0.72);
    border-radius: var(--radius-md);
}

[data-theme="arcane-grimoire"] .tt-sep-accent {
    border-top-color: hsl(46 68% 68%);
}

/* ==========================================================================
   Toggles and Controls
   ========================================================================= */

[data-theme="arcane-grimoire"] .twohanded-toggle {
    background: transparent !important;
    border: 2px solid hsl(46 28% 48%);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 hsl(46 48% 88% / 0.04);
}

[data-theme="arcane-grimoire"] .twohanded-toggle:hover {
    background: hsl(278 24% 18% / 0.34) !important;
    border-color: hsl(46 68% 68%);
    box-shadow: 0 0 12px hsl(46 86% 68% / 0.1);
}

[data-theme="arcane-grimoire"] .twohanded-toggle.active {
    background:
        linear-gradient(135deg, hsl(274 70% 58%), hsl(302 62% 56%)) !important;
    border-color: hsl(46 82% 80%);
    box-shadow:
        0 0 0 3px hsl(274 70% 58% / 0.16),
        0 0 18px hsl(46 86% 68% / 0.14);
}

[data-theme="arcane-grimoire"] .twohanded-toggle.active .twohanded-toggle-icon {
    filter:
        brightness(0) saturate(100%) invert(100%) sepia(7%)
        saturate(355%) hue-rotate(175deg) brightness(102%) contrast(99%) !important;
}

/* ==========================================================================
   Scrollbars and Selection
   ========================================================================= */

[data-theme="arcane-grimoire"] ::-webkit-scrollbar-track {
    background: hsl(274 18% 10%);
    border-radius: 999px;
}

[data-theme="arcane-grimoire"] ::-webkit-scrollbar-thumb {
    background:
        linear-gradient(180deg, hsl(274 44% 46%), hsl(46 52% 56%));
    border-radius: 999px;
    border: 2px solid hsl(274 18% 10%);
}

[data-theme="arcane-grimoire"] ::-webkit-scrollbar-thumb:hover {
    background:
        linear-gradient(180deg, hsl(278 58% 54%), hsl(46 78% 64%));
}

[data-theme="arcane-grimoire"] ::selection {
    background: hsl(274 70% 58% / 0.3);
    color: hsl(46 90% 90%);
}

/* ==========================================================================
   Utility
   ========================================================================= */

[data-theme="arcane-grimoire"] hr,
[data-theme="arcane-grimoire"] .divider {
    border: none;
    border-top: 1px solid hsl(46 22% 40% / 0.14);
}
[data-theme="arcane-grimoire"] .toxicity-container {
    border-color: var(--color-toxicity) !important;
}

[data-theme="arcane-grimoire"] .toxicity-bar {
    background: var(--gradient-toxicity-resource) !important;
    box-shadow: var(--shadow-glow-toxicity) !important;
}

[data-theme="arcane-grimoire"] #toxicityText {
    color: var(--text-light);
}
