/* ─── Reset & Base ─── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* ─── Navbar ─── */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
}

.nav-brand {
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
}

.nav-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-stat {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

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

/* ─── Footer ─── */
.footer {
    text-align: center;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

/* ─── Welcome / Index ─── */
.welcome {
    text-align: center;
    margin-bottom: 2rem;
}

.welcome h1 {
    color: white;
    font-size: 2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* ─── Session Stats ─── */
.session-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: #667eea;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
}

/* ─── Mode Grid ─── */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: white;
    border-radius: 16px;
    padding: 1.5rem 1rem;
    text-decoration: none;
    color: #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.mode-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

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

.mode-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mode-desc {
    font-size: 0.9rem;
    color: #666;
}

/* ─── DB Stats ─── */
.db-stats {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.db-stats h3 {
    font-size: 1rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.db-stats-grid {
    display: flex;
    justify-content: space-around;
}

.db-stat {
    font-size: 0.9rem;
    color: #555;
}

.db-stat strong {
    color: #667eea;
    font-size: 1.2rem;
}

/* ─── Practice Pages ─── */
.practice-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.back-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover {
    color: white;
}

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

.practice-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* ─── Word Display ─── */
.word-display {
    text-align: center;
    margin-bottom: 2rem;
}

.word-display.audio-only {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.big-word {
    font-size: 3rem;
    font-weight: 800;
    color: #333;
    letter-spacing: 0.05em;
}

.big-word.word-hidden {
    color: #aaa;
    letter-spacing: 0.15em;
}

.example-sentence {
    font-size: 1.1rem;
    color: #666;
    margin-top: 0.5rem;
    font-style: italic;
}

.cloze-sentence {
    font-size: 1.5rem;
    line-height: 1.6;
    color: #333;
    padding: 1rem;
    background: #f0f0ff;
    border-radius: 12px;
}

.cloze-sentence .blank {
    display: inline-block;
    min-width: 120px;
    border-bottom: 3px solid #667eea;
    color: transparent;
}

/* ─── Cloze Multiple-Choice Options ─── */
.cloze-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.btn-cloze-option {
    flex: 1 1 auto;
    min-width: 100px;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 12px;
    border: 3px solid #b0b8d1;
    background: #f5f6fa;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cloze-option:hover {
    background: #667eea;
    color: #fff;
    border-color: #5a67d8;
    transform: translateY(-2px);
}

/* ─── Practice Form ─── */
.practice-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.practice-form label {
    font-size: 1rem;
    font-weight: 600;
    color: #555;
}

.practice-form input[type="text"],
.practice-form textarea {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.practice-form input[type="text"]:focus,
.practice-form textarea:focus {
    border-color: #667eea;
}

.practice-form textarea {
    resize: vertical;
    line-height: 1.5;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #e0e0e0;
    color: #555;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.15rem;
}

.btn-small {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

.btn-audio {
    background: #667eea;
    color: white;
    min-width: 200px;
}

.btn-audio:hover {
    background: #5568d3;
}

.btn-slow {
    background: #764ba2;
}

.btn-slow:hover {
    background: #653a91;
}

/* ─── Case Exercise (Satz-Modus: alle Wörter in GROSS) ─── */
.case-sentence-form {
    margin-top: 0.5rem;
}

.case-sentence-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem;
    background: #f8f8f8;
    border-radius: 12px;
}

.case-word-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.3rem;
}

.case-toggle {
    width: 32px;
    height: 26px;
    border: 2px solid transparent;
    border-radius: 7px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
}

.case-toggle-up {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #a5d6a7;
}

.case-toggle-up:hover {
    background: #66bb6a;
    color: #fff;
    transform: scale(1.1);
}

.case-toggle-up.selected {
    background: #2e7d32;
    color: #fff;
    border-color: #1b5e20;
    transform: scale(1.1);
}

.case-toggle-down {
    background: #e3f2fd;
    color: #1565c0;
    border-color: #90caf9;
}

.case-toggle-down:hover {
    background: #64b5f6;
    color: #fff;
    transform: scale(1.1);
}

.case-toggle-down.selected {
    background: #1565c0;
    color: #fff;
    border-color: #0d47a1;
    transform: scale(1.1);
}

.case-submit-area {
    text-align: center;
    margin-top: 1.5rem;
}

.case-punct {
    font-size: 1.3rem;
    font-weight: 800;
    color: #333;
    align-self: center;
    margin-left: -0.2rem;
}

.dictation-error-count {
    text-align: center;
    margin-bottom: 1rem;
}

.dictation-error-count h3 {
    font-size: 1.3rem;
    color: #c62828;
}

.dictation-error-count h3.no-errors {
    color: #2e7d32;
}

.result-perfect {
    color: #2e7d32;
    font-weight: 700;
    font-size: 1.2rem;
}

.result-good {
    color: #1565c0;
    font-weight: 600;
}

.result-keep {
    color: #e65100;
    font-weight: 600;
}

.dictation-word-comparison {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
    line-height: 2.2;
}

.dict-word {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 1.05rem;
}

.dict-word-correct {
    color: #2e7d32;
}

.dict-word-error {
    color: #c62828;
    text-decoration: underline;
    text-decoration-color: #c62828;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.dict-comma-warning {
    color: #e65100;
    background: #fff8e1;
    border: 1px dashed #ff9800;
    border-radius: 4px;
}

.case-fertig-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.case-word-locked {
    font-size: 1.3rem;
    font-weight: 800;
    color: #333;
    text-align: center;
    padding: 0.1rem 0.2rem;
    user-select: none;
    letter-spacing: 0.02em;
}

/* ─── Case Result ─── */
.case-sentence-result {
    text-align: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #e8f5e9;
    border-radius: 12px;
}

.correct-sentence {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2e7d32;
    margin: 0;
}

.case-result-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1rem;
    justify-content: center;
}

.case-result-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.case-result-item.correct {
    background: #e8f5e9;
}

.case-result-item.wrong {
    background: #ffebee;
}

.result-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.result-word {
    font-weight: 700;
}

.result-summary {
    text-align: center;
    margin-bottom: 1rem;
}

.result-summary h3 {
    font-size: 1.8rem;
    margin: 0;
}

.instruction {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 1rem;
}

.case-sentence {
    font-size: 1.5rem;
    line-height: 1.6;
    color: #333;
    padding: 1rem;
    background: #f8f8f8;
    border-radius: 12px;
}

.target-word {
    font-weight: 700;
    color: #667eea;
    border-bottom: 3px solid #667eea;
    padding: 0 2px;
}

/* ─── Result Page ─── */
.result-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.result-card.correct {
    border: 3px solid #4caf50;
}

.result-card.incorrect {
    border: 3px solid #f44336;
}

.result-emoji {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.result-text h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.result-card.correct .result-text h3 {
    color: #4caf50;
}

.result-card.incorrect .result-text h3 {
    color: #f44336;
}

.result-comparison {
    text-align: left;
    background: #f8f8f8;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.comparison-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    align-items: baseline;
}

.comp-label {
    min-width: 140px;
    font-weight: 600;
    color: #666;
}

.comp-value {
    color: #333;
}

.correct-value {
    color: #4caf50;
    font-weight: 700;
}

.explanation {
    background: #fffde7;
    border-left: 4px solid #fbc02d;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    border-radius: 4px;
    font-size: 0.95rem;
    color: #555;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ─── Mobile ─── */
@media (max-width: 600px) {
    .container {
        padding: 1rem 0.5rem;
    }

    .welcome h1 {
        font-size: 1.5rem;
    }

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

    .big-word {
        font-size: 2.2rem;
    }

    .case-sentence-grid {
        gap: 0.3rem;
        padding: 0.6rem;
    }

    .case-word-locked {
        font-size: 1.1rem;
    }

    .btn-case {
        flex-direction: row;
        justify-content: center;
    }

    .case-letter {
        font-size: 1.5rem;
    }

    .cloze-sentence,
    .case-sentence {
        font-size: 1.2rem;
    }

    .comparison-row {
        flex-direction: column;
        gap: 0.2rem;
    }

    .comp-label {
        min-width: auto;
    }
}

/* ─── Source-Toggle ─── */
.nav-toggle {
    margin-left: 12px;
}

.toggle-btn {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.toggle-greg {
    background: rgba(100, 180, 255, 0.25);
    color: #aaddff;
    border-color: rgba(100, 180, 255, 0.4);
}

.toggle-fehler {
    background: rgba(255, 180, 80, 0.25);
    color: #ffdd88;
    border-color: rgba(255, 180, 80, 0.4);
}

.toggle-btn:hover {
    transform: scale(1.05);
}

@media (max-width: 500px) {
    .toggle-btn {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
}

/* ─── Pet (Gamification) ─── */
.pet-widget {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.pet-svg-wrap {
    flex-shrink: 0;
}

.pet-svg {
    width: 100px;
    height: 80px;
    transition: transform 0.3s ease;
}

.pet-svg:hover {
    transform: scale(1.05);
}

.pet-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pet-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pet-bar-label {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.pet-bar-track {
    flex: 1;
    height: 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
    overflow: hidden;
}

.pet-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
}

.pet-bar-hunger { background: linear-gradient(90deg, #ff6b6b, #ffa500); }
.pet-bar-grooming { background: linear-gradient(90deg, #6b5640, #4ecdc4); }
.pet-bar-health { background: linear-gradient(90deg, #ff4444, #44ff44); }
.pet-bar-happiness { background: linear-gradient(90deg, #555, #ffd700); }
.pet-bar-washing { background: linear-gradient(90deg, #6b9bdc, #a8d8ff); }

@media (max-width: 600px) {
    .pet-widget {
        gap: 10px;
        padding: 8px 12px;
    }
    .pet-svg {
        width: 70px;
        height: 56px;
    }
    .pet-bar-label {
        font-size: 0.9rem;
        width: 20px;
    }
    .pet-bar-track {
        height: 8px;
    }
}