@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

:root {
    --bg-dark: #07050d;
    --panel-bg: rgba(23, 17, 38, 0.75);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f1ecf9;
    --text-secondary: #a29bb3;
    --accent: #9b59b6;
    --accent-glow: rgba(155, 89, 182, 0.4);
    
    /* Rarities */
    --rarity-white: #e2e2e2;
    --rarity-green: #2ecc71;
    --rarity-blue: #3498db;
    --rarity-purple: #9b59b6;
    --rarity-gold: #f1c40f;
    --rarity-orange: #e67e22;
    --rarity-rainbow: linear-gradient(45deg, #ff007f, #ff00ff, #00ffff, #00ff00, #ffff00, #ff0000);
}

body {
    background: url('assets/town_bg.png') center/cover fixed, radial-gradient(circle at 50% 50%, #1c1530 0%, #07050d 100%);
    color: var(--text-primary);
    height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

header {
    background: rgba(7, 5, 13, 0.8);
    border-bottom: 1px solid var(--panel-border);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(45deg, #e74c3c, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.player-header-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.header-stat {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 14px;
}

.header-stat span {
    font-weight: 600;
    color: #e67e22;
}

/* Main Container */
.main-content {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
    padding: 12px 20px;
    position: relative;
    overflow: hidden;
}

/* Screens */
.screen {
    width: 100%;
    max-width: 1300px;
    display: none !important;
    animation: fadeIn 0.4s ease forwards;
}

.screen.active {
    display: flex !important;
    flex-direction: column;
    gap: 20px;
}

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

/* Glass Panel Styling */
.glass-panel {
    background: rgba(45, 35, 60, 0.5) !important;
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    box-shadow: 
        0 40px 80px rgba(0, 0, 0, 0.6),
        inset 0 0 80px rgba(255, 255, 255, 0.1);
    padding: 25px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
}

.glass-panel::before, .glass-panel::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.65;
}

.glass-panel::before {
    top: -10%; left: -10%;
    width: 300px; height: 300px;
    background: radial-gradient(circle, #9b59b6, transparent 70%);
}

.glass-panel::after {
    bottom: -20%; right: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, #f1c40f, transparent 70%);
    opacity: 0.35;
}

/* Buttons */
button {
    background: linear-gradient(135deg, #6c3483, #884ea0);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 2px solid rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-20deg);
    transition: all 0.5s ease;
}

button:hover::after {
    left: 150%;
}

button:hover {
    box-shadow: 0 8px 25px var(--accent-glow);
    background: linear-gradient(135deg, #7d3c98, #9b59b6);
    border-color: rgba(255, 255, 255, 0.3);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

button:disabled {
    background: #4a4753 !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.5;
}

/* Main Menu Screen */
#main-menu-screen {
    justify-content: flex-start;
    align-items: center;
    max-width: 800px;
    margin: 20px auto;
}

.menu-title {
    text-align: center;
    margin-bottom: 30px;
}

.menu-title h1 {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, #e74c3c, #f1c40f, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 5px;
}

.menu-title p {
    color: var(--text-secondary);
    font-size: 16px;
}

.menu-options {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

.setup-group {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.setup-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.setup-group select, .setup-group input[type="range"], .setup-group input[type="text"] {
    width: 100%;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
}

.setup-group .range-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-top: 5px;
    color: var(--text-secondary);
}

.new-game-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    font-size: 18px;
    padding: 12px;
}

.new-game-btn:hover {
    background: linear-gradient(135deg, #ec7063, #e74c3c);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

/* ===== LOGIN SCREEN ===== */
#login-screen {
    justify-content: center;
    align-items: center;
    max-width: 480px;
    margin: auto;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    padding: 0 10px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.login-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-field input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.login-field input:focus {
    border-color: rgba(155, 89, 182, 0.7);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.2);
}

.login-field input::placeholder {
    color: rgba(255,255,255,0.25);
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #8e44ad, #c0392b);
    border-radius: 12px;
    letter-spacing: 0.5px;
    margin-top: 4px;
    box-shadow: 0 6px 20px rgba(142, 68, 173, 0.4);
}

.login-btn:hover {
    background: linear-gradient(135deg, #9b59b6, #e74c3c);
    box-shadow: 0 8px 28px rgba(155, 89, 182, 0.55);
}

/* Town/Dashboard Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    gap: 20px;
    height: calc(100vh - 130px);
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* Left Panel: Stats */
.stats-panel h2 {
    font-size: 20px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-points-badge {
    background: #e67e22;
    color: white;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.attribute-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.attribute-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.attribute-info {
    display: flex;
    flex-direction: column;
}

.attribute-name {
    font-weight: 600;
    font-size: 14px;
}

.attribute-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.attribute-value-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attribute-value {
    font-weight: 800;
    font-size: 16px;
    color: #9b59b6;
    min-width: 30px;
    text-align: center;
}

.plus-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

/* Secondary Stats */
.combat-stats-section {
    flex: 1;
    overflow-y: auto;
}

.combat-stats-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.combat-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.combat-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.05);
}

.combat-stat-row span:last-child {
    font-weight: 600;
}

/* Center Panel: Equipment & Inventory */
.eq-inv-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

/* Equipment Paper Doll */
.equipment-layout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--panel-border);
}

.eq-slot {
    aspect-ratio: 1;
    /* Parchment background for equipment slots */
    background: linear-gradient(135deg, #3a2e18 0%, #2e2310 50%, #3a2e18 100%);
    border: 1px dashed rgba(212, 175, 55, 0.35);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.4);
}

.eq-slot.highlight-equip-valid {
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6), inset 0 0 10px rgba(255, 255, 255, 0.2);
    z-index: 2;
}

.eq-slot.highlight-equip-invalid {
    border-color: rgba(255, 100, 100, 0.9);
    box-shadow: 0 0 12px rgba(255, 100, 100, 0.6), inset 0 0 10px rgba(255, 100, 100, 0.2);
    z-index: 2;
}

.eq-slot:hover {
    background: linear-gradient(135deg, #4a3a20 0%, #3a2d14 50%, #4a3a20 100%);
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: inset 0 0 8px rgba(0,0,0,0.3), 0 0 8px rgba(212,175,55,0.2);
}

.eq-slot-label {
    font-size: 10px;
    color: rgba(212, 175, 55, 0.7);
    text-transform: uppercase;
    margin-top: 5px;
    pointer-events: none;
    text-align: center;
    line-height: 1.1;
    letter-spacing: 0.5px;
    transition: opacity 0.15s;
}

.eq-slot-icon {
    font-size: 20px;
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.15s;
}

/* When item is equipped — hide the placeholder emoji & label */
.eq-slot:has(.item-card) .eq-slot-icon,
.eq-slot:has(.item-card) .eq-slot-label {
    display: none;
}

/* Equipped Item Styling */
.item-card {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 7px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid transparent;
    /* Subtle inner glow from rarity border */
    overflow: hidden;
}

/* Inventory Grid */
.inventory-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.inventory-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    grid-auto-rows: 65px;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    overflow-y: auto;
}

.inv-slot {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    overflow: hidden;
}

.inv-slot:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Item Rarity styles */
.rarity-common { border-color: rgba(226, 226, 226, 0.3) !important; background: rgba(226, 226, 226, 0.05); }
.rarity-uncommon { border-color: rgba(46, 204, 113, 0.5) !important; background: rgba(46, 204, 113, 0.05); }
.rarity-rare { border-color: rgba(52, 152, 219, 0.5) !important; background: rgba(52, 152, 219, 0.05); }
.rarity-epic { border-color: rgba(155, 89, 182, 0.5) !important; background: rgba(155, 89, 182, 0.05); }
.rarity-legendary { border-color: rgba(241, 196, 112, 0.6) !important; background: rgba(241, 196, 112, 0.05); }
.rarity-mythic { border-color: rgba(230, 126, 34, 0.6) !important; background: rgba(230, 126, 34, 0.05); }
.rarity-relic {
    border-color: transparent !important;
    background: rgba(255, 0, 127, 0.05);
    box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.2);
}
.rarity-relic::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border-radius: 8px;
    background: var(--rarity-rainbow);
    z-index: -1;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: destination-out;
}

.item-icon {
    display: block;
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    font-size: 26px;
    text-shadow: 0 0 8px rgba(0,0,0,0.5);
}

.item-quantity {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    font-weight: 800;
    color: white;
}

/* Tooltip */
.game-tooltip {
    position: fixed;
    background: rgba(30, 20, 45, 0.85);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 18px;
    z-index: 10000;
    min-width: 280px;
    width: max-content;
    max-width: 700px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.6),
        inset 0 0 30px rgba(255, 255, 255, 0.05);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip-name {
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 4px;
    text-shadow: 0 0 6px rgba(0,0,0,0.3);
}

.tooltip-type {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.tooltip-stat {
    font-size: 15px;
    margin-bottom: 3px;
    display: flex;
    justify-content: space-between;
}

.tooltip-req {
    font-size: 14px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
    color: #e74c3c;
}
.tooltip-req.met {
    color: #2ecc71;
}

.tooltip-price {
    font-size: 14px;
    margin-top: 5px;
    color: #f1c40f;
    font-weight: 600;
}

.diff-positive { color: #2ecc71; font-weight: 600; }
.diff-negative { color: #e74c3c; font-weight: 600; }

/* Right Panel: Tab-like Navigation for Shop/Arena */
.right-tab-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.tabs-header {
    display: flex;
    gap: 10px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
}

.tab-btn.active {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    border-color: var(--accent);
}

.tab-content {
    flex: 1;
    display: none;
    overflow-y: auto;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Arena View */
.boss-card, .super-boss-card {
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.15), rgba(125, 60, 152, 0.15));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(231, 76, 60, 0.4);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3), inset 0 0 20px rgba(231, 76, 60, 0.1);
    transition: all 0.3s ease;
}

.boss-card:hover, .super-boss-card:hover {
    box-shadow: 0 15px 30px rgba(0,0,0,0.4), inset 0 0 30px rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.8);
}

.super-boss-card {
    background: linear-gradient(135deg, rgba(142, 68, 173, 0.2), rgba(41, 128, 185, 0.2));
    border: 1px solid rgba(155, 89, 182, 0.6);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3), inset 0 0 20px rgba(155, 89, 182, 0.1);
}

.super-boss-card:hover {
    border-color: rgba(155, 89, 182, 1);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4), inset 0 0 30px rgba(155, 89, 182, 0.3);
}

.boss-title {
    font-weight: 800;
    color: #e74c3c;
    text-transform: uppercase;
    font-size: 16px;
    text-align: center;
    letter-spacing: 1px;
}

.super-boss-card .boss-title, .rainbow-text {
    background: var(--rarity-rainbow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.enemy-option {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.enemy-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.enemy-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.enemy-archetype {
    font-size: 11px;
    color: var(--text-secondary);
}

.enemy-rewards {
    font-size: 12px;
    color: #f1c40f;
}

.refresh-opponents-btn {
    background: #2980b9;
    border-color: #2471a3;
}
.refresh-opponents-btn:hover {
    background: #3498db;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

/* Shop View */
.icon-gold {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: radial-gradient(circle, #f1c40f 30%, #d4ac0d 90%);
    border-radius: 50%;
    border: 1px solid #b8860b;
    box-shadow: inset 0 0 3px rgba(255,255,255,0.8), 0 0 3px rgba(241,196,15,0.5);
    margin-left: 2px;
    vertical-align: middle;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--panel-border);
}

.shop-tab-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.shop-tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.shop-tab-btn.active {
    background: linear-gradient(135deg, #2980b9, #3498db);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.shop-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

.shop-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 15px;
    gap: 12px;
    cursor: help;
    transition: all 0.3s ease;
}

.shop-item-row:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
    box-shadow: -5px 5px 15px rgba(0,0,0,0.3);
}

.shop-item-details {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.shop-item-name {
    font-size: 16px;
    font-weight: 600;
}

.shop-item-cost {
    font-size: 14px;
    color: #f1c40f;
    font-weight: bold;
}

.buy-btn {
    padding: 8px 14px;
    font-size: 14px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}
.buy-btn:hover, .sell-btn:hover, .donate-btn:hover {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
    transform: none !important;
}

/* Battle Screen & Arena Visualization */
#battle-screen {
    max-width: 100%;
    width: 100%;
    height: 100%; /* occupy full height of main-content */
    margin: 0 auto;
    display: none;
    box-sizing: border-box;
}

#battle-screen.active {
    display: flex !important;
    flex-direction: column;
    gap: 15px;
}

/* Battle Side-by-Side Layout */
.battle-main-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    align-items: stretch;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.battle-main-layout .battle-log-panel {
    width: 250px;
    height: 100%;
    flex-shrink: 0;
}

.battle-main-layout .battle-log-box {
    height: 100%;
    box-sizing: border-box;
}

.battle-main-layout .arena-environment {
    flex: 1;
    height: 100%;
    margin-bottom: 0;
}

.arena-environment {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    overflow: hidden;
    background: url('assets/arena_bg.png') center/cover no-repeat;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.8);
}

.arena-environment.cave-bg {
    background: url('assets/arena_bg_new.png') center/cover no-repeat;
}

.arena-environment.forest-bg {
    background: url('assets/arena_forest.png') center/cover no-repeat;
}

.arena-environment.tower-bg {
    background: url('assets/Endless_Arena.png') center/cover no-repeat;
}

.arena-environment.expedition-bg {
    background: url('assets/arena_highlands.png') center/cover no-repeat;
}

.arena-environment.mirror-bg {
    background: url('assets/Reflection_Arena.png') center/cover no-repeat;
}

.arena-bg-layer { display: none; }
.arena-ground { display: none; }
.arena-props { display: none; }

.arena-fighters-container {
    position: absolute;
    top: 15px;
    bottom: -5%; /* moved 10% lower from 5% to drop their feet closer to bottom */
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 200px; /* original gap restored */
}

.vs-indicator {
    position: absolute;
    left: 50%; top: 30%;
    transform: translate(-50%, -50%);
    font-size: 36px; font-weight: 800; color: #e74c3c;
    text-shadow: 0 0 15px rgba(231,76,60,0.8), 2px 2px 0px #000;
}

.fighter-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.health-bar-mini {
    width: 100px; height: 8px;
    background: #000;
    border: 1px solid #fff;
    border-radius: 4px;
}
.health-bar-fill {
    height: 100%; background: #2ecc71; width: 100%;
    transition: width 0.3s ease;
}

.fighter-name-plate {
    font-size: 12px; font-weight: 800;
    background: rgba(0,0,0,0.7);
    padding: 3px 8px; border-radius: 4px;
    text-shadow: 1px 1px 0 #000;
}

/* Base Sprite Setup (CSS blocky figures) */
.sprite-container {
    width: 120px; height: 180px;
    position: relative;
    border: 2px solid rgba(155, 89, 182, 0.35);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: inset 0 0 15px rgba(155, 89, 182, 0.15), 0 8px 24px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    overflow: hidden;
}

/* Combat Arena Specific Sprite Setup (Taller, transparent frame, overflow visible for wings) */
.arena-environment .sprite-container {
    width: 180px;
    height: 270px;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
}

.arena-environment .sprite-container .avatar,
.arena-environment .sprite-container .monster-rendered {
    transform: scale(1.95);
    transform-origin: bottom center;
}

.sprite-body {
    position: absolute;
    width: 100%; height: 100%;
    bottom: 0; left: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}
.sprite-body::after { display: none; }

/* Creation Preview Frame */
.creation-preview-container {
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(155, 89, 182, 0.15);
}

/* CSS Avatar System */
.avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    --skin: #f1c27d;
    --hair: #2c3e50;
    --h-scale: 1;
    --w-scale: 1;
    transition: all 0.3s ease;
}

.avatar-head {
    width: calc(26px * var(--w-scale));
    height: calc(30px * var(--h-scale));
    background: var(--skin);
    border-radius: 40% 40% 50% 50%;
    position: relative;
    z-index: 3;
    box-shadow: inset -3px -3px 0 rgba(0,0,0,0.15);
}

.avatar-hair {
    position: absolute;
    background: var(--hair);
    top: -4px;
    left: -5%;
    width: 110%;
    border-radius: 10px 10px 0 0;
    z-index: 4;
}

/* Hair variations */
.hair-bald { display: none; }
.hair-short { height: 14px; }
.hair-long { height: 35px; border-radius: 10px 10px 4px 4px; }
.hair-ponytail { height: 14px; }
.hair-ponytail::after {
    content: ''; position: absolute;
    width: 10px; height: 25px;
    background: var(--hair);
    right: -8px; top: 8px;
    border-radius: 5px;
    transform: rotate(-25deg);
}

.avatar-torso {
    width: calc(36px * var(--w-scale));
    height: calc(45px * var(--h-scale));
    background: #bdc3c7; /* Tunic */
    border-radius: 8px 8px 4px 4px;
    margin-top: -3px;
    z-index: 2;
    position: relative;
    box-shadow: inset -4px -4px 0 rgba(0,0,0,0.1);
}

.gender-female .avatar-torso {
    width: calc(30px * var(--w-scale));
    border-radius: 12px 12px 6px 6px;
}

.avatar-arms {
    position: absolute;
    top: calc(27px * var(--h-scale));
    width: calc(52px * var(--w-scale));
    display: flex;
    justify-content: space-between;
    z-index: 1;
    pointer-events: none;
}

.gender-female .avatar-arms {
    width: calc(44px * var(--w-scale));
}

.avatar-arm {
    width: calc(10px * var(--w-scale));
    height: calc(35px * var(--h-scale));
    background: var(--skin);
    border-radius: 4px;
    box-shadow: inset -2px -2px 0 rgba(0,0,0,0.1);
}

.chest-plate .avatar-arm {
    background: #95a5a6; border: 1px solid #7f8c8d;
}
.chest-leather .avatar-arm {
    background: #8b4513; border: 1px dashed #5c2e0b;
}
.chest-robe .avatar-arm {
    background: #2980b9;
}

.avatar-legs {
    width: calc(32px * var(--w-scale));
    height: calc(45px * var(--h-scale));
    display: flex;
    justify-content: space-between;
    margin-top: -2px;
    z-index: 1;
}

.gender-female .avatar-legs {
    width: calc(28px * var(--w-scale));
}

.avatar-leg {
    width: 42%;
    height: 100%;
    background: #7f8c8d; /* Pants */
    border-radius: 3px;
    box-shadow: inset -2px -2px 0 rgba(0,0,0,0.1);
}

/* Armor Classes */
.head-plate .avatar-hair { display: none; }
.head-plate .avatar-head { background: #95a5a6; border-top: 4px solid #7f8c8d; border-radius: 30% 30% 50% 50%; }
.head-plate .avatar-head::after { content: ''; position: absolute; width: 60%; height: 5px; background: #2c3e50; top: 10px; left: 20%; border-radius: 2px; }
.head-leather .avatar-head { border-top: 3px solid #a0522d; }
.head-robe .avatar-head { border-top: 3px solid #2980b9; border-radius: 50% 50% 30% 30%; }

.chest-plate .avatar-torso { background: linear-gradient(to bottom, #bdc3c7, #95a5a6); border: 1px solid #7f8c8d; border-radius: 6px 6px 4px 4px; }
.chest-plate .avatar-torso::before { content: ''; position: absolute; width: 110%; height: 10px; background: #7f8c8d; top: -2px; left: -5%; border-radius: 4px; }
.chest-leather .avatar-torso { background: #8b4513; border: 1px dashed #5c2e0b; }
.chest-robe .avatar-torso { background: #2980b9; border-radius: 10px 10px 2px 2px; }

.legs-plate .avatar-leg { background: #7f8c8d; border: 1px solid #bdc3c7; }
.legs-leather .avatar-leg { background: #a0522d; }
.legs-robe .avatar-leg { background: #2c3e50; }

.sprite-weapon {
    position: absolute;
    width: 10px; height: 70px;
    background: #bdc3c7;
    bottom: 20px; right: 0px;
    transform-origin: bottom center;
    border-radius: 2px;
    box-shadow: inset -2px 0 0 rgba(0,0,0,0.2);
}
.sprite-weapon::after { /* Hilt */
    content: ''; position: absolute;
    width: 20px; height: 10px;
    background: #7f8c8d;
    bottom: 10px; left: -5px;
}

.sprite-shield {
    position: absolute;
    width: 30px; height: 40px;
    background: #e67e22;
    bottom: 15px; left: 10px;
    border-radius: 5px 5px 15px 15px;
    border: 2px solid #d35400;
}

/* Enemy flip */
.enemy .sprite-body { }
.enemy { transform: scaleX(-1); }
.enemy .fighter-name-plate { transform: scaleX(-1); }
.enemy .health-bar-mini { transform: scaleX(-1); }

/* Animations */
@keyframes idle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
.sprite-container { animation: idle 2s ease-in-out infinite; }

@keyframes attack1HPlayer {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(30px); }
}
@keyframes attack1HEnemy {
    0%, 100% { transform: scaleX(-1) translateX(0); }
    50% { transform: scaleX(-1) translateX(30px); }
}

@keyframes attack2HPlayer {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(45px); }
}
@keyframes attack2HEnemy {
    0%, 100% { transform: scaleX(-1) translateX(0); }
    50% { transform: scaleX(-1) translateX(45px); }
}

@keyframes attackMagicPlayer {
    0%, 100% { transform: translateX(0); filter: drop-shadow(0 0 0px #8e44ad); }
    50% { transform: translateX(20px); filter: drop-shadow(0 0 20px #8e44ad); }
}
@keyframes attackMagicEnemy {
    0%, 100% { transform: scaleX(-1) translateX(0); filter: drop-shadow(0 0 0px #8e44ad); }
    50% { transform: scaleX(-1) translateX(20px); filter: drop-shadow(0 0 20px #8e44ad); }
}

@keyframes hitAnim {
    0%, 100% { filter: brightness(1); transform: translateY(0); }
    50% { filter: brightness(1.5) hue-rotate(-30deg); transform: translateY(15px); }
}

@keyframes hitEnemyAnim {
    0%, 100% { filter: brightness(1); transform: scaleX(-1) translateY(0); }
    50% { filter: brightness(1.5) hue-rotate(-30deg); transform: scaleX(-1) translateY(15px); }
}

@keyframes dodgeAnim {
    0%, 100% { transform: translateX(0); opacity: 1; filter: blur(0); }
    50% { transform: translateX(-60px); opacity: 0.3; filter: blur(2px); }
}

@keyframes dodgeEnemyAnim {
    0%, 100% { transform: scaleX(-1) translateX(0); opacity: 1; filter: blur(0); }
    50% { transform: scaleX(-1) translateX(-60px); opacity: 0.3; filter: blur(2px); }
}

@keyframes blockAnim {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(10px); }
    50% { transform: translateX(-5px); filter: brightness(1.5); }
}

@keyframes blockEnemyAnim {
    0%, 100% { transform: scaleX(-1) translateX(0); }
    20% { transform: scaleX(-1) translateX(10px); }
    50% { transform: scaleX(-1) translateX(-5px); filter: brightness(1.5); }
}

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

@keyframes victoryEnemyAnim {
    0%, 100% { transform: scaleX(-1) translateY(0); }
    50% { transform: scaleX(-1) translateY(-40px); }
}

.anim-attack-1h { animation: attack1HPlayer 0.4s ease; }
.anim-attack-1h-enemy { animation: attack1HEnemy 0.4s ease; }
.anim-attack-2h { animation: attack2HPlayer 0.6s ease-in-out; }
.anim-attack-2h-enemy { animation: attack2HEnemy 0.6s ease-in-out; }
.anim-attack-magic { animation: attackMagicPlayer 0.6s ease; }
.anim-attack-magic-enemy { animation: attackMagicEnemy 0.6s ease; }

.anim-hit { animation: hitAnim 0.4s ease; }
.enemy .anim-hit { animation: hitEnemyAnim 0.4s ease; }

.anim-dodge { animation: dodgeAnim 0.4s ease; }
.enemy .anim-dodge { animation: dodgeEnemyAnim 0.4s ease; }

.anim-block { animation: blockAnim 0.4s ease; }
.enemy .anim-block { animation: blockEnemyAnim 0.4s ease; }

.anim-victory { animation: victoryAnim 0.8s ease infinite !important; }
.enemy .anim-victory { animation: victoryEnemyAnim 0.8s ease infinite !important; }

.anim-dead { transform: rotate(-90deg) translateX(-20px) translateY(40px) !important; transform-origin: bottom center; animation: none !important; filter: grayscale(1); }
.enemy .anim-dead { transform: scaleX(-1) rotate(-90deg) translateX(-20px) translateY(40px) !important; transform-origin: bottom center; animation: none !important; filter: grayscale(1); }

/* Compact Combatant Card placed above fighters */
.fighter-wrapper .combatant-card {
    width: 250px; /* twice the original 140px width (approx) */
    padding: 10px 14px; /* larger padding */
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    backdrop-filter: blur(4px);
    margin-bottom: 0; /* removed huge bottom margin, now handled by space-between */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    text-align: left;
    flex: none;
    position: relative;
    overflow: hidden;
}

.fighter-wrapper .combatant-card.active-turn {
    border-color: #3498db;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.6);
}

.fighter-wrapper .combatant-name {
    text-align: center;
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px #000;
}

/* Compact bars inside combatant card */
.fighter-wrapper .bar-container {
    width: 100%;
    height: 22px; /* twice the original 12px height */
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    margin-bottom: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,0.05);
}

.fighter-wrapper .bar-container:last-child {
    margin-bottom: 0;
}

.fighter-wrapper .bar-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px; /* twice the original 8px (approx) */
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.9);
    white-space: nowrap;
}

.bar-fill {
    height: 100%;
    transition: width 0.2s ease-out;
}

.hp-bar {
    background: linear-gradient(90deg, #c0392b, #e74c3c);
}

.mp-bar {
    background: linear-gradient(90deg, #2980b9, #3498db);
}

.charge-bar {
    background: linear-gradient(90deg, #f39c12, #f1c40f);
}
.bar-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    white-space: nowrap;
}

.battle-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 0;
    padding: 10px;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
}

.battle-action-btn {
    min-width: 120px;
}

/* Battle Log */
.battle-log-panel {
    height: 180px;
    display: flex;
    flex-direction: column;
}

.battle-log-box {
    flex: 1;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 10px 15px;
    font-size: 13px;
    line-height: 1.6;
}

.log-entry {
    margin-bottom: 4px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.02);
}

.log-damage { color: #e74c3c; font-weight: 600; }
.log-crit { color: #f1c40f; font-weight: 800; text-shadow: 0 0 4px rgba(241,196,15,0.3); }
.log-heal { color: #2ecc71; font-weight: 600; }
.log-system { color: #3498db; }
.log-dodge { color: #95a5a6; font-style: italic; }
.log-block { color: #e67e22; }

/* Sub-panels inside Battle Controls: Skills and Potions Selection */
.battle-popover {
    display: none;
    position: absolute;
    background: rgba(15, 11, 26, 0.95);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 10px;
    z-index: 10;
    max-width: 300px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    flex-direction: column;
    gap: 8px;
}

.battle-popover.active {
    display: flex;
}

.popover-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popover-item:hover {
    background: var(--accent);
}

.popover-item-cost {
    font-size: 11px;
    color: #3498db;
    font-weight: 600;
}

/* Floating damage numbers */
.floating-text {
    position: absolute;
    font-size: 20px;
    font-weight: 800;
    text-shadow: 0 2px 5px rgba(0,0,0,0.8), 0 0 10px rgba(255,255,255,0.2);
    pointer-events: none;
    z-index: 1000;
    animation: floatUp 3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    10% { transform: translateY(-10px) scale(1.2); opacity: 1; }
    70% { transform: translateY(-30px) scale(1); opacity: 1; filter: none; }
    100% { transform: translateY(-50px) scale(0.8); opacity: 0; filter: blur(2px); }
}

.floating-bm {
    position: fixed;
    left: 5%;
    top: 50%;
    font-size: 26px;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(0,0,0,0.8), 0 0 5px rgba(255,255,255,0.4);
    pointer-events: none;
    z-index: 9999;
    animation: floatUpBM 3s ease-out forwards;
}

@keyframes floatUpBM {
    0% { top: 50%; opacity: 0; transform: scale(0.5); }
    10% { opacity: 1; transform: scale(1.2); }
    80% { opacity: 0.8; }
    100% { top: 10%; opacity: 0; transform: scale(1); filter: blur(1px); }
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.game-modal {
    width: 90%;
    max-width: 450px;
    animation: zoomIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.game-modal.large-modal {
    align-self: flex-start;
    margin-top: 20px;
    margin-bottom: 20px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

.game-modal.large-modal .modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    flex: 1;
    max-height: calc(100vh - 160px);
}

@keyframes zoomIn {
    from { transform: scale(0.85) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 15px rgba(241, 196, 15, 0.6);
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 15px 40px;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: -20px;
    margin-left: -20px;
    margin-right: -20px;
    letter-spacing: 1px;
    z-index: 2;
}

.modal-body {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.victory-reward {
    margin: 10px 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    font-weight: 600;
}

.text-gold { color: #f1c40f; }
.text-exp { color: #3498db; }

#town-screen {
    max-width: 100%;
    flex: 1;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #111;
}

#town-screen.active {
    display: flex;
}

.town-map-wrapper {
    width: 100%;
    height: calc(100vh - 60px);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #111;
}

/* Town Map & Hotspots */
.town-map {
    position: relative;
    height: 100%;
    flex-shrink: 0;
}

.town-bg-image {
    height: 100%;
    width: auto;
    display: block;
    pointer-events: none;
    user-select: none;
}

.town-hover-bg {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease-in-out, filter 0.3s ease, margin 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.town-map {
    border: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.8);
}

.building-hotspot {
    position: absolute;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: translate(-50%, -50%);
    z-index: 10;
}

.building-hotspot:hover {
    background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 70%);
    transform: translate(-50%, -55%) scale(1.1);
    filter: drop-shadow(0 10px 25px rgba(241, 196, 15, 0.8));
}

.hotspot-label {
    background: rgba(20, 15, 30, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 14px;
    border: 1px solid rgba(255,255,255,0.2);
    text-align: center;
    pointer-events: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateY(0);
}

.building-hotspot:hover .hotspot-label {
    background: rgba(241, 196, 15, 0.25);
    border-color: rgba(241, 196, 15, 0.8);
    color: #fff;
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 12px 25px rgba(241, 196, 15, 0.4);
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.8);
}

.hotspot-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    animation: pulse 1.5s infinite;
}

/* Opaque Modals */
.opaque-modal {
    background: rgba(45, 35, 60, 0.5) !important;
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    box-shadow: 
        0 40px 80px rgba(0, 0, 0, 0.6),
        inset 0 0 80px rgba(255, 255, 255, 0.1);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.opaque-modal::before, .opaque-modal::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.65;
}

.opaque-modal::before {
    top: -10%; left: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, #9b59b6, transparent 70%);
}

.opaque-modal::after {
    bottom: -20%; right: -10%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, #f1c40f, transparent 70%);
    opacity: 0.35;
}

.close-modal-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.close-modal-btn:hover {
    color: #fff;
    background: #e74c3c;
    border-color: #c0392b;
    transform: translateY(-50%) scale(1.1) rotate(90deg);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
}

/* Magic School Slots */
.magic-slot {
    width: 60px;
    height: 60px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    padding: 2px;
}

.magic-slot:hover {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.2);
}

.magic-slot.filled {
    border-color: #f1c40f;
    background: linear-gradient(135deg, rgba(155,89,182,0.4), rgba(41,128,185,0.4));
}

.skill-item {
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 13px;
    flex: 1 1 calc(33% - 10px);
}

.skill-item:hover {
    background: rgba(155,89,182,0.2);
    border-color: #9b59b6;
}

.skill-item.equipped {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.2);
}

/* Setup column adjustments */
.setup-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
/* ==========================================
   НАМЕТ ГЛАДІАТОРА — TENT MODAL REDESIGN
   ========================================== */

/* Tent modal overrides - Lighter Premium Glassmorphism WOW Effect */
.tent-modal {
    height: 100%;
    width: 1200px !important;
    max-width: 98vw !important;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: rgba(45, 35, 60, 0.5) !important;
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    box-shadow: 
        0 40px 80px rgba(0, 0, 0, 0.6),
        inset 0 0 80px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
}

/* Vibrant glowing orbs for WOW effect */
.tent-modal::before, .tent-modal::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.65;
}

.tent-modal::before {
    top: -10%; left: -10%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, #9b59b6, transparent 70%);
}

.tent-modal::after {
    bottom: -20%; right: -10%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, #f1c40f, transparent 70%);
    opacity: 0.35;
}

.tent-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 0;
    flex-shrink: 0;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 15px rgba(241, 196, 15, 0.6);
    letter-spacing: 1px;
}

/* Two-zone layout */
.tent-layout {
    display: flex;
    gap: 30px;
    padding: 30px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ---- LEFT ZONE: Paper Doll ---- */
.tent-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    width: 480px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        inset 0 0 30px rgba(255, 255, 255, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* The 3-column paperdoll grid */
.paperdoll-grid {
    display: grid;
    grid-template-columns: 82px 232px 82px;
    grid-auto-rows: 82px;
    gap: 10px;
    width: 100%;
    position: relative;
    overflow: visible;
}

/* Slots inside paper doll */
.pd-slot {
    width: 100%;
    height: 100%;
    background: rgba(30, 20, 45, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1.2);
    position: relative;
    overflow: hidden;
}

.pd-slot::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
}

.pd-slot:hover {
    transform: translateY(-4px) scale(1.03);
    border-color: #f1c40f;
    box-shadow: 
        0 10px 20px rgba(0,0,0,0.5),
        0 0 20px rgba(241, 196, 15, 0.4),
        inset 0 0 15px rgba(241, 196, 15, 0.2);
    z-index: 5;
}

.pd-slot .eq-slot-icon {
    font-size: 26px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.pd-slot:hover .eq-slot-icon {
    transform: scale(1.15);
    filter: drop-shadow(0 0 10px rgba(241, 196, 15, 0.8));
}

.pd-slot .eq-slot-label {
    font-size: 10px;
    margin-top: 4px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    transition: color 0.3s ease;
}

.pd-slot:hover .eq-slot-label {
    color: #fff;
    text-shadow: 0 0 8px #f1c40f;
}

/* Center avatar cell */
.pd-avatar-cell {
    grid-column: 2;
    grid-row: 1 / span 5;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.4) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 
        inset 0 0 40px rgba(0,0,0,0.5),
        0 10px 20px rgba(0,0,0,0.3);
    transition: all 0.4s ease;
}

.pd-avatar-cell::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 50px;
    background: radial-gradient(ellipse at center, rgba(155, 89, 182, 0.6) 0%, transparent 70%);
    z-index: 1;
    pointer-events: none;
    mix-blend-mode: screen;
}

.pd-avatar-cell:hover {
    border-color: rgba(155, 89, 182, 0.8);
    box-shadow: 
        inset 0 0 40px rgba(0,0,0,0.5),
        0 10px 25px rgba(0,0,0,0.4),
        0 0 30px rgba(155, 89, 182, 0.3);
}

/* Avatar sprite container inside tent */
#tent-avatar-container {
    position: relative;
    overflow: hidden;
    z-index: 10;
    width: 100%;
    height: 100%;
}

#tent-avatar-sprite {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
    border-radius: 16px;
}

/* Avatar layers fill the container; scale so gladiator fits with head visible */
#tent-avatar-sprite .avatar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Rings column — two stacked mini slots */
.pd-rings-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 82px;
}

.pd-ring-slot {
    flex: 1;
    min-height: 0;
}

.pd-ring-slot .eq-slot-icon {
    font-size: 16px;
}

.pd-ring-slot .eq-slot-label {
    font-size: 8px;
}

/* Empty placeholder cell */
.pd-empty {
    background: transparent;
    border: none;
    pointer-events: none;
}

/* Drag-drop highlight on eq-slots */
.pd-slot.drag-over {
    border-color: #f1c40f !important;
    background: rgba(241, 196, 15, 0.25) !important;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
}

.pd-slot.drag-invalid {
    border-color: #e74c3c !important;
    background: rgba(231, 76, 60, 0.2) !important;
}

/* Hint text */
.tent-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: auto;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ---- RIGHT ZONE: Inventory ---- */
.tent-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        inset 0 0 30px rgba(255, 255, 255, 0.3),
        0 10px 30px rgba(0, 0, 0, 0.3);
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.inventory-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 5px rgba(0,0,0,0.6);
    letter-spacing: 0.5px;
}

/* Inventory grid inside tent — scrollable */
.tent-inv-grid {
    flex: 1;
    overflow-y: auto !important;
    grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)) !important;
    grid-auto-rows: 66px !important;
    gap: 10px !important;
    align-content: start;
    padding-right: 12px; /* For scrollbar */
}

/* Inventory slots premium look inside tent */
.tent-inv-grid .inv-slot {
    border-radius: 10px;
    background: rgba(30, 20, 45, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1.2);
}

.tent-inv-grid .inv-slot:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 15px rgba(0,0,0,0.6), 
        inset 0 0 15px rgba(255,255,255,0.15);
    border-color: rgba(255, 255, 255, 0.5);
    z-index: 2;
}

/* Custom scrollbar for inventory grid */
.tent-inv-grid::-webkit-scrollbar {
    width: 8px;
}
.tent-inv-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.tent-inv-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(155, 89, 182, 0.8) 0%, rgba(100, 50, 150, 0.8) 100%);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.tent-inv-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(180, 100, 200, 1) 0%, rgba(120, 60, 180, 1) 100%);
}

/* Inventory item being dragged */
.inv-slot.dragging {
    opacity: 0.4;
    border-color: var(--accent) !important;
}

/* ==========================================
   ITEM COMPARE PANEL
   ========================================== */

#item-compare-panel {
    position: fixed;
    top: 80px; right: 20px;
    z-index: 500;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

.compare-panel-inner {
    background: #1a1528;
    border: 2px solid rgba(155, 89, 182, 0.5);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.9), 0 0 30px rgba(155,89,182,0.2);
    padding: 20px 20px 16px 20px;
    max-width: 95vw;
    position: relative;
    pointer-events: auto;
    animation: zoomIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.compare-close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.compare-close-btn:hover {
    color: #e74c3c;
    background: rgba(231,76,60,0.1);
    box-shadow: none;
    transform: none;
}

.compare-columns {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.compare-card {
    width: 300px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 14px;
}

.compare-card-title {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-align: center;
}

.compare-item-name {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 4px;
    line-height: 1.2;
}

.compare-item-type {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.compare-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    margin-bottom: 4px;
    padding: 3px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.04);
    align-items: center;
}

.compare-stat-row span:first-child {
    color: var(--text-secondary);
    font-size: 14px;
}

.compare-stat-row span:last-child {
    font-weight: 600;
}

.compare-diff-pos { color: #2ecc71; font-weight: 700; }
.compare-diff-neg { color: #e74c3c; font-weight: 700; }
.compare-diff-neu { color: var(--text-primary); }

.compare-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: #e74c3c;
    text-shadow: 0 0 10px rgba(231,76,60,0.6);
    align-self: center;
    padding: 0 4px;
    user-select: none;
}

.compare-req-row {
    font-size: 13px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.compare-relic-row {
    font-size: 13px;
    color: #ff00ff;
    font-weight: bold;
    margin-top: 6px;
}

.compare-sell-row {
    font-size: 13px;
    color: #f1c40f;
    margin-top: 6px;
    font-weight: 600;
}

/* Passives Grid */
.passive-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.passive-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.passive-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
    border-color: #3498db;
}

.plus-passive-btn {
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease;
}

.plus-passive-btn:hover:not(:disabled) {
    transform: scale(1.1);
}

.train-tab-btn.active {
    background: linear-gradient(135deg, #2980b9, #3498db);
    border-color: #3498db;
    color: #fff;
}

/* Asset Builder Layers */
.avatar-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: contain;
    pointer-events: none;
    transform: none;
}

.avatar {
    transform: scale(1.5);
    transform-origin: bottom center;
}

/* =========================================
   Skill & Magic Animations (150x150 Icons)
   ========================================= */

.skill-animation-icon {
    position: absolute;
    width: 150px;
    height: 150px;
    z-index: 1000;
    pointer-events: none;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
    object-fit: contain;
}

/* Projectile from Player to Enemy */
@keyframes skillProjectileRight {
    0% { left: 20%; top: 50%; transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    20% { left: 30%; top: 50%; transform: translate(-50%, -50%) scale(1); opacity: 1; }
    80% { left: 70%; top: 50%; transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { left: 80%; top: 50%; transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}
.anim-projectile-right { animation: skillProjectileRight 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) forwards; }

/* Projectile from Enemy to Player */
@keyframes skillProjectileLeft {
    0% { left: 80%; top: 50%; transform: translate(-50%, -50%) scale(0.5) scaleX(-1); opacity: 0; }
    20% { left: 70%; top: 50%; transform: translate(-50%, -50%) scale(1) scaleX(-1); opacity: 1; }
    80% { left: 30%; top: 50%; transform: translate(-50%, -50%) scale(1) scaleX(-1); opacity: 1; }
    100% { left: 20%; top: 50%; transform: translate(-50%, -50%) scale(1.5) scaleX(-1); opacity: 0; }
}
.anim-projectile-left { animation: skillProjectileLeft 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) forwards; }

/* Buff / Heal (Moves UP over target) */
@keyframes skillBuff {
    0% { transform: translate(-50%, 0) scale(0.8); opacity: 0; }
    30% { transform: translate(-50%, -50px) scale(1.2); opacity: 1; filter: drop-shadow(0 0 20px #2ecc71); }
    70% { transform: translate(-50%, -70px) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -100px) scale(1.5); opacity: 0; filter: drop-shadow(0 0 30px #2ecc71); }
}
.anim-buff { animation: skillBuff 1.2s ease forwards; }

/* Debuff / Strike (Sharp hit from above to target) */
@keyframes skillStrike {
    0% { transform: translate(-50%, -100px) scale(2); opacity: 0; filter: blur(4px); }
    30% { transform: translate(-50%, -20px) scale(1); opacity: 1; filter: blur(0); }
    70% { transform: translate(-50%, -20px) scale(1); opacity: 1; }
    100% { transform: translate(-50%, 0) scale(1.2); opacity: 0; }
}
.anim-strike { animation: skillStrike 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

/* Drop / Meteor (Falls from the very top) */
@keyframes skillDrop {
    0% { transform: translate(-50%, -300px) scale(1); opacity: 0; }
    40% { transform: translate(-50%, -20px) scale(1.5); opacity: 1; }
    60% { transform: translate(-50%, -20px) scale(1.8); opacity: 1; filter: drop-shadow(0 0 30px #e74c3c); }
    100% { transform: translate(-50%, -20px) scale(2); opacity: 0; }
}
.anim-drop { animation: skillDrop 1.2s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards; }

/* Nova (Expands in center) */
@keyframes skillNova {
    0% { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.1); opacity: 0; }
    50% { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(2); opacity: 1; filter: drop-shadow(0 0 20px #3498db); }
    100% { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(3); opacity: 0; }
}
.anim-nova { animation: skillNova 1.2s ease-out forwards; }

/* Drain (Target to Caster) */
@keyframes skillDrainRight {
    0% { left: 80%; top: 50%; transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
    20% { left: 70%; top: 50%; transform: translate(-50%, -50%) scale(1); opacity: 1; filter: drop-shadow(0 0 15px #9b59b6); }
    80% { left: 30%; top: 50%; transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
    100% { left: 20%; top: 50%; transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
}
.anim-drain-right { animation: skillDrainRight 1.2s ease-in forwards; }

@keyframes skillDrainLeft {
    0% { left: 20%; top: 50%; transform: translate(-50%, -50%) scale(1.2) scaleX(-1); opacity: 0; }
    20% { left: 30%; top: 50%; transform: translate(-50%, -50%) scale(1) scaleX(-1); opacity: 1; filter: drop-shadow(0 0 15px #9b59b6); }
    80% { left: 70%; top: 50%; transform: translate(-50%, -50%) scale(0.8) scaleX(-1); opacity: 1; }
    100% { left: 80%; top: 50%; transform: translate(-50%, -50%) scale(0.5) scaleX(-1); opacity: 0; }
}
.anim-drain-left { animation: skillDrainLeft 1.2s ease-in forwards; }

/* Arena Flash Effects */
.arena-flash-fire { animation: flashFire 1.2s ease-out; }
@keyframes flashFire { 0% { box-shadow: inset 0 0 100px rgba(231, 76, 60, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(231, 76, 60, 0); } }
.arena-flash-ice { animation: flashIce 1.2s ease-out; }
@keyframes flashIce { 0% { box-shadow: inset 0 0 100px rgba(52, 152, 219, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(52, 152, 219, 0); } }
.arena-flash-void { animation: flashVoid 1.2s ease-out; }
@keyframes flashVoid { 0% { box-shadow: inset 0 0 100px rgba(155, 89, 182, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(155, 89, 182, 0); } }
.arena-flash-holy { animation: flashHoly 1.2s ease-out; }
@keyframes flashHoly { 0% { box-shadow: inset 0 0 100px rgba(241, 196, 15, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(241, 196, 15, 0); } }
.arena-flash-heal { animation: flashHeal 1.2s ease-out; }
@keyframes flashHeal { 0% { box-shadow: inset 0 0 100px rgba(46, 204, 113, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(46, 204, 113, 0); } }

/* Particle Effects */
.particle { position: absolute; pointer-events: none; z-index: 500; border-radius: 50%; }
.particle-blood {
    background: #c0392b; width: 6px; height: 6px; border-radius: 50% 50% 50% 10%;
    transform: rotate(45deg); animation: bloodSpatter 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes bloodSpatter {
    0% { transform: scale(1) translate(0, 0) rotate(45deg); opacity: 1; }
    100% { transform: scale(0.5) translate(var(--tx), var(--ty)) rotate(45deg); opacity: 0; }
}
.particle-spark {
    background: #f1c40f; width: 4px; height: 4px; box-shadow: 0 0 5px #f1c40f;
    animation: sparkFly 0.5s ease-out forwards;
}
@keyframes sparkFly {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    100% { transform: scale(0.2) translate(var(--tx), var(--ty)); opacity: 0; }
}
.particle-magic {
    background: #fff; width: 5px; height: 5px; box-shadow: 0 0 8px var(--glow-color, #3498db);
    animation: magicFloat 1.2s ease-out forwards;
}
@keyframes magicFloat {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    50% { opacity: 1; }
    100% { transform: scale(0.1) translate(var(--tx), var(--ty)); opacity: 0; }
}



/* Carousel Controls */
.carousel-group { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05); }
.carousel-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3); color: white; padding: 5px 15px; border-radius: 5px; cursor: pointer; transition: all 0.2s; font-size: 16px; }
.carousel-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.1); }

/* Trait Grid Selection Controls */
.trait-selection-group { margin-bottom: 15px; }
.trait-title { font-size: 14px; color: #bdc3c7; margin-bottom: 5px; text-transform: uppercase; font-weight: bold; }
.trait-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.trait-btn { background: rgba(255,255,255,0.1); border: 2px solid transparent; border-radius: 8px; cursor: pointer; padding: 5px; transition: 0.2s; overflow: hidden; position: relative; color: white; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.trait-btn:hover { background: rgba(255,255,255,0.2); }
.trait-btn.active { border-color: #f1c40f; background: rgba(241, 196, 15, 0.2); }
.trait-btn img { max-width: 100%; max-height: 100%; object-fit: contain; }
.trait-color-btn { width: 40px; height: 40px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.trait-color-btn.active { border-color: #f1c40f; transform: scale(1.1); box-shadow: 0 0 10px rgba(241, 196, 15, 0.5); }

.town-overlay-bg { position: absolute; top: 0; left: 0; height: 100%; width: 100%; object-fit: cover; pointer-events: none; z-index: 1; opacity: 1; }


.town-overlay-bg { transition: filter 0.3s ease, margin 0.3s ease; }


/* New Battle UI Styles */
.glass-btn {
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.glass-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
    filter: brightness(1.1);
}
.glass-btn:active {
    transform: translateY(1px);
}
.battle-controls { display: none !important; /* Hide old controls */ }


/* Action Queue UI */
.aq-header { display: flex; flex-direction: column; gap: 4px; padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 4px; }
.aq-ap-label { font-size: 11px; font-weight: bold; color: #f1c40f; }
.aq-ap-bar { height: 4px; background: rgba(0,0,0,0.5); border-radius: 2px; overflow: hidden; }
.aq-ap-fill { height: 100%; background: #f39c12; transition: width 0.2s; }
.aq-empty { font-size: 11px; color: #aaa; text-align: center; padding: 10px 0; font-style: italic; }
.aq-list { display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow-y: auto; padding-right: 4px; }
.aq-list::-webkit-scrollbar { width: 4px; }
.aq-list::-webkit-scrollbar-thumb { background: rgba(241,196,15,0.5); border-radius: 2px; }
.aq-item { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); padding: 4px 6px; border-radius: 4px; font-size: 11px; }
.aq-item-label { color: #ecf0f1; font-weight: bold; flex-grow: 1; }
.aq-item-cost { color: #f39c12; margin: 0 8px; }
.aq-remove-btn { background: rgba(231, 76, 60, 0.2); color: #e74c3c; border: 1px solid rgba(231, 76, 60, 0.5); border-radius: 3px; cursor: pointer; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: bold; transition: all 0.2s; }
.aq-remove-btn:hover { background: rgba(231, 76, 60, 0.8); color: #fff; }

/* Locked Locations */
.locked-hotspot {
    cursor: not-allowed !important;
}
.locked-hotspot:hover {
    background: transparent !important;
    filter: none !important;
    transform: translate(-50%, -50%) !important;
}
.locked-hotspot .hotspot-label {
    filter: grayscale(1) opacity(0.7);
    transition: filter 0.3s ease;
}
.locked-hotspot:hover .hotspot-label {
    filter: none;
}
.locked-hotspot .hotspot-label::before {
    content: '\1F512 ';
}

/* =========================================
   Skill & Magic Animations (150x150 Icons)
   ========================================= */

.skill-animation-icon {
    position: absolute;
    width: 150px;
    height: 150px;
    z-index: 1000;
    pointer-events: none;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
    object-fit: contain;
}

/* Projectile from Player to Enemy */
@keyframes skillProjectileRight {
    0% { left: 20%; top: 50%; transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    20% { left: 30%; top: 50%; transform: translate(-50%, -50%) scale(1); opacity: 1; }
    80% { left: 70%; top: 50%; transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { left: 80%; top: 50%; transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}
.anim-projectile-right { animation: skillProjectileRight 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) forwards; }

/* Projectile from Enemy to Player */
@keyframes skillProjectileLeft {
    0% { left: 80%; top: 50%; transform: translate(-50%, -50%) scale(0.5) scaleX(-1); opacity: 0; }
    20% { left: 70%; top: 50%; transform: translate(-50%, -50%) scale(1) scaleX(-1); opacity: 1; }
    80% { left: 30%; top: 50%; transform: translate(-50%, -50%) scale(1) scaleX(-1); opacity: 1; }
    100% { left: 20%; top: 50%; transform: translate(-50%, -50%) scale(1.5) scaleX(-1); opacity: 0; }
}
.anim-projectile-left { animation: skillProjectileLeft 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) forwards; }

/* Buff / Heal (Moves UP over target) */
@keyframes skillBuff {
    0% { transform: translate(-50%, 0) scale(0.8); opacity: 0; }
    30% { transform: translate(-50%, -50px) scale(1.2); opacity: 1; filter: drop-shadow(0 0 20px #2ecc71); }
    70% { transform: translate(-50%, -70px) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -100px) scale(1.5); opacity: 0; filter: drop-shadow(0 0 30px #2ecc71); }
}
.anim-buff { animation: skillBuff 1.2s ease forwards; }

/* Debuff / Strike (Sharp hit from above to target) */
@keyframes skillStrike {
    0% { transform: translate(-50%, -100px) scale(2); opacity: 0; filter: blur(4px); }
    30% { transform: translate(-50%, -20px) scale(1); opacity: 1; filter: blur(0); }
    70% { transform: translate(-50%, -20px) scale(1); opacity: 1; }
    100% { transform: translate(-50%, 0) scale(1.2); opacity: 0; }
}
.anim-strike { animation: skillStrike 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

/* Drop / Meteor (Falls from the very top) */
@keyframes skillDrop {
    0% { transform: translate(-50%, -300px) scale(1); opacity: 0; }
    40% { transform: translate(-50%, -20px) scale(1.5); opacity: 1; }
    60% { transform: translate(-50%, -20px) scale(1.8); opacity: 1; filter: drop-shadow(0 0 30px #e74c3c); }
    100% { transform: translate(-50%, -20px) scale(2); opacity: 0; }
}
.anim-drop { animation: skillDrop 1.2s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards; }

/* Nova (Expands in center) */
@keyframes skillNova {
    0% { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.1); opacity: 0; }
    50% { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(2); opacity: 1; filter: drop-shadow(0 0 20px #3498db); }
    100% { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(3); opacity: 0; }
}
.anim-nova { animation: skillNova 1.2s ease-out forwards; }

/* Drain (Target to Caster) */
@keyframes skillDrainRight {
    0% { left: 80%; top: 50%; transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
    20% { left: 70%; top: 50%; transform: translate(-50%, -50%) scale(1); opacity: 1; filter: drop-shadow(0 0 15px #9b59b6); }
    80% { left: 30%; top: 50%; transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
    100% { left: 20%; top: 50%; transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
}
.anim-drain-right { animation: skillDrainRight 1.2s ease-in forwards; }

@keyframes skillDrainLeft {
    0% { left: 20%; top: 50%; transform: translate(-50%, -50%) scale(1.2) scaleX(-1); opacity: 0; }
    20% { left: 30%; top: 50%; transform: translate(-50%, -50%) scale(1) scaleX(-1); opacity: 1; filter: drop-shadow(0 0 15px #9b59b6); }
    80% { left: 70%; top: 50%; transform: translate(-50%, -50%) scale(0.8) scaleX(-1); opacity: 1; }
    100% { left: 80%; top: 50%; transform: translate(-50%, -50%) scale(0.5) scaleX(-1); opacity: 0; }
}
.anim-drain-left { animation: skillDrainLeft 1.2s ease-in forwards; }

/* Arena Flash Effects */
.arena-flash-fire { animation: flashFire 1.2s ease-out; }
@keyframes flashFire { 0% { box-shadow: inset 0 0 100px rgba(231, 76, 60, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(231, 76, 60, 0); } }
.arena-flash-ice { animation: flashIce 1.2s ease-out; }
@keyframes flashIce { 0% { box-shadow: inset 0 0 100px rgba(52, 152, 219, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(52, 152, 219, 0); } }
.arena-flash-void { animation: flashVoid 1.2s ease-out; }
@keyframes flashVoid { 0% { box-shadow: inset 0 0 100px rgba(155, 89, 182, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(155, 89, 182, 0); } }
.arena-flash-holy { animation: flashHoly 1.2s ease-out; }
@keyframes flashHoly { 0% { box-shadow: inset 0 0 100px rgba(241, 196, 15, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(241, 196, 15, 0); } }
.arena-flash-heal { animation: flashHeal 1.2s ease-out; }
@keyframes flashHeal { 0% { box-shadow: inset 0 0 100px rgba(46, 204, 113, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(46, 204, 113, 0); } }

/* Particle Effects */
.particle { position: absolute; pointer-events: none; z-index: 500; border-radius: 50%; }
.particle-blood {
    background: #c0392b; width: 6px; height: 6px; border-radius: 50% 50% 50% 10%;
    transform: rotate(45deg); animation: bloodSpatter 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes bloodSpatter {
    0% { transform: scale(1) translate(0, 0) rotate(45deg); opacity: 1; }
    100% { transform: scale(0.5) translate(var(--tx), var(--ty)) rotate(45deg); opacity: 0; }
}
.particle-spark {
    background: #f1c40f; width: 4px; height: 4px; box-shadow: 0 0 5px #f1c40f;
    animation: sparkFly 0.5s ease-out forwards;
}
@keyframes sparkFly {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    100% { transform: scale(0.2) translate(var(--tx), var(--ty)); opacity: 0; }
}
.particle-magic {
    background: #fff; width: 5px; height: 5px; box-shadow: 0 0 8px var(--glow-color, #3498db);
    animation: magicFloat 1.2s ease-out forwards;
}
@keyframes magicFloat {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    50% { opacity: 1; }
    100% { transform: scale(0.1) translate(var(--tx), var(--ty)); opacity: 0; }
}



/* Carousel Controls */
.carousel-group { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05); }
.carousel-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3); color: white; padding: 5px 15px; border-radius: 5px; cursor: pointer; transition: all 0.2s; font-size: 16px; }
.carousel-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.1); }

/* Trait Grid Selection Controls */
.trait-selection-group { margin-bottom: 15px; }
.trait-title { font-size: 14px; color: #bdc3c7; margin-bottom: 5px; text-transform: uppercase; font-weight: bold; }
.trait-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.trait-btn { background: rgba(255,255,255,0.1); border: 2px solid transparent; border-radius: 8px; cursor: pointer; padding: 5px; transition: 0.2s; overflow: hidden; position: relative; color: white; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.trait-btn:hover { background: rgba(255,255,255,0.2); }
.trait-btn.active { border-color: #f1c40f; background: rgba(241, 196, 15, 0.2); }
.trait-btn img { max-width: 100%; max-height: 100%; object-fit: contain; }
.trait-color-btn { width: 40px; height: 40px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.trait-color-btn.active { border-color: #f1c40f; transform: scale(1.1); box-shadow: 0 0 10px rgba(241, 196, 15, 0.5); }

.town-overlay-bg { position: absolute; top: 0; left: 0; height: 100%; width: 100%; object-fit: cover; pointer-events: none; z-index: 1; opacity: 1; }


.town-overlay-bg { transition: filter 0.3s ease, margin 0.3s ease; }


/* New Battle UI Styles */
.glass-btn {
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.glass-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
    filter: brightness(1.1);
}
.glass-btn:active {
    transform: translateY(1px);
}
.battle-controls { display: none !important; /* Hide old controls */ }


/* Action Queue UI */
.aq-header { display: flex; flex-direction: column; gap: 4px; padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 4px; }
.aq-ap-label { font-size: 11px; font-weight: bold; color: #f1c40f; }
.aq-ap-bar { height: 4px; background: rgba(0,0,0,0.5); border-radius: 2px; overflow: hidden; }
.aq-ap-fill { height: 100%; background: #f39c12; transition: width 0.2s; }
.aq-empty { font-size: 11px; color: #aaa; text-align: center; padding: 10px 0; font-style: italic; }
.aq-list { display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow-y: auto; padding-right: 4px; }
.aq-list::-webkit-scrollbar { width: 4px; }
.aq-list::-webkit-scrollbar-thumb { background: rgba(241,196,15,0.5); border-radius: 2px; }
.aq-item { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); padding: 4px 6px; border-radius: 4px; font-size: 11px; }
.aq-item-label { color: #ecf0f1; font-weight: bold; flex-grow: 1; }
.aq-item-cost { color: #f39c12; margin: 0 8px; }
.aq-remove-btn { background: rgba(231, 76, 60, 0.2); color: #e74c3c; border: 1px solid rgba(231, 76, 60, 0.5); border-radius: 3px; cursor: pointer; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: bold; transition: all 0.2s; }
.aq-remove-btn:hover { background: rgba(231, 76, 60, 0.8); color: #fff; }

/* Custom System Confirm Modal */
#system-confirm-overlay {
    transition: opacity 0.3s ease;
}
#system-confirm-overlay.show {
    opacity: 1 !important;
}
#system-confirm-overlay.show .confirm-modal {
    transform: translateY(0) scale(1) !important;
}
.confirm-btn {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}
.confirm-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}
.confirm-btn:hover::before {
    left: 100%;
}
.yes-btn {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.8), rgba(39, 174, 96, 0.9));
    color: #fff;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.2);
    border: 1px solid rgba(46, 204, 113, 0.5);
}
.yes-btn:hover {
    background: linear-gradient(135deg, rgba(46, 204, 113, 1), rgba(39, 174, 96, 1));
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.6);
    transform: translateY(-2px);
}
.no-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    70% { transform: translate(-50%, -70px) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -100px) scale(1.5); opacity: 0; filter: drop-shadow(0 0 30px #2ecc71); }
}
.anim-buff { animation: skillBuff 1.2s ease forwards; }

/* Debuff / Strike (Sharp hit from above to target) */
@keyframes skillStrike {
    0% { transform: translate(-50%, -100px) scale(2); opacity: 0; filter: blur(4px); }
    30% { transform: translate(-50%, -20px) scale(1); opacity: 1; filter: blur(0); }
    70% { transform: translate(-50%, -20px) scale(1); opacity: 1; }
    100% { transform: translate(-50%, 0) scale(1.2); opacity: 0; }
}
.anim-strike { animation: skillStrike 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

/* Drop / Meteor (Falls from the very top) */
@keyframes skillDrop {
    0% { transform: translate(-50%, -300px) scale(1); opacity: 0; }
    40% { transform: translate(-50%, -20px) scale(1.5); opacity: 1; }
    60% { transform: translate(-50%, -20px) scale(1.8); opacity: 1; filter: drop-shadow(0 0 30px #e74c3c); }
    100% { transform: translate(-50%, -20px) scale(2); opacity: 0; }
}
.anim-drop { animation: skillDrop 1.2s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards; }

/* Nova (Expands in center) */
@keyframes skillNova {
    0% { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.1); opacity: 0; }
    50% { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(2); opacity: 1; filter: drop-shadow(0 0 20px #3498db); }
    100% { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(3); opacity: 0; }
}
.anim-nova { animation: skillNova 1.2s ease-out forwards; }

/* Drain (Target to Caster) */
@keyframes skillDrainRight {
    0% { left: 80%; top: 50%; transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
    20% { left: 70%; top: 50%; transform: translate(-50%, -50%) scale(1); opacity: 1; filter: drop-shadow(0 0 15px #9b59b6); }
    80% { left: 30%; top: 50%; transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
    100% { left: 20%; top: 50%; transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
}
.anim-drain-right { animation: skillDrainRight 1.2s ease-in forwards; }

@keyframes skillDrainLeft {
    0% { left: 20%; top: 50%; transform: translate(-50%, -50%) scale(1.2) scaleX(-1); opacity: 0; }
    20% { left: 30%; top: 50%; transform: translate(-50%, -50%) scale(1) scaleX(-1); opacity: 1; filter: drop-shadow(0 0 15px #9b59b6); }
    80% { left: 70%; top: 50%; transform: translate(-50%, -50%) scale(0.8) scaleX(-1); opacity: 1; }
    100% { left: 80%; top: 50%; transform: translate(-50%, -50%) scale(0.5) scaleX(-1); opacity: 0; }
}
.anim-drain-left { animation: skillDrainLeft 1.2s ease-in forwards; }

/* Arena Flash Effects */
.arena-flash-fire { animation: flashFire 1.2s ease-out; }
@keyframes flashFire { 0% { box-shadow: inset 0 0 100px rgba(231, 76, 60, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(231, 76, 60, 0); } }
.arena-flash-ice { animation: flashIce 1.2s ease-out; }
@keyframes flashIce { 0% { box-shadow: inset 0 0 100px rgba(52, 152, 219, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(52, 152, 219, 0); } }
.arena-flash-void { animation: flashVoid 1.2s ease-out; }
@keyframes flashVoid { 0% { box-shadow: inset 0 0 100px rgba(155, 89, 182, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(155, 89, 182, 0); } }
.arena-flash-holy { animation: flashHoly 1.2s ease-out; }
@keyframes flashHoly { 0% { box-shadow: inset 0 0 100px rgba(241, 196, 15, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(241, 196, 15, 0); } }
.arena-flash-heal { animation: flashHeal 1.2s ease-out; }
@keyframes flashHeal { 0% { box-shadow: inset 0 0 100px rgba(46, 204, 113, 0.8); } 100% { box-shadow: inset 0 0 0px rgba(46, 204, 113, 0); } }

/* Particle Effects */
.particle { position: absolute; pointer-events: none; z-index: 500; border-radius: 50%; }
.particle-blood {
    background: #c0392b; width: 6px; height: 6px; border-radius: 50% 50% 50% 10%;
    transform: rotate(45deg); animation: bloodSpatter 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes bloodSpatter {
    0% { transform: scale(1) translate(0, 0) rotate(45deg); opacity: 1; }
    100% { transform: scale(0.5) translate(var(--tx), var(--ty)) rotate(45deg); opacity: 0; }
}
.particle-spark {
    background: #f1c40f; width: 4px; height: 4px; box-shadow: 0 0 5px #f1c40f;
    animation: sparkFly 0.5s ease-out forwards;
}
@keyframes sparkFly {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    100% { transform: scale(0.2) translate(var(--tx), var(--ty)); opacity: 0; }
}
.particle-magic {
    background: #fff; width: 5px; height: 5px; box-shadow: 0 0 8px var(--glow-color, #3498db);
    animation: magicFloat 1.2s ease-out forwards;
}
@keyframes magicFloat {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    50% { opacity: 1; }
    100% { transform: scale(0.1) translate(var(--tx), var(--ty)); opacity: 0; }
}



/* Carousel Controls */
.carousel-group { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05); }
.carousel-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3); color: white; padding: 5px 15px; border-radius: 5px; cursor: pointer; transition: all 0.2s; font-size: 16px; }
.carousel-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.1); }

/* Trait Grid Selection Controls */
.trait-selection-group { margin-bottom: 15px; }
.trait-title { font-size: 14px; color: #bdc3c7; margin-bottom: 5px; text-transform: uppercase; font-weight: bold; }
.trait-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.trait-btn { background: rgba(255,255,255,0.1); border: 2px solid transparent; border-radius: 8px; cursor: pointer; padding: 5px; transition: 0.2s; overflow: hidden; position: relative; color: white; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.trait-btn:hover { background: rgba(255,255,255,0.2); }
.trait-btn.active { border-color: #f1c40f; background: rgba(241, 196, 15, 0.2); }
.trait-btn img { max-width: 100%; max-height: 100%; object-fit: contain; }
.trait-color-btn { width: 40px; height: 40px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.trait-color-btn.active { border-color: #f1c40f; transform: scale(1.1); box-shadow: 0 0 10px rgba(241, 196, 15, 0.5); }

.town-overlay-bg { position: absolute; top: 0; left: 0; height: 100%; width: 100%; object-fit: cover; pointer-events: none; z-index: 1; opacity: 1; }


.town-overlay-bg { transition: filter 0.3s ease, margin 0.3s ease; }


/* New Battle UI Styles */
.glass-btn {
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.glass-btn:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
    filter: brightness(1.1);
}
.glass-btn:active {
    transform: translateY(1px);
}
.battle-controls { display: none !important; /* Hide old controls */ }


/* Action Queue UI */
.aq-header { display: flex; flex-direction: column; gap: 4px; padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 4px; }
.aq-ap-label { font-size: 11px; font-weight: bold; color: #f1c40f; }
.aq-ap-bar { height: 4px; background: rgba(0,0,0,0.5); border-radius: 2px; overflow: hidden; }
.aq-ap-fill { height: 100%; background: #f39c12; transition: width 0.2s; }
.aq-empty { font-size: 11px; color: #aaa; text-align: center; padding: 10px 0; font-style: italic; }
.aq-list { display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow-y: auto; padding-right: 4px; }
.aq-list::-webkit-scrollbar { width: 4px; }
.aq-list::-webkit-scrollbar-thumb { background: rgba(241,196,15,0.5); border-radius: 2px; }
.aq-item { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); padding: 4px 6px; border-radius: 4px; font-size: 11px; }
.aq-item-label { color: #ecf0f1; font-weight: bold; flex-grow: 1; }
.aq-item-cost { color: #f39c12; margin: 0 8px; }
.aq-remove-btn { background: rgba(231, 76, 60, 0.2); color: #e74c3c; border: 1px solid rgba(231, 76, 60, 0.5); border-radius: 3px; cursor: pointer; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: bold; transition: all 0.2s; }
.aq-remove-btn:hover { background: rgba(231, 76, 60, 0.8); color: #fff; }

/* Custom System Confirm Modal */
#system-confirm-overlay {
    transition: opacity 0.3s ease;
}
#system-confirm-overlay.show {
    opacity: 1 !important;
}
#system-confirm-overlay.show .confirm-modal {
    transform: translateY(0) scale(1) !important;
}
.confirm-btn {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}
.confirm-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}
.confirm-btn:hover::before {
    left: 100%;
}
.yes-btn {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.8), rgba(39, 174, 96, 0.9));
    color: #fff;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.2);
    border: 1px solid rgba(46, 204, 113, 0.5);
}
.yes-btn:hover {
    background: linear-gradient(135deg, rgba(46, 204, 113, 1), rgba(39, 174, 96, 1));
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.6);
}
.no-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.no-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Ефекти свічіння для заточки предметів +10 та +12 */
.forge-glow-10 {
    box-shadow: inset 0 0 10px rgba(241, 196, 15, 0.5), 0 0 15px rgba(241, 196, 15, 0.6) !important;
    animation: pulse-forge-10 2s infinite alternate;
}
.forge-glow-12 {
    box-shadow: inset 0 0 15px rgba(0, 255, 255, 0.6), 0 0 25px rgba(0, 255, 255, 0.8) !important;
    animation: pulse-forge-12 1.5s infinite alternate;
}

@keyframes pulse-forge-10 {
    0% { box-shadow: inset 0 0 10px rgba(241, 196, 15, 0.4), 0 0 10px rgba(241, 196, 15, 0.3); }
    100% { box-shadow: inset 0 0 20px rgba(241, 196, 15, 0.8), 0 0 20px rgba(241, 196, 15, 0.8); }
}

@keyframes pulse-forge-12 {
    0% { box-shadow: inset 0 0 15px rgba(0, 255, 255, 0.5), 0 0 15px rgba(0, 255, 255, 0.4); }
    100% { box-shadow: inset 0 0 30px rgba(0, 255, 255, 0.9), 0 0 30px rgba(0, 255, 255, 1); }
}

/* Ефекти для самого аватара (фільтри) */
.forge-glow-10-avatar {
    filter: drop-shadow(0 0 8px rgba(241, 196, 15, 0.7));
    animation: pulse-avatar-10 2s infinite alternate;
}
.forge-glow-12-avatar {
    filter: drop-shadow(0 0 12px rgba(0, 255, 255, 0.8));
    animation: pulse-avatar-12 1.5s infinite alternate;
}

@keyframes pulse-avatar-10 {
    0% { filter: drop-shadow(0 0 4px rgba(241, 196, 15, 0.4)); }
    100% { filter: drop-shadow(0 0 12px rgba(241, 196, 15, 0.9)); }
}

@keyframes pulse-avatar-12 {
    0% { filter: drop-shadow(0 0 6px rgba(0, 255, 255, 0.5)); }
    100% { filter: drop-shadow(0 0 16px rgba(0, 255, 255, 1)); }
}


@keyframes rainbowGradientMove {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}
.rainbow-border-icon {
    position: relative;
}
.rainbow-border-icon::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(
        45deg,
        #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #8b00ff,
        #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #8b00ff,
        #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #8b00ff,
        #ff0000
    );
    background-size: 300% 300%;
    animation: rainbowGradientMove 1.5s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 10;
}

/* Quick Skills Panel */
.battle-tab-btn {
    transition: all 0.2s ease;
}
.battle-tab-btn:hover {
    filter: brightness(1.2);
}
.battle-tab-btn:not(.active) {
    opacity: 0.6;
}
.quick-skill-slot {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    height: 70px;
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}
.quick-skill-slot:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}
.quick-skill-slot.drag-over {
    border-color: #f1c40f !important;
    background: rgba(241, 196, 15, 0.25) !important;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.6);
}
.quick-skill-slot.drag-source {
    opacity: 0.4;
    border-style: dashed;
}
.plus-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.minus-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    cursor: pointer;
    border: none;
    color: #fff;
    font-weight: bold;
    line-height: 1;
    transition: background 0.2s, opacity 0.2s;
}

.minus-btn:disabled,
.minus-btn.disabled {
    background: linear-gradient(135deg, #555, #777);
    cursor: not-allowed;
    opacity: 0.55;
}

.quick-skill-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid #c0392b;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
}
.quick-skill-slot:hover .quick-skill-remove {
    opacity: 1;
}
.quick-skill-remove:hover {
    background: #c0392b;
    transform: scale(1.1);
}
