:root {
    --espresso: #4A3022;
    --mocha: #7D5A44;
    --caramel: #C09A7B;
    --crema: #FDF8F0;
    --milk: #FFFFFF;
    --shadow: rgba(74, 48, 34, 0.1);
    --der: #4A90E2; 
    --die: #E24A4A; 
    --das: #4AE27C;
    --feedback-green: #6B8E23;
    --feedback-red: #B22222;
}

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--crema);
    color: var(--espresso);
    margin: 0; 
    padding: 0 0 100px 0;
    display: flex; 
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: var(--milk);
    padding: 12px 20px;
    display: flex; 
    align-items: center;
    justify-content: space-between;
    position: sticky; 
    top: 0; 
    z-index: 100;
    box-shadow: 0 2px 10px var(--shadow);
}

.app-title-group { display: flex; align-items: center; gap: 10px; }
.logo-img { width: 35px; height: 35px; object-fit: contain; border-radius: 5px; }

.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--milk);
    display: flex; justify-content: space-around;
    padding: 12px 0 30px 0;
    box-shadow: 0 -2px 15px var(--shadow);
    z-index: 1000;
}

.nav-item {
    border: none; background: none; color: var(--mocha);
    display: flex; flex-direction: column; align-items: center;
    font-size: 0.75rem; gap: 4px; flex: 1; opacity: 0.5; transition: 0.3s;
}

.nav-item.active { opacity: 1; color: var(--espresso); font-weight: bold; }
.nav-item span { font-size: 1.4rem; }

main { padding: 20px; max-width: 600px; margin: 0 auto; width: 100%; }
.view-section { display: none; animation: fadeIn 0.2s ease; }
.view-section.active { display: block; }

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

.card {
    background: var(--milk); border-radius: 20px;
    padding: 20px; margin-bottom: 20px;
    box-shadow: 0 4px 15px var(--shadow);
}

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.action-card {
    background: var(--milk); 
    border-radius: 12px;         /* Etwas sanfterer Radius */
    padding: 12px 10px;          /* Deutlich verschlankt für mehr Platz */
    text-align: center; 
    border: 1px solid #eee; 
    transition: 0.2s;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 8px;                    /* Abstand zwischen Icon und Text verringert */
    cursor: pointer;
}

.action-card:active { transform: scale(0.96); }

.icon-box { 
    width: 42px;                 /* Vorher 50px */
    height: 42px;                /* Vorher 50px */
    border-radius: 10px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 1.3rem;           /* Icon minimal kleiner */
}

/* NEU: Macht den Text in den Karten automatisch etwas dezenter */
.action-card div:not(.icon-box) {
    font-size: 0.85rem;
}

/* Container für die Tabelle */
.table-container {
    width: 100%;
    overflow-x: hidden; /* Verhindert horizontales Scrollen, wenn möglich */
    padding: 0;
    margin: 10px 0;
}

.grammar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem; /* Etwas kleinere Schrift für Mobile */
    table-layout: fixed; /* Erzeugt gleichmäßig breite Spalten */
}

.grammar-table th, 
.grammar-table td {
    padding: 6px 2px; /* Minimales Padding links/rechts */
    text-align: center;
    border: 1px solid #e0e0e0;
    word-wrap: break-word; /* Bricht lange Wörter zur Not um */
}

/* Die erste Spalte (Nom, Akk...) darf etwas schmaler sein */
.grammar-table th:first-child, 
.grammar-table td:first-child {
    width: 15%; 
    font-weight: bold;
    background-color: var(--milk);
}

/* Optimierung für sehr kleine Bildschirme */
@media (max-width: 360px) {
    .grammar-table {
        font-size: 0.65rem; /* Noch kleinere Schrift bei schmalen Handys */
    }
    .grammar-table th, .grammar-table td {
        padding: 4px 1px;
    }
}


.table-title { font-weight: 800; color: var(--espresso); margin-top: 25px; margin-bottom: 5px; font-size: 1rem; }
.table-subtitle { font-size: 0.8rem; color: var(--mocha); margin-bottom: 10px; font-style: italic; }

.word-category { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--mocha); margin-bottom: 5px; }
.word-display { font-size: 2rem; font-weight: normal; margin: 15px 0; color: var(--espresso); line-height: 1.2; }
.flashcard-container {
    text-align: center;
}

/* Container bleibt gleich */
.btn-group { 
    display: grid; 
    grid-template-columns: 1fr 1fr 1fr; 
    gap: 10px; 
    margin-top: 20px; 
}

/* Grundlayout für die Artikel-Buttons */
.btn-main { 
    padding: 15px 5px; 
    border-radius: 12px; 
    border: none; 
    font-weight: bold; 
    font-size: 1.1rem; 
    cursor: pointer; 
    color: white; 
    background: var(--mocha);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); /* Leichter Schatten für Tiefe */
    transition: all 0.2s ease; /* Weiche Animation für alle Effekte */
}

/* Farben für Der/Die/Das */
.btn-der-static { background: var(--der); }
.btn-die-static { background: var(--die); }
.btn-das-static { background: var(--das); }

/* Großer "Nächste"-Button */
.btn-next-full { 
    background: var(--espresso); 
    width: 100%; 
    padding: 18px; 
    border-radius: 12px; 
    color: white; 
    border: none; 
    font-weight: bold; 
    margin-top: 20px; 
    font-size: 1.1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    cursor: pointer;
}

/* --- INTERAKTIVE EFFEKTE --- */

/* Hover-Effekt (für PC-Nutzer mit Maus) */
.btn-main:hover, .btn-next-full:hover {
    transform: translateY(-2px); /* Bewegt den Button leicht nach oben */
    box-shadow: 0 6px 12px rgba(0,0,0,0.15); /* Vergrößert den Schatten */
}

/* Active-Effekt (WICHTIG für Touchscreens in PWAs!) */
.btn-main:active, .btn-next-full:active {
    transform: translateY(2px) scale(0.96); /* Drückt den Button optisch rein */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Reduziert den Schatten */
}

.feedback-pop { padding: 15px; border-radius: 12px; margin-top: 15px; display: none; text-align: left; line-height: 1.4; }
.feedback-pop.correct { 
    display: block; 
    background: #e8f5e9; 
    border: 1px solid var(--feedback-green); 
    color: var(--feedback-green); 
    /* NEU: Ein weiches, federndes Aufploppen */
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

.feedback-pop.wrong { 
    display: block; 
    background: #ffebee; 
    border: 1px solid var(--feedback-red); 
    color: var(--feedback-red); 
    /* NEU: Ein kurzes Kopfschütteln/Wackeln */
    animation: shake 0.4s ease-in-out; 
}
.rule-list-item { padding: 15px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.rule-tag { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: bold; color: white; }

.translation-area { margin-top: 15px; padding-top: 15px; border-top: 1px dashed var(--caramel); font-size: 0.95rem; text-align: left; }

.rule-section-title { background: #f0f0f0; padding: 8px 15px; font-weight: bold; margin-top: 15px; border-radius: 8px; font-size: 0.9rem; color: var(--mocha); }
.rule-text { font-size: 0.9rem; line-height: 1.5; padding: 10px 5px; }
.rule-text b { color: var(--mocha); }

/* --- ANIMATIONEN --- */

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.9) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
/* --- KAFFEE-LADE-ANIMATION --- */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.coffee-cup {
    width: 50px;
    height: 45px;
    border: 4px solid var(--mocha);
    border-radius: 0 0 20px 20px;
    position: relative;
}

.coffee-cup::after {
    content: "";
    position: absolute;
    top: 5px;
    right: -15px;
    width: 12px;
    height: 18px;
    border: 4px solid var(--mocha);
    border-radius: 0 10px 10px 0;
    border-left: none;
}

.steam {
    display: flex;
    gap: 6px;
    margin-bottom: 5px;
}

.steam span {
    width: 4px;
    height: 15px;
    background: var(--caramel);
    border-radius: 4px;
    animation: steamUp 1.5s infinite ease-in-out;
    opacity: 0;
}

.steam span:nth-child(2) { animation-delay: 0.2s; }
.steam span:nth-child(3) { animation-delay: 0.4s; }

@keyframes steamUp {
    0% { transform: translateY(0) scaleX(1); opacity: 0; }
    50% { opacity: 0.6; }
    100% { transform: translateY(-20px) scaleX(1.5); opacity: 0; }
}
/* --- HINWEIS FÜR SWIPE-GESTE --- */
.swipe-hint-text {
    font-size: 0.75rem;
    font-weight: normal;
    opacity: 0.8;
    margin-top: 5px;
    /* Lässt den Text sanft nach links und rechts wippen */
    animation: subtleSwipe 2s infinite ease-in-out;
}

@keyframes subtleSwipe {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-6px); } 
}

.sentence-display {
    font-size: 1.4rem;
    line-height: 1.6;
    margin: 20px 0;
    text-align: center;
    padding: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 10px;
}

.rule-display {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff3cd; /* Ein sanftes Gelb für die Regel */
    border-left: 5px solid #ffeeba;
    border-radius: 8px;
    font-size: 0.95rem;
    animation: fadeIn 0.5s ease;
}

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

#ad-container {
    position: fixed;
    /* Wir schieben das Banner ein Stück hoch, damit die Nav frei bleibt */
    bottom: 60px; /* Höhe deiner bottom-nav + kleiner Puffer */
    left: 0;
    width: 100%;
    background-color: var(--crema);
    border-top: 1px solid var(--mocha);
    text-align: center;
    padding: 5px 0;
    z-index: 999; /* Eins unter der Navigation */
}

/* Deine Navigation braucht einen höheren Z-Index */
.bottom-nav {
    z-index: 1000;
    position: fixed;
    bottom: 0;
    /* ... rest deines Nav-CSS ... */
}

/* Erhöhe den Padding am Ende der Seite, damit man den Content hinter dem Banner noch hochscrollen kann */
main {
    padding-bottom: 130px; /* Platz für Banner (50px) + Nav (60px) + Puffer */
}
/* --- TABLET & DESKTOP OPTIMIERUNG (2-Spalten-Layout zentriert) --- */
@media (min-width: 768px) {
    /* Mache die App auf großen Bildschirmen zu einer schwebenden, weißen "Lernkarte" */
    main { 
        max-width: 600px; 
        margin: 40px auto; /* Abstand nach oben */
        background-color: var(--milk); /* Hebt sich vom crema-farbenen Hintergrund ab */
        border-radius: 20px;
        box-shadow: 0 10px 30px var(--shadow); 
        padding: 40px 40px 130px 40px; /* 130px Puffer unten bleibt für das Banner! */
    }

    /* Die untere Navigation zentrieren und leicht abrunden */
    .bottom-nav {
        max-width: 600px;
        margin: 0 auto;
        left: 0; 
        right: 0;
        border-radius: 20px 20px 0 0; 
        border: 1px solid #eee;
        border-bottom: none;
        padding-bottom: 12px;
    }
    
    /* Das Werbebanner an die 600px Karte anpassen */
    #ad-container {
        max-width: 600px;
        margin: 0 auto;
        left: 0;
        right: 0;
        border-left: 1px solid var(--mocha);
        border-right: 1px solid var(--mocha);
        /* bottom: 60px wird automatisch von deinem Code oben übernommen */
    }
}