:root {
    /* Color Palette */
    --color-primary: #ffde00;
    /* Bright Yellow */
    --color-secondary: #6fc2ff;
    /* Bright Blue */
    --color-accent: #ff6b9d;
    /* Pink */
    --color-success: #18d85a;
    /* Bright Green */
    --color-border: #383838;
    /* Dark Gray */
    --color-text-primary: #1a1a1a;
    --color-text-secondary: #4a4a4a;
    --color-bg: #f4efea;
    /* Warm beige */

    /* Fonts */
    --font-heading: 'Space Mono', 'Courier New', monospace;
    --font-body: 'DM Sans', 'Inter', sans-serif;

    /* Spacing & Borders */
    --border-width: 3px;
    --border-radius: 12px;
    --border-radius-pill: 999px;

    /* Shadows */
    --shadow-bold: 4px 4px 0px rgba(56, 56, 56, 1);
    --shadow-sm: 0 2px 4px rgba(56, 56, 56, 0.1);
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    background-image:
        linear-gradient(rgba(244, 239, 234, 0.9), rgba(244, 239, 234, 0.9)),
        url('https://motherduck.com/images/transparent-grid-pattern-lighter.png');
    background-position: 50% calc(100% + 7px);
    background-size: 640px;
    color: var(--color-text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
    border-left: 2px solid var(--color-border);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border: 2px solid var(--color-border);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-secondary);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    /* Start hidden */
}

.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

/* Hero Section */
header {
    background: var(--color-primary);
    color: var(--color-text-primary);
    padding: 100px 20px 80px;
    text-align: center;
    border-bottom: var(--border-width) solid var(--color-border);
    margin-bottom: 60px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-bold);
}

/* Decorative shapes for Hero */
header::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: var(--color-secondary);
    border: var(--border-width) solid var(--color-border);
    border-radius: 50%;
    opacity: 0.5;
    animation: float 6s ease-in-out infinite;
}

header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 5%;
    width: 100px;
    height: 100px;
    background: var(--color-accent);
    border: var(--border-width) solid var(--color-border);
    transform: rotate(45deg);
    opacity: 0.6;
    animation: float 8s ease-in-out infinite reverse;
}

.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-text-primary);
    padding: 8px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-pill);
    background: white;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.back-btn:hover {
    background-color: var(--color-secondary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 2px 2px 0px var(--color-border);
}

header h1 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: var(--color-text-primary);
    position: relative;
    z-index: 1;
    text-shadow: 4px 4px 0px white;
    line-height: 1.2;
}

header .subtitle {
    font-family: var(--font-body);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text-primary);
    background: white;
    display: inline-block;
    padding: 10px 25px;
    border: 3px solid var(--color-border);
    border-radius: var(--border-radius-pill);
    box-shadow: 6px 6px 0px var(--color-border);
    position: relative;
    z-index: 1;
    transform: rotate(-2deg);
    transition: transform 0.3s ease;
}

header .subtitle:hover {
    transform: rotate(0deg) scale(1.05);
}

/* Sticky Progress Bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: transparent;
    z-index: 1000;
}

.progress-bar {
    height: 100%;
    background: var(--color-secondary);
    width: 0%;
    transition: width 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border-bottom-right-radius: 4px;
    border-top-right-radius: 4px;
}

/* Main Container */
.article-container {
    max-width: 800px;
    margin: 0 auto 60px;
    background: white;
    padding: 60px;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-bold);
    position: relative;
    z-index: 2;
}

@media (max-width: 768px) {
    .article-container {
        padding: 30px 20px;
        margin: 0 20px 60px;
    }
}

/* Typography */
h2 {
    font-family: var(--font-heading);
    color: var(--color-text-primary);
    font-size: 2rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 10px;
    border-bottom: 4px solid var(--color-primary);
    display: inline-block;
}

h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-text-secondary);
}

p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: #333;
}

/* Special Note Box */
.special-note {
    background-color: #fff9c4;
    /* Light yellow base */
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 25px;
    margin: 30px 0;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.special-note:hover {
    transform: translateY(-3px);
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.15);
}

.special-note::before {
    content: "NOTE";
    position: absolute;
    top: -15px;
    left: 20px;
    background: var(--color-primary);
    border: 2px solid var(--color-border);
    padding: 2px 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* Video Section */
.video-wrapper {
    margin: 50px 0;
    background: #000;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-bold);
    position: relative;
}

/* Retro Monitor Style */
.retro-monitor {
    border: 12px solid #383838;
    border-radius: 20px;
    box-shadow:
        0 0 0 4px #555,
        0 10px 20px rgba(0, 0, 0, 0.3);
    background: #1a1a1a;
}

.monitor-glare {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 50%);
    pointer-events: none;
    z-index: 10;
}

/* Video.js Customization for MotherDuck Theme */
.video-js {
    font-family: var(--font-heading);
}

.video-js .vjs-big-play-button {
    background-color: var(--color-primary);
    border: var(--border-width) solid var(--color-border);
    color: var(--color-text-primary);
    border-radius: 50%;
    width: 2em;
    height: 2em;
    line-height: 1.8em;
    font-size: 3em;
    box-shadow: var(--shadow-bold);
    transition: all 0.2s;
}

.video-js:hover .vjs-big-play-button {
    background-color: var(--color-secondary);
    border-color: var(--color-border);
    color: white;
    transform: scale(1.1);
}

.video-js .vjs-control-bar {
    background-color: rgba(56, 56, 56, 0.9);
    font-family: var(--font-heading);
}

.video-js .vjs-play-progress {
    background-color: var(--color-primary);
}

.video-js .vjs-slider {
    background-color: rgba(255, 255, 255, 0.3);
}

.video-caption {
    text-align: center;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-top: 15px;
    background: #e9ecef;
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

/* Quiz Section */
.quiz-container {
    background: white;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 30px;
    margin: 40px 0;
    box-shadow: var(--shadow-bold);
    display: none;
    /* Hidden by default */
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quiz-container h3 {
    color: var(--color-text-primary);
    margin-top: 0;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
    display: inline-block;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.quiz-btn {
    padding: 15px 20px;
    border: var(--border-width) solid var(--color-border);
    background: white;
    border-radius: var(--border-radius);
    text-align: left;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.2s ease;
    position: relative;
}

.quiz-btn:hover:not(:disabled) {
    background-color: var(--color-primary);
    transform: translateY(-2px) translateX(2px);
    box-shadow: var(--shadow-bold);
}

.quiz-btn:disabled {
    cursor: default;
    opacity: 0.8;
}

.quiz-btn.correct {
    background-color: var(--color-success);
    color: white;
    border-color: var(--color-border);
}

.quiz-btn.wrong {
    background-color: #ff6b6b;
    /* Red error */
    color: white;
    border-color: var(--color-border);
}

.feedback {
    margin-top: 20px;
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid transparent;
}

.feedback.success {
    background-color: #d1fae5;
    border-color: var(--color-success);
    color: #065f46;
}

.feedback.error {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

/* Text Input */
textarea.quiz-input {
    width: 100%;
    padding: 15px;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    margin-top: 15px;
    min-height: 120px;
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
    /* Include padding and border in width */
}

textarea.quiz-input:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 4px 4px 0px var(--color-secondary);
}

.submit-btn {
    background: var(--color-secondary);
    color: white;
    border: var(--border-width) solid var(--color-border);
    padding: 12px 30px;
    border-radius: var(--border-radius-pill);
    cursor: pointer;
    margin-top: 20px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: 2px 2px 0px var(--color-border);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 0px var(--color-border);
}

/* Section Locking */
.section {
    transition: opacity 0.5s ease, filter 0.5s ease;
    position: relative;
}

.section.locked {
    opacity: 0.5;
    filter: grayscale(100%) blur(3px);
    pointer-events: none;
    user-select: none;
}

.lock-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-primary);
    padding: 15px 30px;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius-pill);
    box-shadow: var(--shadow-bold);
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-text-primary);
    z-index: 10;
    display: none;
    white-space: nowrap;
}

.section.locked .lock-overlay {
    display: block;
}

/* Conclusion Section Locking */
.conclusion {
    transition: opacity 0.5s ease, filter 0.5s ease;
    position: relative;
}

.conclusion.locked {
    opacity: 0.3;
    filter: grayscale(100%) blur(5px);
    pointer-events: none;
    user-select: none;
}

/* Primary Button (Finish Course) */
.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text-primary);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    padding: 15px 40px;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius-pill);
    cursor: pointer;
    box-shadow: var(--shadow-bold);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-4px) translateX(2px);
    box-shadow: 6px 6px 0px var(--color-border);
    background-color: #ffe64d;
    /* Slightly lighter yellow */
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 2px 2px 0px var(--color-border);
}

.btn-primary:disabled {
    background-color: #e5e7eb;
    color: #9ca3af;
    border-color: #d1d5db;
    box-shadow: none;
    cursor: not-allowed;
}

/* Dynamic Quiz Card Styles */
.quiz-options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.quiz-option-card {
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--border-radius);
    background: white;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}

.quiz-option-card:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--color-primary);
}

.quiz-option-header {
    padding: 15px 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 1rem;
}

.quiz-option-feedback {
    padding: 15px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
    line-height: 1.5;
    display: none;
    /* Hidden by default */
    background-color: #f9fafb;
}

/* States */
.quiz-option-card.selected {
    border-color: var(--color-primary);
    background-color: #fffde7;
    /* Light yellow tint */
}

.quiz-option-card.correct {
    border-color: var(--color-success);
    background-color: #d1fae5;
    /* Light green bg */
}

.quiz-option-card.correct .quiz-option-header {
    color: #065f46;
    font-weight: 700;
}

.quiz-option-card.correct .quiz-option-feedback {
    display: block;
    background-color: #d1fae5;
    color: #065f46;
    border-top-color: rgba(6, 95, 70, 0.2);
}

.quiz-option-card.wrong {
    border-color: #ef4444;
    /* Red */
    background-color: #fee2e2;
    /* Light red bg */
}

.quiz-option-card.wrong .quiz-option-header {
    color: #991b1b;
    font-weight: 700;
}

.quiz-option-card.wrong .quiz-option-feedback {
    display: block;
    background-color: #fee2e2;
    color: #991b1b;
    border-top-color: rgba(153, 27, 27, 0.2);
}

.quiz-option-card.disabled {
    cursor: default;
    opacity: 0.7;
    pointer-events: none;
}

/* Ensure correct answer is fully visible even if disabled/not selected by user */
.quiz-option-card.correct.disabled {
    opacity: 1;
}
/* Next Section Hint */
.next-section-hint {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: var(--color-text-primary);
    padding: 10px 20px;
    border-radius: var(--border-radius-pill);
    border: var(--border-width) solid var(--color-border);
    box-shadow: var(--shadow-bold);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    z-index: 1000;
    animation: bounce 2s infinite;
    transition: all 0.3s ease;
}

.next-section-hint.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

.next-section-hint:hover {
    transform: translateX(-50%) scale(1.05);
    background-color: #ffe64d;
}

.hint-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}
