:root {
    --bg-space: #05001a;
    --bg-gradient: linear-gradient(180deg, #05001a 0%, #0d0430 100%);
    --aura-cyan: #00fff7;
    --aura-purple: #b026ff;
    --neon-pink: #ff006e;
    --text-white: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    font-family: 'Orbitron', sans-serif;
    background: var(--bg-gradient);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    color: var(--text-white);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--bg-space);
}

.game-wrapper {
    position: relative;
    width: 100%;
    height: calc(100% - 60px); /* Leave space for banner */
    top: 60px; /* Push down */
}

/* UI Overlay */
.ui-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    pointer-events: none;
}

.score-container {
    display: inline-block;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 25px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: none;
    backdrop-filter: blur(10px);
}

.score-label {
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 3px;
}

.score-value {
    font-size: 42px;
    font-weight: 300;
    /* Thin weight for minimalism */
    color: var(--text-white);
    text-shadow: none;
    /* Remove glow for flat aesthetic */
    letter-spacing: 2px;
}

/* Game Over Screen */
.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}


.hidden {
    display: none !important;
}

.game-over.hidden {
    display: none;
}

.game-over-content {
    text-align: center;
    animation: slideIn 0.4s ease;
}

.game-over h1 {
    font-size: 72px;
    font-weight: 900;
    background: linear-gradient(90deg, var(--aura-cyan), var(--aura-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(0, 255, 247, 0.8);
}

.final-score {
    font-size: 24px;
    color: var(--text-white);
    margin-bottom: 30px;
}

.final-score span {
    color: var(--aura-cyan);
    font-weight: 900;
}

.hint {
    margin-top: 15px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

/* Leaderboard */
.leaderboard-container {
    margin: 20px auto;
    max-width: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-container h3 {
    font-size: 14px;
    letter-spacing: 4px;
    margin-bottom: 15px;
    color: var(--aura-cyan);
}

.leaderboard-list {
    text-align: left;
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px;
}

.leaderboard-list::-webkit-scrollbar {
    width: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item .rank {
    color: var(--aura-purple);
    width: 25px;
    font-weight: bold;
}

.leaderboard-item .name {
    flex-grow: 1;
    color: rgba(255, 255, 255, 0.8);
}

.leaderboard-item .score {
    color: var(--aura-cyan);
}

.player-rank-info {
    font-size: 14px;
    color: var(--neon-pink);
    margin-top: 10px;
    font-weight: bold;
}

/* Start Screen */
.start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
}

.start-screen.hidden {
    display: none;
}

.start-content {
    text-align: center;
}

.game-title {
    font-size: 96px;
    font-weight: 900;
    color: var(--text-white);
    margin-bottom: 10px;
    animation: none;
    /* Remove pulse for cleaner look */
    letter-spacing: 8px;
}

.game-subtitle {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 40px;
    letter-spacing: 4px;
}

.controls-info {
    margin-top: 30px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.5);
}

/* Name Input */
.name-input-container {
    margin-bottom: 30px;
}

#playerNameInput {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 12px 20px;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    text-align: center;
    outline: none;
    transition: all 0.3s;
    width: 250px;
    letter-spacing: 2px;
}

#playerNameInput:focus {
    border-color: var(--aura-cyan);
    background: rgba(0, 255, 247, 0.05);
    box-shadow: 0 0 15px rgba(0, 255, 247, 0.2);
}

/* Tutorial Bubble */
.tutorial-bubble {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -150%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 15px;
    width: 320px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: float 3s ease-in-out infinite;
}

.tutorial-bubble.hidden {
    display: none;
}

.bubble-content p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.9);
}

.bubble-content span {
    color: var(--aura-cyan);
    font-weight: bold;
}

#closeTutorial {
    background: var(--aura-cyan);
    color: var(--bg-space);
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
    letter-spacing: 1px;
}

@keyframes float {

    0%,
    100% {
        transform: translate(-50%, -150%);
    }

    50% {
        transform: translate(-50%, -160%);
    }
}

/* Buttons */
.btn-fullscreen {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    font-size: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
    z-index: 100;
}

.btn-fullscreen:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.btn-restart,
.btn-start {
    padding: 16px 45px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    color: var(--bg-space);
    background: var(--text-white);
    border: none;
    border-radius: 4px;
    /* Sharp corners for geometric feel */
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: none;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.btn-restart:hover,
.btn-start:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.9);
}

.btn-restart:active,
.btn-start:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.8);
}

.btn-watch-ad {
    padding: 16px 35px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-white);
    background: linear-gradient(135deg, #ff006e, #b026ff);
    border: 2px solid var(--text-white);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 20px rgba(176, 38, 255, 0.5);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

.btn-watch-ad:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(176, 38, 255, 0.8);
}

.btn-watch-ad:active {
    transform: scale(0.95);
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(176, 38, 255, 0.5);
    }

    50% {
        box-shadow: 0 0 35px rgba(176, 38, 255, 0.8);
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        filter: drop-shadow(0 0 20px rgba(0, 255, 247, 0.8));
    }

    50% {
        filter: drop-shadow(0 0 40px rgba(176, 38, 255, 0.8));
    }
}

/* Ad Overlay */
.ad-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.ad-content {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, rgba(176, 38, 255, 0.2), rgba(255, 0, 110, 0.2));
    border: 2px solid var(--aura-purple);
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(176, 38, 255, 0.6);
}

.ad-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--aura-cyan);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.ad-content h2 {
    font-size: 24px;
    color: var(--text-white);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.ad-timer {
    font-size: 48px;
    color: var(--aura-cyan);
    font-weight: 900;
    margin-top: 20px;
}