/* --- 1. GLOBAL STYLES (Green Theme) --- */
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: 200px; 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; border-radius: 0 4px 4px 0; }

/* --- 5. GRAMMAR RULES --- */
.rule-box { margin-bottom: 40px; border-bottom: 1px solid #333; padding-bottom: 30px; }
.rule-box:last-child { border-bottom: none; }
.rule-box h3 { color: #2ecc71; font-size: 1.15rem; margin-bottom: 8px; }
.rule-intro { color: #bbb; margin-bottom: 15px; font-size: 0.95rem; line-height: 1.7; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 20px; }
.three-col { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.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; font-size: 0.95rem; }
.rule-card ul { padding-left: 18px; color: #ccc; font-size: 0.88rem; margin: 0; }
.rule-card ul li { margin-bottom: 6px; }
.pro-table { width: 100%; border-collapse: collapse; background: #222; border: 1px solid #333; font-size: 0.9rem; margin-bottom: 20px; }
.pro-table th { background: #1a1a1a; color: #2ecc71; padding: 12px; text-align: left; border-bottom: 2px solid #333; font-weight: 600; }
.pro-table td { padding: 10px 12px; border-bottom: 1px solid #333; color: #e0e0e0; vertical-align: top; line-height: 1.6; }
.pro-table tr:hover { background: #2a2a2a; }
.pro-table .col-div { border-left: 2px solid #444; }

/* --- 6. GRAMMAR EXERCISE BLOCKS --- */
.grammar-ex-block { background: #1a1a1a; border-radius: 8px; padding: 20px; margin-top: 20px; border: 1px solid #333; }
.easy-ex { border-left: 4px solid #27ae60; }
.hard-ex { border-left: 4px solid #e67e22; }
.ex-instructions { color: #ddd; margin-bottom: 15px; font-size: 0.95rem; background: #252525; padding: 10px 14px; border-radius: 5px; }
.g-item { margin-bottom: 12px; padding: 8px 10px; background: #222; border-radius: 4px; font-size: 0.93rem; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: #ddd; border: 1px solid #333; }
.g-select { background: #333; border: 1px solid #555; color: #fff; padding: 4px 8px; border-radius: 4px; font-family: 'Segoe UI', sans-serif; font-size: 0.9rem; cursor: pointer; }
.g-input { background: #333; border: 1px solid #555; color: #fff; padding: 5px 10px; border-radius: 4px; width: 200px; font-family: 'Segoe UI', sans-serif; font-size: 0.9rem; }
.g-input.sm { width: 55px; }
.g-input.wide-input { width: 320px; }
.g-fb { font-weight: bold; font-size: 0.9rem; }
.ex-btn-row { display: flex; align-items: center; gap: 15px; margin-top: 15px; padding-top: 12px; border-top: 1px solid #333; }
.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; }
.ex-btn:hover { background: #444; }

/* --- 7. 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: 0 0 100px; height: 120px; background: #333; border: 1px solid #444; display:flex; align-items:center; justify-content:center; border-radius: 5px; font-size: 3rem; }
.news-content { flex: 3; min-width: 250px; }
.news-content h3 { color: #f39c12; margin-top: 0; }
.news-content p { color: #ddd; font-size: 0.95rem; line-height: 1.75; margin: 0 0 10px; white-space: pre-line; }
.news-controls { display: flex; justify-content: center; align-items: center; margin-top: 20px; }
.reading-quiz { background: #1a1a1a; padding: 18px; border-radius: 5px; border-left: 3px solid #f39c12; margin-top: 10px; }
.reading-quiz h4 { color: #f39c12; margin-top: 0; margin-bottom: 15px; }
.mc-q { margin-bottom: 18px; }
.mc-q p { color: #fff; font-weight: bold; margin-bottom: 8px; font-size: 0.95rem; }
.mc-q label { display: block; padding: 7px 12px; margin-bottom: 4px; background: #252525; border-radius: 4px; cursor: pointer; font-size: 0.9rem; color: #ccc; border: 1px solid #333; transition: 0.2s; }
.mc-q label:hover { background: #2e2e2e; border-color: #555; }
.mc-q input[type="radio"] { margin-right: 8px; accent-color: #27ae60; }
.mc-fb { display: block; font-weight: bold; font-size: 0.9rem; margin-top: 4px; }
.wide-speak { font-size: 0.9rem; background: #252525; border: 1px solid #444; border-radius: 4px; padding: 5px 12px; cursor: pointer; color: #2ecc71; margin-top: 8px; filter: none; }
.wide-speak:hover { background: #2f2f2f; }

/* --- 8. CLOZE --- */
.cloze-container { background: #222; border: 1px solid #444; padding: 25px; border-radius: 8px; }
.cloze-title { color: #f39c12; margin-top: 0; }
.cloze-text { font-size: 1rem; line-height: 2.3; color: #ddd; }
.cloze-text p { margin-bottom: 18px; }
.cloze-select { background: #2a2a2a; border: 1px solid #555; border-bottom: 2px solid #f39c12; color: #fff; padding: 3px 8px; border-radius: 4px 4px 0 0; font-size: 0.95rem; cursor: pointer; margin: 0 4px; transition: 0.2s; }
.cloze-select:focus { outline: none; border-color: #f39c12; }
.cloze-controls { display: flex; align-items: center; gap: 15px; margin-top: 20px; padding-top: 15px; border-top: 1px solid #333; flex-wrap: wrap; }
.cloze-feedback-box { background: #1a2a1a; border: 1px solid #2ecc71; padding: 15px; border-radius: 5px; margin-top: 15px; font-size: 0.9rem; color: #ccc; line-height: 1.8; }
.reset-btn { background: #333 !important; color: #aaa !important; }
.reset-btn:hover { background: #444 !important; }

/* --- 9. 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: 8px; border-bottom: 1px solid #444; padding-bottom: 5px; font-size: 1rem; }
.drill-instructions { background: #1e1e1e; padding: 9px 12px; border-radius: 4px; border-left: 3px solid #27ae60; color: #ccc; margin-bottom: 12px; font-size: 0.88rem; }
.mini-quiz-item { margin-bottom: 8px; padding: 10px; background: #222; border-radius: 4px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; border: 1px solid #333; font-size: 0.93rem; color: #ddd; }
.quiz-input { background: #333; border: 1px solid #555; color: #fff; padding: 5px 10px; border-radius: 4px; width: 200px; font-family: 'Segoe UI', sans-serif; }
.check-btn { background: #f39c12; color: #111; border: none; padding: 7px 14px; border-radius: 4px; cursor: pointer; font-weight: bold; transition: 0.2s; font-size: 0.9rem; }
.check-btn:hover { background: #d35400; color: white; }
.drill-fb { font-weight: bold; font-size: 0.88rem; }
.score-display { font-weight: bold; font-size: 1rem; color: #f39c12; }

/* --- 10. COMPARE BOXES --- */
.example-compare { display: flex; gap: 15px; align-items: stretch; flex-wrap: wrap; margin: 20px 0; }
.example-box { flex: 1; min-width: 220px; background: #252525; border: 1px solid #444; border-radius: 8px; padding: 18px; }
.example-box.lw-because { border-left: 4px solid #e74c3c; }
.example-box.lw-so      { border-left: 4px solid #27ae60; }
.example-box p { margin: 6px 0; font-size: 0.9rem; color: #ddd; line-height: 1.6; }
.ex-label { font-weight: bold; color: #f39c12; font-size: 0.88rem; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; display: block; }
.arrow-box { display: flex; align-items: center; justify-content: center; color: #555; font-weight: bold; font-size: 1.4rem; padding: 10px; flex: 0 0 auto; }

/* --- 11. RESPONSIVE --- */
@media (max-width: 600px) {
    body { padding: 12px; }
    h1 { font-size: 1.4rem; }
    .vocab-row span:first-child { width: 130px; }
    .ipa { width: 100px; }
    .g-input.wide-input { width: 100%; }
    .rule-grid { grid-template-columns: 1fr; }
    .news-img { display: none; }
    .example-compare { flex-direction: column; }
    .arrow-box { transform: rotate(90deg); }
}

/* --- 11. LEVEL BADGE & SUBTITLE --- */
.level-badge { display: inline-block; background: #27ae60; color: #fff; font-size: 0.75rem; font-weight: bold; letter-spacing: 0.08em; padding: 3px 10px; border-radius: 3px; margin-bottom: 8px; text-transform: uppercase; }
.subtitle { font-size: 0.88rem; color: #888; margin-top: 4px; }

/* --- 12. KEY WORD TRANSFORMATION --- */
.kwt-item { background: #222; border: 1px solid #444; border-radius: 8px; padding: 20px 22px; margin-bottom: 20px; }
.kwt-number { font-size: 0.78rem; color: #888; font-weight: bold; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.kwt-s1 { color: #ddd; font-size: 0.95rem; margin-bottom: 14px; line-height: 1.6; border-left: 3px solid #555; padding-left: 10px; }
.kwt-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.kwt-keyword { background: #f39c12; color: #111; font-weight: bold; font-size: 0.88rem; padding: 4px 10px; border-radius: 4px; letter-spacing: 0.05em; white-space: nowrap; }
.kwt-gapped { color: #ccc; font-size: 0.95rem; line-height: 1.8; }
.kwt-input { background: #333; border: 1px solid #555; color: #fff; padding: 5px 10px; border-radius: 4px; width: 220px; font-family: 'Segoe UI', sans-serif; font-size: 0.9rem; margin: 0 4px; }
.kwt-textarea { background: #2a2a2a; border: 1px solid #555; color: #fff; padding: 9px 12px; border-radius: 4px; width: 100%; font-family: 'Segoe UI', sans-serif; font-size: 0.93rem; resize: vertical; line-height: 1.6; box-sizing: border-box; transition: border-color 0.2s; }
.kwt-textarea:focus { outline: none; border-color: #27ae60; }
.kwt-hint { font-size: 0.83rem; color: #777; font-style: italic; margin-top: 4px; }
.kwt-fb { display: none; font-weight: bold; font-size: 0.9rem; margin-top: 6px; }

/* --- 13. CLOZE INPUT (inline text) --- */
.cloze-input-text { background: #2a2a2a; border: none; border-bottom: 2px solid #f39c12; color: #fff; padding: 2px 6px; border-radius: 4px 4px 0 0; font-size: 0.95rem; width: 100px; margin: 0 4px; font-family: 'Segoe UI', sans-serif; transition: border-color 0.2s, background 0.2s; }
.cloze-input-text:focus { outline: none; border-bottom-color: #2ecc71; }

/* --- 15. PROGRESS BAR --- */
.progress-bar-wrap { margin: 18px 0 28px; }
.progress-bar-track { display: flex; align-items: center; gap: 0; position: relative; }
.progress-bar-track::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 2px; background: #333; transform: translateY(-50%); z-index: 0; }
.progress-step { width: 30px; height: 30px; border-radius: 50%; background: #2a2a2a; border: 2px solid #444; color: #666; font-size: 0.8rem; font-weight: bold; display: flex; align-items: center; justify-content: center; z-index: 1; flex-shrink: 0; margin-right: auto; transition: 0.3s; cursor: default; }
.progress-step:last-child { margin-right: 0; }
.progress-step.active { background: #27ae60; border-color: #27ae60; color: #fff; box-shadow: 0 0 8px rgba(39,174,96,0.5); }
.progress-labels { display: flex; justify-content: space-between; margin-top: 6px; }
.progress-labels span { font-size: 0.72rem; color: #666; text-align: center; flex: 1; }

/* --- 16. BRIDGE NOTES --- */
.bridge-note { background: #1a2a1a; border-left: 3px solid #27ae60; padding: 10px 14px; color: #9be09b; font-size: 0.88rem; border-radius: 0 4px 4px 0; margin-bottom: 16px; line-height: 1.6; }

/* --- 17. LEVEL TAGS --- */
.level-tag { font-size: 0.65rem; font-weight: bold; padding: 1px 5px; border-radius: 3px; vertical-align: middle; margin-left: 4px; }
.level-tag.b2 { background: #8e44ad; color: #fff; }

/* --- 18. VOCAB RECYCLE BLOCK --- */
.vocab-recycle-block { margin-top: 10px; }

/* --- 19. TIMELINE COMPONENT (PAST PERFECT) --- */
.timeline-container {
    position: relative;
    padding: 40px 0;
    margin: 20px 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}
.timeline-line {
    position: absolute;
    bottom: 25px;
    left: 5%;
    right: 5%;
    height: 4px;
    background: #444;
    border-radius: 2px;
    z-index: 0;
}
.timeline-point {
    position: relative;
    z-index: 1;
    text-align: center;
    width: 30%;
}
.tp-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin: 10px auto;
    border: 3px solid #1a1a1a;
}
.past-perfect .tp-dot { background: #e74c3c; box-shadow: 0 0 10px rgba(231, 76, 60, 0.6); }
.past-simple .tp-dot { background: #3498db; box-shadow: 0 0 10px rgba(52, 152, 219, 0.6); }
.present .tp-dot { background: #2ecc71; box-shadow: 0 0 10px rgba(46, 204, 113, 0.6); }

.tp-label {
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}
.past-perfect .tp-label { color: #e74c3c; }
.past-simple .tp-label { color: #3498db; }
.present .tp-label { color: #2ecc71; }

.tp-action {
    font-size: 0.9rem;
    color: #ddd;
    background: #252525;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #333;
    margin-top: 5px;
}

@media (max-width: 600px) {
    .timeline-container { flex-direction: column; align-items: flex-start; padding: 20px 0; border-left: 4px solid #444; margin-left: 20px; }
    .timeline-line { display: none; }
    .timeline-point { width: 100%; text-align: left; padding-left: 20px; margin-bottom: 20px; }
    .tp-dot { position: absolute; left: -14px; top: 0; margin: 0; }
    .tp-action { display: inline-block; margin-top: 8px; }
}

/* --- 20. 5 QUESTIONS TENSE STRATEGY BOX --- */
.tense-strategy-box {
    background: #1a1a1a;
    border: 1px solid #333;
    border-top: 4px solid #9b59b6;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 40px;
}
.tense-strategy-box h3 {
    color: #9b59b6;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.3rem;
}
.strategy-step {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    background: #222;
    padding: 15px;
    border-radius: 6px;
    border-left: 2px solid #444;
}
.step-num {
    background: #9b59b6;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}
.step-content {
    font-size: 0.95rem;
    color: #ccc;
    line-height: 1.6;
}
.step-content strong {
    color: #fff;
    font-size: 1rem;
}