:root {
    --primary: #4f46e5;
    --secondary: #818cf8;
    --accent: #c7d2fe;
    --text: #1f2937;
    --bg-light: #f9fafb;
    --bg-dark: #111827;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --glass: rgba(255, 255, 255, 0.25);
}

body {
    font-family: 'Vazir', sans-serif;
    background-color: var(--bg-light);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

body.dark {
    --text: #f9fafb;
    --bg-light: #111827;
    --bg-dark: #030712;
    --glass: rgba(0, 0, 0, 0.3);
    background-color: var(--bg-light);
    color: var(--text);
}

body.dark #userName {
    color: var(--bg-light); /* رنگ متن ورودی در حالت دارک */
}

.glass-container {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
}

.neomorphism {
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.1),
                -5px -5px 15px rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.05));
}

.option:hover {
    transform: translateY(-3px);
}

.option.correct {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--success);
}

.option.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--error);
}

.typing-animation:after {
    content: '|';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.5;
    animation: float 10s infinite ease-in-out;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-50px) translateX(50px);
    }
    50% {
        transform: translateY(-100px) translateX(0);
    }
    75% {
        transform: translateY(-50px) translateX(-50px);
    }
}

.progress-bar {
    height: 8px;
    background-color: var(--accent);
    border-radius: 4px;
    transition: width 0.5s;
}

.timer {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text);
    transition: color 0.3s;
}

.timer.warning {
    color: var(--warning);
}

.timer.danger {
    color: var(--error);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
}

.fade-in {
    animation: fadeIn 1s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 1s;
}

@keyframes slideIn {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.certificate {
    background-image: url('https://cdn.jsdelivr.net/gh/images/certificate-bg.jpg');
    background-size: cover;
    position: relative;
    border: 15px solid #f3f4f6;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 3rem;
}

.result-container {
    transition: transform 0.6s, opacity 0.6s;
}

.result-counter {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
    display: inline-block;
}

.chart-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

/* For PDF export optimization */
@media print {
    body {
        width: 100%;
        height: auto;
    }
    .container {
        width: 100% !important;
        max-width: none !important;
    }
    .no-print {
        display: none;
    }
}

.trophy {
    font-size: 5rem;
    color: gold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

@keyframes move-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.particle.pulse {
    animation-name: float, pulse; /* ترکیب انیمیشن قبلی با پالس */
    animation-duration: 10s, 5s;
    animation-iteration-count: infinite;
    animation-direction: ease-in-out, alternate;
}

.particle.gradient {
    background: linear-gradient(45deg, #f3ec78, #af4261, #ffeb3b);
    background-size: 200% 200%;
    animation: float, move-gradient;
    animation-duration: 15s, 10s;
    animation-iteration-count: infinite;
    animation-direction: ease-in-out, alternate;
    opacity: 0.7;
}

/* انیمیشن محو شدن و بزرگنمایی */
@keyframes fadeScaleIn {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

.fade-scale-in {
    animation: fadeScaleIn 0.5s ease-out;
}

/* انیمیشن چرخش و ورود از کنار */
@keyframes rotateSlideIn {
    0% { opacity: 0; transform: translateX(-50px) rotate(-30deg); }
    100% { opacity: 1; transform: translateX(0) rotate(0deg); }
}

.rotate-slide-in {
    animation: rotateSlideIn 0.7s ease-out;
}

/* انیمیشن پرش */
@keyframes jump {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.jump-animation {
    animation: jump 0.6s infinite alternate;
}

/* استایل برای ذرات با انیمیشن‌های جدید */
.particle.bubble {
    background-color: rgba(79, 70, 229, 0.7); /* بنفش با شفافیت */
    animation: float 8s infinite ease-in-out, bubble 4s infinite alternate;
}

@keyframes bubble {
    0% { transform: scale(1); }
    100% { transform: scale(1.2); }
}

.particle.star {
    background-color: gold;
    opacity: 0.8;
    animation: twinkle 5s infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.1); }
}
#particleSelector {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--bg-light);
    color: var(--text);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23718096" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 1rem top 50%;
    background-size: 1rem;
}

#particleSelector:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
}

body.dark #particleSelector {
    background-color: var(--bg-dark);
    color: var(--text);
    border-color: var(--gray-600); /* یک رنگ خاکستری تیره برای بوردر در حالت دارک */
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23cbd5e0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>'); /* تغییر رنگ آیکون در حالت دارک */
}
#particles-js {
    position: fixed; /* تغییر از absolute به fixed */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}