@import url('text-palette.css');

/* Last completed battle: the same open ledger and bronze separators as hub stats. */
[data-menu-screen="hub"] .hub-battle-stats {
    width: 100%; min-width: 0; flex-shrink: 0; box-sizing: border-box; padding-inline: 4px;
    margin-block: 12px; color: #d0be9c;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(16px, 1.05vw, 21px); line-height: 1.35;
}
[data-menu-screen="hub"] .hub-battle-heading {
    position: relative; min-height: calc(12 * var(--menu-ui-pixel,4px));
    width: calc(100% - 4px); margin: 0 2px 12px; padding: 8px 16px; isolation: isolate;
    box-sizing: border-box; text-align: center;
}
[data-menu-screen="hub"] .hub-battle-heading .stats-title-neutral {
    font-size: clamp(17px, 1.2vw, 26px); line-height: 1.3;
    letter-spacing: .035em; overflow-wrap: anywhere; white-space: normal; min-width: 0;
}
[data-menu-screen="hub"] .hub-battle-summary { padding: 12px; background: #100d1480; }
[data-menu-screen="hub"] .hub-battle-meta {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px;
    font-size: .82em; color: #b9aa96;
}
[data-menu-screen="hub"] .hub-battle-outcome { color: #c19a82; }
[data-menu-screen="hub"] .hub-battle-outcome.is-victory { color: #c1dba0; }
[data-menu-screen="hub"] .hub-battle-context { margin: 6px 0 12px; font-size: .88em; overflow-wrap: anywhere; }
[data-menu-screen="hub"] .hub-battle-metrics {
    display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr) minmax(0,1fr);
    gap: 12px; margin: 0; border-top: 2px solid #493721; padding-top: 12px;
}
[data-menu-screen="hub"] .hub-battle-metrics dt { font-size: .8em; line-height: 1.25; overflow-wrap: anywhere; }
[data-menu-screen="hub"] .hub-battle-metrics dd {
    color: #ead9aa; margin: 4px 0 0; font-size: 1.2em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
[data-menu-screen="hub"] .hub-battle-casters {
    display: grid; grid-template-columns: calc(12 * var(--menu-ui-pixel,4px)) minmax(0,1fr) calc(12 * var(--menu-ui-pixel,4px)); align-items: center; gap: 8px; margin-block: 10px;
}
[data-menu-screen="hub"] .hub-battle-casters > span { text-align: center; color: #ead9aa; overflow-wrap: anywhere; }
[data-menu-screen="hub"] .hub-battle-casters small { display: block; color: #b9aa96; font-size: .75em; }
[data-menu-screen="hub"] .hub-battle-control {
    appearance: none; position: relative; box-sizing: border-box; cursor: pointer;
    color: #ead9aa; background: #21191ddd; border: 2px solid #685036; border-radius: 0;
    font: inherit; min-height: 44px; padding: 6px 10px; text-shadow: 1px 1px #100a07;
}
[data-menu-screen="hub"] .hub-battle-sources { list-style: none; margin: 8px 0 0; padding: 0; }
[data-menu-screen="hub"] .hub-battle-row {
    display: grid; grid-template-columns: 1.1em 48px minmax(0,1fr) auto;
    gap: 10px; align-items: center; min-height: 72px; padding: 10px 12px;
    background: #100d1480; border-bottom: 2px solid #493721; box-sizing: border-box;
}
[data-menu-screen="hub"] .hub-battle-row:nth-child(even) { background: #1b141d80; }
[data-menu-screen="hub"] .hub-battle-rank { font-size: .8em; color: #b39a76; }
[data-menu-screen="hub"] .hub-battle-icons { display: grid; grid-template-columns: repeat(auto-fit,minmax(0,1fr)); align-items: center; }
[data-menu-screen="hub"] .hub-battle-icons img { width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; }
[data-menu-screen="hub"] .hub-battle-source { min-width: 0; }
[data-menu-screen="hub"] .hub-battle-name { color: #ead9aa; overflow-wrap: anywhere; }
[data-menu-screen="hub"] .hub-battle-source small { display: block; color: #b9aa96; font-size: .72em; }
[data-menu-screen="hub"] .hub-battle-track { display: block; height: 4px; margin-top: 6px; background: #362921; }
[data-menu-screen="hub"] .hub-battle-track > span { display: block; height: 100%; background: #b18e50; }
[data-menu-screen="hub"] .hub-battle-value { text-align: right; font-variant-numeric: tabular-nums; }
[data-menu-screen="hub"] .hub-battle-value strong { color: #ead9aa; font-weight: normal; }
[data-menu-screen="hub"] .hub-battle-value small { display: block; color: #b9aa96; font-size: .82em; }
[data-menu-screen="hub"] .hub-battle-expand { margin: 12px auto 0; }
[data-menu-screen="hub"] .hub-battle-hint { margin: 10px 12px 0; color: #b9aa96; font-size: .78em; }
[data-menu-screen="hub"] .hub-battle-empty { padding: 14px 12px; margin: 0; color: #b9aa96; background: #100d1480; }
[data-menu-screen="hub"] [data-battle-focus]:is(:focus-visible,.gamepad-selected) { outline: 2px solid #c4a260; outline-offset: -2px; background-color: #2a2020; }
[data-menu-screen="hub"] .hub-battle-control:hover:where(body:not(.gamepad-active) *) { border-color: #c4a260; background: #302322; }
@media (max-width: 1920px) {
    [data-menu-screen="hub"] .hub-battle-row { grid-template-columns: 1em 40px minmax(0,1fr) auto; min-height: 64px; gap: 8px; }
}
@media (max-width: 1366px) {
    [data-menu-screen="hub"] .hub-battle-row { grid-template-columns: .9em 32px minmax(0,1fr) auto; gap: 6px; padding: 8px; }
    [data-menu-screen="hub"] .hub-battle-metrics { gap: 8px; }
}
@media (max-width: 1280px) {
    [data-menu-screen="hub"] .hub-battle-row { gap: 5px; }
}

/* CharacterHub Overlay */
#characterHubOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000; /* Above main menu (18000) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease-in-out, visibility 1s ease-in-out;
}

.character-hub-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease-in-out, visibility 1s ease-in-out;
}

#characterHubOverlay.active {
    opacity: 1;
    visibility: visible;
}

#characterHubOverlay.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Main Container */
.character-hub-container {
    position: relative;
    display: grid;
    grid-template-columns: 2fr auto 3fr;
    gap: 0.5vw;
    max-width: 90vw;
    width: 95%;
    height: 85vh;
    /* Panel uses ui-kit.css styles via .panel class, but transparent outer area */
    background: transparent;
    /* Padding respects frame dimensions: deco-frame inner border is at inset 20px + 5px buffer */
    padding: 25px;
    animation: slideInUp 0.8s ease-out;
    z-index: 10;
}

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

/* Divider between sections */
.character-hub-container .divider {
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-hub-container .divider-v {
    width: 20px;
}

.character-hub-container .divider-v::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: var(--frame-color, #3a2a28);
}

.character-hub-container .divider-diamond {
    position: relative;
    width: 10px;
    height: 10px;
    background: var(--diamond-color, #5a4a45);
    transform: rotate(45deg);
    border: 1px solid var(--corner-color, #4a3a35);
    z-index: 1;
}

.character-hub-container .divider-diamond::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: var(--frame-inner, #2a1a18);
}

.character-hub-container .divider-h {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--corner-color, #4a3a35) 20%, var(--corner-color, #4a3a35) 80%, transparent 100%);
    margin: 10px 0 -8px 0;
}

/* Character Section (Left) */
.character-section {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 2%;
    align-items: center;
    padding: 2%;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100%;
    scrollbar-width: thin;
    scrollbar-color: #4a3a35 #2a1a18;
}

.character-section::-webkit-scrollbar {
    width: 10px;
}

.character-section::-webkit-scrollbar-track {
    background: rgba(26, 15, 31, 0.5);
    border-radius: 5px;
    border: 1px solid #3a2a28;
}

.character-section::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #5a4a45 0%, #3a2a28 100%);
    border-radius: 5px;
    border: 1px solid #4a3a35;
    box-shadow: inset 0 0 5px rgba(90, 74, 69, 0.3);
}

.character-section::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #6a5a55 0%, #4a3a35 100%);
    box-shadow: 0 0 8px rgba(90, 74, 69, 0.6);
}

/* Character and Hero Tabs Header */
/* Character Hero Header - UI Kit Panel */
.character-hero-header {
    position: relative;
    width: 95%;
}

.character-hero-header.panel {
    background: transparent;
}

.hero-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5%;
    width: 100%;
    height: auto; /* override UI Kit height: 100% */
    justify-content: center;
    padding: 18px; /* frame-compact padding */
    box-sizing: border-box;
}

.character-profile-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(14px, 1vw, 22px);
    width: 100%;
    padding: 4px 6px 2px;
    box-sizing: border-box;
}

.character-passive-summary {
    position: relative;
    min-width: 0;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-self: stretch;
    padding: 11px 13px 11px 18px;
    box-sizing: border-box;
    overflow: hidden;
    text-align: left;
    white-space: normal;
    background:
        linear-gradient(90deg, rgba(114, 84, 52, 0.16), transparent 72%),
        rgba(8, 5, 5, 0.42);
    border-left: 1px solid rgba(190, 151, 91, 0.5);
    border-top: 1px solid rgba(122, 91, 60, 0.18);
    border-bottom: 1px solid rgba(65, 43, 35, 0.58);
}

.character-passive-summary::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    width: 7px;
    height: 7px;
    background: #b5965d;
    border: 1px solid #4a3427;
    transform: translateY(-50%) rotate(45deg);
    box-shadow: 0 0 7px rgba(196, 157, 94, 0.28);
}

.character-passive-kicker {
    margin-bottom: 4px;
    color: #8f785d;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(9px, 0.62vw, 11px);
    line-height: 1.1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.character-passive-name {
    color: #d3b46f;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(12px, 0.9vw, 16px);
    font-weight: bold;
    line-height: 1.15;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.character-passive-description {
    margin-top: 6px;
    color: #b9aa96;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(9px, 0.68vw, 12px);
    line-height: 1.38;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.85);
}

/* Divider between portrait and hero tabs */
.character-hub-container .hero-divider.divider-h {
    width: 80%;
    height: 2px;
    flex-shrink: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--kit-frame-color, #3a2a28) 20%,
        var(--kit-frame-color, #3a2a28) 80%,
        transparent 100%
    );
    margin: 15px 0 20px 0;
}

/* Main Character Portrait - UI Kit Panel */
.character-sprite-container {
    width: 8vw;
    height: 8vw;
    min-width: 80px;
    min-height: 80px;
    max-width: 120px;
    max-height: 120px;
    margin-top: 15px;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.character-profile-summary .character-sprite-container {
    margin-top: 0;
}

.character-sprite-container.panel {
    background: transparent;
}

.character-sprite-container.panel > .panel-content.character-sprite-icon {
    width: 100%;
    height: 100%;
    padding: 8px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

.character-sprite-container:hover:where(body:not(.gamepad-active) *) {
    transform: scale(1.05);
}

/* Hero Tabs Navigation Wrapper */
.hero-tabs-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1vw;
    width: 100%;
}

.tab-nav-prompt {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(12px, 1vw, 16px);
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(138, 43, 226, 0.3);
    border: 1px solid #4a3a35;
    color: var(--text-white-soft);
    white-space: nowrap;
}

/* 1080p - zmniejszone prompty nawigacji */
@media (max-width: 1920px) {
    .tab-nav-prompt {
        font-size: clamp(12px, 0.8vw, 14px);
        padding: 4px 8px;
    }

    .hero-tabs-navigation {
        gap: 0.6vw;
    }
}

/* Hero Tabs */
.character-hero-tabs {
    display: flex;
    flex-direction: row;
    gap: 0.8vw;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

/* Hero Tab - UI Kit Panel */
.character-hero-tab {
    width: 4vw;
    height: 4vw;
    min-width: 50px;
    min-height: 50px;
    max-width: 60px;
    max-height: 60px;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.15s ease;
    position: relative;
    overflow: visible;
}

.character-hero-tab.panel {
    background: transparent;
}

.character-hero-tab.panel > .panel-content.hero-tab-icon {
    width: 100%;
    height: 100%;
    padding: 0;
    box-sizing: border-box;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-origin: content-box;
    image-rendering: pixelated;
    z-index: 1;
}

/* Local co-op labels stay inside their own slot, clear of the adjacent remove button. */
.character-hero-tab-player-label {
    position: absolute;
    top: 2px;
    left: 2px;
    color: white;
    font-size: 12px;
    font-weight: bold;
    line-height: 16px;
    padding: 1px 4px;
    border-radius: 5px;
    border: 1px solid rgba(0,0,0,.5);
    z-index: 10;
    pointer-events: none;
}

/* Remove button for hero tabs */
.character-hero-tab-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(220, 20, 60, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--text-white);
    font-size: 16px;
    font-weight: bold;
    cursor: var(--cm-cursor-action, pointer);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    line-height: 1;
}

.character-hero-tab:hover:where(body:not(.gamepad-active) *) .character-hero-tab-remove,
.character-hero-tab.gamepad-selected .character-hero-tab-remove,
.character-hero-tab.selected:not(.player-tab) .character-hero-tab-remove {
    display: flex;
}

.character-hero-tab-remove:hover:where(body:not(.gamepad-active) *) {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.4);
}

/* Active card - larger size, default colors */
.character-hero-tab.selected {
    transform: scale(1.15);
}

/* Hover state */
.character-hero-tab:hover:where(body:not(.gamepad-active) *) {
    transform: scale(1.08);
}

/* Active + hover */
.character-hero-tab.selected:hover:where(body:not(.gamepad-active) *) {
    transform: scale(1.18);
}

.character-hero-tab-sprite {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.character-hero-tab-placeholder {
    font-size: 20px;
    color: var(--text-brown-accent-alpha);
    text-shadow: 0 0 8px rgba(138, 43, 226, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Tooltip for hero names */
.character-hero-tab-tooltip {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: var(--text-white);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    border: 2px solid rgba(138, 43, 226, 0.8);
    font-family: 'SFPixelate', 'Courier New', monospace;
    text-shadow: 0 0 6px rgba(221, 160, 221, 0.6);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.character-hero-tab:hover:where(body:not(.gamepad-active) *) .character-hero-tab-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Status badge */
.character-hero-tab-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    z-index: 10;
    font-family: 'SFPixelate', 'Courier New', monospace;
}

.character-hero-tab-badge.active {
    background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%);
    color: var(--text-black);
}

.character-hero-tab-badge.ready {
    background: linear-gradient(135deg, #ffaa00 0%, #ff8800 100%);
    color: var(--text-black);
}

.character-hero-tab-badge.inactive {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    color: var(--text-gray-light);
}

/* Empty hero tab placeholder */
.character-hero-tab.empty {
    opacity: 0.5;
}

.character-hero-tab.empty:hover:where(body:not(.gamepad-active) *) {
    opacity: 0.7;
    transform: scale(1.05);
}

.character-sprite-canvas {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.character-sprite-placeholder {
    font-size: 64px;
    color: var(--text-brown-accent-alpha);
    text-shadow: 0 0 20px rgba(138, 43, 226, 0.5);
}

/* Character Build Bar */
.character-build-bar {
    width: 95%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1.5%;
    box-shadow: none;
    margin-bottom: 1.5%;
}

/* Neutral section header - no diamonds */
.section-header-neutral {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-bottom: -12px;
    position: relative;
    z-index: 2;
}

.neutral-line {
    flex: 1;
    height: 1px;
    background: rgba(138, 122, 117, 0.4);
}

.section-footer-neutral {
    text-align: center;
    color: var(--text-brown-placeholder);
    font-size: 14px;
    padding: 10px 0;
    opacity: 0.6;
}

.build-bar-title {
    font-family: 'SFPixelate', 'Courier New', monospace;
    color: var(--text-brown-placeholder);
    font-size: 15px;
    font-weight: normal;
    text-align: center;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Panel tła dla slotów */
.build-bar-panel {
    background: rgba(0, 0, 0, 0.3);
    padding: 18px 10px 5px 10px;
}

.build-bar-panel::after,
.artifact-bar-panel::after,
.stats-panel::after {
    content: '';
    display: block;
    height: 2px;
    width: 100%;
    margin: 8px auto -6px auto;
    background: linear-gradient(90deg, transparent 0%, rgba(138, 122, 117, 0.15) 30%, rgba(138, 122, 117, 0.15) 70%, transparent 100%);
}

/* Build chapters */
.build-chapter {
    margin-bottom: 12px;
}

.build-chapter:last-child {
    margin-bottom: 0;
}

.build-chapter-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 6px 0;
    margin-bottom: 8px;
    color: var(--text-brown-placeholder-strong);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 14px;
    letter-spacing: 2px;
}

.build-chapter-header::before,
.build-chapter-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, currentColor 50%, transparent 100%);
    opacity: 0.4;
}

.build-bar-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    max-width: 100%;
    justify-content: flex-start;
}

.build-bar-slot {
    width: 3.15vw;
    height: 3.15vw;
    min-width: 45px;
    min-height: 45px;
    max-width: 54px;
    max-height: 54px;
    background: linear-gradient(135deg, #2a1810 0%, #1a0f0a 100%);
    border: 2px dashed rgba(138, 43, 226, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    cursor: var(--cm-cursor-action, pointer);
    box-sizing: border-box;
}

.build-bar-slot.empty {
    border-style: dashed;
    opacity: 0.6;
}

.build-bar-slot.filled {
    border-style: solid;
    border-color: var(--text-brown-accent-alpha);
    /* Tło tintowane kolorem przewodnim skilla (--spell-color ustawiane inline w JS) */
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--spell-color, #8a2be2) 24%, transparent) 0%,
        color-mix(in srgb, var(--spell-color, #4b0082) 12%, transparent) 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

/* Hover-glow zajętego slotu w kolorze przewodnim skilla (spójnie z Grimuarem) */
.build-bar-slot.filled.panel:hover:where(body:not(.gamepad-active) *) {
    box-shadow: 0 0 14px 1px var(--spell-color, #8a7a6a);
}

.build-bar-slot.locked {
    border-style: solid;
    border-color: var(--text-brown-dark);
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    opacity: 0.4;
    cursor: var(--cm-cursor-disabled, not-allowed);
}

.build-bar-slot.locked:hover:where(body:not(.gamepad-active) *),
.build-bar-slot.locked:focus-visible {
    border-color: var(--text-brown-medium-dark);
    opacity: 0.75;
    outline: none;
}

/* Old hover styles - only for non-panel slots (legacy) */
.build-bar-slot.empty:not(.panel):hover:where(body:not(.gamepad-active) *) {
    transform: scale(1.05);
    border-color: rgba(138, 43, 226, 0.9);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

.build-bar-slot.filled:not(.panel):hover:where(body:not(.gamepad-active) *) {
    transform: scale(1.05);
    border-color: rgba(255, 100, 100, 0.9);
    box-shadow: 0 0 15px rgba(255, 100, 100, 0.5);
    background: linear-gradient(135deg, rgba(255, 100, 100, 0.3) 0%, rgba(150, 50, 50, 0.3) 100%);
}

.build-bar-slot-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.build-bar-slot-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Build bar slot - UI Kit Panel styling */
.build-bar-slot.panel {
    background: transparent;
    border: none;
    border-radius: 0;
}

/* Filled slots - przytłumiona tekstura żeby ikona była widoczna */

.build-bar-slot.panel > .panel-content.build-bar-slot-icon {
    width: 100%;
    height: 100%;
    padding: 4px;
    box-sizing: border-box;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-origin: content-box;
    border: none;
    box-shadow: none;
    border-radius: 0;
    z-index: 1;
}

/* Build bar slot category colors */
.build-bar-slot.panel.category-necromancy {
    --kit-frame-color: rgba(138, 43, 226, 0.6);
    --kit-frame-inner: rgba(88, 23, 156, 0.8);
    --kit-corner-color: rgba(158, 63, 246, 0.7);
    --kit-diamond-color: #8a2be2;
}

.build-bar-slot.panel.category-curses {
    --kit-frame-color: rgba(128, 0, 128, 0.6);
    --kit-frame-inner: rgba(78, 0, 78, 0.8);
    --kit-corner-color: rgba(148, 20, 148, 0.7);
    --kit-diamond-color: #800080;
}

.build-bar-slot.panel.category-soul_magic {
    --kit-frame-color: rgba(65, 105, 225, 0.6);
    --kit-frame-inner: rgba(35, 69, 161, 0.8);
    --kit-corner-color: rgba(85, 125, 245, 0.7);
    --kit-diamond-color: #4169e1;
}

.build-bar-slot.panel.category-summoning {
    --kit-frame-color: rgba(220, 20, 60, 0.6);
    --kit-frame-inner: rgba(156, 10, 40, 0.8);
    --kit-corner-color: rgba(240, 40, 80, 0.7);
    --kit-diamond-color: #dc143c;
}

.build-bar-slot.panel.category-blood_magic {
    --kit-frame-color: rgba(139, 0, 0, 0.6);
    --kit-frame-inner: rgba(89, 0, 0, 0.8);
    --kit-corner-color: rgba(159, 20, 20, 0.7);
    --kit-diamond-color: #8b0000;
}

.build-bar-slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-brown-dark);
    opacity: 0.4;
    transition: all 0.3s ease;
}

.build-bar-slot.empty:hover:where(body:not(.gamepad-active) *) .build-bar-slot-placeholder {
    opacity: 0.7;
    color: var(--text-brown-medium-dark);
}

.build-bar-placeholder-icon {
    font-size: 16px;
    margin-bottom: 2px;
}

.build-bar-placeholder-text {
    font-size: 12px;
    text-align: center;
    line-height: 1.1;
    font-style: italic;
}

.build-bar-slot-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-brown-medium-dark);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.build-bar-lock-icon {
    font-size: 28px;
    color: var(--text-brown-dark);
    font-weight: bold;
}

/* Scroll synergy tile - tylko kolor ramki przez UI toolkit */
.build-bar-slot.panel.scroll-synergy-tile {
    --kit-frame-color: rgba(255, 215, 0, 0.6);
    --kit-frame-inner: rgba(218, 165, 32, 0.8);
    --kit-corner-color: rgba(255, 225, 50, 0.7);
    --kit-diamond-color: var(--text-gold);
}

.scroll-synergy-overlay {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 12px;
    z-index: 10;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

/* Artifact Bar */
.artifact-bar {
    width: 95%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1.5%;
    box-shadow: none;
    margin-bottom: 1.5%;
}

.artifact-bar-title,
.section-title-neutral,
.stats-title-neutral {
    font-family: 'SFPixelate', 'Courier New', monospace;
    color: var(--text-brown-placeholder);
    font-size: 13px;
    font-weight: normal;
    text-align: center;
    letter-spacing: 1px;
    white-space: nowrap;
}

.artifact-bar-panel,
.stats-panel {
    background: rgba(0, 0, 0, 0.3);
    padding: 18px 10px 5px 10px;
}

.artifact-bar-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    max-width: 100%;
    justify-content: flex-start;
}

.artifact-bar-slot {
    width: 3.15vw;
    height: 3.15vw;
    min-width: 45px;
    min-height: 45px;
    max-width: 54px;
    max-height: 54px;
    background: linear-gradient(135deg, #2a1810 0%, #1a0f0a 100%);
    border: 2px dashed rgba(255, 215, 0, 0.5);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    cursor: var(--cm-cursor-action, pointer);
    box-sizing: border-box;
    padding: 2px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.artifact-bar-slot.empty {
    border-style: dashed;
    opacity: 0.6;
}

.artifact-bar-slot.filled {
    border-style: solid;
    border-color: rgba(255, 215, 0, 0.8);
    /* Background image will be set inline */
}

/* Rarity-specific styling for artifact slots - just borders */
.artifact-bar-slot.rarity-common {
    border-color: rgba(204, 204, 204, 0.8);
}

.artifact-bar-slot.rarity-uncommon {
    border-color: rgba(30, 255, 0, 0.8);
}

.artifact-bar-slot.rarity-rare {
    border-color: rgba(0, 153, 255, 0.8);
}

.artifact-bar-slot.rarity-epic {
    border-color: rgba(204, 0, 255, 0.8);
}

.artifact-bar-slot.rarity-legendary {
    border-color: rgba(255, 102, 0, 0.8);
}

.artifact-bar-slot.rarity-ancient {
    border-color: rgba(255, 0, 102, 0.8);
}

.artifact-bar-slot.rarity-eternal {
    border-color: rgba(255, 215, 0, 0.8);
}

/* Old hover styles - only for non-panel slots (legacy) */
.artifact-bar-slot.empty:not(.panel):hover:where(body:not(.gamepad-active) *) {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.artifact-bar-slot.filled:not(.panel):hover:where(body:not(.gamepad-active) *) {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 100, 100, 0.5);
    border-color: rgba(255, 100, 100, 0.7);
}

.artifact-bar-slot.rarity-common:not(.panel):hover:where(body:not(.gamepad-active) *) { box-shadow: 0 0 10px rgba(204, 204, 204, 0.3); }
.artifact-bar-slot.rarity-uncommon:not(.panel):hover:where(body:not(.gamepad-active) *) { box-shadow: 0 0 10px rgba(30, 255, 0, 0.3); }
.artifact-bar-slot.rarity-rare:not(.panel):hover:where(body:not(.gamepad-active) *) { box-shadow: 0 0 10px rgba(0, 153, 255, 0.3); }
.artifact-bar-slot.rarity-epic:not(.panel):hover:where(body:not(.gamepad-active) *) { box-shadow: 0 0 10px rgba(204, 0, 255, 0.3); }
.artifact-bar-slot.rarity-legendary:not(.panel):hover:where(body:not(.gamepad-active) *) { box-shadow: 0 0 10px rgba(255, 102, 0, 0.3); }
.artifact-bar-slot.rarity-ancient:not(.panel):hover:where(body:not(.gamepad-active) *) { box-shadow: 0 0 10px rgba(255, 0, 102, 0.3); }
.artifact-bar-slot.rarity-eternal:not(.panel):hover:where(body:not(.gamepad-active) *) { box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }

/* Artifact bar slot - UI Kit Panel styling */
.artifact-bar-slot.panel {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

/* Filled slots - przytłumiona tekstura żeby ikona była widoczna */
.artifact-bar-slot.panel.filled > .panel-texture {
    opacity: 0.2;
}

.artifact-bar-slot.panel > .panel-content.artifact-bar-icon {
    width: 100%;
    height: 100%;
    padding: 4px;
    box-sizing: border-box;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-origin: content-box;
    z-index: 1;
}

/* Artifact bar slot rarity colors for UI Kit */
.artifact-bar-slot.panel.rarity-common {
    --kit-frame-color: rgba(204, 204, 204, 0.6);
    --kit-frame-inner: rgba(154, 154, 154, 0.8);
    --kit-corner-color: rgba(220, 220, 220, 0.7);
    --kit-diamond-color: #cccccc;
}

.artifact-bar-slot.panel.rarity-uncommon {
    --kit-frame-color: rgba(30, 255, 0, 0.6);
    --kit-frame-inner: rgba(10, 175, 0, 0.8);
    --kit-corner-color: rgba(50, 255, 30, 0.7);
    --kit-diamond-color: #1eff00;
}

.artifact-bar-slot.panel.rarity-rare {
    --kit-frame-color: rgba(0, 153, 255, 0.6);
    --kit-frame-inner: rgba(0, 103, 175, 0.8);
    --kit-corner-color: rgba(30, 170, 255, 0.7);
    --kit-diamond-color: #0099ff;
}

.artifact-bar-slot.panel.rarity-epic {
    --kit-frame-color: rgba(204, 0, 255, 0.6);
    --kit-frame-inner: rgba(154, 0, 205, 0.8);
    --kit-corner-color: rgba(220, 30, 255, 0.7);
    --kit-diamond-color: #cc00ff;
}

.artifact-bar-slot.panel.rarity-legendary {
    --kit-frame-color: rgba(255, 102, 0, 0.6);
    --kit-frame-inner: rgba(205, 72, 0, 0.8);
    --kit-corner-color: rgba(255, 120, 30, 0.7);
    --kit-diamond-color: #ff6600;
}

.artifact-bar-slot.panel.rarity-ancient {
    --kit-frame-color: rgba(255, 0, 102, 0.6);
    --kit-frame-inner: rgba(205, 0, 72, 0.8);
    --kit-corner-color: rgba(255, 30, 120, 0.7);
    --kit-diamond-color: #ff0066;
}

.artifact-bar-slot.panel.rarity-eternal {
    --kit-frame-color: rgba(255, 215, 0, 0.6);
    --kit-frame-inner: rgba(205, 165, 0, 0.8);
    --kit-corner-color: rgba(255, 225, 30, 0.7);
    --kit-diamond-color: var(--text-gold);
}

.artifact-bar-slot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-brown-medium-dark);
    opacity: 0.4;
    transition: all 0.3s ease;
}

.artifact-bar-slot.empty:hover:where(body:not(.gamepad-active) *) .artifact-bar-slot-placeholder {
    opacity: 0.7;
    color: var(--text-gray-light);
}

.artifact-bar-placeholder-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.artifact-bar-placeholder-text {
    font-size: 12px;
    text-align: center;
    line-height: 1.1;
    font-style: italic;
}

/* Artifact tooltip removed - using general tooltip system */

/* Gamepad Focus Styles */
.gamepad-focused {
    outline: 3px solid #ffd700 !important;
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6) !important;
    animation: gamepadPulse 1s infinite;
    z-index: 100;
}

@keyframes gamepadPulse {
    0%, 100% {
        transform: scale(1);
        outline-color: var(--text-gold);
    }
    50% {
        transform: scale(1.05);
        outline-color: #ffed4e;
    }
}

.build-bar-slot.gamepad-focused,
.artifact-bar-slot.gamepad-focused {
    transform: scale(1.1);
    z-index: 10;
}

.spell-item.gamepad-focused,
.artifact-item.gamepad-focused {
    transform: scale(1.15);
    z-index: 10;
}

.character-hero-tab.gamepad-focused {
    --kit-frame-color: rgba(255, 215, 0, 0.9);
    --kit-frame-inner: rgba(180, 150, 0, 0.8);
    --kit-corner-color: rgba(255, 225, 50, 1);
    --kit-diamond-color: var(--text-gold);
}

.character-hub-option.gamepad-focused {
    border-color: var(--text-gold) !important;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(138, 43, 226, 0.4) 100%) !important;
}

/* Gamepad mode indicators */
.navigation-mode-build {
    border-color: rgba(138, 43, 226, 1) !important;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.8) !important;
}

.navigation-mode-selection {
    border-color: rgba(0, 150, 255, 1) !important;
    box-shadow: 0 0 15px rgba(0, 150, 255, 0.8) !important;
}

/* Character Stats */
.character-stats-container {
    flex: 0 0 auto;
    width: 95%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1.5%;
    box-shadow: none;
}

.character-stats-header h3 {
    font-family: 'SFPixelate', 'Courier New', monospace;
    color: var(--text-brown-base);
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 0 8px rgba(138, 122, 117, 0.4);
    letter-spacing: 1px;
}

.character-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(138, 122, 117, 0.3);
    transition: all 0.2s ease;
    font-family: 'SFPixelate', 'Courier New', monospace;
}

.stat-item:hover:where(body:not(.gamepad-active) *) {
    border-color: var(--text-brown-placeholder);
    background: rgba(0, 0, 0, 0.3);
}

.stat-item.improved {
    border-color: rgba(120, 160, 120, 0.5);
}

.stat-item.improved:hover:where(body:not(.gamepad-active) *) {
    border-color: rgba(120, 160, 120, 0.7);
}

.stat-label {
    flex: 1;
    color: var(--text-brown-base);
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 0 4px rgba(201, 169, 110, 0.3);
}

.stat-value {
    color: var(--text-brown-base);
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(221, 160, 221, 0.4);
}

.stat-item.improved .stat-value {
    color: var(--text-green-soft);
}

/* Navigation Section (Right) */
.navigation-section {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1.5vw;
    padding: 1.5vw;
    overflow: hidden;
    max-height: 100%;
}

.navigation-section::-webkit-scrollbar {
    width: 10px;
}

.navigation-section::-webkit-scrollbar-track {
    background: rgba(26, 15, 31, 0.5);
    border-radius: 5px;
    border: 1px solid #3a2a28;
}

.navigation-section::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #5a4a45 0%, #3a2a28 100%);
    border-radius: 5px;
    border: 1px solid #4a3a35;
    box-shadow: inset 0 0 5px rgba(90, 74, 69, 0.3);
}

.navigation-section::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #6a5a55 0%, #4a3a35 100%);
    box-shadow: 0 0 8px rgba(90, 74, 69, 0.6);
}

.character-hub-title {
    font-family: 'SFPixelate', 'Courier New', monospace;
    color: var(--text-brown-base);
    font-size: clamp(14px, 2vw, 32px);
    font-weight: bold;
    text-align: center;
    margin-top: 15px;
    margin-bottom: 5px;
    text-shadow: 0 0 15px rgba(221, 160, 221, 0.6);
    letter-spacing: 3px;
    white-space: nowrap;
}

.character-hub-options {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    justify-content: center;
    margin-top: 20px;
}

/* Character Hub Option Buttons - UI Kit Panel Style */
.character-hub-option {
    flex: 1;
    max-width: 200px;
    height: 50px;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.15s ease;
}

.character-hub-option.panel {
    background: transparent;
}

.character-hub-option.btn.panel > .panel-content {
    font-family: 'SFPixelate', 'Courier New', monospace !important;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--kit-text-color, #8a7a75);
}

/* Selected state - keyboard/gamepad */
.character-hub-option.selected,
.character-hub-option.gamepad-focused {
    --kit-frame-color: #6a5040;
    --kit-frame-inner: #4a3530;
    --kit-corner-color: #8a6a55;
    --kit-diamond-color: #aa8a70;
}

.character-hub-option.gamepad-focused > .panel-texture {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80px 120px at 30% 25%, rgba(40, 25, 20, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 100px 80px at 70% 45%, rgba(35, 20, 18, 0.12) 0%, transparent 70%),
        linear-gradient(180deg,
            #18100c 0%,
            #201510 12%,
            #2a1a14 30%,
            #302018 45%,
            #281814 58%,
            #201210 70%,
            #140c08 100%
        );
    background-blend-mode: soft-light, normal, normal, normal;
}

.character-hub-option.selected > .panel-content,
.character-hub-option.gamepad-focused > .panel-content {
    color: var(--text-brown-accent);
}

.character-hub-option.gamepad-focused > .deco-frame::before {
    box-shadow:
        0 0 10px rgba(120, 90, 60, 0.2),
        inset 0 0 0 4px transparent,
        inset 0 0 0 6px var(--kit-frame-inner, #4a3530);
}

/* Wrapper dla przycisku Upgrades z badge */
.upgrade-button-wrapper {
    position: relative;
    flex: 1;
    max-width: 200px;
    display: flex;
}

.upgrade-button-wrapper .character-hub-option {
    width: 100%;
    max-width: none;
    flex: 1;
}

/* Availability is a quiet label; the pixel frame keeps its normal shape. */
.upgrades-available-badge {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 100%;
    box-sizing: border-box;
    padding: 3px 8px;
    font: clamp(14px, 1.1vw, 22px)/1.25 'SFPixelate', 'Courier New', monospace;
    color: #dfc28a;
    background: #17121e;
    text-shadow: none;
    text-align: center;
    white-space: normal;
    pointer-events: none;
    z-index: 10;
}

.upgrade-button-wrapper.has-upgrades .character-hub-option {
    color: #dfc28a;
}
.upgrade-button-wrapper.has-upgrades .character-hub-option > .panel-content {
    color: inherit;
}
.upgrade-button-wrapper.has-upgrades .character-hub-option:is(:hover:where(body:not(.gamepad-active) *),.selected,.gamepad-focused) {
    color: #ffe4b0;
}

/* Add Hero Wrapper for New Hero Badge */
.add-hero-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 15px;
}

.new-hero-available-badge {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: bold;
    color: var(--text-green-light);
    text-shadow: 0 0 10px #90EE90, 0 0 20px #32CD32;
    white-space: nowrap;
    animation: pulse-badge 1.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
}

/* Glow on add hero button when new hero available */
.add-hero-wrapper.has-new-hero .add-hero-btn.panel {
    --kit-frame-color: rgba(50, 205, 50, 0.6);
    --kit-frame-inner: rgba(34, 139, 34, 0.8);
    --kit-corner-color: rgba(80, 255, 80, 0.7);
    --kit-diamond-color: var(--text-green-light);
    animation: glow-button-green 1.5s ease-in-out infinite;
    box-shadow:
        0 0 15px rgba(50, 205, 50, 0.6),
        0 0 30px rgba(34, 139, 34, 0.4),
        0 0 45px rgba(50, 205, 50, 0.2);
}

.add-hero-wrapper.has-new-hero .add-hero-btn.panel > .panel-content {
    color: var(--text-green-light);
}

/* Override green glow when button is disabled (roster full) */
.add-hero-wrapper.has-new-hero .add-hero-btn.panel.disabled,
.add-hero-wrapper.has-new-hero .add-hero-btn.panel:disabled {
    animation: none !important;
    box-shadow: none !important;
    opacity: 0.4;
    pointer-events: none;
}

@keyframes glow-button-green {
    0%, 100% {
        box-shadow:
            0 0 15px rgba(50, 205, 50, 0.6),
            0 0 30px rgba(34, 139, 34, 0.4),
            0 0 45px rgba(50, 205, 50, 0.2);
    }
    50% {
        box-shadow:
            0 0 25px rgba(50, 205, 50, 0.9),
            0 0 50px rgba(34, 139, 34, 0.6),
            0 0 75px rgba(50, 205, 50, 0.4);
    }
}

/* Back Button - UI Kit X button */
.character-hub-back {
    position: absolute;
    top: calc(7.5vh - 27px);
    left: calc(5vw - 27px);
    z-index: 15;
    cursor: var(--cm-cursor-action, pointer);
}

.character-hub-back.btn.panel {
    width: 36px;
    height: 36px;
    background: transparent;
}

.character-hub-back.panel > .panel-content {
    font-size: 14px;
    line-height: 1;
    color: var(--kit-text-color, #8a7a75);
}

/* Selected state - keyboard/gamepad */
.character-hub-back.selected,
.character-hub-back.gamepad-focused {
    --kit-frame-color: #6a5040;
    --kit-frame-inner: #4a3530;
    --kit-corner-color: #8a6a55;
    --kit-diamond-color: #aa8a70;
}

.character-hub-back.selected > .panel-texture,
.character-hub-back.gamepad-focused > .panel-texture {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80px 120px at 30% 25%, rgba(40, 25, 20, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 100px 80px at 70% 45%, rgba(35, 20, 18, 0.12) 0%, transparent 70%),
        linear-gradient(180deg,
            #18100c 0%,
            #201510 12%,
            #2a1a14 30%,
            #302018 45%,
            #281814 58%,
            #201210 70%,
            #140c08 100%
        );
    background-blend-mode: soft-light, normal, normal, normal;
}

.character-hub-back.selected > .panel-content,
.character-hub-back.gamepad-focused > .panel-content {
    color: var(--text-brown-accent);
}

.character-hub-back.selected > .deco-frame::before,
.character-hub-back.gamepad-focused > .deco-frame::before {
    box-shadow:
        0 0 10px rgba(120, 90, 60, 0.2),
        inset 0 0 0 4px transparent,
        inset 0 0 0 6px var(--kit-frame-inner, #4a3530);
}

/* Help/Tutorial Button - ? icon */
.character-hub-help {
    position: absolute;
    top: calc(7.5vh - 27px);
    left: calc(5vw - 27px + 46px);
    z-index: 15;
    cursor: var(--cm-cursor-action, pointer);
}

.character-hub-help.btn.panel {
    width: 36px;
    height: 36px;
    background: transparent;
}

.character-hub-help.panel > .panel-content {
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    color: var(--kit-text-color, #8a7a75);
    font-family: 'SFPixelate', 'Courier New', monospace;
}

.character-hub-help:hover:where(body:not(.gamepad-active) *) > .panel-content {
    color: var(--text-brown-accent, #c0a080);
}

.character-hub-help.selected,
.character-hub-help.gamepad-focused {
    --kit-frame-color: #6a5040;
    --kit-frame-inner: #4a3530;
    --kit-corner-color: #8a6a55;
    --kit-diamond-color: #aa8a70;
}

.character-hub-help.selected > .panel-texture,
.character-hub-help.gamepad-focused > .panel-texture {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80px 120px at 30% 25%, rgba(40, 25, 20, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 100px 80px at 70% 45%, rgba(35, 20, 18, 0.12) 0%, transparent 70%),
        linear-gradient(180deg,
            #18100c 0%,
            #201510 12%,
            #2a1a14 30%,
            #302018 45%,
            #281814 58%,
            #201210 70%,
            #140c08 100%
        );
    background-blend-mode: soft-light, normal, normal, normal;
}

.character-hub-help.selected > .panel-content,
.character-hub-help.gamepad-focused > .panel-content {
    color: var(--text-brown-accent);
}

.character-hub-help.selected > .deco-frame::before,
.character-hub-help.gamepad-focused > .deco-frame::before {
    box-shadow:
        0 0 10px rgba(120, 90, 60, 0.2),
        inset 0 0 0 4px transparent,
        inset 0 0 0 6px var(--kit-frame-inner, #4a3530);
}

/* Input hints */
/* Build Management Section */
.character-hub-build-section {
    display: flex;
    flex-direction: column;
    gap: 1%;
    padding: 0 1.5% 1.5% 1.5%;
    background: transparent;
    border: none;
    border-radius: 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #4a3a35 #2a1a18;
}

.character-hub-build-section::-webkit-scrollbar {
    width: 10px;
}

.character-hub-build-section::-webkit-scrollbar-track {
    background: rgba(26, 15, 31, 0.5);
    border-radius: 5px;
    border: 1px solid #3a2a28;
}

.character-hub-build-section::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #5a4a45 0%, #3a2a28 100%);
    border-radius: 5px;
    border: 1px solid #4a3a35;
    box-shadow: inset 0 0 5px rgba(90, 74, 69, 0.3);
}

.character-hub-build-section::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #6a5a55 0%, #4a3a35 100%);
    box-shadow: 0 0 8px rgba(90, 74, 69, 0.6);
}

.build-section-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 0;
}

.build-section-footer {
    text-align: center;
    color: var(--kit-text-color, #8a7a75);
    font-size: 12px;
    padding: 15px 0;
    opacity: 0.6;
}

/* Build actions share the existing pixel button artwork. */
.build-section-header { gap: 8px; flex-wrap: wrap; }
#characterHubOverlay .build-section-header > .build-code-btn {
    --control-type: 4.5;
}
#characterHubOverlay .build-section-header > .build-code-btn > .panel-content {
    width: 100%; height: auto;
}

.build-section-header h3 {
    color: var(--text-brown-base);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 18px;
    margin: 0;
}

.add-hero-btn.panel,
.hero-remove-btn.panel {
    width: 180px;
    height: 32px;
    border: none;
}

.add-hero-btn.panel > .panel-content,
.hero-remove-btn.panel > .panel-content {
    display: flex;
    justify-content: center;
    align-items: center;
}

.add-hero-btn.panel > .panel-content,
.hero-remove-btn.panel > .panel-content {
    font-family: 'SFPixelate', 'Courier New', monospace;
    white-space: nowrap;
    letter-spacing: 1px;
}

.add-hero-btn.panel.gamepad-selected,
.hero-remove-btn.panel.gamepad-selected {
    --kit-frame-color: #6a5040;
    --kit-frame-inner: #4a3530;
    --kit-corner-color: #8a6a55;
    --kit-diamond-color: #aa8a70;
}

.add-hero-btn.panel.gamepad-selected > .panel-texture,
.hero-remove-btn.panel.gamepad-selected > .panel-texture {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80px 120px at 30% 25%, rgba(40, 25, 20, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 100px 80px at 70% 45%, rgba(35, 20, 18, 0.12) 0%, transparent 70%),
        linear-gradient(180deg,
            #18100c 0%,
            #201510 12%,
            #2a1a14 30%,
            #302018 45%,
            #281814 58%,
            #1e120e 70%,
            #140c08 100%
        );
}

.add-hero-btn.panel.gamepad-selected > .panel-texture::before,
.hero-remove-btn.panel.gamepad-selected > .panel-texture::before {
    background: radial-gradient(ellipse 80% 70% at 50% 40%,
        rgba(120, 90, 60, 0.1) 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.15) 100%
    );
}

.add-hero-btn.panel.gamepad-selected > .panel-content,
.hero-remove-btn.panel.gamepad-selected > .panel-content {
    color: var(--text-brown-accent);
}

.add-hero-btn.panel.gamepad-selected > .deco-frame::before,
.hero-remove-btn.panel.gamepad-selected > .deco-frame::before {
    box-shadow:
        0 0 10px rgba(120, 90, 60, 0.2),
        inset 0 0 0 4px transparent,
        inset 0 0 0 6px var(--kit-frame-inner, #4a3530);
}

/* Pressed/Active state for keyboard/gamepad */
.add-hero-btn.panel:active,
.add-hero-btn.panel.btn-pressed,
.hero-remove-btn.panel:active,
.hero-remove-btn.panel.btn-pressed {
    --kit-frame-color: #2a1a18;
    --kit-frame-inner: #1a0a08;
    --kit-corner-color: #3a2a25;
    --kit-diamond-color: #4a3a35;
    transform: translateY(1px);
}

.add-hero-btn.panel:active > .panel-texture,
.add-hero-btn.panel.btn-pressed > .panel-texture,
.hero-remove-btn.panel:active > .panel-texture,
.hero-remove-btn.panel.btn-pressed > .panel-texture {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80px 120px at 30% 25%, rgba(10, 5, 8, 0.15) 0%, transparent 70%),
        linear-gradient(180deg,
            #080406 0%,
            #0a0508 12%,
            #0e070b 30%,
            #10080d 45%,
            #0c060a 58%,
            #0a0508 70%,
            #060304 100%
        );
}

.add-hero-btn.panel:active > .panel-content,
.add-hero-btn.panel.btn-pressed > .panel-content,
.hero-remove-btn.panel:active > .panel-content,
.hero-remove-btn.panel.btn-pressed > .panel-content {
    color: var(--text-brown-medium-dark);
}

.add-hero-btn.panel:active > .deco-frame::before,
.add-hero-btn.panel.btn-pressed > .deco-frame::before,
.hero-remove-btn.panel:active > .deco-frame::before,
.hero-remove-btn.panel.btn-pressed > .deco-frame::before {
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 0 0 4px transparent,
        inset 0 0 0 6px var(--kit-frame-inner, #1a0a08);
}

.add-hero-btn.panel.disabled,
.add-hero-btn.panel:disabled,
.hero-remove-btn.panel.disabled,
.hero-remove-btn.panel:disabled {
    opacity: 0.4;
    pointer-events: none;
}

.available-spells-container,
.available-artifacts-container {
    margin-bottom: 1%;
}

.available-artifacts-container[hidden] {
    display: none;
}

.character-hub-container .section-title {
    color: var(--text-gold);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(12px, 1vw, 16px);
    margin-bottom: 8px;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    width: 100%;
    text-align: center;
    white-space: nowrap;
}

@media (max-width: 1600px) {
    .character-hub-container .section-title {
        font-size: clamp(12px, 0.8vw, 14px);
    }
}

/* Section Header Ornate - Art Deco style */
.section-header-ornate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-bottom: -18px;
    padding: 0;
    position: relative;
    z-index: 2;
}

.ornate-line-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.ornate-line {
    height: 1px;
    background: #ffd700;
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.4);
}

.ornate-line.short {
    width: 12px;
}

.ornate-line.long {
    flex: 1;
    min-width: 20px;
}

.ornate-diamond {
    color: var(--text-gold);
    font-size: 12px;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.6);
    line-height: 1;
}

.ornate-diamond.large {
    font-size: 14px;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}

.section-title-text {
    color: var(--text-gold);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(16px, 1.6vw, 26px);
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
}

.available-spells-list {
    padding: 5px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0;
}

.available-spells-list::after,
.available-artifacts-list::after {
    content: '';
    display: block;
    height: 2px;
    width: 100%;
    margin: 8px auto -6px auto;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 215, 0, 0.15) 30%, rgba(255, 215, 0, 0.15) 70%, transparent 100%);
}

.available-artifacts-list {
    padding: 5px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0;
    overflow: visible;
    max-height: none;
}

/* Spell category styles */
.spell-category-section {
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.04);
    padding: 8px;
}

.spell-category-section::after,
.artifact-tier-section::after {
    content: '';
    display: block;
    height: 1px;
    width: 100%;
    margin-top: 8px;
    background: linear-gradient(90deg, transparent 0%, var(--header-color, #8a7a6a) 30%, var(--header-color, #8a7a6a) 70%, transparent 100%);
    opacity: 0.25;
}

.spell-category-header,
.artifact-tier-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 6px 10px;
    margin-bottom: 8px;
    background: transparent;
    cursor: var(--cm-cursor-default, default);
    color: var(--header-color, #8a7a6a);
}

/* Linie po bokach nagłówka */
.spell-category-header::before,
.spell-category-header::after,
.artifact-tier-header::before,
.artifact-tier-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, currentColor 50%, transparent 100%);
    opacity: 0.4;
}

.spell-category-title,
.artifact-tier-title {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
    opacity: 0.85;
    color: inherit;
}

.header-diamond {
    font-size: 12px;
    opacity: 0.7;
    color: inherit;
}

.spell-category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 5px 10px 5px;
}

/* Artifact tier styles */
.artifact-tier-section {
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.04);
    padding: 8px;
}

.artifact-tier-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 5px 10px 5px;
}

/* Spell and Artifact Items - UI Kit Panel */
.spell-item,
.artifact-item {
    width: 3.5vw;
    height: 3.5vw;
    min-width: 50px;
    min-height: 50px;
    max-width: 60px;
    max-height: 60px;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.3s ease;
    position: relative;
    --kit-frame-color: var(--text-brown-dark);
    --kit-corner-color: var(--text-brown-medium-dark);
    --kit-diamond-color: var(--text-brown-medium);
}

.spell-item.panel,
.artifact-item.panel {
    background: transparent;
}

/* Override ui-kit padding - ikony są małe (50-60px) */
.spell-item.panel > .panel-content,
.artifact-item.panel > .panel-content {
    padding: 4px;
    width: 100%;
    box-sizing: border-box;
}

/* Panel texture - subtylne tło */
.artifact-item.panel > .panel-texture {
    inset: 0;
    opacity: 0.2;
    pointer-events: none;
    z-index: 0;
}

/* Ikony spell/artifact - pod ramką ale nad teksturą */
.spell-item.panel > .panel-content.spell-icon,
.artifact-item.panel > .panel-content.artifact-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    padding: 4px;
    box-sizing: border-box;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-origin: content-box;
    color: var(--text-brown-base);
    z-index: 1;
}

/* Ramka i cornery nad ikoną */
.artifact-item.panel > .deco-frame {
    z-index: 2;
}

.artifact-item.panel > .corner {
    z-index: 3;
}

/* Artifact Rarity Colors - UI Kit CSS Variables */
.artifact-item.rarity-common {
    --kit-frame-color: rgba(204, 204, 204, 0.6);
    --kit-frame-inner: rgba(154, 154, 154, 0.8);
    --kit-corner-color: rgba(220, 220, 220, 0.7);
    --kit-diamond-color: #cccccc;
}

.artifact-item.rarity-uncommon {
    --kit-frame-color: rgba(30, 255, 0, 0.6);
    --kit-frame-inner: rgba(10, 175, 0, 0.8);
    --kit-corner-color: rgba(50, 255, 30, 0.7);
    --kit-diamond-color: #1eff00;
}

.artifact-item.rarity-rare {
    --kit-frame-color: rgba(0, 153, 255, 0.6);
    --kit-frame-inner: rgba(0, 103, 175, 0.8);
    --kit-corner-color: rgba(30, 170, 255, 0.7);
    --kit-diamond-color: #0099ff;
}

.artifact-item.rarity-epic {
    --kit-frame-color: rgba(204, 0, 255, 0.6);
    --kit-frame-inner: rgba(154, 0, 205, 0.8);
    --kit-corner-color: rgba(220, 30, 255, 0.7);
    --kit-diamond-color: #cc00ff;
}

.artifact-item.rarity-legendary {
    --kit-frame-color: rgba(255, 102, 0, 0.6);
    --kit-frame-inner: rgba(205, 72, 0, 0.8);
    --kit-corner-color: rgba(255, 120, 30, 0.7);
    --kit-diamond-color: #ff6600;
}

.artifact-item.rarity-ancient {
    --kit-frame-color: rgba(255, 0, 102, 0.6);
    --kit-frame-inner: rgba(205, 0, 72, 0.8);
    --kit-corner-color: rgba(255, 30, 120, 0.7);
    --kit-diamond-color: #ff0066;
}

.artifact-item.rarity-eternal {
    --kit-frame-color: rgba(255, 215, 0, 0.6);
    --kit-frame-inner: rgba(205, 165, 0, 0.8);
    --kit-corner-color: rgba(255, 225, 30, 0.7);
    --kit-diamond-color: var(--text-gold);
}

/* Rarity Hover States */
.artifact-item.rarity-common:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(204, 204, 204, 0.9);
    --kit-corner-color: rgba(230, 230, 230, 1);
    --kit-diamond-color: var(--text-white);
}

.artifact-item.rarity-uncommon:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(30, 255, 0, 0.9);
    --kit-corner-color: rgba(80, 255, 50, 1);
    --kit-diamond-color: #50ff30;
}

.artifact-item.rarity-rare:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(0, 153, 255, 0.9);
    --kit-corner-color: rgba(50, 180, 255, 1);
    --kit-diamond-color: #30b4ff;
}

.artifact-item.rarity-epic:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(204, 0, 255, 0.9);
    --kit-corner-color: rgba(230, 50, 255, 1);
    --kit-diamond-color: #e632ff;
}

.artifact-item.rarity-legendary:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(255, 102, 0, 0.9);
    --kit-corner-color: rgba(255, 140, 50, 1);
    --kit-diamond-color: #ff8c32;
}

.artifact-item.rarity-ancient:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(255, 0, 102, 0.9);
    --kit-corner-color: rgba(255, 50, 140, 1);
    --kit-diamond-color: #ff328c;
}

.artifact-item.rarity-eternal:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(255, 215, 0, 0.9);
    --kit-corner-color: rgba(255, 235, 50, 1);
    --kit-diamond-color: #ffeb32;
}

/* Spell Category Colors - UI Kit CSS Variables (z JS categoryColors) */
.spell-item.category-necromancy {
    --kit-frame-color: rgba(138, 43, 226, 0.6);
    --kit-frame-inner: rgba(88, 23, 156, 0.8);
    --kit-corner-color: rgba(158, 63, 246, 0.7);
    --kit-diamond-color: #8a2be2;
}

.spell-item.category-curses {
    --kit-frame-color: rgba(128, 0, 128, 0.6);
    --kit-frame-inner: rgba(78, 0, 78, 0.8);
    --kit-corner-color: rgba(148, 20, 148, 0.7);
    --kit-diamond-color: #800080;
}

.spell-item.category-soul_magic {
    --kit-frame-color: rgba(65, 105, 225, 0.6);
    --kit-frame-inner: rgba(35, 69, 161, 0.8);
    --kit-corner-color: rgba(85, 125, 245, 0.7);
    --kit-diamond-color: #4169e1;
}

.spell-item.category-summoning {
    --kit-frame-color: rgba(220, 20, 60, 0.6);
    --kit-frame-inner: rgba(156, 10, 40, 0.8);
    --kit-corner-color: rgba(240, 40, 80, 0.7);
    --kit-diamond-color: #dc143c;
}

.spell-item.category-blood_magic {
    --kit-frame-color: rgba(139, 0, 0, 0.6);
    --kit-frame-inner: rgba(89, 0, 0, 0.8);
    --kit-corner-color: rgba(159, 20, 20, 0.7);
    --kit-diamond-color: #8b0000;
}

/* Spell Category Hover States */
.spell-item.category-necromancy:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(138, 43, 226, 0.9);
    --kit-corner-color: rgba(178, 83, 255, 1);
    --kit-diamond-color: #b253ff;
}

.spell-item.category-curses:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(128, 0, 128, 0.9);
    --kit-corner-color: rgba(168, 40, 168, 1);
    --kit-diamond-color: #a828a8;
}

.spell-item.category-soul_magic:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(65, 105, 225, 0.9);
    --kit-corner-color: rgba(105, 145, 255, 1);
    --kit-diamond-color: #6991ff;
}

.spell-item.category-summoning:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(220, 20, 60, 0.9);
    --kit-corner-color: rgba(255, 60, 100, 1);
    --kit-diamond-color: #ff3c64;
}

.spell-item.category-blood_magic:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: rgba(139, 0, 0, 0.9);
    --kit-corner-color: rgba(179, 40, 40, 1);
    --kit-diamond-color: #b32828;
}

/* Kolor przewodni per-skill: zmienne --kit-* ramki/rogów/diamentu ustawiane inline w JS
   (getSpellColor/_applySpellColor) — nadpisują kolory per-kategoria powyżej.
   Tu tylko uniwersalny hover-glow w kolorze danego skilla. */
.spell-item:hover:where(body:not(.gamepad-active) *) {
    box-shadow: 0 0 14px 1px var(--spell-color, #8a7a6a), inset 0 0 10px rgba(0, 0, 0, 0.35);
}

.spell-item.dragging,
.artifact-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

/* Active synergies: readable tiles inside the scrollable left column. */
.active-synergies-container {
    width: 95%;
    padding: 1.5%;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 1.5%;
}

.active-synergies-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    /* The character column owns scrolling, including every synergy tile. */
    max-height: none;
    overflow: visible;
}

/* Synergy Banner - UI Kit Panel */
.synergy-banner {
    position: relative;
    width: 100%;
    cursor: var(--cm-cursor-default, default);
    margin-bottom: 6px;
    transition: all 0.3s ease;
}

.synergy-banner.panel {
    background: transparent;
    border: none;
    border-radius: 0;
}

.synergy-banner.panel > .panel-texture {
    opacity: 0.3;
}

.synergy-banner:hover:where(body:not(.gamepad-active) *),
.synergy-banner.gamepad-selected {
    --kit-frame-color: rgba(255, 215, 0, 0.9);
    --kit-frame-inner: rgba(180, 150, 0, 0.8);
    --kit-corner-color: rgba(255, 225, 50, 1);
    --kit-diamond-color: var(--text-gold);
    transform: translateX(2px);
}

/* Content wrapper - panel-content */
.synergy-banner.panel > .panel-content.synergy-banner-content {
    position: relative;
    width: 100%;
    padding: 8px 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 2;
}

/* Background with skill icons - clipped to frame like panel-texture */
.synergy-banner-bg {
    position: absolute;
    inset: 3px;
    display: flex;
    opacity: 0.1;
    z-index: 1;
    overflow: hidden;
}

.synergy-skill-icon {
    flex: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-right: 1px solid rgba(138, 122, 117, 0.2);
}

.synergy-skill-icon:last-child {
    border-right: none;
}

.synergy-name {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-gold);
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    margin-bottom: 3px;
    line-height: 1.2;
}

.synergy-description {
    font-size: clamp(14px, 0.9vw, 16px);
    color: var(--text-brown-base);
    line-height: 1.3;
}

/* Match hub stat typography; allow full translated descriptions to wrap. */
.active-synergies-list .synergy-banner {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 120px;
    margin-bottom: 0;
}

.active-synergies-list .synergy-banner.panel > .panel-content.synergy-banner-content {
    padding: 16px 18px;
    min-height: 120px;
    gap: 8px;
}

.active-synergies-list .synergy-name,
.active-synergies-list .synergy-description {
    font-family: 'SFPixelate', 'Courier New', monospace;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.3;
}

.active-synergies-list .synergy-name {
    font-size: 18px;
    margin-bottom: 0;
}

.active-synergies-list .synergy-description {
    font-size: 18px;
    color: #e3d7c5;
}

/* Empty state */
.no-synergies {
    color: var(--text-brown-medium-dark);
    text-align: center;
    padding: 20px;
    font-style: italic;
    opacity: 0.6;
}

.build-bar-slot.drag-over {
    border-color: #4ade80 !important;
    background-color: rgba(74, 222, 128, 0.2) !important;
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.6) !important;
}

.artifact-bar-slot.drag-over {
    border-color: #4ade80 !important;
    background-color: rgba(74, 222, 128, 0.2) !important;
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.6) !important;
}

/* UI Scaling Support */
[data-scale="font-size"] {
    transition: font-size 0.3s ease;
}

[data-scale="padding"] {
    transition: padding 0.3s ease;
}

[data-scale="margin"] {
    transition: margin 0.3s ease;
}

[data-scale="border-radius"] {
    transition: border-radius 0.3s ease;
}

/* Animation for stats updates */
@keyframes statUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.stat-item.updating .stat-value {
    animation: statUpdate 0.3s ease;
}

/* Loading state */
.character-hub-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-white);
    font-size: 18px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(138, 43, 226, 0.3);
    border-top: 4px solid rgba(138, 43, 226, 1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 15px;
}

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

/* Synergy Visualization */
.synergy-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}

.synergy-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: opacity 0.3s ease;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
}

/* Synergy line hover effects */
.synergy-line:hover:where(body:not(.gamepad-active) *) {
    opacity: 1 !important;
}

/* Pulse animation for synergy lines */
@keyframes synergyPulse {
    0% { opacity: 0.4; }
    50% { opacity: 1.0; }
    100% { opacity: 0.4; }
}

.synergy-line.pulsing {
    animation: synergyPulse 2s ease-in-out infinite;
}

/* Build bar container positioning for SVG overlay */
.character-build-bar {
    position: relative;
    z-index: 1;
}

/* Ensure slots are properly positioned for synergy visualization */
.build-bar-slots {
    position: relative;
    z-index: 2;
}

.build-bar-slot {
    position: relative;
    z-index: 3;
}

.spell-item.gamepad-selected {
    outline: 3px solid #FFD700;
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
    z-index: 10;
}

.stat-item.gamepad-selected {
    border-color: rgba(255, 215, 0, 0.8);
    background: rgba(0, 0, 0, 0.3);
}

.artifact-item.gamepad-selected.rarity-common {
    outline: 3px solid rgba(204, 204, 204, 1);
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(204, 204, 204, 0.8);
    transform: scale(1.1);
    z-index: 10;
}

.artifact-item.gamepad-selected.rarity-uncommon {
    outline: 3px solid rgba(30, 255, 0, 1);
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(30, 255, 0, 0.8);
    transform: scale(1.1);
    z-index: 10;
}

.artifact-item.gamepad-selected.rarity-rare {
    outline: 3px solid rgba(0, 153, 255, 1);
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(0, 153, 255, 0.8);
    transform: scale(1.1);
    z-index: 10;
}

.artifact-item.gamepad-selected.rarity-epic {
    outline: 3px solid rgba(204, 0, 255, 1);
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(204, 0, 255, 0.8);
    transform: scale(1.1);
    z-index: 10;
}

.artifact-item.gamepad-selected.rarity-legendary {
    outline: 3px solid rgba(255, 102, 0, 1);
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(255, 102, 0, 0.8);
    transform: scale(1.1);
    z-index: 10;
}

.artifact-item.gamepad-selected.rarity-ancient {
    outline: 3px solid rgba(255, 0, 102, 1);
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(255, 0, 102, 0.8);
    transform: scale(1.1);
    z-index: 10;
}

.artifact-item.gamepad-selected.rarity-eternal {
    outline: 3px solid rgba(255, 215, 0, 1);
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    transform: scale(1.1);
    z-index: 10;
}

.spell-slot.gamepad-selected,
.artifact-slot.gamepad-selected {
    outline: 3px solid #FFD700;
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
}

.character-sprite-container.gamepad-selected {
    --kit-frame-color: rgba(255, 215, 0, 0.9);
    --kit-frame-inner: rgba(180, 150, 0, 0.8);
    --kit-corner-color: rgba(255, 225, 50, 1);
    --kit-diamond-color: var(--text-gold);
    transform: scale(1.08);
}

.character-hero-tab.gamepad-selected {
    --kit-frame-color: rgba(255, 215, 0, 0.9);
    --kit-frame-inner: rgba(180, 150, 0, 0.8);
    --kit-corner-color: rgba(255, 225, 50, 1);
    --kit-diamond-color: var(--text-gold);
}

/* Active + gamepad selected = large + golden */
.character-hero-tab.selected.gamepad-selected,
.character-hero-tab.selected.gamepad-focused {
    --kit-frame-color: rgba(255, 215, 0, 0.9);
    --kit-frame-inner: rgba(180, 150, 0, 0.8);
    --kit-corner-color: rgba(255, 225, 50, 1);
    --kit-diamond-color: var(--text-gold);
    transform: scale(1.15);
}

.build-bar-slot.gamepad-selected,
.artifact-bar-slot.gamepad-selected {
    outline: 3px solid #FFD700;
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
}

/* =====================================================
   BUILD CODE MODAL STYLES
   ===================================================== */

/* Build Code Button in header */
.build-code-btn.panel {
    width: 180px;
    height: 32px;
    border: none;
    z-index: 10;
    pointer-events: auto;
}

.build-code-btn.panel > .panel-content {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.build-code-btn.panel.gamepad-selected {
    --kit-frame-color: #6a5040;
    --kit-frame-inner: #4a3530;
    --kit-corner-color: #8a6a55;
    --kit-diamond-color: #aa8a70;
}

.build-code-btn.panel.gamepad-selected > .panel-texture {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80px 120px at 30% 25%, rgba(40, 25, 20, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 100px 80px at 70% 45%, rgba(35, 20, 18, 0.12) 0%, transparent 70%),
        linear-gradient(180deg,
            #18100c 0%,
            #201510 12%,
            #2a1a14 30%,
            #302018 45%,
            #281814 58%,
            #1e120e 70%,
            #140c08 100%
        );
}

.build-code-btn.panel.gamepad-selected > .panel-texture::before {
    background: radial-gradient(ellipse 80% 70% at 50% 40%,
        rgba(120, 90, 60, 0.1) 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.15) 100%
    );
}

.build-code-btn.panel.gamepad-selected > .panel-content {
    color: var(--text-brown-accent);
}

.build-code-btn.panel.gamepad-selected > .deco-frame::before {
    box-shadow:
        0 0 10px rgba(120, 90, 60, 0.2),
        inset 0 0 0 4px transparent,
        inset 0 0 0 6px var(--kit-frame-inner, #4a3530);
}

/* Pressed/Active state for keyboard/gamepad */
.build-code-btn.panel:active,
.build-code-btn.panel.btn-pressed {
    --kit-frame-color: #2a1a18;
    --kit-frame-inner: #1a0a08;
    --kit-corner-color: #3a2a25;
    --kit-diamond-color: #4a3a35;
    transform: translateY(1px);
}

.build-code-btn.panel:active > .panel-texture,
.build-code-btn.panel.btn-pressed > .panel-texture {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80px 120px at 30% 25%, rgba(10, 5, 8, 0.15) 0%, transparent 70%),
        linear-gradient(180deg,
            #080406 0%,
            #0a0508 12%,
            #0e070b 30%,
            #10080d 45%,
            #0c060a 58%,
            #0a0508 70%,
            #060304 100%
        );
}

.build-code-btn.panel:active > .panel-content,
.build-code-btn.panel.btn-pressed > .panel-content {
    color: var(--text-brown-medium-dark);
}

.build-code-btn.panel:active > .deco-frame::before,
.build-code-btn.panel.btn-pressed > .deco-frame::before {
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 0 0 4px transparent,
        inset 0 0 0 6px var(--kit-frame-inner, #1a0a08);
}

/* Modal Overlay */
.build-code-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

/* Modal Container - UI Kit Panel */
.build-code-modal.panel {
    position: relative;
    max-width: 500px;
    width: 90vw;
    background: transparent;
}

.build-code-modal.panel > .panel-content {
    display: flex;
    flex-direction: column;
    gap: 1vh;
}

/* Simple Header */
.build-code-header {
    display: flex;
    align-items: center;
    gap: 1vw;
    flex-shrink: 0;
}

/* Back Button - UI Kit Panel (inside header) */
.build-code-back.btn.panel {
    width: 32px;
    height: 32px;
    background: transparent;
    flex-shrink: 0;
    cursor: var(--cm-cursor-action, pointer);
}

.build-code-back.panel > .panel-content {
    font-size: 14px;
    line-height: 1;
    color: var(--kit-text-color, #8a7a75);
}

.build-code-back.selected,
.build-code-back.gamepad-focused,
.build-code-back.focused,
.build-code-back:hover:where(body:not(.gamepad-active) *) {
    --kit-frame-color: #6a5040;
    --kit-frame-inner: #4a3530;
    --kit-corner-color: #8a6a55;
    --kit-diamond-color: #aa8a70;
}

/* Title */
.build-code-title {
    margin: 0;
    color: var(--text-brown-accent, #c0a080);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(16px, 1.5vw, 22px);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    flex: 1;
}

/* Modal Content */
.build-code-modal-content {
    display: flex;
    flex-direction: column;
    gap: 3vh;
}

/* Code Section */
.code-section {
    display: flex;
    flex-direction: column;
    gap: 1vh;
}

.code-section label {
    color: var(--text-brown-accent, #c0a080);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(14px, 1.2vw, 20px);
    font-weight: 500;
}

/* Code Textarea */
.code-textarea {
    width: 100%;
    min-height: 70px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(90, 74, 69, 0.5);
    border-radius: 8px;
    color: var(--text-brown-light, #a89a90);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(14px, 1.2vw, 18px);
    letter-spacing: 2px;
    padding: 1.5vh 1.5vw;
    resize: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.code-textarea:focus,
.code-textarea.focused {
    outline: none;
    border-color: var(--text-brown-accent, #c0a080);
    box-shadow: 0 0 15px rgba(192, 160, 128, 0.3);
}

.code-textarea.focused {
    border-color: #6a5040;
    box-shadow: 0 0 15px rgba(120, 90, 60, 0.4);
}

.code-textarea::placeholder {
    color: var(--text-gray-medium);
    letter-spacing: normal;
}

/* Code Buttons Grid */
.code-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2vh 1vw;
    margin-top: 1vh;
}

/* Code Button - UI Kit Panel Override */
.code-btn.btn.panel {
    width: 100%;
    height: 44px;
}

.code-btn.btn.panel > .panel-content {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Code Button - hover/focused/selected state - unified brown UI Kit style */
.code-btn.btn.panel:hover:where(body:not(.gamepad-active) *),
.code-btn.btn.panel.focused,
.code-btn.btn.panel.selected {
    --kit-frame-color: #6a5040;
    --kit-frame-inner: #4a3530;
    --kit-corner-color: #8a6a55;
    --kit-diamond-color: #aa8a70;
}

.code-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .panel-texture,
.code-btn.btn.panel.focused > .panel-texture,
.code-btn.btn.panel.selected > .panel-texture {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80px 120px at 30% 25%, rgba(40, 25, 20, 0.15) 0%, transparent 70%),
        linear-gradient(180deg,
            #18100c 0%,
            #201510 12%,
            #2a1a14 30%,
            #302018 45%,
            #281814 58%,
            #1e120e 70%,
            #140c08 100%
        );
}

.code-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .panel-content,
.code-btn.btn.panel.focused > .panel-content,
.code-btn.btn.panel.selected > .panel-content {
    color: #c0a080;
}

.code-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .deco-frame::before,
.code-btn.btn.panel.focused > .deco-frame::before,
.code-btn.btn.panel.selected > .deco-frame::before {
    box-shadow:
        0 0 10px rgba(120, 90, 60, 0.2),
        inset 0 0 0 4px transparent,
        inset 0 0 0 6px var(--kit-frame-inner, #4a3530);
}

/* File Section */
.file-section {
    display: flex;
    gap: 1vw;
    justify-content: center;
    margin-top: 1vh;
    padding-top: 2vh;
    border-top: 1px solid rgba(90, 74, 69, 0.4);
}

/* File Button - UI Kit Panel Override */
.file-btn.btn.panel {
    width: auto;
    min-width: 120px;
    height: 48px;
}

.file-btn.btn.panel > .panel-content {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 0 20px;
}

/* File Button & Confirm Save Button - hover/focused/selected state - unified brown UI Kit style */
.file-btn.btn.panel:hover:where(body:not(.gamepad-active) *),
.file-btn.btn.panel.focused,
.file-btn.btn.panel.selected,
.confirm-save-btn.btn.panel:hover:where(body:not(.gamepad-active) *),
.confirm-save-btn.btn.panel.focused,
.confirm-save-btn.btn.panel.selected {
    --kit-frame-color: #6a5040;
    --kit-frame-inner: #4a3530;
    --kit-corner-color: #8a6a55;
    --kit-diamond-color: #aa8a70;
}

.file-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .panel-texture,
.file-btn.btn.panel.focused > .panel-texture,
.file-btn.btn.panel.selected > .panel-texture,
.confirm-save-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .panel-texture,
.confirm-save-btn.btn.panel.focused > .panel-texture,
.confirm-save-btn.btn.panel.selected > .panel-texture {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80px 120px at 30% 25%, rgba(40, 25, 20, 0.15) 0%, transparent 70%),
        linear-gradient(180deg,
            #18100c 0%,
            #201510 12%,
            #2a1a14 30%,
            #302018 45%,
            #281814 58%,
            #1e120e 70%,
            #140c08 100%
        );
}

.file-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .panel-content,
.file-btn.btn.panel.focused > .panel-content,
.file-btn.btn.panel.selected > .panel-content,
.confirm-save-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .panel-content,
.confirm-save-btn.btn.panel.focused > .panel-content,
.confirm-save-btn.btn.panel.selected > .panel-content {
    color: #c0a080;
}

.file-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .deco-frame::before,
.file-btn.btn.panel.focused > .deco-frame::before,
.file-btn.btn.panel.selected > .deco-frame::before,
.confirm-save-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .deco-frame::before,
.confirm-save-btn.btn.panel.focused > .deco-frame::before,
.confirm-save-btn.btn.panel.selected > .deco-frame::before {
    box-shadow:
        0 0 10px rgba(120, 90, 60, 0.2),
        inset 0 0 0 4px transparent,
        inset 0 0 0 6px var(--kit-frame-inner, #4a3530);
}

/* Responsive adjustments */
@media (max-width: 1920px) {
    .build-code-modal {
        max-width: 480px;
        padding: 1.5vh 1.5vw;
    }

    .code-btn.btn.panel {
        height: 38px;
    }

    .code-btn.btn.panel > .panel-content {
        font-size: 13px;
    }

    .file-btn.btn.panel {
        height: 42px;
    }

    .file-btn.btn.panel > .panel-content {
        font-size: 13px;
    }
}

@media (max-width: 1366px) {
    .build-code-modal {
        max-width: 400px;
    }

    .code-btn.btn.panel {
        height: 34px;
    }

    .code-btn.btn.panel > .panel-content {
        font-size: 12px;
    }

    .file-btn.btn.panel {
        height: 38px;
    }

    .file-btn.btn.panel > .panel-content {
        font-size: 12px;
    }

    .file-section {
        flex-direction: column;
        gap: 0.5vh;
    }

    .file-btn.btn.panel {
        width: 100%;
    }
}

/* ============================================
   Save/Load Build Modals (In-game)
   ============================================ */

/* Save Build Modal */
.save-build-modal {
    max-width: 550px;
}

.save-build-input-section {
    display: flex;
    flex-direction: column;
    gap: 1vh;
    padding-bottom: 2vh;
    border-bottom: 1px solid rgba(90, 74, 69, 0.4);
}

.save-build-input-section label {
    color: var(--text-brown-medium);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(16px, 1.3vw, 22px);
}

.build-name-input {
    width: 100%;
    padding: 1vh 1vw;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(90, 74, 69, 0.5);
    border-radius: 6px;
    color: var(--text-brown-light);
    font-size: clamp(14px, 1.1vw, 18px);
    font-family: 'SFPixelate', 'Courier New', monospace;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.build-name-input:focus {
    border-color: var(--text-brown-accent, #c0a080);
    box-shadow: 0 0 15px rgba(192, 160, 128, 0.3);
}

.build-name-input.focused {
    border-color: var(--text-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.build-name-input::placeholder {
    color: var(--text-brown-dark);
}

.confirm-save-btn {
    align-self: flex-end;
    min-width: 120px;
}

.confirm-save-btn.focused {
    border-color: var(--text-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

/* Saved Builds Section */
.saved-builds-section {
    margin-top: 1vh;
}

.saved-builds-section label {
    display: block;
    color: var(--text-brown-medium-dark);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(16px, 1.2vw, 20px);
    margin-bottom: 1vh;
}

/* Saved Builds List */
.saved-builds-list {
    max-height: 30vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5vh;
    padding-right: 0.5vw;
}

.saved-builds-list::-webkit-scrollbar {
    width: 6px;
}

.saved-builds-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.saved-builds-list::-webkit-scrollbar-thumb {
    background: #4a3a35;
    border-radius: 3px;
}

/* Load Builds List - larger for load modal */
.load-builds-list {
    max-height: 50vh;
}

/* Saved Build Item */
.saved-build-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1vh 1vw;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #3a2a28;
    border-radius: 6px;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.2s ease;
}

.saved-build-item:hover:where(body:not(.gamepad-active) *),
.saved-build-item.focused {
    background: rgba(90, 74, 69, 0.3);
    border-color: rgba(106, 80, 64, 0.6);
}

.saved-build-item.focused {
    border-color: #6a5040;
    box-shadow: 0 0 12px rgba(120, 90, 60, 0.4);
}

.saved-build-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.3vh;
    flex: 1;
}

.saved-build-item-name {
    color: var(--text-brown-light);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(13px, 1vw, 16px);
    font-weight: 500;
}

.saved-build-item-date {
    color: var(--text-brown-dark);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(12px, 0.8vw, 14px);
}

.saved-build-item-codes {
    display: flex;
    gap: 0.5vw;
    color: var(--text-brown-medium-dark);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(12px, 0.7vw, 14px);
}

.saved-build-item-actions {
    display: flex;
    gap: 0.5vw;
}

/* Build Action Button - UI Kit Panel Override */
.build-action-btn.btn.panel {
    width: auto;
    min-width: 70px;
    height: 38px;
}

.build-action-btn.btn.panel > .panel-content {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 0 12px;
}

/* Build Action Button - hover/focused/selected state - unified brown UI Kit style */
.build-action-btn.btn.panel:hover:where(body:not(.gamepad-active) *),
.build-action-btn.btn.panel.focused,
.build-action-btn.btn.panel.selected {
    --kit-frame-color: #6a5040;
    --kit-frame-inner: #4a3530;
    --kit-corner-color: #8a6a55;
    --kit-diamond-color: #aa8a70;
}

.build-action-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .panel-texture,
.build-action-btn.btn.panel.focused > .panel-texture,
.build-action-btn.btn.panel.selected > .panel-texture {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80px 120px at 30% 25%, rgba(40, 25, 20, 0.15) 0%, transparent 70%),
        linear-gradient(180deg,
            #18100c 0%,
            #201510 12%,
            #2a1a14 30%,
            #302018 45%,
            #281814 58%,
            #1e120e 70%,
            #140c08 100%
        );
}

.build-action-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .panel-content,
.build-action-btn.btn.panel.focused > .panel-content,
.build-action-btn.btn.panel.selected > .panel-content {
    color: #c0a080;
}

.build-action-btn.btn.panel:hover:where(body:not(.gamepad-active) *) > .deco-frame::before,
.build-action-btn.btn.panel.focused > .deco-frame::before,
.build-action-btn.btn.panel.selected > .deco-frame::before {
    box-shadow:
        0 0 10px rgba(120, 90, 60, 0.2),
        inset 0 0 0 4px transparent,
        inset 0 0 0 6px var(--kit-frame-inner, #4a3530);
}

/* No Builds Message */
.no-builds-message {
    text-align: center;
    padding: 4vh 2vw;
    color: var(--text-brown-dark);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(16px, 1.3vw, 22px);
}

/* Responsive adjustments for Save/Load modals */
@media (max-width: 1920px) {
    .save-build-modal,
    .load-build-modal {
        max-width: 500px;
    }
}

@media (max-width: 1366px) {
    .save-build-modal,
    .load-build-modal {
        max-width: 450px;
    }

    .saved-builds-list {
        max-height: 25vh;
    }

    .load-builds-list {
        max-height: 40vh;
    }
}

/* Character Hub Tooltip - UI Toolkit */
.character-hub-tooltip {
    position: fixed;
    bottom: 2vh;
    left: 50%;
    transform: translateX(-50%);
    width: 640px;
    display: none;
    z-index: 100000;
    pointer-events: none;
}

.character-hub-tooltip.tooltip-position-top {
    bottom: auto;
    top: 2vh;
}

.character-hub-tooltip.panel {
    background: transparent;
}

.character-hub-tooltip .tooltip-content {
    display: flex;
    flex-direction: row;
    gap: 3%;
    align-items: stretch;
}

.character-hub-tooltip .tooltip-image-container.panel {
    flex-shrink: 0;
    align-self: center;
}

.character-hub-tooltip .tooltip-image-container.panel > .corner {
    z-index: 10;
}

.character-hub-tooltip .tooltip-image-container.panel > .deco-frame {
    z-index: 10;
}

.character-hub-tooltip .tooltip-image-container.panel > .panel-content.tooltip-image-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 4px;
    height: 100%;
    box-sizing: border-box;
}

.character-hub-tooltip .tooltip-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.character-hub-tooltip .tooltip-icon {
    font-size: 3.5em;
    display: none;
}

.character-hub-tooltip .tooltip-info {
    flex: 1;
}

.character-hub-tooltip .tooltip-name {
    color: var(--text-gold);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 1.6em;
    margin: 0 0 0.5em 0;
}

.character-hub-tooltip .tooltip-description {
    color: var(--text-brown-light);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 1em;
    line-height: 1.6;
}

.character-hub-tooltip .tooltip-stats {
    color: var(--text-brown-base);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 0.9em;
}

.character-hub-tooltip .divider-h {
    width: 100%;
    height: 1px;
    margin: 0.4em 0;
    background: linear-gradient(90deg, transparent 0%, var(--corner-color, #4a3a35) 20%, var(--corner-color, #4a3a35) 80%, transparent 100%);
    flex-shrink: 0;
}

/* Spell mutability badge — small "M" marker in corner for mutable spells (the majority).
   Used by spell list (.spell-item), equipped build bar slots (.build-bar-slot), scroll synergy tile,
   and hero skill slots — all render via character-hub-ui.js helpers. */
.spell-mutability-badge {
    position: absolute;
    top: 1px;
    right: 2px;
    z-index: 5;
    font-size: 14px;
    line-height: 1;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-weight: bold;
    color: #ffd700;
    pointer-events: none;
    text-shadow: 0 0 1px #000, 1px 1px 0 #000;
    opacity: 0.85;
}

/* Coming Soon — spell wciąż wybieralny (np. odblokowany cheatem), ale wyraźnie oznaczony.
   Przygaszony kafel + bursztynowy banner na dole. */
.spell-item.coming-soon {
    filter: grayscale(40%) brightness(0.82);
}

.spell-item.coming-soon .spell-coming-soon-ribbon {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    padding: 2px 0;
    text-align: center;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(8px, 0.7vw, 11px);
    font-weight: bold;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1a1206;
    background: linear-gradient(to bottom, rgba(201, 162, 39, 0.92), rgba(160, 120, 30, 0.92));
    border-top: 1px solid rgba(255, 215, 0, 0.7);
    text-shadow: 0 1px 0 rgba(255, 220, 120, 0.5);
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =====================================================
   CARD-DECK UX — presentation only, gameplay unchanged
   ===================================================== */

.character-hub-container {
    width: 96%;
    max-width: 96vw;
    height: 92vh;
    grid-template-columns: minmax(430px, 2fr) auto minmax(0, 3fr);
}

.character-hub-title {
    color: #d3b46f;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.build-bar-panel,
.artifact-bar-panel {
    padding: 18px 8px 8px;
    background:
        radial-gradient(circle at 50% 10%, rgba(105, 72, 45, 0.13), transparent 58%),
        rgba(0, 0, 0, 0.42);
    border-top: 1px solid rgba(154, 122, 78, 0.18);
    border-bottom: 1px solid rgba(154, 122, 78, 0.12);
}

.build-chapter-header {
    position: relative;
    text-transform: uppercase;
    color: #b99a67;
}

.deck-counter {
    position: absolute;
    right: 4px;
    padding: 2px 7px;
    color: #d9c38c;
    border: 1px solid rgba(185, 154, 103, 0.42);
    background: rgba(10, 6, 5, 0.72);
    font-size: 11px;
    letter-spacing: 0.08em;
}

.equipped-card-list {
    justify-content: center;
    align-items: start;
    gap: 9px;
}

.equipped-card-list--skills {
    display: grid;
    grid-template-columns: repeat(4, 118px);
}

.equipped-card-list--artifacts {
    display: flex;
    flex-wrap: wrap;
}

.equipped-card-slot {
    width: 118px;
    height: 166px;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    border-radius: 2px;
    transform-origin: 50% 100%;
    box-shadow: 0 7px 14px rgba(0, 0, 0, 0.38);
}

.equipped-card-slot:nth-child(4n + 1) { transform: rotate(-1.2deg); }
.equipped-card-slot:nth-child(4n + 2) { transform: rotate(-0.4deg); }
.equipped-card-slot:nth-child(4n + 3) { transform: rotate(0.4deg); }
.equipped-card-slot:nth-child(4n + 4) { transform: rotate(1.2deg); }

.equipped-card-slot:hover:where(body:not(.gamepad-active) *),
.equipped-card-slot.gamepad-selected,
.equipped-card-slot.btn-selected {
    transform: translateY(-5px) rotate(0deg) scale(1.03);
    z-index: 20;
}

.equipped-card-slot.panel > .panel-content.equipped-card-icon {
    position: absolute;
    inset: 8px 7px 31px;
    width: auto;
    height: auto;
    background-position: center;
    filter: saturate(0.82) brightness(0.82);
}

.equipped-card-slot--skill.panel > .panel-content.equipped-card-icon {
    padding: 0;
    background-size: cover;
    background-origin: border-box;
}

.equipped-card-slot--artifact.panel > .panel-content.equipped-card-icon {
    padding: 5px;
    background-size: contain;
    background-origin: content-box;
}

.equipped-card-slot.filled:hover:where(body:not(.gamepad-active) *) > .panel-content.equipped-card-icon,
.equipped-card-slot.filled.gamepad-selected > .panel-content.equipped-card-icon,
.equipped-card-slot.filled.btn-selected > .panel-content.equipped-card-icon {
    filter: saturate(1.08) brightness(1.05);
}

.equipped-card-slot.filled.panel:hover:where(body:not(.gamepad-active) *),
.equipped-card-slot.filled.panel.gamepad-selected,
.equipped-card-slot.filled.panel.btn-selected {
    box-shadow: 0 0 14px 1px var(--kit-diamond-color, #d6a84f);
}

.equipped-card-slot.empty > .panel-content::before {
    content: '+';
    position: absolute;
    inset: 10px 8px 27px;
    display: grid;
    place-items: center;
    color: rgba(145, 112, 82, 0.38);
    border: 1px dashed rgba(145, 112, 82, 0.28);
    background: linear-gradient(160deg, rgba(74, 48, 38, 0.13), rgba(7, 5, 5, 0.62));
    font-size: 24px;
}

.deck-card-name {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 7px;
    z-index: 4;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c9b58a;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 9px;
    line-height: 1.08;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 1px 2px #000;
    overflow: hidden;
}

.deck-position-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 5;
    min-width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
    color: #dfc783;
    border: 1px solid rgba(223, 199, 131, 0.5);
    background: rgba(6, 4, 4, 0.86);
    font-size: 9px;
    line-height: 1;
}

.equipped-card-slot .spell-mutability-badge {
    top: 5px;
    right: 6px;
}

.equipped-card-slot--artifact .deck-card-name {
    color: color-mix(in srgb, var(--kit-diamond-color, #d6a84f) 38%, #c9b58a);
}

.equipped-card-slot--artifact .deck-position-badge {
    border-color: color-mix(in srgb, var(--kit-diamond-color, #d6a84f) 52%, rgba(223, 199, 131, 0.5));
}

.available-spells-list {
    padding: 12px;
    background:
        linear-gradient(90deg, rgba(74, 47, 35, 0.08), transparent 15%, transparent 85%, rgba(74, 47, 35, 0.08)),
        rgba(0, 0, 0, 0.42);
    border-top: 1px solid rgba(177, 137, 77, 0.15);
}

.spell-category-navigation {
    --library-scroll-arrow-size: calc(12 * var(--menu-ui-pixel, 4px));
    display: flex;
    align-items: flex-start;
    gap: var(--menu-ui-pixel, 4px);
    margin: 5px 0 8px;
}

.spell-category-scroll {
    flex: 1 1 0;
    min-width: 0;
    display: grid;
    grid-template-columns: var(--library-scroll-arrow-size) minmax(0, 1fr) var(--library-scroll-arrow-size);
    align-items: center;
    gap: var(--menu-ui-pixel, 4px);
}

.spell-category-pinned-tabs {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    gap: var(--menu-ui-pixel, 4px);
    padding: 7px 8px 11px;
}

.spell-category-scroll > .menu-scroll-arrow {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: var(--library-scroll-arrow-size);
    height: var(--library-scroll-arrow-size);
    transform: none;
}

.spell-category-scroll > .menu-scroll-arrow:hover:where(body:not(.gamepad-active) *) {
    transform: scale(1.08);
}

.spell-category-scroll > .menu-scroll-arrow:active {
    transform: scale(0.94);
}

.spell-category-scroll > .spell-category-tabs {
    min-width: 0;
    margin: 0;
}

.spell-category-tabs {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: flex-start;
    justify-content: safe center;
    gap: var(--menu-ui-pixel, 4px);
    width: 100%;
    margin: 5px 0 8px;
    padding: 7px 8px 11px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid rgba(128, 88, 61, 0.14);
    background: linear-gradient(180deg, rgba(25, 13, 17, 0.18), transparent 78%);
    scrollbar-width: thin;
    scrollbar-color: rgba(130, 92, 62, 0.68) rgba(10, 7, 6, 0.5);
}

.spell-category-tabs::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 8px;
    left: 8px;
    z-index: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(171, 124, 75, 0.38) 10%, rgba(91, 58, 47, 0.72) 50%, rgba(171, 124, 75, 0.38) 90%, transparent);
    box-shadow: 0 1px 0 rgba(5, 3, 4, 0.9);
    pointer-events: none;
}

.spell-category-tabs::-webkit-scrollbar {
    height: 5px;
}

.spell-category-tabs::-webkit-scrollbar-track {
    background: rgba(10, 7, 6, 0.5);
}

.spell-category-tabs::-webkit-scrollbar-thumb {
    background: rgba(130, 92, 62, 0.68);
    border-radius: 0;
}

.spell-category-tab {
    position: relative;
    z-index: 1;
    flex: 0 0 calc(16 * var(--menu-ui-pixel, 4px));
    width: calc(16 * var(--menu-ui-pixel, 4px));
    min-width: calc(16 * var(--menu-ui-pixel, 4px));
    max-width: calc(16 * var(--menu-ui-pixel, 4px));
    height: calc(22 * var(--menu-ui-pixel, 4px));
    padding: 0;
    overflow: visible;
    appearance: none;
    color: #d9c38c;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: var(--cm-cursor-action, pointer);
    transform-origin: 50% 0;
    --bookmark-edge: #6e5041;
    --bookmark-edge-active: color-mix(in srgb, var(--tab-color, #8a7a6a) 40%, #b08a57);
    transition: transform 130ms ease, filter 130ms ease;
}

.spell-category-tab::before {
    content: '';
    position: absolute;
    inset: 0 5px 0 3px;
    z-index: 0;
    background: var(--bookmark-edge);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.64));
    pointer-events: none;
}

.spell-category-tab::after {
    content: '';
    position: absolute;
    inset: 2px 7px 3px 5px;
    z-index: 1;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--tab-color, #8a7a6a) 8%, transparent), transparent 42%),
        linear-gradient(180deg, #24151a 0%, #160b10 62%, #0a0608 100%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
    pointer-events: none;
}

.spell-category-tab-fold {
    position: absolute;
    top: -1px;
    right: 1px;
    z-index: 4;
    width: 11px;
    height: 15px;
    background: var(--bookmark-edge);
    clip-path: polygon(0 0, 100% 0, 100% 78%, 38% 78%, 38% 100%, 0 100%);
    filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.62));
    pointer-events: none;
}

.spell-category-tab-fold::after {
    content: '';
    position: absolute;
    inset: 2px 2px 3px 3px;
    background: #140b0f;
    clip-path: polygon(0 0, 100% 0, 100% 73%, 29% 73%, 29% 100%, 0 100%);
}

.spell-category-tab:hover:where(body:not(.gamepad-active) *),
.spell-category-tab:focus-visible,
.spell-category-tab.gamepad-selected {
    z-index: 4;
    filter: brightness(1.08);
    transform: translateY(2px);
}

.spell-category-tab:focus-visible,
.spell-category-tab.gamepad-selected {
    outline: 0;
    filter: brightness(1.12) drop-shadow(0 0 2px var(--bookmark-edge-active));
}

.spell-category-tab.is-active {
    z-index: 5;
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--tab-color, #8a7a6a) 24%, transparent));
    transform: translateY(4px);
}

.spell-category-tab.is-active::before {
    background: var(--bookmark-edge-active);
}

.spell-category-tab.is-active::after {
    background:
        radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--tab-color, #8a7a6a) 15%, transparent), transparent 54%),
        linear-gradient(180deg, #2a171d 0%, #180c11 62%, #0b0608 100%);
}

.spell-category-tab.is-active .spell-category-tab-fold {
    background: var(--bookmark-edge-active);
}

.spell-category-tab.gamepad-selected {
    --bookmark-edge-active: #d9b85f;
    filter:
        brightness(1.16)
        drop-shadow(0 0 2px rgba(255, 226, 142, 0.95))
        drop-shadow(0 0 6px rgba(197, 143, 46, 0.68));
}

.spell-category-tab.gamepad-selected::before {
    background: linear-gradient(90deg, #8d672d 0%, #e8ca76 28%, #b47e32 62%, #f0d98e 100%);
}

.spell-category-tab.gamepad-selected .spell-category-tab-fold {
    background: #d9b85f;
}

.spell-category-tab.is-active .spell-category-tab-icon {
    opacity: 1;
    filter:
        grayscale(0)
        sepia(0)
        saturate(1.04)
        brightness(1.12)
        contrast(1.1);
}

.spell-category-tab-icon {
    position: absolute;
    top: 3px;
    left: 6px;
    z-index: 2;
    display: block;
    width: calc(100% - 14px);
    height: calc(100% - 7px);
    object-fit: cover;
    object-position: center 34%;
    border: 0;
    border-radius: 0;
    box-sizing: border-box;
    opacity: 0.86;
    filter: grayscale(0.18) sepia(0.04) saturate(0.82) brightness(0.94) contrast(1.08);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
    transition: opacity 140ms ease, filter 140ms ease;
    pointer-events: none;
}

.spell-category-tab:hover:where(body:not(.gamepad-active) *) .spell-category-tab-icon,
.spell-category-tab:focus-visible .spell-category-tab-icon,
.spell-category-tab.gamepad-selected .spell-category-tab-icon {
    opacity: 1;
    filter: grayscale(0) saturate(1) brightness(1.06) contrast(1.08);
}

.spell-category-tab[data-category-id="all"] .spell-category-tab-icon {
    object-fit: contain;
    object-position: center top;
    clip-path: none;
}

.spell-category-tab-count {
    position: absolute;
    top: calc(12 * var(--menu-ui-pixel, 4px));
    left: 50%;
    z-index: 3;
    min-width: calc(7 * var(--menu-ui-pixel, 4px));
    height: calc(5 * var(--menu-ui-pixel, 4px));
    display: grid;
    place-items: center;
    padding: 1px 2px 0;
    box-sizing: border-box;
    color: #ad9870;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--bookmark-edge) 44%, transparent);
    border-radius: 0;
    background: linear-gradient(180deg, rgba(9, 5, 7, 0.28), rgba(9, 5, 7, 0.72));
    box-shadow: none;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: max(12px, calc(3 * var(--menu-ui-pixel, 4px)));
    line-height: 1;
    pointer-events: none;
    text-shadow: 0 1px 1px #000;
    transform: translateX(-50%);
}

.spell-category-tab.is-active .spell-category-tab-count {
    color: #dfc98e;
    border-top-color: color-mix(in srgb, var(--bookmark-edge-active) 64%, transparent);
}

.spell-category-divider {
    position: relative;
    align-self: stretch;
    z-index: 1;
    flex: 0 0 16px;
    min-width: 16px;
    margin: 6px 1px 2px;
    pointer-events: none;
}

.spell-category-divider::before {
    content: '';
    position: absolute;
    top: 2px;
    bottom: 6px;
    left: 50%;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(205, 168, 94, 0.75) 18%, rgba(205, 168, 94, 0.75) 82%, transparent);
    box-shadow: 1px 0 0 rgba(20, 11, 8, 0.9);
}

.spell-category-divider::after {
    content: '◆';
    position: absolute;
    top: 50%;
    left: 50%;
    padding: 3px 0;
    color: #d0aa60;
    background: #130c09;
    font-size: 7px;
    line-height: 1;
    text-shadow: 0 0 5px rgba(208, 170, 96, 0.55);
    transform: translate(-50%, -50%);
}

.artifact-category-tab {
    --bookmark-edge: color-mix(in srgb, var(--tab-color, #d6a84f) 24%, #795a42);
    --bookmark-edge-active: color-mix(in srgb, var(--tab-color, #d6a84f) 58%, #c3995e);
}

.spell-category-section[hidden] {
    display: none;
}

.spell-category-section.is-active {
    animation: spell-category-panel-in 180ms ease-out both;
}

.spell-category-section {
    padding: 10px 8px 14px;
}

.spell-category-section:not(.artifact-library-section):not([data-category-id="all"]),
.spell-school-section {
    border-left: 1px solid color-mix(in srgb, var(--header-color, #8a7a6a) 34%, transparent);
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--header-color, #8a7a6a) 6%, transparent), transparent 28%),
        rgba(0, 0, 0, 0.04);
}

#spell-category-panel-all { padding-inline: 0; }

.spell-school-section { padding: 10px 8px 14px; }

.spell-school-section + .spell-school-section {
    margin-top: 20px;
}

#spell-category-panel-all .spell-school-section .spell-category-title {
    font-size: clamp(18px, 1.1vw, 24px);
    color: var(--header-color);
}

.spell-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    justify-items: center;
    align-items: start;
    gap: 16px 12px;
    padding: 3px 5px 14px;
}

.spell-item,
.artifact-library-section .artifact-item {
    width: 118px;
    height: 166px;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    border-radius: 2px;
    transform-origin: 50% 100%;
    box-shadow: 0 9px 18px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.spell-category-grid > .card-library-item:nth-child(3n + 1) { transform: rotate(-0.7deg); }
.spell-category-grid > .card-library-item:nth-child(3n + 2) { transform: rotate(0deg); }
.spell-category-grid > .card-library-item:nth-child(3n + 3) { transform: rotate(0.7deg); }

.card-library-item:hover:where(body:not(.gamepad-active) *),
.card-library-item.gamepad-selected,
.card-library-item.btn-selected {
    transform: translateY(-8px) rotate(0deg) scale(1.04);
    z-index: 20;
}

.artifact-library-section .artifact-item.panel > .panel-texture {
    inset: 2px;
    opacity: 0.48;
    background:
        radial-gradient(circle at 50% 18%, color-mix(in srgb, var(--spell-color, #775b45) 24%, transparent), transparent 52%),
        linear-gradient(160deg, #251711 0%, #100a08 66%, #070505 100%);
}

.spell-item.panel > .panel-content.spell-icon {
    position: absolute;
    inset: 10px 9px 49px;
    width: auto;
    height: auto;
    padding: 0;
    background-size: cover;
    background-position: center;
    background-origin: border-box;
    border: 1px solid color-mix(in srgb, var(--spell-color, #8a7a6a) 45%, transparent);
    filter: saturate(0.82) brightness(0.78);
    box-shadow: inset 0 -18px 22px rgba(0, 0, 0, 0.38);
}

.artifact-library-section .artifact-item {
    --spell-color: var(--kit-diamond-color, #d6a84f);
}

.artifact-library-section .artifact-item.panel > .panel-content.artifact-icon {
    position: absolute;
    inset: 10px 9px 49px;
    width: auto;
    height: auto;
    padding: 8px;
    background-size: contain;
    background-position: center;
    background-origin: content-box;
    border: 1px solid color-mix(in srgb, var(--spell-color, #d6a84f) 45%, transparent);
    background-color: rgba(8, 6, 5, 0.7);
    filter: saturate(0.86) brightness(0.84);
    box-shadow:
        inset 0 0 28px color-mix(in srgb, var(--spell-color, #d6a84f) 16%, transparent),
        inset 0 -18px 22px rgba(0, 0, 0, 0.38);
}

.spell-item:hover:where(body:not(.gamepad-active) *) > .panel-content.spell-icon,
.spell-item.gamepad-selected > .panel-content.spell-icon,
.spell-item.btn-selected > .panel-content.spell-icon,
.artifact-library-section .artifact-item:hover:where(body:not(.gamepad-active) *) > .panel-content.artifact-icon,
.artifact-library-section .artifact-item.gamepad-selected > .panel-content.artifact-icon,
.artifact-library-section .artifact-item.btn-selected > .panel-content.artifact-icon {
    filter: saturate(1.08) brightness(1.04);
}

.spell-card-meta {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 7px;
    z-index: 4;
    height: 37px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 3px 4px 2px;
    color: #d2bd8c;
    border-top: 1px solid color-mix(in srgb, var(--spell-color, #8a7a6a) 46%, transparent);
    background: linear-gradient(180deg, rgba(10, 7, 6, 0.35), rgba(5, 4, 4, 0.8));
    pointer-events: none;
}

.spell-card-name {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 10px;
    line-height: 1.08;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 1px 2px #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spell-card-school {
    color: color-mix(in srgb, var(--spell-color, #9c8065) 68%, #c8b38a);
    font-size: 8px;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.artifact-card-meta {
    border-top-color: color-mix(in srgb, var(--spell-color, #d6a84f) 62%, transparent);
}

.artifact-card-rarity {
    color: color-mix(in srgb, var(--spell-color, #d6a84f) 76%, #dbc38f);
}

.artifact-rarity-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 2px 3px 10px;
}

.artifact-library-section .artifact-tier-section {
    margin: 0;
    padding: 5px 4px 7px;
    border-left: 1px solid color-mix(in srgb, var(--header-color, #8a7a6a) 34%, transparent);
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--header-color, #8a7a6a) 6%, transparent), transparent 28%),
        rgba(0, 0, 0, 0.04);
}

.artifact-library-section .artifact-tier-section::after {
    margin-top: 3px;
    opacity: 0.18;
}

.artifact-library-section .artifact-tier-header {
    gap: 7px;
    margin: 0 0 6px;
    padding: 4px 2px;
}

.artifact-library-section .artifact-tier-title {
    font-size: 10px;
    letter-spacing: 1.5px;
}

.artifact-library-section .artifact-tier-header .header-diamond {
    font-size: 9px;
    opacity: 0.55;
}

.artifact-rarity-count {
    min-width: 17px;
    height: 15px;
    display: grid;
    place-items: center;
    padding: 0 2px;
    box-sizing: border-box;
    color: color-mix(in srgb, var(--header-color, #d6a84f) 58%, #c9b487);
    border: 1px solid color-mix(in srgb, var(--header-color, #d6a84f) 28%, #5d4432);
    background: rgba(8, 4, 7, 0.82);
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 7px;
    line-height: 1;
}

.artifact-library-section .artifact-tier-grid {
    margin: 0;
    padding: 3px 3px 8px;
}

.card-library-empty {
    grid-column: 1 / -1;
    width: 100%;
    padding: 24px 12px;
    box-sizing: border-box;
    color: #9f8a70;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(10px, 0.75vw, 13px);
    text-align: center;
}

.spell-category-section > .card-library-empty {
    color: #bba990;
    font-size: clamp(18px, 1.1vw, 24px);
    line-height: 1.4;
}

.spell-item .spell-mutability-badge {
    top: 6px;
    right: 7px;
    padding: 2px 3px;
    background: rgba(5, 4, 4, 0.78);
    border: 1px solid rgba(255, 215, 0, 0.35);
    font-size: 11px;
}

@keyframes spell-category-panel-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spell-category-tab,
    .spell-category-tab-icon,
    .spell-category-section.is-active {
        transition: none;
        animation: none;
    }
}

@media (max-width: 1920px) {
    .character-hub-container {
        max-width: 94vw;
        height: 90vh;
    }

    .equipped-card-list--skills {
        grid-template-columns: repeat(4, 102px);
    }

    .equipped-card-list {
        gap: 7px;
    }

    .equipped-card-slot {
        width: 102px;
        height: 144px;
    }

    .spell-category-grid {
        grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
        gap: 13px 9px;
    }

    .spell-item,
    .artifact-library-section .artifact-item {
        width: 102px;
        height: 144px;
    }

    .spell-card-name { font-size: 9px; }
    .spell-card-school { font-size: 7px; }
}

@media (max-width: 1366px) {
    .character-hub-container {
        width: 97%;
        max-width: 97vw;
        height: 92vh;
        grid-template-columns: minmax(350px, 2fr) auto minmax(0, 3fr);
        padding: 20px;
    }

    .navigation-section {
        gap: 1vw;
        padding: 1vw;
    }

    .equipped-card-list--skills {
        grid-template-columns: repeat(4, 88px);
    }

    .equipped-card-list {
        gap: 6px;
    }

    .equipped-card-slot {
        width: 88px;
        height: 124px;
    }

    .deck-card-name { font-size: 8px; }

    .spell-category-grid {
        grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
        gap: 11px 7px;
    }

    .spell-item,
    .artifact-library-section .artifact-item {
        width: 88px;
        height: 124px;
    }

    .spell-item.panel > .panel-content.spell-icon,
    .artifact-library-section .artifact-item.panel > .panel-content.artifact-icon {
        inset: 8px 7px 43px;
    }

    .spell-card-meta {
        left: 6px;
        right: 6px;
        bottom: 6px;
        height: 33px;
    }
}

@media (max-width: 1280px) {
    .character-hub-container {
        width: 98%;
        max-width: 98vw;
        height: 94vh;
        grid-template-columns: minmax(330px, 2fr) auto minmax(0, 3fr);
        padding: 16px;
    }

    .equipped-card-list--skills {
        grid-template-columns: repeat(4, 82px);
    }

    .equipped-card-list {
        gap: 5px;
    }

    .equipped-card-slot {
        width: 82px;
        height: 115px;
    }

    .spell-category-grid {
        grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
    }

    .spell-item,
    .artifact-library-section .artifact-item {
        width: 82px;
        height: 115px;
    }
}

@media (max-height: 960px) {
    .character-profile-summary {
        padding-top: 42px;
    }

    .character-hub-container .hero-divider.divider-h {
        margin: 9px 0 12px;
    }
}
