/* game made by Juan Gonzalez 30/12/2025, don´t steal my code */
:root {
    --bg-color: #050505;
    --text-color: #e0e0e0;
    --accent-color: #9d00ff;
    --accent-glow: #bd00ff;
    --secondary-color: #00e5ff;
    --danger-color: #ff0055;
    --legendary-color: #C0C0C0;
    --legendary-glow: rgba(192, 192, 192, 0.4);
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.hidden {
    display: none !important;
}

.active {
    display: flex !important;
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

#main-menu {
    justify-content: center;
    align-items: center;
    text-align: center;
}

#level-select {
    justify-content: center;
    align-items: center;
}

#level-select>h3 {
    margin: 60px 0 30px 0;
    font-size: 1.1rem;
    letter-spacing: 5px;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
}

/* Typography */
h1.title {
    font-size: 4rem;
    letter-spacing: 0.5rem;
    color: transparent;
    -webkit-text-stroke: 2px var(--accent-color);
    text-shadow: 0 0 20px var(--accent-color);
    margin-bottom: 3rem;
    animation: pulse 3s infinite;
    text-align: center;
}

h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.2rem;
}

/* Buttons */
.btn {
    padding: 1rem 3rem;
    font-size: 1.5rem;
    background: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn:hover:not(:disabled) {
    background: var(--accent-color);
    color: #fff;
    box-shadow: 0 0 30px var(--accent-glow);
}

.btn-small {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--text-color);
    color: var(--text-color);
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.2s;
}

.btn-small:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

#back-to-menu {
    font-family: 'Courier New', Courier, monospace;
    color: var(--accent-color);
    border-color: rgba(157, 0, 255, 0.4);
    background: rgba(157, 0, 255, 0.05);
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#back-to-menu:hover {
    background: rgba(157, 0, 255, 0.2);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(157, 0, 255, 0.3);
    color: #fff;
    transform: scale(1.05);
}

/* Level Select */
.level-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.level-btn {
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    font-size: 1.4rem;
    font-weight: 800;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
}

.level-btn:hover {
    background: rgba(157, 0, 255, 0.1);
    box-shadow: 0 0 20px var(--accent-color);
    transform: scale(1.05);
}

.level-btn.locked {
    background: rgba(30, 30, 30, 0.5);
    color: #555;
    cursor: not-allowed;
    border-color: #444;
    opacity: 0.6;
    transform: none;
}

.level-btn.locked:hover {
    box-shadow: none;
    background: rgba(30, 30, 30, 0.5);
    transform: none;
    color: #555;
}

/* Game Screen */
#game-screen {
    background: #050510;
}

canvas {
    background: transparent;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    image-rendering: pixelated; /* --- PIXEL ART FIDELITY: Sharp upscaling --- */
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

#ui-layer>* {
    pointer-events: auto;
}

/* --- Unified Top Info Bar --- */
#top-info-bar {
    width: 100%;
    height: 80px;
    background: rgba(5, 5, 12, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 2px solid rgba(157, 0, 255, 0.3);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(157, 0, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    pointer-events: auto;
    position: relative;
    z-index: 100;
}

.top-bar-section {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 100%;
}

/* 1. Corruption Section */
.corruption-section {
    width: 300px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 4px;
}

.corruption-text {
    font-size: 1rem;
    /* Bigger */
    color: #bd00ff;
    font-weight: 800;
    /* Bolder */
    letter-spacing: 3px;
    /* Stretched to fit bar */
    text-shadow: 0 0 10px #bd00ff;
    margin-left: 2px;
    margin-top: 4px;
    /* Space from bar */
    width: 100%;
    text-align: center;
}

.corruption-meter {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #550088;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 10px rgba(157, 0, 255, 0.2);
}

#corruption-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6600cc, #d500ff);
    box-shadow: 0 0 10px #d500ff;
    transition: width 0.3s ease-out;
}

/* 2. Stats Section */
.stats-section {
    flex: 1;
    justify-content: center;
    gap: 30px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 130px;
    height: 64px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.3));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.3));
}

/* Card Borders */
.card-lives {
    border-top: 2px solid #00ffaa;
    box-shadow: 0 -2px 10px rgba(0, 255, 170, 0.1);
}

.card-wave {
    border-top: 2px solid #00e5ff;
    box-shadow: 0 -2px 10px rgba(0, 229, 255, 0.1);
}

.card-time {
    border-top: 2px solid #ffd700;
    box-shadow: 0 -2px 10px rgba(255, 235, 59, 0.1);
}

.card-matter {
    border-top: 2px solid #bd00ff;
    box-shadow: 0 -2px 10px rgba(189, 0, 255, 0.1);
}

.card-label {
    font-size: 0.9rem;
    /* Increased size */
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.card-value {
    font-size: 1.9rem;
    /* Reduced size */
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    font-family: 'Segoe UI', sans-serif;
    line-height: 1;
}

/* Specific Stat Colors */
#lives-display {
    color: #00ffaa;
    text-shadow: 0 0 10px rgba(0, 255, 170, 0.4);
}

#wave-display {
    color: #00e5ff;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

#wave-timer-display {
    color: #ffeb3b;
    text-shadow: 0 0 10px rgba(255, 235, 59, 0.4);
}

#energy-display {
    color: #bd00ff;
    text-shadow: 0 0 10px rgba(189, 0, 255, 0.4);
}

.loss-indicator {
    position: absolute;
    right: -45px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff0055;
    font-size: 1.6rem;
    font-weight: 800;
    pointer-events: none;
    opacity: 0;
    white-space: nowrap;
    text-shadow: 0 0 10px rgba(255, 0, 85, 0.5);
    z-index: 10;
}

@keyframes lossFadeUp {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }

    10% {
        opacity: 1;
        transform: translateY(-50%) scale(1.2);
    }

    20% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-180%) translateX(15px) scale(0.8);
    }
}

.loss-indicator.animate {
    animation: lossFadeUp 1s ease-out forwards;
}

.time-module .stat-value {
    font-variant-numeric: tabular-nums;
    min-width: 60px;
    text-align: center;
}

/* 3. Controls Section */
/* 3. Controls Section */
.controls-section {
    display: flex;
    align-items: center;
    /* Crucial for vertical centering */
    justify-content: flex-end;
    gap: 20px;
    height: 100%;
    width: 300px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    /* Force circle */
    color: #fff;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    outline: none;
    /* Remove focus ring */
    margin: 0;
    /* Remove defaults */
    padding: 0;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}




/* Tooltip Override */
.corruption-tooltip {
    position: absolute;
    /* Relative to section */
    top: 60px;
    left: 0;
    width: 220px;
    background: rgba(10, 5, 20, 0.95);
    border: 1px solid #9d00ff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(157, 0, 255, 0.2);
    z-index: 200;
    backdrop-filter: blur(10px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(-10px);
}

.corruption-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.tooltip-title {
    color: #fff;
    font-weight: bold;
    border-bottom: 1px solid #9d00ff;
    padding-bottom: 5px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.tooltip-stat {
    color: #ccc;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

/* --- Tower UI (Top Center) --- */
#controls-layer {
    position: absolute;
    top: 95px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(5, 5, 12, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 20px 15px 20px;
    border: 1px solid rgba(157, 0, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(157, 0, 255, 0.1);
    z-index: 50;
    transition: all 0.3s ease;
}

.tower-selector-container {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.ui-panel-header {
    font-size: 0.75rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(157, 0, 255, 0.5);
    margin-bottom: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: color 0.2s;
}

.ui-panel-header:hover {
    color: #fff;
}

.ui-panel-header::before,
.ui-panel-header::after {
    content: '▲';
    font-size: 0.6rem;
    color: var(--secondary-color);
    text-shadow: 0 0 5px var(--secondary-color);
}

#controls-layer.minimized .ui-panel-header::before,
#controls-layer.minimized .ui-panel-header::after {
    content: '▼';
}

#controls-layer.minimized .tower-selector-container {
    display: none;
}

#controls-layer.minimized {
    padding-bottom: 10px;
    border-radius: 12px;
}

.hotkey-indicator {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #000;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 900;
    z-index: 10;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.tower-selector {
    width: 65px;
    height: 65px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: rgba(20, 20, 30, 0.4);
}

.tower-selector:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.tower-selector.selected {
    border-color: var(--secondary-color);
    background: rgba(0, 229, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

.tower-icon-img {
    width: 80%;
    height: 80%;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

/* Modal */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 15000;
}

/* Glass Panels */
.glass-panel {
    background: rgba(5, 5, 12, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(157, 0, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8),
        inset 0 0 15px rgba(157, 0, 255, 0.1);
}

.menu-container {
    padding: 40px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 400px;
    animation: menuFadeIn 0.3s ease-out;
}

@keyframes menuFadeIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin-top: 20px;
}

.menu-container {
    pointer-events: auto; /* Ensure sub-panels are clickable even if modal is transparent */
}

/* --- Pause Bar Redesign --- */
#pause-modal {
    background: transparent !important;
    backdrop-filter: none !important;
    pointer-events: none;
}

#pause-modal .pause-bar {
    position: absolute;
    top: 95px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    padding: 10px 40px;
    min-width: unset;
    width: auto;
    gap: 40px;
    border: 2px solid rgba(157, 0, 255, 0.5);
    border-radius: 15px;
    margin-top: 0;
    background: rgba(5, 5, 12, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(157, 0, 255, 0.2);
    animation: barSlideDown 0.3s ease-out;
}

@keyframes barSlideDown {
    from { transform: translate(-50%, -20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

#pause-modal .pause-bar .pause-title {
    font-size: 1.4rem;
    margin-bottom: 0;
    color: var(--secondary-color);
    letter-spacing: 3px;
    white-space: nowrap;
    text-shadow: 0 0 10px var(--secondary-color);
}

#pause-modal .pause-bar .menu-buttons {
    flex-direction: row;
    margin-top: 0;
    gap: 15px;
    width: auto;
}

#pause-modal .pause-bar .menu-buttons .btn {
    padding: 8px 24px;
    font-size: 0.9rem;
    min-width: 110px;
    width: auto !important;
    letter-spacing: 1px;
}

.menu-buttons .btn {
    width: 100%;
}

/* Volume Controls */
.volume-controls {
    width: 100%;
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.volume-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.volume-label {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--secondary-color);
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.vol-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.vol-btn:hover {
    color: #fff;
    transform: scale(1.2);
}

.dashboard-main-content {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 30px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.volume-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.volume-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--secondary-color));
    box-shadow: 0 0 10px var(--accent-color);
    transition: width 0.2s ease;
}

.vol-text {
    min-width: 20px;
    text-align: right;
    font-weight: bold;
    color: #fff;
    font-family: monospace;
}


@keyframes pulse {
    0% {
        opacity: 0.8;
        text-shadow: 0 0 20px var(--accent-color);
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 40px var(--accent-color);
    }

    100% {
        opacity: 0.8;
        text-shadow: 0 0 20px var(--accent-color);
    }
}

/* --- Hero UI (Bottom Left) --- */
#hero-panel {
    position: absolute;
    bottom: 25px;
    left: 25px;
    display: flex;
    gap: 20px;
    align-items: center;
    background: rgba(5, 5, 12, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px 25px;
    border: 1px solid rgba(157, 0, 255, 0.3);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(157, 0, 255, 0.1);
    pointer-events: auto;
    z-index: 100;
    overflow: visible !important; /* Force visibility to prevent clipping of animated elements */
}

.hero-portrait {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.4));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    overflow: visible !important; /* Force visible to prevent feet clipping */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-portrait:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(157, 0, 255, 0.4);
    transform: scale(1.05);
}

.hero-portrait.selected {
    border-color: #fff;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.3);
}

#hero-level {
    position: absolute;
    bottom: -8px;
    right: -8px;
    background: #000;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 10px rgba(157, 0, 255, 0.5);
    z-index: 10;
    min-width: 24px;
    text-align: center;
}

.hero-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 200px;
}

.bar-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-stats .bar-container:nth-child(1) {
    height: 22px;
}

.hero-stats .bar-container:nth-child(2) {
    height: 20px;
}

.hero-stats .bar-container:nth-child(3) {
    height: 6px;
}

.hero-stats .bar-container:nth-child(4) {
    height: 6px;
    margin-top: -2px;
    /* Pull it closer to the first XP bar */
}

.bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    font-size: 0.85rem;
    color: #fff;
    text-shadow: 1px 1px 2px #000, 0 0 5px rgba(0, 0, 0, 0.8);
    font-weight: 900;
    letter-spacing: 1px;
    font-family: 'Segoe UI', sans-serif;
    pointer-events: none;
}

.bar {
    height: 100%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hp-bar {
    background: linear-gradient(90deg, #ff0055, #ff3377);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}

.mana-bar {
    background: linear-gradient(90deg, #0077ff, #00e5ff);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

.xp-bar {
    background: linear-gradient(90deg, #ffd700, #ffaa00);
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

.perm-xp-bar-mini {
    background: linear-gradient(90deg, #00e5ff, #9d00ff);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.btn-inventory {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin-left: 10px;
}

.btn-inventory:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.btn-inventory:active {
    transform: scale(0.95);
}

/* Notification Badges */
.notif-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background: #ff0055;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.6);
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    pointer-events: none;
    animation: notifBadgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

#btn-inventory-toggle .notif-badge {
    background: #00e5ff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

#btn-perm-skills-toggle .notif-badge {
    background: #d400ff;
    box-shadow: 0 0 10px rgba(212, 0, 255, 0.6);
}

@keyframes notifBadgePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Pulsing Animations */
.notif-pulse.inventory {
    animation: pulseInventory 1.5s infinite alternate;
    border-color: #00e5ff !important;
}

.notif-pulse.skills {
    animation: pulseSkills 1.5s infinite alternate;
    border-color: #d400ff !important;
}

@keyframes pulseInventory {
    from {
        box-shadow: 0 0 5px rgba(0, 229, 255, 0.3);
        background: rgba(0, 229, 255, 0.05);
        transform: scale(1);
    }

    to {
        box-shadow: 0 0 20px rgba(0, 229, 255, 0.7), inset 0 0 10px rgba(0, 229, 255, 0.3);
        background: rgba(0, 229, 255, 0.15);
        transform: scale(1.05);
    }
}

@keyframes pulseSkills {
    from {
        box-shadow: 0 0 5px rgba(212, 0, 255, 0.3);
        background: rgba(212, 0, 255, 0.05);
        transform: scale(1);
    }

    to {
        box-shadow: 0 0 20px rgba(212, 0, 255, 0.7), inset 0 0 10px rgba(212, 0, 255, 0.3);
        background: rgba(212, 0, 255, 0.15);
        transform: scale(1.05);
    }
}

.btn-inventory.notif-pulse {
    will-change: transform, box-shadow, background;
}


/* Legacy card-container removed to avoid conflicts */

/* Upgrade Cards & Level Up Modal */
#level-up-modal {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 20000;
    border: none !important;
    box-shadow: none !important;
}

#level-up-modal h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    color: #00e5ff;
    letter-spacing: 8px;
    margin-bottom: 30px;
    text-align: center;
    width: 100%;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.5), 2px 2px #bd00ff, -2px -2px #00ffaa;
    animation: labelPulse 2s ease-in-out infinite, headerGlitch 5s step-end infinite;
}

@keyframes headerGlitch {

    0%,
    95% {
        transform: skew(0deg);
        filter: hue-rotate(0deg);
    }

    96% {
        transform: skew(2deg) translateX(5px);
        filter: hue-rotate(90deg);
    }

    97% {
        transform: skew(-3deg) translateX(-5px);
        filter: hue-rotate(180deg);
    }

    98% {
        transform: skew(1deg) translateX(2px);
        filter: hue-rotate(270deg);
    }

    99% {
        transform: skew(-1deg);
        filter: hue-rotate(360deg);
    }
}

@keyframes labelPulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
        text-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
    }

    50% {
        transform: scale(1.02);
        opacity: 1;
        text-shadow: 0 0 40px rgba(0, 229, 255, 0.8);
    }

    100% {
        transform: scale(1);
        opacity: 0.9;
        text-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
    }
}

.level-up-content {
    width: 100%;
    max-width: 1250px;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: visible;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Removed stray horizontal line artifact */
.level-up-content .scan-line {
    display: none !important;
}

/* Removed scan lines gradient from here */

.card-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    perspective: 1000px;
}

.upgrade-card {
    width: 250px;
    height: 425px;
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 10px;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.upgrade-card::before {
    content: '';
    position: absolute;
    inset: 6px;
    pointer-events: none;
    background:
        linear-gradient(to right, #00e5ff 15px, transparent 15px) 0 0 / 100% 2px no-repeat,
        linear-gradient(to bottom, #00e5ff 15px, transparent 15px) 0 0 / 2px 100% no-repeat,
        linear-gradient(to left, #00e5ff 15px, transparent 15px) 100% 0 / 100% 2px no-repeat,
        linear-gradient(to bottom, #00e5ff 15px, transparent 15px) 100% 0 / 2px 100% no-repeat,
        linear-gradient(to right, #00e5ff 15px, transparent 15px) 0 100% / 100% 2px no-repeat,
        linear-gradient(to top, #00e5ff 15px, transparent 15px) 0 100% / 2px 100% no-repeat,
        linear-gradient(to left, #00e5ff 15px, transparent 15px) 100% 100% / 100% 2px no-repeat,
        linear-gradient(to top, #00e5ff 15px, transparent 15px) 100% 100% / 2px 100% no-repeat;
    opacity: 0.4;
    transition: opacity 0.3s, scale 0.3s;
}

.upgrade-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: #00e5ff;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 229, 255, 0.3);
    background: rgba(20, 20, 35, 0.95);
}

.upgrade-card:hover::before {
    opacity: 0.8;
}

.upgrade-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(125deg, transparent 40%, rgba(255, 255, 255, 0.1) 45%, rgba(0, 229, 255, 0.15) 50%, rgba(255, 255, 255, 0.1) 55%, transparent 60%);
    background-size: 300% 300%;
    background-position: 100% 100%;
    transition: background-position 0.6s ease;
    pointer-events: none;
}

.upgrade-card:hover::after {
    background-position: 0% 0%;
}

.card-type-tag {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 900;
    border-radius: 4px;
    letter-spacing: 1px;
    text-shadow: 1px 1px 0 #000;
    z-index: 50;
    /* Top layer */
}

.card-type-tag.active {
    background: rgba(255, 0, 85, 0.6);
    color: #fff;
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.4);
}

.card-type-tag.passive {
    background: rgba(0, 229, 255, 0.6);
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.card-icon-wrapper {
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    transition: all 0.3s;
    position: relative;
    z-index: 5;
}

.upgrade-card:hover .card-icon-wrapper {
    border-color: #00e5ff;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
    transform: scale(1.1);
}

.card-title {
    font-family: 'Segoe UI', sans-serif;
    font-size: 1.15rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.card-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    margin-bottom: 15px;
    min-height: 42px;
    z-index: 5;
}

.card-stats-container {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 5;
}

.card-level {
    margin-top: auto;
    font-size: 0.75rem;
    font-weight: bold;
    color: rgba(0, 229, 255, 0.6);
    letter-spacing: 2px;
    text-transform: uppercase;
    z-index: 5;
}

.tower-selector {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    cursor: pointer;
    border: 2px solid #333;
    border-radius: 8px;
    transition: all 0.2s;
    position: relative;
    background: rgba(0, 0, 0, 0.8);
}

.tower-selector:hover {
    border-color: #fff;
    background: rgba(20, 20, 30, 0.9);
}

.tower-selector.selected {
    border-color: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
}

.tower-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

/* Legacy Modal definition removed */

@keyframes pulse {
    0% {
        opacity: 0.8;
        text-shadow: 0 0 20px var(--accent-color);
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 40px var(--accent-color);
    }

    100% {
        opacity: 0.8;
        text-shadow: 0 0 20px var(--accent-color);
    }
}





/* Legacy Upgrade Card styles removed to avoid conflicts with premium diagnostic UI */




/* --- Skill UI (Bottom Center) --- */
#skill-bar-container {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    /* Reduced gap */
    background: rgba(5, 5, 12, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 11px 30px;
    /* Adjusted padding to match hero-panel height */
    border: 1px solid rgba(157, 0, 255, 0.3);
    border-radius: 15px;
    /* Match hero-panel radius */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(157, 0, 255, 0.1);
    z-index: 100;
    pointer-events: auto;
}

#skill-bar {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

.skill-group-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.skill-group-label {
    font-size: 0.75rem;
    /* Match towers */
    font-weight: 800;
    /* Match towers */
    color: rgba(255, 255, 255, 0.6);
    /* Match towers */
    letter-spacing: 3px;
    /* Match towers */
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(157, 0, 255, 0.5);
    /* Match towers */
}

.skill-group {
    display: flex;
    gap: 12px;
}

.skill-slot,
.passive-slot {
    width: 60px;
    height: 60px;
    background: rgba(20, 20, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    position: relative;
    /* overflow: hidden; */
    /* Allow circular hotkey to overflow */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.skill-slot:hover,
.passive-slot:hover {
    border-color: var(--accent-color);
    background: rgba(157, 0, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.skill-key {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #000;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 900;
    z-index: 15;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.skill-icon {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    z-index: 10;
    border-radius: 12px;
    /* Maintain rounding within slot */
    overflow: hidden;
    /* Contain icon within slot borders */
}

.skill-cooldown {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(157, 0, 255, 0.4);
    backdrop-filter: grayscale(1);
    transition: height 0.1s linear;
    z-index: 12;
    border-radius: 0 0 12px 12px;
    /* Bottom rounding to match slot */
}

.skill-timer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 5px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 15;
}

@keyframes skill-ready-glow {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    30% {
        transform: scale(1.05);
        filter: brightness(2.0) drop-shadow(0 0 7px #fff);
    }

    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

/* Rarity Specific Visual Effects (Optimized for performance) */
.rarity-normal {
    color: #ffffff;
    opacity: 0.9;
}

.rarity-magic {
    color: #00ffff;
    animation: rarityMagicPulse 3s infinite ease-in-out;
    will-change: opacity, transform;
}

.rarity-rare {
    color: #ffff00;
    animation: rarityRarePulse 1.5s infinite ease-in-out;
    will-change: opacity, transform;
    text-shadow: 0 0 5px rgba(255, 255, 0, 0.3);
}

.rarity-epic {
    color: #bf00ff;
    position: relative;
    animation: rarityEpicSweep 4s infinite linear;
    text-shadow: 0 0 8px rgba(191, 0, 255, 0.5);
}

.rarity-legendary {
    color: #c0c0c0;
    font-weight: bold;
    animation: rarityLegendaryAura 5s infinite ease-in-out;
    will-change: transform, filter;
}

.rarity-unique {
    color: #ffd700;
    font-weight: bold;
    animation: rarityUniqueFlux 3s infinite ease-in-out;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

@keyframes rarityMagicPulse {

    0%,
    100% {
        opacity: 0.8;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

@keyframes rarityRarePulse {

    0%,
    100% {
        opacity: 0.8;
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

@keyframes rarityEpicSweep {

    0%,
    100% {
        filter: hue-rotate(0deg);
        opacity: 0.9;
    }

    50% {
        filter: hue-rotate(20deg);
        opacity: 1;
    }
}

@keyframes rarityLegendaryAura {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px #c0c0c0);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 15px #c0c0c0);
        opacity: 1;
    }
}

@keyframes rarityUniqueFlux {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1) drop-shadow(0 0 8px #ffd700);
        text-shadow: 0 0 5px #ffd700;
    }

    25% {
        transform: scale(1.05) skewX(-2deg);
        filter: brightness(1.3) drop-shadow(0 0 15px #ffd700);
    }

    50% {
        transform: scale(1.1);
        filter: brightness(1.6) drop-shadow(0 0 25px #ffd700);
        text-shadow: 0 0 15px #ffd700;
    }

    75% {
        transform: scale(1.05) skewX(2deg);
        filter: brightness(1.3) drop-shadow(0 0 15px #ffd700);
    }
}

.skill-ready {
    animation: skill-ready-glow 0.8s ease-out;
}

/* Skill Level Pips */
.skill-level-pips {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 20;
    padding: 2px 4px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

.level-pip {
    width: 6px;
    height: 3px;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.5);
}

.level-pip.filled {
    background: #ffd700;
    box-shadow: 0 0 5px #ffd700, inset 0 0 2px rgba(0, 0, 0, 0.3);
}

.skill-divider {
    width: 1px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    align-self: center;
    margin-top: 20px;
}



.passive-slot.has-skill {
    border-color: #ffd700;
    /* Gold border for passives */
    background: rgba(50, 40, 0, 0.8);
}

/* Tower Detail Panel */
/* Tower Detail Panel */
/* Tower Detail Panel */
#tower-detail-panel {
    position: absolute;
    /* Position will be set by JS */
    width: 300px;
    background: rgba(8, 8, 12, 0.98);
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.9), 0 0 10px rgba(157, 0, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(15px);
    z-index: 1000;
    font-size: 0.85rem;
    pointer-events: auto;
    /* Removed max-height/overflow to avoid scroll */
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
    margin-bottom: 0;
}

#tower-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
}

.tower-name-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#tower-tier-badge {
    background: var(--secondary-color);
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 900;
    font-size: 0.7rem;
    display: inline-block;
    align-self: flex-start;
}

.close-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    margin-left: auto;
    padding: 0 5px;
}

.close-btn:hover {
    color: #fff;
    text-shadow: 0 0 10px #fff;
}

.panel-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-section h3 {
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-left: 2px solid var(--accent-color);
    padding-left: 5px;
}

/* Stats Grid */
.stats-section .stat-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 5px;
}

.stat-box-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 4px;
}

.stat-label {
    font-size: 0.65rem;
    color: #aaa;
}

.stat-value {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: bold;
}

/* Upgrade Section */
.upgrade-info {
    text-align: center;
    font-size: 0.8rem;
    color: #ccc;
    margin-bottom: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 4px;
}

.btn-upgrade {
    width: 100%;
    background: linear-gradient(90deg, #2a0a38, #3a0a4d);
    border: 1px solid var(--accent-color);
    color: #fff;
    padding: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    text-transform: uppercase;
    transition: all 0.2s;
    border-radius: 4px;
    text-shadow: 0 0 5px var(--accent-color);
}

.btn-upgrade:hover:not(:disabled) {
    background: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

.btn-upgrade:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #222;
    border-color: #444;
    box-shadow: none;
}

/* Skill Tree */
.skill-choices {
    display: flex;
    gap: 8px;
}

.skill-choice-btn {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #444;
    padding: 8px 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s;
    border-radius: 6px;
}

.skill-choice-btn:hover {
    border-color: var(--secondary-color);
    background: rgba(0, 229, 255, 0.05);
}

.skill-choice-btn .icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.skill-choice-btn .name {
    font-size: 0.7rem;
    font-weight: bold;
    color: #ddd;
    text-align: center;
}

.skill-choice-btn .desc {
    font-size: 0.6rem;
    color: #aaa;
    text-align: center;
    margin-top: 4px;
    line-height: 1.2;
}

.skill-choice-btn .unlock-cost {
    font-size: 0.7rem;
    color: #ffd700;
    font-weight: bold;
    margin-top: 6px;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

/* Active Skill */
.skill-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.skill-next-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #bbb;
    text-align: center;
    margin-bottom: 5px;
}

.btn-sell {
    width: 100%;
    background: rgba(40, 0, 0, 0.6);
    border: 1px solid #600;
    color: #ff6666;
    padding: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: bold;
    transition: all 0.2s;
    border-radius: 4px;
}

.btn-sell:hover {
    background: #900;
    color: #fff;
    border-color: #f00;
}

/* Hero Selection */
.hero-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.hero-card {
    background: rgba(0, 20, 40, 0.8);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 15px;
    width: 150px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.hero-card:hover {
    border-color: #ff0000;
    transform: translateY(-5px);
}

.hero-card.selected {
    border-color: #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
    background: rgba(0, 40, 20, 0.9);
}

.hero-card-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    border: none; /* Removed redundant square border */
    border-radius: 0;
}

.hero-icon {
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: radial-gradient(circle, rgba(255, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    overflow: visible !important; /* Allow animations to overlap outside the icon bounds */
}

.warrior-idle-preview {
    width: 128px;
    height: 120px;
    background-image: url('assets/animations/warrior/warrioridle.png');
    background-size: 1024px 112px;
    background-repeat: no-repeat;
    animation: heroSelectIdle 0.8s steps(8) infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    /* Aggressive calibration for Hero Selection screen (80x80 container) */
    transform: translate(calc(-50% + 32px), calc(-50% - 12px)) scale(1.3);
    image-rendering: pixelated;
    filter: drop-shadow(0 0 8px rgba(255, 0, 0, 0.5));
}

/* Specific calibration for the HUD Portrait (70x70 container) */
.warrior-idle-preview.hud-portrait {
    transform: translate(calc(-50% + 5px), calc(-50% + 5px)) scale(1.15);
    filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.6));
}

/* Specific calibration for the Hero Selection Cards (80x80 container) */
.warrior-idle-preview.select-portrait {
    transform: translate(calc(-50% + 8px), calc(-50% + 10px)) scale(1.2);
    filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.4));
}

@keyframes heroSelectIdle {
    from { background-position: 0 0; }
    to { background-position: -1024px 0; }
}

.hero-card-name {
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.hero-card-class {
    font-size: 12px;
    color: #aaa;
}

/* Character UI */
#character-ui {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 640px;
    height: 520px;
    background: linear-gradient(135deg, rgba(15, 10, 25, 0.9), rgba(5, 5, 15, 0.98));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--accent-color);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(157, 0, 255, 0.2);
    z-index: 2000;
    pointer-events: auto;
    overflow: visible;
}

.c-header {
    background: rgba(157, 0, 255, 0.1);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(157, 0, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.c-header h2 {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin: 0;
    letter-spacing: 3px;
    font-weight: 800;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--secondary-color);
}

.c-body {
    flex: 1;
    display: grid;
    grid-template-columns: 150px 1fr 200px;
    padding: 10px;
    gap: 8px;
    overflow: hidden;
}

/* Augmentation Compact Section */
.aug-section {
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(157, 0, 255, 0.2);
    border-radius: 10px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aug-label {
    font-size: 0.55rem;
    color: rgba(0, 229, 255, 0.8); /* Faded label text */
    margin: 0;
    letter-spacing: 1px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
}

/* Tooltip styles */
.aug-help-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    pointer-events: auto;
}

.aug-help-icon {
    width: 14px;
    height: 14px;
    border: 1px solid var(--secondary-color);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    cursor: help;
    transition: all 0.2s;
    background: rgba(0, 229, 255, 0.1);
}

.aug-help-icon:hover {
    background: var(--secondary-color);
    color: #000;
    box-shadow: 0 0 10px var(--secondary-color);
}

.aug-help-tooltip {
    position: absolute;
    bottom: 25px;
    right: 0;
    width: 260px;
    background: #0a0514; /* Solid opaque background */
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9), 0 0 15px rgba(157, 0, 255, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    text-align: left;
    transform: translateY(10px);
}

.aug-help-wrapper:hover .aug-help-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.aug-help-tooltip .tooltip-title {
    color: var(--secondary-color);
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 1px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(157, 0, 255, 0.3);
    padding-bottom: 4px;
}

.aug-help-tooltip .tooltip-row {
    font-size: 0.7rem;
    color: #fff;
    margin-bottom: 6px;
    line-height: 1.3;
    letter-spacing: 0.3px;
}

.aug-help-tooltip .safe { color: #00ffa3; font-weight: 700; }
.aug-help-tooltip .risk { color: #ff3366; font-weight: 700; }
.aug-help-tooltip .milestone { color: #ffd700; font-weight: 700; }


.aug-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.aug-main-row {
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    gap: 8px;
}

.aug-slot-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 65px;
    min-height: 65px;
}

.aug-slot {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.2rem !important;
    border-width: 2px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border-radius: 8px;
    /* Match inv-slot */
}

.aug-placeholder {
    color: rgba(255, 255, 255, 0.1);
    font-size: 2rem;
    pointer-events: none;
}

.aug-status {
    margin-top: 5px;
    font-size: 0.55rem;
    font-weight: bold;
    height: 15px;
    text-align: center;
}

.aug-info {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.aug-resource {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.aug-crystal-icon-wrapper {
    width: 24px;
    height: 24px;
}

.aug-crystal-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#aug-crystal-count {
    color: #00e5ff;
    font-weight: bold;
    font-size: 1rem;
}

.aug-stat-row {
    font-size: 0.7rem;
    color: #aaa;
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.aug-stat-row .val {
    color: #fff;
    font-weight: bold;
}

.aug-btn {
    width: 100% !important;
    padding: 4px 4px !important;
    font-size: 0.75rem !important;
    letter-spacing: 1px !important;
    height: 27px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease !important;
}

.aug-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 0 10px rgba(157, 0, 255, 0.3) !important;
    transform: translateY(-1px) !important;
    color: inherit !important;
}

.aug-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: #444 !important;
    color: #666 !important;
    background: rgba(0, 0, 0, 0.2) !important;
    box-shadow: none !important;
}

/* Animations */
/* Augmentation Animations */
@keyframes aug-processing-pulse {
    0% {
        box-shadow: 0 0 5px rgba(0, 229, 255, 0.4);
        border-color: rgba(0, 229, 255, 0.6);
    }

    50% {
        box-shadow: 0 0 20px rgba(0, 229, 255, 0.8);
        border-color: #00e5ff;
    }

    100% {
        box-shadow: 0 0 5px rgba(0, 229, 255, 0.4);
        border-color: rgba(0, 229, 255, 0.6);
    }
}

.aug-processing {
    animation: aug-processing-pulse 0.5s infinite ease-in-out !important;
}

@keyframes aug-success-pop {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0px #00ff00;
        border-color: #00ff00;
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 0 40px #00ff00;
        border-color: #00ff00;
        filter: brightness(1.5);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 10px #00ff00;
        border-color: #00ff00;
    }
}

.aug-success {
    animation: aug-success-pop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    z-index: 100 !important;
}

@keyframes aug-fail-heavy-shake {

    0%,
    100% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-8px, -2px) rotate(-2deg);
    }

    20% {
        transform: translate(8px, 2px) rotate(2deg);
    }

    30% {
        transform: translate(-8px, 1px) rotate(-1deg);
    }

    40% {
        transform: translate(8px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-5px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(5px, -2px) rotate(1deg);
    }

    70% {
        transform: translate(-2px, 1px) rotate(0);
    }

    80% {
        transform: translate(2px, -1px) rotate(0);
    }
}

.aug-fail {
    animation: aug-fail-heavy-shake 0.5s ease-in-out !important;
    border-color: #ff0055 !important;
    box-shadow: 0 0 30px #ff0055 !important;
}

.c-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.c-panel h3 {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

/* Stats */
.c-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: #ccc;
}

.c-stat-row span:last-child {
    color: #fff;
    font-weight: bold;
}

/* Equipment (Paperdoll) */
.c-equipment {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.paperdoll-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.pd-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pd-col.center {
    justify-content: center;
}

.pd-slot {
    width: 42px;
    height: 42px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pd-slot:hover {
    border-color: var(--secondary-color);
    background: rgba(0, 229, 255, 0.1);
    color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.2), inset 0 0 8px rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.pd-slot.filled {
    border-color: var(--secondary-color);
    color: #fff;
    background: rgba(0, 229, 255, 0.15);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3), inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

.cosmetic-slots-bottom {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 5px;
    margin-bottom: 5px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(157, 0, 255, 0.1);
}

.aug-level-tag {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: transparent;
    color: #00ff00;
    font-size: 0.85rem;
    padding: 0;
    border: none;
    border-radius: 0;
    font-weight: bold;
    pointer-events: none;
    z-index: 100 !important; /* Force on top of everything */
    text-shadow: 
        -1.5px -1.5px 0 #000,  
         1.5px -1.5px 0 #000,
        -1.5px  1.5px 0 #000,
         1.5px  1.5px 0 #000,
        -2px 0px 0 #000,
         2px 0px 0 #000,
         0px -2px 0 #000,
         0px 2px 0 #000,
         0px 0px 5px rgba(0, 0, 0, 0.9);
}

.pd-slot,
.inv-slot {
    position: relative;
}

/* Ensure absolute positioning works */

/* Inventory */
.c-inventory {
    display: flex;
    flex-direction: column;
}

.inventory-grid-20 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-top: 10px;
}

.inv-slot {
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.7rem;
    color: #fff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
}

.inv-slot:hover {
    border-color: var(--accent-color);
    background: rgba(157, 0, 255, 0.1);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(157, 0, 255, 0.2), inset 0 0 8px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.inv-slot.filled {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

#item-tooltip {
    position: absolute;
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid #666;
    padding: 10px;
    color: #fff;
    font-size: 0.8rem;
    z-index: 1000;
    pointer-events: none;
    max-width: 200px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    font-family: 'Courier New', monospace;
}

#item-tooltip .t-name {
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 5px;
    border-bottom: 1px solid #444;
    padding-bottom: 2px;
}

#item-tooltip .t-type {
    color: #aaa;
    font-style: italic;
    margin-bottom: 5px;
    font-size: 0.7rem;
}


#btn-trash-item {
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid #00e5ff;
    color: #00e5ff;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    transition: all 0.2s;
}

#btn-trash-item:hover {
    background: rgba(0, 229, 255, 0.3);
    box-shadow: 0 0 15px #00e5ff;
    transform: scale(1.1);
}

#btn-trash-item:active {
    transform: scale(0.95);
}

/* Mute Button */
#btn-music-toggle {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00ffff;
    color: #fff;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 1.2rem;
    position: absolute;
    right: 0;
    top: 50px;
    pointer-events: auto;
    transition: all 0.2s;
    z-index: 2000;
}

#btn-music-toggle:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 10px #00ffff;
}

/* Muted State for Toggle Button */
#btn-music-toggle.muted {
    opacity: 0.5;
    background: #333;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-out;
}

#loading-screen.hidden {
    pointer-events: none;
    opacity: 0;
}

#loading-bar-container {
    width: 300px;
    height: 4px;
    background: #111;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 20px;
}

#loading-bar-fill {
    width: 0%;
    height: 100%;
    background: #00ffff;
    box-shadow: 0 0 10px #00ffff;
    transition: width 0.2s linear;
}

#loading-text {
    color: #444;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    margin-top: 10px;
    letter-spacing: 2px;
}

/* Victory Modal Specific Override */
#victory-modal {
    background: transparent !important;
    pointer-events: none;
    /* Let clicks pass through to game */
    justify-content: center;
}

#victory-modal h2 {
    font-size: 4em;
    color: #00ff00;
    text-shadow: 0 0 20px #00ff00, 0 0 40px black;
}

#victory-modal .menu-container {
    pointer-events: auto;
    /* Enable interaction with the EXIT button */
}

#victory-modal p {
    font-size: 1.5em;
    color: #fff;
    text-shadow: 0 0 10px black;
}

/* Corruption Tooltip */
.corruption-tooltip {
    position: absolute;
    top: -10px;
    left: 260px;
    background: linear-gradient(135deg, rgba(20, 0, 40, 0.98), rgba(40, 0, 60, 0.98));
    border: 2px solid #9d00ff;
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 200px;
    box-shadow: 0 0 20px rgba(157, 0, 255, 0.6), inset 0 0 20px rgba(157, 0, 255, 0.1);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.corruption-tooltip.show {
    opacity: 1;
    transform: translateX(0);
}

.tooltip-title {
    font-size: 13px;
    font-weight: bold;
    color: #9d00ff;
    text-align: center;
    margin-bottom: 8px;
    text-shadow: 0 0 8px #9d00ff;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(157, 0, 255, 0.3);
    padding-bottom: 6px;
}

.tooltip-stat {
    font-size: 12px;
    color: #e0e0ff;
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 3px rgba(157, 0, 255, 0.5);
}

.tooltip-stat::before {
    content: '';
    width: 3px;
    height: 3px;
    background: #9d00ff;
    border-radius: 50%;
    box-shadow: 0 0 4px #9d00ff;
}

/* Escalation Indicator */
.escalation-section {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0 12px;
    height: 44px;
    cursor: help;
    transition: all 0.3s ease;
}

.escalation-section:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

.escalation-icons {
    display: flex;
    gap: 4px;
    font-size: 1.2rem;
    filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.5));
}

.escalation-tooltip {
    position: absolute;
    top: 55px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: linear-gradient(135deg, rgba(10, 20, 30, 0.95), rgba(0, 40, 60, 0.98));
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 15px;
    min-width: 250px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 255, 255, 0.3);
    z-index: 3000;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
}

.escalation-section:hover .escalation-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tooltip-divider {
    height: 1px;
    background: rgba(0, 255, 255, 0.2);
    margin: 10px 0;
}

.rewards-summary {
    color: #ffff00;
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
    text-shadow: 0 0 5px rgba(255, 255, 0, 0.3);
}

.mod-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.mod-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.mod-info {
    display: flex;
    flex-direction: column;
}

.mod-name {
    color: #00ffff;
    font-weight: bold;
}

.mod-desc {
    color: #aaa;
    font-size: 0.75rem;
}

#btn-music-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
    box-sizing: border-box !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
}

#btn-music-toggle:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: #fff !important;
    transform: scale(1.1) !important;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3) !important;
}

/* ========================================
   PERMANENT SKILLS MODAL
   ======================================== */

.permanent-skills-container {
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    background: rgba(5, 5, 12, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 2px solid rgba(157, 0, 255, 0.4);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(157, 0, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.perm-skills-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(157, 0, 255, 0.3);
    background: rgba(0, 0, 0, 0.3);
}

.perm-skills-header h2 {
    margin: 0;
    font-size: 1.8rem;
    color: #00e5ff;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
    justify-self: start;
}

.perm-skills-header #respec-btn {
    padding: 10px 24px;
    font-size: 0.9rem;
    margin: 0;
    justify-self: center;
}

.perm-skills-header .close-btn {
    justify-self: end;
}


.perm-level-info {
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(157, 0, 255, 0.1);
}

.perm-instructions {
    padding: 10px 30px;
    background: rgba(157, 0, 255, 0.05);
    border-bottom: 1px solid rgba(157, 0, 255, 0.2);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
}

.perm-instructions span {
    text-shadow: 0 0 10px currentColor;
}

.perm-instructions .left-click {
    color: #00e5ff;
    /* Cyan */
}

.perm-instructions .right-click {
    color: #00ff00;
    /* Green */
}

.perm-level-display {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 8px;
    text-align: center;
}

.perm-level-display span {
    color: #00e5ff;
    font-weight: 800;
    font-size: 1.3rem;
}

.perm-xp-bar-container {
    position: relative;
    width: 100%;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 12px;
    overflow: hidden;
}

.perm-xp-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00e5ff, #9d00ff);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
    transition: width 0.5s ease;
}

.perm-xp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    pointer-events: none;
}

.path-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(157, 0, 255, 0.2);
}

.path-tab {
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.path-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-2px);
}

.path-tab.active {
    background: rgba(157, 0, 255, 0.2);
    border-color: #9d00ff;
    color: #fff;
    box-shadow: 0 0 20px rgba(157, 0, 255, 0.3);
}

.path-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    min-height: 400px;
}

.skill-category {
    margin-bottom: 30px;
}

.skill-category-header {
    font-size: 1.2rem;
    color: #00e5ff;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.3);
}

.skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 12px;
}

.skill-slot {
    width: 65px;
    height: 65px;
    background: rgba(20, 20, 30, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.skill-slot:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-3px);
}

.skill-slot.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.skill-slot.locked:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.1);
}

.skill-slot.selected {
    border-color: #00ff00;
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
}

.skill-slot.unlocked {
    border-color: #00e5ff;
    background: rgba(0, 229, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.skill-slot.purchasable {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.05);
}

.skill-initials {
    font-size: 1.2rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.skill-name {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-top: 4px;
    padding: 0 2px;
    line-height: 1.1;
}

.skill-level-req {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.8);
    color: #ffd700;
    font-size: 0.6rem;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
}

.perm-skills-footer {
    display: flex;
    justify-content: space-between;
    padding: 20px 30px;
    border-top: 1px solid rgba(157, 0, 255, 0.3);
    background: rgba(0, 0, 0, 0.3);
    gap: 15px;
}

.perm-skills-footer .btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 1rem;
}

/* Scrollbar styling for path content */
.path-content::-webkit-scrollbar {
    width: 10px;
}

.path-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.path-content::-webkit-scrollbar-thumb {
    background: rgba(157, 0, 255, 0.5);
    border-radius: 10px;
}

.path-content::-webkit-scrollbar-thumb:hover {
    background: rgba(157, 0, 255, 0.7);
}

/* Table layout for skills by level */
.skill-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skill-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.level-label {
    min-width: 40px;
    font-size: 1rem;
    font-weight: 800;
    color: #ffd700;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.skill-row-content {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Grid table layout for skills */
.skills-grid-table {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.skills-grid-header {
    display: grid;
    grid-template-columns: 60px repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(0, 229, 255, 0.3);
}

.grid-header-cell {
    text-align: center;
    font-size: 1rem;
    font-weight: 800;
    color: #00e5ff;
    text-transform: uppercase;
    letter-spacing: 1px;
}



.grid-header-cell .limit-text {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.skills-grid-row {
    display: grid;
    grid-template-columns: 60px repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 12px;
    align-items: start;
}

.grid-cell {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    min-height: 65px;
}

.skill-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.skill-connector {
    position: absolute;
    top: 65px;
    /* Bottom of a skill slot */
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: rgba(157, 0, 255, 0.2);
    margin: 0;
    transition: all 0.3s;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    z-index: -1;
}

.skill-connector.active {
    background: #00ff00;
    box-shadow: 0 0 10px #00ff00;
}

.skill-slot.locked-prereq {
    opacity: 0.3;
    filter: grayscale(1);
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.05);
}

/* === 5-Level Skill System Styles === */
.skill-level-text {
    font-size: 0.7rem;
    color: #00ff00;
    font-weight: 700;
    margin-top: 4px;
    text-shadow: 0 0 5px #00ff00;
}

.unlock-badge {
    font-size: 0.65rem;
    color: #ffd700;
    font-weight: 700;
    margin-top: 4px;
    text-shadow: 0 0 5px #ffd700;
}

.skill-dots {
    display: flex;
    gap: 3px;
    margin-top: 6px;
    justify-content: center;
}

.skill-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #222;
    border: 1px solid #555;
    transition: all 0.2s;
}

.skill-dots .dot.filled {
    background: #00ff00;
    border-color: #00ff00;
    box-shadow: 0 0 6px #00ff00;
}

.skill-slot.maxed {
    border-color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.1) !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3) !important;
}


/* Selected skill indicator */
.selected-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 1.2rem;
    color: #00ff00;
    font-weight: 900;
    text-shadow: 0 0 8px #00ff00;
    z-index: 10;
}

.skill-slot.selected {
    border-color: #00ff00 !important;
    background: rgba(0, 255, 0, 0.1) !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.4) !important;
}

/* ========================================
   ESCALATION MODAL
   ======================================== */

.escalation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.escalation-modal {
    background: linear-gradient(135deg, rgba(20, 10, 35, 0.95), rgba(10, 5, 20, 0.98));
    border: 2px solid #9d00ff;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    box-shadow: 0 0 50px rgba(157, 0, 255, 0.3), inset 0 0 20px rgba(157, 0, 255, 0.1);
    animation: menuFadeIn 0.3s ease-out;
}

.escalation-title {
    color: #00e5ff;
    text-align: center;
    margin: 0 0 10px 0;
    font-size: 32px;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
    letter-spacing: 4px;
    font-weight: 800;
}

.escalation-subtitle {
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    margin: 0 0 35px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.escalation-warning {
    color: #ff9d00;
    background: rgba(255, 157, 0, 0.1);
    padding: 8px 15px;
    border-radius: 12px;
    font-size: 13px;
    margin: -20px 0 30px 0;
    text-align: center;
    border: 1px solid rgba(255, 157, 0, 0.3);
    font-weight: bold;
    display: inline-block;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    animation: fadeIn 0.5s ease-out;
}

.escalation-grid {
    display: flex;
    gap: 20px;
    margin-bottom: 35px;
}

.escalation-choice-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(157, 0, 255, 0.3);
    border-radius: 15px;
    padding: 25px 15px;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    outline: none;
}

.escalation-choice-btn:hover {
    background: rgba(157, 0, 255, 0.1) !important;
    border-color: #9d00ff !important;
    transform: translateY(-5px) !important;
    box-shadow: 0 10px 30px rgba(157, 0, 255, 0.3) !important;
}

.escalation-choice-icon {
    font-size: 44px;
    filter: drop-shadow(0 0 10px rgba(157, 0, 255, 0.5));
}

.escalation-choice-name {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 10px rgba(157, 0, 255, 0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.escalation-choice-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    min-height: 40px;
    line-height: 1.4;
    text-align: center;
}

.escalation-choice-reward {
    font-size: 13px;
    color: #ffff00;
    font-weight: bold;
    background: rgba(255, 255, 0, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    margin-top: 5px;
}

.escalation-skip-btn {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 15px 50px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    transition: all 0.3s;
    text-transform: uppercase;
}

.escalation-skip-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.escalation-skip-reward {
    color: #ffff00;
    margin-left: 10px;
}

.stat-reduced {
    color: #ff6666 !important;
    text-shadow: 0 0 5px #ff0000;
}

.game-notification {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(5, 5, 12, 0.95);
    color: #00e5ff;
    padding: 15px 40px;
    border: 2px solid #00e5ff;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 800;
    z-index: 10000;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.4), inset 0 0 15px rgba(0, 229, 255, 0.1);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    letter-spacing: 1px;
    opacity: 0;
}

.game-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========================================
   LEGENDARY ITEM BORDER ANIMATIONS
   ======================================== */

/* Legendary Item Borders - Hybrid Shimmer + Pulse */
.legendary-border {
    border: 3px solid #c0c0c0 !important;
    box-shadow:
        0 0 8px rgba(192, 192, 192, 0.6),
        inset 0 0 8px rgba(255, 255, 255, 0.25) !important;
    position: relative;
    /* overflow: hidden; REMOVED to allow augmentation tags to overlap */
    animation: silverPulse 2s ease-in-out infinite;
}

.legendary-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(110deg,
            transparent 0%,
            transparent 40%,
            rgba(255, 255, 255, 0.6) 50%,
            transparent 60%,
            transparent 100%);
    background-size: 300% 100%;
    background-position: 150% 0;
    animation: shimmerSweepBackground 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
    border-radius: inherit;
}

@keyframes shimmerSweepBackground {
    0%, 20% { background-position: 150% 0; opacity: 0; }
    30% { opacity: 1; }
    70% { opacity: 1; }
    80%, 100% { background-position: -50% 0; opacity: 0; }
}

/* Perfect Roll - Gold Enhancement */
.legendary-border.perfect-roll {
    border-color: #ffd700 !important;
    animation: perfectPulse 1.5s ease-in-out infinite;
}

.legendary-border.perfect-roll::before {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 1) 50%,
            transparent 100%);
}

@keyframes perfectPulse {

    0%,
    100% {
        box-shadow:
            0 0 15px rgba(255, 215, 0, 0.8),
            0 0 30px rgba(255, 215, 0, 0.4),
            inset 0 0 15px rgba(255, 255, 255, 0.4);
    }

    50% {
        box-shadow:
            0 0 25px rgba(255, 215, 0, 1),
            0 0 50px rgba(255, 215, 0, 0.6),
            inset 0 0 20px rgba(255, 255, 255, 0.6);
    }

}

/* === HERO DASHBOARD STYLES === */
.dashboard-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 96%;
    max-width: 1600px;
    height: 88%;
    z-index: 10000;
    /* Ensure it's above everything */
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.dashboard-content {
    width: 100%;
    height: 100%;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, rgba(10, 10, 20, 0.98), rgba(20, 10, 40, 0.95));
    backdrop-filter: blur(25px);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), inset 0 0 30px rgba(157, 0, 255, 0.15);
    border-radius: 20px;
}

.dashboard-content.diagnostic-panel {
    border: 1px solid rgba(0, 229, 255, 0.3);
    background: linear-gradient(135deg, rgba(5, 10, 15, 0.95), rgba(10, 5, 25, 0.92));
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(0, 229, 255, 0.05);
}

.dashboard-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid rgba(0, 229, 255, 0.4);
    padding: 25px 40px;
    gap: 40px;
    text-align: left;
}

.dashboard-header h2 {
    color: var(--secondary-color);
    letter-spacing: 3px;
    text-shadow: 0 0 15px var(--secondary-color);
    margin: 0;
    font-size: 2rem;
    flex-shrink: 0;
    font-family: 'Bebas Neue', sans-serif;
}

.dashboard-tabs {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-shrink: 0;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 229, 255, 0.15);
    color: rgba(255, 255, 255, 0.4);
    padding: 12px 28px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 2px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    position: relative;
    backdrop-filter: blur(10px);
}

.tab-btn:hover {
    background: rgba(0, 229, 255, 0.1);
    color: #fff;
    border-color: rgba(0, 229, 255, 0.5);
    box-shadow: 0 5px 15px rgba(0, 229, 255, 0.2);
    transform: translateY(-2px) scale(1.05);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.3), rgba(0, 119, 255, 0.3));
    border-color: #00e5ff;
    color: #00e5ff;
    box-shadow:
        0 0 25px rgba(0, 229, 255, 0.3),
        inset 0 0 10px rgba(0, 229, 255, 0.2);
    transform: translateY(-3px) scale(1.08);
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #fff;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.tab-btn.active::after {
    width: 40%;
}

/* === Diagnostic Slot Styles === */
.mini-slot.diagnostic-slot {
    position: relative;
    border: 1px solid rgba(0, 229, 255, 0.2);
    background: rgba(0, 229, 255, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

.mini-slot.diagnostic-slot .scanning-bar {
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0, 229, 255, 0.4);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
    animation: slotScan 2s linear infinite;
    pointer-events: none;
    will-change: transform;
}

@keyframes slotScan {
    0% {
        transform: translateY(-110%);
    }

    100% {
        transform: translateY(110%);
    }
}

/* Distribution Bars */
.dist-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.7rem;
    color: rgba(0, 229, 255, 0.8);
    font-weight: 800;
    font-family: 'Courier New', Courier, monospace;
}

.dist-bar-container {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    margin-bottom: 8px;
}

.dist-segment {
    height: 100%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.dist-segment.physical {
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.dist-segment.magical {
    background: #0077ff;
    box-shadow: 0 0 10px rgba(0, 119, 255, 0.3);
}

.dist-segment.pure {
    background: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.dist-legend {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    font-size: 0.6rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.8;
}

.legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* === Refined Diagnostic Row Styles === */
.diagnostic-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.diagnostic-row:hover {
    background: rgba(0, 229, 255, 0.05);
    padding-left: 20px;
    /* Slight push on hover */
    box-shadow: inset 0 0 15px rgba(0, 229, 255, 0.1);
}

.diagnostic-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.1), transparent);
    pointer-events: none;
    will-change: transform;
}

.diagnostic-row:hover::before {
    animation: diagRowScan 1.5s infinite;
}

@keyframes diagRowScan {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(350%);
    }
}

.row-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.row-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 5px rgba(0, 229, 255, 0.5));
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.row-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.row-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
}

.row-value {
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'Bebas Neue', sans-serif;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
    letter-spacing: 1px;
}

.row-value.glow-cyan {
    color: #00e5ff;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

.row-value.glow-gold {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.row-value.glow-red {
    color: #ff3366;
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.6);
}

.row-value.glow-silver {
    color: #c0c0c0;
    text-shadow: 0 0 10px rgba(192, 192, 192, 0.6);
}

.row-value.glow-blue {
    color: #0077ff;
    text-shadow: 0 0 10px rgba(0, 119, 255, 0.6);
}

.row-value.glow-white {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

/* Icon Special Effects */
.icon-pulse {
    animation: diagIconPulse 3s infinite ease-in-out;
}

.icon-pulse-strong {
    animation: diagIconPulse 1.5s infinite ease-in-out;
}

.icon-huge-special {
    position: relative;
    animation: diagHugeSpecial 4s infinite ease-in-out;
}

.icon-huge-special::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -10%;
    width: 120%;
    height: 1px;
    background: rgba(0, 229, 255, 0.8);
    box-shadow: 0 0 5px #00e5ff;
    animation: diagHugeScan 2s infinite linear;
    pointer-events: none;
    will-change: transform;
}

.icon-glitch-cycle {
    animation: diagIconGlitch 3s infinite steps(1);
}

.icon-boss-glow {
    animation: diagBossSteady 5s infinite ease-in-out;
    filter: drop-shadow(0 0 5px #ffd700);
}

@keyframes diagIconPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.08);
        opacity: 1;
        filter: drop-shadow(0 0 3px rgba(0, 229, 255, 0.3));
    }
}

@keyframes diagIconGlitch {

    0%,
    90%,
    100% {
        transform: translate(0, 0);
        filter: none;
    }

    92% {
        transform: translate(-2px, 1px);
        filter: hue-rotate(90deg);
    }

    94% {
        transform: translate(2px, -1px);
        filter: hue-rotate(-90deg);
    }

    96% {
        transform: translate(-1px, -2px);
        filter: brightness(1.5);
    }
}

@keyframes diagHugeSpecial {

    0%,
    100% {
        filter: hue-rotate(0deg) drop-shadow(0 0 2px #00e5ff);
        transform: translateY(0);
    }

    50% {
        filter: hue-rotate(15deg) drop-shadow(0 0 8px #ff00ff);
        transform: translateY(-2px);
    }
}

@keyframes diagHugeScan {
    0% {
        transform: translateY(-110%);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateY(110%);
        opacity: 0;
    }
}

@keyframes diagBossSteady {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 6px #ffd700);
    }

    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 15px #ffd700);
    }
}

.dashboard-body-new {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2.5rem;
    overflow: hidden;
    padding: 0 10px 30px 10px;
    /* Main containers don't scroll, inner ones do */
}

.dashboard-sidebar {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), rgba(0, 20, 30, 0.4));
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 229, 255, 0.05);
}

.dashboard-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

.dashboard-sidebar>* {
    position: relative;
    z-index: 1;
}

.side-title {
    color: #00e5ff;
    font-size: 1.1rem;
    margin: 0;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    font-family: 'Bebas Neue', sans-serif;
}

.dashboard-main-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 15px;
}

.dashboard-main-content::-webkit-scrollbar {
    width: 10px;
}

.dashboard-main-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

.dashboard-main-content::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.3);
    border: 1px solid rgba(0, 229, 255, 0.5);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.dashboard-main-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.stat-card-mini {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: default;
}

.stat-label-mini {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
}

.stat-value-mini {
    font-size: 1.6rem;
    color: #fff;
    font-family: 'Bebas Neue', sans-serif;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Grouped Stat Styling */
.stats-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 10px;
}

.stat-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
}

.group-title {
    color: var(--secondary-color);
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-bottom: 15px;
    border-left: 3px solid var(--secondary-color);
    padding-left: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row .label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    font-family: 'Courier New', Courier, monospace;
}

.stat-row .value {
    color: #fff;
    font-family: 'Bebas Neue', sans-serif;
    font-weight: bold;
    font-size: 1.3rem;
    letter-spacing: 1px;
}

.stat-row .value.highlight {
    color: #00ffcc;
}

.mini-paperdoll {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    background: rgba(0, 229, 255, 0.02);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 255, 0.1);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.mini-pd-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Anima Section Styling */
.anima-section {
    margin-top: -10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.anima-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 229, 255, 0.3);
    padding-bottom: 5px;
}

.anima-header span {
    color: #00e5ff;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.anima-message-container {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 229, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    min-height: 120px;
    display: flex;
    align-items: flex-start;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.anima-text {
    font-size: 1rem;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.5;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
    margin: 0;
}

.anima-text::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 1.2rem;
    background: #00e5ff;
    margin-left: 5px;
    animation: anima-blink 0.8s infinite;
    vertical-align: middle;
}

@keyframes anima-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.bio-stat-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 229, 255, 0.1);
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: all 0.2s ease;
}

/* End Anima Styling */

.mini-pd-center {
    justify-content: center;
    align-self: center;
}


.mini-slot {
    width: 42px;
    height: 42px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    font-size: 0.85rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.3);
    cursor: default;
    overflow: hidden;
    flex-shrink: 0;
    box-sizing: border-box;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}

.mini-slot.filled {
    color: #fff;
    background: rgba(0, 229, 255, 0.15);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3), inset 0 2px 5px rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.mini-slot:hover {
    background: rgba(0, 229, 255, 0.2);
    border-color: #00e5ff;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
    transform: translateY(-1px);
}



.mini-slot img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
}

.dashboard-overlay .close-btn {
    position: absolute !important;
    top: 25px !important;
    right: 25px !important;
    background: #ff3333 !important;
    border: 2px solid white !important;
    color: white !important;
    font-size: 1.2rem !important;
    cursor: pointer;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 99999 !important;
    font-weight: 950 !important;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4) !important;
}

.dashboard-overlay .close-btn:hover {
    background: #ff0000 !important;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.6) !important;
}

/* Character info: keep close button in normal header flow */
.c-header .close-btn {
    position: static !important;
    top: auto !important;
    right: auto !important;
    background: #ff3333 !important;
    border: 2px solid white !important;
    color: white !important;
    font-size: 1.2rem !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    font-weight: 950 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4) !important;
    flex-shrink: 0;
}

.c-header .close-btn:hover {
    background: #ff0000 !important;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.6) !important;
}

#unified-hero-stats-btn {
    padding: 12px 40px;
    font-size: 1.1rem;
    background: rgba(0, 229, 255, 0.05);
    border: 2px solid rgba(0, 229, 255, 0.4);
    color: #00e5ff !important;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 800;
    font-family: 'Courier New', Courier, monospace;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 4px;
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.1), inset 0 0 10px rgba(0, 229, 255, 0.05);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
    position: relative;
    overflow: hidden;
    animation: stats-btn-glow 3s infinite ease-in-out alternate;
}

#unified-hero-stats-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.2), transparent);
    transform: skewX(-25deg);
    animation: stats-btn-scan 3s infinite linear;
}

#unified-hero-stats-btn:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: #00e5ff;
    color: #fff !important;
    box-shadow: 0 0 35px rgba(0, 229, 255, 0.4), inset 0 0 15px rgba(0, 229, 255, 0.1);
    transform: translateY(-2px) scale(1.02);
}

#unified-hero-stats-btn:active {
    transform: translateY(1px) scale(0.98);
    background: rgba(0, 229, 255, 0.25);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
}

@keyframes stats-btn-glow {
    0% {
        box-shadow: 0 0 15px rgba(0, 229, 255, 0.1), inset 0 0 10px rgba(0, 229, 255, 0.05);
        border-color: rgba(0, 229, 255, 0.4);
    }

    100% {
        box-shadow: 0 0 30px rgba(0, 229, 255, 0.3), inset 0 0 15px rgba(0, 229, 255, 0.1);
        border-color: rgba(0, 229, 255, 0.8);
    }
}

@keyframes stats-btn-scan {
    0% {
        transform: translateX(-100%) skewX(-25deg);
    }

    30%,
    100% {
        transform: translateX(350%) skewX(-25deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* ========================================
   VICTORY SUMMARY (CYBER-DIAGNOSTIC)
   ======================================== */

.diagnostic-panel {
    background: linear-gradient(135deg, rgba(5, 5, 10, 0.95), rgba(10, 10, 25, 0.98));
    border: 2px solid #00e5ff;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.9);
    border-radius: 4px;
    width: 850px;
    /* Reduced from 1020px */
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    position: relative;
    padding: 0;
}

.diagnostic-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 1px, transparent 1px, transparent 2px);
    pointer-events: none;
    z-index: 10;
}

.summary-header {
    background: rgba(0, 229, 255, 0.1);
    padding: 25px 40px;
    border-bottom: 2px solid #00e5ff;
    position: relative;
}

.summary-header .header-glitch {
    font-size: 3rem;
    color: #00e5ff;
    font-weight: 900;
    letter-spacing: 12px;
    text-shadow: 2px 2px #bd00ff, -2px -2px #00ffaa;
    margin-bottom: 5px;
    font-family: 'Bebas Neue', sans-serif;
}

.summary-header .header-sub {
    font-size: 0.9rem;
    color: rgba(0, 229, 255, 0.7);
    letter-spacing: 2px;
}

.summary-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(0, 229, 255, 0.3);
}

.summary-tab {
    flex: 1;
    background: transparent;
    border: none;
    border-right: 1px solid rgba(0, 229, 255, 0.1);
    padding: 15px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.summary-tab:hover {
    background: rgba(0, 229, 255, 0.05);
    color: #fff;
}

.summary-tab.active {
    background: rgba(0, 229, 255, 0.15);
    color: #00e5ff;
    box-shadow: inset 0 -3px 0 #00e5ff;
}

.summary-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
    background: rgba(0, 0, 0, 0.2);
}

/* Custom Scrollbar for Victory Summary */
.summary-content::-webkit-scrollbar {
    width: 10px;
}

.summary-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

.summary-content::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.3);
    border: 1px solid rgba(0, 229, 255, 0.5);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.summary-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
}

.overview-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.overview-card {
    background: rgba(0, 229, 255, 0.03);
    border: 1px solid rgba(0, 229, 255, 0.2);
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.overview-card .card-label {
    font-size: 0.75rem;
    color: rgba(0, 229, 255, 0.6);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.overview-card .card-value {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.hero-stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.stat-block {
    background: rgba(255, 0, 85, 0.03);
    border: 1px solid rgba(255, 0, 85, 0.2);
    padding: 20px;
}

.stat-block.magical {
    background: rgba(0, 229, 255, 0.03);
    border-color: rgba(0, 229, 255, 0.2);
}

.stat-block-header {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 15px;
    border-bottom: 1px solid currentColor;
    padding-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Bebas Neue', sans-serif;
}

.stat-row-diagnostic {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.stat-row-diagnostic .label {
    color: rgba(255, 255, 255, 0.5);
}

.stat-row-diagnostic .value {
    font-weight: bold;
}

.diagnostic-list {
    margin-top: 30px;
}

.diag-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 10px;
    gap: 15px;
}

.diag-item-icon {
    width: 40px;
    height: 40px;
    background: #111;
    border: 1px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
}

.diag-item-info {
    flex: 1;
}

.diag-item-name {
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.diag-item-dmg-bar {
    height: 4px;
    background: #222;
    width: 100%;
}

.diag-item-dmg-fill {
    height: 100%;
    background: #00e5ff;
    box-shadow: 0 0 5px #00e5ff;
}

.summary-footer {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px 40px;
    border-top: 2px solid #00e5ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.footer-xp-total-container {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    text-align: right;
    margin: 0;
}

.footer-xp-total-container .label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 2px;
    letter-spacing: 1px;
}

.footer-xp-total-container .value {
    font-size: 1.8rem;
    font-weight: bold;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 1px;
}

.value.cyan {
    color: #00e5ff;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.value.gold {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.diagnostic-btn {
    background: transparent;
    border: 1px solid #00e5ff;
    color: #00e5ff;
    padding: 8px 24px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.diagnostic-btn:hover {
    background: rgba(0, 229, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
    transform: scale(1.05);
}

.diagnostic-btn:active {
    transform: scale(0.95);
}

@keyframes diagnostic-scan {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(100%);
    }
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 229, 255, 0.2);
    box-shadow: 0 0 10px #00e5ff;
    z-index: 11;
    pointer-events: none;
    animation: diagnostic-scan 4s linear infinite;
}

/* --- XP REWARD SYSTEM & SUMMARY ANIMATION --- */
.diagnostic-reward-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 255, 0.1);
    max-height: 250px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #00e5ff rgba(0, 0, 0, 0.5);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.reward-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(0, 229, 255, 0.04);
    border-left: 3px solid transparent;
    border-radius: 4px;
    margin-bottom: 8px;
    transform: translateX(40px);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.4s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.reward-row.visible {
    animation: reward-entry 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes reward-entry {
    0% {
        transform: translateX(50px) scale(0.9);
        opacity: 0;
        filter: brightness(2) blur(10px);
    }

    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
        filter: brightness(1) blur(0);
    }
}

.reward-row .reward-name {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
}

.reward-row .reward-xp {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 0 10px currentColor;
}

.reward-row.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    animation: rewardScan 2.5s ease-in-out infinite;
    opacity: 0.3;
    will-change: transform;
}

@keyframes rewardScan {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(450%);
    }
}

.summary-xp-footer-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.summary-perm-xp-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-bottom: 8px;
    letter-spacing: 3px;
    font-weight: 800;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.summary-perm-xp-bar-outer {
    width: 100%;
    height: 18px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 9px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(0, 229, 255, 0.1);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.summary-perm-xp-bar-outer.processing-glow {
    border-color: #00e5ff;
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.4), inset 0 0 15px rgba(0, 229, 255, 0.2);
    animation: bar-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes bar-pulse {
    from {
        opacity: 0.8;
    }

    to {
        opacity: 1;
        box-shadow: 0 0 35px rgba(0, 229, 255, 0.6), inset 0 0 20px rgba(0, 229, 255, 0.3);
    }
}

.summary-perm-xp-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0077ff, #00e5ff, #00ffff);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
    position: relative;
    transition: width 0.1s linear;
}

.summary-perm-xp-bar-fill.surging::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: data-surge 0.8s linear infinite;
    will-change: transform;
}

@keyframes data-surge {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(200%);
    }
}

.summary-perm-xp-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    filter: blur(6px);
}

.level-up-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 20;
    animation: ripple-expand 0.6s ease-out forwards;
}

@keyframes ripple-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }

    100% {
        width: 600px;
        height: 600px;
        opacity: 0;
    }
}

.summary-perm-xp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 5px #000;
    pointer-events: none;
    letter-spacing: 2px;
    z-index: 5;
}

@keyframes barLevelUp {
    0% {
        filter: brightness(1);
        transform: scaleY(1);
    }

    30% {
        filter: brightness(3) contrast(1.2);
        transform: scaleY(1.5);
        box-shadow: 0 0 40px #00e5ff;
    }

    100% {
        filter: brightness(1);
        transform: scaleY(1);
    }
}

.bar-level-up {
    animation: barLevelUp 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bar-pulse {
    animation: barPulseSmall 0.4s ease-out;
}

@keyframes barPulseSmall {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.02);
        filter: brightness(1.5);
    }
}

/* Legendary Exaltation UI */
.legendary-container {
    width: 850px;
    /* Reduced from 1020px */
    padding: 30px 40px;
    /* Reduced padding */
    animation: exaltationZoom 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes exaltationZoom {
    from {
        transform: scale(0.8) translateY(50px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.legendary-subtitle {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    margin-bottom: 20px;
}

/* Legendary Silver Branding */
.legendary-text-silver {
    color: var(--legendary-color) !important;
    text-shadow: 0 0 15px var(--legendary-glow) !important;
    letter-spacing: 2px;
    font-weight: 900;
}

.legendary-border-silver {
    border-color: var(--legendary-color) !important;
    box-shadow: 0 0 20px var(--legendary-glow) !important;
}

/* Selection Cards */
.card-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    width: 100%;
    flex-wrap: nowrap !important;
    /* Force single line */
}

.legendary-baseline-box {
    display: none;
    /* Removed in favor of per-card info */
}

.baseline-label {
    display: block;
    font-size: 0.75rem;
    color: #aaa;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.baseline-value {
    display: block;
    font-size: 1.1rem;
    color: var(--legendary-color);
    font-weight: bold;
    text-shadow: 0 0 10px var(--legendary-glow);
}

.upgrade-card.legendary-card {
    background: rgba(15, 15, 25, 0.75) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-image: repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(0, 230, 255, 0.03) 2px);
    border: 1px solid rgba(192, 192, 192, 0.3) !important;
    width: 200px;
    height: 220px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 15px;
    border-radius: 8px;
}

.upgrade-card.legendary-card::before {
    content: '';
    position: absolute;
    inset: 6px;
    pointer-events: none;
    background:
        linear-gradient(to right, var(--bracket-color, #C0C0C0) 20px, transparent 20px) 0 0 / 100% 2.5px no-repeat,
        linear-gradient(to bottom, var(--bracket-color, #C0C0C0) 20px, transparent 20px) 0 0 / 2.5px 100% no-repeat,
        linear-gradient(to left, var(--bracket-color, #C0C0C0) 20px, transparent 20px) 100% 0 / 100% 2.5px no-repeat,
        linear-gradient(to bottom, var(--bracket-color, #C0C0C0) 20px, transparent 20px) 100% 0 / 2.5px 100% no-repeat,
        linear-gradient(to right, var(--bracket-color, #C0C0C0) 20px, transparent 20px) 0 100% / 100% 2.5px no-repeat,
        linear-gradient(to top, var(--bracket-color, #C0C0C0) 20px, transparent 20px) 0 100% / 2.5px 100% no-repeat,
        linear-gradient(to left, var(--bracket-color, #C0C0C0) 20px, transparent 20px) 100% 100% / 100% 2.5px no-repeat,
        linear-gradient(to top, var(--bracket-color, #C0C0C0) 20px, transparent 20px) 100% 100% / 2.5px 100% no-repeat;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.upgrade-card.legendary-card:hover::before {
    opacity: 0.8;
}

.legendary-card .card-baseline-info {
    margin-top: auto;
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid rgba(192, 192, 192, 0.15);
    text-align: center;
}

.legendary-card .baseline-tag {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.legendary-card .baseline-text {
    font-size: 0.75rem;
    color: #00ff00;
    font-weight: bold;
    display: block;
}

.upgrade-card.legendary-card:hover {
    border-color: var(--legendary-color) !important;
    transform: translateY(-15px) scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 30px var(--legendary-glow);
}

.legendary-card .card-icon {
    display: none;
}

.legendary-card .card-name {
    color: var(--legendary-color);
    font-size: 1.25rem;
    font-weight: 900;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(192, 192, 192, 0.4);
}

.legendary-card .card-desc {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.88rem;
    line-height: 1.4;
    text-align: center;
    font-style: italic;
}

.legendary-card::after {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: linear-gradient(45deg,
            transparent 45%,
            rgba(255, 255, 255, 0.05) 48%,
            rgba(0, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 52%,
            transparent 55%);
    transform: rotate(45deg);
    animation: holographicShine 6s infinite;
    pointer-events: none;
}

@keyframes holographicShine {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    30% {
        transform: translateX(100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}