:root {
    --primary: rgb(162, 76, 255);
    --primary-border: rgb(0, 0, 0);
    --secondary: rgb(255, 125, 0);
    --akzent: rgb(255, 200, 0);
    --body-bg-color: #0B1020;
    --text-color: white;
    --text-grey: grey;
    --card-bg: rgba(30, 35, 55, 0.4);
    --card-border: 1px solid rgba(255, 255, 255, 0.1);
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--body-bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 60%, 25%, 0.4) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(280, 70%, 30%, 0.5) 0px, transparent 50%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#game-container.game-active {
    cursor: none;
}

/* Laserpointer (roter Punkt) */
#laser {
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at center, #ff0000, #ff3333, #ff0000);
    border-radius: 50%;
    position: absolute;
    pointer-events: none;
    box-shadow:
        0 0 10px #ff0000,
        0 0 20px #ff0000,
        0 0 30px #ff3333,
        0 0 40px #ff6666;
    transform: translate(-50%, -50%);
    z-index: 100;
}

/* Kurt (der Kater) */
#kurt {
    width: 120px;
    height: 120px;
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 50;
}

#kurt img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: auto;
}

#kurt img.hidden {
    display: none;
}

/* Score Anzeige */
#score-display {
    position: absolute;
    top: 20px;
    left: 20px;
    color: var(--text-color);
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    z-index: 200;
    background: var(--card-bg);
    border: var(--card-border);
    padding: 10px 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

#score-display span {
    color: var(--secondary);
}

/* Geschwindigkeitsanzeige */
#speed-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    color: var(--text-color);
    font-size: 16px;
    z-index: 200;
    background: var(--card-bg);
    border: var(--card-border);
    padding: 10px 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

#speed-indicator span {
    color: var(--akzent);
}

/* Game Over Overlay */
#game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 16, 32, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 500;
    cursor: auto;
}

#game-over.active {
    display: flex;
}

#game-over h1 {
    color: var(--secondary);
    font-size: clamp(24px, 6vw, 48px);
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 20px var(--secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

#game-over .score-final {
    color: var(--text-color);
    font-size: clamp(18px, 4vw, 32px);
    margin-bottom: 30px;
}

#game-over .score-final span {
    color: var(--akzent);
    font-weight: bold;
}

#restart-btn {
    padding: 15px 40px;
    font-size: clamp(16px, 3vw, 24px);
    background: linear-gradient(135deg, var(--primary), rgb(190, 120, 255));
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(162, 76, 255, 0.4);
}

#restart-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(162, 76, 255, 0.6);
}

#restart-btn:active {
    transform: scale(0.95);
}

/* Start Screen */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 16, 32, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 600;
    cursor: auto;
}

#start-screen.hidden {
    display: none;
}

#start-screen h1 {
    color: var(--primary);
    font-size: clamp(28px, 7vw, 56px);
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 20px var(--primary);
}

#start-screen .instructions {
    color: var(--text-grey);
    font-size: clamp(14px, 2.5vw, 18px);
    text-align: center;
    max-width: 80%;
    margin-bottom: 30px;
    line-height: 1.6;
}

#start-btn {
    padding: 20px 50px;
    font-size: clamp(18px, 4vw, 28px);
    background: linear-gradient(135deg, var(--secondary), rgb(255, 160, 50));
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(255, 125, 0, 0.4);
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

#start-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(255, 125, 0, 0.6);
    animation: none;
}

/* Speed Up Warnung */
#speed-warning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--akzent);
    font-size: clamp(24px, 5vw, 40px);
    font-weight: bold;
    text-shadow: 0 0 20px var(--akzent);
    opacity: 0;
    z-index: 300;
    pointer-events: none;
}

#speed-warning.show {
    animation: speedUp 1s ease-out forwards;
}

@keyframes speedUp {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

/* Hintergrund-Sterne */
.star {
    position: absolute;
    background: var(--primary);
    border-radius: 50%;
    pointer-events: none;
    animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

/* Home Button */
.home-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 30px;
    font-size: clamp(14px, 2.5vw, 18px);
    color: var(--text-grey);
    text-decoration: none;
    border: 2px solid var(--text-grey);
    border-radius: 50px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.home-btn:hover {
    color: var(--text-color);
    border-color: var(--primary);
    background: rgba(162, 76, 255, 0.2);
    transform: scale(1.05);
}

.home-btn:active {
    transform: scale(0.95);
}

/* ============ LEADERBOARD ============ */

/* Button on Start Screen */
.leaderboard-toggle-btn {
    margin-top: 10px;
    padding: 12px 30px;
    font-size: clamp(14px, 2.5vw, 18px);
    background: transparent;
    color: var(--akzent);
    border: 2px solid var(--akzent);
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.leaderboard-toggle-btn:hover {
    background: rgba(255, 200, 0, 0.15);
    transform: scale(1.05);
}

/* Full-screen overlay for start screen leaderboard */
#leaderboard-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 16, 32, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 700;
    backdrop-filter: blur(6px);
}

#leaderboard-overlay.hidden {
    display: none;
}

.leaderboard-panel {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: 16px;
    padding: 30px 40px;
    width: min(480px, 90vw);
    max-height: 80vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    backdrop-filter: blur(20px);
}

.leaderboard-panel h2 {
    color: var(--akzent);
    font-size: clamp(20px, 4vw, 28px);
    text-align: center;
    text-shadow: 0 0 15px var(--akzent);
    margin: 0;
}

#leaderboard-close-btn {
    padding: 10px 28px;
    font-size: 16px;
    background: transparent;
    color: var(--text-grey);
    border: 2px solid var(--text-grey);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: center;
}

#leaderboard-close-btn:hover {
    color: var(--text-color);
    border-color: var(--primary);
    background: rgba(162, 76, 255, 0.15);
}

/* Leaderboard section inside Game Over */
.leaderboard-section {
    width: min(420px, 90vw);
    margin: 10px 0 20px;
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: 12px;
    padding: 16px 24px;
    backdrop-filter: blur(10px);
}

.leaderboard-title {
    color: var(--akzent);
    font-size: clamp(16px, 3vw, 20px);
    text-align: center;
    margin-bottom: 12px;
    text-shadow: 0 0 10px var(--akzent);
}

/* Shared list styles */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s;
}

.leaderboard-entry--me {
    background: rgba(162, 76, 255, 0.18);
    border-color: rgba(162, 76, 255, 0.4);
}

.lb-rank {
    font-size: 18px;
    min-width: 32px;
    text-align: center;
}

.lb-name {
    flex: 1;
    color: var(--text-color);
    font-size: clamp(14px, 2.5vw, 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-score {
    color: var(--secondary);
    font-weight: bold;
    font-size: clamp(14px, 2.5vw, 16px);
    white-space: nowrap;
}

.leaderboard-loading,
.leaderboard-empty {
    color: var(--text-grey);
    text-align: center;
    font-size: 14px;
    padding: 12px 0;
}