﻿/* WordBattle - Complete Optimized CSS
 * Version: 1.0.0
 * Description: Unified and optimized stylesheet for WordBattle game
 */

/* ===========================
   CSS CUSTOM PROPERTIES
   =========================== */
:root {
    /* Colors */
    --color-bg-primary: #0a0a0a;
    --color-bg-secondary: rgba(20, 20, 35, 0.95);
    --color-bg-tertiary: rgba(15, 15, 25, 0.98);
    --color-bg-quaternary: rgba(10, 10, 20, 0.98);
    --color-text-primary: #e0e0e0;
    --color-text-secondary: #bbb;
    --color-text-tertiary: #888;
    --color-text-accent: #f39c12;
    --color-border-primary: #333;
    --color-border-secondary: #444;
    --color-border-tertiary: #555;
    --color-border-active: #666;
    /* Game Colors */
    --color-moral: #dc3545;
    --color-moral-light: #ff6b7d;
    --color-mana: #007bff;
    --color-mana-light: #4a9eff;
    --color-fury: #fd7e14;
    --color-fury-light: #ffa654;
    --color-honor: #ffc107;
    --color-honor-light: #ffd54f;
    --color-shame: #6f42c1;
    --color-shame-light: #a584e4;
    --color-will: #20c997;
    --color-will-light: #6eddb9;
    --color-fear: #6c757d;
    --color-fear-light: #adb5bd;
    /* Path Colors */
    --color-path-light: #ffd700;
    --color-path-dark: #8b4513;
    --color-path-gray: #888888;
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 20px;
    --spacing-xl: 30px;
    /* Transitions */
    --transition-fast: 0.3s ease;
    --transition-medium: 0.5s ease;
    --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    /* Z-Index Layers */
    --z-status: 30;
    --z-controls: 80;
    --z-hand: 150;
    --z-hud: 300;
    --z-modal: 1000;
}

/* ===========================
   BASE STYLES & RESET
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #0a0a0a;
    color: var(--color-text-primary);
    overflow: hidden;
    height: 100vh;
    position: relative;
}

/* ===========================
   GAME CONTAINER
   =========================== */
.game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

/* ===========================
   TOP HUD
   =========================== */
.top-hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background: linear-gradient(to bottom, rgba(15, 15, 25, 0.9), rgba(10, 10, 20, 0.9));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(51, 51, 51, 0.5);
    z-index: var(--z-hud);
    height: 65px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 1 45%;
    max-width: 45%;
}

    .player-info.opponent {
        flex-direction: row-reverse;
        justify-content: flex-start;
    }

/* Player Components */
.player-level {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) 10px;
    background: rgba(30, 30, 50, 0.8);
    border-radius: 10px;
    border: 1px solid var(--color-border-secondary);
    min-width: 100px;
}

.level-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-path-light);
    text-align: center;
    text-transform: uppercase;
}

.xp-bar {
    height: 14px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 7px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--color-border-primary);
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4 0%, #44a3aa 100%);
    transition: width var(--transition-slow);
}

.xp-text {
    position: absolute;
    inset: 0;
    font-size: 9px;
    line-height: 14px;
    text-align: center;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, rgba(40, 40, 60, 0.9), rgba(30, 30, 50, 0.9));
    border: 2px solid var(--color-border-active);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

    .avatar.opponent {
        background: linear-gradient(135deg, rgba(60, 40, 40, 0.9), rgba(50, 30, 30, 0.9));
        border-color: #966;
    }

/* Stats */
.stats {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 180px;
}

.stat-bar {
    height: 12px;
    width: 100%;
    max-width: 180px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--color-border-primary);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.stat-fill {
    height: 100%;
    transition: width var(--transition-slow);
    position: relative;
}

    .stat-fill.moral-fill {
        background: linear-gradient(90deg, var(--color-moral) 0%, var(--color-moral-light) 100%);
    }

    .stat-fill.mana-fill {
        background: linear-gradient(90deg, var(--color-mana) 0%, var(--color-mana-light) 100%);
    }

    .stat-fill.fury-fill {
        background: linear-gradient(90deg, var(--color-fury) 0%, var(--color-fury-light) 100%);
    }

.stat-text {
    font-size: 9px;
    line-height: 12px;
    padding: 0 6px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    position: relative;
    z-index: 1;
}

/* Player Path */
.player-path {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 5px 10px;
    background: rgba(30, 30, 50, 0.7);
    border-radius: 15px;
    font-size: 11px;
    border: 1px solid var(--color-border-tertiary);
    flex-shrink: 0;
    height: fit-content;
}

.path-icon {
    font-size: 14px;
}

.path-name {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.path-light {
    color: var(--color-path-light);
}

.path-dark {
    color: var(--color-path-dark);
}

.path-gray {
    color: var(--color-path-gray);
}

/* Center Info */
.center-info {
    position: absolute;
    left: 50%;
    top: 10px;
    text-align: center;
    z-index: 310;
    transform: translate(-50%, 0);
}

.turn-indicator {
    padding: 6px 20px;
    background: linear-gradient(135deg, #3a3a5a 0%, #2a2a4a 100%);
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 14px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    border: 1px solid #4a4a6a;
}

/* Turn Timer */
.turn-timer {
    margin-top: 10px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    border: 2px solid #333;
    min-width: 200px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.turn-timer.active {
    opacity: 1;
}

.timer-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.timer-text {
    font-size: 18px;
    font-weight: bold;
    color: #4a9eff;
    font-family: 'Courier New', monospace;
}

.timer-text.warning {
    color: #ffc107;
    animation: pulse 1s infinite;
}

.timer-text.critical {
    color: #dc3545;
    animation: shake 0.5s infinite;
}

.timer-bank {
    font-size: 12px;
    color: #888;
    margin-left: 10px;
}

.timer-bank.active {
    color: #ffc107;
    font-weight: bold;
}

.game-time {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    text-align: center;
}

.timer-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #4a9eff 0%, #2a7eff 100%);
    transition: width 0.1s linear, background 0.3s ease;
    border-radius: 4px;
}

.timer-bar.warning {
    background: linear-gradient(90deg, #ffc107 0%, #ff9800 100%);
}

.timer-bar.critical {
    background: linear-gradient(90deg, #dc3545 0%, #ff0000 100%);
    animation: pulse-glow 0.5s infinite;
}

.timer-text.shake {
    animation: shake 0.3s infinite;
    color: #ff4444;
}

.timer-text.pulse {
    animation: pulse 1s infinite;
    color: #ffaa44;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes pulse-glow {
    0%, 100% { 
        opacity: 1;
        box-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
    }
    50% { 
        opacity: 0.8;
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    }
}

/* Hide unused elements */
.phase-indicator,
.game-controls,
.path-indicator,
.psych-indicators {
    display: none;
}

/* ===========================
   BATTLE ARENA
   =========================== */
.battle-arena {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-lg);
    padding-top: 85px;
    position: relative;
    overflow-y: auto;
    background: transparent;
}

/* ===========================
   GRAMMAR ZONE
   =========================== */
.grammar-zone {
    background: rgba(20, 20, 35, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 3px solid rgba(58, 58, 90, 0.5);
    border-radius: 20px;
    padding: 25px;
    width: auto;
    max-width: 850px;
    margin: 100px auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    position: relative;
    z-index: 20;
}

.spell-preview {
    font-size: 20px;
    font-weight: bold;
    color: var(--color-text-accent);
    text-align: center;
    min-height: 40px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 20px;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.damage-preview {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-top: 10px;
    min-height: 20px;
    text-align: center;
    padding: var(--spacing-sm);
    background: rgba(20, 20, 30, 0.6);
    border-radius: 10px;
    display: none;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

    .damage-preview strong {
        color: var(--color-text-accent);
        font-size: 16px;
    }

    .damage-preview span {
        margin: 0 var(--spacing-sm);
    }

.damage-preview-moral {
    color: var(--color-moral);
}

.damage-preview-honor {
    color: var(--color-shame);
}

.damage-preview-shame {
    color: #e67e22;
}

.damage-preview-will {
    color: #3498db;
}

.damage-preview-fury {
    color: var(--color-text-accent);
}

.damage-preview-fear {
    color: #95a5a6;
}

/* Grammar Slots */
.grammar-slots {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.grammar-slot {
    width: 100px;
    height: 140px;
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid var(--color-border-secondary);
    border-radius: 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

    .grammar-slot:hover {
        border-color: var(--color-border-active);
        background: rgba(40, 40, 60, 0.8);
    }

    .grammar-slot.can-accept {
        border-color: var(--color-mana-light);
        box-shadow: 0 0 15px rgba(74, 158, 255, 0.5);
        animation: pulse-accept 1s infinite;
    }

    .grammar-slot.slot-filled {
        background: rgba(40, 40, 60, 0.8);
        border-color: #5a5a8a;
        box-shadow: inset 0 0 10px rgba(100, 100, 200, 0.3);
    }

    .grammar-slot.too-expensive {
        border-color: var(--color-moral) !important;
        background: rgba(231, 76, 60, 0.1);
        opacity: 0.7;
        cursor: not-allowed;
    }

        .grammar-slot.too-expensive::after {
            content: '💰';
            position: absolute;
            top: 5px;
            right: 5px;
            font-size: 16px;
            filter: grayscale(1);
        }

.slot-label {
    font-size: 12px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.slot-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
}

/* Cast Area */
.cast-area {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-top: 20px;
    justify-content: center;
}

.cast-button {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

    .cast-button:not(:disabled):hover {
        background: linear-gradient(135deg, #c0392b, #a93226);
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    }

    .cast-button:disabled {
        background: var(--color-border-tertiary);
        cursor: not-allowed;
        opacity: 0.7;
    }

.clear-button {
    background: rgba(50, 50, 70, 0.8);
    color: var(--color-text-secondary);
    border: 2px solid var(--color-border-secondary);
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

    .clear-button:hover {
        background: rgba(60, 60, 80, 0.8);
        border-color: var(--color-border-active);
        color: #ddd;
    }

.mana-cost {
    font-size: 14px;
    color: var(--color-mana-light);
    font-weight: 600;
    background: rgba(20, 20, 40, 0.9);
    padding: 8px 20px;
    border-radius: 20px;
    border: 2px solid var(--color-border-primary);
    margin-top: 10px;
    display: inline-block;
    min-width: 280px;
    text-align: center;
}

    .mana-cost span {
        margin: 0 5px;
    }

/* ===========================
   HAND AREA
   =========================== */
.hand-area {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    padding: 12px;
    background: linear-gradient(to bottom, rgba(20, 20, 35, 0.9), rgba(15, 15, 25, 0.9));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 2px solid rgba(42, 42, 74, 0.5);
    max-width: 90%;
    z-index: var(--z-hand);
    box-shadow: 0 -5px 20px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* Control Buttons Grid */
.hand-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: var(--spacing-sm);
    padding: 10px;
    background: rgba(20, 20, 35, 0.8);
    border-radius: 10px;
    border: 1px solid #3a3a5a;
    min-width: 140px;
}

.control-button {
    width: 65px;
    height: 65px;
    padding: 4px;
    font-size: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid;
    color: #ddd;
}

    .control-button:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    }

    .control-button:active {
        transform: translateY(0);
        box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    }

    .control-button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.button-icon {
    font-size: 18px;
}

.button-text {
    font-size: 9px;
    line-height: 1;
    text-transform: uppercase;
    font-weight: 600;
}

.button-cost,
.button-cooldown {
    font-size: 8px;
    line-height: 1;
}

/* Individual Button Styles */
.draw-button {
    grid-area: 1 / 1;
    background: linear-gradient(135deg, #2a4a6a 0%, #1a3a5a 100%);
    border-color: #3a5a7a;
}

.pass-button {
    grid-area: 1 / 2;
    background: linear-gradient(135deg, #4a4a4a 0%, #2a2a2a 100%);
    border-color: #5a5a5a;
}

.special-button {
    grid-area: 2 / 1;
    background: linear-gradient(135deg, #6a4a2a 0%, #5a3a1a 100%);
    border-color: #7a5a3a;
}

.surrender-button {
    grid-area: 2 / 2;
    background: linear-gradient(135deg, #6a2a2a 0%, #5a1a1a 100%);
    border-color: #7a3a3a;
}

/* Cards Container */
.cards-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px;
    max-width: calc(100% - 180px);
    align-items: center;
    min-height: 160px;
    background: rgba(10, 10, 20, 0.4);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

    /* Custom Scrollbar */
    .cards-container::-webkit-scrollbar,
    .log-content::-webkit-scrollbar {
        height: 6px;
        width: 6px;
    }

    .cards-container::-webkit-scrollbar-track,
    .log-content::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 3px;
    }

    .cards-container::-webkit-scrollbar-thumb,
    .log-content::-webkit-scrollbar-thumb {
        background: rgba(100, 100, 150, 0.5);
        border-radius: 3px;
    }

        .cards-container::-webkit-scrollbar-thumb:hover,
        .log-content::-webkit-scrollbar-thumb:hover {
            background: rgba(120, 120, 170, 0.7);
        }

/* ===========================
   CARDS
   =========================== */
.card {
    width: 100px;
    height: 140px;
    border-radius: 10px;
    padding: 5px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid var(--color-border-secondary);
    flex-shrink: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
}

    .card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    }

    .card.selected {
        border-color: var(--color-text-accent);
        box-shadow: 0 0 20px rgba(243, 156, 18, 0.5);
        transform: translateY(-10px);
    }

    /* Out of mana budget - stays readable and selectable, but clearly not playable */
    .card.card-unaffordable {
        filter: grayscale(0.9) brightness(0.55);
        border-color: var(--color-border-primary);
        cursor: not-allowed;
    }

        .card.card-unaffordable:hover {
            transform: none;
            box-shadow: none;
            filter: grayscale(0.9) brightness(0.7);
        }

/* Card Type Styling */
.card-tone {
    background: linear-gradient(135deg, #4a1a5a 0%, #2a0a3a 100%);
    border-color: #6a2a7a;
}

.card-opener {
    background: linear-gradient(135deg, #1a4a5a 0%, #0a2a3a 100%);
    border-color: #2a6a7a;
}

.card-intensifier {
    background: linear-gradient(135deg, #5a1a1a 0%, #3a0a0a 100%);
    border-color: #7a2a2a;
}

.card-epithet {
    background: linear-gradient(135deg, #5a4a1a 0%, #3a2a0a 100%);
    border-color: #7a6a2a;
}

.card-target,
.card-bloodline,
.card-identity {
    background: linear-gradient(135deg, #1a5a4a 0%, #0a3a2a 100%);
    border-color: #2a7a6a;
}

.card-anatomy {
    background: linear-gradient(135deg, #5a1a4a 0%, #3a0a2a 100%);
    border-color: #7a2a6a;
}

.card-action {
    background: linear-gradient(135deg, #8a2a2a 0%, #5a0a0a 100%);
    border-color: #aa4a4a;
    box-shadow: 0 0 15px rgba(255, 100, 100, 0.3);
}

.card-amplifier {
    background: linear-gradient(135deg, #2a2a8a 0%, #0a0a5a 100%);
    border-color: #4a4aaa;
}

.card-resolution {
    background: linear-gradient(135deg, #2a8a2a 0%, #0a5a0a 100%);
    border-color: #4aaa4a;
}

.card-curse {
    background: linear-gradient(135deg, #8a2a8a 0%, #5a0a5a 100%);
    border-color: #aa4aaa;
    box-shadow: 0 0 20px rgba(200, 100, 200, 0.4);
}

.card-defensive {
    background: linear-gradient(135deg, #2a5a8a 0%, #0a3a5a 100%);
    border-color: #4a7aaa;
}

.card-compound {
    background: linear-gradient(135deg, #666666 0%, #333333 100%);
    border-color: var(--color-text-tertiary);
}

/* Enhanced Damage Preview */
.damage-preview {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-top: 15px;
    padding: 12px;
    background: rgba(20, 20, 30, 0.8);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
    animation: fadeIn 0.3s ease;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

    .damage-preview.active {
        display: block;
    }

.damage-preview-header {
    text-align: center;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--color-text-accent);
    font-size: 16px;
}

.damage-preview-total {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.damage-preview-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.damage-preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.damage-type-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 8px 0;
}

.damage-type-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    border: 1px solid;
    font-size: 13px;
    font-weight: 600;
}

.damage-type-icon {
    font-size: 16px;
}

.damage-type-value {
    font-weight: bold;
}

.damage-type-item.moral {
    border-color: var(--color-moral);
    color: var(--color-moral-light);
}

.damage-type-item.honor {
    border-color: var(--color-honor);
    color: var(--color-honor-light);
}

.damage-type-item.shame {
    border-color: var(--color-shame);
    color: var(--color-shame-light);
}

.damage-type-item.will {
    border-color: var(--color-will);
    color: var(--color-will-light);
}

.damage-type-item.fury {
    border-color: var(--color-fury);
    color: var(--color-fury-light);
}

.damage-type-item.fear {
    border-color: var(--color-fear);
    color: var(--color-fear-light);
}

.damage-preview-bonus {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.bonus-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #2ecc71;
    margin: 4px 0;
}

.bonus-label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.bonus-icon {
    font-size: 14px;
}

.damage-preview-warning {
    margin-top: 8px;
    padding: 6px;
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid var(--color-moral);
    border-radius: 6px;
    color: var(--color-moral-light);
    font-size: 12px;
    text-align: center;
    font-weight: 600;
}

.damage-preview-effects {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.effect-preview {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--color-shame-light);
    margin: 4px 0;
}

.fury-generation {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 6px;
    background: rgba(253, 126, 20, 0.1);
    border: 1px solid var(--color-fury);
    border-radius: 6px;
    color: var(--color-fury-light);
    font-size: 12px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Layout */
.card-type-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.8);
    color: #fff;
    font-size: 9px;
    padding: 3px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.card-damage-icon {
    position: absolute;
    top: 20px;
    right: 5px;
    font-size: 24px;
    opacity: 0.8;
}

.card-text {
    margin-top: 30px;
    padding: 8px;
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-stats {
    position: absolute;
    bottom: 35px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 0 5px;
}

.damage-stat {
    background: rgba(0,0,0,0.7);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid;
}

.damage-moral {
    border-color: var(--color-moral);
    color: var(--color-moral-light);
}

.damage-honor {
    border-color: var(--color-honor);
    color: var(--color-honor-light);
}

.damage-shame {
    border-color: var(--color-shame);
    color: var(--color-shame-light);
}

.damage-will {
    border-color: var(--color-will);
    color: var(--color-will-light);
}

.damage-fury {
    border-color: var(--color-fury);
    color: var(--color-fury-light);
}

.damage-fear {
    border-color: var(--color-fear);
    color: var(--color-fear-light);
}

.card-footer {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
}

.card-cost {
    display: flex;
    align-items: center;
    gap: 3px;
    transition: all var(--transition-fast);
}

    .card-cost.too-expensive {
        color: var(--color-moral) !important;
        text-decoration: line-through;
        opacity: 0.7;
    }

        .card-cost.too-expensive .mana-icon {
            filter: grayscale(1) brightness(0.7);
        }

.mana-icon {
    font-size: 14px;
}

.cost-value {
    font-weight: bold;
    font-size: 14px;
}

.card-alignment {
    font-size: 14px;
}

.card-rarity {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.rarity-common {
    background: #95a5a6;
}

.rarity-uncommon {
    background: #2ecc71;
}

.rarity-rare {
    background: #3498db;
}

.rarity-epic {
    background: #9b59b6;
}

.rarity-legendary {
    background: var(--color-text-accent);
}

/* ===========================
   BATTLE LOG
   =========================== */
.battle-log {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 250px;
    max-height: 400px;
    background: rgba(20, 20, 30, 0.95);
    border: 2px solid var(--color-border-primary);
    border-radius: 8px;
    overflow: hidden;
    z-index: var(--z-controls);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.log-header {
    background: #222;
    padding: 10px;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--color-border-primary);
    flex-shrink: 0;
}

.log-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    font-size: 12px;
    line-height: 1.6;
    min-height: 0;
    max-height: 350px;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.log-entry {
    margin-bottom: 8px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 2px solid var(--color-border-secondary);
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

    .log-entry.damage {
        border-left-color: var(--color-moral);
    }

    .log-entry.heal {
        border-left-color: #2ecc71;
    }

    .log-entry.effect {
        border-left-color: #9b59b6;
    }

    .log-entry.action {
        border-left-color: #3498db;
    }

    .log-entry.info {
        border-left-color: #95a5a6;
    }

/* ===========================
   CROWD SECTION
   =========================== */
.crowd-section {
    position: fixed;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 220px;
    max-height: 400px;
    background: rgba(20, 20, 30, 0.95);
    border: 2px solid var(--color-border-primary);
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    z-index: var(--z-controls);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.crowd-header {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    color: var(--color-text-accent);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hype-meter {
    height: 30px;
    background: rgba(40, 40, 60, 0.6);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 2px solid var(--color-border-primary);
}

.hype-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-text-accent), var(--color-moral));
    transition: width var(--transition-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.crowd-reactions {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
}

.reaction {
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
}

    .reaction:hover {
        transform: scale(1.2);
    }

.reaction-float {
    position: fixed;
    z-index: var(--z-hud);
    font-size: 28px;
    pointer-events: none;
    transform: translate(-50%, 0);
    animation: reactionFloat 1s ease-out forwards;
}

@keyframes reactionFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -80px) scale(1.6);
    }
}

.crowd-messages {
    max-height: 200px;
    overflow-y: auto;
    font-size: 12px;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ===========================
   STATUS EFFECTS
   =========================== */
.status-effects {
    position: fixed;
    left: 20px;
    top: 90px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: var(--z-status);
    max-height: 150px;
    overflow-y: auto;
}

    .status-effects.opponent {
        left: auto;
        right: 20px;
    }

.status-effect {
    background: rgba(30, 30, 45, 0.9);
    border: 1px solid var(--color-border-tertiary);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-icon {
    font-size: 16px;
}

.status-name {
    font-size: 11px;
}

.status-duration {
    font-size: 10px;
    color: var(--color-text-tertiary);
    margin-left: auto;
}

/* ===========================
   MODALS & OVERLAYS
   =========================== */
.loading-screen,
.victory-screen {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
}

    .loading-screen.active,
    .victory-screen.active {
        display: flex;
    }

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--color-border-primary);
    border-top-color: var(--color-text-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-text {
    font-size: 18px;
    color: var(--color-text-secondary);
}

/* Victory Screen */
.victory-content {
    text-align: center;
    padding: 40px;
    background: var(--color-bg-secondary);
    border-radius: 20px;
    border: 3px solid #4a4a7a;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.victory-title {
    font-size: 48px;
    color: var(--color-path-light);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin-bottom: 30px;
    font-weight: bold;
    letter-spacing: 3px;
}

.victory-stats {
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.victory-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(30, 30, 50, 0.8);
    border-radius: 10px;
    border: 1px solid var(--color-border-tertiary);
}

.victory-stat-label {
    color: #aaa;
    font-size: 14px;
}

.victory-stat-value {
    color: var(--color-mana-light);
    font-weight: bold;
    font-size: 16px;
}

.victory-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.victory-button {
    background: linear-gradient(135deg, #4a4a8a 0%, #2a2a5a 100%);
    border: 2px solid #6a6aaa;
    border-radius: 10px;
    padding: 12px 30px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

    .victory-button:hover {
        background: linear-gradient(135deg, #5a5a9a 0%, #3a3a6a 100%);
        border-color: #8a8aca;
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.6);
    }

    .victory-button:active {
        transform: translateY(0);
        box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    }

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-accept {
    0%, 100% {
        box-shadow: 0 0 15px rgba(74, 158, 255, 0.5);
    }

    50% {
        box-shadow: 0 0 25px rgba(74, 158, 255, 0.8);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(74, 158, 255, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(74, 158, 255, 0.8);
    }
}

@keyframes spell-cast {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

@keyframes spell-cast-delayed {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }

    10% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }

    80% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }
}

@keyframes mana-blink {
    0%, 100% {
        background-color: rgba(255, 0, 0, 0.2);
        color: #ff0000;
        border-color: #ff0000;
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    }

    50% {
        background-color: rgba(255, 0, 0, 0.5);
        color: #ffffff;
        border-color: #ff3333;
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    }
}

/* Quick Damage Preview */
.quick-damage-preview {
    animation: fadeIn 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

/* ===========================
   UTILITY CLASSES
   =========================== */
.mana-insufficient-blink {
    animation: mana-blink 0.5s ease-in-out 2;
}

/* ===========================
   MUSIC TOGGLE
   =========================== */
.music-toggle {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: var(--z-hud);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(30, 30, 50, 0.7);
    border: 1px solid var(--color-border-tertiary);
    border-radius: 50%;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.music-toggle:hover {
    background: rgba(50, 50, 80, 0.85);
    border-color: var(--color-border-active);
}

.music-toggle:focus-visible {
    outline: 2px solid var(--color-mana-light);
    outline-offset: 2px;
}

.music-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.music-icon-off,
.music-toggle.music-off .music-icon-on {
    display: none;
}

.music-toggle.music-off .music-icon-off {
    display: block;
}

.music-toggle.music-off {
    color: var(--color-text-tertiary);
}

/* Responsive layout lives in comic-theme.css as container queries on the scaled
   stage (.game-container); viewport media queries here would fire on device width,
   not on the stage's logical size. */
