/**
 * TELC B1 — Современный минималистичный дизайн
 *
 * ПРИНЦИПЫ ДИЗАЙНА 2025:
 * ✨ Минимализм — чистый, воздушный интерфейс без лишних элементов
 * ⬜ White space — щедрые отступы (spacing-sm до spacing-xl)
 * 🌈 Градиенты — плавные переходы цветов для акцентов и заголовков
 * 📐 Grid — адаптивная сетка через CSS Grid (auto-fit, minmax)
 * 🌗 Dark mode — переключение через data-theme
 * 🔤 Inter — современный шрифт Google Fonts с вариативными весами
 * ♿ Accessibility — prefers-reduced-motion, семантичная разметка, WCAG контраст
 *
 * ЦВЕТОВАЯ ПАЛИТРА:
 * - Приглушенные, успокаивающие тона
 * - 4 градиента для разных разделов (Lesen, Hören, Schreiben, Sprechen)
 * - Переключение на темную тему вручную
 */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT@0,9..144,400..900,0..100;1,9..144,400..900,0..100&family=Geist:wght@400;500;600&family=Inter+Tight:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============================================
   ТОКЕНЫ ДИЗАЙНА 2025
   ============================================ */

:root {
    /* Типографика */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Отступы (white space) */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 3rem;
    --spacing-xl: 4rem;

    /* Анимация */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

    /* Радиусы */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Градиенты */
    --gradient-accent-1: linear-gradient(135deg, #6366f1, #4f46e5);
    --gradient-accent-2: linear-gradient(135deg, #8b5cf6, #7c3aed);
    --gradient-accent-3: linear-gradient(135deg, #ec4899, #db2777);
    --gradient-accent-4: linear-gradient(135deg, #f59e0b, #ea580c);
}

/* ============================================
   СВЕТЛАЯ ТЕМА (по умолчанию)
   ============================================ */

:root,
html[data-theme="light"] {
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-surface-muted: #f8f9fa;
    --color-text: #1a1a1a;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-shadow: rgba(0, 0, 0, 0.06);
    --color-shadow-md: rgba(0, 0, 0, 0.10);
    --color-shadow-lg: rgba(0, 0, 0, 0.15);

    /* Акценты */
    --color-accent-1: #4f46e5;
    --color-accent-2: #7c3aed;
    --color-accent-3: #be185d;
    --color-accent-4: #c2410c;

    /* Состояния */
    --color-focus: #6366f1;
    --color-focus-ring: rgba(99, 102, 241, 0.2);
    --color-action-bg: #4f46e5;
    --color-danger: #b91c1c;
    --color-warning-text: #9a3412;

    /* Compatibility aliases */
    --color-card-bg: var(--color-surface);
    --color-text-light: var(--color-text-muted);
    --color-text-secondary: var(--color-text-muted);
}

/* ============================================
   ТЁМНАЯ ТЕМА
   ============================================ */

html[data-theme="dark"] {
    --color-bg: #0a0a0a;
    --color-surface: #1a1a1a;
    --color-surface-muted: #171717;
    --color-text: #f5f5f5;
    --color-text-muted: #a3a3a3;
    --color-border: #2d2d2d;
    --color-shadow: rgba(0, 0, 0, 0.3);
    --color-shadow-md: rgba(0, 0, 0, 0.5);
    --color-shadow-lg: rgba(0, 0, 0, 0.7);

    /* Акценты - чуть ярче для тёмного фона */
    --color-accent-1: #818cf8;
    --color-accent-2: #a78bfa;
    --color-accent-3: #f472b6;
    --color-accent-4: #fbbf24;

    /* Состояния */
    --color-focus: #818cf8;
    --color-focus-ring: rgba(129, 140, 248, 0.3);
    --color-action-bg: #4f46e5;
    --color-danger: #f87171;
    --color-warning-text: #fbbf24;

    /* Compatibility aliases */
    --color-card-bg: var(--color-surface);
    --color-text-light: var(--color-text-muted);
    --color-text-secondary: var(--color-text-muted);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    padding: var(--spacing-md);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.container {
    width: 100%;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    animation: fadeInDown 0.6s ease-out;
}

.title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--spacing-xs);
    background: linear-gradient(135deg, var(--color-accent-1), var(--color-accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--color-text-light);
    font-weight: 300;
}

/* Cards Grid */
.main-content {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

body.home-page .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Card Styles */
.card {
    background: var(--color-card-bg);
    border-radius: 24px;
    padding: var(--spacing-lg);
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition);
    box-shadow: 0 4px 6px var(--color-shadow);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

body.home-page .card {
    aspect-ratio: 1 / 1;
    justify-content: center;
    gap: 0.75rem;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

/* Explanation details */
.text-explanation {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: linear-gradient(180deg, var(--color-surface-muted), var(--color-surface));
    box-shadow: 0 12px 24px var(--color-shadow);
}

.text-explanation-summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--color-text);
    transition: var(--transition-fast);
}

.text-explanation-summary::-webkit-details-marker {
    display: none;
}

.text-explanation-summary::marker {
    content: '';
}

.text-explanation-summary::after {
    content: '+';
    font-size: 0.85em;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.text-explanation[open] .text-explanation-summary::after {
    content: '-';
    opacity: 0.9;
}

.text-explanation-summary:hover {
    background: var(--color-surface);
}

.text-explanation-summary:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.text-explanation-content {
    margin-top: 0.6rem;
    display: grid;
    gap: 0.4rem;
    color: var(--color-text-muted);
}

.text-explanation[open] .text-explanation-content {
    animation: explanation-in 0.35s ease-out;
}

.text-explanation-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.text-explanation-text,
.text-explanation-evidence {
    margin: 0;
}

.text-explanation-evidence {
    font-style: italic;
}

.gap-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    margin: 0 2px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-muted);
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.9em;
    line-height: 1;
}

@keyframes explanation-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .text-explanation[open] .text-explanation-content {
        animation: none;
    }
    .text-explanation-summary::after {
        transition: none;
    }
}

/* Status lines */
.text-status-line {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.86rem;
    color: var(--color-text-muted);
}

.text-status-line + .text-status-line {
    margin-top: 0.15rem;
}

.richtig,
.falsch,
.text-status.is-correct .text-status-line:first-child,
.text-status.is-wrong .text-status-line:first-child {
    padding-left: 0.55rem;
    border-left: 2px solid transparent;
    border-radius: 2px;
    color: var(--color-text);
}

.richtig,
.text-status.is-correct .text-status-line:first-child {
    border-left-color: rgba(34, 197, 94, 0.55);
}

.falsch,
.text-status.is-wrong .text-status-line:first-child {
    border-left-color: rgba(239, 68, 68, 0.55);
}

.card:hover::before {
    transform: scaleX(1);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--color-shadow);
}

.card-icon {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-sm);
    transition: var(--transition);
}

.card:hover .card-icon {
    transform: scale(1.1);
}

.card-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.card-description {
    font-size: 1rem;
    color: var(--color-text-light);
    font-weight: 300;
}

/* Индивидуальные цвета для карточек */
.card-lesen {
    --gradient-start: var(--color-accent-1);
    --gradient-end: #4f46e5;
}

.card-horen {
    --gradient-start: var(--color-accent-2);
    --gradient-end: #7c3aed;
}

.card-schreiben {
    --gradient-start: var(--color-accent-3);
    --gradient-end: #db2777;
}

.card-sprechen {
    --gradient-start: var(--color-accent-4);
    --gradient-end: #ea580c;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    color: var(--color-text-light);
    font-weight: 300;
    animation: fadeIn 0.6s ease-out 0.4s both;
}

.footer-links {
    margin-top: var(--spacing-sm);
    display: inline-flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 400;
}

.footer-links a:hover {
    color: var(--color-text);
    text-decoration: underline;
}

/* Privacy Settings button in footer */
.footer-link-btn {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    padding: 0;
}

.footer-link-btn:hover {
    color: var(--color-text);
    text-decoration: underline;
}

.footer-link-btn:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .card {
        padding: var(--spacing-md);
    }

    body {
        padding: var(--spacing-sm);
    }

    body.home-page .cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    body.home-page .cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ============================================
   ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ (левый верхний угол)
   ============================================ */

.theme-toggle {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--color-shadow);
    transition: var(--transition-fast);
    font-size: 1.25rem;
    color: var(--color-text);
}

/* Переключатель темы теперь находится в site-header */
.site-nav .theme-toggle {
    /* Убрано fixed позиционирование, теперь кнопка остается в navigation */
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px var(--color-shadow-md);
    border-color: var(--color-focus);
}

.theme-toggle:active {
    transform: scale(1);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* Адаптив для переключателя */
@media (max-width: 768px) {
    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1.125rem;
    }
}

/* ============================================
   ОБЩИЙ HEADER (для всех страниц)
   ============================================ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-sm) var(--spacing-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px var(--color-shadow);
}

.site-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "logo breadcrumbs exam-switch nav";
    align-items: center;
    column-gap: var(--spacing-sm);
    min-height: 44px;
}

.exam-switcher {
    grid-area: exam-switch;
    display: inline-flex;
    align-items: center;
    padding: 0.2rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-muted);
    white-space: nowrap;
}

.exam-switcher a {
    padding: 0.38rem 0.72rem;
    border-radius: var(--radius-full);
    color: var(--color-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
}

.exam-switcher a:hover {
    color: var(--color-text);
}

.exam-switcher a:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.exam-switcher a[aria-current="page"] {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 1px 4px var(--color-shadow);
}

.site-logo {
    grid-area: logo;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: -0.02em;
    transition: var(--transition-fast);
}

.site-logo:hover {
    color: var(--color-accent-1);
}

.site-logo:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 4px;
    border-radius: 4px;
}

.site-nav {
    grid-area: nav;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    justify-content: flex-end;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.938rem;
    font-weight: 500;
    transition: var(--transition-fast);
    cursor: pointer;
    font-family: inherit;
}

.back-btn:hover {
    background: var(--color-surface-muted);
    border-color: var(--color-focus);
    transform: translateX(-2px);
}

.back-btn:active {
    transform: translateX(0);
}

.back-btn:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* Адаптив для header */
@media (max-width: 768px) {
    .site-header {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .site-logo {
        font-size: 1.125rem;
    }

    .back-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .auth-widget {
        width: 100%;
        justify-content: flex-end;
    }

    .auth-email {
        display: none;
    }
}

/* ============================================
   LESEN PAGE - Task Cards (Минимализм 2025)
   ============================================ */

/* Task Card Container */
.task-card {
    background: var(--color-card-bg);
    border-radius: 24px;
    padding: var(--spacing-lg);
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    transition: var(--transition);
    box-shadow: 0 2px 8px var(--color-shadow);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
}

.task-card[hidden] {
    display: none;
}

/* Градиентный акцент - тонкая полоска сверху */
.task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, linear-gradient(90deg, var(--color-accent-1), var(--color-accent-2)));
    opacity: 0.8;
}

/* Subtle Hover Lift */
.task-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px var(--color-shadow);
    border-color: rgba(99, 102, 241, 0.1);
}

/* ============================================
   MONETIZATION UI
   ============================================ */

.auth-widget {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.5rem;
}

.auth-email {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
}

.auth-btn {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
}

.auth-btn:hover {
    border-color: var(--color-focus);
    transform: translateY(-1px);
}

.auth-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.auth-btn.secondary {
    background: transparent;
}

.auth-hidden {
    display: none;
}

#premium-badge {
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-accent-1);
    color: white;
}

.premium-hidden {
    display: none;
}

.gate-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* Ensure Google FC consent dialog appears above gate */
.fc-consent-root,
.fc-dialog-overlay,
.fc-dialog-container,
div[id^="fc-dialog"],
iframe[id*="googlefc"] {
    z-index: 2147483647 !important;
}

.gate-overlay[hidden] {
    display: none;
}

.gate-content {
    max-width: 420px;
    width: 100%;
    background: #121212;
    color: #f5f5f5;
    border-radius: 24px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.gate-content h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.gate-content p {
    margin-bottom: 1.5rem;
    color: rgba(255, 255, 255, 0.75);
}

.gate-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gate-btn.primary {
    background: linear-gradient(135deg, #47b0ff, #00d4ff);
    color: #0b0b0b;
}

.gate-btn.premium {
    background: linear-gradient(135deg, #ffb347, #ffcc33);
    color: #1a1206;
}

.gate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.gate-link {
    background: transparent;
    border: none;
    color: #93c5fd;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}

.gate-locked {
    overflow: hidden;
}

/* ============================================
   ADBLOCK GATE
   ============================================ */

.adblock-gate {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease-out;
}

.adblock-gate[hidden] {
    display: none;
}

.adblock-gate-content {
    max-width: 520px;
    width: 100%;
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--color-border);
    box-shadow: 0 20px 50px var(--color-shadow-lg);
    animation: slideUp 0.3s ease-out;
}

.adblock-gate-content h2 {
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
}

.adblock-gate-content p {
    margin-bottom: 1.5rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.adblock-gate-message-en {
    margin-top: -0.75rem;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

.adblock-gate-actions {
    display: flex;
    justify-content: center;
}

.adblock-gate-btn {
    border: none;
    border-radius: var(--radius-full);
    padding: 0.75rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--color-accent-1);
    color: #fff;
    cursor: pointer;
    transition: var(--transition-fast);
    min-width: 220px;
}

.adblock-gate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px var(--color-shadow);
}

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

.adblock-locked {
    overflow: hidden;
}

html.adblock-checking body.adblock-locked > * {
    visibility: hidden;
}

html.adblock-checking body.adblock-locked #adblock-gate,
html.adblock-checking body.adblock-locked #adblock-gate * {
    visibility: visible;
}

@media (max-width: 720px) {
    .adblock-gate-content {
        padding: 1.5rem;
    }

    .adblock-gate-btn {
        width: 100%;
    }
}

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

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    grid-template-areas:
        "main"
        "bottom";
}

.study-rail,
.ad-sidebar {
    width: 300px;
}

.ad-slot {
    width: 100%;
}

.ad-slot-sidebar {
    min-height: 250px;
}

.ad-slot-bottom {
    min-height: 96px;
}

.study-rail {
    grid-area: left;
    display: none;
}

.ad-sidebar.left {
    grid-area: left;
    display: none;
}

.ad-sidebar.right {
    grid-area: right;
    display: none;
}

.main-content {
    grid-area: main;
}

.ad-bottom {
    grid-area: bottom;
    display: none;
    width: 100%;
    margin-top: var(--spacing-lg);
}

/* Task container width control */
.task-container,
.main-content {
    max-width: 80%;
    margin: 0 auto;
}

body.ads-visible .task-container,
body.ads-visible .main-content,
body.ads-reserved .task-container,
body.ads-reserved .main-content,
body.study-panel-visible .task-container,
body.study-panel-visible .main-content {
    max-width: 100%;
}

body.home-page.study-panel-visible:not(.ads-visible):not(.ads-reserved) .task-container,
body.home-page.study-panel-visible:not(.ads-visible):not(.ads-reserved) .main-content {
    max-width: 80%;
}

body.ads-visible .content-wrapper,
body.ads-reserved .content-wrapper {
    grid-template-columns: 300px minmax(0, 1fr) 300px;
    grid-template-areas:
        "left main right"
        "bottom bottom bottom";
    align-items: start;
}

body.ads-visible .ad-sidebar,
body.ads-reserved .ad-sidebar {
    display: block;
    position: sticky;
    top: 5rem;
}

body.ads-visible .study-rail,
body.ads-reserved .study-rail,
body.study-panel-visible .study-rail {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 5rem;
}

body.ads-visible .ad-bottom,
body.ads-reserved .ad-bottom {
    display: block;
}

body.study-panel-visible .content-wrapper {
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas:
        "left main"
        "bottom bottom";
    align-items: start;
}

body.study-panel-visible.ads-visible .content-wrapper,
body.study-panel-visible.ads-reserved .content-wrapper {
    grid-template-columns: 300px minmax(0, 1fr) 300px;
    grid-template-areas:
        "left main right"
        "bottom bottom bottom";
}

body.home-page.study-panel-visible:not(.ads-visible):not(.ads-reserved) .content-wrapper {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "main"
        "bottom";
}

body.home-page.study-panel-visible:not(.ads-visible):not(.ads-reserved) .study-rail {
    display: none;
}

/* ============================================
   APP-PROMO „Learn German B1 Words“ (site-core.js)
   Karte in der Seitenleiste bzw. unter dem Inhalt, Kontext-Hinweis nach einer
   Übung und auf /woerter. Farben kommen aus den Theme-Variablen (Dark Mode).
   ============================================ */

.app-tile {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--gradient-accent-1);
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(79, 70, 229, 0.8);
}

.vocab-card.app-card {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
    box-shadow: 0 18px 40px -28px var(--color-shadow-lg);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.vocab-card.app-card:hover,
.vocab-card.app-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--color-accent-1);
    box-shadow: 0 24px 48px -30px var(--color-shadow-lg);
    outline: none;
}

.vocab-card.app-card:focus-visible {
    box-shadow: 0 0 0 4px var(--color-focus-ring);
}

.vocab-card-inline {
    max-width: 360px;
    margin: 32px auto 0;
}

.app-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-card-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.app-card-name b {
    font-size: 0.9375rem;
    font-weight: 700;
}

.app-card-name small {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.app-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
}

.app-card-points {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9375rem;
    line-height: 1.35;
}

.app-card-points span {
    position: relative;
    padding-left: 22px;
}

.app-card-points span::before {
    content: "✓";
    position: absolute;
    left: 2px;
    top: 0;
    font-weight: 700;
    color: var(--color-accent-1);
}

.app-card-qr {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
}

.app-card-qr img {
    flex: none;
    width: 98px;
    height: 98px;
    border-radius: 6px;
    background: #fff;
}

.app-card-qr small {
    font-size: 0.8125rem;
    line-height: 1.35;
    color: var(--color-text-muted);
}

.app-card-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: var(--radius-full);
    background: var(--color-action-bg);
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
}

.app-card-cta svg {
    flex: none;
}

.app-nudge {
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 1.25rem 0;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent-1);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    text-align: left;
    box-shadow: 0 12px 30px -24px var(--color-shadow-lg);
    animation: app-nudge-in 0.28s ease-out both;
}

@keyframes app-nudge-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.app-nudge-body {
    flex: 1;
    min-width: 0;
}

/* Doppelte Klasse: seitenweite „p“-Regeln (z. B. auf /woerter) sollen nicht greifen. */
.app-nudge .app-nudge-title {
    max-width: none;
    margin: 0 0 4px;
    color: var(--color-text);
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
}

.app-nudge .app-nudge-text {
    max-width: none;
    margin: 0 0 12px;
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    line-height: 1.45;
    text-align: left;
}

.app-nudge-text b {
    color: var(--color-text);
    font-weight: 650;
}

.app-nudge-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.app-nudge-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    background: var(--color-action-bg);
    color: #fff;
    font-weight: 650;
    text-decoration: none;
}

.app-nudge-cta:hover,
.app-nudge-cta:focus-visible {
    filter: brightness(1.1);
    color: #fff;
}

.app-nudge-qr {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-nudge-qr img {
    flex: none;
    width: 98px;
    height: 98px;
    border-radius: 6px;
    box-shadow: 0 0 0 1px var(--color-border);
    background: #fff;
}

.app-nudge-qr > span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-nudge-qr small {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.app-nudge-weblink {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-accent-1);
}

.app-nudge-later {
    min-height: 44px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: var(--color-text-muted);
    font: inherit;
    font-size: 0.875rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.app-nudge-later:hover {
    color: var(--color-text);
}

.app-nudge--woerter {
    width: 100%;
    max-width: 560px;
}

/* Leiste unter der Kopfzeile (nur Android): steht im Seitenfluss und scrollt mit
   weg — keine fixierte Position, überdeckt also nie Inhalt. */
.app-strip {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.app-strip-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.5rem 0.4rem var(--spacing-md, 1rem);
}

.app-strip-link {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 48px;
    color: var(--color-text);
    text-decoration: none;
}

.app-strip .app-tile {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    box-shadow: none;
}

.app-strip-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

/* Store-Titel sind je Sprache unterschiedlich lang: bis zu zwei Zeilen statt „…“. */
.app-strip-copy b {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 0.875rem;
    font-weight: 650;
}

.app-strip-copy small {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-strip-cta {
    flex: none;
    margin-left: auto;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-full);
    background: var(--color-action-bg);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 650;
    white-space: nowrap;
}

.app-strip-close {
    flex: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.app-strip-close:hover {
    color: var(--color-text);
}

/* Seitenweite Linkfarben (z. B. im Blogtext) dürfen den Button nicht umfärben. */
.app-nudge a.app-nudge-cta,
.app-nudge a.app-nudge-cta:hover,
.app-nudge a.app-nudge-cta:focus-visible {
    color: #fff;
    text-decoration: none;
}

/* Schmale Handys: App-Name hat Vorrang vor dem Icon. */
@media (max-width: 480px) {
    .app-strip .app-tile {
        display: none;
    }

    .app-strip-cta {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* Sehr schmal (≤ 380px): Untertitel darf umbrechen statt abgeschnitten zu werden. */
@media (max-width: 380px) {
    .app-strip-copy small {
        white-space: normal;
    }
}

/* Blogartikel, /woerter-Karteikarten, Modelltest-Ergebnis */
.app-nudge--article {
    margin: 1.75rem 0;
}

.app-nudge--session {
    width: 100%;
    max-width: 560px;
    margin: 1.25rem auto 0;
}

.app-nudge--mt {
    margin: 1.5rem 0;
}

/* Dezente Links */
.footer-app {
    margin: 0.9rem 0 0;
    font-size: 0.875rem;
}

.footer-app {
    max-width: 620px;
    margin-inline: auto;
}

/* inline-block statt flex: bricht der Text um, bleibt das Icon an der ersten Zeile. */
.footer-app a {
    display: inline-block;
    padding: 0.6rem 0;
    line-height: 1.5;
    color: var(--color-text-muted);
    font-weight: 500;
    text-decoration: none;
}

.footer-app a:hover,
.footer-app a:focus-visible {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-app svg,
.related-link--app svg {
    flex: none;
    color: var(--color-accent-1);
}

.footer-app svg {
    display: inline;
    vertical-align: -2px;
    margin-right: 0.35rem;
}

.exercise-related .related-link.related-link--app {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* /woerter: Sprachen, die es schon in der App gibt */
.lang-grid .lang-btn.lang-btn--app {
    border-style: dashed;
    border-color: var(--color-accent-1);
    cursor: pointer;
}

.lang-grid .lang-btn--app .lang-badge {
    background: var(--color-action-bg);
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .app-nudge {
        animation: none;
    }

    .vocab-card.app-card {
        transition: none;
    }
}

.kidavo-card-wrap {
    min-height: 600px;
}

.kidavo-card {
    position: relative;
    display: block;
    width: 100%;
    max-width: 300px;
    height: 600px;
    overflow: hidden;
    text-decoration: none;
    cursor: pointer;
    color: #f1efe7;
    background: #0f1a1f;
    border-radius: 4px;
    box-shadow: 0 12px 28px rgba(15, 26, 31, 0.22);
    box-sizing: border-box;
    font-family: 'Geist', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.kidavo-card:hover,
.kidavo-card:focus-visible {
    outline: none;
}

.kidavo-card:hover .kidavo-card-action,
.kidavo-card:focus-visible .kidavo-card-action {
    transform: translateY(-1px);
}

.kidavo-card-branding {
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    z-index: 2;
}

.kidavo-card-wordmark {
    color: #f1efe7;
    font-family: 'Fraunces', 'Times New Roman', serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1;
}

.kidavo-card-wordmark span {
    opacity: 0.45;
}

.kidavo-card-tagline {
    margin-top: 4px;
    color: rgba(241, 239, 231, 0.55);
    font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 1.4px;
    line-height: 1.3;
    text-transform: uppercase;
}

.kidavo-card-stage {
    position: absolute;
    top: 110px;
    left: 24px;
    right: 24px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.kidavo-card-stage-label {
    color: rgba(241, 239, 231, 0.5);
    font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 1.4px;
    line-height: 1.3;
    text-transform: uppercase;
}

.kidavo-card-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    width: 220px;
}

.kidavo-card-cell {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    background: rgba(241, 239, 231, 0.08);
    border-radius: 2px;
}

.kidavo-card-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #c86d3e;
    background: oklch(0.66 0.16 38);
    border-radius: 2px;
    opacity: 0;
    animation: kidavo-sweep 4s ease-in-out infinite;
    animation-delay: var(--kidavo-delay, 0s);
}

.kidavo-card-formula {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 4px;
    font-family: 'Fraunces', 'Times New Roman', serif;
    font-size: 28px;
    font-weight: 600;
    line-height: 1;
}

.kidavo-card-formula-left {
    animation: kidavo-blink 2s ease-in-out infinite;
}

.kidavo-card-formula-right {
    color: #c86d3e;
    color: oklch(0.66 0.16 38);
}

.kidavo-card-bottom {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 24px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kidavo-card-headline {
    color: #f1efe7;
    font-family: 'Fraunces', 'Times New Roman', serif;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.05;
}

.kidavo-card-headline em {
    color: #c86d3e;
    color: oklch(0.66 0.16 38);
    font-style: italic;
}

.kidavo-card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    padding: 12px 16px;
    background: #c86d3e;
    background: oklch(0.66 0.16 38);
    border-radius: 999px;
    color: #111;
    font-family: 'Geist', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1;
    transition: transform 0.2s ease;
}

.kidavo-card-arrow {
    font-size: 14px;
    line-height: 1;
}

@keyframes kidavo-sweep {
    0% {
        opacity: 0;
        transform: scale(0.6);
    }
    20%,
    80% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.4);
    }
}

@keyframes kidavo-blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

@media (max-width: 1200px) {
    body.ads-visible .content-wrapper,
    body.ads-reserved .content-wrapper {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "left"
            "main"
            "right"
            "bottom";
    }

    body.study-panel-visible .content-wrapper {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "left"
            "main"
            "bottom";
    }

    body.study-panel-visible.ads-visible .content-wrapper,
    body.study-panel-visible.ads-reserved .content-wrapper {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "left"
            "main"
            "right"
            "bottom";
    }

    body.ads-visible .ad-sidebar,
    body.ads-reserved .ad-sidebar {
        display: block;
        position: static;
        justify-self: center;
        width: min(100%, 300px);
    }

    body.ads-visible .study-rail,
    body.ads-reserved .study-rail,
    body.study-panel-visible .study-rail {
        display: flex;
        position: static;
        justify-self: center;
        width: min(100%, 300px);
    }

    .study-rail:has(.vocab-card) #ad-left {
        display: none;
        min-height: 0;
    }

    body.home-page.ads-visible .content-wrapper,
    body.home-page.ads-reserved .content-wrapper,
    body.home-page.study-panel-visible .content-wrapper {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "main"
            "bottom";
    }

    body.home-page.ads-visible .ad-sidebar,
    body.home-page.ads-reserved .ad-sidebar,
    body.home-page.ads-visible .study-rail,
    body.home-page.ads-reserved .study-rail,
    body.home-page.study-panel-visible .study-rail {
        display: none;
    }
}

@media (max-width: 640px) {
    body {
        padding: var(--spacing-xs);
    }

    .task-container,
    .main-content {
        max-width: 100% !important;
        padding: var(--spacing-sm);
    }
}

@media (max-width: 360px) {
    body {
        padding: 0.5rem;
    }

    .task-container,
    .main-content {
        padding: 0;
    }
}

/* ============================================
   ACCOUNT PAGE
   ============================================ */

.account-page .account-container {
    max-width: 960px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md) var(--spacing-xl);
    display: grid;
    gap: var(--spacing-lg);
}

.account-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: var(--spacing-lg);
    box-shadow: 0 10px 24px var(--color-shadow);
}

.account-grid {
    display: grid;
    gap: var(--spacing-lg);
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.account-card h2 {
    margin-bottom: 0.75rem;
}

.account-placeholder {
    border: 1px dashed var(--color-border);
    background: var(--color-surface-muted);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.account-placeholder strong {
    display: block;
    font-weight: 600;
}

.account-placeholder p {
    margin: 0.35rem 0 0;
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.account-form {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.account-input {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--color-bg);
}

.account-input:disabled {
    background: var(--color-surface-muted);
    color: var(--color-text-light);
    cursor: not-allowed;
}

.account-label {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 0.35rem;
}

.account-button {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.1rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--color-action-bg);
    color: white;
    font-family: inherit;
}

.account-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.account-button.secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.account-note {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: var(--color-surface-muted);
    font-size: 0.85rem;
}

.auth-error {
    margin-top: 0.75rem;
    color: #f87171;
    font-size: 0.85rem;
    display: none;
}

.auth-error-visible {
    display: block;
}

/* Focus state для accessibility */
.task-card:focus,
.task-card:focus-visible {
    outline: 3px solid var(--color-accent-1);
    outline-offset: 3px;
}

/* Task Card Header */
.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.task-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text);
    flex: 1;
}

/* Badge для статуса */
.task-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.task-badge.completed {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.task-badge.in-progress {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.task-badge.not-started {
    background: rgba(107, 114, 128, 0.15);
    color: var(--color-text-light);
}

/* Task Description */
.task-card-description {
    font-size: 0.938rem;
    color: var(--color-text-light);
    line-height: 1.6;
    margin-bottom: var(--spacing-xs);
}

/* Task Meta Info */
.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-top: auto;
    padding-top: var(--spacing-sm);
    border-top: 1px solid rgba(107, 114, 128, 0.1);
}

.task-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.task-meta-icon {
    font-size: 1rem;
    opacity: 0.7;
}

/* Task Tags */
.task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: var(--spacing-xs);
}

.task-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--color-accent-1);
    font-weight: 500;
}

/* Gradient Variants - используем accent из manifest */
.task-card[data-accent="blue"] {
    --card-accent: linear-gradient(90deg, #3b82f6, #2563eb);
}

.task-card[data-accent="purple"] {
    --card-accent: linear-gradient(90deg, #8b5cf6, #7c3aed);
}

.task-card[data-accent="pink"] {
    --card-accent: linear-gradient(90deg, #ec4899, #db2777);
}

.task-card[data-accent="orange"] {
    --card-accent: linear-gradient(90deg, #f59e0b, #ea580c);
}

.task-card[data-accent="green"] {
    --card-accent: linear-gradient(90deg, #10b981, #059669);
}

.task-card[data-accent="indigo"] {
    --card-accent: linear-gradient(90deg, #6366f1, #4f46e5);
}

/* Animation - Staggered Fade In */
.task-card {
    animation: taskFadeIn 0.5s ease-out backwards;
}

.task-card:nth-child(1) { animation-delay: 0.05s; }
.task-card:nth-child(2) { animation-delay: 0.1s; }
.task-card:nth-child(3) { animation-delay: 0.15s; }
.task-card:nth-child(4) { animation-delay: 0.2s; }
.task-card:nth-child(5) { animation-delay: 0.25s; }
.task-card:nth-child(6) { animation-delay: 0.3s; }

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

/* Difficulty Indicator */
.difficulty-dots {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.difficulty-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-light);
    opacity: 0.3;
}

.difficulty-dot.active {
    opacity: 1;
    background: var(--color-accent-1);
}

/* Responsive adjustments for Lesen page */
@media (max-width: 768px) {
    .task-card {
        padding: var(--spacing-md);
    }

    .task-card-title {
        font-size: 1rem;
    }

    .task-meta {
        font-size: 0.813rem;
    }
}


/* Accessibility - High Contrast Mode */
@media (prefers-contrast: high) {
    .task-card {
        border: 2px solid var(--color-text);
    }

    .task-badge {
        border: 1px solid currentColor;
    }
}

/* Reduced motion - disable staggered animations */
@media (prefers-reduced-motion: reduce) {
    .task-card {
        animation: none !important;
    }
}

/* ============================================
   ПОДСВЕТКА РЕЗУЛЬТАТОВ ПОИСКА
   ============================================ */

mark {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: var(--color-text);
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    font-weight: 600;
}

html[data-theme="dark"] mark {
    background: linear-gradient(135deg, #713f12 0%, #854d0e 100%);
    color: #fef3c7;
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */

.lang-switcher {
    display: inline-flex;
    gap: 0.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 0.2rem;
    background: var(--color-surface-muted);
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
    line-height: 1;
}

.lang-btn:hover {
    color: var(--color-text);
    background: var(--color-surface);
}

.lang-btn.active {
    background: var(--color-accent-1);
    color: #fff;
}

/* ============================================
   BLOG HUB & ARTICLE PAGES
   ============================================ */

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.blog-card {
    background: var(--color-card-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: var(--transition);
    box-shadow: 0 2px 8px var(--color-shadow);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent-1), var(--color-accent-2));
    opacity: 0.7;
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px var(--color-shadow-md);
    border-color: rgba(99, 102, 241, 0.15);
}

.blog-card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.4;
}

.blog-card p {
    font-size: 0.938rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    flex: 1;
}

.blog-card .blog-card-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

/* Blog Article Page */
.blog-article {
    max-width: 780px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md);
}

.blog-article-header {
    margin-bottom: var(--spacing-lg);
}

.blog-article-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-accent-1);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.blog-article-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.02em;
}

.blog-article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.blog-article-body {
    line-height: 1.8;
    font-size: 1.05rem;
}

.blog-article-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.01em;
}

.blog-article-body h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.blog-article-body p {
    margin-bottom: var(--spacing-sm);
    color: var(--color-text);
}

.blog-article-body ul,
.blog-article-body ol {
    margin-bottom: var(--spacing-sm);
    padding-left: 1.5rem;
}

.blog-article-body li {
    margin-bottom: 0.5rem;
}

.blog-article-body blockquote {
    margin: var(--spacing-md) 0;
    padding: var(--spacing-sm) var(--spacing-md);
    border-left: 4px solid var(--color-accent-1);
    background: var(--color-surface-muted);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--color-text-muted);
}

.blog-article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0;
    font-size: 0.95rem;
}

.blog-article-body th,
.blog-article-body td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    text-align: left;
}

.blog-article-body th {
    background: var(--color-surface-muted);
    font-weight: 600;
}

.blog-article-body a {
    color: var(--color-accent-1);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-article-body a:hover {
    color: var(--color-accent-2);
}

.blog-article-body strong {
    font-weight: 600;
}

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

    .blog-article {
        padding: var(--spacing-md) var(--spacing-sm);
    }

    .blog-article-body {
        font-size: 1rem;
    }

    .blog-article-body table {
        font-size: 0.85rem;
    }

    .blog-article-body th,
    .blog-article-body td {
        padding: 0.5rem 0.6rem;
    }
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */

.lang-switcher {
    display: flex;
    align-items: center;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 2px;
    gap: 2px;
}

.lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--color-text-muted);
    background: transparent;
    transition: var(--transition-fast);
    line-height: 1;
}

.lang-btn:hover {
    color: var(--color-text);
    background: var(--color-surface);
}

.lang-btn.active {
    background: var(--color-accent-1);
    color: white;
}

.lang-btn.active:hover {
    background: var(--color-accent-1);
    color: white;
}

@media (max-width: 768px) {
    .lang-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* ============================================
   BLOG HUB
   ============================================ */

.blog-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    animation: fadeInDown 0.6s ease-out;
}

.blog-header h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--spacing-xs);
    background: linear-gradient(135deg, #10b981, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.blog-header p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--color-text-muted);
    font-weight: 300;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.blog-card {
    background: var(--color-card-bg);
    border-radius: 24px;
    padding: var(--spacing-lg);
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    transition: var(--transition);
    box-shadow: 0 2px 8px var(--color-shadow);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #10b981, #059669);
    opacity: 0.8;
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px var(--color-shadow);
    border-color: rgba(16, 185, 129, 0.1);
}

.blog-card-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    font-weight: 500;
    width: fit-content;
}

.blog-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

.blog-card-excerpt {
    font-size: 0.938rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.blog-card-meta {
    font-size: 0.813rem;
    color: var(--color-text-muted);
    margin-top: auto;
    padding-top: var(--spacing-sm);
    border-top: 1px solid rgba(107, 114, 128, 0.1);
}

/* ============================================
   BLOG ARTICLE
   ============================================ */

.blog-article {
    max-width: 780px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md);
}

.blog-article-header {
    margin-bottom: var(--spacing-lg);
}

.blog-article-header h1 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin-bottom: var(--spacing-xs);
}

.blog-article-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    font-weight: 500;
    display: inline-block;
    margin-bottom: var(--spacing-sm);
}

.blog-article-meta {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.blog-article-body h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
    color: var(--color-text);
}

.blog-article-body h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    color: var(--color-text);
}

.blog-article-body p {
    color: var(--color-text-muted);
    line-height: 1.8;
    margin-bottom: var(--spacing-sm);
}

.blog-article-body ul,
.blog-article-body ol {
    color: var(--color-text-muted);
    line-height: 1.8;
    padding-left: 1.5rem;
    margin-bottom: var(--spacing-sm);
}

.blog-article-body li {
    margin-bottom: 0.5rem;
}

.blog-article-body blockquote {
    border-left: 3px solid #10b981;
    padding: var(--spacing-sm) var(--spacing-md);
    margin: var(--spacing-md) 0;
    background: var(--color-surface-muted);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--color-text);
    font-style: italic;
}

.blog-article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0;
    font-size: 0.938rem;
}

.blog-article-body th,
.blog-article-body td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    text-align: left;
}

.blog-article-body th {
    background: var(--color-surface-muted);
    font-weight: 600;
    color: var(--color-text);
}

.blog-article-body td {
    color: var(--color-text-muted);
}

.blog-article-body strong {
    color: var(--color-text);
}

body.grammar-page .grammar-lesson-exercise-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    margin: calc(-1 * var(--spacing-sm)) 0 var(--spacing-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border);
    border-left: 4px solid #10b981;
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
}

body.grammar-page .grammar-lesson-exercise-link strong {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--color-text);
    font-size: 1rem;
}

body.grammar-page .grammar-lesson-exercise-link p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

body.grammar-page .grammar-lesson-exercise-link a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    white-space: nowrap;
    border-radius: var(--radius-full);
    background: var(--color-accent-1);
    color: #ffffff;
    font-weight: 700;
    padding: 0.6rem 1rem;
    text-decoration: none;
    transition: var(--transition-fast);
}

body.grammar-page .grammar-lesson-exercise-link a:hover {
    background: var(--color-accent-2);
    transform: translateY(-1px);
}

body.grammar-page .grammar-lesson-exercise-link a:focus-visible {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
}

/* Blog card on index page */
.card-blog {
    --gradient-start: #10b981;
    --gradient-end: #059669;
}

/* Wörter card on index page */
.card-woerter {
    --gradient-start: #6366f1;
    --gradient-end: #7c3aed;
}

/* Grammatik card on index page */
.card-grammatik {
    --gradient-start: #0ea5e9;
    --gradient-end: #2563eb;
}

/* Modelltest card on index page */
.card-modelltest {
    --gradient-start: #f59e0b;
    --gradient-end: #d97706;
}

/* Diagnose card on index page */
.card-diagnose {
    --gradient-start: #14b8a6;
    --gradient-end: #0d9488;
}

/* "Trainer & mehr"-Sektion auf der Startseite */
.trainer-section {
    max-width: 1100px;
    margin: 1.5rem auto 0;
    padding: 0 1rem;
}
.trainer-heading {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text, #1a1a1a);
    margin: 0 0 0.75rem;
    text-align: center;
}
.trainer-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
}
.trainer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    color: var(--color-text, #1f2937);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.trainer-link:hover {
    border-color: var(--color-text-muted, #9ca3af);
    transform: translateY(-1px);
}
.trainer-icon {
    font-size: 1.1rem;
    line-height: 1;
}

body.grammar-page .title,
body.grammar-page .blog-article-header h1,
body.grammar-page .blog-article-body h2 {
    overflow-wrap: anywhere;
}

body.grammar-page .blog-article-body table {
    table-layout: fixed;
}

body.grammar-page .blog-article-body th,
body.grammar-page .blog-article-body td {
    overflow-wrap: anywhere;
}

body.grammar-page .grammar-table-scroll {
    overflow-x: auto;
    margin: var(--spacing-md) 0;
}

body.grammar-page .grammar-table-scroll table {
    min-width: 760px;
    margin: 0;
    table-layout: auto;
}

body.grammar-page .grammar-table-scroll th,
body.grammar-page .grammar-table-scroll td {
    overflow-wrap: normal;
    white-space: nowrap;
}

body.grammar-page .blog-card--coming-soon {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #6b7280;
    box-shadow: none;
    cursor: default;
}

body.grammar-page .blog-card--coming-soon::before {
    background: #9ca3af;
    opacity: 0.55;
}

body.grammar-page .blog-card--coming-soon:hover {
    transform: none;
    border-color: #d1d5db;
    box-shadow: none;
}

body.grammar-page .blog-card--coming-soon h2,
body.grammar-page .blog-card--coming-soon p,
body.grammar-page .blog-card--coming-soon .blog-card-meta {
    color: #6b7280;
}

body.grammar-page .blog-card--coming-soon .blog-card-meta {
    border-top-color: #d1d5db;
}

html[data-theme="dark"] body.grammar-page .blog-card--coming-soon {
    background: #202020;
    border-color: #3f3f46;
}

html[data-theme="dark"] body.grammar-page .blog-card--coming-soon h2,
html[data-theme="dark"] body.grammar-page .blog-card--coming-soon p,
html[data-theme="dark"] body.grammar-page .blog-card--coming-soon .blog-card-meta {
    color: #a3a3a3;
}

html[data-theme="dark"] body.grammar-page .blog-card--coming-soon .blog-card-meta {
    border-top-color: #3f3f46;
}

body.grammar-page .grammar-tabs {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto var(--spacing-md);
    padding: 6px;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
}

body.grammar-page .grammar-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

body.grammar-page .grammar-tab:hover {
    color: var(--color-text);
}

body.grammar-page .grammar-tab.active {
    background: linear-gradient(135deg, var(--color-accent-1), var(--color-accent-2));
    color: #ffffff;
    box-shadow: 0 4px 12px var(--color-shadow-md);
}

body.grammar-page .grammar-tab:focus-visible {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
}

body.grammar-page .grammar-tab-panel[hidden] {
    display: none;
}

body.grammar-page .grammar-exercises-grid {
    align-items: start;
}

body.grammar-page .grammar-exercise-card::before {
    background: linear-gradient(90deg, #10b981, #059669);
}

body.grammar-page .grammar-exercise-main {
    max-width: 1040px;
    margin: 0 auto var(--spacing-lg);
}

body.grammar-page .grammar-exercise-static {
    margin-bottom: var(--spacing-lg);
    padding: clamp(1rem, 3vw, 1.75rem);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: 0 10px 28px var(--color-shadow);
}

body.grammar-page .grammar-exercise-static > p,
body.grammar-page .grammar-static-help p {
    max-width: 78ch;
    color: var(--color-text-muted);
    line-height: 1.75;
}

body.grammar-page .grammar-static-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 0.75rem;
    margin: var(--spacing-md) 0;
    padding: 0;
    list-style: none;
}

body.grammar-page .grammar-static-item {
    padding: 0.85rem 1rem;
    border-left: 4px solid var(--color-accent-1);
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
    color: var(--color-text);
    line-height: 1.55;
}

body.grammar-page .grammar-static-help {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

body.grammar-page .grammar-static-help h2 {
    margin-bottom: 0.5rem;
    font-size: clamp(1.25rem, 2.5vw, 1.65rem);
}

/* Statische Aufgabenübersicht unter der interaktiven Übung: ohne JS lesbar und druckbar. */
body.grammar-page .grammar-exercise-overview {
    margin-top: var(--spacing-lg);
    padding: clamp(1rem, 3vw, 1.75rem);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: 0 10px 28px var(--color-shadow);
}

body.grammar-page .grammar-overview-intro {
    max-width: 78ch;
    margin-bottom: var(--spacing-md);
    color: var(--color-text-muted);
    line-height: 1.75;
}

body.grammar-page .grammar-overview-block {
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

body.grammar-page .grammar-overview-block:first-of-type {
    padding-top: 0;
    border-top: 0;
}

body.grammar-page .grammar-overview-block h3 {
    margin-bottom: 0.35rem;
    font-size: clamp(1.05rem, 2vw, 1.25rem);
}

body.grammar-page .grammar-overview-instruction,
body.grammar-page .grammar-overview-example {
    max-width: 78ch;
    margin-bottom: 0.5rem;
    color: var(--color-text-muted);
    line-height: 1.65;
}

body.grammar-page .grammar-overview-example em {
    color: var(--color-text);
    font-style: normal;
    font-weight: 600;
}

body.grammar-page .grammar-overview-items,
body.grammar-page .grammar-overview-answers {
    margin: 0 0 0.75rem;
    padding-left: 1.5rem;
    color: var(--color-text);
    line-height: 1.7;
}

body.grammar-page .grammar-overview-items li,
body.grammar-page .grammar-overview-answers li {
    margin-bottom: 0.25rem;
}

body.grammar-page .grammar-overview-fields,
body.grammar-page .grammar-overview-accepted {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

body.grammar-page .grammar-overview-pair {
    display: inline-block;
    margin-right: 0.75rem;
    white-space: nowrap;
}

body.grammar-page .grammar-overview-solutions {
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
    overflow: hidden;
}

body.grammar-page .grammar-overview-solutions summary {
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--color-text);
    list-style: none;
}

body.grammar-page .grammar-overview-solutions summary::-webkit-details-marker {
    display: none;
}

body.grammar-page .grammar-overview-solutions summary::after {
    content: ' +';
    color: var(--color-text-muted);
}

body.grammar-page .grammar-overview-solutions[open] summary::after {
    content: ' \2212';
}

body.grammar-page .grammar-overview-solutions summary:focus-visible {
    outline: 2px solid var(--color-accent-1);
    outline-offset: -2px;
}

body.grammar-page .grammar-overview-solutions .grammar-overview-answers {
    margin: 0;
    padding: 0 1rem 0.85rem 2.5rem;
}

body.grammar-page .grammar-practice-card {
    grid-column: 1 / -1;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 28px var(--color-shadow);
    padding: var(--spacing-md);
}

body.grammar-page .grammar-practice-header {
    max-width: 860px;
    margin-bottom: var(--spacing-md);
}

body.grammar-page .grammar-practice-kicker {
    display: inline-flex;
    width: fit-content;
    margin-bottom: var(--spacing-xs);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-accent-1);
    font-size: 0.85rem;
    font-weight: 700;
}

body.grammar-page .grammar-exercise-static > .grammar-practice-kicker {
    color: var(--color-accent-1);
}

body.grammar-page .grammar-practice-header h1,
body.grammar-page .grammar-practice-header h2 {
    margin-bottom: 0.5rem;
    color: var(--color-text);
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    line-height: 1.2;
}

body.grammar-page .grammar-practice-header p {
    color: var(--color-text-muted);
    line-height: 1.7;
}

body.grammar-page .grammar-progress-summary {
    display: grid;
    gap: 0.45rem;
    max-width: 680px;
    margin-top: 1rem;
}

body.grammar-page .grammar-progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

body.grammar-page .grammar-progress-label {
    color: var(--color-text);
    font-size: 0.95rem;
    font-weight: 700;
}

body.grammar-page .grammar-progress-value {
    color: var(--color-accent-1);
    font-size: 1rem;
}

body.grammar-page .grammar-progress-track {
    height: 10px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-muted);
}

body.grammar-page .grammar-progress-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, #10b981, #059669);
    transition: width 0.2s ease;
}

body.grammar-page .grammar-progress-detail {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

body.grammar-page .grammar-practice-form {
    display: grid;
    gap: var(--spacing-md);
}

body.grammar-page .grammar-task-list {
    display: grid;
    gap: var(--spacing-sm);
    list-style: none;
    counter-reset: grammar-task;
}

body.grammar-page .grammar-task {
    counter-increment: grammar-task;
    display: grid;
    gap: 0.85rem;
    padding: var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
}

body.grammar-page .grammar-task h2,
body.grammar-page .grammar-task h3 {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--color-text);
    font-size: 1.05rem;
    line-height: 1.35;
}

body.grammar-page .grammar-task h2::before,
body.grammar-page .grammar-task h3::before {
    content: counter(grammar-task);
    display: inline-grid;
    place-items: center;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    background: var(--color-accent-1);
    color: #ffffff;
    font-size: 0.9rem;
}

body.grammar-page .grammar-task-instruction {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

body.grammar-page .grammar-task-items {
    display: grid;
    gap: 0.85rem;
}

body.grammar-page .grammar-task-item {
    display: grid;
    gap: 0.65rem;
}

body.grammar-page .grammar-task-item--article-pair {
    align-items: start;
    grid-template-columns: minmax(80px, 0.35fr) minmax(0, 1fr);
    column-gap: 0.75rem;
}

body.grammar-page .grammar-task-example {
    display: grid;
    gap: 0.4rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

body.grammar-page .grammar-task-example strong {
    color: var(--color-accent-1);
    font-size: 0.85rem;
}

body.grammar-page .grammar-task-example p,
body.grammar-page .grammar-example-answer {
    color: var(--color-text);
    font-size: 0.95rem;
}

body.grammar-page .grammar-example-answer ul {
    display: grid;
    gap: 0.2rem;
    margin: 0;
    padding-left: 1.2rem;
}

body.grammar-page .grammar-task-prompt {
    color: var(--color-text);
    font-weight: 600;
}

body.grammar-page .grammar-input-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

body.grammar-page .grammar-article-pair-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.grammar-page .grammar-answer-stack {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

body.grammar-page .grammar-input-field {
    display: grid;
    gap: 0.35rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

body.grammar-page .grammar-practice-input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    padding: 0.7rem 0.8rem;
    transition: var(--transition-fast);
}

body.grammar-page .grammar-practice-input:focus {
    border-color: var(--color-accent-1);
    box-shadow: 0 0 0 4px var(--color-focus-ring);
    outline: none;
}

body.grammar-page .grammar-practice-input.is-correct {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.08);
}

body.grammar-page .grammar-practice-input.is-wrong {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

body.grammar-page .grammar-input-feedback {
    min-height: 1.2em;
    color: var(--color-text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

body.grammar-page .grammar-practice-input.is-correct + .grammar-input-feedback {
    color: #15803d;
}

body.grammar-page .grammar-practice-input.is-wrong + .grammar-input-feedback {
    color: #b91c1c;
}

body.grammar-page .grammar-task-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

body.grammar-page .grammar-task-check-button {
    min-height: 40px;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
}

body.grammar-page .grammar-task-result {
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 700;
}

body.grammar-page .grammar-practice-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--color-border);
}

body.grammar-page .grammar-practice-button {
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: var(--color-accent-1);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    min-height: 44px;
    padding: 0.7rem 1.2rem;
    transition: var(--transition-fast);
}

body.grammar-page .grammar-practice-button:hover {
    background: var(--color-accent-2);
    transform: translateY(-1px);
}

body.grammar-page .grammar-practice-button:focus-visible {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
}

body.grammar-page .grammar-practice-button--secondary {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

body.grammar-page .grammar-practice-button--secondary:hover {
    background: var(--color-surface-muted);
}

body.grammar-page .grammar-practice-result {
    color: var(--color-text);
    font-weight: 700;
}

html[data-theme="dark"] body.grammar-page .grammar-practice-input.is-correct {
    background: rgba(34, 197, 94, 0.12);
}

html[data-theme="dark"] body.grammar-page .grammar-practice-input.is-wrong {
    background: rgba(248, 113, 113, 0.12);
}

html[data-theme="dark"] body.grammar-page .grammar-practice-input.is-correct + .grammar-input-feedback {
    color: #86efac;
}

html[data-theme="dark"] body.grammar-page .grammar-practice-input.is-wrong + .grammar-input-feedback {
    color: #fca5a5;
}

@media (max-width: 768px) {
    body.grammar-page .grammar-tab {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.9375rem;
    }

    body.grammar-page .grammar-practice-card {
        padding: var(--spacing-sm);
    }

    body.grammar-page .grammar-lesson-exercise-link {
        align-items: stretch;
        flex-direction: column;
    }

    body.grammar-page .grammar-lesson-exercise-link a {
        width: 100%;
    }

    body.grammar-page .grammar-task-item--article-pair {
        grid-template-columns: 1fr;
    }

    body.grammar-page .grammar-practice-actions {
        align-items: stretch;
        flex-direction: column;
    }

    body.grammar-page .grammar-task-actions {
        align-items: stretch;
        flex-direction: column;
    }

    body.grammar-page .grammar-practice-button {
        width: 100%;
    }

    body.grammar-page .site-header-inner {
        flex-wrap: wrap;
    }

    body.grammar-page .site-nav {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 0.5rem;
    }

    body.grammar-page .back-btn {
        white-space: nowrap;
    }

    body.grammar-page .lang-switcher {
        flex-shrink: 0;
    }

    body.grammar-page .theme-toggle {
        flex: 0 0 40px;
    }
}

/* ============================================
   FAQ ACCORDION
   ============================================ */

.faq-category {
    margin-bottom: var(--spacing-lg);
}

.faq-category h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text);
}

.faq-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.faq-item summary {
    padding: 1rem var(--spacing-md);
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-fast);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
}

.faq-item[open] summary::after {
    content: '\2212';
}

.faq-item summary:hover {
    background: var(--color-surface-muted);
}

.faq-item .faq-answer {
    padding: 0 var(--spacing-md) var(--spacing-md);
    color: var(--color-text-muted);
    line-height: 1.7;
}

/* ============================================
   INTRO CONTENT (exercise pages)
   ============================================ */

.intro-content {
    max-width: 800px;
    margin: 0 auto var(--spacing-lg);
    padding: 0 var(--spacing-sm);
}

.intro-content h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.intro-content p {
    color: var(--color-text-muted);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.intro-content ul {
    color: var(--color-text-muted);
    line-height: 1.8;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

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

    .blog-article {
        padding: var(--spacing-md) var(--spacing-sm);
    }
}

/* ============================================
   Breadcrumbs + Result Summary + Related Links
   Phase 1.2 — Learning Layer (spec 02 §11, spec 05 §16)
   ============================================ */

.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: var(--color-text-muted, #6b7280);
    padding: 0.5rem 1rem;
    max-width: var(--content-max, 960px);
    margin: 0 auto;
}
.site-header .breadcrumbs {
    grid-area: breadcrumbs;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0.25rem 0.5rem;
    flex-wrap: nowrap;
    justify-content: center;
    overflow: hidden;
    white-space: nowrap;
}
.breadcrumbs .crumb-link {
    color: var(--color-text-muted, #6b7280);
    text-decoration: none;
    border-radius: var(--radius-sm, 6px);
    padding: 0.2rem 0.35rem;
    transition: color var(--transition-fast, 0.15s ease), background-color var(--transition-fast, 0.15s ease);
}
.breadcrumbs .crumb-link:hover {
    color: var(--color-text, #1f2937);
    background: var(--color-surface-muted, #f3f4f6);
}
.breadcrumbs .crumb-link:focus-visible {
    outline: 2px solid var(--color-focus, #2563eb);
    outline-offset: 2px;
}
.breadcrumbs .crumb-sep {
    opacity: 0.5;
    user-select: none;
    padding: 0 0.1rem;
}
.breadcrumbs .crumb-current {
    color: var(--color-text, #1f2937);
    font-weight: 500;
}
.site-header .breadcrumbs .crumb-current {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-full, 999px);
    background: var(--color-surface-muted, #f8fafc);
}

@media (max-width: 900px) {
    .site-header-inner {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "logo nav"
            "exam-switch exam-switch"
            "breadcrumbs breadcrumbs";
        row-gap: 0.25rem;
    }

    .exam-switcher {
        justify-self: start;
    }

    .site-header .breadcrumbs {
        justify-content: flex-start;
        flex-wrap: wrap;
        overflow: visible;
        padding: 0.1rem 0 0.2rem;
        white-space: normal;
    }

    .site-header .breadcrumbs .crumb-current {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }
}

/* Result summary — score display after "Prüfen" */
.result-summary {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text, #1f2937);
    min-height: 1.4rem;
    margin: 0.75rem 0 0.5rem;
}
.status-live {
    font-size: 0.9rem;
    color: var(--color-text-muted, #6b7280);
    min-height: 1.2rem;
}

/* Related links after exercise content */
.exercise-related {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    padding: 1.25rem 1rem;
    margin: 1rem auto 0;
    max-width: var(--content-max, 960px);
    border-top: 1px solid var(--color-border, #e5e7eb);
}
.exercise-related .related-link {
    font-size: 0.88rem;
    color: var(--color-text-muted, #6b7280);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    transition: color 0.2s, border-color 0.2s;
}
.exercise-related .related-link:hover {
    color: var(--color-text, #1f2937);
    border-color: var(--color-text-muted, #9ca3af);
    text-decoration: none;
}

/* ============================================
   Dashboard (Phase 4.3, spec 04 §8)
   ============================================ */
.dashboard-container { min-height: 80px; }
.dashboard-login-hint { color: var(--color-text-muted, #6b7280); font-size: 0.9rem; padding: 1rem 0; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.dash-card { background: var(--color-surface-muted, #f9fafb); border-radius: 10px; padding: 1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.dash-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted, #6b7280); font-weight: 600; }
.dash-big { font-size: 2rem; font-weight: 800; line-height: 1; }
.dash-unit { font-size: 0.85rem; color: var(--color-text-muted, #6b7280); }
.dash-accuracy { font-size: 0.8rem; color: var(--color-text-muted, #6b7280); }
.dash-empty { font-size: 0.85rem; color: var(--color-text-muted, #6b7280); margin: 0.25rem 0; }
.dash-count { font-size: 1.1rem; font-weight: 700; margin: 0; }
.dash-subtext { font-size: 0.78rem; color: var(--color-text-muted, #6b7280); margin: 0; }
.dash-link { font-size: 0.85rem; color: var(--color-primary, #2563eb); text-decoration: none; margin-top: 0.25rem; }
.dash-link:hover { text-decoration: underline; }
.dash-skill { display: flex; align-items: center; gap: 0.5rem; }
.dash-skill .skill-name { width: 90px; font-size: 0.82rem; }
.dash-skill .skill-bar { flex: 1; height: 8px; background: var(--color-border, #e5e7eb); border-radius: 4px; overflow: hidden; }
.dash-skill .skill-bar-fill { height: 100%; background: var(--color-primary, #2563eb); border-radius: 4px; }
.dash-skill .skill-meta { font-size: 0.75rem; color: var(--color-text-muted, #6b7280); width: 50px; text-align: right; }
.readiness-badge { display: inline-block; padding: 0.3rem 0.7rem; border-radius: 999px; font-weight: 600; font-size: 0.82rem; }
.readiness-hoch { background: rgba(22,163,74,0.12); color: #16a34a; }
.readiness-mittel { background: rgba(245,158,11,0.12); color: #d97706; }
.readiness-niedrig { background: rgba(220,38,38,0.12); color: #dc2626; }
.readiness-unbekannt { background: rgba(107,114,128,0.12); color: #6b7280; }
.dash-plan-item { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.6rem; border-radius: 6px; text-decoration: none; color: inherit; font-size: 0.85rem; margin-bottom: 0.3rem; border-left: 3px solid var(--color-border, #e5e7eb); transition: background 0.15s; }
.dash-plan-item:hover { background: var(--color-surface, #fff); }
.dash-plan-item.priority-high { border-left-color: #dc2626; }
.dash-plan-item.priority-medium { border-left-color: #d97706; }
.dash-plan-item.priority-low { border-left-color: var(--color-border, #e5e7eb); }
.plan-label { font-weight: 500; }
.plan-duration { font-size: 0.75rem; color: var(--color-text-muted, #6b7280); white-space: nowrap; }

/* Trust-Block (Phase 5.2, spec 02 §10) */
.trust-block {
    display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem; margin: 0.5rem auto 1rem;
    max-width: var(--content-max, 960px);
    font-size: 0.78rem; color: var(--color-text-muted, #6b7280);
    border-top: 1px solid var(--color-border, #e5e7eb);
}
.trust-item { white-space: nowrap; }
.trust-link { color: var(--color-text-muted, #6b7280); text-decoration: none; }
.trust-link:hover { text-decoration: underline; color: var(--color-text, #1f2937); }
/* Unabhängigkeits-/Markenhinweis: eigene Zeile, kleiner als die Attribution */
.trust-disclaimer {
    flex-basis: 100%; text-align: center;
    font-size: 0.72rem; line-height: 1.5;
}
.footer-disclaimer {
    font-size: 0.72rem; line-height: 1.5; text-align: center;
    color: var(--color-text-muted, #6b7280); max-width: 620px; margin: 0.5rem auto 0;
}
.teacher-tools {
    display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap;
    padding: 0.75rem; margin: 0 auto 0.5rem; max-width: var(--content-max, 960px);
}

/* Static section hierarchy used by Lesen/Hören hubs. */
.part-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    max-width: 920px;
    margin: -1.25rem auto 2rem;
    padding: 0 1rem;
}

.part-links a {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 999px;
    background: var(--color-surface, #fff);
    color: var(--color-text, #1f2937);
    font-size: 0.88rem;
    font-weight: 650;
    text-decoration: none;
}

.part-links a:hover,
.part-links a:focus-visible {
    border-color: var(--color-accent-1, #6366f1);
    color: var(--color-accent-1, #6366f1);
}

.site-logo-product {
    margin-left: 0.3rem;
    opacity: 0.72;
    font-size: 0.72em;
    font-weight: 650;
}

/* ============================================
   APP-PROMO + MOBILE-OPTIMIERUNG
   Der Großteil des Traffics kommt aus mobilen Browsern: Promo, Tap-Targets,
   Schriftgrößen und breite Inhalte werden hier für kleine Viewports korrigiert.
   ============================================ */

/* --- Einspaltige Grids dürfen nicht über den Viewport wachsen ---
   Diese Container setzen nur `display: grid` und `gap`. Ihre implizite
   `auto`-Spur wird nach max-content bemessen: eine Karten-Liste mit
   `repeat(auto-fill, …)` legt darin alle Spalten nebeneinander (12 Anzeigen
   ≈ 1330px), ein breites Kind zieht die Spur mit — und die ganze Seite
   scrollt seitlich, obwohl die Media Queries korrekt greifen.
   `minmax(0, 1fr)` bindet die Spur an die Containerbreite; die Breite der
   Anzeigenliste macht zusätzlich die auto-fill-Berechnung definit.
   Vollständige Liste ermittelt aus styles.css + allen Seiten-<style>-Blöcken. */
.task-container,
.exam-layout,
.exam-section,
.anzeigen-section,
.situations-list,
.situation-answer,
.questions-list,
.question-body,
.question-options,
.texts-list,
.text-answer,
.text-explanation-content,
.passage-body,
.gaps-list,
.gap-body,
.gap-control,
.checklist,
.highlight-list,
.step-list,
.sources,
.topic-card,
.account-page .account-container,
.account-form,
body.grammar-page .grammar-task,
body.grammar-page .grammar-task-list,
body.grammar-page .grammar-task-items,
body.grammar-page .grammar-task-item,
body.grammar-page .grammar-task-example,
body.grammar-page .grammar-example-answer ul,
body.grammar-page .grammar-practice-form,
body.grammar-page .grammar-progress-summary,
body.grammar-page .grammar-input-field {
    grid-template-columns: minmax(0, 1fr);
}

.anzeigen-list {
    width: 100%;
}

/* Textzellen in Grids mit festen Spalten (z. B. `18px 24px 1fr` in den
   Antwortoptionen): `1fr` ist `minmax(auto, 1fr)` und kann nicht unter die
   min-content-Breite des Textes schrumpfen — `overflow-wrap` ändert daran
   nichts, das tut nur `min-width: 0`. Ohne das läuft die Option auf sehr
   schmalen Geräten (320px) aus der Karte heraus. */
.option-text,
.question-text,
.anzeige-text,
.situation-text {
    min-width: 0;
}

/* --- Lange deutsche Komposita dürfen die Seite nicht aufziehen ---
   „Geschäftsbedingungen“ misst als h1 rund 366px und passt damit auf keinem
   Telefon in eine Textspalte; ohne Umbruchregel wächst stattdessen das
   Layout-Viewport. Greift nur, wenn ein Wort sonst überliefe, und vererbt
   sich — eine Regel auf body deckt damit auch Übungstexte, Antwortoptionen
   und künftige Komponenten ab. */
body {
    overflow-wrap: break-word;
}

/* --- Breite Inhalte: Tabellen scrollen im eigenen Container statt der Seite --- */
.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    margin: 1.25rem 0;
}

.table-scroll > table {
    margin: 0;
    min-width: 34rem;
}

@media (max-width: 900px) {
    /* Auf dem Handy ist der QR-Code nutzlos — der Button bekommt den Platz. */
    .app-card-qr,
    .app-nudge-qr img,
    .app-nudge-qr small {
        display: none;
    }

    .app-card-cta,
    .app-nudge-cta {
        min-height: 48px;
    }

    .app-nudge {
        gap: 12px;
        padding: 14px;
    }

    /* Schmaler Screen: Text und Button bekommen die volle Breite. */
    .app-nudge .app-tile {
        display: none;
    }

    .app-nudge-cta {
        flex: 1 1 auto;
        justify-content: center;
    }

    /* --- Tap-Targets ≥ 44px (WCAG 2.5.8) --- */
    .site-nav .theme-toggle,
    .site-nav .back-btn,
    .exam-switcher a,
    .lang-switcher .lang-btn,
    .footer-links a,
    .footer-links .footer-link-btn,
    .auth-btn,
    .breadcrumbs .crumb-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .site-nav .theme-toggle {
        min-width: 44px;
    }

    .exam-switcher a {
        min-width: 44px;
        padding-inline: 0.7rem;
    }

    /* 4 Sprachen + Theme + Login müssen in eine Zeile passen, sonst wächst
       die klebende Kopfzeile auf über 200px. Höhe bleibt bei 44px. */
    .lang-switcher .lang-btn {
        min-width: 40px;
        padding-inline: 0.4rem;
    }

    .footer-links a,
    .footer-links .footer-link-btn {
        padding: 0.35rem 0.5rem;
    }

    /* Grammatik-Kopfzeile: Zurück + 4 Sprachen + Theme + Login brauchen
       zusammen über 500px und passen neben dem Logo auf kein Telefon.
       Deshalb eigene Zeile unter dem Logo statt seitlichem Überlauf. */
    body.grammar-page .site-header-inner {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "logo"
            "nav"
            "breadcrumbs";
    }

    body.grammar-page .site-nav {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.4rem 0.5rem;
    }

    /* `width: 100%` (Regel für ≤768px) zwingt das Login-Widget in eine eigene
       Zeile und macht die klebende Kopfzeile unnötig hoch. */
    .site-nav .auth-widget {
        flex: none;
        width: auto;
    }

    /* Zwei statt drei Zeilen: schmales Theme-Icon zum breiten Zurück-Button,
       Sprachwahl zum Login. */
    body.grammar-page .site-nav .back-btn {
        order: 1;
    }

    body.grammar-page .site-nav .theme-toggle {
        order: 2;
    }

    body.grammar-page .site-nav .lang-switcher {
        order: 3;
    }

    body.grammar-page .site-nav .auth-widget {
        order: 4;
    }

    .site-header .lang-switcher {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .diag-option,
    .question-options button {
        min-height: 48px;
    }

    .part-links a,
    .trainer-grid .trainer-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Logo bleibt Inline-Text (als Flexbox kann es nicht umbrechen und schiebt
       sich über die Icons rechts); Trefferfläche kommt über Padding. */
    .site-header .site-logo {
        padding-block: 0.5rem;
        font-size: 1.125rem;
    }

    /* Auf schmalen Geräten würde „GermanUp TELC B1“ neben Zurück-Button,
       Sprachwahl und Theme dreizeilig umbrechen. Die Prüfung steht ohnehin
       direkt darunter im Umschalter. */
    .site-header .site-logo-product {
        display: none;
    }

    .site-header .site-logo {
        white-space: nowrap;
    }

    .site-header-inner {
        column-gap: 0.5rem;
    }

    .site-header .site-nav {
        gap: 0.5rem;
    }

    /* 48px Innenabstand lassen auf 390px nur 212px Textspalte übrig. */
    .account-card {
        padding: var(--spacing-sm);
    }

    /* „Quelle: Originalaufgabe nach Prüfungsformat“ misst 333px am Stück und
       zieht auf 360px-Geräten die Seite auf. */
    .trust-item {
        white-space: normal;
    }

    /* Deutsche Komposita in Überschriften sauber trennen statt hart brechen. */
    h1,
    h2,
    h3 {
        hyphens: auto;
    }

    .lang-switcher .lang-switcher-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Radio/Checkbox: sichtbarer Treffer statt 13px-Punkt. */
    .rf-option input[type="radio"],
    .rf-option input[type="checkbox"],
    input[type="radio"],
    input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    .rf-option {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        min-height: 44px;
    }

    /* --- Formulare: 16px verhindert den Auto-Zoom in iOS Safari --- */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    input:not([type="radio"]):not([type="checkbox"]),
    select,
    button {
        min-height: 44px;
    }

    /* --- Lesbare Schriftgrößen (≥ 14px) ---
       `body`-Präfix und volle Ketten, weil seiteneigene <style>-Blöcke und
       Astro-Scoped-Styles nach dieser Datei geladen werden. */
    body .task-tag,
    body .task-badge,
    body .blog-card .blog-card-meta,
    body .blog-card-meta,
    body .task-meta-item span,
    body .exam-switcher a,
    body .lang-switcher .lang-btn,
    body .account-label,
    body .account-note,
    body .breadcrumbs,
    body .blog-article-category,
    body .exam-kicker,
    body .exam-note,
    body .lang-switcher-label,
    body .status-pill span,
    body .trust-block,
    body .exercise-related .related-link {
        font-size: 0.875rem;
    }

    body .lang-badge {
        font-size: 0.8125rem;
    }

    body .footer-disclaimer,
    body .trust-disclaimer,
    body .site-logo-product {
        font-size: 0.8125rem;
    }
}

/* --- Promo-Rail steht mobil unter dem Inhalt, nicht davor --- */
@media (max-width: 1200px) {
    body.study-panel-visible .content-wrapper {
        grid-template-areas:
            "main"
            "left"
            "bottom";
    }

    body.study-panel-visible.ads-visible .content-wrapper,
    body.study-panel-visible.ads-reserved .content-wrapper {
        grid-template-areas:
            "main"
            "left"
            "right"
            "bottom";
    }

    body.study-panel-visible .study-rail {
        margin-top: var(--spacing-md, 2rem);
    }
}

@media print {
    .app-strip,
    .app-nudge,
    .footer-app,
    .related-link--app,
    .trainer-link--app,
    .vocab-card {
        display: none !important;
    }
}

/* ============================================
   EXAM ANSWER SHEET
   Gemeinsame Bausteine für Lesen/Sprachbausteine-Aufgabenseiten:
   getrennter "Antwortbogen" (Buchstaben-Kreise statt inline select/radio),
   angesteuert von lesen-task.js, lesen-teil2.js, lesen-teil3.js,
   sb-teil1.js und sb-teil2.js über exam-answer-sheet.js.
   ============================================ */

.exam-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: var(--spacing-md, 2rem);
    align-items: start;
}

.exam-main {
    display: grid;
    gap: var(--spacing-md, 2rem);
    min-width: 0;
}

.answer-sheet {
    position: sticky;
    top: var(--spacing-md, 2rem);
    display: grid;
    gap: 1rem;
    background: var(--sheet-bg, var(--color-surface));
    border: 1px solid var(--sheet-border, var(--color-border));
    border-radius: var(--radius-lg, 24px);
    box-shadow: var(--shadow-soft, 0 12px 28px var(--color-shadow-md));
    padding: 1.5rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.answer-sheet-head {
    display: grid;
    gap: 0.3rem;
}

.answer-sheet-kicker {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sheet-text-muted, var(--color-text-muted));
}

.answer-sheet-head h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: var(--sheet-text, var(--color-text));
}

.answer-sheet-hint {
    font-size: 0.82rem;
    color: var(--sheet-text-muted, var(--color-text-muted));
    margin: 0;
}

.answer-sheet-body {
    display: grid;
    gap: 1.1rem;
}

.answer-row {
    display: grid;
    gap: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--sheet-border, var(--color-border));
}

.answer-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.answer-row-number {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--sheet-text-muted, var(--color-text-muted));
    margin: 0;
}

.answer-bubbles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.answer-bubble {
    min-width: 34px;
    height: 34px;
    padding: 0 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--sheet-border, var(--color-border));
    background: var(--sheet-bg, var(--color-surface));
    color: var(--sheet-text, var(--color-text));
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition-fast);
}

.answer-bubble:hover:not(:disabled) {
    border-color: var(--color-focus);
    background: var(--sheet-muted, var(--color-surface-muted));
}

.answer-bubble:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.answer-bubble.is-selected {
    border-color: var(--color-focus);
    background: var(--color-focus);
    color: #ffffff;
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.answer-bubble.is-answer-correct {
    border-color: rgba(34, 197, 94, 0.6);
    background: var(--status-bg-correct, rgba(34, 197, 94, 0.12));
    color: var(--status-correct, #16a34a);
}

.answer-bubble.is-answer-wrong {
    border-color: rgba(239, 68, 68, 0.6);
    background: var(--status-bg-wrong, rgba(239, 68, 68, 0.12));
    color: var(--status-wrong, #ef4444);
}

.answer-bubble:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.answer-bubble-wide {
    padding: 0 0.75rem;
    text-transform: none;
}

.answer-row-status {
    font-size: 0.82rem;
    color: var(--sheet-text-muted, var(--color-text-muted));
    margin: 0;
    min-height: 1.1rem;
}

.answer-row.is-correct .answer-row-status {
    color: var(--status-correct, #16a34a);
}

.answer-row.is-wrong .answer-row-status {
    color: var(--status-wrong, #ef4444);
}

.answer-row.is-missing .answer-bubble {
    border-color: var(--color-focus);
}

/* Antwortoptionen mit Text in der Aufgabenkarte (Sprachbausteine Teil 1,
   Lesen Teil 2): Der Antwortbogen zeigt nur a/b/c — der Wortlaut der Optionen
   steht wie im Aufgabenheft unter jeder Aufgabe und ist ebenfalls anklickbar. */
.question-options {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.option-card {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--sheet-border, var(--color-border));
    background: var(--sheet-bg, var(--color-surface));
    color: var(--sheet-text, var(--color-text));
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: var(--transition-fast);
}

.option-card:hover:not(:disabled) {
    border-color: var(--color-focus);
    background: var(--sheet-muted, var(--color-surface-muted));
}

.option-card:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.option-card.is-selected {
    border-color: var(--color-focus);
    box-shadow: 0 0 0 2px var(--color-focus-ring);
}

.option-card.is-selected .option-key {
    background: var(--color-focus);
    border-color: var(--color-focus);
    color: #ffffff;
}

.option-card:disabled {
    cursor: default;
}

.option-card:disabled:not(.is-correct):not(.is-wrong) .option-text {
    color: var(--sheet-text-muted, var(--color-text-muted));
}

.option-card.is-correct {
    border-color: rgba(34, 197, 94, 0.6);
    background: var(--status-bg-correct, rgba(34, 197, 94, 0.12));
}

.option-card.is-wrong {
    border-color: rgba(239, 68, 68, 0.6);
    background: var(--status-bg-wrong, rgba(239, 68, 68, 0.12));
}

.option-key {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--sheet-muted, var(--color-surface-muted));
    border: 1px solid var(--sheet-border, var(--color-border));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    text-transform: lowercase;
}

.option-text {
    font-size: 0.95rem;
    line-height: 1.4;
}

@media (max-width: 900px) {
    .exam-shell {
        grid-template-columns: 1fr;
    }

    .answer-sheet {
        position: static;
        max-height: none;
    }
}
