/* ============================================
           CSS VARIABLES & RESET
           ============================================ */
        :root {
            /* Case colors */
            --nom: #3b82f6;
            --acc: #ef4444;
            --dat: #10b981;
            --gen: #8b5cf6;
            /* Gender colors */
            --masc: #06b6d4;
            --fem: #ec4899;
            --neut: #f59e0b;
            /* Word order specific */
            --verb: #dc2626;
            --subject: #2563eb;
            --object: #059669;
            --time: #7c3aed;
            --manner: #db2777;
            --place: #ea580c;
            /* UI colors */
            --bg: #f8fafc;
            --card: #ffffff;
            --text: #1e293b;
            --text-light: #64748b;
            --border: #e2e8f0;
            --success: #22c55e;
            --error: #ef4444;
            --warning: #f59e0b;
            --primary: #4f46e5;
            --primary-light: #e0e7ff;
            --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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: var(--bg);
            color: var(--text);
            line-height: 1.6;
            padding-bottom: 2rem;
        }

        /* ============================================
           HEADER & NAVIGATION
           ============================================ */
        .chapter-header {
            background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
            color: white;
            padding: 2rem 1rem;
            text-align: center;
        }

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

        .chapter-title {
            font-size: 2rem;
            font-weight: 800;
            margin-bottom: 0.5rem;
        }

        .chapter-subtitle {
            opacity: 0.9;
            font-size: 1.1rem;
        }

        .chapter-nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem;
            background: var(--card);
            border-bottom: 1px solid var(--border);
            position: sticky;
            top: 0;
            z-index: 100;
            flex-wrap: wrap;
            gap: 0.5rem;
        }

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

        .chapter-nav a:hover {
            background: var(--primary-light);
        }

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

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

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

        /* ============================================
           MAIN CONTAINER
           ============================================ */
        .container {
            max-width: 900px;
            margin: 0 auto;
            padding: 1rem;
        }

        /* ============================================
           THEORY CARDS
           ============================================ */
        .theory-section {
            margin: 2rem 0;
        }

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

        .section-title::before {
            content: "";
            width: 4px;
            height: 1.5rem;
            background: var(--primary);
            border-radius: 2px;
        }

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

        .theory-card h3 {
            font-size: 1.125rem;
            margin-bottom: 0.75rem;
            color: var(--primary);
        }

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

        .theory-card ul {
            margin-left: 1.5rem;
            margin-bottom: 1rem;
        }

        .theory-card li {
            margin-bottom: 0.5rem;
        }

        /* ============================================
           WORD ORDER DIAGRAMS
           ============================================ */
        .word-order-diagram {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-wrap: wrap;
            margin: 1rem 0;
            padding: 1rem;
            background: #f1f5f9;
            border-radius: 0.75rem;
            font-family: 'Courier New', monospace;
        }

        .word-box {
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
            font-weight: 600;
            font-size: 0.95rem;
        }

        .word-box.subject {
            background: var(--subject);
            color: white;
        }

        .word-box.verb {
            background: var(--verb);
            color: white;
        }

        .word-box.object {
            background: var(--object);
            color: white;
        }

        .word-box.time {
            background: var(--time);
            color: white;
        }

        .word-box.manner {
            background: var(--manner);
            color: white;
        }

        .word-box.place {
            background: var(--place);
            color: white;
        }

        .arrow {
            color: var(--text-light);
            font-size: 1.2rem;
        }

        /* Satzklammer Diagram */
        .satzklammer {
            margin: 1.5rem 0;
            padding: 1.5rem;
            background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
            border-radius: 1rem;
            border: 2px solid #f59e0b;
        }

        .satzklammer-title {
            font-weight: 700;
            color: #92400e;
            margin-bottom: 1rem;
            text-align: center;
        }

        .bracket-container {
            position: relative;
            padding: 1rem;
            margin: 1rem 0;
        }

        .bracket-line {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
        }

        .bracket-verb {
            background: var(--verb);
            color: white;
            padding: 0.75rem 1.25rem;
            border-radius: 0.5rem;
            font-weight: 700;
        }

        .bracket-content {
            flex: 1;
            text-align: center;
            padding: 1rem;
            background: white;
            border-radius: 0.5rem;
            border: 2px dashed #cbd5e1;
            min-height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .bracket-visual {
            position: relative;
            margin-top: 0.5rem;
        }

        .bracket-curve {
            height: 20px;
            border: 3px solid var(--verb);
            border-top: none;
            border-radius: 0 0 20px 20px;
            margin: 0 1rem;
        }

        /* ============================================
           EXAMPLE BOXES
           ============================================ */
        .example-box {
            background: #f8fafc;
            border: 1px solid var(--border);
            border-radius: 0.75rem;
            padding: 1rem;
            margin: 1rem 0;
        }

        .example-sentence {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            flex-wrap: wrap;
            padding: 0.75rem;
            background: white;
            border-radius: 0.5rem;
            margin-bottom: 0.5rem;
        }

        .example-sentence:last-child {
            margin-bottom: 0;
        }

        .german {
            font-weight: 600;
            color: var(--text);
        }

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

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

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

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

        /* ============================================
           TIME-MANNER-PLACE TABLE
           ============================================ */
        .tmp-table {
            width: 100%;
            border-collapse: collapse;
            margin: 1rem 0;
            background: white;
            border-radius: 0.75rem;
            overflow: hidden;
            box-shadow: var(--shadow);
        }

        .tmp-table th {
            background: linear-gradient(135deg, var(--time) 0%, var(--manner) 50%, var(--place) 100%);
            color: white;
            padding: 1rem;
            text-align: left;
            font-weight: 600;
        }

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

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

        .tmp-badge {
            display: inline-block;
            padding: 0.25rem 0.75rem;
            border-radius: 1rem;
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
        }

        .tmp-badge.time {
            background: var(--time);
            color: white;
        }

        .tmp-badge.manner {
            background: var(--manner);
            color: white;
        }

        .tmp-badge.place {
            background: var(--place);
            color: white;
        }

        /* ============================================
           EXERCISE SECTIONS
           ============================================ */
        .exercise-section {
            background: var(--card);
            border-radius: 1rem;
            padding: 1.5rem;
            margin: 2rem 0;
            box-shadow: var(--shadow);
        }

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

        .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: 1rem;
            font-size: 0.875rem;
            font-weight: 600;
        }

        .exercise-instruction {
            background: var(--primary-light);
            padding: 1rem;
            border-radius: 0.75rem;
            margin-bottom: 1.5rem;
            color: var(--primary);
            font-weight: 500;
        }

        /* Exercise 28.1 - Input sentences */
        .exercise-item {
            margin-bottom: 1.5rem;
            padding: 1rem;
            background: #f8fafc;
            border-radius: 0.75rem;
        }

        .exercise-item .question {
            margin-bottom: 0.75rem;
            font-weight: 500;
        }

        .exercise-item .italic {
            font-style: italic;
            color: var(--primary);
            font-weight: 600;
        }

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

        .exercise-input:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px var(--primary-light);
        }

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

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

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

        .feedback.show {
            display: block;
        }

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

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

        /* Exercise 28.2 - Drag/drop or select */
        .sentence-builder {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.5rem;
            padding: 1rem;
            background: white;
            border-radius: 0.5rem;
            margin-bottom: 0.75rem;
            border: 2px dashed var(--border);
        }

        .sentence-part {
            padding: 0.5rem 1rem;
            background: #e2e8f0;
            border-radius: 0.5rem;
            font-weight: 500;
        }

        .sentence-part.insert {
            background: var(--primary-light);
            color: var(--primary);
            border: 2px dashed var(--primary);
            min-width: 150px;
            text-align: center;
        }

        .position-select {
            padding: 0.5rem 1rem;
            border: 2px solid var(--primary);
            border-radius: 0.5rem;
            background: white;
            font-size: 0.95rem;
            cursor: pointer;
        }

        /* Exercise 28.3 - Word ordering */
        .word-bank {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-bottom: 1rem;
            padding: 1rem;
            background: #f1f5f9;
            border-radius: 0.75rem;
        }

        .draggable-word {
            padding: 0.5rem 1rem;
            background: white;
            border: 2px solid var(--border);
            border-radius: 0.5rem;
            cursor: move;
            font-weight: 500;
            transition: all 0.2s;
            user-select: none;
        }

        .draggable-word:hover {
            border-color: var(--primary);
            transform: translateY(-2px);
            box-shadow: var(--shadow);
        }

        .draggable-word.dragging {
            opacity: 0.5;
        }

        .drop-zone {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            min-height: 60px;
            padding: 1rem;
            background: white;
            border: 2px dashed var(--border);
            border-radius: 0.75rem;
            margin-bottom: 1rem;
        }

        .drop-zone.drag-over {
            background: var(--primary-light);
            border-color: var(--primary);
        }

        .ordered-word {
            padding: 0.5rem 1rem;
            background: var(--primary);
            color: white;
            border-radius: 0.5rem;
            font-weight: 500;
            cursor: pointer;
        }

        .ordered-word:hover {
            background: #dc2626;
        }

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

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

        /* 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: #4338ca;
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
        }

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

        .btn-group {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
            margin-top: 1rem;
        }

        /* ============================================
           CHECKLIST
           ============================================ */
        .checklist-section {
            background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
            border-radius: 1rem;
            padding: 1.5rem;
            margin: 2rem 0;
            border: 2px solid var(--success);
        }

        .checklist-title {
            font-size: 1.25rem;
            font-weight: 700;
            color: #065f46;
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .checklist-title::before {
            content: "✓";
            width: 28px;
            height: 28px;
            background: var(--success);
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
        }

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

        .checklist-item:hover {
            box-shadow: var(--shadow);
        }

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

        .checklist-item label {
            flex: 1;
            cursor: pointer;
            color: #065f46;
        }

        .checklist-item.checked {
            background: #dcfce7;
        }

        /* ============================================
           CONNECTIVITY (BRIDGE) SECTION
           ============================================ */
        .connectivity {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
            margin: 2rem 0;
        }

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

        .from-prev {
            background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
            border-left: 4px solid var(--primary);
        }

        .to-next {
            background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
            border-left: 4px solid var(--neut);
        }

        .connectivity h4 {
            font-size: 1rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
        }

        .from-prev h4 {
            color: var(--primary);
        }

        .to-next h4 {
            color: #92400e;
        }

        .connectivity p {
            font-size: 0.9rem;
            color: var(--text);
        }

        /* ============================================
           STREAK COUNTER & PROGRESS
           ============================================ */
        .stats-bar {
            display: flex;
            justify-content: center;
            gap: 2rem;
            padding: 1rem;
            background: var(--card);
            border-radius: 1rem;
            margin: 1rem 0;
            box-shadow: var(--shadow);
        }

        .stat-item {
            text-align: center;
        }

        .stat-value {
            font-size: 1.5rem;
            font-weight: 800;
            color: var(--primary);
        }

        .stat-label {
            font-size: 0.75rem;
            color: var(--text-light);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        /* Progress indicator */
        .progress-container {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: var(--border);
            z-index: 1000;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--primary), #7c3aed);
            width: 0%;
            transition: width 0.3s ease;
        }

        /* ============================================
           VERB POSITION VISUAL
           ============================================ */
        .verb-position-visual {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1rem;
            margin: 1rem 0;
        }

        .position-card {
            background: white;
            border-radius: 0.75rem;
            padding: 1rem;
            border: 2px solid var(--border);
        }

        .position-card h4 {
            font-size: 0.875rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-light);
            margin-bottom: 0.5rem;
        }

        .position-card .position-number {
            font-size: 2rem;
            font-weight: 800;
            color: var(--verb);
            margin-bottom: 0.5rem;
        }

        .position-card.main-clause {
            border-color: var(--verb);
        }

        .position-card.sub-clause {
            border-color: var(--gen);
        }

        .position-card.question {
            border-color: var(--acc);
        }

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

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

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

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

            .word-order-diagram {
                font-size: 0.85rem;
            }

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

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

            .stats-bar {
                gap: 1rem;
            }
        }

        /* ============================================
           ANIMATIONS
           ============================================ */
        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.05); }
        }

        .pulse {
            animation: pulse 2s infinite;
        }

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

        .theory-card,
        .exercise-section {
            animation: slideIn 0.5s ease-out;
        }

        /* ============================================
           HINT BOX
           ============================================ */
        .hint-box {
            background: #fef3c7;
            border-left: 4px solid #f59e0b;
            padding: 1rem;
            border-radius: 0 0.5rem 0.5rem 0;
            margin: 1rem 0;
        }

        .hint-box::before {
            content: "💡 ";
        }

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

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

        /* ============================================
           WORD HIGHLIGHTING
           ============================================ */
        .highlight-verb {
            color: var(--verb);
            font-weight: 700;
        }

        .highlight-subject {
            color: var(--subject);
            font-weight: 700;
        }

        .highlight-time {
            color: var(--time);
            font-weight: 700;
        }

        .highlight-manner {
            color: var(--manner);
            font-weight: 700;
        }

        .highlight-place {
            color: var(--place);
            font-weight: 700;
        }

        /* ============================================
           SENTENCE PATTERN TABLE
           ============================================ */
        .pattern-table {
            width: 100%;
            border-collapse: collapse;
            margin: 1rem 0;
            background: white;
            border-radius: 0.75rem;
            overflow: hidden;
            box-shadow: var(--shadow);
        }

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

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

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

        .pattern-table code {
            background: #f1f5f9;
            padding: 0.25rem 0.5rem;
            border-radius: 0.25rem;
            font-family: 'Courier New', monospace;
            font-size: 0.9rem;
        }
