/* --- 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 --- */
.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. VOCABULARY --- */
.vocab-list-single { display: flex; flex-direction: column; gap: 5px; max-width: 800px; margin: 0 auto; }
.vocab-category { color: #2ecc71; margin-top: 25px; margin-bottom: 5px; border-bottom: 1px solid #444; padding-bottom: 5px; text-transform: uppercase; font-size: 1rem; }
.vocab-row { display: flex; align-items: center; padding: 10px 15px; border-bottom: 1px solid #333; font-size: 1rem; background: #222; border-radius: 4px; }
.vocab-row:hover { background: #2a2a2a; border-left: 3px solid #27ae60; }
.vocab-row span:first-child { font-weight: bold; width: 150px; color: #fff; }
.ipa { color: #f39c12; width: 140px; font-family: 'Lucida Sans Unicode', 'Arial Unicode MS', sans-serif; font-size: 0.9rem; }
.bg { color: #aaa; font-style: italic; margin-right: auto; }
.speak-btn { background: none; border: none; cursor: pointer; font-size: 1.2rem; margin-left: 10px; filter: grayscale(1); transition: 0.2s; color: #2ecc71; }
.speak-btn:hover { filter: grayscale(0); transform: scale(1.1); }
.context-note { background: #2a2a2a; padding: 15px; border-left: 3px solid #2ecc71; color: #ccc; margin-bottom: 20px; font-size: 0.95rem; }

/* --- 5. GRAMMAR RULES --- */
.rule-box { margin-bottom: 30px; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.rule-card { background: #252525; border: 1px solid #444; padding: 15px; border-radius: 8px; }
.rule-card h4 { color: #f39c12; margin-top: 0; border-bottom: 1px solid #555; padding-bottom: 5px; }
.rule-card ul { padding-left: 20px; color: #ccc; font-size: 0.9rem; }
.rule-card li { margin-bottom: 5px; }

.grammar-block { margin-bottom: 40px; }
.grammar-title-bar { 
    background: #121212; padding: 10px 15px; border-left: 5px solid #27ae60; 
    display: flex; justify-content: space-between; align-items: center; 
    color: #fff; font-weight: bold; margin-bottom: 10px;
}
.pro-table { width: 100%; border-collapse: collapse; background: #222; border: 1px solid #333; font-size: 0.95rem; }
.pro-table th { background: #1a1a1a; color: #2ecc71; padding: 12px; text-align: left; border-bottom: 2px solid #333; font-weight: 600; }
.pro-table td { padding: 12px; border-bottom: 1px solid #333; color: #e0e0e0; }
.pro-table tr:hover { background: #2a2a2a; }
.pro-table strong { color: #fff; }
.short-answer-box { background: #252525; padding: 10px; border: 1px solid #333; border-top: none; color: #bbb; font-style: italic; font-size: 0.9rem; }

/* --- 6. READING --- */
.newspaper-container { border: 2px solid #555; background: #222; padding: 20px; border-radius: 8px; min-height: 450px; position: relative; }
.newspaper-page { display: none; animation: fadeIn 0.5s; }
.newspaper-page.active { display: block; }
.news-layout { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.news-img { flex: 1; min-width: 150px; height: 180px; background: #333; border: 1px solid #444; display:flex; align-items:center; justify-content:center; border-radius: 5px; }
.news-content { flex: 3; min-width: 250px; }
.news-content h3 { color: #f39c12; margin-top: 0; }
.news-controls { display: flex; justify-content: center; align-items: center; margin-top: 20px; }
.reading-quiz { background: #1a1a1a; padding: 15px; border-radius: 5px; border-left: 3px solid #f39c12; }
.reading-quiz h4 { margin-top: 0; color: #ccc; }
.q-row { margin-bottom: 10px; font-size: 0.95rem; }
.q-row input { background: #333; border: 1px solid #555; color: white; padding: 4px 8px; border-radius: 4px; margin-left: 10px; }
.fb { font-weight: bold; margin-left: 10px; }

/* --- 7. DRILLS --- */
.quiz-block { border: 1px solid #333; padding: 20px; border-radius: 8px; background: #252525; margin-bottom: 20px;}
.quiz-header { font-weight: bold; color: #f39c12; margin-bottom: 10px; border-bottom: 1px solid #444; padding-bottom: 5px; }
.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: 120px; font-family: 'Segoe UI', sans-serif; }
.check-btn { background: #f39c12; color: black; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.check-btn:hover { background: #d35400; color: white; }
.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; }
.feedback-icon { font-weight: bold; font-size: 1.2rem; margin-left: 10px; }

/* --- 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; }

/* Board Layout: 2 Columns (2x2 Grid) */
.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; }

/* Panels */
.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 Bubbles */
.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; }

/* Draggable Word Bank */
.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;}

/* Mobile Response (Stack columns vertically) */
@media (max-width: 600px) {
    .comic-board { grid-template-columns: 1fr; }
}
/* GAMES */
.game-wrapper { display: none; margin-top: 20px; }
.career-arena { background: #2c3e50; padding: 30px; border-radius: 10px; text-align: center; border: 4px solid #e67e22; max-width: 500px; margin: 0 auto; position: relative; min-height: 300px; display: flex; flex-direction: column; justify-content: center;}
.virus-arena { height: 350px; background: #333; border: 4px solid #f1c40f; position: relative; overflow: hidden; margin-bottom: 10px; cursor: none; }
.falling-word { position: absolute; padding: 10px 20px; border-radius: 10px; font-weight: bold; color: white; cursor: pointer; user-select: none; border: 2px solid #fff; font-size: 1.1rem; white-space: nowrap; }
.falling-word.good { background: #2ecc71; }
.falling-word.bad { background: #e74c3c; } 
#police-start-overlay { position: absolute; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.85); z-index: 10; }

/* GRAMMAR PUZZLE GAME */
.puzzle-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; max-width: 800px; margin: 0 auto; }
.puzzle-piece { 
    background: #34495e; color: #fff; padding: 15px 20px; 
    cursor: pointer; font-weight: bold; font-size: 1rem; user-select: none;
    transition: transform 0.2s, background 0.2s; position: relative;
    border: 2px solid #2c3e50;
    min-width: 100px; text-align: center;
}
.puzzle-piece:hover { transform: translateY(-3px); }
.piece-left { border-radius: 5px 20px 20px 5px; border-right: 4px solid #2980b9; background: #3498db; margin-right: 5px;}
.piece-right { border-radius: 20px 5px 5px 20px; border-left: 4px solid #d35400; background: #e67e22; margin-left: 5px;}

.puzzle-piece.selected { border-color: #f1c40f; box-shadow: 0 0 10px #f1c40f; transform: scale(1.1); z-index: 10; }
.puzzle-piece.matched { opacity: 0; pointer-events: none; transform: scale(0); transition: 0.5s; }

/* WITNESS GAME */
#witness-timer-bar { width: 100%; height: 10px; background: #333; margin-top: 10px; border-radius: 5px; overflow: hidden; }
#witness-fill { height: 100%; width: 100%; background: #e74c3c; transition: width 0.1s linear; }
.witness-face { font-size: 4rem; margin-bottom: 10px; display: block; }
.w-opt-btn { display: block; width: 100%; margin: 5px 0; padding: 8px; background: #34495e; color: white; border: none; cursor: pointer; border-radius: 4px; }
.w-opt-btn:hover { background: #46607a; }

@media (max-width: 600px) {
    .comic-board { grid-template-columns: 1fr; }
    .comic-panel { flex-direction: column; align-items: center; text-align: center;}
    .comic-panel.right { flex-direction: column-reverse; }
    .speech-bubble { text-align: center; justify-content: center; width: 100%;}
    .vocab-row { flex-direction: column; align-items: flex-start; gap: 5px; }
    .vocab-row span, .ipa { width: 100%; }
}