/* CSS Variables */
        :root {
            --nom: #3b82f6;
            --acc: #ef4444;
            --dat: #10b981;
            --gen: #8b5cf6;
            --masc: #06b6d4;
            --fem: #ec4899;
            --neut: #f59e0b;
            --primary: #6366f1;
            --primary-dark: #4f46e5;
            --success: #22c55e;
            --error: #ef4444;
            --warning: #f59e0b;
            --bg: #f8fafc;
            --card-bg: #ffffff;
            --text: #1e293b;
            --text-muted: #64748b;
            --border: #e2e8f0;
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
        }

        * {
            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;
            min-height: 100vh;
        }

        /* Header */
        .chapter-header {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 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: 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: 0.5rem 1.5rem;
            border-radius: 2rem;
            font-size: 0.875rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            margin-bottom: 1rem;
            position: relative;
            z-index: 1;
        }

        .chapter-title {
            font-size: clamp(1.75rem, 5vw, 2.5rem);
            font-weight: 800;
            margin-bottom: 0.5rem;
            position: relative;
            z-index: 1;
        }

        .chapter-subtitle {
            font-size: 1.125rem;
            opacity: 0.9;
            position: relative;
            z-index: 1;
        }

        /* Progress & Streak Bar */
        .progress-container {
            background: var(--card-bg);
            padding: 1rem;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
        }

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

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

        .overall-progress {
            flex: 1;
            max-width: 300px;
        }

        .progress-bar {
            height: 8px;
            background: var(--border);
            border-radius: 4px;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--success), #16a34a);
            border-radius: 4px;
            transition: width 0.5s ease;
            width: 0%;
        }

        .progress-text {
            font-size: 0.75rem;
            color: var(--text-muted);
            text-align: right;
            margin-top: 0.25rem;
        }

        /* 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(--primary);
            text-decoration: none;
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
            font-weight: 500;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .chapter-nav a:hover {
            background: rgba(99, 102, 241, 0.1);
        }

        .chapter-nav .nav-center {
            color: var(--text-muted);
            font-size: 0.875rem;
        }

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

        /* Section Styling */
        section {
            margin-bottom: 3rem;
        }

        .section-title {
            font-size: 1.5rem;
            font-weight: 700;
            margin-bottom: 1.5rem;
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .section-title .icon {
            width: 40px;
            height: 40px;
            background: var(--primary);
            color: white;
            border-radius: 0.75rem;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.25rem;
        }

        /* Theory Cards */
        .theory-card {
            background: var(--card-bg);
            border-radius: 1rem;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            box-shadow: var(--shadow);
            border-left: 4px solid var(--primary);
        }

        .theory-card h3 {
            color: var(--primary);
            font-size: 1.125rem;
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

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

        .theory-card p:last-child {
            margin-bottom: 0;
        }

        .note-box {
            background: #fef3c7;
            border-left: 4px solid var(--warning);
            padding: 1rem;
            border-radius: 0 0.5rem 0.5rem 0;
            margin: 1rem 0;
        }

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

        .tip-box {
            background: #dbeafe;
            border-left: 4px solid var(--nom);
            padding: 1rem;
            border-radius: 0 0.5rem 0.5rem 0;
            margin: 1rem 0;
        }

        .tip-box strong {
            color: #1e40af;
        }

        /* Number Tables */
        .number-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
            gap: 0.75rem;
            margin: 1rem 0;
        }

        .number-card {
            background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
            padding: 1rem;
            border-radius: 0.75rem;
            text-align: center;
            transition: all 0.2s;
            cursor: pointer;
        }

        .number-card:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow);
        }

        .number-card .digit {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--primary);
        }

        .number-card .german {
            font-size: 1rem;
            color: var(--text);
            margin-top: 0.25rem;
        }

        .number-card .audio-btn {
            margin-top: 0.5rem;
            background: var(--primary);
            color: white;
            border: none;
            width: 28px;
            height: 28px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 0.75rem;
            transition: all 0.2s;
        }

        .number-card .audio-btn:hover {
            background: var(--primary-dark);
            transform: scale(1.1);
        }

        /* Tables */
        .data-table {
            width: 100%;
            border-collapse: collapse;
            margin: 1rem 0;
            background: var(--card-bg);
            border-radius: 0.75rem;
            overflow: hidden;
            box-shadow: var(--shadow);
        }

        .data-table th {
            background: var(--primary);
            color: white;
            padding: 1rem;
            text-align: left;
            font-weight: 600;
        }

        .data-table td {
            padding: 0.875rem 1rem;
            border-bottom: 1px solid var(--border);
        }

        .data-table tr:last-child td {
            border-bottom: none;
        }

        .data-table tr:hover {
            background: #f8fafc;
        }

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

        .ordinal-card {
            background: var(--card-bg);
            padding: 1rem;
            border-radius: 0.75rem;
            box-shadow: var(--shadow);
            border-top: 3px solid var(--dat);
        }

        .ordinal-card .cardinal {
            font-size: 0.875rem;
            color: var(--text-muted);
        }

        .ordinal-card .ordinal {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--dat);
        }

        /* Exercise Styling */
        .exercise-container {
            background: var(--card-bg);
            border-radius: 1rem;
            padding: 2rem;
            margin-bottom: 2rem;
            box-shadow: var(--shadow-lg);
        }

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

        .exercise-title {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--text);
        }

        .exercise-number {
            background: var(--primary);
            color: white;
            padding: 0.25rem 0.75rem;
            border-radius: 0.5rem;
            font-size: 0.875rem;
            font-weight: 600;
        }

        .exercise-progress {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.875rem;
            color: var(--text-muted);
        }

        .exercise-item {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 1rem;
            background: #f8fafc;
            border-radius: 0.75rem;
            margin-bottom: 0.75rem;
            flex-wrap: wrap;
        }

        .exercise-item .number {
            font-weight: 700;
            color: var(--primary);
            min-width: 30px;
        }

        .exercise-item .prompt {
            flex: 1;
            min-width: 150px;
        }

        .exercise-item input[type="text"] {
            padding: 0.75rem 1rem;
            border: 2px solid var(--border);
            border-radius: 0.5rem;
            font-size: 1rem;
            min-width: 200px;
            transition: all 0.2s;
        }

        .exercise-item input[type="text"]:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
        }

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

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

        .feedback {
            font-size: 0.875rem;
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
            display: none;
        }

        .feedback.show {
            display: block;
        }

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

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

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

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

        .btn-primary:hover {
            background: var(--primary-dark);
            transform: translateY(-1px);
            box-shadow: var(--shadow);
        }

        .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;
        }

        .exercise-actions {
            display: flex;
            gap: 1rem;
            margin-top: 1.5rem;
            flex-wrap: wrap;
        }

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

        .audio-btn-inline:hover {
            background: var(--primary-dark);
            transform: scale(1.1);
        }

        /* Translation Exercise */
        .translation-item {
            padding: 1.25rem;
            background: #f8fafc;
            border-radius: 0.75rem;
            margin-bottom: 1rem;
        }

        .translation-item .english {
            font-size: 1rem;
            margin-bottom: 0.75rem;
            color: var(--text);
        }

        .translation-item input {
            width: 100%;
            max-width: 500px;
        }

        /* Checklist */
        .checklist-container {
            background: var(--card-bg);
            border-radius: 1rem;
            padding: 2rem;
            box-shadow: var(--shadow-lg);
        }

        .checklist-item {
            padding: 1rem;
            border-bottom: 1px solid var(--border);
            cursor: pointer;
            transition: all 0.2s;
        }

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

        .checklist-item:hover {
            background: #f8fafc;
        }

        .checklist-item .question {
            display: flex;
            align-items: flex-start;
            gap: 1rem;
        }

        .checklist-item .checkbox {
            width: 24px;
            height: 24px;
            border: 2px solid var(--border);
            border-radius: 0.375rem;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: all 0.2s;
        }

        .checklist-item.checked .checkbox {
            background: var(--success);
            border-color: var(--success);
            color: white;
        }

        .checklist-item .answer {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
            margin-left: 2.5rem;
            margin-top: 0.5rem;
        }

        .checklist-item.expanded .answer {
            max-height: 500px;
        }

        .checklist-item .answer-content {
            background: #f0fdf4;
            padding: 1rem;
            border-radius: 0.5rem;
            color: #166534;
        }

        /* Bridge Section */
        .connectivity {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1.5rem;
            margin-top: 3rem;
        }

        .bridge-card {
            background: var(--card-bg);
            border-radius: 1rem;
            padding: 1.5rem;
            box-shadow: var(--shadow);
        }

        .bridge-card.from-prev {
            border-left: 4px solid var(--nom);
        }

        .bridge-card.to-next {
            border-left: 4px solid var(--gen);
        }

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

        .bridge-card.from-prev h4 {
            color: var(--nom);
        }

        .bridge-card.to-next h4 {
            color: var(--gen);
        }

        .bridge-card p {
            color: var(--text-muted);
            font-size: 0.9375rem;
        }

        /* Footer */
        footer {
            text-align: center;
            padding: 2rem;
            color: var(--text-muted);
            font-size: 0.875rem;
            border-top: 1px solid var(--border);
            margin-top: 2rem;
        }

        /* Responsive */
        @media (max-width: 640px) {
            .chapter-nav {
                flex-direction: column;
                text-align: center;
            }

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

            .exercise-item {
                flex-direction: column;
                align-items: stretch;
            }

            .exercise-item input[type="text"] {
                width: 100%;
            }

            .number-grid {
                grid-template-columns: repeat(2, 1fr);
            }

            .exercise-actions {
                flex-direction: column;
            }

            .btn {
                width: 100%;
                justify-content: center;
            }
        }

        /* Celebration Animation */
        .celebration {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: var(--success);
            color: white;
            padding: 2rem 3rem;
            border-radius: 1rem;
            font-size: 1.5rem;
            font-weight: 700;
            z-index: 1000;
            display: none;
            animation: celebrate 0.5s ease;
        }

        @keyframes celebrate {
            0% { transform: translate(-50%, -50%) scale(0); }
            50% { transform: translate(-50%, -50%) scale(1.1); }
            100% { transform: translate(-50%, -50%) scale(1); }
        }

        /* Highlight classes */
        .highlight-dat {
            color: var(--dat);
            font-weight: 600;
        }

        .highlight-primary {
            color: var(--primary);
            font-weight: 600;
        }

        code {
            background: #f1f5f9;
            padding: 0.125rem 0.375rem;
            border-radius: 0.25rem;
            font-family: 'Consolas', monospace;
            font-size: 0.9em;
        }
