/* 1. Globales Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body { 
    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background: #ffffff; 
    display: flex;
    align-items: center;
    justify-content: center; 
    min-height: 100vh;
    padding: 10px;
    overflow: hidden;
    transition: background 0.5s ease;
}

/* Hintergrund-Glow (Dezent passend zum Level) */
body.glow-bronze { background: radial-gradient(circle, #ffffff 60%, #fff5eb 100%); }
body.glow-silver { background: radial-gradient(circle, #ffffff 60%, #e0e0e0 100%);}
body.glow-gold   { background: radial-gradient(circle, #ffffff 60%, #fffdf0 100%); }

/* Das Menü
/* Punkt 4: Einheitliche Größe für beide Cards */
.card {
    min-height: 400px; /* Dieser Wert sorgt für die gleiche Höhe auf dem iPhone SE */
    display: flex;
    flex-direction: column;
}

.menu-container {
    flex-grow: 1;
    display: flex;
    align-items: center; /* Zentriert die Buttons vertikal in der Karte */
    justify-content: center;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.score {
    position: relative; /* Ankerpunkt für absolute Positionierung des Buttons */
    display: flex;
    justify-content: center; /* Zentriert die Punkte-Anzeige horizontal */
    align-items: center; /* Zentriert die Punkte-Anzeige vertikal */
    min-height: 50px; /* Mindesthöhe des Headers */
    padding: 10px 50px 10px 10px; /* Rechts 50px Platzhalter für den Button */
}

.menu-controls {
    position: absolute; /* Löst den Button aus dem Textfluss */
    right: 0px; /* Fixer Abstand zum rechten Rand */
    top: 50%; /* Startet bei 50% der Höhe */
    transform: translateY(-50%); /* Verschiebt sich um eigene halbe Höhe nach oben (perfekte Mitte) */
    z-index: 100; /* Stellt sicher, dass der Button über allem anderen liegt */
}

.icon-btn {
    background: none; /* Entfernt Standard-Button-Hintergrund */
    border: none; /* Entfernt Standard-Button-Rahmen */
	filter: grayscale(100%); /* Macht das Emoji grau */
    opacity: 0.6;            /* Macht es dezenter */
    font-size: 1.2rem; /* Größe des Emojis/Icons */
    cursor: pointer; /* Zeigt den Klick-Finger */
    padding: 10px; /* Vergrößert die Trefferfläche für Finger */
    line-height: 1; /* Verhindert Zeilenabstand-Verschiebungen */
    -webkit-tap-highlight-color: transparent; /* Verhindert blauen Kasten beim Tippen auf iOS */
}

.icon-btn:active {
    transform: scale(1.2);
    color: #ffd700;
}

/* Styling der Menü-Buttons */
.menu-item {
    background: #ffffff;
    border: 2px solid #f0f0f0;
    border-radius: 15px;
    padding: 20px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.menu-item:active {
    transform: scale(0.95);
    background: #fffdf0; /* Ganz leichtes Gold beim Drücken */
    border-color: #ffd700;
}

/* 2. Die App-Karte */
.card { 
    background: white !important; 
    border-radius: 20px; 
    padding: 15px 15px 15px 15px;
    width: 100%; 
    max-width: 320px; 
    position: relative;
    z-index: 10;
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.5s ease;
}

/* Die Auren */
.bronze-aura { box-shadow: 0 10px 40px rgba(205, 127, 50, 0.3); border: 2px solid rgba(205, 127, 50, 0.2); }
.silver-aura { box-shadow: 0 10px 40px rgba(160, 160, 160, 0.5);border: 2px solid rgba(160, 160, 160, 0.4);}
.gold-aura   { box-shadow: 0 10px 50px rgba(255, 215, 0, 0.5); border: 2px solid rgba(255, 215, 0, 0.4); }

/* 3. Mini-Fortschrittsbalken oben in der Karte */
.card-progress-mini {
    position: absolute;
    top: 0; left: 0;
    height: 7px;
    width: 0%;
    border-radius: 20px 20px 0 0;
    transition: width 0.3s ease, background-color 0.5s ease;
    z-index: 100;
}

/* 4. Score & Header - Schlank & Sauber */
.score { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 12px; 
    font-weight: bold; 
    font-size: 0.9rem; 
    color: #444;
}

.score-left { flex: 1; text-align: left; }
.score-center { flex: 1; text-align: center; } /* Der Pokal-Bereich bleibt purer Text */
.score-right { flex: 1; text-align: right; font-size: 1.1rem; }

/* 5. Aufgabe & Platzhalter */
#task { 
    font-size: 2.2rem; 
    font-weight: 800;
    text-align: center;
    margin: 15px 0;
    min-height: 65px;
    display: flex; 
    align-items: center; 
    justify-content: center;
}

.placeholder {
    display: inline-block;
    min-width: 60px;
    min-height: 1.2em;
    /* Linie unten */
    border-bottom: 4px solid #2196F3; 
    margin: 0 5px;
    text-align: center;
    vertical-align: bottom;
    transition: all 0.2s ease;
    border-radius: 4px 4px 0 0;
    /* Standard-Hintergrund beim Tippen */
    background: rgba(33, 150, 243, 0.1); 
}

/* Zustände der Hinterlegung */
.placeholder.typing { background: #e3f2fd; color: #2196F3; }
.placeholder.correct { background: #c8e6c9 !important; color: #2e7d32 !important; border-bottom-color: #2e7d32 !important; }
.placeholder.wrong { background: #ffcdd2 !important; color: #d32f2f !important; border-bottom-color: #d32f2f !important; }
/* 6. Das Numpad (Jetzt aber wirklich!) */
.numpad { 
    display: grid !important; 
    grid-template-columns: repeat(3, 1fr) !important; 
    gap: 8px !important; 
    width: 100%;
}

.numpad button { 
    padding: 18px 5px;
    font-size: 1.6rem; 
    border: none; 
    border-radius: 12px; 
    background: #f2f2f2; 
    color: #000; 
    font-weight: bold;
    cursor: pointer;
    transition: background 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.numpad button:active { background: #e0e0e0; transform: scale(0.98); }

.btn-c { background-color: #ffca28 !important; }
.btn-ok { background-color: #4caf50 !important; color: white !important; }

/* 7. Animationen */
.bounce-success { animation: bounce 0.4s ease; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.shake-error { animation: shake 0.4s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

.finish-message { text-align: center; padding: 20px; line-height: 1.5; }

#feedback { 
    min-height: 1.8rem;    /* Etwas niedriger, damit es kompakter wirkt */
    margin: 2px 0 8px 0;   /* Deutlich kleinere Abstände */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900; 
    font-size: 1rem;       /* Etwas kleiner für einen moderneren Look */
    width: 100%;
}
/*Tutorial*/
/* --- Installations-Tutorial Overlay --- */
#install-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    z-index: 20000;
    padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom) 20px;
    box-sizing: border-box;
    overflow-y: auto;
    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#install-overlay .install-box {
    position: relative;
    max-width: 420px;
    width: 100%;
    background: #ffffff;
    padding: 30px 25px;
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    line-height: 1.5;
}

#install-overlay h2 {
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    color: #222;
}

#install-overlay p {
    font-size: 1rem;
    color: #333;
    margin: 8px 0;
    text-align: left;
}

#install-overlay button#install-close {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 22px;
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    transition: color 0.2s ease;
}

#install-overlay button#install-close:hover {
    color: #000;
}

#install-reminder {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #ffcc00;
    color: #000;
    text-align: center;
    font-size: 14px;
    padding: 8px;
    z-index: 15000;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: background 0.2s ease;
}

#install-reminder:hover {
    background: #ffdb4d;
}

/* Optional: kleine Animation beim Einblenden */
#install-overlay,
#install-reminder {
    animation: fadeIn 0.3s ease forwards;
}

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

#install-overlay p {
    display: flex;
    align-items: center;
    gap: 10px;
}

#install-overlay .emoji {
    font-size: 1.5rem;
    width: 32px;
    text-align: center;
}