/* Custom Styles */
body {
    font-family: 'Inter', sans-serif;
}

/* --- Dark Mode Background Pattern (Always Active) --- */
body {
    background-color: #0d1117 !important;
    /* Subtle neon grid pattern for cyber look */
    background-image: linear-gradient(0deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px), 
                      linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* --- Keyframe Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}
@keyframes fadeOutUp {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}
@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.03); }
    100% { transform: scale(1); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-6px); }
    50%      { transform: translateX(6px); }
    75%      { transform: translateX(-6px); }
}
@keyframes electricFlicker {
    0%, 100% {
        text-shadow: 0 0 5px #22d3ee, 0 0 10px #22d3ee, 0 0 20px #06b6d4, 0 0 40px #06b6d4;
        color: #93f0ff;
    }
    50% {
        text-shadow: 0 0 3px #22d3ee, 0 0 7px #22d3ee, 0 0 15px #06b6d4, 0 0 30px #06b6d4;
        color: #67e8f9;
    }
}
@keyframes electricBoxFlicker {
    0%, 100% {
        box-shadow: 0 0 8px rgba(34, 211, 238, 0.7), 0 0 15px rgba(6, 182, 212, 0.5), inset 0 0 5px rgba(34, 211, 238, 0.5);
    }
    50% {
        box-shadow: 0 0 5px rgba(34, 211, 238, 0.5), 0 0 10px rgba(6, 182, 212, 0.3), inset 0 0 3px rgba(34, 211, 238, 0.3);
    }
}
@keyframes ripple {
    0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.5); }
    100% { box-shadow: 0 0 0 15px rgba(34, 211, 238, 0); }
}
@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}
@keyframes scorePop {
    0% { transform: scale(1); color: inherit; }
    50% { transform: scale(1.2); color: #facc15; }
    100% { transform: scale(1); color: inherit; }
}
@keyframes modalScaleIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}


/* --- Animation Utility Classes --- */
.animate-fadeInUp { animation: fadeInUp 0.5s ease-out; animation-fill-mode: forwards; }
.animate-fadeIn { animation: fadeIn 0.3s ease-in; }
.animate-fadeOut { animation: fadeOut 0.3s ease-out; }
.animate-fadeOutUp { animation: fadeOutUp 0.3s ease-out forwards; }
.modal-fade-in { animation: fadeIn 0.3s ease-out; }
.shake { animation: shake 0.4s ease-in-out; }
.pulse { animation: pulse 0.5s ease-in-out; }
.animate-bounce-in { animation: bounceIn 0.5s ease-out; }
.animate-score-pop { animation: scorePop 0.2s ease-out; }
.animate-results-modal { animation: modalScaleIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }

/* NEW: Loader Styles */
.loader {
    width: 50px;
    height: 50px;
    border: 5px solid #22d3ee;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}
@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* NEW: Ripple Effect Class */
.ripple-active {
    animation: ripple 0.5s ease-out;
}


/* --- Accessibility (Keyboard Focus) --- */
/* Add neon glow effect for all focusable elements */
*:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.5) !important; /* cyan-400 */
    transition: box-shadow 0.15s ease-in-out;
}
.interactive-btn:focus,
.option-btn:focus {
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.5) !important;
}


/* --- Neon & Button Styles (Always Dark) --- */
.interactive-btn {
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.interactive-btn:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease-out;
}
.interactive-btn:hover:not(:disabled) {
    box-shadow: 0 5px 15px rgba(34, 211, 238, 0.2);
}
.interactive-btn:active {
    transform: scale(0.97);
}


h1.neon-text {
    color: #93f0ff;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    background-color: rgba(13, 17, 23, 0.8);
    border: 1px solid rgba(34, 211, 238, 0.3);
    text-shadow: 0 0 5px #22d3ee, 0 0 10px #22d3ee, 0 0 20px #06b6d4, 0 0 40px #06b6d4;
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.7), 0 0 15px rgba(6, 182, 212, 0.5), inset 0 0 5px rgba(34, 211, 238, 0.5);
    animation: electricFlicker 3s infinite alternate, electricBoxFlicker 3s infinite alternate;
}

.neon-text {
    color: #67e8f9;
    animation: electricFlicker 3s infinite alternate;
}

.neon-shadow {
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.5), 0 0 15px rgba(6, 182, 212, 0.3);
    transition: box-shadow 0.3s ease;
}
.neon-shadow-hard {
    box-shadow: 0 0 8px #22d3ee, 
                0 0 15px #22d3ee;
}
.neon-shadow-hard:hover {
    box-shadow: 0 0 12px #22d3ee, 
                0 0 25px #22d3ee;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #1f2937; }
::-webkit-scrollbar-thumb { background: #0e7490; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #22d3ee; }

/* --- Code Block Styling (Syntax Highlighting) --- */
pre[id="code-display"] {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    background-color: #011627;
    color: #d6deeb;
    border: 1px solid #374151;
}

/* Syntax Highlighting Colors */
.python-code .keyword { color: #f92672; }
.python-code .builtin { color: #66d9ef; }
.python-code .string { color: #e6db74; }
.python-code .comment { color: #75715e; }
.python-code .operator { color: #fd971f; }
.python-code .number { color: #ae81ff; }

/* Option Button Styling (Always Dark) */
.option-btn {
    font-family: 'Fira Code', monospace;
    transition: all 0.2s ease-in-out;
    opacity: 0; 
    background-color: #4b5563; 
    border: 2px solid #374151;
}
.option-btn:hover:not(:disabled) {
    border-color: #22d3ee;
    background-color: #374151;
}

.option-btn.correct {
    background-color: #22c55e !important;
    color: #ffffff !important;
    border-color: #22c55e !important;
}
.option-btn.incorrect {
    background-color: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
}
#next-btn {
    display: none;
}