:root {
    --bg: #f6f3ed;
    --surface: #ffffff;
    --surface-soft: #eeefe7;
    --text: #0f172a;
    --muted: #66708f;
    --primary: #0ea76b;
    --primary-soft: #e7f9f1;
    --border: #e6e7eb;
    --border-soft: #dfdfdf;
    --hero-overlay: rgba(13, 20, 44, 0.64);
    --accent: #ffcc28;
    --accent-text: #111827;
    --shadow: 0 10px 28px rgba(9, 18, 32, 0.08);
    --top-offset: 72px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Open Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
h1, h2, h3, h4 { font-family: 'Montserrat', sans-serif; }
a { color: inherit; text-decoration: none; }
.container { width: min(1140px, 92%); margin: 0 auto; }

body.dark {
    --bg: #0f1220;
    --surface: #171a2b;
    --surface-soft: #1a1d2e;
    --text: #eff2ff;
    --muted: #b4bdd8;
    --primary: #25d08a;
    --primary-soft: #153327;
    --border: #2a3048;
    --border-soft: #686868;
    --hero-overlay: rgba(8, 10, 20, 0.68);
    --accent: #ffcc28;
    --accent-text: #111827;
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.nav-wrap {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.85rem;
    letter-spacing: 0.3px;
}
.topbar-logo span,
.brand span { color: var(--primary); }
.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 26px;
}
.nav-links a {
    color: var(--muted);
    font-weight: 600;
    font-size: 1.02rem;
}
.nav-links a:hover,
.nav-links a.active-link { color: var(--primary); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 1.05rem;
}
.subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 14px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    padding: 10px 16px;
    font-weight: 700;
}
.mobile-menu-btn { display: none; }

footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 24px 0;
    text-align: center;
    color: var(--muted);
    margin-top: 40px;
}

/* Home page sections */
.hero {
    min-height: 68vh;
    background-image: linear-gradient(var(--hero-overlay), var(--hero-overlay)), url('https://images.unsplash.com/photo-1532187643603-ba119ca4109e?auto=format&fit=crop&w=1900&q=80');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.12;
    color: #fff;
    max-width: 850px;
    margin-bottom: 16px;
}
.hero h1 span { color: #74e0aa; }
.hero p {
    color: #dce6ff;
    font-size: clamp(1rem, 2vw, 1.2rem);
    max-width: 720px;
    margin-bottom: 28px;
}
.hero-btns { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
    border-radius: 14px;
    padding: 14px 24px;
    font-weight: 700;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}
.btn-yellow { background: var(--accent); color: var(--accent-text); }
.btn-outline {
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    color: var(--text);
    border-color: var(--border);
}
.section { padding: 72px 0; }
.section-alt { background: color-mix(in srgb, var(--surface) 72%, var(--bg)); }
.section-title {
    font-size: clamp(1.9rem, 3.4vw, 3rem);
    text-align: center;
    margin-bottom: 10px;
}
.section-title span { color: var(--primary); }
.section-sub { text-align: center; color: var(--muted); margin-bottom: 36px; }
.chapter-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.chapter-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.2rem;
}
.chapter-list { list-style: none; }
.chapter-main-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-weight: 600;
}
.chapter-main-link:hover { background: var(--primary-soft); color: var(--primary); }
.about-box, .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}
.about-box { margin: 0 auto; padding: 34px; text-align: center; }
.about-list { margin: 18px auto 0; max-width: 520px; text-align: left; list-style: none; }
.about-list li { margin: 10px 0; color: var(--muted); }
.about-list li::before { content: "• "; color: var(--primary); font-weight: 800; margin-right: 6px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 22px; }
.panel { padding: 24px; }
.panel p, .contact-item { color: var(--muted); }
.contact-item { margin-top: 16px; }
.input, .textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    padding: 12px 14px;
    margin-top: 6px;
    margin-bottom: 14px;
    font: inherit;
}
.textarea { min-height: 120px; resize: vertical; }
.submit-btn {
    width: 100%;
    border: none;
    background: var(--accent);
    color: var(--accent-text);
    border-radius: 12px;
    padding: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}

/* Chapter page */
.page-layout { min-height: calc(100vh - var(--top-offset)); }
.chapter-page .sidebar {
    width: 300px;
    position: fixed;
    top: var(--top-offset);
    left: 0;
    bottom: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    overflow: hidden;
    transition: width 0.25s ease, padding 0.25s ease;
}
.chapter-page.sidebar-collapsed .sidebar {
    width: 72px;
    padding: 20px 10px;
}
.chapter-page.sidebar-collapsed .sidebar-class-label,
.chapter-page.sidebar-collapsed .sidebar-chapter-list li a {
    font-size: 0;
}
.chapter-page.sidebar-collapsed .sidebar-toggle {
    padding: 8px 0;
    font-size: 0.8rem;
}
.chapter-page.sidebar-collapsed .sidebar-chapter-list li a {
    justify-content: center;
    padding: 8px 0;
}
.chapter-page.sidebar-collapsed .chapter-num {
    font-size: 0.74rem;
}
.sidebar-toggle {
    width: 100%;
    margin-bottom: 14px;
    font-size: 0.86rem;
    font-weight: 700;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
}
.sidebar-class-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--text);
    text-transform: uppercase;
    margin-bottom: 10px;
}
.sidebar-chapter-list { list-style: none; }
.sidebar-chapter-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}
.sidebar-chapter-list li a:hover { background: var(--primary-soft); color: var(--primary); }
.sidebar-chapter-list li a.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}
.chapter-num {
    min-width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    font-size: 0.74rem;
    font-weight: 700;
}
.chapter-page .main-content {
    margin-left: 300px;
    padding: 24px 40px 40px;
    transition: margin-left 0.25s ease;
}
.chapter-page.sidebar-collapsed .main-content { margin-left: 72px; }
.chapter-header {
    position: sticky;
    top: var(--top-offset);
    z-index: 120;
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    padding: 12px 0 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.chapter-badge {
    display: inline-block;
    border: 1.5px solid #c8c8c8;
    background: var(--surface);
    color: #777;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
}
.chapter-title { font-size: 2.3rem; margin-bottom: 8px; line-height: 1.2; }
.chapter-title .highlight { color: var(--primary); }
.chapter-desc { color: var(--muted); margin-bottom: 16px; }
.tab-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
}
.tab-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.section-divider { height: 1px; background: var(--border); margin: 30px 0; }
.section-header { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.section-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-soft);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.section-subtitle { color: var(--muted); font-size: 0.92rem; margin-bottom: 20px; padding-left: 58px; }
.video-embed-wrapper { position: relative; padding-bottom: 25%; height: 0; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.video-embed-wrapper iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.notes-card, .quiz-start-card, .quiz-active-card, .activity-item, .pyq-item {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
}
.notes-card { padding: 40px 30px; text-align: center; }
.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    cursor: pointer;
}
.activity-num {
    width: 36px;
    height: 36px;
    background: var(--primary-soft);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
}
.activity-info { flex: 1; }
.activity-type { font-size: 0.82rem; color: var(--primary); font-weight: 700; }
.activity-chevron { color: var(--muted); transition: transform 0.25s; }
.activity-item.open .activity-chevron { transform: rotate(180deg); }
.activity-body { display: none; padding: 0 20px 18px 72px; border-top: 1px solid var(--border); padding-top: 14px; color: var(--muted); }
.activity-item.open .activity-body { display: block; }

/* Activity visual card from screenshot */
.activity-sim {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.sim-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--border);
}
.sim-step {
    text-align: center;
    padding: 10px;
    color: var(--muted);
    font-weight: 600;
}
.sim-step.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}
.sim-stage {
    background: #f7f8f2;
    margin: 18px;
    border-radius: 12px;
    padding: 26px;
    text-align: center;
}
.sim-title {
    color: var(--text);
    font-size: 1.6rem;
    margin-bottom: 8px;
}
.sim-caption {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 8px;
}
.sim-dots { display: inline-flex; gap: 6px; }
.sim-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d4d4d4;
}
.sim-dot.active { width: 28px; border-radius: 10px; background: var(--primary); }
.sim-instruction {
    border: 1px solid var(--border);
    margin: 0 18px 16px;
    border-radius: 10px;
    padding: 14px;
    color: var(--text);
}
.sim-materials { margin: 0 18px 16px; }
.sim-materials h4 {
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}
.material-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.material-chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    padding: 5px 12px;
    font-size: 0.82rem;
}
.sim-nav {
    display: flex;
    justify-content: space-between;
    padding: 0 18px 18px;
}
.sim-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    padding: 10px 18px;
    font-weight: 700;
    cursor: pointer;
}
.sim-btn.next { background: var(--accent); border-color: transparent; }
.sim-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.pyq-list { display: flex; flex-direction: column; gap: 10px; }
.pyq-item { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.pyq-tags { display: flex; gap: 8px; }
.tag { padding: 4px 10px; border-radius: 6px; font-size: 0.78rem; font-weight: 700; }
.tag-year { background: #f0f0f0; color: var(--muted); }
.tag-marks { background: var(--primary-soft); color: var(--primary); }
.quiz-start-card { padding: 50px 30px; text-align: center; }
.quiz-active-card { display: none; padding: 28px; }
.quiz-meta { display: flex; justify-content: space-between; margin-bottom: 10px; }
.quiz-score { color: var(--primary); font-weight: 700; }
.quiz-progress-bar { height: 5px; background: #eee; border-radius: 3px; margin-bottom: 22px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: var(--primary); transition: width 0.3s; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option { display: flex; gap: 12px; padding: 12px 16px; border-radius: 8px; background: #f2f2f2; border: 2px solid transparent; cursor: pointer; }
.quiz-option:hover:not(.answered) { background: var(--primary-soft); border-color: var(--primary); }
.quiz-option .opt-label { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; background: #ddd; font-weight: 700; }
.quiz-option.correct { background: var(--primary-soft); border-color: var(--primary); }
.quiz-option.correct .opt-label { background: var(--primary); color: #fff; }
.quiz-option.wrong { background: #fdecea; border-color: #e53935; }
.quiz-option.wrong .opt-label { background: #e53935; color: #fff; }
.quiz-next-btn, .btn-retake, .btn-download {
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 700;
    cursor: pointer;
    padding: 11px 24px;
}
.btn-start-quiz {
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 700;
    cursor: pointer;
    padding: 11px 24px;
}
.quiz-next-btn { display: none; margin-top: 18px; }
.quiz-result-card { display: none; text-align: center; padding-top: 20px; }

@media (max-width: 980px) {
    .nav-links {
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        padding: 16px 4%;
        display: none;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    .nav-links.open { display: flex; }
    .mobile-menu-btn { display: inline-block; }
    .contact-grid { grid-template-columns: 1fr; }
    .brand { font-size: 1.4rem; }
    .subscribe-btn { padding: 10px 12px; }
    .chapter-page .sidebar { transform: translateX(-100%); width: 260px; z-index: 950; }
    .chapter-page .sidebar.open { transform: translateX(0); }
    .chapter-page .main-content,
    .chapter-page.sidebar-collapsed .main-content { margin-left: 0; padding: 24px 20px 30px; }
    .chapter-header { top: var(--top-offset); }
}

@media (max-width: 560px) {
    .hero-btns .btn { width: 100%; justify-content: center; }
    .nav-actions .subscribe-btn { display: none; }
    .chapter-title { font-size: 1.8rem; }
}
