/* צבעים ומשתנים גלובליים - סגנון פורטנייט */
:root {
    --primary-blue: #007bff;
    --primary-purple: #8b5cf6;
    --success-green: #28a745;
    --danger-red: #dc3545;
    --warning-yellow: #ffc107;
    --dark-bg: #1a1a2e;
    --darker-bg: #16213e;
    --light-blue: #0f3460;
    --text-light: #ffffff;
    --text-secondary: #b8c5d1;
    --gold: #ffd700;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glow: 0 0 20px rgba(139, 92, 246, 0.5);
}

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

body {
    font-family: 'Heebo', Arial, sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--darker-bg) 50%, var(--light-blue) 100%);
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
    direction: rtl;
}

/* רקע אנימטד */
.game-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 123, 255, 0.3) 0%, transparent 50%),
        linear-gradient(135deg, var(--dark-bg) 0%, var(--darker-bg) 100%);
    animation: backgroundShift 10s ease-in-out infinite alternate;
    z-index: -1;
}

@keyframes backgroundShift {
    0% { transform: rotate(0deg) scale(1); }
    100% { transform: rotate(2deg) scale(1.05); }
}

.game-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* מסכים */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* מסך התחלה */
.title-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 3rem;
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow);
    animation: float 3s ease-in-out infinite;
}

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

.game-title {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--gold), var(--warning-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* כפתורים */
.btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.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;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-purple), var(--primary-blue));
    color: var(--text-light);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--glow), var(--shadow);
}

.btn-attack {
    background: linear-gradient(45deg, var(--danger-red), #ff6b6b);
    color: var(--text-light);
    font-size: 1.2rem;
    padding: 1.2rem 2.5rem;
    margin-top: 1rem;
}

.btn-attack:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(220, 53, 69, 0.6);
}

/* HUD - ממשק משתמש עליון */
.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    z-index: 10;
}

.hud-item {
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.hud-item i {
    font-size: 1.5rem;
}

.hud-item:nth-child(1) i { color: var(--danger-red); }
.hud-item:nth-child(2) i { color: var(--gold); }
.hud-item:nth-child(3) i { color: var(--primary-blue); }

/* זירת הלחימה */
.battle-arena {
    position: relative;
    width: 90%;
    height: 70%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem;
}

/* דמויות */
.character {
    position: relative;
    text-align: center;
    animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.david {
    width: 150px;
    height: 200px;
    background: linear-gradient(45deg, var(--primary-blue), var(--primary-purple));
    border-radius: 20px;
    border: 3px solid var(--gold);
    box-shadow: var(--glow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.david::before {
    content: '👑';
    font-size: 3rem;
    position: absolute;
    top: 20px;
}

.david::after {
    content: '🏹';
    font-size: 2.5rem;
    position: absolute;
    bottom: 30px;
}

.goliath {
    width: 200px;
    height: 300px;
    background: linear-gradient(45deg, var(--danger-red), #8b0000);
    border-radius: 20px;
    border: 3px solid #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.goliath::before {
    content: '⚔️';
    font-size: 4rem;
    position: absolute;
    top: 30px;
}

.goliath::after {
    content: '🛡️';
    font-size: 3rem;
    position: absolute;
    bottom: 40px;
}

.character-name {
    position: absolute;
    top: -30px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.8);
    padding: 5px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
}

/* פס חיים */
.health-bar {
    position: absolute;
    bottom: -20px;
    width: 120%;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-green), var(--warning-yellow));
    border-radius: 5px;
    transition: width 0.3s ease;
    width: 100%;
}

/* בקרות */
.controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.power-meter {
    width: 200px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.power-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-green), var(--warning-yellow), var(--danger-red));
    border-radius: 8px;
    transition: width 0.1s ease;
    width: 0%;
}

.power-meter span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
}

/* פרויקטילים */
#projectiles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.projectile {
    position: absolute;
    width: 15px;
    height: 15px;
    background: radial-gradient(circle, var(--gold), var(--warning-yellow));
    border-radius: 50%;
    box-shadow: 0 0 15px var(--gold);
    animation: projectileTrail 0.1s ease-in-out infinite alternate;
}

@keyframes projectileTrail {
    0% { box-shadow: 0 0 15px var(--gold); }
    100% { box-shadow: 0 0 25px var(--gold), 0 0 35px rgba(255, 215, 0, 0.3); }
}

/* מסך סיום */
.game-over-container {
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    padding: 3rem;
    border-radius: 20px;
    border: 2px solid var(--danger-red);
    backdrop-filter: blur(20px);
    animation: gameOverPulse 2s ease-in-out infinite;
}

@keyframes gameOverPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

#game-over-title {
    font-size: 2.5rem;
    color: var(--danger-red);
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.final-stats {
    margin: 2rem 0;
    font-size: 1.3rem;
}

.final-stats p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.final-stats span {
    color: var(--gold);
    font-weight: 600;
}

/* אנימציות נוספות */
.hit-effect {
    animation: hitFlash 0.3s ease-in-out;
}

@keyframes hitFlash {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(2) hue-rotate(90deg); }
}

/* אפקט ניצוץ לפגיעה */
.spark-effect {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--gold);
    border-radius: 50%;
    pointer-events: none;
    animation: sparkFly 0.8s ease-out forwards;
}

@keyframes sparkFly {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0) translateX(var(--spark-x)) translateY(var(--spark-y));
    }
}

/* אפקט רעידה למסך */
.screen-shake {
    animation: screenShake 0.5s ease-in-out;
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* אפקט זוהר לכפתור התקפה */
.btn-attack.charging {
    animation: chargingGlow 0.1s ease-in-out infinite alternate;
    box-shadow: 0 0 30px var(--danger-red), 0 0 60px rgba(220, 53, 69, 0.4);
}

@keyframes chargingGlow {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.3); }
}

.damage-text {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--danger-red);
    pointer-events: none;
    animation: damageFloat 1s ease-out forwards;
}

@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px);
    }
}

/* רספונסיביות */
@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }
    
    .battle-arena {
        width: 95%;
        height: 60%;
        padding: 1rem;
    }
    
    .david, .goliath {
        transform: scale(0.8);
    }
    
    .hud {
        flex-direction: column;
        gap: 10px;
        top: 10px;
        left: 10px;
        right: 10px;
    }
    
    .hud-item {
        padding: 10px 15px;
        font-size: 1rem;
    }
}