/* ============================================================
   LESSON 01 — STYLESHEET (UK English, Cross-browser safe)
   ============================================================ */

/* --- 0. BOX MODEL RESET (cross-browser consistency) --- */
*, *::before, *::after {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

/* --- 1. GLOBAL STYLES --- */
html { -webkit-text-size-adjust: 100%; }

body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    min-height: 100vh;
}

.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: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 10px;
}

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;
    -webkit-transition: color 0.2s, border-color 0.2s;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
    display: inline-block;
}
.back-link:hover { color: #fff; border-color: #fff; }

.nav-container {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 8px;
    margin-top: 15px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

button.nav-btn {
    background: #1e1e1e;
    border: 1px solid #333;
    color: #aaa;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 4px;
    -webkit-transition: background 0.3s, color 0.3s, border-color 0.3s;
    transition: background 0.3s, color 0.3s, border-color 0.3s;
    font-weight: bold;
    font-size: 0.95rem;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}
button.nav-btn.active,
button.nav-btn:hover {
    background: #27ae60;
    color: #fff;
    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;
    -webkit-animation: fadeIn 0.4s ease;
    animation: fadeIn 0.4s ease;
}
.section-box.active { display: block; }

@-webkit-keyframes fadeIn {
    from { opacity: 0; -webkit-transform: translateY(5px); transform: translateY(5px); }
    to   { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- 4. VOCABULARY --- */
.vocab-list-single {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    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: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #333;
    font-size: 1rem;
    background: #222;
    border-radius: 4px;
    border-left: 3px solid transparent;
    -webkit-transition: background 0.2s, border-left-color 0.2s;
    transition: background 0.2s, border-left-color 0.2s;
}
.vocab-row:hover {
    background: #2a2a2a;
    border-left-color: #27ae60;
}
.vocab-row span:first-child { font-weight: bold; width: 150px; color: #fff; }
.ipa {
    color: #f39c12;
    width: 160px;
    font-family: 'Lucida Sans Unicode', 'Arial Unicode MS', 'DejaVu Sans', 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;
    -webkit-filter: grayscale(1);
    filter: grayscale(1);
    -webkit-transition: -webkit-filter 0.2s, -webkit-transform 0.2s;
    transition: filter 0.2s, transform 0.2s;
    color: #2ecc71;
    padding: 2px 5px;
    font-family: inherit;
}
.speak-btn:hover {
    -webkit-filter: grayscale(0);
    filter: grayscale(0);
    -webkit-transform: scale(1.1);
    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;
}

/* --- VOCAB EXERCISES --- */
.vocab-ex-wrapper {
    margin-top: 35px;
    border-top: 2px dashed #333;
    padding-top: 25px;
}
.vocab-ex-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #f39c12;
    margin-bottom: 20px;
    border-left: 4px solid #f39c12;
    padding-left: 12px;
}

/* --- 5. GRAMMAR RULES --- */
.rule-box { margin-bottom: 30px; }

.rule-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 20px;
}
.rule-card {
    background: #252525;
    border: 1px solid #444;
    padding: 15px;
    border-radius: 8px;
    -webkit-box-flex: 1;
    -ms-flex: 1 1 200px;
    flex: 1 1 200px;
    min-width: 200px;
}
.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; margin: 0; }
.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: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    color: #fff;
    font-weight: bold;
    margin-bottom: 10px;
}

/* Tables */
.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; vertical-align: top; }
.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;
}

/* --- GRAMMAR LAB SECTIONS --- */
.gl-section {
    margin-bottom: 40px;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
}
.gl-section-header {
    background: #1a3d2b;
    border-left: 5px solid #27ae60;
    color: #fff;
    font-size: 1.05rem;
    font-weight: bold;
    padding: 13px 20px;
    letter-spacing: 0.03em;
}
.gl-section > div { padding: 20px; }
.gl-section .gl-ex-block { margin: 0 20px 20px; padding: 20px; }

.gl-ex-block {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 3px solid #f39c12;
}
.gl-ex-block h4 { margin-top: 0; color: #bbb; margin-bottom: 15px; }

.gl-q-row {
    margin-bottom: 12px;
    font-size: 0.95rem;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 8px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

/* Shared form element base (cross-browser) */
.gl-q-row select,
.gl-q-row input[type="text"] {
    background: #333;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.gl-q-row select {
    padding: 5px 28px 5px 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23aaa' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
}

.gl-q-row input[type="text"] {
    padding: 5px 10px;
    width: 200px;
}

.gl-feedback { margin-top: 15px; font-weight: bold; font-size: 0.95rem; }

/* --- 6. READING --- */
.newspaper-container {
    border: 2px solid #555;
    background: #222;
    padding: 20px;
    border-radius: 8px;
    min-height: 450px;
    position: relative;
}

.newspaper-page { display: none; -webkit-animation: fadeIn 0.5s; animation: fadeIn 0.5s; }
.newspaper-page.active { display: block; }

.news-layout {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 20px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.news-img {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 150px;
    flex: 1 1 150px;
    min-width: 150px;
    max-width: 180px;
    height: 180px;
    background: #333;
    border: 1px solid #444;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 3rem;
}
.news-content {
    -webkit-box-flex: 3;
    -ms-flex: 3 1 250px;
    flex: 3 1 250px;
    min-width: 250px;
}
.news-content h3 { color: #f39c12; margin-top: 0; }

.news-controls {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

/* Reading quiz — radio style */
.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: 16px; font-size: 0.95rem; }
.q-row p { margin: 0 0 7px; font-weight: bold; color: #e0e0e0; }
.q-row label {
    display: block;
    padding: 7px 14px;
    margin: 3px 0;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    -webkit-transition: background 0.2s;
    transition: background 0.2s;
    color: #ccc;
}
.q-row label:hover { background: #333; }
.q-row input[type="radio"] { margin-right: 8px; accent-color: #27ae60; }
.fb { display: block; margin-top: 6px; font-weight: bold; font-size: 0.9rem; min-height: 18px; }

/* --- 7. EXERCISES (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: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 10px;
    border: 1px solid #333;
    font-size: 0.95rem;
}
.party-options {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 6px;
}

.quiz-input {
    background: #333;
    border: 1px solid #555;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    width: 180px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.check-btn {
    background: #f39c12;
    color: #000;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    font-size: 0.9rem;
    -webkit-transition: background 0.2s, color 0.2s;
    transition: background 0.2s, color 0.2s;
}
.check-btn:hover { background: #d35400; color: #fff; }

.ex-btn {
    background: #333;
    border: 1px solid #555;
    color: #ccc;
    padding: 7px 13px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    -webkit-transition: background 0.2s;
    transition: background 0.2s;
}
.ex-btn:hover { background: #444; }

.feedback-icon { font-weight: bold; font-size: 1.2rem; margin-left: 6px; }

/* --- 8. CLOZE TEST --- */
.cloze-container {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 25px;
}
.cloze-title { color: #f39c12; margin-top: 0; }

.cloze-text {
    font-size: 1rem;
    color: #ccc;
    line-height: 2.4;
}
.cloze-text p { margin-bottom: 18px; }

/* Cloze selects — fully styled, cross-browser */
.cloze-select {
    display: inline-block;
    background: #252525;
    color: #e0e0e0;
    border: 2px solid #444;
    border-radius: 5px;
    padding: 4px 30px 4px 10px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    outline: none;
    vertical-align: middle;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23aaa' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    -webkit-transition: border-color 0.2s;
    transition: border-color 0.2s;
    min-width: 110px;
    margin: 0 3px;
}
.cloze-select:hover { border-color: #27ae60; }
.cloze-select:focus { border-color: #f39c12; }
.cloze-select option { background: #252525; color: #e0e0e0; }

/* Correct / wrong state classes (applied by JS) */
.cloze-correct { border-color: #2ecc71 !important; background: #1a3a1a !important; color: #2ecc71 !important; }
.cloze-wrong   { border-color: #e74c3c !important; background: #3a1a1a !important; color: #e74c3c !important; }

/* Score and controls */
.cloze-controls {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}
.score-display { font-weight: bold; color: #f39c12; font-size: 0.95rem; }
.score-perfect { color: #2ecc71 !important; }

.reset-btn { background: #333 !important; color: #ccc !important; border: 1px solid #555 !important; }
.reset-btn:hover { background: #444 !important; color: #fff !important; }

/* Feedback box */
.cloze-feedback-box {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 15px 20px;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #ccc;
}
.cloze-errors { padding-left: 20px; margin: 8px 0 0; }
.cloze-errors li { margin-bottom: 6px; }
.cloze-errors em { color: #e74c3c; }
.cloze-errors strong { color: #2ecc71; }

/* Cloze answer key */
.cloze-answer-key {
    margin-top: 20px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-left: 4px solid #27ae60;
    border-radius: 6px;
    padding: 18px 22px;
}
.cloze-answer-key h4 {
    margin: 0 0 12px;
    color: #2ecc71;
    font-size: 1rem;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}
.cloze-key-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 10px;
}
.cloze-key-item {
    background: #252525;
    border: 1px solid #444;
    border-radius: 5px;
    padding: 7px 14px;
    font-size: 0.95rem;
    min-width: 100px;
}
.cloze-key-item .key-num { color: #f39c12; font-weight: bold; margin-right: 5px; }
.cloze-key-item .key-word { color: #2ecc71; font-weight: bold; }

/* --- RESPONSIVE --- */
@media (max-width: 700px) {
    body { padding: 12px; }
    .section-box { padding: 16px; }
    .vocab-row { -ms-flex-wrap: wrap; flex-wrap: wrap; }
    .vocab-row span:first-child { width: 100%; }
    .ipa { width: 100%; }
    .news-img { max-width: 100%; height: 100px; }
    .pro-table { font-size: 0.82rem; }
    .pro-table th, .pro-table td { padding: 8px 6px; }
    .cloze-select { min-width: 100px; font-size: 0.9rem; }
    .cloze-text { line-height: 2.8; }
    h1 { font-size: 1.4rem; }
    .gl-q-row input[type="text"] { width: 150px; }
    .rule-card { -ms-flex: 1 1 100%; flex: 1 1 100%; }
}