:root {
    --p1-blue: #00F0FF;
    --p2-pink: #FF007F;
    --neon-yellow: #FFCC00;
    --neon-green: #00FF66;
    --neon-purple: #B000FF;
    --background-dark: #02040A;
    --glass-background: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    height: 100vh;
    width: 100vw;
    font-family: 'Fredoka', sans-serif;
    background-color: var(--background-dark);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: none; /* Hide standard cursor for the custom neon cursor */
}

/* Custom Cyber Cursor */
#custom-cursor {
    position: fixed;
    width: 28px;
    height: 28px;
    border: 3px solid var(--p1-blue);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 12px var(--p1-blue), inset 0 0 6px rgba(0, 240, 255, 0.3);
    display: none;
    transition: width 0.1s, height 0.1s;
}
#custom-cursor::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--p1-blue);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px var(--p1-blue);
}

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

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Glassmorphism Overlays */
#start-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(13, 2, 33, 0.9) 0%, rgba(6, 14, 36, 0.95) 100%);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-panel {
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 255, 255, 0.02);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90%;
    width: 600px;
}

.start-title {
    color: #fff;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    font-weight: 900;
    text-shadow: 0 0 30px var(--p1-blue), 0 0 60px rgba(0, 240, 255, 0.4);
    margin-bottom: 5px;
}

.start-subtitle {
    color: var(--neon-yellow);
    font-size: 1.1rem;
    text-shadow: 0 0 15px var(--neon-yellow);
    margin-bottom: 35px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 700;
}

.mode-container {
    display: flex;
    gap: 30px;
    width: 100%;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.mode-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px;
}

.player-badge {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 4px 16px;
    border-radius: 20px;
    border: 2px solid #fff;
    text-transform: uppercase;
}

.p1-badge {
    border-color: var(--p1-blue);
    color: var(--p1-blue);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.p2-badge {
    border-color: var(--p2-pink);
    color: var(--p2-pink);
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.3);
}

.mode-btn {
    width: 100%;
    padding: 20px;
    font-size: 1.5rem;
    font-family: 'Fredoka', sans-serif;
    font-weight: 900;
    border: none;
    border-radius: 50px;
    cursor: none; /* Let them use mouse, but we show custom cursor */
    transition: transform 0.15s, box-shadow 0.15s;
}

#btn-1p {
    background: var(--p1-blue);
    color: #000;
    box-shadow: 0 0 25px var(--p1-blue);
}

#btn-2p {
    background: var(--p2-pink);
    color: #fff;
    box-shadow: 0 0 25px var(--p2-pink);
}

.mode-btn:hover {
    transform: scale(1.05) translateY(-2px);
}

#btn-1p:hover {
    box-shadow: 0 0 40px var(--p1-blue);
}

#btn-2p:hover {
    box-shadow: 0 0 40px var(--p2-pink);
}

.key-hint {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.key-chip {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 1px 6px;
    font-weight: bold;
    font-size: 0.85rem;
    margin: 0 2px;
}

.controls-info {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.95rem;
    line-height: 1.7;
}

.controls-info strong {
    color: #fff;
}

/* HUD Overlay */
#hud-overlay {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    padding: 0 30px;
    pointer-events: none;
    z-index: 100;
}

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

.score-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(8px);
    border: 1.5px solid var(--glass-border);
    border-radius: 18px;
    padding: 12px 24px;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

#p1-hud {
    border-color: rgba(0, 240, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.1);
}

#p2-hud {
    border-color: rgba(255, 0, 127, 0.3);
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.1);
}

.player-label {
    font-size: 0.85rem;
    color: #fff;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: bold;
    opacity: 0.8;
}

.score-num {
    font-size: 2.2rem;
    font-weight: 900;
    margin: 4px 0;
    text-shadow: 0 0 10px currentColor;
}

#p1-score {
    color: var(--p1-blue);
}

#p2-score {
    color: var(--p2-pink);
}

.combo-badge {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--neon-yellow);
    text-shadow: 0 0 6px var(--neon-yellow);
    background: rgba(255, 204, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 204, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.combo-visible {
    opacity: 1 !important;
}

.level-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 204, 0, 0.3);
    border-radius: 20px;
    padding: 10px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 204, 0, 0.15);
}

#level-badge {
    font-size: 0.9rem;
    font-weight: 900;
    color: var(--neon-yellow);
    letter-spacing: 2px;
}

#level-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
    margin: 4px 0 8px 0;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    text-align: center;
}

#timer-sec {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green);
}

/* Action/Transition Overlays */
.alert-banner {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 25px var(--p2-pink), 0 0 50px var(--p2-pink);
    text-align: center;
    z-index: 150;
    pointer-events: none;
    animation: alertPulse 1s infinite alternate;
}

@keyframes alertPulse {
    from { transform: translate(-50%, -50%) scale(0.95); opacity: 0.85; }
    to { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
}

.countdown-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(8rem, 15vw, 15rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 45px var(--p1-blue);
    z-index: 150;
    pointer-events: none;
}

/* Mobile Controls Overlay */
#mobile-controls {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 200;
}

.mobile-group-left, .mobile-group-right {
    display: flex;
    gap: 20px;
}

.control-button {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 1.8rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    outline: none;
    transition: background 0.1s, transform 0.1s, border-color 0.1s;
}

.control-button:active {
    transform: scale(0.9);
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--p1-blue);
    box-shadow: 0 0 15px var(--p1-blue);
}

.jump-button {
    border-color: var(--neon-yellow);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.2);
    font-size: 0.95rem;
    text-transform: uppercase;
    width: 85px;
    border-radius: 24px;
}
.jump-button:active {
    background: rgba(255, 204, 0, 0.25);
    border-color: var(--neon-yellow);
    box-shadow: 0 0 20px var(--neon-yellow);
}

.climb-button {
    border-color: var(--neon-green);
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.2);
}
.climb-button:active {
    background: rgba(0, 255, 102, 0.25);
    border-color: var(--neon-green);
    box-shadow: 0 0 20px var(--neon-green);
}
