/* CSS Variables */
        :root {
            --nom: #3b82f6;
            --acc: #ef4444;
            --dat: #10b981;
            --gen: #8b5cf6;
            --masc: #06b6d4;
            --fem: #ec4899;
            --neut: #f59e0b;
            --bg: #f8fafc;
            --card-bg: #ffffff;
            --text: #1e293b;
            --text-light: #64748b;
            --border: #e2e8f0;
            --success: #22c55e;
            --error: #ef4444;
            --warning: #f59e0b;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
            background: var(--bg);
            color: var(--text);
            line-height: 1.6;
            padding-bottom: 2rem;
        }

        /* Header */
        .chapter-header {
            background: linear-gradient(135deg, var(--gen) 0%, #7c3aed 100%);
            color: white;
            padding: 2rem 1rem;
            text-align: center;
            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: shimmer 8s infinite linear;
        }

        @keyframes shimmer {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .chapter-badge {
            display: inline-block;
            background: rgba(255,255,255,0.2);
            padding: 0.4rem 1rem;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 0.5rem;
            position: relative;
            z-index: 1;
        }

        .chapter-title {
            font-size: 2rem;
            font-weight: 700;
            position: relative;
            z-index: 1;
        }

        .chapter-subtitle {
            font-size: 1.1rem;
            opacity: 0.9;
            margin-top: 0.5rem;
            position: relative;
            z-index: 1;
        }

        /* Navigation */
        .chapter-nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem;
            background: var(--card-bg);
            border-bottom: 1px solid var(--border);
            flex-wrap: wrap;
            gap: 0.5rem;
        }

        .chapter-nav a {
            color: var(--gen);
            text-decoration: none;
            padding: 0.5rem 1rem;
            border-radius: 8px;
            font-weight: 500;
            transition: all 0.2s;
        }

        .chapter-nav a:hover {
            background: rgba(139, 92, 246, 0.1);
        }

        .progress-bar {
            font-size: 0.9rem;
            color: var(--text-light);
            font-weight: 500;
        }

        /* Container */
        .container {
            max-width: 900px;
            margin: 0 auto;
            padding: 1.5rem;
        }

        /* Section */
        .section {
            background: var(--card-bg);
            border-radius: 16px;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
            border-left: 4px solid var(--gen);
        }

        .section-title {
            font-size: 1.4rem;
            color: var(--gen);
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .section-title::before {
            content: '';
            width: 8px;
            height: 8px;
            background: var(--gen);
            border-radius: 50%;
        }

        /* Theory Cards */
        .theory-card {
            background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
            border-radius: 12px;
            padding: 1.25rem;
            margin-bottom: 1rem;
            border: 1px solid #e9d5ff;
        }

        .theory-card h4 {
            color: var(--gen);
            margin-bottom: 0.75rem;
            font-size: 1.1rem;
        }

        .theory-card p {
            color: var(--text);
            margin-bottom: 0.5rem;
        }

        /* Example Box */
        .example-box {
            background: #f8fafc;
            border-radius: 10px;
            padding: 1rem;
            margin: 0.75rem 0;
            border-left: 3px solid var(--gen);
        }

        .example-german {
            font-size: 1.1rem;
            color: var(--text);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-wrap: wrap;
        }

        .example-english {
            color: var(--text-light);
            font-size: 0.95rem;
            margin-top: 0.25rem;
            font-style: italic;
        }

        /* Audio Button */
        .audio-btn {
            background: var(--gen);
            color: white;
            border: none;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 0.9rem;
            transition: all 0.2s;
            flex-shrink: 0;
        }

        .audio-btn:hover {
            background: #7c3aed;
            transform: scale(1.1);
        }

        .audio-btn:active {
            transform: scale(0.95);
        }

        /* Table */
        .endings-table {
            width: 100%;
            border-collapse: collapse;
            margin: 1rem 0;
            font-size: 0.95rem;
        }

        .endings-table th,
        .endings-table td {
            padding: 0.75rem;
            text-align: left;
            border: 1px solid var(--border);
        }

        .endings-table th {
            background: var(--gen);
            color: white;
            font-weight: 600;
        }

        .endings-table td {
            background: var(--card-bg);
        }

        .endings-table tr:nth-child(even) td {
            background: #faf5ff;
        }

        /* Gender colors */
        .masc { color: var(--masc); font-weight: 600; }
        .fem { color: var(--fem); font-weight: 600; }
        .neut { color: var(--neut); font-weight: 600; }
        .gen-ending { 
            background: var(--gen); 
            color: white; 
            padding: 2px 6px; 
            border-radius: 4px;
            font-weight: 600;
        }

        /* Prepositions Grid */
        .prep-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 1rem;
            margin: 1rem 0;
        }

        .prep-card {
            background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
            border-radius: 10px;
            padding: 1rem;
            text-align: center;
            border: 2px solid #e9d5ff;
            transition: all 0.2s;
        }

        .prep-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
        }

        .prep-german {
            font-size: 1.3rem;
            font-weight: 700;
            color: var(--gen);
        }

        .prep-english {
            color: var(--text-light);
            font-size: 0.9rem;
            margin-top: 0.25rem;
        }

        /* Exercise Section */
        .exercise-section {
            background: var(--card-bg);
            border-radius: 16px;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        }

        .exercise-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            flex-wrap: wrap;
            gap: 0.5rem;
        }

        .exercise-title {
            font-size: 1.2rem;
            color: var(--gen);
            font-weight: 600;
        }

        .exercise-instruction {
            background: #faf5ff;
            padding: 0.75rem 1rem;
            border-radius: 8px;
            margin-bottom: 1rem;
            color: var(--text);
            border-left: 3px solid var(--gen);
        }

        /* Exercise Items */
        .exercise-item {
            padding: 1rem;
            border-bottom: 1px solid var(--border);
        }

        .exercise-item:last-child {
            border-bottom: none;
        }

        .exercise-number {
            display: inline-block;
            background: var(--gen);
            color: white;
            width: 28px;
            height: 28px;
            border-radius: 50%;
            text-align: center;
            line-height: 28px;
            font-weight: 600;
            font-size: 0.9rem;
            margin-right: 0.5rem;
        }

        .exercise-text {
            display: inline;
        }

        /* Input Styles */
        .input-inline {
            display: inline-block;
            border: 2px solid var(--border);
            border-radius: 6px;
            padding: 0.4rem 0.6rem;
            font-size: 1rem;
            min-width: 120px;
            margin: 0 0.25rem;
            transition: all 0.2s;
        }

        .input-inline:focus {
            outline: none;
            border-color: var(--gen);
            box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
        }

        .input-inline.correct {
            border-color: var(--success);
            background: #f0fdf4;
        }

        .input-inline.incorrect {
            border-color: var(--error);
            background: #fef2f2;
        }

        /* Buttons */
        .btn {
            padding: 0.6rem 1.2rem;
            border-radius: 8px;
            border: none;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }

        .btn-primary {
            background: var(--gen);
            color: white;
        }

        .btn-primary:hover {
            background: #7c3aed;
            transform: translateY(-2px);
        }

        .btn-secondary {
            background: var(--border);
            color: var(--text);
        }

        .btn-secondary:hover {
            background: #cbd5e1;
        }

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

        .btn-success:hover {
            background: #16a34a;
        }

        /* Feedback */
        .feedback {
            margin-top: 0.5rem;
            padding: 0.5rem 0.75rem;
            border-radius: 6px;
            font-size: 0.9rem;
            display: none;
        }

        .feedback.show {
            display: block;
        }

        .feedback.correct {
            background: #f0fdf4;
            color: #166534;
            border: 1px solid #bbf7d0;
        }

        .feedback.incorrect {
            background: #fef2f2;
            color: #991b1b;
            border: 1px solid #fecaca;
        }

        /* Checklist */
        .checklist {
            list-style: none;
        }

        .checklist li {
            padding: 0.75rem 0;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: flex-start;
            gap: 0.75rem;
        }

        .checklist li:last-child {
            border-bottom: none;
        }

        .checklist-checkbox {
            width: 22px;
            height: 22px;
            border: 2px solid var(--gen);
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            flex-shrink: 0;
            margin-top: 2px;
            transition: all 0.2s;
        }

        .checklist-checkbox:hover {
            background: rgba(139, 92, 246, 0.1);
        }

        .checklist-checkbox.checked {
            background: var(--gen);
        }

        .checklist-checkbox.checked::after {
            content: '✓';
            color: white;
            font-size: 0.8rem;
            font-weight: bold;
        }

        /* Connectivity Section */
        .connectivity {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
            margin-top: 2rem;
        }

        .connectivity > div {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 1.25rem;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        }

        .connectivity h4 {
            color: var(--gen);
            margin-bottom: 0.5rem;
            font-size: 1rem;
        }

        .from-prev {
            border-left: 3px solid var(--dat);
        }

        .to-next {
            border-left: 3px solid var(--acc);
        }

        /* Streak Counter */
        .streak-counter {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
            color: white;
            padding: 0.75rem 1rem;
            border-radius: 12px;
            font-weight: 700;
            box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            z-index: 100;
        }

        .streak-counter::before {
            content: '🔥';
        }

        /* Progress Indicator */
        .progress-indicator {
            position: fixed;
            top: 0;
            left: 0;
            height: 4px;
            background: var(--gen);
            transition: width 0.3s;
            z-index: 1000;
        }

        /* Note Box */
        .note-box {
            background: #fffbeb;
            border: 1px solid #fcd34d;
            border-radius: 10px;
            padding: 1rem;
            margin: 1rem 0;
        }

        .note-box strong {
            color: #92400e;
        }

        /* Highlight */
        .highlight {
            background: linear-gradient(120deg, #f3e8ff 0%, #f3e8ff 100%);
            background-repeat: no-repeat;
            background-size: 100% 40%;
            background-position: 0 88%;
            padding: 0 2px;
        }

        /* Translation exercise */
        .translation-item {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            padding: 1rem;
            border-bottom: 1px solid var(--border);
        }

        .translation-prompt {
            font-weight: 500;
            color: var(--text);
        }

        .translation-input {
            width: 100%;
            padding: 0.6rem;
            border: 2px solid var(--border);
            border-radius: 8px;
            font-size: 1rem;
        }

        .translation-input:focus {
            outline: none;
            border-color: var(--gen);
        }

        /* Responsive */
        @media (max-width: 768px) {
            .chapter-title {
                font-size: 1.5rem;
            }

            .chapter-nav {
                flex-direction: column;
                text-align: center;
            }

            .container {
                padding: 1rem;
            }

            .connectivity {
                grid-template-columns: 1fr;
            }

            .endings-table {
                font-size: 0.85rem;
            }

            .endings-table th,
            .endings-table td {
                padding: 0.5rem;
            }

            .streak-counter {
                bottom: 10px;
                right: 10px;
                padding: 0.5rem 0.75rem;
                font-size: 0.9rem;
            }
        }

        /* Animations */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .section, .exercise-section {
            animation: fadeIn 0.5s ease-out;
        }

        /* Stats bar */
        .stats-bar {
            display: flex;
            gap: 1rem;
            justify-content: center;
            flex-wrap: wrap;
            margin-top: 1rem;
        }

        .stat-item {
            background: rgba(255,255,255,0.2);
            padding: 0.4rem 0.8rem;
            border-radius: 20px;
            font-size: 0.85rem;
        }
