/* css/style.css - KOMPLETTE DATEI */

/* --- 1. GRUNDLAGEN & LAYOUT (APP-FEELING) --- */
* { box-sizing: border-box; }

body { 
    font-family: 'Nunito', sans-serif; 
    background: #eef2f3; 
    margin: 0; padding: 0; 
    height: 100vh; 
    width: 100vw;
    overflow: hidden; /* WICHTIG: Verhindert Scrollen der gesamten Seite */
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
}

#root {
    width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
}

/* Der Haupt-Rahmen der App */
.game-container { 
    background: white; 
    width: 100%; max-width: 600px; 
    height: 100%; 
    display: flex; flex-direction: column; position: relative;
    box-shadow: 0 0 30px rgba(0,0,0,0.1);
    text-align: center;
}

/* Desktop-Optimierung: Kleinerer, abgerundeter Rahmen */
@media (min-width: 620px) {
    .game-container { height: 90vh; border-radius: 20px; overflow: hidden; }
}

/* Der scrollbare Innenbereich */
.scroll-content {
    flex: 1; 
    overflow-y: auto; 
    padding: 30px;
    display: flex; flex-direction: column; width: 100%; align-items: center;
}

.scroll-content > div { width: 100%; }
.scroll-content::-webkit-scrollbar { width: 6px; }
.scroll-content::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 3px; }

.spacer-bottom { margin-top: auto; width: 100%; text-align: center; }

/* --- 2. HEADER & STATS --- */
.header { 
    display: flex; justify-content: space-between; align-items: center; 
    padding-bottom: 20px; border-bottom: 2px solid #f0f0f0; 
    margin-bottom: 20px; flex-shrink: 0; width: 100%; 
}
.user-info { display: flex; align-items: center; gap: 15px; text-align: left; }
.avatar-circle { width: 50px; height: 50px; border-radius: 50%; border: 2px solid #ddd; background: white; display: flex; justify-content: center; align-items: center; font-size: 1.8rem; }
.badge { display: inline-block; padding: 5px 12px; border-radius: 15px; font-weight: 800; font-size: 0.9rem; color: white; margin-left: 5px; }
.xp-badge { background: #f1c40f; }
.coin-badge { background: linear-gradient(45deg, #f39c12, #d35400); }

/* --- 3. WELTKARTE (INSELN) --- */
.island-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px; width: 100%; }
.island-card { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); border-radius: 20px; padding: 20px; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; border: 4px solid white; box-shadow: 0 5px 15px rgba(0,0,0,0.1); min-height: 150px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.island-card:active { transform: scale(0.98); }
.island-icon { font-size: 3rem; margin-bottom: 10px; }
.island-title { font-weight: 800; font-size: 1.2rem; color: #2c3e50; background: rgba(255,255,255,0.8); padding: 5px 10px; border-radius: 10px; }

/* --- 4. MISSIONSPFAD --- */
.path-container { display: flex; flex-direction: column; gap: 20px; padding: 20px 0; align-items: center; position: relative; width: 100%; }
.path-line { position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; background: #eee; transform: translateX(-50%); z-index: 0; }
.mission-node { width: 100%; max-width: 350px; background: white; border: 2px solid #eee; border-radius: 15px; padding: 15px; z-index: 1; position: relative; cursor: pointer; transition: 0.2s; text-align: left; }
.mission-node:hover { border-color: #3498db; transform: scale(1.02); }
.mission-node.done { border-color: #2ecc71; background: #f0fff4; }
.mission-node.locked { opacity: 0.6; filter: grayscale(1); cursor: not-allowed; background: #f9f9f9; }
.lock-icon { position: absolute; right: 15px; top: 15px; font-size: 1.5rem; }

/* --- 5. BUTTONS & UI (Allgemein) --- */
.btn-primary { background: #3498db; color: white; border: none; padding: 12px; border-radius: 10px; font-weight: bold; cursor: pointer; width: 100%; font-size: 1rem; margin-top: 10px; }
.btn-shop { background: linear-gradient(45deg, #f1c40f, #f39c12); margin-bottom: 20px; margin-top: 0; }
.btn-back { background: #eee; color: #555; border: none; padding: 8px 15px; border-radius: 20px; font-weight: bold; cursor: pointer; float: left; margin-bottom: 15px; }

.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 25px; width: 100%; }
.btn-answer { padding: 25px; border: 2px solid #e0e0e0; border-radius: 15px; background: white; font-size: 1.2rem; font-weight: bold; cursor: pointer; color: #333; transition: all 0.2s; }
.btn-answer.correct-choice { background-color: #d4edda; border-color: #28a745; color: #155724; transform: scale(1.05); }
.btn-answer.wrong-choice { background-color: #f8d7da; border-color: #dc3545; color: #721c24; animation: shake 0.3s; }

.btn-small { padding: 5px 10px; font-size: 0.85rem; border-radius: 5px; cursor: pointer; border: none; margin-left: 5px; }
.btn-danger { background: #e74c3c; color: white; }
.btn-warn { background: #f39c12; color: white; }
.btn-edit { background: #3498db; color: white; }

/* --- 6. AUFGABEN STYLES --- */
/* Memory */
.match-grid { display: grid; gap: 10px; margin-top: 20px; grid-template-columns: repeat(3, 1fr); width: 100%; }
.match-card { aspect-ratio: 1; background: #3498db; border-radius: 10px; cursor: pointer; display: flex; justify-content: center; align-items: center; font-size: 2rem; color: white; }
.match-card.flipped { background: white; border: 2px solid #3498db; color: #333; }
.match-card.matched { background: #2ecc71; opacity: 0; pointer-events: none; }

/* Sortieren */
.sort-grid { display: grid; gap: 10px; margin-top: 20px; width: 100%; }
.btn-sort { padding: 15px; background: white; border: 2px solid #ddd; border-radius: 10px; font-weight: bold; cursor: pointer; width: 100%; }
.btn-sort.locked { background-color: #d4edda; border-color: #28a745; color: #155724; cursor: default; pointer-events: none; transform: scale(0.98); opacity: 0.8; }
.btn-sort.shake { background-color: #f8d7da; border-color: #dc3545; color: #721c24; animation: shake 0.4s; }

.feedback { margin-top: 20px; font-weight: 800; font-size: 1.2rem; min-height: 1.5em; }
.correct { color: #27ae60; } .wrong { color: #e74c3c; }
.input-field { width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 10px; margin-bottom: 15px; font-size: 1rem; }

/* Taschenrechner (Input Number) */
.input-display {
    font-size: 2.5rem; font-weight: bold; padding: 15px;
    border: 3px solid #3498db; border-radius: 15px;
    width: 100%; max-width: 280px; margin: 0 auto 25px auto;
    text-align: center; min-height: 80px;
    background: #f8f9fa; color: #2c3e50;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05); letter-spacing: 5px;
}
.numpad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 280px; margin: 0 auto; }
.btn-num {
    padding: 15px 0; font-size: 1.5rem; font-weight: bold; border-radius: 12px;
    border: 2px solid #e0e0e0; background: white; color: #333;
    cursor: pointer; transition: transform 0.1s, background 0.2s; user-select: none;
}
.btn-num:active { transform: scale(0.95); background: #f0f0f0; }
.btn-clear { background-color: #ffebee; border-color: #ffcdd2; color: #c62828; }
.btn-enter { background-color: #e8f5e9; border-color: #c8e6c9; color: #2e7d32; }

/* --- 7. ADMIN BEREICH --- */
.student-list { text-align: left; width: 100%; margin-top: 20px; }
.student-row { background: #f9f9f9; border: 1px solid #eee; padding: 10px; margin-bottom: 10px; border-radius: 10px; display: flex; justify-content: space-between; align-items: center; }
.mini-input { padding: 8px; width: 100px; border: 1px solid #ddd; border-radius: 5px; font-size:0.9rem; }
.grade-badge { background: #d1e7dd; padding: 2px 6px; border-radius: 8px; font-size: 0.8rem; margin-right: 3px; color: #0f5132; border: 1px solid #badbcc; }

/* --- 8. UTILS --- */
#loader { font-size: 1.5rem; font-weight: bold; color: #999; }

@keyframes shake {
    0% { transform: translateX(0); } 25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); } 75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

@media (max-width: 480px) { 
    .island-grid { grid-template-columns: 1fr; } 
    .match-grid { grid-template-columns: repeat(2, 1fr); } 
    .scroll-content { padding: 20px; }
    .student-row { flex-direction: column; align-items: flex-start; gap: 10px; }
    .student-row > div:last-child { width: 100%; display: flex; justify-content: flex-end; }
}

/* --- 9. AVATAR EDITOR & SHOP SPEZIAL --- */

/* Der schwebende Button (unten rechts auf Maps) */
.fab-shop {
    position: absolute; bottom: 20px; right: 20px;
    width: 60px; height: 60px; border-radius: 50%;
    background: linear-gradient(45deg, #f1c40f, #f39c12);
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.5);
    border: none; font-size: 2rem; cursor: pointer;
    z-index: 100; display: flex; justify-content: center; align-items: center;
    transition: transform 0.2s;
}
.fab-shop:hover { transform: scale(1.1) rotate(-10deg); }
.fab-shop:active { transform: scale(0.95); }

/* Avatar Preview Bereich (Fixiert oben) */
.avatar-preview-area {
    flex-shrink: 0; /* Verhindert das Zusammenstauchen! */
    padding: 10px 0; background: white;
    position: sticky; top: 0; z-index: 10;
    border-bottom: 1px solid #eee;
}

/* Shop Items Grid */
.shop-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 110px; /* Feste Höhe */
    padding: 10px; border-radius: 15px;
    cursor: pointer; transition: transform 0.1s; position: relative;
}
.shop-item:active { transform: scale(0.95); }
.shop-item.selected { border: 3px solid #3498db !important; background: #f0f8ff !important; }
.shop-item.owned { background: white; border: 2px solid #eee; }
.shop-item.locked { background: #f9f9f9; border: 1px solid #eee; opacity: 0.8; }

/* DER NEUE 3D SHOP BUTTON */
.btn-buy-action {
    width: 100%;
    padding: 15px;
    /* Verlauf von Hellgrün zu Dunkelgrün */
    background: linear-gradient(to bottom, #2ecc71, #27ae60) !important; 
    color: white !important;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    margin-top: 10px;
    
    /* 3D Effekt Schatten unten */
    box-shadow: 0 6px 0 #1e8449, 0 10px 10px rgba(0,0,0,0.2);
    transition: all 0.1s;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: pulseBuy 2s infinite;
}

.btn-buy-action:active {
    /* Beim Klicken geht er runter */
    transform: translateY(6px);
    box-shadow: 0 0 0 #1e8449, 0 0 0 rgba(0,0,0,0.2);
}

@keyframes pulseBuy {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}