/* ═══════════════════════════════════════════════════
   CRAZY CHASE CLICKS — Design System
   ═══════════════════════════════════════════════════ */

:root {
    --bg-dark: #0a0a1a;
    --bg-gradient: linear-gradient(135deg, #0a0a2e 0%, #1a0a3e 30%, #0a1a3e 60%, #0a0a2e 100%);
    --accent-pink: #ff6bb5;
    --accent-cyan: #00e5ff;
    --accent-yellow: #ffe066;
    --accent-green: #66ff99;
    --accent-purple: #b366ff;
    --accent-orange: #ff9a3c;
    --text-white: #f0f0ff;
    --font-main: 'Fredoka', 'Segoe UI', sans-serif;
    --road-grey: #3a3a4a;
    --road-line: #f0e060;
    --grass-green: #2d8a4e;
    --sky-top: #1a0a3e;
    --sky-bottom: #4a2a7e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-white);
    cursor: none;
}

/* ═══ SPLASH SCREEN ═══ */

#splash-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

#splash-screen.hiding {
    opacity: 0;
    transform: scale(1.1);
    pointer-events: none;
}

.splash-content {
    text-align: center;
    animation: splash-float 3s ease-in-out infinite;
}

.splash-emoji {
    font-size: clamp(80px, 15vw, 160px);
    animation: splash-bounce 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(255, 107, 181, 0.5));
}

.splash-icon {
    animation: splash-bounce 1.5s ease-in-out infinite;
}

.splash-icon-img {
    width: clamp(100px, 18vw, 200px);
    height: auto;
    border-radius: 24px;
    filter: drop-shadow(0 0 30px rgba(255, 107, 181, 0.5));
}

.splash-content h1 {
    font-size: clamp(40px, 8vw, 90px);
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-cyan), var(--accent-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 20px 0 10px;
    text-shadow: none;
    filter: drop-shadow(0 4px 20px rgba(0, 229, 255, 0.3));
}

.splash-content p {
    font-size: clamp(16px, 3vw, 28px);
    color: rgba(240, 240, 255, 0.7);
    margin-bottom: 8px;
}

.splash-sub {
    font-size: clamp(12px, 2vw, 20px) !important;
    color: rgba(240, 240, 255, 0.5) !important;
}

.red-btn {
    color: #ff4444;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

@keyframes splash-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes splash-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ═══ GAME MODES ═══ */

.game-mode {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

.game-mode.hidden {
    display: none;
}

.game-mode canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ═══ EMOJI MODE ═══ */

#emoji-mode {
    background: var(--bg-gradient);
}

#emoji-canvas {
    position: absolute;
    inset: 0;
}

#emoji-display {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.floating-emoji {
    position: absolute;
    font-size: 60px;
    animation: emoji-pop 2.5s ease-out forwards;
    pointer-events: none;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));
    z-index: 10;
}

@keyframes emoji-pop {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    15% {
        opacity: 1;
        transform: scale(1.3) rotate(10deg);
    }
    30% {
        transform: scale(1) rotate(-5deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-200px) rotate(720deg);
    }
}

.floating-image {
    position: absolute;
    animation: image-pop 3.5s ease-out forwards;
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(0 0 20px rgba(255, 224, 102, 0.6)) drop-shadow(0 0 40px rgba(255, 107, 181, 0.3));
    border-radius: 12px;
    transform-origin: center center;
}

@keyframes image-pop {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-15deg);
    }
    10% {
        opacity: 1;
        transform: scale(1.2) rotate(5deg);
    }
    20% {
        transform: scale(1) rotate(-3deg);
    }
    60% {
        opacity: 1;
        transform: scale(1) translateY(-60px) rotate(3deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.7) translateY(-250px) rotate(-10deg);
    }
}

#key-label {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(40px, 8vw, 100px);
    font-weight: 700;
    color: var(--text-white);
    text-shadow: 0 0 30px var(--accent-cyan), 0 0 60px var(--accent-purple);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 20;
}

#key-label.show {
    opacity: 1;
    animation: key-flash 0.6s ease-out;
}

@keyframes key-flash {
    0% { transform: translateX(-50%) scale(2); opacity: 0; }
    20% { transform: translateX(-50%) scale(1.1); opacity: 1; }
    100% { transform: translateX(-50%) scale(1); opacity: 0.7; }
}

/* ═══ SONG BANNER ═══ */

#song-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(16px, 3vw, 28px);
    font-weight: 600;
    color: var(--text-white);
    background: linear-gradient(135deg, rgba(26, 10, 62, 0.85), rgba(42, 26, 78, 0.85));
    border: 2px solid rgba(179, 102, 255, 0.4);
    padding: 10px 28px;
    border-radius: 50px;
    pointer-events: none;
    z-index: 25;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(179, 102, 255, 0.2);
    white-space: nowrap;
}

#song-banner.show {
    opacity: 1;
}

/* ═══ Background particles for emoji mode canvas ═══ */

.particle-ring {
    position: absolute;
    border-radius: 50%;
    border: 3px solid;
    opacity: 0;
    animation: ring-burst 1s ease-out forwards;
    pointer-events: none;
}

@keyframes ring-burst {
    0% { transform: scale(0); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}

/* ═══ DRIVE MODE ═══ */

#drive-mode {
    background: #111;
}

#drive-canvas {
    position: absolute;
    inset: 0;
}

#speedometer {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: clamp(80px, 12vw, 140px);
    height: clamp(80px, 12vw, 140px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 20, 40, 0.9), rgba(10, 10, 30, 0.95));
    border: 4px solid var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3), inset 0 0 20px rgba(0, 229, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(10px);
}

#speed-value {
    font-size: clamp(24px, 5vw, 48px);
    font-weight: 700;
    color: var(--accent-cyan);
    text-shadow: 0 0 10px var(--accent-cyan);
    line-height: 1;
}

#speed-label {
    font-size: clamp(10px, 2vw, 16px);
    color: rgba(0, 229, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* ═══ CALIBRATION ═══ */

#calibration-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

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

.calibration-box {
    background: linear-gradient(135deg, #1a1a3e, #2a1a4e);
    border: 2px solid var(--accent-purple);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 0 40px rgba(179, 102, 255, 0.2);
}

.calibration-box h2 {
    font-size: 28px;
    margin-bottom: 16px;
}

.calibration-box p {
    color: rgba(240, 240, 255, 0.7);
    margin-bottom: 20px;
}

#calibration-axes {
    font-family: monospace;
    font-size: 14px;
    text-align: left;
    background: rgba(0, 0, 0, 0.4);
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
}

#calibration-done {
    padding: 12px 40px;
    font-size: 18px;
    font-family: var(--font-main);
    font-weight: 600;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#calibration-done:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 107, 181, 0.4);
}

/* ═══ SCREEN FLASH EFFECT ═══ */

.screen-flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    animation: flash-fade 0.4s ease-out forwards;
}

@keyframes flash-fade {
    0% { opacity: 0.3; }
    100% { opacity: 0; }
}

/* ═══ CUSTOM CURSOR for emoji mode ═══ */

.custom-cursor {
    position: fixed;
    width: 50px;
    height: 50px;
    font-size: 40px;
    pointer-events: none;
    z-index: 100;
    transform: translate(-50%, -50%);
    transition: none;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

/* ═══ HAMBURGER MENU ═══ */

#hamburger-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    font-size: 26px;
    line-height: 44px;
    text-align: center;
    background: rgba(26, 10, 62, 0.7);
    border: 2px solid rgba(179, 102, 255, 0.4);
    border-radius: 12px;
    color: rgba(240, 240, 255, 0.8);
    cursor: pointer;
    z-index: 500;
    backdrop-filter: blur(10px);
    transition: transform 0.2s, background 0.2s;
    user-select: none;
}

#hamburger-btn:hover {
    background: rgba(42, 20, 82, 0.9);
    transform: scale(1.1);
}

#hamburger-menu {
    position: fixed;
    top: 70px;
    right: 15px;
    width: 260px;
    background: linear-gradient(135deg, rgba(26, 10, 62, 0.95), rgba(42, 26, 78, 0.95));
    border: 2px solid rgba(179, 102, 255, 0.4);
    border-radius: 16px;
    padding: 16px;
    z-index: 500;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(179, 102, 255, 0.15);
    animation: menu-slide-in 0.2s ease-out;
}

#hamburger-menu.hidden {
    display: none;
}

@keyframes menu-slide-in {
    0% { opacity: 0; transform: translateY(-10px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.menu-header {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-white);
    text-align: center;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    margin-bottom: 6px;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, transform 0.15s;
}

.menu-item:hover {
    background: rgba(179, 102, 255, 0.25);
    transform: translateX(4px);
}

.menu-item:active {
    transform: scale(0.97);
}

.menu-divider {
    height: 1px;
    background: rgba(179, 102, 255, 0.3);
    margin: 10px 0;
}

.menu-info {
    font-size: 12px;
    color: rgba(240, 240, 255, 0.5);
    padding: 4px 8px;
    line-height: 1.4;
    word-break: break-word;
}

/* ═══ YOKE DEBUG PANEL ═══ */

#yoke-debug {
    position: fixed;
    bottom: 15px;
    left: 15px;
    width: 340px;
    max-height: 70vh;
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(10, 10, 30, 0.95), rgba(26, 10, 62, 0.95));
    border: 2px solid rgba(0, 229, 255, 0.4);
    border-radius: 16px;
    padding: 16px;
    z-index: 600;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 229, 255, 0.1);
    font-family: var(--font-main);
    font-size: 14px;
    color: var(--text-white);
    animation: menu-slide-in 0.2s ease-out;
}

#yoke-debug::-webkit-scrollbar {
    width: 6px;
}

#yoke-debug::-webkit-scrollbar-track {
    background: transparent;
}

#yoke-debug::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.3);
    border-radius: 3px;
}
