/* --- GLOBAL --- */
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; }

/* --- HEADER --- */
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; }
.back-link:hover { color: #fff; border-color: #fff; }

/* --- NAV --- */
.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; }

/* --- SECTIONS --- */
.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); } }

/* --- TEXT & TABLES --- */
h2 { color: #2ecc71; margin-top: 0; border-bottom: 1px solid #444; padding-bottom: 10px; }
h3 { color: #f39c12; margin-top: 30px; border-left: 3px solid #f39c12; padding-left: 10px; }
.context-note { background: #2a2a2a; padding: 15px; border-left: 3px solid #2ecc71; color: #ccc; margin-bottom: 20px; }
.rule-box { background: #202c38; padding: 15px; border-radius: 5px; border: 1px solid #34495e; margin-bottom: 15px; border-left: 4px solid #27ae60; }
.special-case { background: #2c3e50; border: 1px solid #34495e; padding: 15px; margin-top: 15px; border-radius: 5px; border-left: 4px solid #e74c3c; }
.clean-list { list-style: none; padding: 0; }
.clean-list li { padding: 8px 0; border-bottom: 1px solid #333; }
.ipa { font-family: 'Courier New', monospace; color: #f39c12; background: #333; padding: 2px 5px; border-radius: 3px; font-size: 0.9rem; }
.bg { color: #aaa; font-style: italic; margin-left: 10px; }

/* GRAMMAR TABLES */
.grammar-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; background: #222; border-radius: 5px; overflow: hidden; }
.grammar-table td, .grammar-table th { padding: 8px 15px; border-bottom: 1px solid #333; }
.grammar-table th { background: #1a1a1a; color: #2ecc71; text-align: left; }
.grammar-table tr:last-child td { border-bottom: none; }
.grammar-table.negative td strong { color: #e74c3c; }
.grammar-table.question td strong { color: #3498db; }

/* VOCAB GRID */
.vocab-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.vocab-card { background: #252525; border: 1px solid #444; border-radius: 8px; padding: 15px; }
.vocab-card h3 { border-bottom: 1px solid #555; padding-bottom: 5px; margin-top: 0; border-left: none; padding-left: 0; color: #2ecc71; }

/* FREQUENCY BARS */
.freq-container { background: #252525; padding: 20px; border-radius: 8px; border: 1px solid #333; }
.freq-row { display: flex; align-items: center; margin-bottom: 10px; }
.freq-label { width: 100px; font-weight: bold; }
.freq-bar { height: 12px; border-radius: 6px; margin-right: 15px; }

/* --- EXERCISES --- */
.quiz-block { margin-top: 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; font-size: 0.95rem; }
.quiz-input { background: #333; border: 1px solid #555; color: #fff; padding: 5px 10px; border-radius: 4px; width: 140px; font-family: 'Segoe UI', sans-serif; }
.check-btn { background: #f39c12; color: black; border: none; padding: 5px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; margin-left: auto; transition: 0.2s; }
.check-btn:hover { background: #d35400; color: white; }
.feedback-icon { font-weight: bold; font-size: 1.2rem; margin-left: 10px; }
.ex-btn { background: #333; border: 1px solid #555; color: #ccc; padding: 8px 15px; border-radius: 4px; cursor: pointer; transition: 0.2s; font-size: 0.9rem; margin-right:5px; }
.ex-btn:hover { background: #444; }

/* --- LIGHT 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.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; }
.comic-panel.right { justify-content: flex-end; flex-direction: row; }
.comic-img { width: 70px; height: 70px; border-radius: 50%; border: 2px solid #333; object-fit: cover; background: #ddd;}
.speech-bubble { background: #fff; border: 2px solid #000; border-radius: 15px; padding: 10px 15px; color: #000; font-weight: bold; position: relative; flex-grow: 1; text-align: center; min-height: 40px; display: flex; align-items: center; justify-content: center; font-family: 'Comic Sans MS', sans-serif;}
.speech-bubble.empty { border: 2px dashed #bbb; color: #bbb; background: #f4f4f4; }
.speech-bubble.correct { border: 2px solid #2ecc71; background: #d5f5e3; }
.comic-bank { display:flex; justify-content: center; flex-wrap: wrap; gap: 10px; 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; display: inline-block; box-shadow: 0 2px 5px rgba(0,0,0,0.5); font-family: 'Comic Sans MS', sans-serif;}

/* --- GAMES --- */
.game-wrapper { display: none; margin-top: 20px; }

/* Game 1: Planner (Chips) */
.planner-source { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 20px; }
.task-chip { background: #fff; color: #000; padding: 10px 20px; border-radius: 20px; cursor: pointer; font-weight: bold; border-bottom: 4px solid #ccc; text-align: center; transition: 0.1s; }
.task-chip:active { transform: translateY(3px); border-bottom: 0; margin-top: 3px; }
.task-chip.used { display: none; }
.timeline-container { display: flex; flex-direction: column; gap: 10px; max-width: 400px; margin: 0 auto; border-left: 4px solid #555; padding-left: 20px; }
.timeline-slot { padding: 12px; background: #222; border: 2px dashed #555; border-radius: 8px; text-align: left; color: #777; position: relative; }
.timeline-slot::before { content: ''; position: absolute; left: -29px; top: 18px; width: 14px; height: 14px; background: #555; border-radius: 50%; }
.timeline-slot.filled { border-style: solid; border-color: #2ecc71; background: #202c25; color: #fff; }
.timeline-slot.filled::before { background: #2ecc71; }

/* Game 2: Security (Hacker Style) */
.detector-stage { text-align: center; background: #000; padding: 30px; border-radius: 12px; max-width: 600px; margin: 0 auto; position: relative; border: 4px solid #c0392b; box-shadow: 0 0 20px rgba(192, 57, 43, 0.2); }
.red-alert { color: #e74c3c; font-weight: bold; font-family: monospace; font-size: 1.2rem; margin-bottom: 10px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.security-screen { background: #111; padding: 20px; border-radius: 4px; border: 1px solid #333; min-height: 60px; margin-bottom: 20px; display:flex; flex-wrap:wrap; gap:10px; justify-content:center; color: #2ecc71; font-family: monospace; font-size: 1.2rem; }
.word-bank-sec { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.sec-word { background: #222; color: #2ecc71; padding: 10px 15px; border-radius: 4px; cursor: pointer; font-family: monospace; font-size: 1rem; border: 1px solid #2ecc71; transition: 0.2s; }
.sec-word:hover { background: #2ecc71; color: #000; }
.word-in-sentence { background: #2ecc71; color: #000; padding: 5px 10px; border-radius: 2px; font-weight: bold; cursor: pointer; }

/* Game 3: The Commute */
.commute-track { height: 100px; background: #333; margin: 20px 0; border-radius: 50px; position: relative; overflow: hidden; border: 4px solid #555; }
.commute-player { position: absolute; left: 10px; top: 20px; font-size: 3rem; transition: left 0.5s ease; }
.commute-bus { position: absolute; right: 10px; top: 20px; font-size: 3rem; }
.commute-question-box { background: #2c3e50; padding: 20px; border-radius: 8px; text-align: center; }
.commute-opts { display: flex; gap: 20px; justify-content: center; }
.commute-btn { flex: 1; padding: 15px; border: none; background: #fff; color: #2c3e50; font-weight: bold; font-size: 1rem; border-radius: 5px; cursor: pointer; border-bottom: 4px solid #ccc; }
.commute-btn:active { border-bottom: 0; transform: translateY(4px); }

@media (max-width: 600px) {
    .comic-board { grid-template-columns: 1fr; }
    .vocab-grid-3 { grid-template-columns: 1fr; }
}