/* ============================================
           CSS VARIABLES & BASE STYLES
           ============================================ */
        :root {
            /* Case Colors */
            --nom: #3b82f6;
            --acc: #ef4444;
            --dat: #10b981;
            --gen: #8b5cf6;
            
            /* Gender Colors */
            --masc: #06b6d4;
            --fem: #ec4899;
            --neut: #f59e0b;
            --plural: #84cc16;
            
            /* UI Colors */
            --bg-primary: #fef2f2;
            --bg-card: #ffffff;
            --text-primary: #1f2937;
            --text-secondary: #6b7280;
            --border: #e5e7eb;
            --success: #22c55e;
            --error: #ef4444;
            --warning: #f59e0b;
            
            /* Spacing */
            --space-xs: 0.25rem;
            --space-sm: 0.5rem;
            --space-md: 1rem;
            --space-lg: 1.5rem;
            --space-xl: 2rem;
            --space-2xl: 3rem;
            
            /* Border Radius */
            --radius-sm: 0.375rem;
            --radius-md: 0.5rem;
            --radius-lg: 0.75rem;
            --radius-xl: 1rem;
            
            /* Shadows */
            --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
            --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
            --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
            color: var(--text-primary);
            line-height: 1.6;
            min-height: 100vh;
        }
        
        /* ============================================
           NAVIGATION
           ============================================ */
        .chapter-nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: var(--space-md) var(--space-xl);
            background: white;
            border-bottom: 3px solid var(--acc);
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: var(--shadow-md);
        }
        
        .chapter-nav a {
            text-decoration: none;
            color: var(--acc);
            font-weight: 600;
            padding: var(--space-sm) var(--space-md);
            border-radius: var(--radius-md);
            transition: all 0.2s ease;
        }
        
        .chapter-nav a:hover {
            background: var(--bg-primary);
            transform: translateY(-2px);
        }
        
        .progress-bar {
            background: linear-gradient(90deg, var(--acc) 42%, var(--border) 42%);
            padding: var(--space-sm) var(--space-lg);
            border-radius: var(--radius-xl);
            font-weight: 600;
            color: white;
            font-size: 0.9rem;
        }
        
        /* ============================================
           HEADER
           ============================================ */
        .chapter-header {
            text-align: center;
            padding: var(--space-2xl) var(--space-xl);
            background: linear-gradient(135deg, var(--acc) 0%, #dc2626 100%);
            color: white;
            position: relative;
            overflow: hidden;
        }
        
        .chapter-header::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
            animation: pulse 4s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { transform: scale(1); opacity: 0.5; }
            50% { transform: scale(1.1); opacity: 0.8; }
        }
        
        .chapter-badge {
            display: inline-block;
            background: rgba(255,255,255,0.2);
            padding: var(--space-sm) var(--space-lg);
            border-radius: var(--radius-xl);
            font-size: 0.875rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            margin-bottom: var(--space-md);
            position: relative;
            z-index: 1;
        }
        
        .chapter-title {
            font-size: clamp(2rem, 5vw, 3.5rem);
            font-weight: 800;
            margin-bottom: var(--space-sm);
            position: relative;
            z-index: 1;
        }
        
        .chapter-subtitle {
            font-size: 1.25rem;
            opacity: 0.9;
            position: relative;
            z-index: 1;
        }
        
        /* ============================================
           STREAK COUNTER
           ============================================ */
        .streak-container {
            position: fixed;
            top: 80px;
            right: 20px;
            background: white;
            padding: var(--space-sm) var(--space-md);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            z-index: 99;
            border: 2px solid var(--acc);
        }
        
        .streak-icon {
            font-size: 1.5rem;
        }
        
        .streak-count {
            font-weight: 700;
            color: var(--acc);
            font-size: 1.1rem;
        }
        
        /* ============================================
           MAIN CONTAINER
           ============================================ */
        .container {
            max-width: 900px;
            margin: 0 auto;
            padding: var(--space-xl);
        }
        
        /* ============================================
           THEORY CARDS
           ============================================ */
        .theory-section {
            margin-bottom: var(--space-2xl);
        }
        
        .section-title {
            font-size: 1.75rem;
            font-weight: 700;
            color: var(--acc);
            margin-bottom: var(--space-lg);
            display: flex;
            align-items: center;
            gap: var(--space-sm);
        }
        
        .section-title::before {
            content: '';
            width: 4px;
            height: 1.5rem;
            background: var(--acc);
            border-radius: var(--radius-sm);
        }
        
        .theory-card {
            background: white;
            border-radius: var(--radius-lg);
            padding: var(--space-xl);
            margin-bottom: var(--space-lg);
            box-shadow: var(--shadow-md);
            border-left: 4px solid var(--acc);
        }
        
        .theory-card h3 {
            color: var(--acc);
            font-size: 1.25rem;
            margin-bottom: var(--space-md);
            display: flex;
            align-items: center;
            gap: var(--space-sm);
        }
        
        .theory-card p {
            margin-bottom: var(--space-md);
            color: var(--text-primary);
        }
        
        .theory-card p:last-child {
            margin-bottom: 0;
        }
        
        /* Highlight Box */
        .highlight-box {
            background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
            border: 2px solid var(--acc);
            border-radius: var(--radius-md);
            padding: var(--space-lg);
            margin: var(--space-lg) 0;
        }
        
        .highlight-box h4 {
            color: var(--acc);
            margin-bottom: var(--space-sm);
            font-size: 1rem;
        }
        
        /* Warning Box */
        .warning-box {
            background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
            border: 2px solid var(--warning);
            border-radius: var(--radius-md);
            padding: var(--space-lg);
            margin: var(--space-lg) 0;
        }
        
        .warning-box h4 {
            color: #92400e;
            margin-bottom: var(--space-sm);
            display: flex;
            align-items: center;
            gap: var(--space-sm);
        }
        
        /* ============================================
           EXAMPLE SENTENCES
           ============================================ */
        .example-sentence {
            background: #f8fafc;
            border-radius: var(--radius-md);
            padding: var(--space-md) var(--space-lg);
            margin: var(--space-md) 0;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: var(--space-md);
        }
        
        .example-german {
            font-size: 1.1rem;
            font-weight: 500;
        }
        
        .example-english {
            color: var(--text-secondary);
            font-style: italic;
        }
        
        .audio-btn {
            background: var(--acc);
            color: white;
            border: none;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            font-size: 1rem;
        }
        
        .audio-btn:hover {
            background: #dc2626;
            transform: scale(1.1);
        }
        
        .audio-btn:active {
            transform: scale(0.95);
        }
        
        /* ============================================
           ENDINGS TABLE
           ============================================ */
        .endings-table-container {
            overflow-x: auto;
            margin: var(--space-lg) 0;
        }
        
        .endings-table {
            width: 100%;
            border-collapse: collapse;
            background: white;
            border-radius: var(--radius-lg);
            overflow: hidden;
            box-shadow: var(--shadow-md);
        }
        
        .endings-table th,
        .endings-table td {
            padding: var(--space-md);
            text-align: left;
            border-bottom: 1px solid var(--border);
        }
        
        .endings-table th {
            background: var(--acc);
            color: white;
            font-weight: 600;
        }
        
        .endings-table tr:hover {
            background: #fef2f2;
        }
        
        .endings-table td:first-child {
            font-weight: 600;
            color: var(--text-primary);
        }
        
        /* Gender highlighting in table */
        .masc-cell {
            color: var(--masc);
            font-weight: 600;
        }
        
        .fem-cell {
            color: var(--fem);
            font-weight: 600;
        }
        
        .neut-cell {
            color: var(--neut);
            font-weight: 600;
        }
        
        .plural-cell {
            color: var(--plural);
            font-weight: 600;
        }
        
        /* Change highlight */
        .change-highlight {
            background: #fef3c7;
            padding: 2px 6px;
            border-radius: var(--radius-sm);
            font-weight: 700;
        }
        
        /* ============================================
           PREPOSITIONS LIST
           ============================================ */
        .prepositions-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: var(--space-md);
            margin: var(--space-lg) 0;
        }
        
        .preposition-card {
            background: white;
            border-radius: var(--radius-md);
            padding: var(--space-md);
            box-shadow: var(--shadow-sm);
            border: 2px solid transparent;
            transition: all 0.2s ease;
        }
        
        .preposition-card:hover {
            border-color: var(--acc);
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
        }
        
        .prep-german {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--acc);
        }
        
        .prep-english {
            color: var(--text-secondary);
            font-size: 0.9rem;
        }
        
        /* ============================================
           EXERCISES
           ============================================ */
        .exercise-section {
            background: white;
            border-radius: var(--radius-lg);
            padding: var(--space-xl);
            margin-bottom: var(--space-xl);
            box-shadow: var(--shadow-md);
        }
        
        .exercise-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: var(--space-lg);
            padding-bottom: var(--space-md);
            border-bottom: 2px solid var(--border);
        }
        
        .exercise-title {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--acc);
        }
        
        .exercise-number {
            background: var(--acc);
            color: white;
            padding: var(--space-xs) var(--space-md);
            border-radius: var(--radius-xl);
            font-size: 0.875rem;
            font-weight: 600;
        }
        
        .exercise-instructions {
            background: #f8fafc;
            padding: var(--space-md);
            border-radius: var(--radius-md);
            margin-bottom: var(--space-lg);
            color: var(--text-secondary);
        }
        
        /* Exercise Items */
        .exercise-item {
            display: flex;
            align-items: center;
            gap: var(--space-md);
            padding: var(--space-md) 0;
            border-bottom: 1px solid var(--border);
            flex-wrap: wrap;
        }
        
        .exercise-item:last-child {
            border-bottom: none;
        }
        
        .item-number {
            background: var(--acc);
            color: white;
            width: 28px;
            height: 28px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            font-size: 0.875rem;
            flex-shrink: 0;
        }
        
        .item-prompt {
            font-weight: 500;
            min-width: 120px;
        }
        
        .item-answer {
            flex: 1;
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            flex-wrap: wrap;
        }
        
        /* Input Styles */
        .answer-input {
            padding: var(--space-sm) var(--space-md);
            border: 2px solid var(--border);
            border-radius: var(--radius-md);
            font-size: 1rem;
            transition: all 0.2s ease;
            min-width: 150px;
        }
        
        .answer-input:focus {
            outline: none;
            border-color: var(--acc);
            box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
        }
        
        .answer-input.correct {
            border-color: var(--success);
            background: #f0fdf4;
        }
        
        .answer-input.incorrect {
            border-color: var(--error);
            background: #fef2f2;
        }
        
        /* Select Styles */
        .answer-select {
            padding: var(--space-sm) var(--space-md);
            border: 2px solid var(--border);
            border-radius: var(--radius-md);
            font-size: 1rem;
            background: white;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .answer-select:focus {
            outline: none;
            border-color: var(--acc);
        }
        
        /* Check Button */
        .check-btn {
            background: var(--acc);
            color: white;
            border: none;
            padding: var(--space-sm) var(--space-lg);
            border-radius: var(--radius-md);
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .check-btn:hover {
            background: #dc2626;
            transform: translateY(-2px);
        }
        
        .check-all-btn {
            background: linear-gradient(135deg, var(--acc) 0%, #dc2626 100%);
            color: white;
            border: none;
            padding: var(--space-md) var(--space-xl);
            border-radius: var(--radius-lg);
            font-weight: 700;
            font-size: 1.1rem;
            cursor: pointer;
            transition: all 0.2s ease;
            margin-top: var(--space-lg);
            width: 100%;
        }
        
        .check-all-btn:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
        }
        
        /* Feedback */
        .feedback {
            display: none;
            padding: var(--space-sm) var(--space-md);
            border-radius: var(--radius-md);
            font-size: 0.875rem;
            font-weight: 500;
            margin-left: var(--space-sm);
        }
        
        .feedback.show {
            display: inline-block;
        }
        
        .feedback.correct {
            background: #dcfce7;
            color: #166534;
        }
        
        .feedback.incorrect {
            background: #fee2e2;
            color: #991b1b;
        }
        
        /* Progress Indicator */
        .progress-indicator {
            display: flex;
            gap: var(--space-xs);
            margin-top: var(--space-lg);
        }
        
        .progress-dot {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--border);
            transition: all 0.3s ease;
        }
        
        .progress-dot.correct {
            background: var(--success);
        }
        
        .progress-dot.incorrect {
            background: var(--error);
        }
        
        /* Score Display */
        .score-display {
            text-align: center;
            padding: var(--space-lg);
            background: #f8fafc;
            border-radius: var(--radius-lg);
            margin-top: var(--space-lg);
        }
        
        .score-number {
            font-size: 3rem;
            font-weight: 800;
            color: var(--acc);
        }
        
        .score-text {
            color: var(--text-secondary);
        }
        
        /* ============================================
           CHECKLIST
           ============================================ */
        .checklist-section {
            background: white;
            border-radius: var(--radius-lg);
            padding: var(--space-xl);
            box-shadow: var(--shadow-md);
            margin-bottom: var(--space-xl);
        }
        
        .checklist-item {
            display: flex;
            align-items: flex-start;
            gap: var(--space-md);
            padding: var(--space-md) 0;
            border-bottom: 1px solid var(--border);
        }
        
        .checklist-item:last-child {
            border-bottom: none;
        }
        
        .checklist-checkbox {
            width: 24px;
            height: 24px;
            border: 2px solid var(--acc);
            border-radius: var(--radius-sm);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: all 0.2s ease;
        }
        
        .checklist-checkbox:hover {
            background: var(--bg-primary);
        }
        
        .checklist-checkbox.checked {
            background: var(--acc);
            color: white;
        }
        
        .checklist-text {
            flex: 1;
        }
        
        .checklist-answer {
            display: none;
            margin-top: var(--space-sm);
            padding: var(--space-sm) var(--space-md);
            background: #f0fdf4;
            border-radius: var(--radius-md);
            color: #166534;
            font-size: 0.9rem;
        }
        
        .checklist-answer.show {
            display: block;
        }
        
        .reveal-btn {
            background: transparent;
            border: 2px solid var(--acc);
            color: var(--acc);
            padding: var(--space-xs) var(--space-md);
            border-radius: var(--radius-md);
            cursor: pointer;
            font-size: 0.875rem;
            font-weight: 600;
            transition: all 0.2s ease;
        }
        
        .reveal-btn:hover {
            background: var(--acc);
            color: white;
        }
        
        /* ============================================
           BRIDGE SECTION
           ============================================ */
        .connectivity {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: var(--space-lg);
            margin-top: var(--space-2xl);
        }
        
        .from-prev,
        .to-next {
            background: white;
            border-radius: var(--radius-lg);
            padding: var(--space-lg);
            box-shadow: var(--shadow-md);
        }
        
        .from-prev {
            border-left: 4px solid var(--nom);
        }
        
        .to-next {
            border-left: 4px solid var(--dat);
        }
        
        .from-prev h4 {
            color: var(--nom);
            margin-bottom: var(--space-sm);
            display: flex;
            align-items: center;
            gap: var(--space-sm);
        }
        
        .to-next h4 {
            color: var(--dat);
            margin-bottom: var(--space-sm);
            display: flex;
            align-items: center;
            gap: var(--space-sm);
        }
        
        .from-prev p,
        .to-next p {
            color: var(--text-secondary);
            font-size: 0.95rem;
        }
        
        /* ============================================
           FOOTER
           ============================================ */
        .chapter-footer {
            text-align: center;
            padding: var(--space-2xl);
            background: #1f2937;
            color: white;
            margin-top: var(--space-2xl);
        }
        
        /* ============================================
           RESPONSIVE
           ============================================ */
        @media (max-width: 768px) {
            .chapter-nav {
                flex-direction: column;
                gap: var(--space-sm);
                padding: var(--space-sm);
            }
            
            .chapter-nav a {
                font-size: 0.875rem;
            }
            
            .progress-bar {
                order: -1;
            }
            
            .streak-container {
                top: auto;
                bottom: 20px;
                right: 10px;
            }
            
            .container {
                padding: var(--space-md);
            }
            
            .theory-card,
            .exercise-section,
            .checklist-section {
                padding: var(--space-md);
            }
            
            .connectivity {
                grid-template-columns: 1fr;
            }
            
            .example-sentence {
                flex-direction: column;
                align-items: flex-start;
            }
            
            .prepositions-grid {
                grid-template-columns: 1fr;
            }
            
            .exercise-item {
                flex-direction: column;
                align-items: flex-start;
            }
            
            .answer-input {
                width: 100%;
            }
        }
        
        /* ============================================
           ANIMATIONS
           ============================================ */
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .theory-card,
        .exercise-section,
        .checklist-section {
            animation: slideIn 0.5s ease forwards;
        }
        
        .theory-card:nth-child(2) { animation-delay: 0.1s; }
        .theory-card:nth-child(3) { animation-delay: 0.2s; }
        .exercise-section:nth-of-type(1) { animation-delay: 0.3s; }
        .exercise-section:nth-of-type(2) { animation-delay: 0.4s; }
        .exercise-section:nth-of-type(3) { animation-delay: 0.5s; }
