/* CSS Reset & Variable Definitions */
:root {
    --bg-dark: #07080c;
    --panel-bg: rgba(10, 12, 18, 0.88);
    --panel-border: rgba(34, 211, 238, 0.12);
    --panel-border-focus: rgba(34, 211, 238, 0.45);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --accent-red: #f43f5e;
    --accent-gold: #fbbf24;
    --accent-green: #10b981;
    --accent-blue: #06b6d4; /* Neon Cyan */
    --accent-mana: #3b82f6; /* Vibrant Mana Blue */
    
    /* Rarity Colors */
    --rarity-common: #64748b;
    --rarity-uncommon: #10b981;
    --rarity-rare: #3b82f6;
    --rarity-epic: #a855f7;
    --rarity-legendary: #f97316;
    --rarity-mythic: #ef4444; /* Mythic Red/Gold */
    --rarity-set: #eab308; /* Set Golden Shimmer */
    
    --font-heading: 'Cinzel', serif;
    --font-body: 'Quicksand', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background-color: #020204;
    color: var(--text-primary);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Scrollbars */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* Main Screen Layout */
#game-container {
    width: 100vw;
    height: 100vh;
    max-width: 1200px;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #07080c;
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 45px rgba(0, 0, 0, 0.95);
    overflow: hidden;
    border-radius: 12px;
}

/* Header bar */
#game-header {
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.55);
    z-index: 10;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.logo .accent {
    color: var(--accent-blue);
    text-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.active-relics-bar {
    display: flex;
    gap: 6px;
}

.relic-badge-tiny {
    font-size: 1.1rem;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid var(--accent-gold);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.2);
}

/* Node Progress tracker */
.progress-tracker {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 10px;
    border-radius: 15px;
}

.node-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1e293b;
    border: 2px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    cursor: default;
    transition: all 0.3s ease;
}

.node-dot.active {
    background: #083344;
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px var(--accent-blue);
}

.node-dot.completed {
    background: #111827;
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.node-line {
    width: 15px;
    height: 2px;
    background: #334155;
}

.node-line.completed {
    background: var(--accent-green);
}

.stat-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.8rem;
}

.gold-text {
    color: var(--accent-gold);
}

/* Screens wrapper */
#screen-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 1. Level Map Selector styling */
#level-select-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 25px;
    gap: 20px;
    background: radial-gradient(circle at center, #0e1117 0%, #030406 100%);
    overflow-y: auto;
}

.difficulty-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
}

.diff-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.diff-label.active {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.diff-label#diff-hard.active {
    color: var(--accent-red);
    text-shadow: 0 0 10px rgba(244, 63, 94, 0.4);
}

/* Neon Checkbox Slider switch */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334155;
    transition: .3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}
input:checked + .slider { background-color: var(--accent-red); }
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: 24px; }
.slider.round:before { border-radius: 50%; }

.levels-map-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    max-width: 1000px;
    margin: auto;
    width: 100%;
}

.level-node-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 250px;
    height: auto;
}

.level-node-card:hover:not(.locked) {
    transform: translateY(-5px);
    background: rgba(6, 182, 212, 0.05);
    border-color: var(--accent-blue);
    box-shadow: 0 5px 15px rgba(6, 182, 212, 0.15);
}

.level-node-card.completed {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.03);
}

.level-node-card.locked {
    opacity: 0.35;
    cursor: not-allowed;
}

.lvl-number {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--text-secondary);
}

.completed .lvl-number { color: var(--accent-green); }

.level-node-card.hard-mode:not(.locked) {
    border-color: rgba(244, 63, 94, 0.3);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.05);
}

.level-node-card.hard-mode:hover:not(.locked) {
    border-color: var(--accent-red);
    box-shadow: 0 5px 15px rgba(244, 63, 94, 0.2);
    background: rgba(244, 63, 94, 0.04);
}

.lvl-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.lvl-drops-badge {
    font-size: 0.62rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    padding: 2px 6px;
    margin-top: 5px;
    color: var(--accent-gold);
}

/* 2. Character Selection Screen */
#char-select-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px 20px;
    gap: 12px;
    background: radial-gradient(circle at center, #10121a 0%, #040507 100%);
    overflow-y: auto;
}

.back-btn {
    position: absolute;
    left: 20px;
    top: 15px;
    padding: 4px 10px;
    font-size: 0.7rem;
}

.select-main-layout {
    display: flex;
    flex: 1;
    gap: 15px;
    overflow: hidden;
}

.roster-panel {
    flex: 1.8;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.roster-panel h3, .squad-panel h3 {
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 4px;
}

.roster-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    overflow-y: auto;
    flex: 1;
    padding-right: 3px;
}

.roster-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    aspect-ratio: 0.82;
}

.roster-card:hover {
    background: rgba(6, 182, 212, 0.06);
    border-color: rgba(6, 182, 212, 0.25);
    transform: translateY(-1px);
}

.roster-card.selected {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.06);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.15);
}

.roster-card .card-emoji { font-size: 1.8rem; }
.roster-card .card-name { font-weight: 700; font-size: 0.7rem; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.squad-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 12px;
}

.squad-slots {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.squad-slot {
    flex: 1;
    aspect-ratio: 0.9;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.squad-slot:not(.empty) {
    border-style: solid;
    border-color: var(--accent-blue);
    background: rgba(6, 182, 212, 0.04);
}

.squad-slot .slot-emoji { font-size: 1.6rem; }
.squad-slot .slot-name { font-weight: 700; font-size: 0.65rem; }

.selection-preview-box {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.selection-preview-box h4 { font-family: var(--font-heading); font-size: 1rem; color: var(--accent-blue); }
.selection-preview-box .power-item {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255,255,255,0.04);
    padding: 5px;
    border-radius: 4px;
}

/* 3. Battle Stage Screen & Animations */
#battle-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.arena-background-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.8)), 
                radial-gradient(ellipse at center, #171d2b 0%, #040508 100%);
    z-index: 0;
}

.gothic-windows {
    position: absolute;
    top: 15%; left: 10%; right: 10%; bottom: 45%;
    background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0px, rgba(255, 255, 255, 0.02) 2px, transparent 2px, transparent 150px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.04);
    opacity: 0.3;
}

.dungeon-floor-line {
    position: absolute;
    bottom: 35%; left: 0; width: 100%; height: 8px;
    background: linear-gradient(180deg, #1e293b 0%, #0b0f19 100%);
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* Battle lines placement */
.battlefield-stage {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 60px 14% 60px;
}

.stage-side {
    display: flex;
    gap: 40px;
    align-items: flex-end;
}

.hero-side { justify-content: flex-start; }
.enemy-side { justify-content: flex-end; flex-direction: row-reverse; }

.battle-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.25s;
}

.battle-unit:hover { transform: scale(1.04); }

.unit-ring {
    width: 60px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    position: absolute;
    bottom: 28px;
    z-index: -1;
    transition: all 0.25s;
}

.battle-unit.inspected .unit-ring {
    border-color: var(--accent-blue);
    background: rgba(6, 182, 212, 0.1);
    box-shadow: 0 0 10px var(--accent-blue);
}

.battle-unit.target-candidate:hover .unit-ring {
    border-color: var(--accent-red);
    background: rgba(244, 63, 94, 0.1);
    box-shadow: 0 0 12px var(--accent-red);
    animation: pulse-ring 1s infinite alternate;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.1); opacity: 1; }
}

.battle-unit.dead {
    opacity: 0.2;
    filter: grayscale(1);
    cursor: not-allowed;
    transform: none !important;
}

.unit-sprite {
    font-size: 3.4rem;
    margin-bottom: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
    animation: breathing 3s infinite ease-in-out;
}

@keyframes breathing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.unit-info-plate {
    width: 95px;
    text-align: center;
    background: rgba(10, 15, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    padding: 3px;
    z-index: 2;
}

.unit-name {
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* HP / Mana bars in battlefield */
.unit-stats-bar {
    width: 100%;
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.unit-hp-bg {
    height: 5px;
    background: rgba(0,0,0,0.4);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.unit-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #f43f5e 0%, #fda4af 100%);
    transition: width 0.25s ease;
}

.unit-shield-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8 0%, #0ea5e9 100%);
    position: absolute;
    top: 0; left: 0;
    transition: width 0.25s ease;
}

.unit-mana-bg {
    height: 3px;
    background: rgba(0,0,0,0.4);
    border-radius: 1px;
    overflow: hidden;
}

.unit-mana-fill {
    height: 100%;
    background: var(--accent-mana);
    transition: width 0.25s ease;
}

.unit-statuses {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 2px;
    min-height: 12px;
    font-size: 0.6rem;
}

.gear-mini-icon {
    font-size: 0.65rem;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
}
.gear-mini-icon.empty {
    opacity: 0.25;
    font-size: 0.4rem;
}

/* Floating overlay banner when target selection is active */
.target-prompt-banner {
    position: absolute;
    top: 15px; left: 50%;
    transform: translateX(-50%);
    background: rgba(244, 63, 94, 0.9);
    border: 1px solid var(--accent-red);
    box-shadow: 0 0 15px var(--accent-red);
    color: #fff;
    font-weight: 900;
    font-size: 1rem;
    padding: 6px 20px;
    border-radius: 4px;
    z-index: 50;
    letter-spacing: 1.5px;
    animation: flash-text 1s infinite alternate;
}

@keyframes flash-text {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Floating End turn action card prompt */
.end-turn-prompt {
    position: absolute;
    bottom: 215px; left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    box-shadow: 0 0 20px var(--accent-blue);
    animation: pulse-end-turn 1.5s infinite;
}

@keyframes pulse-end-turn {
    0% { transform: translateX(-50%) scale(1); box-shadow: 0 0 15px var(--accent-blue); }
    50% { transform: translateX(-50%) scale(1.05); box-shadow: 0 0 25px var(--accent-blue); }
    100% { transform: translateX(-50%) scale(1); box-shadow: 0 0 15px var(--accent-blue); }
}

/* Mini Boss visual indicator badges */
.mini-boss-badge {
    border-color: var(--accent-gold) !important;
    box-shadow: 0 0 8px var(--accent-gold) !important;
}

/* Bottom Inspect / Details Dashboard */
.combat-dashboard-container {
    height: 175px;
    display: flex;
    gap: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.65);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 10;
}

.dashboard-inspect-pane {
    flex: 1.1;
    padding: 8px 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    border-color: var(--panel-border);
}

.inspect-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 55px;
}

.inspect-emoji { font-size: 2.2rem; }
.inspect-name { font-weight: 700; font-size: 0.8rem; margin-top: 2px; }
.inspect-role { font-size: 0.6rem; color: var(--text-secondary); }

.inspect-stats-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    font-size: 0.68rem;
}

.stat-row { display: flex; justify-content: space-between; }
.stat-lbl { color: var(--text-secondary); }
.stat-val { font-weight: 700; color: #fff; }

.resistances-block {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding-left: 8px;
    font-size: 0.65rem;
}

/* Actions Deck (Center Cards) */
.dashboard-actions-pane {
    flex: 2;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-color: var(--panel-border);
}

.combat-card {
    flex: 1;
    height: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s;
    max-width: 155px;
}

.combat-card:hover:not(.disabled) {
    background: rgba(6, 182, 212, 0.06);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.15);
}

.combat-card.selected-card {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.05);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.2);
}

.combat-card.disabled { opacity: 0.35; cursor: not-allowed; }

.card-title { font-weight: 700; font-size: 0.75rem; color: #fff; }
.card-desc { font-size: 0.65rem; color: var(--text-secondary); line-height: 1.25; margin: 2px 0; flex: 1; }
.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 2px;
    font-weight: 700;
}

.meta-mana { color: var(--accent-mana); }

/* Battle Log (Right) */
.dashboard-log-pane {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    padding: 6px 10px;
    border-color: var(--panel-border);
    overflow: hidden;
}

.dashboard-log-pane h4 {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 2px;
}

.log-messages {
    flex: 1;
    overflow-y: auto;
    font-size: 0.68rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Modals Overlay */
.modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden { opacity: 0; pointer-events: none; }

.modal-content {
    width: 82%;
    max-width: 780px;
    max-height: 85%;
    display: flex;
    flex-direction: column;
    padding: 15px;
    position: relative;
    border-radius: 10px;
}

.modal-header h2 { font-family: var(--font-heading); font-size: 1.2rem; }

/* Dungeon merchant store specific styles */
.merchant-modal { border-color: rgba(6, 182, 212, 0.25); }
.shop-subtitle { font-size: 0.72rem; color: var(--text-secondary); margin-bottom: 12px; }

.shop-sections-layout {
    display: flex;
    gap: 15px;
    overflow: hidden;
}

.shop-gear-container { flex: 1.8; }
.shop-relics-container { flex: 1; }

.shop-gear-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 3px;
}

.shop-relics-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.shop-item-card {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-item-card:hover { transform: translateY(-2px); }

.shop-item-price {
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 4px;
    color: var(--accent-gold);
}

.relic-shop-card {
    background: rgba(251, 191, 36, 0.03);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.relic-shop-card:hover:not(.purchased) {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.06);
}

.relic-shop-card.purchased {
    opacity: 0.4;
    cursor: not-allowed;
}

.relic-title {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--accent-gold);
}

/* Armory, level up, stat point allocators */
.hero-header-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.exp-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(0,0,0,0.4);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.exp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green) 0%, #34d399 100%);
    width: 0%;
    transition: width 0.3s;
}

.exp-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6rem;
    font-weight: 700;
}

.stat-points-allocator {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px;
    margin-top: 5px;
}

.pts-title { font-size: 0.72rem; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 2px; }

.alloc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    margin-top: 4px;
}

.btn-alloc {
    width: 18px;
    height: 18px;
    background: var(--accent-blue);
    border: none;
    color: #000;
    font-weight: 950;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-alloc:hover { background: #fff; }

.set-bonuses-box {
    margin-top: 6px;
    background: rgba(234, 179, 8, 0.03);
    border: 1px solid rgba(234, 179, 8, 0.15);
    padding: 6px;
    border-radius: 6px;
}

.set-bonuses-box h4 { font-size: 0.7rem; color: var(--rarity-set); font-weight: 800; border-bottom: 1px solid rgba(234,179,8,0.1); padding-bottom: 2px; }
.set-bonuses-box ul { list-style: none; padding-left: 2px; font-size: 0.65rem; }
.set-bonuses-box li { margin-top: 2px; color: var(--text-secondary); }

/* Rarity Border updates for sets/mythics */
.rarity-mythic {
    border-color: var(--rarity-mythic);
    box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.25);
    animation: glow-red 2s infinite alternate;
}

@keyframes glow-red {
    0% { box-shadow: inset 0 0 10px rgba(239, 68, 68, 0.2); }
    100% { box-shadow: inset 0 0 15px rgba(239, 68, 68, 0.4), 0 0 8px rgba(239, 68, 68, 0.2); }
}

.rarity-set {
    border-color: var(--rarity-set);
    box-shadow: inset 0 0 12px rgba(234, 179, 8, 0.25);
    animation: glow-gold-shimmer 2s infinite alternate;
}

@keyframes glow-gold-shimmer {
    0% { box-shadow: inset 0 0 10px rgba(234, 179, 8, 0.2); }
    100% { box-shadow: inset 0 0 15px rgba(234, 179, 8, 0.4), 0 0 8px rgba(234, 179, 8, 0.2); }
}

.text-mythic { color: var(--rarity-mythic); }
.text-set { color: var(--rarity-set); }

/* 4 Slots Grid update */
.equipped-slots-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.equip-slot {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 4px 6px;
    gap: 3px;
}

.slot-label { width: 100%; font-size: 0.65rem; }
.slot-item-placeholder { font-size: 0.72rem; }

/* Buttons */
.btn {
    border: none;
    border-radius: 5px;
    padding: 6px 12px;
    font-family: var(--font-body);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.72rem;
}

.btn.primary {
    background: linear-gradient(135deg, #0891b2 0%, #0369a1 100%);
    color: #fff;
    box-shadow: 0 4px 10px rgba(6, 182, 212, 0.2);
}

.btn.primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(6, 182, 212, 0.3);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn.secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }

.btn:disabled, .btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.hidden { display: none !important; }

/* Visual Combat Graphics */
.slash-effect {
    position: absolute;
    top: 5%; left: 5%; right: 5%; bottom: 5%;
    background: linear-gradient(135deg, transparent 46%, #fff 49%, var(--accent-red) 51%, transparent 54%);
    z-index: 20;
    pointer-events: none;
    animation: slash-fade 0.35s ease-out forwards;
}
@keyframes slash-fade {
    0% { transform: scaleX(0); opacity: 1; }
    40% { transform: scaleX(1.2); opacity: 1; }
    100% { opacity: 0; }
}

.heal-bloom-effect {
    position: absolute;
    top: 40%; left: 50%;
    transform: translate(-50%, -50%);
    width: 15px; height: 15px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.8) 0%, rgba(16, 185, 129, 0.4) 40%, transparent 70%);
    border-radius: 50%;
    z-index: 20;
    pointer-events: none;
    animation: bloom-expand 0.5s ease-out forwards;
}
@keyframes bloom-expand {
    0% { transform: translate(-50%, -50%) scale(0.6); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(7.5); opacity: 0; }
}

.aoe-flash-effect {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.35);
    z-index: 50;
    pointer-events: none;
    animation: flash-fade-out 0.4s ease-out forwards;
}
@keyframes flash-fade-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.floating-dmg-text {
    position: absolute;
    font-weight: 900;
    font-size: 1.25rem;
    z-index: 30;
    pointer-events: none;
    text-shadow: 0 0 4px #000, 0 0 8px rgba(0,0,0,0.8);
    transform: translate(-50%, -50%);
    animation: float-up-fade 0.8s ease-out forwards;
}

.text-red { color: #f43f5e; }
.text-green { color: #10b981; }
.text-blue { color: #3b82f6; }
.text-purple { color: #a855f7; }

@keyframes float-up-fade {
    0% {
        transform: translate(-50%, 0) scale(0.8);
        opacity: 0;
    }
    15% {
        transform: translate(-50%, -20px) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -60px) scale(0.9);
        opacity: 0;
    }
}

#victory-heroes-showcase {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 15px 0;
    width: 100%;
}

.victory-hero-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 125px;
    position: relative;
    transition: all 0.3s ease;
}

.victory-hero-card.mvp {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.08);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.35);
    transform: scale(1.08);
    z-index: 10;
}

.victory-hero-emoji {
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 8px;
    overflow: hidden;
}

.victory-hero-card.mvp .victory-hero-emoji {
    border: 2px solid var(--accent-gold);
    box-shadow: 0 0 10px var(--accent-gold);
}

.mvp-badge {
    position: absolute;
    top: -10px;
    background: var(--accent-gold);
    color: #000;
    font-weight: 900;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 0 8px var(--accent-gold);
    letter-spacing: 0.5px;
}

.victory-hero-name {
    font-weight: 700;
    font-size: 0.8rem;
    margin-top: 4px;
}

.victory-hero-dmg {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Close button top right */
.close-btn {
    position: absolute !important;
    top: 15px !important;
    right: 20px !important;
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    font-size: 1.5rem !important;
    cursor: pointer !important;
    line-height: 1 !important;
    z-index: 100 !important;
}

.close-btn:hover {
    color: var(--accent-red) !important;
}

/* Horizontal scrolling roster selector grid wrapping to 2 or 3 rows */
#inventory-hero-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    max-height: 125px !important;
    overflow-y: auto !important;
    gap: 5px !important;
    padding: 6px 3px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    margin-bottom: 10px !important;
    width: 100% !important;
    scrollbar-width: thin !important;
}

.hero-tab {
    flex: 0 0 auto !important;
    width: 76px !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 6px !important;
    padding: 4px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    position: relative !important;
    user-select: none !important;
}

.hero-tab:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.hero-tab.active {
    background: rgba(6, 182, 212, 0.08) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25) !important;
}

.hero-tab .tab-exp-container {
    width: 100% !important;
    height: 3px !important;
    background: rgba(0,0,0,0.5) !important;
    border-radius: 2px !important;
    margin-top: 4px !important;
    overflow: hidden !important;
    position: relative !important;
}

.hero-tab .tab-exp-fill {
    height: 100% !important;
    background: linear-gradient(90deg, var(--accent-green) 0%, #34d399 100%) !important;
    width: 0% !important;
}

/* Reduced font-sizes inside Armory */
.hero-tab-name {
    font-size: 0.6rem !important;
    font-weight: 700 !important;
    color: #fff !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    width: 100% !important;
    text-align: center !important;
}

.hero-tab-lvl {
    font-size: 0.5rem !important;
    color: var(--text-secondary) !important;
    line-height: 1.1 !important;
}

.hero-equipment-stats {
    font-size: 0.68rem !important;
}

.stat-points-allocator {
    font-size: 0.65rem !important;
    padding: 6px !important;
}

.pts-title {
    font-size: 0.68rem !important;
}

.alloc-row {
    font-size: 0.65rem !important;
    margin-top: 3px !important;
}

.equipped-slots-grid {
    font-size: 0.65rem !important;
}

.slot-label {
    font-size: 0.6rem !important;
}

.slot-item-placeholder {
    font-size: 0.68rem !important;
}

.hero-tab.active-squad-member {
    border-color: rgba(34, 211, 238, 0.4) !important;
    background: rgba(6, 182, 212, 0.04) !important;
    box-shadow: inset 0 0 6px rgba(6, 182, 212, 0.15) !important;
}

.hero-tab.active-squad-member:hover {
    border-color: rgba(34, 211, 238, 0.6) !important;
    background: rgba(6, 182, 212, 0.08) !important;
}

/* --- ICON ANIMATIONS --- */

/* 1. Roster selector hover pop */
.card-emoji {
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.25s ease;
}
.roster-card:hover:not(.locked):not(.dead) .card-emoji {
    transform: scale(1.2) translateY(-2px);
    filter: drop-shadow(0 4px 8px rgba(6, 182, 212, 0.45));
}

/* 2. squad slots animations */
.squad-slot:not(.empty) .slot-emoji {
    animation: bounce-gentle 2.5s infinite ease-in-out;
}
@keyframes bounce-gentle {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.05); }
}

/* 3. Spell / power inline icons */
.spell-icon-inline {
    display: inline-block;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.combat-card:hover:not(.disabled) .spell-icon-inline {
    transform: scale(1.3) rotate(8deg);
    filter: drop-shadow(0 0 6px var(--accent-blue));
}

/* 4. Loot / Gear icons animation on hover & shimmer for high rarities */
.loot-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, filter 0.3s ease;
}
.shop-item-card:hover .loot-icon,
.inventory-item-card:hover .item-icon {
    transform: scale(1.18) translateY(-2px);
}

/* Rarity specific active icon shimmers */
.rarity-mythic .loot-icon {
    animation: mythic-icon-shimmer 2s infinite alternate ease-in-out;
}
@keyframes mythic-icon-shimmer {
    0% { filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)) saturate(1.1); }
    100% { filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.9)) saturate(1.5); }
}

.rarity-legendary .loot-icon {
    animation: legendary-icon-shimmer 2.2s infinite alternate ease-in-out;
}
@keyframes legendary-icon-shimmer {
    0% { filter: drop-shadow(0 0 2px rgba(249, 115, 22, 0.4)); }
    100% { filter: drop-shadow(0 0 7px rgba(249, 115, 22, 0.85)); }
}

.rarity-epic .loot-icon {
    animation: epic-icon-shimmer 2.4s infinite alternate ease-in-out;
}
@keyframes epic-icon-shimmer {
    0% { filter: drop-shadow(0 0 2px rgba(168, 85, 247, 0.4)); }
    100% { filter: drop-shadow(0 0 6px rgba(168, 85, 247, 0.8)); }
}

/* 5. Unlock Modal Pop & Glow */
#unlock-hero-emoji {
    display: inline-block;
    animation: unlock-pop 1.1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, unlock-glow 3s infinite ease-in-out alternate;
}
@keyframes unlock-pop {
    0% { transform: scale(0) rotate(-45deg); opacity: 0; }
    70% { transform: scale(1.25) rotate(12deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes unlock-glow {
    0% { filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.3)); }
    100% { filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.8)) brightness(1.1); }
}

/* 6. Armory Tabs active/hover transitions */
.hero-tab {
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.2s ease, background 0.2s ease !important;
}
.hero-tab:hover {
    transform: translateY(-2px);
}
.hero-tab.active img,
.hero-tab.active div {
    animation: active-tab-pulse 2.2s infinite ease-in-out;
}
@keyframes active-tab-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 7. Action tracker: Highlight character cards that have not acted yet */
.battle-unit.has-not-acted .unit-info-plate {
    border-color: var(--accent-green) !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.45);
}

.battle-unit.has-not-acted::after {
    content: 'READY';
    position: absolute;
    top: -5px;
    right: -2px;
    background: linear-gradient(135deg, var(--accent-green) 0%, #34d399 100%);
    color: #000;
    font-weight: 900;
    font-size: 0.52rem;
    padding: 1px 4px;
    border-radius: 4px;
    box-shadow: 0 0 8px var(--accent-green);
    z-index: 10;
    letter-spacing: 0.5px;
    animation: ready-badge-pulse 1.5s infinite alternate ease-in-out;
}

@keyframes ready-badge-pulse {
    0% { opacity: 0.8; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1.05); }
}

.hero-side .battle-unit:not(.has-not-acted):not(.dead) .unit-info-plate {
    opacity: 0.75;
    border-color: rgba(255, 255, 255, 0.05);
}

/* 8. Weakness indicators */
.unit-weaknesses {
    display: flex;
    justify-content: center;
    gap: 3px;
    margin-top: 1px;
    min-height: 10px;
}
.element-weakness {
    font-size: 0.52rem;
    background: rgba(0, 0, 0, 0.45);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 0px 4px;
    line-height: 1.15;
    display: flex;
    align-items: center;
    gap: 2px;
    font-weight: 800;
}
.element-weakness.fire { border-color: var(--accent-red); color: var(--accent-red); }
.element-weakness.ice { border-color: var(--accent-blue); color: var(--accent-blue); }
.element-weakness.nature { border-color: var(--accent-green); color: var(--accent-green); }




