
:root {
    --bg-color: #080a10;
    --panel-bg: rgba(15, 20, 35, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    
    --primary: #9d4edd;
    --primary-glow: rgba(157, 78, 221, 0.6);
    --secondary: #3b82f6;
    --accent: #fbbf24;
    
    --hp-color: #ef4444;
    --shield-color: #3b82f6;
    --ap-color: #fbbf24;
    
    --font-ui: 'Inter', sans-serif;
    --font-title: 'Cinzel Decorative', serif;
    --font-serif: 'Playfair Display', serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

html, body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-ui);
    overflow: hidden;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: none;
    overflow: hidden;
    border-radius: 0;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(10, 14, 25, 0.6);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.4);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.8);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    z-index: 10;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem 2rem 2.5rem 2rem;
}

.screen.active {
    display: flex;
}

/* Glassmorphism utility - Enhanced by UI/UX Designer */
.glass-panel {
    background: rgba(15, 20, 35, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-panel:hover {
    background: rgba(20, 25, 45, 0.75);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(139, 92, 246, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Main Menu */
#main-menu {
    justify-content: flex-start;
    padding-top: max(5vh, 40px);
    padding-bottom: 20px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

#main-menu::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('assets/menu-bg.jpg') center/cover;
    opacity: 0.3;
    pointer-events: none;
    mix-blend-mode: overlay;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 3rem;
    z-index: 2;
    animation: floatingLogo 6s ease-in-out infinite;
}

.logo-mythos {
    font-family: var(--font-title);
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 12px;
    color: #e2e8f0;
    text-transform: uppercase;
    opacity: 0.9;
    margin-bottom: -5px;
    text-shadow: 0 0 10px rgba(157, 78, 221, 0.5);
    padding-left: 12px; /* Compensate for letter spacing to center */
}

.logo-clash {
    font-family: var(--font-title);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 900;
    background: linear-gradient(to bottom, #ffffff 0%, #e2e8f0 40%, #9d4edd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 40px rgba(157, 78, 221, 0.4), 0 5px 15px rgba(0,0,0,0.8);
    filter: drop-shadow(0 0 2px rgba(255,255,255,0.3));
    letter-spacing: 2px;
    line-height: 1.1;
}

@keyframes floatingLogo {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.game-title {
    font-family: var(--font-title);
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #fff;
    text-shadow: 0 0 20px var(--primary-glow);
    text-align: center;
    margin-bottom: 2rem;
}

.menu-options, .menu-buttons {
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 2vh, 1.2rem);
    width: 90%;
    z-index: 2;
}

.menu-btn {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
}

.menu-btn:hover:not(.disabled) {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.3) 0%, rgba(109, 40, 217, 0.3) 100%);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(0,0,0,0.6), 0 0 20px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.3);
    transform: translateY(-4px) scale(1.02);
    color: #fff;
}

.menu-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: line-through;
}

.version-info {
    position: absolute;
    bottom: 20px;
    right: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Party Selection */
#party-selection {
    padding: 2rem;
    justify-content: flex-start;
}

#party-selection h2 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 2rem;
    color: #fff;
    text-shadow: 0 0 10px var(--primary-glow);
    text-align: center;
}

.roster-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    max-width: 1000px;
    margin-bottom: 2rem;
}

.class-card {
    width: clamp(100px, 20vw, 150px);
    height: clamp(140px, 25vw, 200px);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0.5rem;
}

.class-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.class-icon {
    font-size: 3rem;
}

.class-name {
    font-weight: 800;
    font-size: 1.1rem;
    text-align: center;
}

.party-status {
    width: 100%;
    max-width: 800px;
    text-align: center;
}

.party-grid {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0 2rem 0;
    min-height: 120px;
}

.party-slot {
    width: clamp(60px, 15vw, 100px);
    height: clamp(80px, 18vw, 120px);
    border: 2px dashed var(--glass-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.2rem;
}

.party-slot.filled {
    border: 2px solid var(--secondary);
    background: rgba(59, 130, 246, 0.1);
}

.action-btn {
    padding: 1.2rem 2.5rem;
    font-size: 1.1rem;
    background: linear-gradient(180deg, var(--primary) 0%, #6d28d9 100%);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 800;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4), inset 0 2px 0 rgba(255,255,255,0.2);
}

.action-btn:hover:not(.disabled) {
    background: linear-gradient(180deg, #a78bfa 0%, var(--primary) 100%);
    box-shadow: 0 8px 25px rgba(0,0,0,0.6), 0 0 20px var(--primary-glow), inset 0 2px 0 rgba(255,255,255,0.4);
    transform: translateY(-3px) scale(1.05);
}

.action-btn.disabled {
    background: linear-gradient(180deg, #4b5563 0%, #374151 100%);
    opacity: 0.6;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.05);
    box-shadow: none;
}

/* Battle Screen */
#battle-screen {
    overflow: hidden;
    padding: 0;
}
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#battle-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none; /* Let clicks pass through to canvas when not on UI elements */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    pointer-events: auto;
}

.turn-indicator {
    font-size: 1.8rem;
    font-weight: 900;
    color: transparent;
    background: linear-gradient(90deg, #fff, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    padding: 0.5rem 2rem;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 0 20px rgba(0,0,0,0.5), inset 0 0 10px rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }
    
    #game-container {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .menu-options, .menu-buttons {
        width: 90%;
        max-width: 320px;
    }

    #party-selection {
        padding: 1rem;
        padding-top: 4rem; /* leave space if profile info is there */
    }

    .class-icon {
        font-size: 2rem;
    }

    .class-name {
        font-size: 0.9rem;
    }

    .party-slot .class-icon {
        font-size: 1.5rem;
    }

    .party-slot .class-name {
        font-size: 0.7rem;
    }
    
    .action-btn {
        padding: 0.8rem 1.2rem;
        font-size: 1rem;
        margin: 0.2rem;
    }
    
    .party-status {
        padding-bottom: 2rem;
    }
}

.ap-container {
    font-size: 2rem;
    font-weight: 900;
    color: transparent;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
    padding: 0.5rem 2rem;
    border-radius: 30px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    box-shadow: 0 0 20px rgba(0,0,0,0.5), inset 0 0 15px rgba(251, 191, 36, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(10px);
}

.ap-container::before {
    content: '💎';
    font-size: 1.5rem;
    filter: drop-shadow(0 0 10px #fbbf24);
}

.timer-container {
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
    padding: 0.5rem 2rem;
    border-radius: 30px;
    border: 1px solid rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    display: flex;
    align-items: center;
    margin-right: 15px;
    backdrop-filter: blur(10px);
}

.status-panel {
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 50;
}

.status-panel.heroes { left: 2rem; }
.status-panel.enemies { right: 2rem; align-items: flex-end; }

.unit-status {
    width: 200px;
    padding: 0.8rem;
}

.unit-name {
    font-weight: bold;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.hp-bar-bg {
    width: 100%;
    height: 12px;
    background: rgba(0,0,0,0.5);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,0.2);
}

.hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc2626, #ef4444);
    width: 100%;
    transition: width 0.3s ease;
}

.shield-indicator {
    position: absolute;
    top: -2px;
    left: -2px;
    bottom: -2px;
    border: 2px solid var(--shield-color);
    border-radius: 6px;
    box-shadow: 0 0 10px var(--shield-color);
    display: none;
}

/* Targeting Styles */
body.targeting-active {
    cursor: crosshair !important;
}

.unit-status.targetable {
    cursor: crosshair;
    animation: targetPulse 1.5s infinite;
    z-index: 100;
}

.unit-status.targetable:hover {
    transform: scale(1.05);
    background: rgba(251, 191, 36, 0.2);
}

@keyframes targetPulse {
    0% { box-shadow: 0 0 5px #fbbf24; border-color: rgba(251, 191, 36, 0.5); }
    50% { box-shadow: 0 0 20px #fbbf24; border-color: #fbbf24; }
    100% { box-shadow: 0 0 5px #fbbf24; border-color: rgba(251, 191, 36, 0.5); }
}

.bottom-bar {
    padding: 1rem 2rem 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: auto;
    z-index: 40;
}

.cards-hand {
    display: flex;
    gap: -20px;
    perspective: 1000px;
    justify-content: center;
}

.card {
    width: 180px;
    height: 260px;
    background: linear-gradient(135deg, #2a2d3e, #1a1c29);
    border: 2px solid #3f445e;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    margin-left: -30px;
}

.card:first-child { margin-left: 0; }

.card:hover, .card-in-hand:hover {
    transform: translateY(-50px) scale(1.15) rotate(2deg) !important;
    z-index: 100 !important;
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(0,0,0,0.8), 0 0 30px var(--primary-glow);
}

.card-cost {
    position: absolute;
    top: -15px;
    left: -15px;
    width: 40px;
    height: 40px;
    background: var(--ap-color);
    color: #000;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-title);
    font-size: 1rem;
    border: 3px solid #1a1c29;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.card-image {
    height: 100px;
    background: rgba(0,0,0,0.3);
    margin: 10px 10px 0 10px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
}

.card-content {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 5px;
    color: #fff;
}

.card-type {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
}

.card-desc {
    font-size: 0.85rem;
    line-height: 1.3;
}

.deck-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.pile {
    padding: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(0,0,0,0.5);
    font-weight: bold;
    min-width: 150px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.pile:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: var(--secondary);
}

/* Animations and Premium UX */
@keyframes pulseGlow {
    0% { box-shadow: 0 0 5px var(--primary-glow); transform: scale(1); }
    50% { box-shadow: 0 0 25px var(--primary), inset 0 0 10px rgba(255,255,255,0.5); transform: scale(1.05); }
    100% { box-shadow: 0 0 5px var(--primary-glow); transform: scale(1); }
}

@keyframes shakeError {
    0% { transform: translateX(0); }
    20% { transform: translateX(-5px) rotate(-2deg); border-color: #ef4444; }
    40% { transform: translateX(5px) rotate(2deg); border-color: #ef4444; }
    60% { transform: translateX(-5px) rotate(-2deg); border-color: #ef4444; }
    80% { transform: translateX(5px) rotate(2deg); border-color: #ef4444; }
    100% { transform: translateX(0); }
}

.shake {
    animation: shakeError 0.4s ease-in-out !important;
}

.action-btn.attack-btn {
    animation: pulseGlow 1.5s infinite;
    background: linear-gradient(45deg, #7c3aed, #d946ef);
    border: 1px solid rgba(255,255,255,0.3);
}

.card.disabled:hover {
    transform: translateY(-10px);
    cursor: not-allowed;
}

/* ==========================================================================
   Deck Builder v2.0 Styles
   ========================================================================== */
.deck-builder-container {
    width: 100%;
    max-width: 1300px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.deck-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.deck-title-area h2 {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 15px var(--primary-glow);
    margin-bottom: 0.3rem;
}

.deck-subtitle {
    color: #94a3b8;
    font-size: 0.95rem;
}

.deck-summary-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.4);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.summary-label {
    font-size: 0.85rem;
    color: #cbd5e1;
    font-weight: 600;
}

.summary-count {
    font-size: 1.3rem;
    font-weight: 900;
    color: #fbbf24;
}

.summary-bonus {
    font-size: 0.8rem;
    color: #a78bfa;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 8px;
    border-radius: 12px;
}

.deck-category-nav {
    display: flex;
    gap: 1rem;
    width: 100%;
    flex-wrap: wrap;
}

.deck-nav-tab {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.2rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #e2e8f0;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}

.deck-nav-tab:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.deck-nav-tab.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(59, 130, 246, 0.3));
    border-color: #8b5cf6;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4), inset 0 0 10px rgba(139, 92, 246, 0.2);
    color: #fff;
}

.tab-badge {
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #fbbf24;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.deck-nav-tab.active .tab-badge {
    background: #8b5cf6;
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.6);
}

.deck-sections-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.deck-section {
    padding: 1.5rem;
    width: 100%;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.section-hint {
    font-size: 0.85rem;
    color: #94a3b8;
    font-style: italic;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.2rem;
    width: 100%;
}

/* Individual Card Styling */
.deck-card {
    position: relative;
    width: 100%;
    min-height: 220px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(25, 32, 54, 0.95) 0%, rgba(13, 16, 28, 0.98) 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.deck-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.7);
}

.deck-card.type-support {
    border-color: rgba(16, 185, 129, 0.35);
}
.deck-card.type-support:hover, .deck-card.type-support.is-equipped {
    border-color: #10b981;
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.4);
}

.deck-card.type-aoe {
    border-color: rgba(245, 158, 11, 0.35);
}
.deck-card.type-aoe:hover, .deck-card.type-aoe.is-equipped {
    border-color: #f59e0b;
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.4);
}

.deck-card.type-summon {
    border-color: rgba(139, 92, 246, 0.35);
}
.deck-card.type-summon:hover, .deck-card.type-summon.is-equipped {
    border-color: #8b5cf6;
    box-shadow: 0 0 18px rgba(139, 92, 246, 0.4);
}

.deck-card.type-ultimate {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(180deg, rgba(45, 18, 28, 0.95) 0%, rgba(18, 10, 16, 0.98) 100%);
}
.deck-card.type-ultimate:hover, .deck-card.type-ultimate.is-equipped {
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.card-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.45);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.card-mana-gem {
    font-size: 0.88rem;
    font-weight: 800;
    color: #fbbf24;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

.card-type-tag {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
}

.card-type-tag.SUPPORT { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.card-type-tag.AOE { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.card-type-tag.SUMMON { background: rgba(139, 92, 246, 0.2); color: #c084fc; }
.card-type-tag.ULTIMATE { background: rgba(239, 68, 68, 0.25); color: #f87171; }

.card-header-area {
    padding: 0.6rem 0.75rem 0.3rem 0.75rem;
}

.card-name-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
    line-height: 1.25;
}

.card-hero-class {
    font-size: 0.75rem;
    color: #60a5fa;
    margin-top: 3px;
    font-weight: 600;
}

.card-body-description {
    padding: 0.4rem 0.75rem 0.6rem 0.75rem;
    flex: 1;
}

.card-body-description p {
    font-size: 0.83rem;
    color: #cbd5e1;
    line-height: 1.35;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    font-weight: 700;
}

.card-footer-bar.equipped {
    background: rgba(16, 185, 129, 0.15);
    border-top-color: rgba(16, 185, 129, 0.3);
}

.card-footer-bar.equipped .card-action-text {
    color: #34d399;
}

.card-footer-bar.available .card-action-text {
    color: #94a3b8;
}

.deck-card:hover .card-footer-bar.available .card-action-text {
    color: #a78bfa;
}

.card-level-tag {
    color: #e2e8f0;
    font-size: 0.75rem;
}

/* Empty Slot Placeholder */
.deck-card-empty {
    width: 100%;
    min-height: 220px;
    border-radius: 12px;
    border: 2px dashed rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.deck-card-empty:hover {
    border-color: rgba(139, 92, 246, 0.5);
    color: #c084fc;
    background: rgba(139, 92, 246, 0.05);
}

.empty-icon {
    font-size: 1.6rem;
    opacity: 0.5;
}

.deck-card.locked {
    filter: grayscale(60%) brightness(0.8);
    opacity: 0.9;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}


body.targeting-active { cursor: crosshair !important; }
body.targeting-active .targetable { cursor: crosshair !important; animation: pulse-target 1.5s infinite alternate; }
@keyframes pulse-target { 
    0% { box-shadow: 0 0 10px rgba(139, 92, 246, 0.5), inset 0 0 10px rgba(139, 92, 246, 0.2); border-color: rgba(139, 92, 246, 0.5); } 
    100% { box-shadow: 0 0 25px rgba(139, 92, 246, 1), inset 0 0 20px rgba(139, 92, 246, 0.5); border-color: rgba(139, 92, 246, 1); } 
}


.end-turn-btn {
    margin-top: 20px;
    background: linear-gradient(135deg, #8b5cf6 0%, #4c1d95 100%);
    border: 2px solid #a78bfa;
    border-radius: 12px;
    padding: 15px 30px;
    color: white;
    font-family: var(--font-ui);
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4), inset 0 0 10px rgba(255,255,255,0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}
.end-turn-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.7), inset 0 0 15px rgba(255,255,255,0.5);
    background: linear-gradient(135deg, #9333ea 0%, #5b21b6 100%);
}
.end-turn-btn:active {
    transform: translateY(2px) scale(0.95);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}
.end-turn-btn .icon {
    font-size: 1.4rem;
    text-shadow: 0 0 5px white;
}


/* --- Encyclopedia --- */
.encyclopedia-tabs { display: flex; gap: 1rem; margin-bottom: 2rem; justify-content: center; }
.encyclopedia-tab { background: rgba(30, 41, 59, 0.8); border: 2px solid #334155; padding: 0.75rem 1.5rem; color: #cbd5e1; cursor: pointer; border-radius: 8px; font-weight: bold; font-family: inherit; transition: 0.2s; }
.encyclopedia-tab.active, .encyclopedia-tab:hover { background: rgba(99, 102, 241, 0.2); border-color: #6366f1; color: white; }

.book-container { 
    width: 100%; max-width: 1200px; height: 75vh; 
    background: #1e1e24; border-radius: 4px 16px 16px 4px; 
    display: flex; position: relative; margin: 0 auto;
    box-shadow: 20px 20px 40px rgba(0,0,0,0.6), inset -2px 0 10px rgba(255,255,255,0.1); 
    border: 1px solid #333; overflow: hidden; 
}
.book-page { 
    flex: 1; padding: 2rem; overflow-y: auto; 
    background: linear-gradient(to bottom right, #24242c, #1a1a20); 
}
.book-page::-webkit-scrollbar { width: 6px; }
.book-page::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }

.book-spine-center { 
    width: 40px; height: 100%; 
    background: linear-gradient(to right, #0f0f13, #2a2a35, #0f0f13); 
    box-shadow: inset -5px 0 10px rgba(0,0,0,0.5), inset 5px 0 10px rgba(0,0,0,0.5); 
    border-left: 1px solid rgba(0,0,0,0.8);
    border-right: 1px solid rgba(0,0,0,0.8);
    z-index: 10;
}

#encyclopedia-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.encyclopedia-list-btn {
    background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1);
    color: white; padding: 1rem; text-align: left; border-radius: 6px;
    font-size: 1.1rem; cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; gap: 1rem;
    position: relative; overflow: hidden;
}
.encyclopedia-list-btn::before {
    content: ''; position: absolute; left: 0; top: 0; width: 4px; height: 100%; background: var(--entry-color, #6366f1);
}
.encyclopedia-list-btn:hover, .encyclopedia-list-btn.selected {
    background: rgba(var(--entry-rgb, 99, 102, 241), 0.2);
    border-color: var(--entry-color, #6366f1);
    transform: translateX(5px);
}

.encyclopedia-entry { 
    background: transparent; display: flex; flex-direction: column; height: 100%;
}
.entry-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 1rem; }
.entry-icon { font-size: 3.5rem; text-shadow: 0 0 15px rgba(255,255,255,0.2); }
.entry-title { font-size: 2rem; font-weight: bold; margin: 0; }

.entry-desc { font-size: 1.1rem; color: #cbd5e1; margin-bottom: 2rem; line-height: 1.6; }

.entry-passive { 
    background: rgba(var(--entry-rgb, 99, 102, 241), 0.1); padding: 1.5rem; 
    border-radius: 8px; font-size: 1.1rem; color: #f8fafc; 
    border-left: 3px solid var(--entry-color, #6366f1); 
}
.entry-passive strong { color: var(--entry-color, #818cf8); display: block; margin-bottom: 0.5rem; font-size: 1.2rem; }

.entry-stats { 
    display: flex; gap: 2rem; margin-top: auto; font-size: 1.2rem; font-weight: bold; 
    background: rgba(0,0,0,0.3); padding: 1.5rem; border-radius: 8px; justify-content: space-around; 
}
/* --- Ascension --- */
.ascension-card {
    background: rgba(30, 41, 59, 0.7); border: 2px solid #334155; border-radius: 12px;
    padding: 1.5rem; text-align: center; position: relative;
    transition: 0.3s;
}
.ascension-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.4); border-color: #eab308; }
.ascension-card .class-icon { font-size: 3.5rem; margin-bottom: 0.5rem; text-shadow: 0 0 10px rgba(255,255,255,0.2); }
.ascension-card .class-name { font-size: 1.4rem; font-weight: bold; margin-bottom: 0.5rem; }
.ascension-card .class-level { font-size: 1.2rem; color: #eab308; font-weight: bold; margin-bottom: 1rem; }
.ascension-card .level-bonuses { font-size: 0.9rem; color: #94a3b8; margin-bottom: 1.5rem; line-height: 1.5; }
.ascension-cost { display: flex; justify-content: center; gap: 1rem; margin-bottom: 1rem; font-weight: bold; }
.ascension-btn { background: #eab308; color: #1e1e24; font-weight: bold; width: 100%; border-radius: 6px; padding: 0.75rem; transition: 0.2s; border: none; cursor: pointer; font-size: 1.1rem; font-family: inherit;}
.ascension-btn:hover { background: #fde047; box-shadow: 0 0 15px rgba(234, 179, 8, 0.5); }
.ascension-btn:disabled { background: #1e293b; color: #475569; cursor: not-allowed; box-shadow: none; }
