* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;400;600;700&display=swap');

:root {
    --primary-gold: #ffd700;
    --secondary-gold: #ffed4e;
    --accent-red: #ff4757;
    --accent-blue: #3742fa;
    --accent-purple: #5f27cd;
    --accent-green: #2ed573;
    --dark-bg: #1a1a2e;
    --card-bg: #16213e;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-light: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-gold: linear-gradient(45deg, var(--primary-gold), var(--secondary-gold));
    --gradient-fire: linear-gradient(45deg, #ff6b6b, #ffa502);
    --gradient-royal: linear-gradient(135deg, #667eea, #764ba2);
}

body {
    font-family: 'Exo 2', sans-serif;
    background: var(--gradient-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.game-container {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    padding: 30px;
    box-shadow: var(--shadow-heavy);
    max-width: 1000px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-gold);
    border-radius: 25px 25px 0 0;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.header h1 {
    font-family: 'Orbitron', monospace;
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 10px;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.3)); }
    to { filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.6)); }
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-light);
}

.elixir-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.elixir-label {
    font-weight: 600;
    color: var(--primary-gold);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.elixir-bar {
    width: 180px;
    height: 25px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    border: 2px solid var(--glass-border);
}

.elixir-fill {
    height: 100%;
    background: var(--gradient-gold);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.elixir-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.elixir-text {
    font-weight: 700;
    color: var(--primary-gold);
    font-size: 1.2rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.timer {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-red);
    text-shadow: 0 0 15px rgba(255, 71, 87, 0.5);
    animation: pulse 1s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

#gameCanvas {
    border: 3px solid var(--primary-gold);
    border-radius: 15px;
    background: linear-gradient(to bottom, #74b9ff, #0984e3);
    display: block;
    margin: 0 auto 25px;
    cursor: crosshair;
    box-shadow: var(--shadow-heavy);
    transition: all 0.3s ease;
}

#gameCanvas:hover {
    border-color: var(--secondary-gold);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4);
}

.card-selection {
    text-align: center;
}

.card-selection h2 {
    margin-bottom: 25px;
    color: var(--primary-gold);
    font-size: 2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.card {
    background: var(--card-bg);
    border: 2px solid var(--glass-border);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-heavy);
    border-color: var(--primary-gold);
}

.card.selected {
    border-color: var(--accent-red);
    background: linear-gradient(135deg, var(--accent-red), #ffa502);
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(255, 71, 87, 0.3);
}

.card-image {
    font-size: 2.5rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.card-name {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-cost {
    background: var(--accent-red);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin: 0 auto;
    font-size: 1.1rem;
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.3);
    transition: all 0.3s ease;
}

.card:hover .card-cost {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(255, 71, 87, 0.4);
}

#startGame {
    background: var(--gradient-fire);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 30px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: var(--shadow-light);
    position: relative;
    overflow: hidden;
}

#startGame::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;
}

#startGame:hover::before {
    left: 100%;
}

#startGame:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-heavy);
}

#startGame:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.hand {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 15px;
    margin-top: 25px;
    box-shadow: var(--shadow-light);
}

.hand-label {
    text-align: center;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--primary-gold);
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hand-cards {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.hand-card {
    background: var(--card-bg);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 100px;
    text-align: center;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.hand-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.hand-card:hover::before {
    left: 100%;
}

.hand-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: var(--shadow-heavy);
    border-color: var(--primary-gold);
}

.hand-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.hand-card.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--glass-border);
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over-content {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 50px;
    border-radius: 25px;
    text-align: center;
    box-shadow: var(--shadow-heavy);
    animation: slideIn 0.5s ease;
    max-width: 500px;
    width: 90%;
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.game-over-content h2 {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#playAgain {
    background: var(--gradient-fire);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 20px;
}

#playAgain:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-heavy);
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        margin: 10px;
        padding: 20px;
        border-radius: 20px;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .elixir-bar {
        width: 150px;
    }
    
    .hand-cards {
        gap: 15px;
    }
    
    .hand-card {
        min-width: 80px;
        padding: 12px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-gold);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Particle Effects */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-gold);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 2s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(0);
    }
} 