:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --accent-color: #FFC107;
    --bg-color: #f0f9ff;
    --text-color: #333;
    --white: #ffffff;
    --correct-color: #4CAF50;
    --wrong-color: #f44336;
    --xp-color: #9C27B0;
    --fibi-color: #FF5722;
}

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

body {
    font-family: 'Comic Neue', cursive, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
}

#app {
    background: var(--white);
    width: 100%;
    max-width: 1000px;
    min-height: 700px;
    border-radius: 30px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    padding: 20px;
    position: relative;
    border: 8px solid #e0f2fe;
    overflow: hidden;
}

.screen { display: none; flex-direction: column; align-items: center; text-align: center; animation: fadeIn 0.4s ease-out; width: 100%; }
.screen.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Header & Stats */
header { width: 100%; margin-bottom: 20px; position: relative; display: flex; flex-direction: column; gap: 10px; }
.player-stats-header { display: flex; align-items: center; gap: 12px; justify-content: flex-end; font-weight: bold; font-size: 0.85rem; }
.xp-mini-bar { width: 80px; height: 8px; background: #eee; border-radius: 4px; overflow: hidden; }
#xp-mini-fill { height: 100%; background: var(--xp-color); width: 0%; transition: width 0.5s; }

/* Klassenauswahl */
.grade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 30px; width: 100%; max-width: 500px; }
.grade-btn { background: var(--secondary-color); color: white; border: none; padding: 30px; border-radius: 20px; font-size: 1.5rem; cursor: pointer; transition: transform 0.2s, background 0.2s; font-family: inherit; }
.grade-btn:hover { transform: scale(1.05); background: #1976D2; }

/* Weltkarte (8 Orte) */
.world-map {
    width: 100%;
    height: 450px;
    background: #e3f2fd;
    border-radius: 20px;
    position: relative;
    margin: 10px 0;
    background-image: radial-gradient(#bbdefb 2px, transparent 2px);
    background-size: 20px 20px;
    border: 4px solid #90caf9;
    overflow: hidden;
}

.map-location {
    position: absolute;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s;
    z-index: 2;
}

.map-location:hover { transform: scale(1.15); }
.loc-icon { font-size: 2.2rem; background: white; border-radius: 50%; width: 55px; height: 55px; display: flex; justify-content: center; align-items: center; box-shadow: 0 5px 15px rgba(0,0,0,0.1); border: 4px solid var(--secondary-color); }
.loc-label { font-weight: bold; margin-top: 5px; background: rgba(255,255,255,0.9); padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; white-space: nowrap; }
.loc-stars { color: var(--accent-color); font-size: 0.8rem; height: 1.2rem; }

/* Positionen der 8 Orte */
#loc-rechtschreibung { top: 10%; left: 10%; }
#loc-lesen { top: 10%; left: 45%; }
#loc-grammatik { top: 10%; right: 10%; }
#loc-wortschatz { top: 40%; left: 15%; }
#loc-satzbau { top: 40%; right: 15%; }
#loc-silben { bottom: 10%; left: 10%; }
#loc-gegenteile { bottom: 10%; left: 45%; }
#loc-zeitformen { bottom: 10%; right: 10%; }

/* Missionen */
.mission-panel { width: 100%; background: #fff9c4; padding: 12px; border-radius: 15px; border: 2px solid #fff176; text-align: left; margin-top: 10px; }
.mission-panel h3 { margin-bottom: 5px; color: #fbc02d; font-size: 1rem; }
#mission-list { list-style: none; font-size: 0.9rem; }
.mission-item { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed #ffe082; }
.mission-done { text-decoration: line-through; color: #999; }

/* Fibi der Fuchs */
#fibi-container {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: flex-end;
    pointer-events: none;
    z-index: 10;
}

.fibi-bubble {
    background: white;
    border: 3px solid var(--fibi-color);
    padding: 8px 12px;
    border-radius: 15px 15px 0 15px;
    margin-right: 5px;
    max-width: 160px;
    font-size: 0.8rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
    pointer-events: auto;
}

.fibi-avatar { font-size: 3.5rem; filter: drop-shadow(0 5px 5px rgba(0,0,0,0.1)); }

/* Buttons */
.btn-main { background: var(--primary-color); color: white; padding: 12px 24px; font-size: 1rem; border-radius: 15px; border: none; cursor: pointer; transition: background 0.2s; font-family: inherit; }
.btn-main:hover { background: #45a049; }
.btn-main:disabled { background: #ccc; cursor: not-allowed; }
.btn-secondary { background: var(--secondary-color); color: white; padding: 8px 16px; border-radius: 10px; border: none; cursor: pointer; font-family: inherit; }
.btn-small { background: #eee; padding: 6px 10px; font-size: 0.75rem; border-radius: 8px; border: none; cursor: pointer; width: fit-content; font-family: inherit; }

/* Game Elements */
#game-container { width: 100%; margin: 20px 0; min-height: 200px; }
.progress-container { width: 100%; height: 10px; background: #eee; border-radius: 5px; margin-top: 10px; overflow: hidden; }
#progress-bar { height: 100%; background: var(--primary-color); width: 0%; transition: width 0.3s; }

.choice-container { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.choice-btn { padding: 10px 20px; font-size: 1.1rem; background: #f8f9fa; border: 3px solid #dee2e6; border-radius: 12px; cursor: pointer; transition: all 0.2s; font-family: inherit; }
.choice-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--secondary-color); }
.choice-btn:disabled { cursor: not-allowed; opacity: 0.8; }

.gap-text { font-size: 1.4rem; margin: 20px 0; line-height: 1.6; }
.gap-input { border: 2px solid #ddd; border-radius: 8px; text-align: center; font-family: inherit; outline: none; }
.gap-input:focus { border-color: var(--secondary-color); }

.drop-zone { min-height: 80px; width: 100%; border: 3px dashed #ccc; border-radius: 15px; margin: 20px 0; display: flex; flex-wrap: wrap; gap: 10px; padding: 15px; justify-content: center; background: #fafafa; transition: background 0.2s; }
.drop-zone.active { background: #e8f5e9; border-color: var(--primary-color); }
.draggable-word { padding: 8px 15px; background: white; border: 2px solid var(--secondary-color); border-radius: 10px; cursor: grab; font-size: 1.1rem; user-select: none; }

#feedback { margin: 20px 0; padding: 15px; border-radius: 15px; background: #f9f9f9; width: 100%; }
.hidden { display: none; }
.success { color: var(--correct-color); font-weight: bold; font-size: 1.2rem; }
.error { color: var(--wrong-color); font-weight: bold; font-size: 1.1rem; }

/* Player Cards */
.player-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; margin: 20px 0; }
.player-card { border: 2px solid #ddd; border-radius: 15px; padding: 15px; cursor: pointer; transition: all 0.2s; min-width: 150px; }
.player-card:hover { border-color: var(--primary-color); background: #f1f8e9; }

/* Responsive */
@media (max-width: 768px) {
    .world-map { height: 600px; }
    #loc-rechtschreibung { top: 5%; left: 5%; }
    #loc-lesen { top: 5%; left: 50%; transform: translateX(-50%); }
    #loc-grammatik { top: 5%; right: 5%; }
    #loc-wortschatz { top: 30%; left: 10%; }
    #loc-satzbau { top: 30%; right: 10%; }
    #loc-silben { top: 55%; left: 10%; }
    #loc-gegenteile { top: 55%; right: 10%; }
    #loc-zeitformen { bottom: 5%; left: 50%; transform: translateX(-50%); }
    .grade-grid { grid-template-columns: 1fr; }
}
