/* 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;
            --shadow: 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: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg);
            color: var(--text);
            line-height: 1.6;
            padding: 0;
        }

        /* Header */
        .chapter-header {
            background: linear-gradient(135deg, var(--nom) 0%, var(--acc) 50%, var(--dat) 100%);
            color: white;
            padding: 2rem 1rem;
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .chapter-header::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
        }

        .chapter-badge {
            display: inline-block;
            background: rgba(255,255,255,0.2);
            padding: 0.5rem 1.5rem;
            border-radius: 50px;
            font-size: 0.9rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 1rem;
        }

        .chapter-header h1 {
            font-size: 2.5rem;
            margin-bottom: 0.5rem;
            position: relative;
        }

        .chapter-header p {
            opacity: 0.9;
            font-size: 1.1rem;
            position: relative;
        }

        /* Streak Counter */
        .streak-bar {
            background: var(--card-bg);
            padding: 1rem;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 1rem;
            border-bottom: 1px solid var(--border);
            flex-wrap: wrap;
        }

        .streak-display {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-weight: 600;
            color: var(--text);
        }

        .streak-display .fire {
            font-size: 1.5rem;
        }

        .progress-pills {
            display: flex;
            gap: 0.3rem;
        }

        .pill {
            width: 30px;
            height: 8px;
            background: var(--border);
            border-radius: 4px;
            transition: all 0.3s ease;
        }

        .pill.completed {
            background: linear-gradient(90deg, var(--success), #16a34a);
        }

        .pill.current {
            background: var(--nom);
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.6; }
        }

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

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

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

        .chapter-nav .prev::before {
            content: '← ';
        }

        .chapter-nav .next::after {
            content: ' →';
        }

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

        /* Main Content */
        .container {
            max-width: 900px;
            margin: 0 auto;
            padding: 2rem 1rem;
        }

        .section {
            background: var(--card-bg);
            border-radius: 16px;
            padding: 2rem;
            margin-bottom: 2rem;
            box-shadow: var(--shadow);
        }

        .section h2 {
            font-size: 1.5rem;
            margin-bottom: 1.5rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .section h3 {
            font-size: 1.2rem;
            margin: 1.5rem 0 1rem;
            color: var(--text);
        }

        /* Theory Cards */
        .theory-card {
            background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
            border-left: 4px solid var(--nom);
            padding: 1.5rem;
            border-radius: 12px;
            margin-bottom: 1.5rem;
        }

        .theory-card.acc {
            background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
            border-left-color: var(--acc);
        }

        .theory-card.dat {
            background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
            border-left-color: var(--dat);
        }

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

        .theory-card.acc h4 {
            color: var(--acc);
        }

        .theory-card.dat h4 {
            color: var(--dat);
        }

        /* Pronoun Tables */
        .pronoun-table {
            width: 100%;
            border-collapse: collapse;
            margin: 1.5rem 0;
            font-size: 0.95rem;
        }

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

        .pronoun-table th {
            background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
            font-weight: 600;
            color: var(--text);
        }

        .pronoun-table tr:nth-child(even) {
            background: #f8fafc;
        }

        .pronoun-table tr:hover {
            background: #f0f9ff;
        }

        .pronoun-table .nom-cell {
            color: var(--nom);
            font-weight: 600;
        }

        .pronoun-table .acc-cell {
            color: var(--acc);
            font-weight: 600;
        }

        .pronoun-table .dat-cell {
            color: var(--dat);
            font-weight: 600;
        }

        .pronoun-table .masc {
            color: var(--masc);
        }

        .pronoun-table .fem {
            color: var(--fem);
        }

        .pronoun-table .neut {
            color: var(--neut);
        }

        /* Audio Button */
        .audio-btn {
            background: linear-gradient(135deg, var(--nom), #2563eb);
            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;
            margin-left: 0.5rem;
            vertical-align: middle;
        }

        .audio-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
        }

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

        /* Example Box */
        .example-box {
            background: #f8fafc;
            border-radius: 12px;
            padding: 1.25rem;
            margin: 1rem 0;
            border: 1px solid var(--border);
        }

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

        .example-box .english {
            color: var(--text-light);
            font-style: italic;
        }

        /* Gender Cards */
        .gender-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1rem;
            margin: 1.5rem 0;
        }

        .gender-card {
            padding: 1.5rem;
            border-radius: 12px;
            text-align: center;
        }

        .gender-card.masc {
            background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
            border: 2px solid var(--masc);
        }

        .gender-card.fem {
            background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
            border: 2px solid var(--fem);
        }

        .gender-card.neut {
            background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
            border: 2px solid var(--neut);
        }

        .gender-card h4 {
            font-size: 1.2rem;
            margin-bottom: 0.5rem;
        }

        .gender-card .pronoun {
            font-size: 2rem;
            font-weight: 700;
            margin: 0.5rem 0;
        }

        .gender-card.masc .pronoun { color: var(--masc); }
        .gender-card.fem .pronoun { color: var(--fem); }
        .gender-card.neut .pronoun { color: var(--neut); }

        /* Phrase Cards */
        .phrase-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1rem;
            margin: 1.5rem 0;
        }

        .phrase-card {
            background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
            border: 2px solid var(--dat);
            border-radius: 12px;
            padding: 1.25rem;
            transition: transform 0.2s;
        }

        .phrase-card:hover {
            transform: translateY(-2px);
        }

        .phrase-card .german {
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--dat);
            margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .phrase-card .english {
            color: var(--text-light);
        }

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

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

        .exercise-header h2 {
            font-size: 1.3rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .exercise-badge {
            background: linear-gradient(135deg, var(--nom), #2563eb);
            color: white;
            padding: 0.4rem 1rem;
            border-radius: 50px;
            font-size: 0.85rem;
            font-weight: 600;
        }

        .exercise-instruction {
            background: #f0f9ff;
            border-left: 4px solid var(--nom);
            padding: 1rem 1.25rem;
            margin-bottom: 1.5rem;
            border-radius: 0 8px 8px 0;
            color: var(--text);
        }

        .exercise-instruction code {
            background: rgba(59, 130, 246, 0.1);
            padding: 0.2rem 0.4rem;
            border-radius: 4px;
            font-family: inherit;
            color: var(--nom);
        }

        /* Exercise Items */
        .exercise-item {
            background: #f8fafc;
            border-radius: 12px;
            padding: 1.25rem;
            margin-bottom: 1rem;
            border: 2px solid transparent;
            transition: all 0.3s;
        }

        .exercise-item:hover {
            border-color: var(--border);
        }

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

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

        .exercise-number {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 28px;
            height: 28px;
            background: var(--nom);
            color: white;
            border-radius: 50%;
            font-size: 0.85rem;
            font-weight: 600;
            margin-right: 0.75rem;
        }

        .exercise-text {
            font-size: 1.05rem;
            margin-bottom: 0.75rem;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 0.5rem;
        }

        /* Input Styles */
        .input-inline {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }

        .answer-input {
            padding: 0.5rem 0.75rem;
            border: 2px solid var(--border);
            border-radius: 8px;
            font-size: 1rem;
            min-width: 120px;
            transition: all 0.2s;
        }

        .answer-input:focus {
            outline: none;
            border-color: var(--nom);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

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

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

        .answer-input:disabled {
            background: #f1f5f9;
            cursor: not-allowed;
        }

        /* Select Dropdown */
        .answer-select {
            padding: 0.5rem 0.75rem;
            border: 2px solid var(--border);
            border-radius: 8px;
            font-size: 1rem;
            background: white;
            cursor: pointer;
            transition: all 0.2s;
        }

        .answer-select:focus {
            outline: none;
            border-color: var(--nom);
        }

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

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

        /* Check Button */
        .check-btn {
            background: linear-gradient(135deg, var(--nom), #2563eb);
            color: white;
            border: none;
            padding: 0.6rem 1.25rem;
            border-radius: 8px;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            margin-left: 0.5rem;
        }

        .check-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
        }

        .check-btn:active {
            transform: translateY(0);
        }

        .check-btn:disabled {
            background: #94a3b8;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        /* Feedback */
        .feedback {
            margin-top: 0.75rem;
            padding: 0.75rem 1rem;
            border-radius: 8px;
            font-size: 0.95rem;
            display: none;
        }

        .feedback.show {
            display: block;
            animation: slideIn 0.3s ease;
        }

        .feedback.correct {
            background: #dcfce7;
            color: #166534;
        }

        .feedback.incorrect {
            background: #fee2e2;
            color: #991b1b;
        }

        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Action Buttons */
        .action-btns {
            display: flex;
            gap: 1rem;
            margin-top: 1.5rem;
            flex-wrap: wrap;
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--nom), #2563eb);
            color: white;
            border: none;
            padding: 0.75rem 1.5rem;
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
        }

        .btn-secondary {
            background: white;
            color: var(--text);
            border: 2px solid var(--border);
            padding: 0.75rem 1.5rem;
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-secondary:hover {
            border-color: var(--nom);
            color: var(--nom);
        }

        /* Checklist */
        .checklist {
            background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
            border: 2px solid var(--gen);
            border-radius: 16px;
            padding: 2rem;
        }

        .checklist h2 {
            color: var(--gen);
            margin-bottom: 1.5rem;
        }

        .checklist-item {
            display: flex;
            align-items: flex-start;
            gap: 1rem;
            padding: 1rem;
            background: white;
            border-radius: 10px;
            margin-bottom: 0.75rem;
            cursor: pointer;
            transition: all 0.2s;
        }

        .checklist-item:hover {
            transform: translateX(4px);
            box-shadow: var(--shadow);
        }

        .checklist-item input[type="checkbox"] {
            width: 22px;
            height: 22px;
            accent-color: var(--gen);
            cursor: pointer;
            flex-shrink: 0;
            margin-top: 2px;
        }

        .checklist-item label {
            cursor: pointer;
            flex: 1;
            line-height: 1.5;
        }

        .checklist-item.checked {
            opacity: 0.7;
        }

        .checklist-item.checked label {
            text-decoration: line-through;
        }

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

        @media (max-width: 600px) {
            .connectivity {
                grid-template-columns: 1fr;
            }
        }

        .connectivity > div {
            padding: 1.5rem;
            border-radius: 12px;
        }

        .from-prev {
            background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
            border: 2px solid var(--nom);
        }

        .to-next {
            background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
            border: 2px solid var(--neut);
        }

        .connectivity h4 {
            font-size: 1rem;
            margin-bottom: 0.75rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .from-prev h4 { color: var(--nom); }
        .to-next h4 { color: #ca8a04; }

        .connectivity p {
            color: var(--text);
            font-size: 0.95rem;
            line-height: 1.6;
        }

        /* Footer */
        .chapter-footer {
            text-align: center;
            padding: 2rem;
            color: var(--text-light);
            font-size: 0.9rem;
        }

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

            .section, .exercise-section {
                padding: 1.5rem;
            }

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

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

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

            .chapter-nav a {
                width: 100%;
            }
        }

        /* Tips Box */
        .tip-box {
            background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
            border-left: 4px solid var(--neut);
            padding: 1.25rem;
            border-radius: 0 12px 12px 0;
            margin: 1.5rem 0;
        }

        .tip-box h4 {
            color: #b45309;
            margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

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

        .tip-box p:last-child {
            margin-bottom: 0;
        }

        /* Verb Endings Table */
        .verb-endings {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 1rem;
            margin: 1rem 0;
        }

        .ending-group {
            background: white;
            border-radius: 10px;
            padding: 1rem;
            border: 1px solid var(--border);
        }

        .ending-group h5 {
            color: var(--nom);
            margin-bottom: 0.75rem;
            font-size: 1rem;
        }

        .ending-row {
            display: flex;
            justify-content: space-between;
            padding: 0.4rem 0;
            border-bottom: 1px dashed var(--border);
        }

        .ending-row:last-child {
            border-bottom: none;
        }

        .ending-row span:first-child {
            font-weight: 600;
            color: var(--nom);
        }

        .ending-row span:last-child {
            color: var(--text-light);
            font-family: monospace;
        }

        /* Highlight */
        .highlight {
            background: linear-gradient(180deg, transparent 60%, rgba(59, 130, 246, 0.2) 60%);
            padding: 0 2px;
        }

        .highlight-acc {
            background: linear-gradient(180deg, transparent 60%, rgba(239, 68, 68, 0.2) 60%);
            padding: 0 2px;
        }

        .highlight-dat {
            background: linear-gradient(180deg, transparent 60%, rgba(16, 185, 129, 0.2) 60%);
            padding: 0 2px;
        }

        /* Translation Exercise */
        .translation-item {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

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

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

        .translation-input:focus {
            outline: none;
            border-color: var(--nom);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .translation-hint {
            font-size: 0.85rem;
            color: var(--text-light);
            font-style: italic;
        }

        /* Score Display */
        .score-display {
            background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
            border: 2px solid var(--success);
            border-radius: 12px;
            padding: 1rem 1.5rem;
            text-align: center;
            margin-top: 1.5rem;
        }

        .score-display.hidden {
            display: none;
        }

        .score-display h4 {
            color: var(--success);
            margin-bottom: 0.5rem;
        }

        .score-value {
            font-size: 2rem;
            font-weight: 700;
            color: var(--success);
        }
