/* --- 1. GLOBAL STYLES --- */
body { 
    background-color: #121212; 
    color: #e0e0e0; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    padding: 20px; 
    line-height: 1.6;
}
.container { max-width: 1100px; margin: 0 auto; padding-bottom: 100px; }

/* --- 2. HEADER & NAV --- */
header { 
    border-bottom: 2px solid #27ae60; 
    padding-bottom: 20px; 
    margin-bottom: 30px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
h1 { margin: 0; font-size: 1.8rem; color: #fff; }

.back-link {
    text-decoration: none;
    color: #888;
    border: 1px solid #444;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: 0.2s;
    white-space: nowrap;
}
.back-link:hover {
    color: #fff;
    border-color: #fff;
}

.nav-container { display: flex; gap: 8px; margin-top: 15px; flex-wrap: wrap; }
button.nav-btn { 
    background: #1e1e1e; border: 1px solid #333; color: #aaa; 
    padding: 10px 16px; cursor: pointer; border-radius: 4px; 
    transition: 0.3s; font-weight: bold; font-size: 0.95rem; 
}
button.nav-btn.active, button.nav-btn:hover { background: #27ae60; color: white; border-color: #27ae60; }

/* --- 3. SECTIONS & TAB CONTENT --- */
.section-box { 
    display: none; 
    background: #1e1e1e; 
    border: 1px solid #333; 
    border-top: 4px solid #27ae60; 
    border-radius: 8px; 
    padding: 30px; 
    margin-bottom: 40px;
    animation: fadeIn 0.4s ease;
}
.section-box.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- 4. TEXT & TABLES --- */
h2 { color: #2ecc71; margin-top: 0; border-bottom: 1px solid #444; padding-bottom: 10px; font-size: 1.5rem; }
h3 { color: #f39c12; margin-top: 25px; font-size: 1.2rem; }
.context-note { background: #2a2a2a; padding: 15px; border-left: 3px solid #2ecc71; color: #ccc; margin-bottom: 20px; font-size: 0.95rem; }
.special-case { background: #252525; padding: 15px; border-left: 4px solid #e74c3c; margin-bottom: 15px; }
.special-case strong { color: #3498db; }

table.custom-table { width: 100%; border-collapse: collapse; margin-top: 15px; background: #252525; border-radius: 6px; overflow: hidden; }
table.custom-table th, table.custom-table td { text-align: left; padding: 12px 15px; border-bottom: 1px solid #333; }
table.custom-table th { background: #1a1a1a; color: #2ecc71; text-transform: uppercase; font-size: 0.9rem; letter-spacing: 1px; }
table.custom-table tr:hover { background: #2c2c2c; }
.ipa-text { font-family: 'Consolas', monospace; color: #aaa; }
.tts-btn { background: none; border: 1px solid #555; color: #2ecc71; cursor: pointer; border-radius: 50%; width: 25px; height: 25px; display: inline-flex; align-items: center; justify-content: center; margin-left: 10px; font-size: 0.8rem; }
.tts-btn:hover { background: #2ecc71; color: #000; }

/* --- PHONEME GRID --- */
.phoneme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; margin-top: 15px; }
.card { background: #252525; border: 1px solid #444; border-radius: 6px; padding: 15px; text-align: center; transition: 0.2s; }
.card:hover { transform: translateY(-3px); border-color: #2ecc71; }
.symbol { font-size: 2rem; color: #2ecc71; font-family: "Lucida Sans Unicode", sans-serif; display: block; margin-bottom: 5px; }
.word { font-size: 1.1rem; color: #fff; font-weight: bold; }
.ipa-word { color: #888; font-family: monospace; font-size: 0.95rem; }
.bg-note { display: block; margin-top: 8px; font-size: 0.85rem; color: #f39c12; font-style: italic; }

/* --- EXERCISES & QUIZ --- */
.quiz-block { margin-top: 20px; margin-bottom: 20px; border: 1px solid #333; padding: 20px; border-radius: 8px; background: #252525; }
.quiz-title { color: #2ecc71; font-weight: bold; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; font-size: 0.9rem; }
.mini-quiz-item { margin-bottom: 10px; padding: 10px; background: #222; border-radius: 4px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; border: 1px solid #333;}
.quiz-input { background: #333; border: 1px solid #555; color: #fff; padding: 5px 10px; border-radius: 4px; width: 120px; margin-left: 10px; }
.check-btn { background: #3498db; color: white; border: none; padding: 5px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; margin-left: auto; }
.feedback-icon { font-weight: bold; font-size: 1.2rem; margin-left: 10px; }

.exercise-block { background: #252525; padding: 25px; border-radius: 8px; margin-bottom: 30px; border: 1px solid #444; }
.ex-item { margin-bottom: 20px; border-bottom: 1px solid #333; padding-bottom: 15px; }
.ex-q { font-size: 1.05rem; margin-bottom: 10px; display: block; font-weight: bold; }
.ex-options { display: flex; gap: 10px; flex-wrap: wrap; }
.ex-btn { 
    background: #333; border: 1px solid #555; color: #ccc; padding: 10px 20px; 
    border-radius: 4px; cursor: pointer; transition: 0.2s; font-size: 0.95rem;
}
.ex-btn:hover { background: #444; }
.ex-btn.correct { background: #27ae60; color: white; border-color: #2ecc71; }
.ex-btn.wrong { background: #c0392b; color: white; border-color: #e74c3c; opacity: 0.6; }

/* --- COMIC/NOVEL --- */
.level-selector { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; }
.lvl-btn { background: #333; color: #888; border: 1px solid #444; padding: 5px 15px; cursor: pointer; border-radius: 20px; font-size: 0.9rem; transition: 0.3s; }
.lvl-btn:hover { background: #444; color: #fff; }
.lvl-btn.active { background: #f39c12; color: #000; border-color: #f39c12; font-weight: bold; }
.comic-board { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; max-width: 900px; margin: 0 auto; background: #2c3e50; padding: 20px; border-radius: 8px; border: 4px solid #1a252f; }
.comic-panel { background: #fff; border: 3px solid #000; padding: 10px; border-radius: 4px; display: flex; align-items: center; gap: 15px; min-height: 110px; box-shadow: 3px 3px 0 rgba(0,0,0,0.3); }
.comic-panel.right { justify-content: flex-end; flex-direction: row; }
.comic-img { width: 100px; height: 100px; border-radius: 50%; border: 2px solid #333; background: #ddd; object-fit: cover; }
.speech-bubble { background: #fff; border: 2px solid #000; border-radius: 15px; padding: 10px 15px; color: #000; font-weight: bold; font-family: 'Comic Sans MS', sans-serif; position: relative; flex-grow: 1; text-align: center; min-height: 40px; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.speech-bubble.empty { border: 2px dashed #bbb; color: #bbb; background: #f4f4f4; }
.speech-bubble.highlight { background: #e8f6f3; border-color: #2ecc71; }
.speech-bubble.correct { border: 2px solid #2ecc71; background: #d5f5e3; color: #000; }
.comic-bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; border-top: 1px dashed #555; padding-top: 20px; }
.comic-phrase { background: #f1f1f1; color: #333; padding: 8px 15px; border: 1px solid #999; border-radius: 20px; cursor: grab; font-family: 'Comic Sans MS', sans-serif; font-size: 0.95rem; display: inline-block; }
.comic-phrase:active { cursor: grabbing; }

/* --- STRESS --- */
.stress-example { display: flex; flex-direction: column; gap: 10px; }
.stress-row { display: flex; align-items: center; background: #252525; padding: 10px; border-radius: 5px; }
.stress-visual { margin-right: 15px; width: 60px; }
.big-dot { font-size: 1.5rem; color: #e74c3c; margin-right: 2px; }
.small-dot { font-size: 1rem; color: #888; margin-right: 2px; }
.stress-word { font-weight: bold; color: #fff; font-size: 1.1rem; margin-right: auto; }

/* --- GAME CONTAINERS --- */
.game-container { text-align: center; max-width: 600px; margin: 0 auto; background: #222; padding: 20px; border-radius: 10px; border: 1px solid #333; }
.score-board { font-size: 0.9rem; color: #777; margin-bottom: 20px; text-transform: uppercase; letter-spacing: 1px; }

/* Drag & Drop */
.word-stage { display: flex; justify-content: center; align-items: center; font-size: 2.5rem; font-weight: bold; margin: 30px 0; font-family: 'Courier New', monospace; letter-spacing: 2px; gap: 10px; color: #fff; }
.drop-zone { width: 80px; height: 80px; border: 2px dashed #666; margin: 0 10px; display: flex; justify-content: center; align-items: center; background: #1a1a1a; color: #444; border-radius: 8px; transition: 0.3s; }
.drop-zone.highlight { border-color: #2ecc71; background: #1e3a2a; }
.drop-zone.correct { border-color: #2ecc71; background: #27ae60; color: white; border-style: solid; }
.drop-zone.wrong { border-color: #e74c3c; background: #3a1e1e; animation: shake 0.4s; }
.draggables-container { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; margin-top: 20px; min-height: 60px; }
.draggable-item { background: #3498db; color: white; padding: 10px 20px; border-radius: 5px; cursor: grab; font-size: 1.2rem; font-family: 'Courier New', monospace; user-select: none; }
.draggable-item:active { cursor: grabbing; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Hangman */
#hangman-area { text-align: center; max-width: 600px; margin: 0 auto; background: #222; padding: 20px; border-radius: 10px; border: 1px solid #333; }
.word-display { font-size: 2rem; letter-spacing: 10px; margin: 20px 0; font-family: monospace; min-height: 40px; color: #fff; }
.keyboard { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; max-width: 400px; margin: 0 auto; }
.key-btn { width: 35px; height: 35px; border: 1px solid #444; background: #333; color: #fff; border-radius: 4px; cursor: pointer; font-weight: bold; }
.key-btn:hover:not(:disabled) { background: #555; }
.key-btn:disabled { opacity: 0.5; cursor: default; }
.key-btn.correct { background: #2ecc71; border-color: #2ecc71; }
.key-btn.wrong { background: #e74c3c; border-color: #e74c3c; }
.status-text { font-size: 1.2rem; margin-bottom: 15px; font-weight: bold; min-height: 24px; color: #f39c12; }
.final-info { font-size: 1.1rem; color: #aaa; margin-top: 10px; }
.final-info strong { color: #2ecc71; }

/* Stress Game */
.stress-options { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; margin-top: 20px; }
.stress-btn { background: #333; border: 2px solid #555; padding: 15px; border-radius: 8px; cursor: pointer; width: 220px; color: #fff; transition: 0.2s; text-align: center; font-size: 1.1rem; font-weight: bold; }
.stress-btn:hover { border-color: #f39c12; background: #444; }
.stress-btn.correct { border-color: #2ecc71; background: #27ae60; }
.stress-btn.wrong { border-color: #e74c3c; opacity: 0.5; }

/* --- CHARACTER INTRO --- */
.character-showcase { display: flex; justify-content: center; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.char-card { background: #252525; padding: 15px; border-radius: 8px; text-align: center; width: 140px; border: 1px solid #333; }
.char-card img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; border: 2px solid #27ae60; }
.char-name { font-weight: bold; color: #2ecc71; }
.char-role { font-size: 0.8rem; color: #888; }

@media (max-width: 600px) {
    .comic-board { grid-template-columns: 1fr; }
}