:root {
    --neon-purple: #8113f3;
    --neon-cyan: #00d2ff;
    --neon-pink: #f50057;
    --neon-red: #ff003c;
    --deep-black: #0a0a0c;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

.hidden {
    display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--deep-black);
    color: white;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#ui-layer {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

#score-board, #highscore-board {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

#score-label, #highscore-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    text-transform: uppercase;
}

#score-value, #highscore-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

#bottom-left-ui {
    position: absolute;
    bottom: 20px;
    left: 20px;
    pointer-events: none;
    z-index: 20;
}

#bottom-ui-layer {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    pointer-events: none;
    z-index: 10;
}

#boost-indicator, #jump-indicator, #weapon-indicator {
    width: 180px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--glass-border);
}

#boost-indicator {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
}

#jump-indicator {
    border-color: var(--neon-red);
    box-shadow: 0 0 15px rgba(255, 0, 60, 0.3);
}

#weapon-indicator {
    border-color: #fff01f;
    box-shadow: 0 0 15px rgba(255, 240, 31, 0.3);
    min-height: 54px;
    justify-content: center;
}

#boost-indicator.hidden, #jump-indicator.hidden, #weapon-indicator.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    display: flex !important;
    pointer-events: none;
}

#boost-label {
    font-size: 0.8rem;
}

#jump-label, #boost-label {
    font-size: 0.7rem;
    font-weight: bold;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

#boost-label { color: var(--neon-cyan); }
#jump-label { color: var(--neon-red); }

#boost-timer-bar, #jump-timer-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

#boost-timer-progress {
    width: 100%;
    height: 100%;
    background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
    transition: width 0.1s linear;
}

#jump-timer-progress {
    width: 100%;
    height: 100%;
    background: var(--neon-red);
    box-shadow: 0 0 10px var(--neon-red);
    transition: width 0.1s linear;
}

#health-container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

#health-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--neon-pink);
    text-transform: uppercase;
}

#health-bar {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    margin-top: 5px;
    overflow: hidden;
}

#health-progress {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--neon-pink), #ff4d4d);
    box-shadow: 0 0 10px var(--neon-pink);
    transition: width 0.3s ease;
}

#weapon-indicator.hidden {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
    display: flex !important;
}

#weapon-label {
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff01f;
    letter-spacing: 1px;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    text-align: center;
    transition: all 0.3s ease;
}

.overlay.hidden {
    display: none !important;
}

.logo {
    font-size: 4rem;
    margin-bottom: 20px;
    letter-spacing: 10px;
    color: white;
    text-shadow: 0 0 20px var(--neon-purple);
}

.logo span {
    color: var(--neon-cyan);
    text-shadow: 0 0 20px var(--neon-cyan);
}

.instruction {
    font-size: 1rem;
    color: #999;
    margin-bottom: 40px;
}

.gameover-title {
    font-size: 3rem;
    color: var(--neon-pink);
    text-shadow: 0 0 20px var(--neon-pink);
    margin-bottom: 20px;
}

#final-score-container {
    margin-bottom: 40px;
    line-height: 2;
}

#final-score-container span {
    font-weight: bold;
    color: var(--neon-cyan);
}

.neon-btn {
    background: transparent;
    border: 2px solid var(--neon-purple);
    color: white;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(129, 19, 243, 0.3);
}

.neon-btn:hover {
    background: var(--neon-purple);
    box-shadow: 0 0 30px var(--neon-purple);
    transform: scale(1.05);
}

.leaderboard-container {
    margin-bottom: 20px;
    width: 85%;
    max-width: 400px;
    background: var(--glass-bg);
    border-radius: 15px;
    padding: 12px 18px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
}

.leaderboard-list {
    max-height: 160px; /* Fits ~5 items on desktop */
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar styling */
.leaderboard-list::-webkit-scrollbar {
    width: 4px;
}
.leaderboard-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.02);
}
.leaderboard-list::-webkit-scrollbar-thumb {
    background: var(--neon-purple);
    border-radius: 2px;
}

/* Limit Start Screen to Top 5 (Deprecated: now using scroll for all) */
/* #start-screen .leaderboard-item:nth-child(n+6) { display: none; } */

.leaderboard-container h3 {
    font-size: 1rem;
    color: var(--neon-cyan);
    margin-bottom: 15px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    font-size: 0.85rem;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item .rank {
    color: var(--neon-purple);
    font-weight: bold;
    width: 40px;
    text-align: left;
}

.leaderboard-item .name {
    flex: 1;
    text-align: left;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ddd;
}

.leaderboard-item .score {
    color: var(--neon-cyan);
    font-weight: bold;
    min-width: 80px;
    text-align: right;
}

#player-name-input {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-purple);
    color: white;
    padding: 15px 25px;
    border-radius: 30px;
    margin: 25px 0;
    width: 90%;
    max-width: 350px;
    font-size: 1.2rem;
    text-align: center;
    outline: none;
    box-shadow: 0 0 15px rgba(129, 19, 243, 0.3);
    transition: all 0.3s ease;
}

#player-name-input:focus {
    box-shadow: 0 0 25px var(--neon-cyan);
    border-color: var(--neon-cyan);
}

/* Animations */
@keyframes glowPulse {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
    100% { filter: brightness(1); }
}
/* Orientation Warning */
#orientation-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--deep-black);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    text-align: center;
    padding: 20px;
}

.warning-content {
    animation: rotateHint 2s infinite ease-in-out;
}

.device-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

#orientation-warning h2 {
    color: var(--neon-cyan);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

#orientation-warning p {
    color: white;
    opacity: 0.8;
}

@keyframes rotateHint {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

/* Landscape restriction for mobile */
@media screen and (orientation: portrait) and (max-width: 900px) {
    #orientation-warning {
        display: flex;
    }
}

/* Ultra-compact adjustments for smaller screens */
@media screen and (max-width: 768px) {
    .logo { font-size: 1.6rem; margin-bottom: 5px; }
    .neon-btn { padding: 9px 20px; font-size: 0.8rem; margin-bottom: 12px; margin-top: 5px; }
    .leaderboard-container { scale: 0.85; margin: 0 auto 5px auto; padding: 8px 12px; }
    .leaderboard-container h3 { margin-bottom: 5px; font-size: 0.7rem; }
    .leaderboard-list { max-height: 100px; } /* Strictly 5 items at ~20px each */
    .leaderboard-item { padding: 2px 0; font-size: 0.8rem; }
    .instruction { font-size: 0.7rem; margin-top: 5px; opacity: 0.5; }
    .gameover-title { font-size: 2.2rem; margin-bottom: 10px; }
    #final-score-container { margin-bottom: 15px; font-size: 0.9rem; }
}
