/* Tutorial Lab Styles */
@property --lab-bg { syntax: '<color>'; inherits: true; initial-value: #0f172a; }
@property --lab-surface { syntax: '<color>'; inherits: true; initial-value: #1e293b; }
@property --lab-surface-hover { syntax: '<color>'; inherits: true; initial-value: #334155; }
@property --lab-text { syntax: '<color>'; inherits: true; initial-value: #f8fafc; }
@property --lab-text-secondary { syntax: '<color>'; inherits: true; initial-value: #94a3b8; }
@property --lab-accent { syntax: '<color>'; inherits: true; initial-value: #38bdf8; }
@property --lab-accent-hover { syntax: '<color>'; inherits: true; initial-value: #7dd3fc; }
@property --lab-border { syntax: '<color>'; inherits: true; initial-value: rgba(248, 250, 252, 0.12); }
@property --lab-success { syntax: '<color>'; inherits: true; initial-value: #10b981; }
@property --lab-error { syntax: '<color>'; inherits: true; initial-value: #ef4444; }
@property --lab-warning { syntax: '<color>'; inherits: true; initial-value: #f59e0b; }

:root[data-theme="dark"] {
    --lab-bg: #0f172a;
    --lab-surface: #1e293b;
    --lab-surface-hover: #334155;
    --lab-text: #f8fafc;
    --lab-text-secondary: #94a3b8;
    --lab-accent: #38bdf8;
    --lab-accent-hover: #7dd3fc;
    --lab-border: rgba(248, 250, 252, 0.12);
    --lab-success: #10b981;
    --lab-error: #ef4444;
    --lab-warning: #f59e0b;
}

:root[data-theme="light"] {
    --lab-bg: #f1f5f9;
    --lab-surface: #ffffff;
    --lab-surface-hover: #e2e8f0;
    --lab-text: #334155;
    --lab-text-secondary: #475569;
    --lab-accent: #2563eb;
    --lab-accent-hover: #3b82f6;
    --lab-border: rgba(51, 65, 85, 0.12);
    --lab-success: #059669;
    --lab-error: #dc2626;
    --lab-warning: #d97706;
}

:root[data-theme="eye-saver"] {
    --lab-bg: #fdf6e3;
    --lab-surface: #eee8d5;
    --lab-surface-hover: #e5ddc8;
    --lab-text: #586e75;
    --lab-text-secondary: #657b83;
    --lab-accent: #d97706;
    --lab-accent-hover: #f59e0b;
    --lab-border: rgba(88, 110, 117, 0.15);
    --lab-success: #2aa198;
    --lab-error: #dc322f;
    --lab-warning: #cb4b16;
}

/* Transition lab variables on :root during theme switch */
:root[data-theme-transitioning] {
    transition:
        --bg-body 0.3s ease, --bg-main 0.3s ease, --bg-panel 0.3s ease,
        --bg-secondary 0.3s ease, --bg-tertiary 0.3s ease,
        --bg-workspace 0.3s ease, --bg-console 0.3s ease,
        --text-primary 0.3s ease, --text-secondary 0.3s ease, --text-muted 0.3s ease,
        --accent-primary 0.3s ease, --accent-hover 0.3s ease,
        --border-main 0.3s ease, --bg-input 0.3s ease, --bg-input-focus 0.3s ease,
        --lab-bg 0.3s ease, --lab-surface 0.3s ease, --lab-surface-hover 0.3s ease,
        --lab-text 0.3s ease, --lab-text-secondary 0.3s ease,
        --lab-accent 0.3s ease, --lab-accent-hover 0.3s ease,
        --lab-border 0.3s ease, --lab-success 0.3s ease,
        --lab-error 0.3s ease, --lab-warning 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    touch-action: manipulation;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--lab-bg);
    color: var(--lab-text);
    min-height: 100vh;
}

.lab-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.lab-header {
    background: var(--lab-surface);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    border: 1px solid var(--lab-border);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    text-align: center;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--lab-surface-hover);
    border: 1px solid var(--lab-border);
    border-radius: 8px;
    color: var(--lab-text);
    text-decoration: none;
    font-weight: 500;
}

.back-btn:hover {
    background: var(--lab-surface-hover);
    border-color: var(--lab-accent);
    color: var(--lab-accent);
}

/* Theme Toggle Buttons */
.theme-toggles {
    display: flex;
    gap: 8px;
}

.theme-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--lab-surface);
    border: 2px solid var(--lab-border);
    border-radius: 10px;
    color: var(--lab-text-secondary);
    cursor: pointer;
    /* transition removed to prevent color shift glitch on page load */
}

.theme-btn:hover {
    background: var(--lab-surface-hover);
    border-color: var(--lab-accent);
    color: var(--lab-accent);
    transform: translateY(-2px);
}

.theme-btn.active {
    background: var(--lab-accent);
    border-color: var(--lab-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.theme-btn svg {
    transition: transform 0.3s ease;
}

.theme-btn:hover svg {
    transform: scale(1.1);
}

.lab-title {
    font-size: 3rem;
    font-weight: 700;
    display: inline-block;
    background: linear-gradient(135deg, var(--lab-accent) 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.lab-subtitle {
    font-size: 1.1rem;
    color: var(--lab-text-secondary);
    font-weight: 500;
}

/* Navigation */
.lab-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 30px 0;
    padding: 0 20px;
}

.nav-tab {
    padding: 12px 32px;
    background: var(--lab-surface);
    border: 2px solid var(--lab-border);
    border-radius: 12px;
    color: var(--lab-text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    /* transition removed to prevent color shift glitch on page load */
    position: relative;
}

.nav-tab:hover {
    background: var(--lab-surface-hover);
    border-color: var(--lab-accent);
    color: var(--lab-text);
}

.nav-tab.active {
    background: var(--lab-accent);
    border-color: var(--lab-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

/* Content Sections */
.lab-content {
    padding: 20px;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.section-header p {
    color: var(--lab-text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

/* Assessment Grid */
.assessment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.assessment-card {
    background: var(--lab-surface);
    border: 1px solid var(--lab-border);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    /* transition removed to prevent color shift glitch on page load */
    position: relative;
    overflow: hidden;
}

.assessment-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--lab-accent), var(--lab-accent-hover));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.assessment-card:hover::before {
    transform: scaleX(1);
}

.assessment-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    border-color: var(--lab-accent);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--lab-text);
}

.difficulty-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.difficulty-basic {
    background: rgba(16, 185, 129, 0.2);
    color: var(--lab-success);
}

.difficulty-intermediate {
    background: rgba(245, 158, 11, 0.2);
    color: var(--lab-warning);
}

.difficulty-advanced {
    background: rgba(239, 68, 68, 0.2);
    color: var(--lab-error);
}

.difficulty-professional {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: white;
}

.card-description {
    color: var(--lab-text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 16px;
    line-height: 1.65;
}

.card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--lab-text-secondary);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    animation: fadeIn 0.3s ease;
    touch-action: none;
    /* Blocks backdrop scroll — children override with their own touch-action */
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--lab-surface);
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--lab-text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* transition removed to prevent color shift glitch on page load */
}

.modal-close:hover {
    background: var(--lab-surface-hover);
    color: var(--lab-text);
}

/* Quiz Styles */
/* Quiz Styles */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.quiz-timer {
    font-size: 1rem;
    font-weight: 600;
    color: var(--lab-accent);
    padding: 8px 16px;
    background: var(--lab-bg);
    border-radius: 8px;
    border: 1px solid var(--lab-border);
}

.quiz-progress {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--lab-bg);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--lab-accent), var(--lab-accent-hover));
    transition: width 0.3s ease;
}

.quiz-question {
    margin-bottom: 30px;
}

.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--lab-text);
    line-height: 1.7;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    padding: 16px 20px;
    background: var(--lab-bg);
    border: 2px solid var(--lab-border);
    border-radius: 12px;
    cursor: pointer;
    /* transition removed to prevent color shift glitch on page load */
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-letter {
    width: 32px;
    height: 32px;
    background: var(--lab-accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    line-height: 1.5;
}

.quiz-option:hover {
    border-color: var(--lab-accent);
    background: var(--lab-surface-hover);
    transform: translateX(4px);
}

.quiz-option.selected {
    border-color: var(--lab-accent);
    background: rgba(56, 189, 248, 0.1);
}

.quiz-option.selected .option-letter {
    background: var(--lab-accent-hover);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2);
}

.quiz-option.correct {
    border-color: var(--lab-success);
    background: rgba(16, 185, 129, 0.1);
}

.quiz-option.incorrect {
    border-color: var(--lab-error);
    background: rgba(239, 68, 68, 0.1);
}

.quiz-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.btn-primary {
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--lab-accent), var(--lab-accent-hover));
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    /* transition removed to prevent color shift glitch on page load */
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
    padding: 12px 32px;
    background: var(--lab-surface);
    border: 2px solid var(--lab-border);
    border-radius: 10px;
    color: var(--lab-text);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    /* transition removed to prevent color shift glitch on page load */
}

.btn-secondary:hover {
    border-color: var(--lab-accent);
    background: var(--lab-surface-hover);
}

/* Results */
.quiz-result {
    padding: 20px;
}

.result-header {
    text-align: center;
    margin-bottom: 30px;
}

.result-emoji {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.result-score {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--lab-accent), var(--lab-accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.result-message {
    font-size: 1.25rem;
    color: var(--lab-text);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.stat-item {
    background: var(--lab-bg);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--lab-border);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--lab-text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--lab-accent);
}

.result-details {
    text-align: left;
    margin-top: 30px;
}

.result-details h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--lab-text);
}

.result-item {
    background: var(--lab-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border-left: 4px solid var(--lab-border);
}

.result-item.correct {
    border-left-color: var(--lab-success);
    background: rgba(16, 185, 129, 0.05);
}

.result-item.incorrect {
    border-left-color: var(--lab-error);
    background: rgba(239, 68, 68, 0.05);
}

.result-question {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--lab-text);
    line-height: 1.6;
}

.question-number {
    color: var(--lab-accent);
    margin-right: 8px;
}

.result-answer {
    font-size: 0.95rem;
}

.answer-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: baseline;
}

.answer-label {
    color: var(--lab-text-secondary);
    font-weight: 500;
    min-width: 120px;
}

.answer-value {
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
}

.correct-answer {
    color: var(--lab-success);
    background: rgba(16, 185, 129, 0.1);
}

.wrong-answer {
    color: var(--lab-error);
    background: rgba(239, 68, 68, 0.1);
    text-decoration: line-through;
}

.explanation {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--lab-surface);
    border-radius: 8px;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--lab-text-secondary);
    border-left: 3px solid var(--lab-accent);
}

/* Exercise Styles */
.exercise-content {
    line-height: 1.8;
}

.exercise-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--lab-accent);
}

.exercise-content code {
    background: var(--lab-surface-hover);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'Fira Code', 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.875em;
    font-weight: 500;
}

.exercise-content pre {
    background: #0d1117;
    padding: 16px 18px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-left: 3px solid var(--lab-accent);
}

.exercise-content pre code {
    background: none;
    padding: 0;
    color: #e2e8f0;
    font-size: 0.9rem;
    line-height: 1.7;
    font-weight: 400;
}

.exercise-content ul,
.exercise-content ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.exercise-content li {
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    /* Ensure natural page scroll on mobile — override styles.css body overflow */
    body {
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
    }

    .lab-title {
        font-size: 2rem;
    }

    .lab-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .nav-tab {
        flex: 1;
        min-width: 100px;
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .assessment-grid {
        grid-template-columns: 1fr;
    }

    .back-btn {
        position: static;
    }

    .modal-content {
        padding: 24px;
    }
}

/* Timer Pulse Animation */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* ===== QUIZ ENHANCEMENTS CSS ===== */

/* Validation Warning */
.validation-warning {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    animation: slideDown 0.3s ease-out;
}

.warning-content {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.warning-icon {
    font-size: 24px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Collapsible Answer Review */
.results-expander {
    width: 100%;
    padding: 16px;
    margin: 20px 0;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* transition removed to prevent color shift glitch on page load */
}

.results-expander:hover {
    background: var(--hover-bg);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.expander-icon {
    transition: transform 0.3s ease;
    font-size: 14px;
}

.expander-icon.expanded {
    transform: rotate(180deg);
}

.answer-review-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.answer-review-section.expanded {
    max-height: 5000px;
}

/* Premium Trophy Display */
.trophy-icon {
    display: block;
    font-size: 150px;
    line-height: 1;
    margin: 20px auto;
    text-align: center;
    animation:
        trophy-bounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55),
        trophy-pulse 2s ease-in-out infinite,
        trophy-glow 3s ease-in-out infinite;
    filter:
        drop-shadow(0 0 20px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 40px rgba(255, 215, 0, 0.6)) drop-shadow(0 0 60px rgba(255, 215, 0, 0.3)) brightness(1.1);

}

@keyframes trophy-bounce {
    0% {
        transform: translateY(0) scale(0.5) rotate(-10deg);
        opacity: 0;
    }

    50% {
        transform: translateY(-30px) scale(1.15) rotate(5deg);
    }

    70% {
        transform: translateY(-10px) scale(0.95) rotate(-2deg);
    }

    100% {
        transform: translateY(0) scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes trophy-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

@keyframes trophy-glow {

    0%,
    100% {
        filter:
            drop-shadow(0 0 20px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 40px rgba(255, 215, 0, 0.6)) drop-shadow(0 0 60px rgba(255, 215, 0, 0.3)) brightness(1.1);
    }

    50% {
        filter:
            drop-shadow(0 0 40px rgba(255, 215, 0, 1)) drop-shadow(0 0 80px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 120px rgba(255, 215, 0, 0.5)) brightness(1.3);
    }
}

/* Confetti Animation */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    opacity: 0;
    animation: confetti-fall 3.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    will-change: transform, opacity;
}

.confetti-square {
    width: 12px;
    height: 12px;
}

.confetti-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.confetti-triangle {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 12px solid;
    border-bottom-color: inherit;
    background-color: transparent !important;
}

.confetti-rectangle {
    width: 8px;
    height: 14px;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-100vh) translateX(0) rotate(0deg) scale(1);
    }

    15% {
        opacity: 1;
        transform: translateY(15vh) translateX(calc(var(--drift, 0px) * 0.3)) rotate(calc(var(--rotation, 360deg) * 0.15)) scale(1.05);
    }

    35% {
        opacity: 1;
        transform: translateY(35vh) translateX(calc(var(--drift, 0px) * 0.8)) rotate(calc(var(--rotation, 360deg) * 0.35)) scale(1.1);
    }

    55% {
        opacity: 0.95;
        transform: translateY(55vh) translateX(calc(var(--drift, 0px) * 0.9)) rotate(calc(var(--rotation, 360deg) * 0.55)) scale(0.95);
    }

    75% {
        opacity: 0.7;
        transform: translateY(75vh) translateX(calc(var(--drift, 0px) * 0.6)) rotate(calc(var(--rotation, 360deg) * 0.75)) scale(1);
    }

    90% {
        opacity: 0.3;
        transform: translateY(95vh) translateX(calc(var(--drift, 0px) * 0.2)) rotate(calc(var(--rotation, 360deg) * 0.9)) scale(0.9);
    }

    100% {
        opacity: 0;
        transform: translateY(110vh) translateX(0) rotate(var(--rotation, 360deg)) scale(0.7);
    }
}

/* Celebration Effects Container */
.celebration-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100000;
    overflow: hidden;
}

/* Fireworks Effect */
.firework-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: firework-burst 1.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    box-shadow: 0 0 8px currentColor, 0 0 16px currentColor;
    will-change: transform, opacity;
}

@keyframes firework-burst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--tx, 0), var(--ty, 0)) scale(0);
    }
}

/* Stars Effect */
.star-particle {
    position: absolute;
    animation: star-fall 3.5s cubic-bezier(0.33, 0, 0.67, 1) forwards;
    filter: drop-shadow(0 0 8px gold) drop-shadow(0 0 16px gold);
    will-change: transform, opacity;
}

@keyframes star-fall {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg) scale(0);
    }

    10% {
        opacity: 1;
        transform: translateY(10vh) rotate(36deg) scale(1);
    }

    90% {
        opacity: 1;
        transform: translateY(90vh) rotate(360deg) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(396deg) scale(0.5);
    }
}

/* Sparkles Effect */
.sparkle-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: sparkle-burst 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow: 0 0 12px currentColor, 0 0 24px currentColor, 0 0 36px rgba(255, 215, 0, 0.5);
    will-change: transform, opacity;
}

@keyframes sparkle-burst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    50% {
        opacity: 1;
        transform: translate(calc(var(--tx, 0) * 0.5), calc(var(--ty, 0) * 0.5)) scale(1.5);
    }

    100% {
        opacity: 0;
        transform: translate(var(--tx, 0), var(--ty, 0)) scale(0);
    }
}









/* ─── Category Filters ───────────────────────────────────────────────────── */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 0 1.5rem;
}

.cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 100px;
    border: 1px solid var(--border-main);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cat-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.cat-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    font-weight: 600;
}

.cat-btn .cat-count {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 100px;
    padding: 1px 7px;
    font-size: 0.75rem;
    font-weight: 700;
}

.cat-btn:not(.active) .cat-count {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.08));
    color: var(--text-muted);
}

/* ─── Category Badge on Cards ────────────────────────────────────────────── */
.cat-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 100px;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.cat-python {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.cat-datascience {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.cat-ml {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.cat-ai {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

:root[data-theme="light"] .cat-python {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

:root[data-theme="light"] .cat-datascience {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

:root[data-theme="light"] .cat-ml {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

:root[data-theme="light"] .cat-ai {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

/* Disable all transitions during page load to prevent flash */
html.no-transition *,
html.no-transition *::before,
html.no-transition *::after {
    transition: none !important;
    animation: none !important;
}