/* ============================================================
   SCHOOL LEARNING HUB - NEURODIVERSITY-OPTIMIZED STYLES
   ============================================================

   Design Principles:
   - Large fonts (18px+) for Legasthenie
   - High contrast for readability
   - Clear spacing to reduce cognitive load (ADHS)
   - Calm color palette
   - OpenDyslexic font fallback (if installed)
*/

:root {
    /* Colors */
    --primary-color: #4A90E2;
    --secondary-color: #7FCDCD;
    --success-color: #5CB85C;
    --error-color: #D9534F;
    --bg-color: #F5F7FA;
    --card-bg: #FFFFFF;
    --text-color: #2C3E50;
    --text-muted: #7F8C8D;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Legasthenie-optimized typography */
    --font-size-base: 18px;
    --font-size-lg: 22px;
    --font-size-xl: 28px;
    --line-height: 1.8;
    --letter-spacing: 0.05em;
}

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

body {
    font-family: 'OpenDyslexic', 'Arial', 'Helvetica Neue', sans-serif;
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    letter-spacing: var(--letter-spacing);
    color: var(--text-color);
    background-color: var(--bg-color);
    padding: 0;
    margin: 0;
}

/* ============================================================
   HEADER
   ============================================================ */

.app-header {
    background-color: var(--primary-color);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.app-header h1 {
    font-size: var(--font-size-xl);
    font-weight: bold;
}

.user-select {
    display: flex;
    gap: var(--spacing-sm);
}

/* Hide user selection during active exercises (when X button is visible) */
body.compact-mode .user-select {
    display: none;
}

body.compact-mode .app-header {
    padding: var(--spacing-xs) var(--spacing-md);
}

body.compact-mode .app-header h1 {
    font-size: var(--font-size-lg);
}

.user-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-base);
    font-weight: bold;
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-btn:hover {
    background-color: rgba(255,255,255,0.3);
}

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

.user-btn.test-user {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 14px;
    opacity: 0.6;
    background-color: rgba(255,255,255,0.1);
}

.user-btn.test-user:hover {
    opacity: 1;
}

/* ============================================================
   CONTAINER & SCREENS
   ============================================================ */

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

.screen {
    animation: fadeIn 0.3s ease;
}

.screen.hidden {
    display: none;
}

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

/* ============================================================
   CARDS
   ============================================================ */

.welcome-card,
.complete-card,
.question-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: var(--spacing-xl);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: var(--spacing-lg);
}

.welcome-card h2,
.complete-card h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
}

.welcome-card p {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
}

.complete-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.complete-actions button {
    width: 100%;
}

/* ============================================================
   SUBJECT GRID
   ============================================================ */

#subject-screen h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    color: var(--primary-color);
}

/* ============================================================
   CHILD DASHBOARD (XP, Streak, Stats)
   ============================================================ */

.dashboard-header {
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

.dashboard-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.stat-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, var(--card-bg), #f0f4f8);
    border-radius: 16px;
    padding: var(--spacing-md) var(--spacing-lg);
    min-width: 100px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.stat-badge .stat-icon {
    font-size: 32px;
    margin-bottom: var(--spacing-xs);
}

.stat-badge .stat-value {
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: var(--text-color);
}

.stat-badge .stat-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.xp-badge {
    border-color: #FFD700;
    background: linear-gradient(135deg, #FFFEF0, #FFF9E6);
}

.xp-badge .stat-value {
    color: #B8860B;
}

.streak-badge {
    border-color: #FF6B6B;
    background: linear-gradient(135deg, #FFF5F5, #FFEBEB);
}

.streak-badge .stat-value {
    color: #D63031;
}

/* Subject Statistics Table */
.stats-section {
    margin-top: var(--spacing-xl);
}

.stats-table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--card-bg);
    font-size: 16px;
}

.stats-table th,
.stats-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid #eee;
}

.stats-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.05em;
}

.stats-table tbody tr:hover {
    background-color: #f8f9fa;
}

.stats-table .subject-cell {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.stats-table .accuracy-good {
    color: var(--success-color);
    font-weight: bold;
}

.stats-table .accuracy-medium {
    color: #F0AD4E;
    font-weight: bold;
}

.stats-table .accuracy-low {
    color: var(--error-color);
    font-weight: bold;
}

/* Challenge Highscores */
.highscore-section {
    margin-top: var(--spacing-xl);
}

.highscore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.highscore-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    padding: var(--spacing-md);
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.highscore-card .mode-name {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: var(--spacing-xs);
}

.highscore-card .highscore-value {
    font-size: var(--font-size-xl);
    font-weight: bold;
}

.highscore-card .highscore-detail {
    font-size: 14px;
    opacity: 0.8;
    margin-top: var(--spacing-xs);
}

.highscore-card.no-score {
    background: linear-gradient(135deg, #a0a0a0 0%, #808080 100%);
    box-shadow: 0 4px 15px rgba(100, 100, 100, 0.2);
}

.highscore-subject {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.85;
    margin-bottom: var(--spacing-xs);
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    display: inline-block;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .dashboard-stats {
        gap: var(--spacing-md);
    }

    .stat-badge {
        min-width: 80px;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .stat-badge .stat-icon {
        font-size: 24px;
    }

    .stat-badge .stat-value {
        font-size: var(--font-size-lg);
    }

    .stats-table {
        font-size: 14px;
    }

    .stats-table th,
    .stats-table td {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

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

.subject-section-title {
    font-size: var(--font-size-lg);
    margin: var(--spacing-lg) 0 var(--spacing-md) 0;
    color: var(--text-color);
    font-weight: bold;
}

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

.subject-card {
    background-color: var(--card-bg);
    border: 3px solid var(--primary-color);
    border-radius: 16px;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

.subject-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 25px rgba(74, 144, 226, 0.3);
}

.subject-icon {
    font-size: 48px;
}

.subject-name {
    font-size: var(--font-size-lg);
    font-weight: bold;
    color: var(--text-color);
}

/* ============================================================
   SESSION SCREEN
   ============================================================ */

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

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: #E0E0E0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.progress-fill {
    height: 100%;
    background-color: var(--success-color);
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    font-size: var(--font-size-base);
    color: var(--text-muted);
    font-weight: bold;
}

.question-text {
    font-size: var(--font-size-lg);
    font-weight: bold;
    margin-bottom: var(--spacing-lg);
    line-height: var(--line-height);
    color: var(--text-color);
    white-space: pre-wrap; /* Preserve line breaks */
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.option-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-base);
    background-color: var(--card-bg);
    border: 3px solid var(--primary-color);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    font-weight: 500;
}

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

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

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

.option-btn.incorrect {
    background-color: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

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

/* ============================================================
   FEEDBACK
   ============================================================ */

.feedback-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: var(--spacing-xl);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-top: var(--spacing-lg);
}

.feedback-card.hidden {
    display: none;
}

.feedback-correct {
    color: var(--success-color);
    font-size: var(--font-size-lg);
    font-weight: bold;
    margin-bottom: var(--spacing-md);
}

.feedback-incorrect {
    color: var(--error-color);
    font-size: var(--font-size-lg);
    font-weight: bold;
    margin-bottom: var(--spacing-md);
}

.feedback-text {
    font-size: var(--font-size-base);
    color: var(--text-color);
    margin-bottom: var(--spacing-lg);
}

/* ============================================================
   COMPLETE SCREEN
   ============================================================ */

.stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background-color: var(--bg-color);
    border-radius: 12px;
}

.stat-label {
    font-size: var(--font-size-base);
    color: var(--text-muted);
}

.stat-value {
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: var(--primary-color);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-lg);
    font-weight: bold;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #3A7BC8;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   PODCAST LIBRARY
   ============================================================ */

.special-actions {
    margin-bottom: var(--spacing-lg);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-md);
}

.podcast-nav-btn {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-lg);
    font-weight: bold;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.podcast-nav-btn:hover {
    background-color: #6ABCBC;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(127, 205, 205, 0.4);
}

.schulfortschritt-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    text-decoration: none;
}

.schulfortschritt-btn:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* School Progress Section - positioned before statistics */
.school-progress-section {
    margin: var(--spacing-lg) 0;
    text-align: center;
}

.school-progress-btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.2s ease;
}

.school-progress-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.podcast-library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.podcast-library-header h2 {
    font-size: var(--font-size-xl);
    color: var(--primary-color);
    margin: 0;
}

.btn-secondary {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-base);
    font-weight: bold;
    background-color: var(--text-muted);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #6C7C7D;
    transform: translateY(-2px);
}

/* Quit/Cancel button for active sessions */
.quit-btn {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.quit-btn:hover {
    border-color: var(--error-color);
    color: var(--error-color);
    transform: scale(1.1);
}

.challenge-header,
.session-header {
    position: relative;
}

.podcast-filters {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
    justify-content: center;
}

.podcast-filter-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-base);
    background-color: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

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

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

.podcast-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.no-podcasts {
    text-align: center;
    font-size: var(--font-size-lg);
    color: var(--text-muted);
    padding: var(--spacing-xl);
}

.podcast-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: var(--spacing-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.podcast-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(74, 144, 226, 0.2);
}

.podcast-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.podcast-icon {
    font-size: 40px;
    flex-shrink: 0;
}

.podcast-info {
    flex: 1;
}

.podcast-title {
    font-size: var(--font-size-lg);
    font-weight: bold;
    color: var(--text-color);
    margin: 0 0 var(--spacing-xs) 0;
}

.podcast-meta {
    font-size: var(--font-size-base);
    color: var(--text-muted);
    margin: 0;
}

.podcast-player {
    width: 100%;
}

.podcast-player audio {
    width: 100%;
    height: 54px;
    border-radius: 8px;
    background-color: var(--bg-color);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
    .app-header {
        flex-direction: column;
        gap: var(--spacing-md);
    }

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

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

    .podcast-library-header {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .podcast-filters {
        flex-direction: column;
    }

    .podcast-filter-btn {
        width: 100%;
    }
}

/* ============================================================
   MODE SELECTION STYLES
   ============================================================ */

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

.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
    background-color: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: bold;
    transition: all 0.3s ease;
    min-height: 160px;
}

.mode-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

/* Test Prep Cards - highlighted for exam preparation */
.mode-card.test-prep-card {
    border-color: #FF9800;
    background: linear-gradient(135deg, #FFF8E1 0%, #FFFFFF 100%);
}

.mode-card.test-prep-card:hover {
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

/* Challenge/Hard mode cards - red highlight */
.mode-card.challenge-card {
    border-color: #E53935;
    background: linear-gradient(135deg, #FFEBEE 0%, #FFFFFF 100%);
}

.mode-card.challenge-card:hover {
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.4);
}

.mode-icon {
    font-size: 3rem;
    display: block;
}

.mode-name {
    text-align: center;
    color: var(--text-color);
}

/* Mobile responsive: 1 column at 360px */
@media (max-width: 480px) {
    .mode-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablet: 2 columns at 480px+ */
@media (min-width: 481px) and (max-width: 799px) {
    .mode-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 columns at 800px+ */
@media (min-width: 800px) {
    .mode-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile optimization: Hide title but keep user selection visible */
@media (max-width: 768px) {
    .app-header h1 {
        display: none;
    }

    .app-header {
        justify-content: center;
        padding: var(--spacing-sm);
    }
}

/* ============================================================
   MATHE MODE SELECTION STYLES
   ============================================================ */

.mode-subtitle {
    color: #666;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: var(--font-size-base);
}

.mathe-mode-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto 2rem;
}

.mathe-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.mathe-mode-card:hover {
    background: #F0F7FF;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.2);
}

.mathe-mode-card .mode-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.mathe-mode-card .mode-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.mathe-mode-card .mode-desc {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.25rem;
    text-align: center;
}

/* Responsive: stack on mobile */
@media (max-width: 600px) {
    .mathe-mode-grid {
        max-width: 100%;
    }

    .mathe-mode-card {
        padding: 1.25rem;
    }

    .mathe-mode-card .mode-icon {
        font-size: 2rem;
    }

    .mathe-mode-card .mode-title {
        font-size: 1.1rem;
    }

    .mathe-mode-card .mode-desc {
        font-size: 0.85rem;
    }
}

/* ============================================================
   MATH CHALLENGE STYLES
   ============================================================ */

.challenge-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    padding: 0.4rem var(--spacing-sm);
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    margin-bottom: var(--spacing-sm);
}

.challenge-timer {
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.challenge-score {
    font-size: 1rem;
    font-weight: bold;
}

.challenge-timer.timer-warning {
    color: #ff6b6b;
    animation: pulse 0.5s infinite;
}

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

.challenge-question-card {
    background-color: #ffffff;
    border-radius: 16px;
    padding: var(--spacing-xl);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    border: 2px solid #e2e8f0;
}

.challenge-question {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    color: #1a202c;
    white-space: pre-wrap;
    line-height: 1.6;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #2563eb;
}

.challenge-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.challenge-option-btn {
    padding: var(--spacing-lg) var(--spacing-md);
    font-size: var(--font-size-lg);
    font-weight: bold;
    border: 3px solid #2563eb;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e3a5f;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.challenge-option-btn:hover:not(:disabled) {
    background: #2563eb;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.challenge-option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.challenge-option-btn.correct {
    background: #16a34a;
    color: white;
    border-color: #16a34a;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

.challenge-option-btn.incorrect {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.challenge-progress {
    text-align: center;
    font-size: var(--font-size-lg);
    color: var(--text-muted);
    font-weight: bold;
    padding: var(--spacing-md);
}

/* Challenge Complete Screen */
.challenge-result-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: var(--spacing-xl);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.challenge-result-card h2 {
    font-size: var(--font-size-xl);
    color: var(--primary-color);
    margin-bottom: var(--spacing-lg);
}

.challenge-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    margin: var(--spacing-xl) 0;
    flex-wrap: wrap;
}

/* Compact stats for challenge results - single line */
.challenge-stats-compact {
    font-size: var(--font-size-lg);
    font-weight: bold;
    text-align: center;
    margin: var(--spacing-sm) 0;
    color: var(--primary-color);
}

.stat-big {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.stat-big span:first-child {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-big .stat-label {
    font-size: var(--font-size-base);
    color: var(--text-muted);
}

.new-record {
    font-size: var(--font-size-lg);
    color: gold;
    margin: var(--spacing-lg) 0;
    animation: bounce 0.6s infinite;
    font-weight: bold;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.new-record.hidden {
    display: none;
}

.challenge-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.challenge-actions button {
    width: 100%;
}

/* Responsive: stacked buttons on mobile */
@media (max-width: 600px) {
    .challenge-options {
        grid-template-columns: 1fr;
    }

    .challenge-stats {
        flex-direction: column;
        gap: var(--spacing-lg);
    }

    .challenge-option-btn {
        padding: var(--spacing-md);
        font-size: var(--font-size-base);
    }

    .challenge-timer {
        font-size: 2rem;
    }
}

/* Challenge Error Review */
.challenge-errors {
    margin: var(--spacing-sm) 0;
    text-align: left;
    max-height: 50vh;
    overflow-y: auto;
}

.challenge-errors h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.challenge-errors.hidden {
    display: none;
}

.errors-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.error-item {
    background: #fff5f5;
    border-left: 4px solid var(--error-color);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
}

.error-question {
    font-weight: bold;
    margin-bottom: var(--spacing-xs);
    color: var(--text-color);
}

.error-answers {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9em;
}

.user-answer {
    color: var(--error-color);
}

.correct-answer {
    color: var(--success-color);
    font-weight: bold;
}

/* ============================================================
   MATH FRACTION RENDERER
   ============================================================

   Displays fractions like in textbooks:

      1
      ─
      4

   Usage:
   <span class="fraction">
     <span class="numerator">1</span>
     <span class="denominator">4</span>
   </span>
*/

.fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 0.2em;
    font-size: 1em;
    line-height: 1.2;
}

.fraction .numerator {
    border-bottom: 2px solid var(--text-color);
    padding: 0 0.3em 0.15em 0.3em;
    min-width: 1.2em;
    text-align: center;
}

.fraction .denominator {
    padding: 0.15em 0.3em 0 0.3em;
    min-width: 1.2em;
    text-align: center;
}

/* Large fractions for questions/focus */
.fraction-large {
    font-size: 1.5em;
}

.fraction-large .numerator,
.fraction-large .denominator {
    padding: 0.1em 0.4em;
    min-width: 1.5em;
}

/* Extra large for main question display */
.fraction-xl {
    font-size: 2em;
}

.fraction-xl .numerator {
    border-bottom-width: 3px;
    padding: 0.1em 0.5em 0.2em 0.5em;
    min-width: 2em;
}

.fraction-xl .denominator {
    padding: 0.2em 0.5em 0.1em 0.5em;
    min-width: 2em;
}

/* Mixed number: 1 1/2 */
.mixed-number {
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
}

.mixed-number .whole {
    font-size: 1.2em;
    font-weight: bold;
}

/* Math expression with fractions */
.math-expression {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    font-size: var(--font-size-lg);
    padding: var(--spacing-md);
    flex-wrap: wrap;
}

.math-expression .operator {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 1em;
    text-align: center;
}

.math-expression .equals {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-muted);
}

.math-expression .unknown {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    padding: 0.2em 0.5em;
    min-width: 2em;
    text-align: center;
}

/* Fraction in answer options */
.option-btn .fraction {
    font-size: 0.9em;
}

/* Visual fraction bar (pizza/pie style) */
.fraction-visual {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5em;
    margin: 0 0.5em;
}

.fraction-visual .pie {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: conic-gradient(
        var(--primary-color) 0deg,
        var(--primary-color) calc(var(--fraction-value) * 360deg),
        #e0e0e0 calc(var(--fraction-value) * 360deg)
    );
    border: 2px solid var(--text-color);
}

.fraction-visual-large .pie {
    width: 100px;
    height: 100px;
}

/* Bar visual (like chocolate bar) */
.fraction-bar {
    display: flex;
    gap: 2px;
    border: 2px solid var(--text-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5em 0;
}

.fraction-bar .segment {
    width: 30px;
    height: 40px;
    background-color: #e0e0e0;
    border-right: 1px solid var(--text-color);
}

.fraction-bar .segment:last-child {
    border-right: none;
}

.fraction-bar .segment.filled {
    background-color: var(--primary-color);
}

/* Geometry elements */
.geometry-angle {
    display: inline-block;
    width: 60px;
    height: 60px;
    position: relative;
    margin: 0.5em;
}

.geometry-angle::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-color);
}

.geometry-angle::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background-color: var(--text-color);
    transform-origin: bottom left;
    transform: rotate(calc(-1 * var(--angle-deg, 45deg)));
}

.geometry-angle .arc {
    position: absolute;
    bottom: 5px;
    left: 5px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    clip-path: polygon(0 100%, 100% 100%, 100% 0);
}

/* Unit conversion display */
.unit-conversion {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: var(--font-size-lg);
}

.unit-conversion .value {
    font-weight: bold;
    color: var(--primary-color);
}

.unit-conversion .unit {
    color: var(--text-muted);
    font-size: 0.9em;
}

.unit-conversion .arrow {
    font-size: 1.5em;
    color: var(--text-muted);
}

/* Number line for fractions */
.number-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: var(--spacing-md) 0;
    width: 100%;
    max-width: 400px;
}

.number-line .line {
    width: 100%;
    height: 4px;
    background-color: var(--text-color);
    position: relative;
    margin: var(--spacing-md) 0;
}

.number-line .tick {
    position: absolute;
    width: 2px;
    height: 16px;
    background-color: var(--text-color);
    top: -6px;
}

.number-line .tick-label {
    position: absolute;
    top: 16px;
    transform: translateX(-50%);
    font-size: 0.9em;
}

.number-line .marker {
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: var(--primary-color);
    border-radius: 50%;
    top: -6px;
    transform: translateX(-50%);
    cursor: pointer;
    transition: transform 0.2s;
}

.number-line .marker:hover {
    transform: translateX(-50%) scale(1.2);
}

/* Responsive math */
@media (max-width: 600px) {
    .math-expression {
        font-size: var(--font-size-base);
    }

    .fraction-xl {
        font-size: 1.5em;
    }

    .fraction-visual .pie {
        width: 50px;
        height: 50px;
    }
}

/* ============================================================
   GEOMETRY RENDERER - Additional Elements
   ============================================================

   Klasse 6 Geometry Topics:
   - Winkel (angles)
   - Koordinaten (coordinates)
   - 2D/3D Shapes
   - Symmetrie
   - Formeln
*/

/* Coordinate point display: (3|5) */
.coordinate-point {
    display: inline-flex;
    align-items: center;
    font-family: 'Arial', sans-serif;
    font-size: 1.1em;
    padding: 0.2em 0.4em;
    background-color: rgba(var(--primary-rgb, 76, 175, 80), 0.1);
    border-radius: 4px;
}

.coordinate-point .coord-x,
.coordinate-point .coord-y {
    font-weight: bold;
    color: var(--primary-color);
    padding: 0 0.2em;
}

/* Large coordinate display for questions */
.coordinate-point-large {
    font-size: 1.5em;
    padding: 0.3em 0.6em;
}

/* Coordinate system grid (SVG container) */
.coordinate-grid {
    display: flex;
    justify-content: center;
    margin: var(--spacing-md) 0;
}

.coordinate-grid svg {
    max-width: 100%;
    height: auto;
}

/* Point marker in coordinate grid */
.coordinate-grid .point-marker {
    fill: var(--primary-color);
    stroke: var(--text-color);
    stroke-width: 2;
}

.coordinate-grid .axis {
    stroke: var(--text-color);
    stroke-width: 2;
}

.coordinate-grid .grid-line {
    stroke: #e0e0e0;
    stroke-width: 1;
}

/* Math formula display */
.math-formula {
    display: inline-block;
    font-family: 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.1em;
    padding: 0.3em 0.6em;
    background-color: rgba(var(--primary-rgb, 76, 175, 80), 0.05);
    border-left: 3px solid var(--primary-color);
    margin: 0.3em 0;
}

.math-formula sup {
    font-size: 0.7em;
    vertical-align: super;
}

/* Formula block for larger displays */
.formula-block {
    display: block;
    text-align: center;
    font-size: 1.3em;
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
}

/* Shape containers (for SVG shapes) */
.shape-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-md);
    margin: var(--spacing-sm) 0;
}

.shape-container svg {
    max-width: 200px;
    max-height: 200px;
}

/* Shape type indicators */
.shape-triangle { --shape-color: #FF9800; }
.shape-rectangle { --shape-color: #2196F3; }
.shape-square { --shape-color: #4CAF50; }
.shape-circle { --shape-color: #9C27B0; }
.shape-parallelogram { --shape-color: #00BCD4; }
.shape-trapezoid { --shape-color: #E91E63; }
.shape-rhombus { --shape-color: #CDDC39; }

.shape-container svg path,
.shape-container svg polygon,
.shape-container svg rect,
.shape-container svg circle {
    fill: rgba(var(--primary-rgb, 76, 175, 80), 0.2);
    stroke: var(--shape-color, var(--primary-color));
    stroke-width: 3;
}

/* Angle value display (inline) */
.geometry-angle .angle-value {
    font-weight: bold;
    font-size: 1.1em;
}

.geometry-angle .angle-symbol {
    font-size: 0.9em;
    margin-left: 1px;
}

/* Angle type badges */
.angle-badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 0.5em;
}

.angle-badge.acute {
    background-color: #E3F2FD;
    color: #1976D2;
}

.angle-badge.right {
    background-color: #E8F5E9;
    color: #388E3C;
}

.angle-badge.obtuse {
    background-color: #FFF3E0;
    color: #F57C00;
}

.angle-badge.straight {
    background-color: #F3E5F5;
    color: #7B1FA2;
}

.angle-badge.reflex {
    background-color: #FFEBEE;
    color: #D32F2F;
}

/* Symmetry axis indicator */
.symmetry-axis {
    stroke: var(--primary-color);
    stroke-width: 2;
    stroke-dasharray: 8 4;
}

/* 3D shape shading */
.shape-3d-face {
    stroke: var(--text-color);
    stroke-width: 2;
}

.shape-3d-face.front { fill: rgba(var(--primary-rgb, 76, 175, 80), 0.3); }
.shape-3d-face.side { fill: rgba(var(--primary-rgb, 76, 175, 80), 0.2); }
.shape-3d-face.top { fill: rgba(var(--primary-rgb, 76, 175, 80), 0.4); }

/* Geometry labels */
.geometry-label {
    font-size: 0.9em;
    font-weight: bold;
    fill: var(--text-color);
}

.geometry-label.point-label {
    font-style: italic;
}

.geometry-label.measurement {
    fill: var(--primary-color);
}

/* Responsive geometry */
@media (max-width: 600px) {
    .shape-container svg {
        max-width: 150px;
        max-height: 150px;
    }

    .coordinate-point-large {
        font-size: 1.2em;
    }

    .formula-block {
        font-size: 1.1em;
    }
}

/* ============================================================
   WEEKLY ACTIVITY (Last 7 Days)
   ============================================================ */

.weekly-activity-section {
    margin: var(--spacing-lg) 0;
}

.weekly-activity-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--spacing-sm);
    background: var(--card-bg);
    padding: var(--spacing-md);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.day-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm);
    border-radius: 8px;
    transition: transform 0.2s ease;
}

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

.day-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
}

.day-indicator {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: var(--spacing-xs);
}

.day-card.practiced .day-indicator {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    color: white;
}

.day-card.not-practiced .day-indicator {
    background: #e0e0e0;
    color: #9e9e9e;
}

.day-card.today .day-name {
    color: var(--primary-color);
    font-weight: bold;
}

.day-xp {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.day-xp.has-xp {
    color: #FFD700;
    font-weight: bold;
}

/* Highscore card - not played state */
.highscore-card.not-played {
    background: linear-gradient(135deg, #f0f4ff, #e8f0fe);
    border: 2px dashed #4A90E2;
    cursor: pointer;
    transition: all 0.2s ease;
}

.highscore-card.not-played:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.3);
    border-style: solid;
}

.highscore-card.not-played .highscore-icon {
    font-size: 2rem;
}

.highscore-card.not-played .highscore-mode {
    color: #1a365d;
    font-weight: 600;
    font-size: 1rem;
}

.highscore-card.not-played .highscore-score {
    font-size: 0.85rem;
    color: #4a5568;
    font-weight: 500;
}

.try-it-badge {
    background: linear-gradient(135deg, #4A90E2, #667eea);
    color: white;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: var(--spacing-sm);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.highscore-card.clickable {
    cursor: pointer;
}

/* Responsive weekly activity */
@media (max-width: 600px) {
    .weekly-activity-grid {
        gap: 4px;
        padding: var(--spacing-sm);
    }

    .day-card {
        padding: 4px;
    }

    .day-name {
        font-size: 0.65rem;
    }

    .day-indicator {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .day-xp {
        font-size: 0.6rem;
    }
}

/* ============================================================
   DEUTSCH MODE SELECTION
   ============================================================ */

.deutsch-mode-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto 2rem;
}

.deutsch-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.deutsch-mode-card:hover {
    background: #FFF8E7;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.2);
}

.deutsch-mode-card .mode-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.deutsch-mode-card .mode-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #FF9800;
}

.deutsch-mode-card .mode-desc {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.25rem;
    text-align: center;
}

/* ============================================================
   LATEIN MODE SELECTION
   ============================================================ */

.latein-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 500px;
    margin: 0 auto 2rem;
}

.latein-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    background: #fef3e2;
    border: 3px solid #92400e;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(146, 64, 14, 0.15);
}

.latein-mode-card:hover {
    background: #fde68a;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(146, 64, 14, 0.25);
    border-color: #78350f;
}

.latein-mode-card .mode-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.latein-mode-card .mode-title {
    font-weight: 700;
    font-size: 1.2rem;
    color: #78350f;
    margin-bottom: 0.25rem;
}

.latein-mode-card .mode-desc {
    font-size: 0.9rem;
    color: #92400e;
    text-align: center;
    font-weight: 500;
}

/* ============================================================
   ACHIEVEMENTS / BADGES
   ============================================================ */

.achievements-section {
    margin-top: var(--spacing-lg);
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.achievement-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm);
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s;
}

.achievement-badge:hover {
    transform: scale(1.05);
}

.achievement-badge.earned {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: white;
}

.achievement-badge.locked {
    background: #e0e0e0;
    color: #9e9e9e;
    opacity: 0.6;
}

.achievement-icon {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.achievement-badge.locked .achievement-icon {
    filter: grayscale(100%);
}

.achievement-name {
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 1.2;
}

.achievement-date {
    font-size: 0.65rem;
    opacity: 0.8;
    margin-top: 2px;
}

/* No achievements yet message */
.no-achievements {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-muted);
}

.no-achievements .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    opacity: 0.5;
}

/* Responsive achievements */
@media (max-width: 600px) {
    .achievements-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }

    .achievement-icon {
        font-size: 1.5rem;
    }

    .achievement-name {
        font-size: 0.65rem;
    }

    .deutsch-mode-grid {
        max-width: 100%;
    }

    .deutsch-mode-card {
        padding: 1.25rem;
    }

    .deutsch-mode-card .mode-icon {
        font-size: 2rem;
    }

    .deutsch-mode-card .mode-title {
        font-size: 1.1rem;
    }

    .deutsch-mode-card .mode-desc {
        font-size: 0.85rem;
    }

    .latein-mode-grid {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .latein-mode-card {
        padding: 1.25rem;
    }

    .latein-mode-card .mode-icon {
        font-size: 2rem;
    }

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

    .latein-mode-card .mode-desc {
        font-size: 0.8rem;
    }
}

/* ============================================================
   UPCOMING EXAMS SECTION (Kids Dashboard)
   ============================================================ */

.upcoming-exams-section {
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.upcoming-exams-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.exam-alert-card {
    background: white;
    border-radius: 12px;
    padding: var(--spacing-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    border-left: 5px solid var(--primary-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.exam-alert-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.exam-alert-card.urgent {
    border-left-color: #D9534F;
    background: linear-gradient(to right, #fff5f5, white);
}

.exam-alert-card.warning {
    border-left-color: #F0AD4E;
    background: linear-gradient(to right, #fffbf0, white);
}

.exam-countdown {
    text-align: center;
    min-width: 70px;
    padding: var(--spacing-sm);
    border-radius: 8px;
    background: #f5f7fa;
}

.exam-alert-card.urgent .exam-countdown {
    background: #ffebee;
    color: #c62828;
}

.exam-alert-card.warning .exam-countdown {
    background: #fff8e1;
    color: #ef6c00;
}

.exam-countdown .days-number {
    font-size: 1.8rem;
    font-weight: bold;
    line-height: 1;
}

.exam-countdown .days-label {
    font-size: 0.75rem;
    text-transform: uppercase;
}

.exam-alert-info {
    flex: 1;
}

.exam-alert-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 4px;
}

.exam-alert-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.exam-topics-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.topic-mini-chip {
    font-size: 0.75rem;
    padding: 3px 8px;
    background: #e3f2fd;
    border-radius: 10px;
    color: #1976d2;
}

.exam-progress-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.progress-mini-bar {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    max-width: 120px;
}

.progress-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-mini-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.exam-alert-action {
    display: flex;
    align-items: center;
}

.exam-prep-link {
    padding: 8px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: bold;
    transition: background 0.2s;
}

.exam-prep-link:hover {
    background: #3a7bc8;
}

.no-exams-message {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 600px) {
    .exam-alert-card {
        flex-direction: column;
        text-align: center;
    }

    .exam-countdown {
        min-width: auto;
        width: 100%;
    }

    .exam-topics-preview {
        justify-content: center;
    }

    .exam-progress-mini {
        justify-content: center;
    }
}

/* Task list in exam alerts */
.exam-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
}

.exam-task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.exam-task-item.overdue {
    color: #c62828;
}

.exam-task-item.due-today {
    color: #e65100;
    font-weight: 600;
}

.exam-task-item.due-soon {
    color: #ef6c00;
}

.task-checkbox {
    font-size: 0.9rem;
    opacity: 0.5;
}

.task-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.due-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 8px;
    background: #e0e0e0;
    color: #666;
    white-space: nowrap;
}

.due-badge.overdue {
    background: #ffcdd2;
    color: #c62828;
    font-weight: bold;
}

.due-badge.due-today {
    background: #ffe0b2;
    color: #e65100;
    font-weight: bold;
}

.due-badge.due-soon {
    background: #fff3e0;
    color: #ef6c00;
}

.exam-task-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding-top: 4px;
}

.exam-setup-hint {
    font-size: 0.8rem;
    color: var(--primary-color);
    margin-top: 8px;
}

/* ============================================================
   STREAMLINED ANSWER FEEDBACK (weniger Klicks!)
   ============================================================ */

/* Correct Answer Overlay - kurzes "Richtig!" Feedback */
.correct-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(76, 175, 80, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.correct-overlay.show {
    opacity: 1;
    visibility: visible;
}

.correct-content {
    text-align: center;
    color: white;
    animation: correctPop 0.3s ease-out;
}

@keyframes correctPop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.correct-icon {
    font-size: 5rem;
    display: block;
    margin-bottom: 1rem;
}

.correct-text {
    font-size: 2.5rem;
    font-weight: bold;
    display: block;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.correct-xp {
    font-size: 1.5rem;
    display: block;
    margin-top: 0.5rem;
    opacity: 0.9;
}

/* Wrong Answer Popup - mit Erklärung */
.wrong-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    padding: 1rem;
}

.wrong-popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.wrong-popup-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    animation: popupSlide 0.3s ease-out;
}

@keyframes popupSlide {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.wrong-header {
    font-size: 1.5rem;
    font-weight: bold;
    color: #D9534F;
    margin-bottom: 1rem;
}

.wrong-explanation {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.wrong-correct-answer {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    border-left: 4px solid #4CAF50;
}

.wrong-correct-answer strong {
    color: #4CAF50;
}

.wrong-ok-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s ease, transform 0.1s ease;
}

.wrong-ok-btn:hover {
    background: var(--primary-dark);
}

.wrong-ok-btn:active {
    transform: scale(0.98);
}

/* Hide old buttons in learn screen when using streamlined flow */
#check-answer-btn,
#feedback-card {
    display: none !important;
}

/* ============================================================
   LATEIN SELECTION (Üben vs Challenge)
   ============================================================ */

.latein-selection-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 500px;
    margin: 0 auto 2rem;
}

.latein-selection-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #fef3e2 0%, #fde68a 100%);
    border: 3px solid #92400e;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(146, 64, 14, 0.15);
}

.latein-selection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(146, 64, 14, 0.25);
    border-color: #78350f;
}

.latein-selection-card.challenge-card {
    background: linear-gradient(135deg, #fef3e2 0%, #fed7aa 100%);
    border-color: #ea580c;
}

.latein-selection-card.challenge-card:hover {
    border-color: #c2410c;
    background: linear-gradient(135deg, #ffedd5 0%, #fdba74 100%);
}

.latein-selection-card .mode-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.latein-selection-card .mode-title {
    font-weight: 700;
    font-size: 1.4rem;
    color: #78350f;
    margin-bottom: 0.5rem;
}

.latein-selection-card .mode-desc {
    font-size: 0.95rem;
    color: #92400e;
    text-align: center;
    font-weight: 500;
}

@media (max-width: 480px) {
    .latein-selection-grid {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .latein-selection-card {
        padding: 1.5rem 1rem;
    }

    .latein-selection-card .mode-icon {
        font-size: 2.5rem;
    }

    .latein-selection-card .mode-title {
        font-size: 1.2rem;
    }
}

/* ============================================================
   WEEKLY GOALS SECTION
   ============================================================ */

.weekly-goals-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.goals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.goals-manage-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
}

.goals-manage-btn:hover {
    background: #3a7bc8;
}

.goals-summary {
    margin-bottom: var(--spacing-sm);
}

.goals-progress-bar {
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.goals-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #3cb371);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.goals-stats {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
}

.goals-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.goal-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.goal-item.priority-1 {
    border-left-color: #ef4444;
}

.goal-item.priority-2 {
    border-left-color: #f59e0b;
}

.goal-item.priority-3 {
    border-left-color: #22c55e;
}

.goal-item.completed {
    opacity: 0.7;
    background: #f0fdf4;
    border-left-color: var(--success-color);
}

.goal-icon {
    font-size: 1.5rem;
}

.goal-info {
    flex: 1;
}

.goal-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.goal-progress {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.goal-mini-bar {
    width: 60px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.goal-mini-fill {
    height: 100%;
    background: var(--success-color);
    border-radius: 3px;
}

/* ============================================================
   GOALS MANAGEMENT SCREEN
   ============================================================ */

#goals-screen {
    padding: var(--spacing-md);
}

.goals-screen-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: var(--spacing-md);
}

.goals-week-info {
    text-align: center;
    padding: 0.75rem;
    background: #f0f9ff;
    border-radius: 10px;
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
    font-weight: 600;
}

.goals-current-section,
.goals-add-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.goals-current-section h3,
.goals-add-section h3 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
}

.goals-edit-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.goal-edit-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.goal-edit-item.priority-1 { border-left-color: #ef4444; }
.goal-edit-item.priority-2 { border-left-color: #f59e0b; }
.goal-edit-item.priority-3 { border-left-color: #22c55e; }

.goal-edit-info {
    flex: 1;
}

.goal-edit-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.goal-edit-details {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.goal-edit-actions {
    display: flex;
    gap: 0.5rem;
}

.goal-delete-btn {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.goal-delete-btn:hover {
    background: #fecaca;
}

/* Goal Form */
.goal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row label {
    font-weight: 600;
    font-size: 0.95rem;
}

.goal-select,
.goal-input {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
}

.goal-select:focus,
.goal-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.add-goal-btn {
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
}

.add-goal-btn:hover {
    background: #4cae4c;
}

.no-goals-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

@media (max-width: 480px) {
    .goals-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .goals-manage-btn {
        width: 100%;
    }

    .goal-edit-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .goal-edit-actions {
        width: 100%;
    }

    .goal-delete-btn {
        flex: 1;
    }
}

/* Goal Item Content (Dashboard) */
.goal-subject {
    font-weight: 600;
    font-size: 1rem;
    display: block;
}

.goal-target {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.goal-progress-mini {
    width: 80px;
    flex-shrink: 0;
}

.goal-progress-bar-mini {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.goal-progress-fill-mini {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.goal-progress-fill-mini.completed {
    background: linear-gradient(90deg, #10b981, #059669);
}

.no-goals-hint,
.no-goals-edit {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Goal Edit Item Details */
.goal-edit-subject {
    font-weight: 600;
    font-size: 1rem;
    display: block;
    margin-bottom: 0.25rem;
}

.goal-edit-progress {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================================
   EDIT GOAL MODAL
   ============================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.cancel-btn,
.save-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.cancel-btn {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.cancel-btn:hover {
    background: var(--border-color);
}

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

.save-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.goal-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-primary);
    resize: vertical;
    min-height: 80px;
}

.goal-textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
}

/* Edit button in goal list */
.goal-edit-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.goal-edit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.goal-edit-actions {
    display: flex;
    gap: 0.5rem;
}
