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

body, html {
    width: 100%;
    height: 100%;
    background-color: #000;
    font-family: 'Roboto', sans-serif;
    overflow: hidden;
}

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

#bg-video, #bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

#bg-image {
    opacity: 0.4;
}

#bg-video {
    z-index: 2; /* Put above the bg-image so it's not obscured */
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

#bg-video.playing {
    opacity: 0.6;
}

#game-canvas {
    position: absolute;
    z-index: 5;
    background: transparent;
    cursor: crosshair;
    /* Maintain 4:3 aspect ratio mostly, fit to screen */
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1024 / 768;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to canvas when in gameplay */
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* Catch clicks on UI */
    transition: opacity 0.3s;
}

.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Login Screen */
.logo {
    font-family: 'Fredoka One', cursive;
    font-size: 8rem;
    color: #ff66aa;
    text-shadow: 0 0 20px #ff66aa, 4px 4px 0px #aa2266;
    margin-bottom: 2rem;
}

.login-box {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 2rem;
    border-radius: 15px;
    border: 2px solid #444;
}

input {
    padding: 15px;
    font-size: 1.2rem;
    border: none;
    border-radius: 8px;
    outline: none;
    text-align: center;
    font-family: 'Roboto', sans-serif;
}

input:focus {
    box-shadow: 0 0 10px #ff66aa;
}

button {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Fredoka One', cursive;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

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

#login-btn {
    background: #ff66aa;
    color: white;
}
#login-btn:hover { background: #ff88cc; }

/* Menu Screen */
#menu-screen {
    background: rgba(0,0,0,0.6);
}

.menu-header {
    margin-bottom: 2rem;
}

#welcome-text {
    font-size: 3rem;
    color: white;
    text-shadow: 2px 2px 4px black;
}

.menu-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 500px;
}

h3 {
    color: #ccc;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 2px;
}

.song-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.song-item {
    background: rgba(255,255,255,0.1);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.song-item:hover { background: rgba(255,255,255,0.2); }
.song-item.selected {
    background: rgba(255, 102, 170, 0.2);
    border-color: #ff66aa;
    color: #ff66aa;
    font-weight: bold;
}

.diff-buttons {
    display: flex;
    gap: 10px;
}

.diff-btn {
    flex: 1;
    background: rgba(255,255,255,0.1);
    color: white;
}
.diff-btn:hover { background: rgba(255,255,255,0.2); }
.diff-btn.selected[data-diff="easy"] { background: #4caf50; color: white;}
.diff-btn.selected[data-diff="med"] { background: #ff9800; color: white;}
.diff-btn.selected[data-diff="hard"] { background: #f44336; color: white;}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.primary-btn {
    flex: 2;
    background: #ff66aa;
    color: white;
    font-size: 1.5rem;
}
.primary-btn:hover { background: #ff88cc; }

.secondary-btn {
    flex: 1;
    background: #444;
    color: white;
}
.secondary-btn:hover { background: #666; }

/* Gameplay HUD */
#gameplay-hud {
    justify-content: space-between;
    padding: 20px;
    pointer-events: none;
}

.hud-top {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

#score-display {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    color: white;
    text-shadow: 2px 2px 0 #000;
}

#combo-display {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    color: #ff66aa;
    text-shadow: 2px 2px 0 #000;
}

#quit-btn {
    align-self: flex-end;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 1rem;
    padding: 10px 20px;
    pointer-events: auto;
}
#quit-btn:hover { background: rgba(255,0,0,0.8); }
