:root {
    --primary-color: #ff3e3e;
    --secondary-color: #ffd700;
    --accent-color: #00f2ff;
    --bg-dark: #0a0a0c;
    --text-light: #ffffff;
    --hud-bg: rgba(0, 0, 0, 0.4);
    --font-main: 'NanumSquare', 'Segoe UI', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

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

#game-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100%;
    max-height: 800px;
    background: #000;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* --- UI OVERLAY (HUD) --- */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}

#score-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
    letter-spacing: 1px;
}

#score-value {
    font-size: 1.8rem;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#wave-label {
    text-align: right;
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 5px;
}

#health-bar-container {
    width: 120px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

#health-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #ff3e3e, #ff7e7e);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--primary-color);
}

/* --- OVERLAYS --- */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    text-align: center;
    padding: 30px;
    transition: opacity 0.4s ease;
}

#start-screen {
    background-color: #000;
    background-image: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.7)), url('photo/2.jpg');
    background-size: cover;
    background-position: center;
}

#start-screen h1 {
    font-size: 3rem;
    color: var(--secondary-color);
    text-shadow: 0 0 20px rgba(0,0,0,0.8), 2px 2px 0px #000;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 1rem;
    color: #eee;
    margin-bottom: 40px;
    text-shadow: 1px 1px 2px #000;
}

.menu-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 240px;
}

/* --- BUTTONS --- */
button {
    padding: 14px 0;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.main-btn {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 62, 62, 0.4);
}

.main-btn:hover {
    transform: scale(1.05);
    background: #ff5e5e;
}

.sub-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
}

.sub-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- MODALS --- */
#scoreboard-modal {
    background: rgba(0, 0, 0, 0.9);
}

.modal-content {
    width: 100%;
    max-width: 320px;
}

#scores-list {
    margin: 30px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 10px;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 1.1rem;
}

.score-entry:last-child {
    border-bottom: none;
}

.score-rank {
    color: var(--secondary-color);
    font-weight: bold;
    margin-right: 10px;
}

/* --- UTILS --- */
.hidden {
    display: none !important;
}

#powerup-notify {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-color);
    color: #000;
    padding: 5px 20px;
    border-radius: 20px;
    font-weight: bold;
    animation: bounce 0.5s infinite alternate;
    z-index: 15;
}

@keyframes bounce {
    from { transform: translateX(-50%) translateY(0); }
    to { transform: translateX(-50%) translateY(-10px); }
}

#game-container::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
    z-index: 5;
}
