:root {
    --bg-color: #111;
    --text-color: #eee;
    --accent-color: #e53935;
    --exp-color: #42a5f5;
    --health-color: #66bb6a;
    --card-bg: rgba(30, 30, 40, 0.8);
}

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

body {
    background-color: #000;
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    user-select: none;
}

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

canvas {
    display: block;
    image-rendering: pixelated;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* HUD */
#top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    z-index: 10;
}

.exp-bar-container {
    width: 80%;
    height: 15px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid #333;
    border-radius: 8px;
    overflow: hidden;
}

#exp-bar-fill {
    height: 100%;
    width: 0%;
    background-color: var(--exp-color);
    box-shadow: 0 0 10px var(--exp-color);
    transition: width 0.2s ease-out;
}

#level-display {
    position: absolute;
    right: 15%;
    top: 10px;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
}

#time-display {
    margin-top: 10px;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
}

#health-bar-container {
    position: absolute;
    /* Updated dynamically in JS to follow player or fixed at bottom */
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #333;
    border-radius: 10px;
    overflow: hidden;
    z-index: 10;
}

#health-bar-fill {
    height: 100%;
    width: 100%;
    background-color: var(--health-color);
    box-shadow: 0 0 10px var(--health-color);
    transition: width 0.1s linear;
}

/* Boss UI */
#boss-ui {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

#boss-name {
    font-size: 24px;
    font-weight: bold;
    color: #e53935;
    text-shadow: 0 0 10px #e53935, 2px 2px 0 #000;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#boss-hp-container {
    width: 100%;
    height: 25px;
    background-color: rgba(0, 0, 0, 0.8);
    border: 3px solid #424242;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(229, 57, 53, 0.5);
}

#boss-hp-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #b71c1c, #e53935);
    transition: width 0.1s linear;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
    z-index: 20;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

.screen h1 {
    font-size: 64px;
    margin-bottom: 20px;
    color: var(--accent-color);
    text-shadow: 0 0 20px var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 5px;
}

.screen h2 {
    font-size: 48px;
    margin-bottom: 30px;
    color: #ffd700;
    text-shadow: 0 0 15px #ffd700;
}

.screen p {
    font-size: 24px;
    margin-bottom: 30px;
}

button {
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(45deg, #b71c1c, #e53935);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(229, 57, 53, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    pointer-events: auto;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(229, 57, 53, 0.6);
}

button:active {
    transform: scale(0.95);
}

/* Level Up Cards */
#upgrade-cards-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
}

.upgrade-card {
    width: 250px;
    height: 350px;
    background: var(--card-bg);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(10px);
}

.upgrade-card:hover {
    transform: translateY(-10px);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.upgrade-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px;
}

.upgrade-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.upgrade-desc {
    font-size: 16px;
    text-align: center;
    color: #ccc;
    flex-grow: 1;
}

.upgrade-level {
    font-size: 14px;
    color: #888;
    margin-top: 10px;
}
