:root {
    --primary-color: #6a0dad;
    --secondary-color: #8be9fd;
    --combat-red: #d9534f;
}

/* Nascondi automaticamente l'UI di combattimento */
.hidden {
    display: none !important;
}

body {
    background-color: #1a1a1a;
    color: white;
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 20px;
}

#game-container {
    max-width: 1000px;
    margin: 0 auto;
}

#header {
    text-align: center;
    border-bottom: 3px solid var(--primary-color);
    margin-bottom: 20px;
    padding: 15px;
}

#stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 20px 0;
    font-size: 1.2em;
    text-align: center;
}

#scene-container {
    position: relative;
    height: 500px;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    overflow: hidden;
}

.background {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
}

.character {
    position: absolute;
    bottom: 50px;
    transition: all 0.3s ease;
}

.player-character {
    left: 100px;
    height: 200px;
    z-index: 2;
}

.npc-character {
    right: 100px;
    height: 250px;
    z-index: 1;
}

.enemy-character {
    right: -500px;
    height: 300px;
    animation: approach 1.5s forwards;
}

@keyframes approach {
    from { right: -500px; }
    to { right: 100px; }
}

#dialogue {
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.8);
}

#message {
    min-height: 150px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.choice-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    background: #2d2d2d;
    border: 1px solid var(--primary-color);
    color: white;
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s ease;
}

.choice-btn:hover {
    transform: translateX(10px);
    background: #3a3a3a;
}

/* Combat UI */
#combat-ui {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border: 3px solid var(--combat-red);
    border-radius: 10px;
    z-index: 1000;
    width: 500px;
}

#combat-message {
    font-size: 1.2em;
    margin-bottom: 15px;
    text-align: center;
    min-height: 30px;
    font-weight: bold;
    animation: textScroll 3s linear;
}

@keyframes textScroll {
    0% { opacity: 0; transform: translateY(-10px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0.7; transform: translateY(0); }
}

#combat-player-stats {
    text-align: left;
    margin-bottom: 15px;
    font-size: 1.1em;
    line-height: 1.5;
}

.health-bar {
    margin: 15px 0;
    display: flex;
    align-items: center;
}

.health-bar span {
    width: 100px;
    display: inline-block;
}

.bar {
    width: 300px;
    height: 20px;
    background: #444;
    border-radius: 5px;
    overflow: hidden;
    flex-grow: 1;
}

.health {
    height: 100%;
    background: linear-gradient(to right, #00ff00, #00cc00);
    transition: width 0.3s ease;
}

#enemyHealth {
    background: linear-gradient(to right, #ff3300, #cc0000);
}

.action-group {
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.combat-btn {
    padding: 10px;
    background: var(--combat-red);
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    flex-grow: 1;
    transition: all 0.2s ease;
}

.combat-btn:hover {
    transform: scale(1.05);
    background: #c9302c;
}

/* Animazioni aggiuntive */
.shake {
    animation: shake 0.5s linear infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.pulse {
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Responsive design */
@media (max-width: 768px) {
    #combat-ui {
        width: 90%;
        padding: 15px;
    }
    
    .bar {
        width: 200px;
    }
    
    .action-group {
        flex-direction: column;
    }
    
    .combat-btn {
        width: 100%;
    }
}