body.learning-page {
    min-height: 100vh;
    height: auto;
    overflow: auto;
    background: #f5f7fb;
    color: #263247;
}

.learning-shell {
    width: min(1180px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 22px 0 28px;
    display: flex;
    flex-direction: column;
}

.learning-header,
.learning-header-actions,
.learning-mode-switch,
.view-heading,
.series-card-footer,
.episode-card-top,
.method-scenes-heading,
.lesson-completion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.learning-header {
    margin-bottom: 32px;
}

.back-to-hub,
.learning-footer a {
    color: #4f46e5;
    font-weight: 600;
    text-decoration: none;
}

.back-to-hub:hover,
.learning-footer a:hover {
    text-decoration: underline;
}

.learning-header-title {
    color: #475569;
    font-size: 14px;
    font-weight: 600;
}

.learning-intro {
    max-width: 760px;
    margin: 18px 0 28px;
}

.learning-intro h1 {
    display: block;
    margin: 5px 0 12px;
    color: #172033;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 650;
    letter-spacing: -1.4px;
    line-height: 1.12;
}

.learning-intro > p:last-child {
    max-width: 680px;
    color: #64748b;
    font-size: 16px;
}

.eyebrow,
.series-kicker {
    color: #6366f1;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.learning-mode-switch {
    justify-content: flex-start;
    width: fit-content;
    padding: 5px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    background: #fff;
}

.mode-button,
.primary-button,
.secondary-button,
.text-button,
.answer-option {
    border: 0;
    cursor: pointer;
    font: inherit;
}

.mode-button {
    padding: 9px 16px;
    border-radius: 9px;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 650;
}

.mode-button.is-active {
    background: #4f46e5;
    color: #fff;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.2);
}

.view-heading {
    align-items: flex-end;
    margin-bottom: 18px;
}

.view-heading h2,
.detail-heading h2 {
    margin-top: 4px;
    color: #172033;
    font-size: 23px;
    line-height: 1.25;
}

.progress-note {
    max-width: 390px;
    color: #64748b;
    font-size: 13px;
    text-align: right;
}

.series-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.series-card,
.learning-method-category,
.method-scenes,
.lesson-article,
.episode-card,
.linked-scene-card {
    border: 1px solid #e3e8f1;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 7px 22px rgba(26, 42, 70, 0.04);
}

.series-card {
    min-height: 250px;
    padding: 21px;
    display: flex;
    flex-direction: column;
    border-top: 4px solid #818cf8;
}

.series-card.relationship { border-top-color: #e879a9; }
.series-card.kangxi { border-top-color: #c48a44; }

.series-card h3 {
    margin: 7px 0 9px;
    color: #1e293b;
    font-size: 19px;
    line-height: 1.3;
}

.series-description,
.episode-hook,
.linked-scene-card > p {
    color: #64748b;
    font-size: 14px;
}

.series-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 15px 0;
}

.method-chip,
.level-tag,
.episode-number {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 99px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 11px;
    font-weight: 700;
}

.level-tag { background: #f1f5f9; color: #475569; }
.episode-number { background: transparent; color: #94a3b8; }

.series-card-footer {
    margin-top: auto;
    padding-top: 14px;
}

.progress-count,
.completion-note {
    color: #64748b;
    font-size: 12px;
}

.primary-button,
.secondary-button {
    padding: 9px 13px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    transition: background 0.15s ease, transform 0.15s ease;
}

.primary-button {
    background: #4f46e5;
    color: #fff;
}

.primary-button:hover:not(:disabled) { background: #4338ca; transform: translateY(-1px); }
.primary-button:disabled { background: #16a34a; cursor: default; }

.secondary-button {
    background: #eef2ff;
    color: #4338ca;
}

.secondary-button:hover { background: #e0e7ff; }

.text-button {
    padding: 5px 0;
    background: transparent;
    color: #4f46e5;
    font-size: 13px;
    font-weight: 650;
}

.series-detail { margin-top: 24px; }
.series-detail[hidden], .learning-view[hidden], .lesson-view[hidden], .method-scenes[hidden] { display: none; }
.series-grid[hidden] { display: none; }

.detail-heading { margin-bottom: 17px; }
.detail-heading h2 { margin: 13px 0 5px; }
.detail-heading p:last-child { color: #64748b; }

.episode-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.episode-card { padding: 18px; }
.episode-card.is-complete { border-color: #86efac; }
.episode-card h3 { margin: 12px 0 7px; color: #1e293b; font-size: 17px; }
.episode-card .method-chip { margin: 12px 0; }

.status-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 14px;
    color: #64748b;
    font-size: 12px;
}

.status-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.status-dot, .method-status {
    display: inline-grid;
    width: 21px;
    height: 21px;
    place-items: center;
    border-radius: 50%;
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}
.status-dot.mastered { background: #dcfce7; color: #15803d; }
.status-dot.unmastered { background: #f1f5f9; color: #94a3b8; }

.learning-method-tree { display: grid; gap: 14px; }
.learning-method-category { padding: 17px; }
.learning-method-category h3 { margin: 0 0 12px; color: #334155; font-size: 15px; }
.learning-method-list { display: flex; flex-wrap: wrap; gap: 9px; }

.learning-method-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    text-align: left;
    transition: all 0.15s ease;
}

.learning-method-button:hover { border-color: #a5b4fc; background: #eef2ff; color: #3730a3; }
.learning-method-button.is-mastered { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.learning-method-button .method-status { background: #e2e8f0; color: #64748b; }
.learning-method-button.is-mastered .method-status { background: #16a34a; color: #fff; }
.method-open-indicator { margin-left: 2px; color: #94a3b8; }

.method-scenes { margin-top: 16px; padding: 18px; }
.method-scenes-heading { margin-bottom: 13px; }
.method-scenes-heading h3 { color: #1e293b; font-size: 17px; }
.linked-scene-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.linked-scene-card { padding: 15px; box-shadow: none; }
.linked-scene-card h4 { margin: 5px 0; color: #1e293b; font-size: 15px; }
.linked-scene-card .secondary-button { margin-top: 11px; }
.empty-state { padding: 14px 0; color: #64748b; font-size: 14px; }

.lesson-view { max-width: 900px; margin: 0 auto; }
.lesson-article { margin-top: 12px; padding: clamp(18px, 4vw, 34px); }
.lesson-article > h2 { margin: 5px 0 10px; color: #172033; font-size: clamp(24px, 4vw, 34px); line-height: 1.2; }
.lesson-hook { margin-bottom: 20px; color: #475569; font-size: 16px; }
.lesson-scene-card, .lesson-method-card, .lesson-finale { margin: 14px 0; padding: 18px; border-radius: 13px; }
.lesson-scene-card { background: #f8fafc; }
.lesson-method-card { border: 1px solid #c7d2fe; background: #fafaff; }
.lesson-method-card > p { margin: 10px 0; color: #334155; font-weight: 600; }
.lesson-scene-card h3, .lesson-finale h3 { margin-bottom: 6px; color: #334155; font-size: 15px; }
.lesson-scene-card p, .lesson-finale p { color: #475569; font-size: 14px; }
.answer-options { display: flex; flex-wrap: wrap; gap: 8px; }
.answer-option { padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: #334155; font-size: 13px; }
.answer-option:hover:not(:disabled) { border-color: #818cf8; background: #eef2ff; }
.answer-option:disabled { cursor: default; opacity: 0.75; }
.answer-option.is-correct { border-color: #22c55e; background: #f0fdf4; color: #166534; opacity: 1; }
.answer-option.is-incorrect { border-color: #f87171; background: #fef2f2; color: #991b1b; opacity: 1; }
.answer-feedback { min-height: 22px; margin-top: 9px; font-size: 13px; }
.answer-feedback.is-correct-text { color: #15803d; }
.answer-feedback.is-incorrect-text { color: #b91c1c; }
.method-explanation, .evidence-card { margin-top: 13px; padding: 13px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
.method-explanation summary, .evidence-card summary { color: #334155; cursor: pointer; font-size: 13px; font-weight: 700; }
.method-explanation p { padding-top: 9px; color: #64748b; font-size: 13px; }
.evidence-content { padding-top: 11px; overflow-x: auto; }
.evidence-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.evidence-table th, .evidence-table td { padding: 9px; border-bottom: 1px solid #e2e8f0; }
.evidence-table thead th { color: #64748b; }
.evidence-list { display: grid; grid-template-columns: minmax(110px, 0.7fr) 1fr; gap: 8px 12px; font-size: 13px; }
.evidence-list dt { color: #64748b; font-weight: 650; }
.evidence-list dd { color: #334155; }
.lesson-finale { background: #eef2ff; }
.lesson-completion { justify-content: flex-start; flex-wrap: wrap; margin-top: 19px; }

.learning-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: auto;
    padding-top: 34px;
    color: #94a3b8;
    font-size: 12px;
}

@media (max-width: 850px) {
    .series-grid { grid-template-columns: 1fr; }
    .series-card { min-height: 0; }
    .view-heading { align-items: flex-start; flex-direction: column; }
    .progress-note { text-align: left; }
    .status-legend { justify-content: flex-start; }
}

@media (max-width: 620px) {
    .learning-shell { width: min(100% - 28px, 560px); padding-top: 15px; }
    .learning-header { align-items: flex-start; flex-direction: column; gap: 8px; margin-bottom: 18px; }
    .learning-header-actions { width: 100%; }
    .learning-mode-switch { width: 100%; }
    .mode-button { flex: 1; }
    .episode-list, .linked-scene-list { grid-template-columns: 1fr; }
    .learning-method-list { display: grid; grid-template-columns: 1fr; }
    .learning-method-button { width: 100%; }
    .learning-footer { flex-direction: column; }
    .lesson-completion { align-items: flex-start; flex-direction: column; }
}

/* Compact learning-home and focused story screens. */
.learning-header {
    min-height: 42px;
    margin-bottom: 18px;
}

.learning-header-actions[hidden],
#screen-back-button[hidden],
.learning-home[hidden],
.subscreen[hidden],
.lesson-view[hidden] {
    display: none !important;
}

.learning-home {
    padding-top: 12px;
}

.learning-tagline {
    margin: 0 0 24px;
    color: #64748b;
    font-size: 16px;
}

.home-section-title {
    margin: 0 0 18px;
    color: #1e293b;
    font-size: clamp(21px, 3vw, 27px);
    font-weight: 650;
    line-height: 1.25;
}

.learning-mode-switch {
    margin-bottom: 22px;
}

.method-map-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.method-map-title .home-section-title {
    margin: 0;
}

.series-grid {
    gap: 14px;
}

.series-card {
    min-height: 230px;
    padding: 19px;
}

.series-card h2 {
    margin: 0 0 8px;
    color: #1e293b;
    font-size: 19px;
    line-height: 1.3;
}

.series-description {
    min-height: 44px;
}

.progress-count {
    margin: 2px 0 9px;
}

.subscreen {
    min-height: 55vh;
    padding-top: 3px;
}

.subscreen .home-section-title {
    margin: 4px 0 15px;
}

.episode-list {
    grid-template-columns: minmax(0, 720px);
}

.episode-card {
    padding: 19px;
}

.episode-card .method-chip {
    display: flex;
    margin: 9px 0 13px;
}

.linked-scene-list {
    grid-template-columns: minmax(0, 720px);
}

.linked-scene-card {
    display: grid;
    justify-items: start;
    gap: 8px;
}

.linked-scene-card .series-kicker,
.linked-scene-card .level-tag {
    margin-bottom: 2px;
}

.lesson-view {
    max-width: 820px;
}

.lesson-article {
    margin-top: 0;
    padding: clamp(17px, 4vw, 30px);
}

.lesson-topline {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
}

.lesson-article > h1 {
    margin: 0 0 17px;
    color: #172033;
    font-size: clamp(24px, 4vw, 33px);
    line-height: 1.2;
}

.dialogue-log {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.dialogue-row {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    max-width: 88%;
}

.dialogue-row.right {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.dialogue-avatar {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: #e0e7ff;
    color: #4338ca;
    font-size: 14px;
    font-weight: 750;
}

.dialogue-row.right .dialogue-avatar {
    background: #dbeafe;
    color: #1d4ed8;
}

.dialogue-bubble {
    padding: 11px 14px;
    border: 1px solid #e5eaf2;
    border-radius: 15px 15px 15px 4px;
    background: #f8fafc;
}

.dialogue-row.right .dialogue-bubble {
    border-color: #dbeafe;
    border-radius: 15px 15px 4px 15px;
    background: #eff6ff;
}

.dialogue-speaker {
    display: block;
    margin-bottom: 3px;
    color: #64748b;
    font-size: 11px;
    font-weight: 750;
}

.dialogue-bubble p {
    color: #334155;
    font-size: 14px;
    line-height: 1.55;
}

.dialogue-next {
    display: block;
    margin: 14px 0 0 auto;
}

.dialogue-task,
.analysis-result {
    margin-top: 17px;
    padding: 17px;
    border: 1px solid #e0e7ff;
    border-radius: 13px;
    background: #fafaff;
}

.dialogue-task h2,
.analysis-result h2 {
    margin-bottom: 10px;
    color: #334155;
    font-size: 16px;
}

.analysis-result > p {
    margin: 8px 0;
    color: #334155;
    font-size: 14px;
}

.analysis-result .method-note {
    padding: 10px 12px;
    border-radius: 9px;
    background: #f1f5f9;
    color: #64748b;
}

.analysis-result h3 {
    margin: 16px 0 9px;
    color: #334155;
    font-size: 14px;
}

.decision-options {
    display: grid;
    gap: 9px;
}

.decision-option {
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
}

.decision-option:hover {
    border-color: #818cf8;
    background: #eef2ff;
}

.lesson-finale {
    padding: 18px;
}

.lesson-finale h2 {
    margin-bottom: 8px;
    color: #334155;
    font-size: 17px;
}

.lesson-finale .primary-button {
    margin-top: 15px;
}

.mission-brief,
.level-content-card {
    margin: 15px 0;
    padding: 17px;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    background: #fff;
}

.mission-brief { background: #f8fafc; }
.mission-brief h2, .level-content-card h2 { margin-bottom: 9px; color: #1e293b; font-size: 17px; }
.mission-brief > p, .level-lesson-text { color: #475569; font-size: 14px; line-height: 1.65; }
.mission-variables { display: grid; gap: 5px; margin-top: 13px; }
.mission-variables p { color: #334155; font-size: 13px; font-weight: 650; }
.regression-data-table { max-width: 360px; }
.regression-data-table td, .regression-data-table th { text-align: center; }

.level-navigation {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin: 18px 0;
}

.level-nav-button {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 52px;
    padding: 9px 11px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    text-align: left;
}

.level-nav-button.is-current { border-color: #818cf8; background: #eef2ff; color: #3730a3; }
.level-nav-button.is-done { border-color: #86efac; color: #166534; }
.level-nav-number { display: grid; flex: 0 0 25px; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: #f1f5f9; font-weight: 800; }
.level-nav-button.is-current .level-nav-number { background: #4f46e5; color: #fff; }
.level-nav-button.is-done .level-nav-number { background: #dcfce7; }
.level-content-card { margin-top: 0; }
.level-content-badge { margin-bottom: 5px; color: #6366f1; font-size: 11px; font-weight: 800; letter-spacing: .07em; }
.level-activity { margin: 17px 0; padding: 14px; border-radius: 11px; background: #f8fafc; }
.regression-chart-wrap { width: 100%; overflow-x: auto; }
.regression-chart-wrap svg { display: block; width: 100%; min-width: 410px; height: auto; }
.chart-grid-line { stroke: #e2e8f0; stroke-width: 1; }
.chart-axis-line { stroke: #64748b; stroke-width: 1.5; }
.chart-axis-label { fill: #64748b; font: 11px sans-serif; }
.chart-axis-title { fill: #475569; font: 12px sans-serif; }
.chart-point { fill: #6366f1; stroke: #fff; stroke-width: 2; }
.chart-fit-line { stroke: #e879a9; stroke-width: 3; }
.chart-residual-line { stroke: #f59e0b; stroke-width: 2; stroke-dasharray: 4 3; opacity: .9; }
.prediction-demo { display: grid; gap: 9px; }
.prediction-label { color: #475569; font-size: 13px; font-weight: 650; }
.prediction-demo input { width: 100%; accent-color: #4f46e5; }
.prediction-output { padding: 10px; border-radius: 8px; background: #eef2ff; color: #3730a3; font-size: 20px; font-weight: 750; text-align: center; }
.interpretation-note { margin-top: 12px; color: #64748b; font-size: 12px; line-height: 1.55; }
.stat-highlight { display: flex; align-items: baseline; gap: 12px; color: #4338ca; }
.stat-highlight span { font-size: 15px; font-weight: 750; }
.stat-highlight strong { font-size: 36px; }
.ols-steps { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 15px; color: #475569; font-size: 13px; }
.ols-steps strong { color: #1e293b; text-align: right; }
.level-question { margin: 17px 0 10px; color: #334155; font-size: 15px; }
.level-answer-options { display: grid; gap: 8px; }
.level-answer-options .answer-option { text-align: left; line-height: 1.45; }
.next-level-button { margin-top: 15px; }

@media (max-width: 620px) {
    .level-navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .level-nav-button { min-height: 46px; }
    .ols-steps { grid-template-columns: 1fr; gap: 3px; }
    .ols-steps strong { margin-bottom: 8px; text-align: left; }
}

@media (max-width: 620px) {
    .learning-header {
        flex-direction: row;
        align-items: center;
        margin-bottom: 13px;
    }

    .learning-header-actions {
        width: auto;
    }

    .dialogue-row {
        max-width: 100%;
    }
}
