:root {
    --primary: #ff7bc3;
    --primary-dark: #d5519b;
    --bg-dark: #2a2a35;
    --text-light: #ffffff;
    --text-dark: #333;
    --bg-lobby: #a0e6ff;
    --boss-hp: #ff3333;
    --player-hp: #33ff33;
}

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

body {
    font-family: 'Jua', sans-serif;
    background-color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: var(--text-dark);
    overflow: hidden;
}

#game-container {
    width: 800px;
    height: 750px;
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* ===== LOBBY SCREEN ===== */
#lobby-screen {
    background: linear-gradient(135deg, var(--bg-lobby) 0%, #ffffff 100%);
    padding: 20px;
    align-items: center;
    overflow-y: auto;
}

#lobby-screen h1 {
    color: var(--primary-dark);
    font-size: 36px;
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
}

.resources {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
}

.icon {
    font-size: 24px;
}

.icon.fire {
    text-shadow: 0 0 5px red;
}

.icon.water {
    text-shadow: 0 0 5px blue;
}

.icon.light {
    text-shadow: 0 0 5px yellow;
}

.waddle-dee-container {
    margin: 10px 0;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s;
    user-select: none;
}

.waddle-dee-container:active {
    transform: scale(0.9);
}

.waddle-dee-sprite {
    font-size: 80px;
    animation: breathe 2s infinite ease-in-out;
}

.waddle-dee-text {
    font-size: 18px;
    color: #555;
    background: rgba(255, 255, 255, 0.7);
    padding: 5px 10px;
    border-radius: 10px;
    margin-top: -10px;
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05) translateY(-5px);
    }
}

.shop-container {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    width: 80%;
    margin-bottom: auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.shop-container h2 {
    text-align: center;
    margin-bottom: 15px;
    color: #444;
}

.upgrades {
    display: flex;
    justify-content: space-around;
}

.upgrade-btn {
    background: #f0f0f0;
    border: 3px solid #ddd;
    border-radius: 10px;
    padding: 10px;
    font-family: 'Jua', sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.upgrade-btn:hover {
    background: #fff;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.upgrade-btn:active {
    transform: translateY(2px);
}

.upgrade-btn small {
    color: #666;
}

.main-btn {
    background: var(--primary);
    color: white;
    border: 4px solid var(--primary-dark);
    border-radius: 30px;
    padding: 15px 40px;
    font-family: 'Jua', sans-serif;
    font-size: 28px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 5px 0 var(--primary-dark);
    transition: all 0.1s;
}

.main-btn:hover {
    background: #ff8ecf;
    transform: translateY(-2px);
    box-shadow: 0 7px 0 var(--primary-dark);
}

.main-btn:active {
    transform: translateY(5px);
    box-shadow: none;
}

.main-btn.small {
    padding: 10px 20px;
    font-size: 20px;
}

.start-btn-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
}

/* ===== BATTLE SCREEN ===== */
#battle-screen {
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 60%, #8B4513 60%, #654321 100%);
    position: relative;
}

.battle-ui {
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    color: white;
}

.timer {
    font-size: 24px;
    font-weight: bold;
    min-width: 150px;
}

.boss-hp-container {
    flex-grow: 1;
    margin-left: 20px;
    background: #444;
    height: 30px;
    border-radius: 15px;
    border: 3px solid #222;
    position: relative;
    overflow: hidden;
}

.hp-bar-fill {
    height: 100%;
    transition: width 0.2s ease-out;
}

.hp-bar-fill.boss-hp {
    background: var(--boss-hp);
    width: 100%;
}

#boss-hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

#game-canvas {
    display: block;
    margin: 0;
    padding: 0;
    width: 800px;
    height: 400px;
    /* Canvas background is transparent, we draw the ground/sky in CSS or Canvas */
}

.player-hud {
    position: absolute;
    bottom: 40px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    padding: 0 20px;
}

.char-status {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 10px;
    width: 22%;
    text-align: center;
}

.char-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 1px 1px 1px black;
}

.hp-bar-bg {
    width: 100%;
    height: 15px;
    background: #444;
    border-radius: 8px;
    border: 2px solid #222;
    overflow: hidden;
}

.hp-bar-bg .hp-bar-fill {
    background: var(--player-hp);
    width: 100%;
}

.controls-help {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* ===== MODAL ===== */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    min-width: 400px;
    border: 5px solid var(--primary);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#result-title {
    font-size: 48px;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.badge-container {
    margin: 20px 0;
}

.badge {
    font-size: 80px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    animation: float 2s infinite ease-in-out;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

#result-rank {
    font-size: 32px;
    font-weight: bold;
    margin-top: 10px;
}

.clear-time {
    font-size: 24px;
    color: #666;
    margin-bottom: 20px;
}

.rewards-list {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 20px;
    justify-content: center;
    gap: 15px;
}

/* ===== BOSS SELECTION ===== */
.boss-selection {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 15px;
    width: 80%;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.boss-selection h2 {
    text-align: center;
    font-size: 20px;
    color: #444;
    margin-bottom: 10px;
}

.boss-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.boss-btn {
    background: #f0f0f0;
    border: 3px solid #ddd;
    border-radius: 10px;
    padding: 10px 5px;
    font-family: 'Jua', sans-serif;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.boss-btn:hover {
    background: #fff;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.boss-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
}