* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #222;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: white;
}

#game-container {
    width: 800px;
    height: 600px;
    background-color: #333;
    border: 4px solid #fff;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0px 0px 20px rgba(0,0,0,0.8);
}

.screen {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    text-align: center;
    padding: 20px;
}

.screen.active {
    display: flex;
}

h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    color: #f1c40f;
    text-shadow: 2px 2px 4px #000;
}

p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

button {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    background-color: #e74c3c;
    color: white;
    border: 2px solid white;
    border-radius: 8px;
    transition: 0.2s;
    box-shadow: 0px 4px 0px #c0392b;
}

button:hover {
    background-color: #c0392b;
    transform: translateY(2px);
    box-shadow: 0px 2px 0px #962d22;
}

button:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Battle Screen */
#battle-screen {
    justify-content: space-between;
    background: linear-gradient(to bottom, #87CEEB 50%, #8B4513 50%);
}

.level-info {
    background: rgba(0,0,0,0.7);
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid white;
    width: 90%;
    margin-top: 10px;
}

.arena {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    width: 100%;
    height: 200px;
    margin-top: 20px;
}

.character {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sprite {
    font-size: 90px;
    margin-bottom: 15px;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
}

.hp-bar-container {
    width: 150px;
    height: 24px;
    background-color: #555;
    border: 2px solid white;
    border-radius: 4px;
    overflow: hidden;
}

.hp-bar {
    width: 100%;
    height: 100%;
    background-color: #2ecc71;
    transition: width 0.3s ease;
}

.hp-text {
    background: rgba(0,0,0,0.8);
    padding: 4px 8px;
    margin-top: 8px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 4px;
}

.dialogue-box {
    background: rgba(0,0,0,0.8);
    border: 2px solid white;
    border-radius: 8px;
    width: 90%;
    padding: 15px;
    font-size: 1.2rem;
    margin-top: 20px;
    min-height: 60px;
}

.question-container {
    background: #2c3e50;
    width: 90%;
    padding: 20px;
    border: 2px solid white;
    border-radius: 8px;
    margin-bottom: 20px;
    margin-top: 10px;
    box-shadow: 0px 4px 8px rgba(0,0,0,0.5);
}

.timer-container {
    width: 100%;
    height: 15px;
    background-color: #555;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    border: 1px solid #7f8c8d;
}

.timer-bar {
    width: 100%;
    height: 100%;
    background-color: #3498db;
    transition: width 1s linear, background-color 0.3s;
}

#question-text {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #ecf0f1;
}

.input-area {
    display: flex;
    justify-content: center;
    gap: 15px;
}

input[type="number"] {
    padding: 12px;
    font-size: 1.5rem;
    font-weight: bold;
    width: 180px;
    text-align: center;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    background-color: #fff;
    color: #2c3e50;
}

input[type="number"]:focus {
    outline: none;
    border-color: #f1c40f;
    box-shadow: 0 0 10px #f1c40f;
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.damage-flash {
    animation: flash 0.3s;
}

@keyframes flash {
    0% { filter: brightness(1) drop-shadow(2px 4px 6px rgba(0,0,0,0.5)); }
    50% { filter: brightness(3) sepia(1) hue-rotate(300deg) drop-shadow(0 0 20px red); }
    100% { filter: brightness(1) drop-shadow(2px 4px 6px rgba(0,0,0,0.5)); }
}
