/* ===== ROOT VARIABLES ===== */
:root {
    --neon-blue: #00d4ff;
    --neon-purple: #b44fff;
    --neon-green: #00ff88;
    --neon-red: #ff3366;
    --neon-yellow: #ffdd00;
    --bg-dark: #050810;
    --bg-card: #0d1220;
    --bg-card2: #111827;
    --text-dim: #4a5568;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--bg-dark);
    color: #e2e8f0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    animation: bgFloat 8s ease-in-out infinite alternate;
}

.bg-glow-1 {
    background: rgba(0, 212, 255, 0.06);
    top: -200px;
    left: -200px;
}

.bg-glow-2 {
    background: rgba(180, 79, 255, 0.06);
    bottom: -200px;
    right: -200px;
    animation-delay: -4s;
}

@keyframes bgFloat {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(30px, 20px) scale(1.1); }
}

/* ===== SECTIONS ===== */
.section {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* ===== ORBITRON HEADINGS ===== */
.font-orbitron {
    font-family: 'Orbitron', monospace;
}

/* ===== NEON TEXT ===== */
.neon-blue { color: var(--neon-blue); }
.neon-purple { color: var(--neon-purple); }
.neon-green { color: var(--neon-green); }

.text-glow-blue {
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.8), 0 0 40px rgba(0, 212, 255, 0.4);
}

.text-glow-purple {
    text-shadow: 0 0 20px rgba(180, 79, 255, 0.8), 0 0 40px rgba(180, 79, 255, 0.4);
}

.text-glow-green {
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.8), 0 0 40px rgba(0, 255, 136, 0.4);
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: linear-gradient(135deg, #00a8cc, #0070ff);
    border: 1px solid rgba(0, 212, 255, 0.5);
    color: #fff;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 14px 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3), 0 4px 20px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    font-size: 14px;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 0 35px rgba(0, 212, 255, 0.6), 0 8px 30px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #00c8f0, #0088ff);
}

.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(180, 79, 255, 0.5);
    color: var(--neon-purple);
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    letter-spacing: 2px;
    padding: 12px 28px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 13px;
    text-transform: uppercase;
}

.btn-secondary:hover {
    background: rgba(180, 79, 255, 0.15);
    box-shadow: 0 0 25px rgba(180, 79, 255, 0.4);
    transform: translateY(-2px);
}

.btn-secondary:active { transform: scale(0.97); }

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 14px;
}

.btn-ghost:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

/* ===== MODE CARDS ===== */
.mode-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 28px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mode-card.card-blue::before {
    background: radial-gradient(circle at 50% 0%, rgba(0, 212, 255, 0.12), transparent 70%);
}

.mode-card.card-purple::before {
    background: radial-gradient(circle at 50% 0%, rgba(180, 79, 255, 0.12), transparent 70%);
}

.mode-card.card-green::before {
    background: radial-gradient(circle at 50% 0%, rgba(0, 255, 136, 0.12), transparent 70%);
}

.mode-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.2);
}

.mode-card:hover::before { opacity: 1; }

.mode-card.card-blue:hover { box-shadow: 0 0 30px rgba(0, 212, 255, 0.25), 0 16px 40px rgba(0, 0, 0, 0.5); }
.mode-card.card-purple:hover { box-shadow: 0 0 30px rgba(180, 79, 255, 0.25), 0 16px 40px rgba(0, 0, 0, 0.5); }
.mode-card.card-green:hover { box-shadow: 0 0 30px rgba(0, 255, 136, 0.25), 0 16px 40px rgba(0, 0, 0, 0.5); }

.mode-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 16px;
}

/* ===== CLASSIC MODE ===== */
#game-classic {
    min-height: 280px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#game-classic.state-idle {
    background: var(--bg-card2);
    border: 2px dashed rgba(255, 255, 255, 0.1);
}

#game-classic.state-wait {
    background: linear-gradient(135deg, #2d0a12, #4a0f1f);
    border: 2px solid var(--neon-red);
    box-shadow: inset 0 0 60px rgba(255, 51, 102, 0.2), 0 0 40px rgba(255, 51, 102, 0.3);
}

#game-classic.state-go {
    background: linear-gradient(135deg, #0a2d1a, #0f4a2a);
    border: 2px solid var(--neon-green);
    box-shadow: inset 0 0 60px rgba(0, 255, 136, 0.2), 0 0 40px rgba(0, 255, 136, 0.4);
    animation: pulseGreen 0.5s ease infinite alternate;
}

@keyframes pulseGreen {
    from { box-shadow: inset 0 0 60px rgba(0, 255, 136, 0.2), 0 0 40px rgba(0, 255, 136, 0.3); }
    to { box-shadow: inset 0 0 80px rgba(0, 255, 136, 0.3), 0 0 60px rgba(0, 255, 136, 0.5); }
}

#game-classic.state-early {
    background: linear-gradient(135deg, #2d1a00, #4a2a00);
    border: 2px solid var(--neon-yellow);
    box-shadow: inset 0 0 60px rgba(255, 221, 0, 0.15);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* ===== FALLING OBJECT ===== */
#falling-area {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: var(--bg-card2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 340px;
    cursor: pointer;
}

#falling-ball {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #00eeff, #0055cc);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.8), 0 0 40px rgba(0, 212, 255, 0.4);
    cursor: pointer;
    display: none;
    left: 50%;
    transform: translateX(-50%);
    -webkit-tap-highlight-color: transparent;
}

/* ===== RANDOM BUTTON MODE ===== */
#random-area {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: var(--bg-card2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 340px;
}

#random-btn {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #cc00ff, #7700cc);
    box-shadow: 0 0 25px rgba(180, 79, 255, 0.8);
    border: 2px solid rgba(220, 150, 255, 0.6);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    -webkit-tap-highlight-color: transparent;
    animation: btnPulse 0.6s ease infinite alternate;
}

@keyframes btnPulse {
    from { transform: scale(1); box-shadow: 0 0 25px rgba(180, 79, 255, 0.7); }
    to { transform: scale(1.08); box-shadow: 0 0 40px rgba(180, 79, 255, 1); }
}

/* ===== COUNTDOWN TIMER ===== */
.countdown-ring {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
}

.countdown-ring svg { transform: rotate(-90deg); }

.ring-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 6;
}

.ring-fill {
    fill: none;
    stroke: var(--neon-blue);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 220;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.1s linear, stroke 0.3s;
}

.ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-size: 20px;
    font-weight: 700;
}

/* ===== RESULT ===== */
.result-box {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 40px 32px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.result-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-blue), var(--neon-purple), transparent);
}

.result-time {
    font-family: 'Orbitron', monospace;
    font-size: clamp(48px, 12vw, 80px);
    font-weight: 900;
    line-height: 1;
}

.badge-excellent { color: var(--neon-green); }
.badge-good { color: var(--neon-blue); }
.badge-average { color: var(--neon-yellow); }
.badge-slow { color: var(--neon-red); }

.rating-bar-wrap {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
    margin: 12px 0;
}

.rating-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== FADE TRANSITIONS ===== */
.section { animation: fadeIn 0.4s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== PARTICLES ===== */
.particle {
    position: fixed;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
    animation: particleFly 0.8s ease-out forwards;
}

@keyframes particleFly {
    to { opacity: 0; transform: translateY(-60px) scale(0); }
}

/* ===== MISC ===== */
.badge-pill {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.divider-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.3); border-radius: 3px; }
