* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0d0d1a;
    color: #fff;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#gameCanvas {
    background: #000;
    display: block;
    width: 100%;
    height: 100%;
}

/* --- UI OVERLAY SYSTEM --- */
#ui-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

/* Overlays should cover the screen and center their content */
.overlay-full {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 1000;
}

/* Centered panels */
.panel-center {
    pointer-events: auto;
}

/* Lobby Menu */
#menu {
    width: 1000px;
    height: 650px;
    background: rgba(15, 15, 30, 0.95);
    backdrop-filter: blur(30px);
    border: 2px solid rgba(255, 77, 141, 0.3);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

/* --- SCALING --- */
@media (max-width: 1100px) or (max-height: 750px) {
    #menu, .results-panel, .selection-panel, #pause-menu { transform: scale(0.8); }
    #menu { transform: translate(-50%, -50%) scale(0.8); }
}
@media (max-width: 900px) or (max-height: 600px) {
    #menu, .results-panel, .selection-panel, #pause-menu { transform: scale(0.65); }
    #menu { transform: translate(-50%, -50%) scale(0.65); }
}

.lobby-header {
    background: linear-gradient(90deg, rgba(255, 77, 141, 0.2), transparent);
    padding: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lobby-header h1 {
    font-size: 3rem;
    color: #ff4d8d;
    text-shadow: 0 0 15px rgba(255, 77, 141, 0.8);
    letter-spacing: 10px;
    font-weight: 900;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem 2rem;
    cursor: pointer;
    font-weight: 900;
    border-radius: 12px;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #ff4d8d;
    box-shadow: 0 0 20px rgba(255, 77, 141, 0.6);
}

.tab-content { display: none; padding: 2rem; flex-grow: 1; overflow-y: auto; }
.tab-content.active { display: flex; flex-direction: column; }

/* --- STAGE CAROUSEL --- */
#stage-carousel {
    display: flex;
    gap: 30px;
    overflow-x: auto;
    padding: 20px;
    height: 100%;
    align-items: center;
}

.stage-card {
    min-width: 260px;
    height: 360px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.stage-card:hover {
    transform: translateY(-10px);
    border-color: #ff4d8d;
    background: rgba(255, 77, 141, 0.1);
}

.stage-card .art-placeholder {
    width: 150px;
    height: 150px;
    background: linear-gradient(45deg, #ff4d8d, #00e5ff);
    border-radius: 50%;
    margin-bottom: 25px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* --- OVERLAYS --- */
.selection-panel {
    width: 600px;
    background: #0a0a1a;
    border: 2px solid #00e5ff;
    border-radius: 30px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 229, 255, 0.3);
}

.results-panel {
    width: 800px;
    background: #0a0a1a;
    border: 3px solid #ff4d8d;
    border-radius: 40px;
    padding: 4rem;
    text-align: center;
    box-shadow: 0 0 60px rgba(255, 77, 141, 0.4);
}

#results-rank {
    font-size: 14rem;
    font-weight: 900;
    text-shadow: 0 0 40px currentColor;
    line-height: 0.8;
}

.rank-s { color: #ffcc00; }
.rank-a { color: #ff4d8d; }
.rank-b { color: #00e5ff; }
.rank-c { color: #00ff88; }

/* --- HUD --- */
#hud {
    position: absolute;
    top: 30px;
    left: 30px;
    display: flex;
    gap: 40px;
    pointer-events: none;
    z-index: 50;
}

#score, #combo, #accuracy {
    font-size: 2.8rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 77, 141, 0.5);
}

#ui-bottom-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 50;
}

#health-container, #fever-container {
    width: 700px;
    height: 12px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

#health-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff4d8d, #ff3366);
    box-shadow: 0 0 15px #ff4d8d;
    transition: width 0.3s;
}

#fever-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ffcc00, #ffaa00);
    box-shadow: 0 0 15px #ffcc00;
    transition: width 0.1s linear;
}

/* --- LOADING --- */
#loading-overlay {
    background: #000;
    z-index: 99999;
}

#loading-overlay.hidden { display: none !important; }

.loader-content h2 { 
    color: #ff4d8d !important; 
    font-size: 4rem !important; 
    text-shadow: 0 0 30px rgba(255, 77, 141, 0.8);
    font-weight: 900;
    letter-spacing: 15px;
}

/* --- UTILS --- */
.hidden { display: none !important; }

#results-close-btn {
    background: #fff;
    color: #000;
    padding: 1.2rem 4rem;
    font-size: 1.5rem;
    font-weight: 900;
    border-radius: 15px;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 30px #fff;
}

#results-close-btn:hover { background: #ff4d8d; color: #fff; box-shadow: 0 0 40px #ff4d8d; }

.upload-area { border: 4px dashed rgba(0, 229, 255, 0.2); background: rgba(255, 255, 255, 0.02); border-radius: 30px; padding: 4rem; text-align: center; margin: 20px; }
.drop-hint { font-size: 2.5rem; font-weight: 900; color: #00e5ff; text-shadow: 0 0 10px rgba(0, 229, 255, 0.5); }
#import-btn { background: #00ff88; font-size: 1.5rem; font-weight: 900; padding: 1rem 4rem; border-radius: 12px; box-shadow: 0 0 20px rgba(0, 255, 136, 0.3); border: none; cursor: pointer; }
