/* Shared visual language: quiet reading, explicit evidence, useful whitespace. */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
button:focus-visible, a:focus-visible, summary:focus-visible, textarea:focus-visible { outline: 3px solid #78bcb4; outline-offset: 3px; }
.topbar h1 { font-size: clamp(25px,3vw,38px); letter-spacing: -.035em; }
.study-mode-switch { display: flex; gap: 8px; margin: 8px 0 20px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.study-mode-switch button { background: transparent; color: var(--muted); border-radius: 8px; }
.study-mode-switch .is-active { background: #e6f2ed; color: #165b4d; }
.study-layout { display: grid; grid-template-columns: 260px minmax(0,1fr); gap: 24px; align-items: start; }
.study-sidebar { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding: 22px 16px; }
.study-sidebar h2 { margin: 8px 0 20px; font-size: 23px; }
.study-sidebar label { font-size: 12px; }
.study-outline { margin-top: 20px; }
.study-outline-chapter { border-top: 1px solid var(--line); padding: 14px 0; }
.study-outline-chapter summary { cursor: pointer; line-height: 1.7; font-size: 13px; font-weight: 750; color: #344d45; }
.study-outline-section h4 { font-size: 11px; line-height: 1.65; color: var(--muted); margin: 18px 8px 7px; font-weight: 550; }
.study-unit-link { display: flex; flex-direction: column; width: 100%; align-items: flex-start; gap: 5px; background: transparent; color: var(--ink); padding: 11px 12px; text-align: left; border-left: 3px solid transparent; border-radius: 0 8px 8px 0; font-size: 13px; line-height: 1.5; }
.study-unit-link small { font-size: 10px; font-weight: 400; color: var(--muted); }
.study-unit-link:hover { background: #f1f5f0; }
.study-unit-link.is-current { border-left-color: #397869; background: #e9f2ed; color: #175644; }
.study-main { min-width: 0; }
.study-heading { padding: 12px 0 25px; }
.study-heading h1 { font-size: clamp(25px,2.7vw,36px); line-height: 1.35; margin: 12px 0 17px; letter-spacing: -.035em; }
.study-heading-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 12px; color: var(--muted); }
.study-status { background: #eaf0eb; color: #296553; padding: 4px 9px; border-radius: 20px; }
.study-pane-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.study-pane-tabs button { background: transparent; color: var(--muted); border-radius: 0; padding: 13px 16px; font-size: 13px; border-bottom: 2px solid transparent; }
.study-pane-tabs [aria-selected="true"] { color: #155c4c; border-bottom-color: #276d5c; }
.study-feedback { font-size: 13px; color: #165d4f; margin: 0; }
.study-feedback:not(:empty) { padding: 12px 16px; margin: 0 0 14px; background: #eaf4ef; border-radius: 8px; }
.study-workspace { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.95fr); gap: 20px; align-items: start; }
.study-workspace > .panel { padding: 28px; min-width: 0; }
.study-workspace h2 { font-size: 21px; line-height: 1.6; margin: 10px 0 20px; }
.study-workspace h3 { font-size: 16px; line-height: 1.65; }
.study-workspace p, .study-workspace li { font-size: 14px; line-height: 1.95; }
.study-workspace .tiny { font-size: 11px; line-height: 1.8; }
.study-step-label { color: #367565; font-size: 10px; letter-spacing: .13em; text-transform: uppercase; font-weight: 750; margin-top: 22px; }
.study-step-label:first-child { margin-top: 0; }
.study-objectives { padding-left: 18px; margin-bottom: 24px; }
.study-objectives li { margin: 8px 0; }
.study-prerequisites { background: #f6f7f2; border-radius: 8px; padding: 12px 16px; margin-bottom: 26px; }
.study-prerequisites summary, .recall-card summary, .official-recall summary, .source-table summary { cursor: pointer; font-size: 13px; line-height: 1.7; }
.guide-card { border-bottom: 1px solid var(--line); padding: 0 0 22px; margin: 20px 0; }
.guide-card h3 { margin: 0 0 8px; }
.source-cite { background: transparent; border: 1px solid #d8e5dd; color: #34705f; padding: 3px 7px; border-radius: 5px; font-size: 10px; font-weight: 500; margin: 3px 2px 3px 0; cursor: pointer; line-height: 1.7; }
.source-cite:hover { background: #eaf2ec; }
.misconception-list { background: #fbf6ea; border-left: 3px solid #cfb66c; padding: 10px 17px; margin: 22px 0; }
.misconception-wrong { color: #927146; font-size: 13px !important; }
.misconception-list article + article { border-top: 1px solid #e9dfc7; padding-top: 12px; }
.read-check { display: grid; gap: 10px; margin: 24px 0; }
.recall-card, .case-verification, .section-practice { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 28px; }
.recall-card label { margin: 18px 0 0; font-size: 13px; }
.recall-card textarea, #studyPromptText { width: 100%; padding: 13px; border: 1px solid #cbdcd0; border-radius: 8px; background: #fdfefb; color: var(--ink); font-family: inherit; font-size: 14px; line-height: 1.8; resize: vertical; }
.self-assessment { margin: 20px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.self-assessment legend { font-size: 12px; padding: 0 6px; color: var(--muted); }
.self-assessment label { display: flex; gap: 8px; align-items: center; margin: 7px 0; font-size: 12px; }
.self-assessment input, .case-choice input { width: auto; flex: 0 0 auto; accent-color: #347260; }
.study-case { border: 1px solid var(--line); border-radius: 9px; padding: 20px 16px; margin: 18px 0; }
.study-case h3 { margin: 8px 0 15px; }
.study-case fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.case-choice { display: flex; align-items: flex-start; gap: 9px; padding: 12px 10px; margin: 8px 0; border: 1px solid #e2e9e2; border-radius: 7px; background: #fafbf8; cursor: pointer; font-size: 13px; line-height: 1.7; }
.case-choice input { margin-top: 5px; }
.case-choice.is-picked { border-color: #7eaa95; background: #eff6ef; }
.case-feedback { border-radius: 6px; padding: 15px; background: #f8f2e7; }
.case-feedback.is-correct { background: #ecf5ed; }
.case-feedback p { margin: 8px 0; font-size: 13px; }
.verification-result { color: #366451; }
.official-recall { margin: 30px 0 0; border: 1px solid var(--line); padding: 15px; border-radius: 8px; }
.official-recall article { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 8px; }
.official-recall article p { white-space: pre-wrap; }
.official-calibration-note { padding: 12px; background: #f0f6ef; border-left: 3px solid #426a52; font-size: 12px; line-height: 1.8; }
.official-web-sources { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.official-web-sources a { max-width: 100%; overflow-wrap: anywhere; }
.official-original-answer { margin-top: 15px; color: var(--muted); }
.study-source { position: sticky; top: 16px; }
.source-heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.source-heading h2 { margin: 0; font-size: 17px; }
.source-page-nav { margin: 15px 0; display: flex; flex-wrap: wrap; gap: 3px; }
.manual-reader { max-height: 73vh; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-right: 8px; position: relative; }
.source-paper { padding: 0 0 30px; margin-bottom: 20px; }
.source-paper header { border-top: 1px solid #e1e4dc; padding: 14px 0 10px; display: flex; justify-content: space-between; gap: 6px; color: #798579; font-size: 10px; }
.source-paper strong { color: #3c5c4b; }
.source-lines { font-family: 'Songti SC','Noto Serif TC','STSong',serif; }
.source-lines p { font-size: 15px; line-height: 1.95; margin: 0 0 5px; overflow-wrap: anywhere; }
.table-scroll { width: 100%; overflow: auto; margin: 15px 0; }
.table-scroll table { font-size: 11px; border-collapse: collapse; min-width: 360px; }
.table-scroll td, .table-scroll th { padding: 7px; border: 1px solid var(--line); }
.study-auxiliary { display: none; }
.study-workspace[data-active-pane="auxiliary"] .study-guide { display: none; }
.study-workspace[data-active-pane="auxiliary"] .study-auxiliary { display: block; grid-column: 1; grid-row: 1; }
.study-workspace[data-active-pane="auxiliary"] .study-source { grid-column: 2; }
.gpt-card, .video-card { margin-top: 25px; }
.gpt-card { padding: 18px; border-radius: 9px; background: #f0f6ef; }
.gpt-card label { font-size: 12px; }
.gpt-card .button-row { margin: 20px 0; }
.button-link { display: inline-flex; justify-content: center; padding: 10px 15px; border-radius: 7px; text-decoration: none; color: var(--green); border: 1px solid #c6dac9; font-size: 12px; }
#studyPromptFallback { margin-top: 16px; }
#studyPromptFallback summary { font-size: 12px; cursor: pointer; }
#studyPromptText { margin-top: 12px; font-family: ui-monospace,monospace; font-size: 11px; }
.video-card iframe { aspect-ratio: 16/9; width: 100%; border: 0; margin-top: 16px; }
.video-card h4 { font-size: 14px; }
.study-unit-pager { display: flex; justify-content: space-between; gap: 15px; margin: 22px 0; }
.study-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; margin-top: 24px; }
.study-metrics div { display: flex; flex-direction: column; gap: 8px; }
.study-metrics strong { font-size: 26px; font-weight: 550; color: #275e4c; }
.study-metrics span { font-size: 11px; color: var(--muted); line-height: 1.7; }
.study-chapter { position: relative; padding: 23px; text-align: left; background: #fff; color: var(--ink); min-height: 205px; }
.chapter-number { display: block; color: #96a98e; font-family: Georgia,serif; font-size: 28px; font-weight: 400; margin-bottom: 15px; }
.study-chapter > strong { font-size: 15px; line-height: 1.7; display: block; }
.study-chapter > small { display: block; margin: 10px 0; }
.chapter-evidence { display: flex; gap: 9px; flex-wrap: wrap; font-size: 10px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.chapter-evidence .due-badge { color: #a56724; }
.legacy-notes { margin: 20px 0; }
.legacy-notes pre { white-space: pre-wrap; overflow-wrap: anywhere; }
#review > .panel { margin-bottom: 20px; }
.review-lesson-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.section-picker { margin-bottom: 18px; }
.section-picker .button-row { flex-wrap: wrap; }
@media (min-width: 1600px) { .shell { max-width: 1600px; } }
@media (max-width: 1180px) {
  .study-layout { grid-template-columns: 220px minmax(0,1fr); gap: 16px; }
  .study-workspace { gap: 14px; }
  .study-workspace > .panel { padding: 20px; }
}
@media (max-width: 950px) {
  .study-layout { grid-template-columns: 1fr; }
  .study-sidebar { position: static; max-height: 300px; padding: 16px; }
  .study-sidebar h2 { font-size: 19px; margin: 5px 0 10px; }
  .study-sidebar .eyebrow { display: none; }
  .study-outline { margin-top: 10px; }
}
@media (max-width: 680px) {
  .study-workspace { display: block; }
  .study-workspace [data-study-pane] { display: none !important; }
  .study-workspace[data-active-pane="guide"] [data-study-pane="guide"], .study-workspace[data-active-pane="source"] [data-study-pane="source"], .study-workspace[data-active-pane="auxiliary"] [data-study-pane="auxiliary"] { display: block !important; }
  .study-source { position: static; }
  .study-pane-tabs { position: sticky; top: 0; z-index: 3; background: var(--paper); }
  .study-pane-tabs button { padding: 12px 10px; font-size: 12px; flex: 1; }
  .study-workspace > .panel { padding: 22px 18px; }
  .study-sidebar { max-height: 190px; }
  .study-heading { padding: 8px 0 15px; }
  .study-heading h1 { font-size: 26px; }
  .study-metrics { gap: 12px; }
  .study-metrics strong { font-size: 20px; }
  .study-chapter { min-height: 175px; padding: 18px; }
  .review-lesson-list { grid-template-columns: 1fr; }
  .manual-reader { max-height: 68vh; }
  .study-unit-pager button { padding: 12px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .study-main * { scroll-behavior: auto !important; } }

.source-layout { margin: 14px 0; padding: 12px; background: #f2f4ee; border-radius: 10px; }
.source-layout img { display: block; width: 100%; height: auto; margin-top: 12px; background: white; }

#chapterMap:has(.study-chapter) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) {
  #chapterMap:has(.study-chapter) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  #chapterMap:has(.study-chapter) { grid-template-columns: 1fr; }
  .shell:has(#learning.is-active) .topbar { padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
  .shell:has(#learning.is-active) .topbar h1,
  .shell:has(#learning.is-active) .topbar-copy,
  .shell:has(#learning.is-active) .score-strip { display: none; }
  .shell:has(#learning.is-active) .topbar .eyebrow { margin: 0; font-size: 12px; }
  .shell:has(#learning.is-active) .account-area { padding: 0; border: 0; box-shadow: none; background: transparent; min-width: 0; }
  .shell:has(#learning.is-active) .account-trigger { padding: 7px 12px; font-size: 11px; }
  .shell:has(#learning.is-active) .account-status { font-size: 9px; margin-top: 3px; }
}
