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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    overflow: hidden;
    height: 100vh;
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
}

canvas {
    display: block;
    cursor: crosshair;
}

#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    color: white;
    font-size: 18px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#timer {
    background: rgba(220, 20, 60, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: bold;
    border: 2px solid #ff6b6b;
}

#score {
    background: rgba(50, 205, 50, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: bold;
    border: 2px solid #90ee90;
}

#instructions {
    background: rgba(70, 130, 180, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    max-width: 400px;
    font-size: 14px;
    border: 2px solid #87ceeb;
}

#gameOverScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#gameOverContent {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 3px solid #fff;
}

#gameOverTitle {
    font-size: 36px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#gameOverMessage {
    font-size: 18px;
    margin-bottom: 30px;
}

#restartButton {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
}

#restartButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.hidden {
    display: none !important;
}

/* Loading animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s infinite;
}

/* Cutscene overlay */
#cutsceneOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

#cutsceneOverlay video {
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover; /* fill screen; use 'contain' if you prefer full frame without crop */
    display: block;
    background: black;
}

#cutsceneControls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 1;
}

#cutsceneControls button {
    background: linear-gradient(45deg, #6a5acd, #8a2be2);
    color: #fff;
    border: none;
    padding: 10px 16px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#cutsceneControls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(138,43,226,0.35);
}

/* Loader */
.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #fff;
    z-index: 1;
}

.spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    animation: spin 1s linear infinite;
}

.loaderText {
    margin-top: 12px;
    font-size: 14px;
    opacity: 0.9;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Splash overlay */
#splashOverlay {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250; /* below cutscene overlay, above game */
}

#splashOverlay #splashImage {
    position: absolute;
    inset: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover; /* fill screen; may crop */
    display: block;
    filter: brightness(0.92);
}

#startGameBtn.primary {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 12vh; /* lower half of the screen */
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 20px 36px;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, #ffcc33 0%, #ff7b00 35%, #ff3d3d 100%);
    border: 3px solid rgba(255,255,255,0.85);
    border-radius: 999px;
    cursor: pointer;
    text-shadow: 0 2px 0 rgba(0,0,0,0.25);
    box-shadow: 0 12px 24px rgba(255, 61, 61, 0.4), 0 0 22px rgba(255, 180, 0, 0.45) inset;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    animation: ctaPulse 2s ease-in-out infinite;
}

#startGameBtn.primary::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 16px solid #ffffff;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    filter: drop-shadow(0 2px 0 rgba(0,0,0,0.25));
}

#startGameBtn.primary:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 16px 32px rgba(255, 61, 61, 0.5), 0 0 26px rgba(255, 200, 0, 0.55) inset;
    filter: brightness(1.05);
}

@keyframes ctaPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.06); }
}
