/* Shared study UI for the third-year source collection. */
body { --study-accent: #7dd3fc; --accent: var(--study-accent); --accent-light: var(--study-accent); }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 300; padding: 12px; background: white; color: #111; }
.skip-link:focus { top: 8px; }
a { color: var(--study-accent); text-underline-offset: 4px; }
button, input, select { font: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--study-accent); outline-offset: 4px; }
#sidebar .logo { align-items: flex-start; }
#sidebar .logo h2 { line-height: 1.35; font-size: 17px; }
#sidebar .logo-sub { color: #aaa; margin-top: 8px; font-size: 12px; }
#section-list { flex: initial; overflow-y: visible; }
#section-list a { text-decoration: none; }
.section-item.active { color: #101010; }
.section-item.active .section-num { color: #101010; }
.study-progress-wrap { padding: 12px 24px 24px; color: #aaa; font-size: 12px; }
.study-progress-wrap progress { display: block; width: 100%; height: 8px; accent-color: var(--study-accent); margin-top: 8px; }
#content { width: calc(100% - 280px); max-width: 1150px; padding-bottom: 72px; }
.study-heading { border-bottom: 1px solid var(--border); padding: 12px 0 28px; margin-bottom: 28px; }
.study-heading h1 { font-size: clamp(27px, 3.5vw, 44px); line-height: 1.18; letter-spacing: -.025em; margin: 12px 0 16px; overflow-wrap: anywhere; }
.study-heading h1:focus { outline: none; }
.study-heading > p:last-child, .study-muted { color: #aaa; }
.study-eyebrow { font-size: 11px; letter-spacing: .14em; color: var(--study-accent); font-weight: 700; }
.study-intro { font-size: 18px; line-height: 1.8; max-width: 75ch; }
.study-source-ref { color: #aaa; font-size: 12px; margin-top: 16px; }
.study-source-ref a { display: inline-block; margin: 4px 0; }
.study-notice { padding: 16px 20px; border-left: 3px solid var(--study-accent); background: #191919; margin: 24px 0; }
.study-notice p { color: #b5b5b5; font-size: 14px; margin-top: 6px; }
.study-stats { display: flex; flex-wrap: wrap; gap: 24px; margin: 30px 0 40px; color: #aaa; font-size: 13px; }
.study-stats strong { display: block; font-size: 30px; color: white; font-variant-numeric: tabular-nums; }
.study-roadmap { list-style: none; margin: 20px 0; }
.study-roadmap li { border-top: 1px solid var(--border); }
.study-roadmap a { display: flex; align-items: center; gap: 18px; padding: 20px 0; text-decoration: none; color: #eee; }
.study-roadmap a:hover { color: var(--study-accent); }
.study-step { color: var(--study-accent); font: 20px ui-monospace, monospace; width: 30px; flex-shrink: 0; }
.study-roadmap small { display: block; margin-top: 4px; color: #aaa; font-size: 12px; }
.study-duration { margin-left: auto; flex-shrink: 0; font-size: 12px; color: #aaa; }
.study-block { margin: 36px 0; }
.study-block h2, .study-recall h2, .study-tool h2 { font-size: 23px; line-height: 1.4; margin-bottom: 16px; }
.study-block h3 { font-size: 17px; margin: 24px 0 10px; color: var(--study-accent); }
.study-block p { margin: 12px 0; color: #ccc; line-height: 1.85; }
.study-block ul, .study-block ol, .study-recall ul { padding-left: 24px; }
.study-block li, .study-recall li { margin: 10px 0; color: #ccc; }
.study-block strong { color: #f4f4f4; }
.study-formula { padding: 16px 20px; background: #202020; border-radius: 8px; color: var(--study-accent); font: 16px/1.9 ui-monospace, monospace; overflow-x: auto; margin: 18px 0; }
.study-table-wrap { overflow-x: auto; max-width: 100%; margin: 20px 0; }
.study-table-wrap table { border-collapse: collapse; width: 100%; font-size: 14px; text-align: left; }
.study-table-wrap caption { text-align: left; color: #aaa; margin-bottom: 10px; }
.study-table-wrap th, .study-table-wrap td { padding: 12px; border-bottom: 1px solid var(--border); min-width: 110px; vertical-align: top; }
.study-table-wrap th { color: var(--study-accent); background: #1a1a1a; }
.study-table-wrap td { color: #ccc; }
.study-block pre { padding: 20px; background: #191919; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; line-height: 1.8; }
.study-worked { margin: 12px 0; border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; }
.study-worked summary { cursor: pointer; font-weight: 600; color: white; min-height: 32px; }
.study-answer { border-top: 1px solid var(--border); padding-top: 12px; }
.study-recall { padding: 24px; border-left: 3px solid var(--study-accent); background: #191919; margin: 36px 0; }
.study-question { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: 8px; margin: 28px 0; }
.study-question legend { padding: 0 8px; font-weight: 600; line-height: 1.7; max-width: 100%; }
.study-option { width: 100%; display: flex; gap: 14px; text-align: left; padding: 13px 16px; margin-top: 10px; border: 1px solid #454545; background: #1c1c1c; color: #ddd; border-radius: 6px; cursor: pointer; line-height: 1.6; overflow-wrap: anywhere; }
.study-option span { color: #aaa; }
.study-option:hover:not(:disabled) { border-color: var(--study-accent); background: #292929; }
.study-option:disabled { cursor: default; opacity: .75; }
.study-option.correct { border-color: #4ade80; background: #123522; color: #bbf7d0; opacity: 1; }
.study-option.wrong { border-color: #f87171; background: #39191b; color: #fecaca; opacity: 1; }
.study-feedback { padding-top: 12px; }
.study-quiz-score { position: relative; color: var(--study-accent) !important; font-variant-numeric: tabular-nums; }
.study-completion { padding: 24px 0; border-top: 1px solid var(--border); }
.study-completion label { display: flex; align-items: center; gap: 12px; cursor: pointer; min-height: 44px; }
.study-completion input { width: 20px; height: 20px; accent-color: var(--study-accent); }
.study-pagination { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 24px; }
.study-pagination a { padding: 10px 0; }
.study-source-list { list-style: none; }
.study-source-list li { display: flex; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.study-source-list p { color: #aaa; font-size: 13px; margin-top: 6px; }
.study-filetype { color: #aaa; font: 11px ui-monospace, monospace; width: 38px; flex-shrink: 0; padding-top: 6px; }
.study-tool { border: 1px solid var(--border); border-radius: 12px; background: #191919; padding: 24px; margin: 36px 0; }
.study-tool form { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; }
.study-tool h2, .study-tool form > p { flex-basis: 100%; margin: 0; }
.study-tool p { color: #bbb; }
.study-tool label { display: flex; flex-direction: column; gap: 8px; color: #ccc; font-size: 13px; }
.study-tool input, .study-tool select { background: #252525; color: white; border: 1px solid #555; padding: 12px; border-radius: 6px; max-width: 100%; width: 200px; }
.study-tool select { width: 300px; }
.study-tool [data-model] { display: flex; flex-wrap: wrap; gap: 18px; }
.study-tool [hidden] { display: none; }
.study-tool .btn-primary { background: var(--study-accent); color: #111; border-color: transparent; min-height: 46px; }
.study-tool-result { margin-top: 24px; overflow-wrap: anywhere; }
.study-tool-result:empty { margin: 0; }
.study-pmf { display: grid; gap: 10px; margin: 20px 0; }
.study-pmf div { display: grid; grid-template-columns: 35px minmax(0, 1fr) 90px; align-items: center; gap: 12px; font-size: 13px; }
.study-pmf meter { width: 100%; height: 24px; }
.study-practice-entry, .study-english-section { border-top: 2px solid var(--study-accent); padding: 24px 0; margin: 32px 0; }
.study-practice-entry h2 { margin: 12px 0; font-size: 27px; }
.study-practice-entry p { color: #ccc; margin: 12px 0; }
.study-entry-links { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 20px 0; font-weight: 600; }
.study-section-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; justify-content: space-between; margin-bottom: 18px; }
.study-section-label h2 { font-size: 23px; }
.study-section-label a { font-size: 12px; }
.study-terms { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.study-terms > div { padding: 18px 0; border-top: 1px solid var(--border); }
.study-terms dt { font-size: 17px; font-weight: 600; color: var(--study-accent); }
.study-terms dd p { color: #ccc; margin-top: 8px; font-size: 14px; }
.study-term-tr { color: #aaa; font-size: 13px; }
.study-english-answer { border: 1px solid var(--border); border-radius: 8px; padding: 18px; margin-top: 20px; }
.study-english-answer summary { cursor: pointer; font-weight: 600; }
.study-english-answer p { margin: 16px 0; line-height: 1.85; }
.study-english-answer h3 { font-size: 15px; color: var(--study-accent); }
.study-quiz-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin: 20px 0; }
.study-language { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 8px; }
.study-language button { padding: 10px 16px; cursor: pointer; border: 0; border-radius: 5px; background: transparent; color: #bbb; min-height: 44px; }
.study-language button[aria-pressed="true"] { background: var(--study-accent); color: #101010; }
.study-command-list details { border-top: 1px solid var(--border); padding: 14px 0; }
.study-command-list summary { cursor: pointer; min-height: 36px; }
.study-command-list summary span:first-child { color: var(--study-accent); font-weight: 600; margin-right: 16px; }
.study-command-list summary span:last-child { color: #aaa; font-size: 13px; }
.study-term-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.study-term-filters label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: #ccc; min-width: 0; }
.study-term-filters input, .study-term-filters select { width: 100%; min-width: 0; background: #222; color: white; border: 1px solid #555; border-radius: 6px; padding: 12px; }
.study-vocabulary article { padding: 22px 0; border-top: 1px solid var(--border); }
.study-vocabulary article[hidden] { display: none; }
.study-vocabulary h3 { margin-top: 0; }
.study-vocabulary a { font-size: 13px; }
.study-written-label { display: block; color: #bbb; font-size: 13px; margin: 14px 0; }
.study-written-label textarea { display: block; resize: vertical; width: 100%; padding: 16px; margin-top: 10px; border: 1px solid #555; border-radius: 6px; background: #191919; color: #eee; font: 16px/1.8 ui-monospace, monospace; }
.study-written-label textarea:focus-visible { outline: 3px solid var(--study-accent); outline-offset: 3px; }
.study-topic-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 24px; }
.study-topic-tabs button { cursor: pointer; min-height: 44px; padding: 10px 20px; border: 1px solid var(--border); border-radius: 6px; background: #202020; color: #ccc; }
.study-topic-tabs button[aria-selected="true"] { color: #111; background: var(--study-accent); border-color: var(--study-accent); }
[role="tabpanel"][hidden] { display: none; }
.study-topic-quizzes { border-top: 1px solid var(--border); margin: 32px 0; padding-top: 24px; }
.study-topic-quizzes h2 { font-size: 22px; margin-bottom: 12px; }
.study-quiz-launchers { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,220px),1fr)); gap: 14px; margin-top: 20px; }
.study-quiz-launch { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 20px; border: 1px solid #444; border-radius: 8px; background: #1c1c1c; text-align: left; color: #eee; cursor: pointer; }
.study-quiz-launch:hover { border-color: var(--study-accent); background: #252525; }
.study-quiz-launch strong { color: var(--study-accent); font-size: 16px; }
.study-quiz-launch span { color: #aaa; font-size: 13px; }
.study-source-question-list article { margin: 20px 0; padding: 20px 0; border-bottom: 1px solid var(--border); }
.study-source-question-list article > p { margin: 12px 0; }
.study-source-tag { font-size: 12px; color: var(--study-accent); }
.study-reference-note { margin: 12px 0; border: 1px solid #383838; border-radius: 8px; background: #181818; }
.study-reference-note > summary { display: flex; align-items: flex-start; gap: 12px; padding: 18px; cursor: pointer; font-weight: 600; list-style: none; }
.study-reference-note > summary::-webkit-details-marker { display: none; }
.study-reference-note > summary::before { content: "+"; color: var(--study-accent); flex: 0 0 14px; }
.study-reference-note[open] > summary::before { content: "−"; }
.study-reference-note > summary:hover { background: #222; border-radius: 8px; }
.study-reference-note > summary small { display: block; margin-top: 6px; color: #aaa; font-size: 13px; font-weight: 400; }
.study-reference-number { color: var(--study-accent); font-variant-numeric: tabular-nums; flex: 0 0 38px; }
.study-reference-content { padding: 0 20px 20px; overflow-wrap: anywhere; }
.study-reference-content h4 { margin: 18px 0 8px; font-size: 16px; color: var(--study-accent); }
.study-reference-content p { margin: 12px 0; }
.study-reference-content > details { margin: 18px 0; padding-top: 16px; border-top: 1px solid #383838; }
.study-reference-content summary { cursor: pointer; line-height: 1.65; }
.study-reference-content .study-reference-transcript { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; font-size: 13px; }
.study-reference-questions { border-top: 1px solid #383838; margin-top: 20px; padding-top: 18px; }
.study-reference-questions .btn { white-space: normal; text-align: left; }
.study-quiz-dialog { width: min(800px, calc(100vw - 32px)); max-width: none; max-height: min(90dvh, 950px); padding: 0; margin: auto; border: 1px solid #555; border-radius: 14px; background: #191919; color: #eee; overflow: hidden; box-shadow: 0 24px 100px #000a; }
.study-quiz-dialog[open] { display: flex; flex-direction: column; }
.study-quiz-dialog::backdrop { background: #000c; }
.study-modal-header { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; padding: 22px 26px 12px; border-bottom: 1px solid var(--border); }
.study-modal-header h2 { font-size: 19px; line-height: 1.4; }
.study-modal-header p { font-size: 12px; margin-top: 8px; }
.study-modal-close { width: 44px; height: 44px; font-size: 28px; line-height: 1; background: #292929; color: #ddd; border: 1px solid #444; border-radius: 6px; cursor: pointer; flex-shrink: 0; }
.study-modal-language { align-self: flex-start; margin: 14px 26px 0; }
.study-modal-body { padding: 20px 26px 26px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.study-modal-question h3, .study-quiz-summary h3 { font-size: 20px; line-height: 1.65; margin-bottom: 16px; overflow-wrap: anywhere; }
.study-modal-question h3:focus, .study-quiz-summary h3:focus { outline: none; }
.study-modal-options .study-option > span:last-child { color: inherit; }
.study-modal-source { font-size: 12px; color: #aaa; margin: 16px 0; line-height: 1.8; }
.study-modal-source > span { display: block; margin-top: 6px; }
.study-question-origin { font-size: 12px; margin: 12px 0; }
.study-modal-code { white-space: pre; overflow: auto; background: #101010; border: 1px solid #444; padding: 16px; margin: 18px 0; border-radius: 6px; font: 14px/1.7 ui-monospace,monospace; }
.study-source-figure { display: block; max-width: 100%; height: auto; background: white; border-radius: 6px; margin: 18px 0; }
.study-modal-feedback { background: #202a22; border-left: 3px solid #4ade80; border-radius: 4px; padding: 18px; margin-top: 22px; }
.study-modal-feedback h4 { color: #86efac; font-size: 17px; margin-bottom: 12px; }
.study-modal-feedback p { line-height: 1.85; overflow-wrap: anywhere; }
.study-modal-feedback pre { max-width: 100%; margin-top: 16px; padding: 14px; border: 1px solid #465147; border-radius: 6px; background: #131b15; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.7 ui-monospace,monospace; }
.study-modal-feedback pre code { font: inherit; }
.study-modal-feedback .study-muted { font-size: 12px; margin-top: 14px; }
.study-modal-footer { display: flex; align-items: center; gap: 14px; justify-content: space-between; padding: 16px 26px; border-top: 1px solid #444; }
.study-modal-footer > span { color: #aaa; font-size: 13px; }
.study-modal-footer .btn { min-height: 44px; }
.study-quiz-dialog .btn-primary { background: var(--study-accent); color: #111; border-color: transparent; }
.study-quiz-dialog button:disabled { cursor: default; opacity: .55; }
.study-quiz-dialog .study-option.correct, .study-quiz-dialog .study-option.wrong { opacity: 1; }
.study-quiz-summary p { margin: 16px 0; }
@media (max-width: 600px) {
    .study-topic-tabs { gap: 6px; }
    .study-topic-tabs button { flex: 1; padding: 10px 6px; font-size: 14px; }
    .study-quiz-dialog { width: calc(100vw - 16px); max-height: 94dvh; border-radius: 10px; }
    .study-modal-header { padding: 16px 16px 12px; gap: 12px; }
    .study-modal-header h2 { font-size: 16px; }
    .study-modal-language { margin: 12px 16px 0; }
    .study-modal-body { padding: 16px; }
    .study-modal-question h3 { font-size: 17px; }
    .study-modal-footer { gap: 8px; padding: 12px 16px; }
    .study-modal-footer .btn { padding: 10px 12px; font-size: 13px; }
    .study-modal-footer > span { font-size: 12px; }
    .study-modal-feedback { padding: 14px; }
}
@media (max-width: 900px) {
    #content { width: 100%; }
    #sidebar .logo { padding-top: 72px; }
}
@media (max-width: 600px) {
    #content { padding: 70px 20px 48px; }
    .study-heading { padding-top: 0; }
    .study-heading h1 { font-size: 30px; }
    .study-intro { font-size: 16px; }
    .study-block h2, .study-recall h2, .study-tool h2 { font-size: 21px; }
    .study-question, .study-worked, .study-tool, .study-recall { padding: 16px; }
    .study-tool form, .study-tool [data-model] { flex-direction: column; align-items: stretch; width: 100%; }
    .study-tool input, .study-tool select { width: 100%; }
    .study-stats { gap: 20px; }
    .study-roadmap a { gap: 10px; }
    .study-terms, .study-term-filters { grid-template-columns: 1fr; }
    .study-command-list summary span { display: block; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } #sidebar { transition: none; } }
