/* Estudo usa a paleta editorial existente, não copia o painel do concorrente. */
:root { color-scheme: light; height: 100%; }
html, body { overflow-x: visible; }
/* Keep navigation outside the content scrollport, not painted over its targets. */
body { height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.study-wrap [hidden] { display: none !important; }
.study-skip { position: absolute; top: -100px; left: 12px; z-index: 10; background: var(--surface); padding: 8px 12px; }
.study-skip:focus { top: 8px; }
.study-topbar { flex: none; position: sticky; top: 0; z-index: 9; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; padding: 6px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.study-logo { font-size: 19px; font-weight: 850; letter-spacing: -.02em; text-decoration: none; white-space: nowrap; }
.study-logo span { color: var(--brand-active); font-size: 12px; letter-spacing: .04em; }
.study-topbar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.study-topbar nav a { display: flex; align-items: center; min-height: 44px; border-radius: 8px; padding: 10px 12px; color: var(--text-primary); font-size: 14px; font-weight: 600; text-decoration: none; }
.study-topbar nav a[aria-current="location"] { background: var(--brand-softer); color: var(--brand-active); }
.study-topbar nav a:hover { background: var(--brand-softer); }
.study-actions a, .study-actions button, .study-empty a { display: inline-block; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 12px; background: var(--surface); color: var(--text-primary); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.study-actions a:hover, .study-actions button:hover, .study-empty a:hover { background: var(--brand-softer); }
.study-wrap { --text-secondary: #5C656D; width: 100%; max-width: 1440px; min-height: 0; flex: 1; padding: 16px 24px 32px; margin: 8px auto 0; overflow: auto; scrollbar-gutter: stable; scroll-padding-top: 8px; font-size: 16px; }
.study-intro { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }
.study-intro h1 { font-size: 28px; line-height: 1.2; margin: 0; letter-spacing: -.02em; }
.study-totals { color: var(--text-secondary); font-size: 14px; }
.study-shell { display: grid; grid-template-columns: minmax(280px, 30%) minmax(0, 1fr); align-items: start; gap: 16px; }
.study-shell > * { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 16px; }
.study-wizard { grid-column: 1 / -1; grid-row: 1; display: grid; grid-template-columns: auto minmax(420px, 1fr); gap: 12px 24px; align-items: center; border-radius: 14px !important; padding: 18px 20px !important; background: linear-gradient(135deg, var(--brand-softer), var(--surface) 42%, var(--accent-softer)) !important; }
.study-wizard-eyebrow { margin: 0 0 4px; color: var(--brand-active); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.study-wizard h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(20px, 2vw, 27px); font-weight: 500; }
.study-wizard-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.study-wizard-steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 0 8px; align-items: center; min-height: 52px; border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--text-secondary); }
.study-wizard-steps li > span { grid-row: 1 / span 2; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-muted); font-weight: 800; }
.study-wizard-steps b { color: var(--text-primary); font-size: 12px; }
.study-wizard-steps small { font-size: 10px; line-height: 1.25; }
.study-wizard-steps li[aria-current="step"] { background: var(--brand-softer); color: var(--brand-active); }
.study-wizard-steps li[aria-current="step"] > span { background: var(--brand-active); color: white; }
.study-wizard-steps li[data-complete="true"] > span { background: var(--accent); color: var(--text-primary); }
.study-wizard-controls { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.study-wizard-controls button { min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px 15px; background: var(--surface); color: var(--text-primary); font: inherit; font-weight: 750; cursor: pointer; }
#study-wizard-next { border-color: var(--brand); background: var(--brand); color: white; }
.study-wizard-controls button:disabled { opacity: .5; cursor: not-allowed; }
#study-wizard-status { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.45; text-align: center; }
.study-shell[data-wizard-step] > :not(.study-wizard) { display: none; }
.study-shell[data-wizard-step="1"] > :is(.study-library, .study-search), .study-shell[data-wizard-step="2"] > :is(.study-lesson-list, .study-reader, .study-empty), .study-shell[data-wizard-step="3"] > .study-kit-builder, .study-shell[data-wizard-step="4"] > .study-kits { display: block; grid-row: 2; }
.study-shell[data-wizard-step="1"] > .study-library, .study-shell[data-wizard-step="2"] > .study-lesson-list { grid-column: 1; }
.study-shell[data-wizard-step="1"] > .study-search, .study-shell[data-wizard-step="2"] > .study-reader { grid-column: 2; }
.study-shell[data-wizard-step="3"] > .study-kit-builder, .study-shell[data-wizard-step="4"] > .study-kits { grid-column: 1 / -1; }
.study-shell[data-wizard-step="3"] #study-kit-create { display: none; }
.study-shell > details > summary { min-height: 44px; cursor: pointer; font-size: 17px; font-weight: 600; padding: 10px 0; }
.study-shell > details[open] > summary { margin-bottom: 12px; }
.study-pane-head { margin-bottom: 8px; }
.study-pane-head h2 { font-size: 15px; line-height: 1.35; margin: 0; overflow-wrap: anywhere; }
.study-kits { grid-column: 1 / -1; grid-row: 1; }
.study-library { grid-column: 1; grid-row: 2; }
.study-search { grid-column: 2; grid-row: 2; }
.study-kit-builder { grid-column: 1 / -1; grid-row: 3; }
.study-lesson-list { grid-column: 1; grid-row: 4; position: sticky; top: 8px; }
.study-reader { grid-column: 2; grid-row: 4; }
.study-search form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; }
.study-search label { font-size: 12px; font-weight: 700; }
.study-search :is(input, select, button) { width: 100%; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; background: white; color: var(--text-primary); padding: 8px; font: inherit; }
.study-search form button { background: var(--brand); color: white; cursor: pointer; font-weight: 700; }
.study-search-results { display: grid; gap: 6px; }
.study-search-results .study-result-open { width: 100%; text-align: left; background: var(--surface-muted); color: var(--text-primary); cursor: pointer; }
.study-search-results .study-result-open strong, .study-search-results .study-result-open small { display: block; }
.study-search-results .study-result-open small { color: var(--text-secondary); margin-top: 4px; }
.study-search-results .study-result-open span { display: block; margin-top: 5px; overflow-wrap: anywhere; }
.study-transcript mark { background: #ffe49a; color: inherit; }
.study-library label { display: block; font-size: 12px; font-weight: 700; margin: 0 0 6px; }
.study-library input { width: 100%; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; background: white; padding: 8px 10px; font: inherit; }
.study-hint { color: var(--text-secondary); font-size: 14px; line-height: 1.5; margin: 6px 0 8px; }
.study-courses, #study-lessons { display: grid; gap: 0; padding: 3px; overflow: auto; align-content: start; }
.study-courses { grid-template-columns: 1fr; max-height: 280px; }
#study-lessons { grid-template-columns: 1fr; max-height: calc(100dvh - 220px); }
.study-courses button, #study-lessons .study-lesson-open { display: block; width: 100%; min-height: 44px; padding: 6px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--text-primary); text-align: left; font: inherit; cursor: pointer; overflow-wrap: anywhere; }
.study-courses button:hover, #study-lessons .study-lesson-open:hover { background: var(--surface-muted); }
.study-courses button[aria-current="true"], #study-lessons .study-lesson-open[aria-current="true"] { background: var(--brand-softer); color: var(--brand-active); }
.study-courses button strong, #study-lessons .study-lesson-open strong { display: block; font-size: 14px; line-height: 1.4; }
.study-courses button small, #study-lessons .study-lesson-open small { display: block; color: var(--text-secondary); font-size: 14px; line-height: 1.45; margin-top: 4px; }
#study-lessons .study-lesson-open:disabled { opacity: .65; cursor: not-allowed; }
.study-bulk-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 8px 3px; }
.study-bulk-actions button { min-height: 40px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; background: var(--surface); color: var(--text-primary); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.study-bulk-actions button:first-child { border-color: var(--brand); background: var(--brand-softer); }
.study-bulk-actions button:disabled { opacity: .5; cursor: not-allowed; }
#study-bulk-status { flex: 1 1 220px; color: var(--text-secondary); font-size: 11px; line-height: 1.4; }
.study-reader .study-pane-head h2 { font-size: clamp(18px, 2vw, 25px); }
.study-return { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; padding: 8px 0; }
.study-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0; }
.study-actions button:disabled { opacity: .5; cursor: not-allowed; }
.study-actions #study-mark { border-color: var(--brand); background: var(--brand-softer); }
.study-section { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.study-section h3 { font-size: 16px; margin: 0 0 10px; }
.study-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.study-transcript { max-height: calc(100dvh - 280px); min-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 4px; padding: 16px; background: white; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.study-transcript p + p { margin-top: 14px; }
:is(.study-notes, .study-cards, .study-concepts, .study-codings, .study-themes, .coding-bar) h4 { margin: 12px 0 6px; font-size: 14px; }
:is(.study-notes, .study-cards, .study-concepts, .study-codings, .study-themes, .coding-bar) label { display: block; margin: 12px 0; font-size: 12px; font-weight: 700; }
:is(.study-notes, .study-cards, .study-concepts, .study-codings, .study-themes, .coding-bar) :is(input, textarea, select) { display: block; width: 100%; min-height: 44px; margin-top: 5px; padding: 10px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; color: var(--text-primary); background: white; }
:is(.study-notes, .study-cards, .study-concepts, .study-codings, .study-themes, .coding-bar) textarea { resize: vertical; overflow-wrap: anywhere; }
:is(.study-notes, .study-cards, .study-concepts, .study-codings, .study-themes, .coding-bar) button { border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); padding: 9px 12px; font: inherit; font-weight: 700; color: var(--text-primary); cursor: pointer; }
:is(.study-notes, .study-cards, .study-concepts, .study-codings, .study-themes, .coding-bar) :is(#notes-save, #cards-save, #concepts-save, #codings-mark, #themes-save, #coding-theme-create) { background: var(--brand); color: white; }
:is(.study-notes, .study-cards, .study-concepts, .study-codings, .study-themes, .coding-bar) button:hover { background: var(--brand-softer); }
:is(.study-notes, .study-cards, .study-concepts, .study-codings, .study-themes, .coding-bar) :is(#notes-save, #cards-save, #concepts-save, #codings-mark, #themes-save, #coding-theme-create):hover { background: var(--brand-active); }
:is(.study-notes, .study-cards, .study-concepts, .study-codings, .study-themes, .coding-bar) button:disabled { opacity: .5; cursor: wait; }
.notes-list { display: grid; gap: 10px; }
.notes-card, .cards-review article { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-muted); padding: 12px; min-width: 0; overflow-wrap: anywhere; }
.notes-card blockquote, .cards-review blockquote { margin: 12px 0; border-left: 3px solid var(--brand); padding-left: 12px; white-space: pre-wrap; font-size: 13px; }
.notes-card small, .cards-review small { color: var(--text-secondary); }
#notes-status, #cards-status, #concepts-status, #codings-status, #themes-status { min-height: 1.5em; font-size: 13px; color: var(--text-secondary); }
.study-cards details { margin: 16px 0; }
:is(.study-cards, .study-concepts) summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.study-concepts legend { font-weight: 700; }
.study-cards #cards-summary { font-weight: 700; }
.cards-review .study-actions { margin-bottom: 0; }
.study-navigation { justify-content: space-between; }
.study-error { border: 1px solid var(--danger); border-radius: 8px; color: var(--danger); padding: 12px; margin-bottom: 16px; }
.study-empty { grid-column: 1 / -1; padding: 34px !important; text-align: center; }
.study-empty h2 { font-size: 22px; margin-bottom: 8px; }
.study-empty a { margin-top: 18px; }
.study-footnote { color: var(--text-secondary); max-width: 780px; font-size: 12px; margin: 22px 0 0; }
.study-wrap :is(a, button, input, select, textarea, summary, [tabindex="0"]):focus-visible, .study-topbar a:focus-visible { outline: 3px solid var(--brand-active); outline-offset: 3px; }
.study-wrap [tabindex="-1"]:focus { outline: 3px solid var(--brand-active); outline-offset: 3px; border-radius: 4px; }
.study-concepts .notes-card:focus { outline: 3px solid var(--brand-active); outline-offset: 3px; }
.study-quizzes h4 { margin: 14px 0 8px; }
.study-quizzes label, .study-shared label { display: block; margin: 10px 0; font-weight: 600; font-size: 13px; }
.study-quizzes :is(input:not([type=radio]), select, textarea), .study-shared input:not([type=radio]) { display: block; width: 100%; min-height: 44px; margin-top: 5px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px; background: white; color: var(--text-primary); font: inherit; }
.study-quizzes textarea { resize: vertical; }
.study-quizzes fieldset, .study-shared fieldset { min-width: 0; border: 1px solid var(--border); border-radius: 8px; margin: 12px 0; padding: 12px; }
.study-quizzes legend, .study-shared legend { font-weight: 700; }
.study-quizzes button, .study-shared button { border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text-primary); padding: 9px 12px; font: inherit; cursor: pointer; }
.study-quizzes button:disabled, .study-shared button:disabled { opacity: .5; }
.study-quizzes #quizzes-save, .study-shared button[type=submit] { background: var(--brand); color: white; }
.study-quizzes #quizzes-status input { max-width: 100%; font-size: 12px; }
.study-shared { max-width: 760px; }
.study-shared #quiz-result blockquote { border-left: 3px solid var(--brand); padding-left: 12px; overflow-wrap: anywhere; }

.study-search-result, .study-lesson-choice { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; min-width: 0; gap: 2px; border-bottom: 1px solid var(--border); }
.study-lesson-choice > .study-lesson-open, .study-search-result > .study-result-open { grid-column: 2; grid-row: 1; }
.study-kit-check { display: grid; place-items: center; grid-column: 1; grid-row: 1; min-width: 44px; min-height: 44px; cursor: pointer; }
.study-lesson-choice > .study-lesson-open, .study-search-result > .study-result-open { min-width: 0; }
.study-kit-toggle { width: 24px; height: 24px; accent-color: var(--brand-active); cursor: pointer; }
.study-kit-toggle:disabled, .study-kit-card button:disabled { opacity: .5; cursor: not-allowed; }
.study-lesson-choice:has(:checked), .study-search-result:has(:checked) { background: var(--brand-softer); }
.study-kit-selection, .study-kits-list { display: grid; gap: 4px; max-height: 260px; overflow: auto; }
.study-kit-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; min-width: 0; border-bottom: 1px solid var(--border); padding: 6px; overflow-wrap: anywhere; }
.study-kit-card h3, .study-kit-card h4 { margin: 0; font-size: 13px; }
.study-kit-card p { grid-column: 1; margin: 0; color: var(--text-secondary); font-size: 11px; }
.study-kit-card > button { grid-column: 2; grid-row: 1 / span 3; min-height: 44px; border: 0; background: transparent; color: var(--danger); font: inherit; font-size: 12px; cursor: pointer; }
.study-kit-actions { grid-column: 2; grid-row: 1 / span 4; margin: 0; justify-content: flex-end; }
.study-kit-actions :is(a, button), #study-kits-refresh { min-height: 44px; font-size: 12px; }
.study-kit-actions a, .study-kit-actions [data-kit-action="retry"]:first-child { border-color: var(--brand); background: var(--brand-softer); }
.study-kit-actions [data-kit-delete] { border-color: transparent; background: transparent; color: var(--danger); font-weight: 400; }
#study-kits-refresh { display: block; margin: -8px 0 4px auto; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; }
#study-kit-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 10px; margin-top: 18px; }
#study-kit-form label { font-size: 12px; font-weight: 700; }
#study-kit-form input { display: block; width: 100%; min-height: 44px; margin-top: 5px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px; font: inherit; }
#study-kit-form button { min-height: 44px; border: 0; border-radius: 8px; padding: 9px 16px; background: var(--brand); color: white; font: inherit; font-weight: 800; cursor: pointer; }
#study-kit-form button:disabled { opacity: .5; cursor: not-allowed; }
#study-kit-status, #study-kits-status { color: var(--text-secondary); font-size: 13px; }
:is(#study-kit-status, #study-kits-status, #study-search-status):empty { display: none; }
.study-kit-state { grid-column: 1; color: var(--brand-active); font-size: 11px; font-weight: 700; }
.study-search input.study-kit-toggle { width: 24px; min-height: 24px; padding: 0; }
/* #614: temas entre aulas — lista de temas, segmentos recuperados e matriz temas × aulas. */
.study-shell[data-wizard-step="4"] > .study-themes { display: block; grid-row: 3; grid-column: 1 / -1; }
.study-themes > summary { cursor: pointer; font-size: 16px; font-weight: 800; padding: 6px 0; }
.themes-layout { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.themes-list { display: grid; gap: 2px; margin: 0 0 8px; padding: 0; list-style: none; }
.theme-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.theme-item.theme-child { padding-left: 22px; }
.study-themes .theme-open { flex: 1 1 200px; display: grid; grid-template-columns: 12px minmax(0, 1fr); align-items: center; gap: 4px 8px; min-width: 0; min-height: 44px; border-color: transparent; background: transparent; text-align: left; font-weight: 600; }
.study-themes .theme-open strong { min-width: 0; overflow-wrap: anywhere; }
.study-themes .theme-open small { grid-column: 2; color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.study-themes .theme-open[aria-current="true"] { background: var(--brand-softer); }
.theme-actions { display: flex; gap: 4px; margin-left: auto; }
.study-themes .theme-actions button { padding: 6px 8px; font-size: 12px; }
.theme-swatch { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.theme-segment { border-left: 5px solid var(--theme, var(--brand)); }
.theme-segment blockquote { border-left-color: var(--theme, var(--brand)); }
.theme-segment h4 { margin: 0 0 4px; font-size: 14px; }
.themes-segments { overflow-wrap: anywhere; }
.themes-segments h3 { margin-top: 0; }
.themes-matrix-title { margin: 18px 0 8px; font-size: 16px; }
.themes-matrix { max-height: 460px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.themes-table { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.themes-table caption { padding: 8px; color: var(--text-secondary); text-align: left; }
.themes-table th, .themes-table td { border-bottom: 1px solid var(--border); padding: 3px; text-align: center; }
.themes-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); vertical-align: bottom; }
.themes-table thead th span { display: block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.themes-table tbody th { position: sticky; left: 0; background: var(--surface); text-align: left; white-space: normal; max-width: min(12rem, 40vw); overflow-wrap: anywhere; font-weight: 700; padding-right: 12px; }
.themes-table tbody th.theme-child { padding-left: 18px; font-weight: 600; }
.study-themes .themes-table td button { min-width: 40px; min-height: 36px; border: 0; border-radius: 6px; padding: 4px; }
.study-themes .themes-table td button.has-summary { box-shadow: inset 0 0 0 3px #2e7d4f; }
.themes-legend { margin: 6px 8px; }
.cell-summary { margin-top: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--surface); }
.cell-summary h4 { margin: 0 0 4px; font-size: 14px; }
.study-themes .cell-summary-save { background: var(--brand); color: white; }
.study-themes .cell-summary-save:hover { background: var(--brand-active); }
.coding-bar { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto auto; gap: 6px 10px; align-items: end; margin: 0 0 8px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--surface); box-shadow: 0 4px 14px rgba(0,0,0,.05); }
.coding-bar label { margin: 0 !important; }
.coding-bar :is(input, select) { min-height: 40px !important; padding: 6px 8px !important; }
.coding-bar > button { min-height: 40px; }
.coding-bar-more { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; color: var(--text-secondary); font-size: 12px; }
.coding-bar-more button { min-height: 36px !important; padding: 6px 12px !important; }
.coding-selection { grid-column: 1 / -1; margin: 0; color: var(--text-secondary); font-size: 12px; }
.coding-selection[data-ready="true"] { color: var(--brand-active); font-weight: 700; }
.coding-theme-form { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.coding-theme-form label { flex: 1 1 220px; }
.coding-theme-form[hidden] { display: none; }
mark.theme-mark { background: color-mix(in srgb, var(--theme) 16%, white); color: inherit; border-bottom: 2px solid var(--theme); border-radius: 2px; }
/* #622: Hoje, revisão do dia e ferramentas da aula em abas. */
.study-shell[data-wizard-step="4"] > .study-today { display: block; grid-row: 2; grid-column: 1 / -1; }
.study-shell[data-wizard-step="4"] > .study-kits { grid-row: 3; }
.study-shell[data-wizard-step="4"] > .study-guide { display: block; grid-row: 4; grid-column: 1 / -1; }
.study-shell[data-wizard-step="4"] > .study-themes { grid-row: 5; }
.study-shell:is([data-wizard-step="4"], [data-reading="true"], [data-browsing="true"]) > .study-wizard { grid-template-columns: minmax(0, 1fr) auto; background: var(--surface) !important; }
.study-shell:is([data-reading="true"], [data-browsing="true"]) .study-wizard-controls { display: block; max-width: 44ch; border: 0; padding: 0; grid-column: auto; }
.study-shell:is([data-reading="true"], [data-browsing="true"]) #study-wizard-status { text-align: left; }
.study-shell[data-wizard-step="4"] .study-wizard-controls { grid-column: auto; border: 0; padding: 0; grid-template-columns: minmax(0, 1fr) auto; }
.study-shell[data-wizard-step="4"] #study-wizard-status { max-width: 34ch; text-align: left; }
.study-today { border: 0 !important; background: transparent !important; padding: 0 !important; }
.study-today > h2 { margin: 0 0 8px; font-size: 18px; }
.today-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.week-days { display: flex; gap: 6px; margin: 2px 0; padding: 0; list-style: none; }
.week-days li { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--text-secondary); font-size: 11px; font-weight: 800; }
.week-days li.studied { border-color: var(--brand-active); background: var(--brand-active); color: white; }
.week-days li.today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand-active); }
.week-goal { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 12px; }
.week-goal select { min-height: 36px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px 8px; background: white; color: var(--text-primary); font: inherit; }
.study-today[data-goal-met="true"] .today-week { background: var(--success-soft); }
@media (max-width: 1100px) {
.today-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.coding-bar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.today-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--surface); box-shadow: 0 6px 18px rgba(151,76,49,.06); }
.today-tile h3 { margin: 0; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.today-tile .study-hint { margin: 0; flex: 1; }
#today-week-status:empty { display: none; }
.today-eyebrow { margin: 0; color: var(--brand-active); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.today-tile button { align-self: flex-start; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px 14px; background: var(--surface); color: var(--text-primary); font: inherit; font-weight: 750; cursor: pointer; }
.today-tile button:hover { background: var(--brand-softer); }
.study-today[data-due]:not([data-due="0"]) .today-review { background: var(--brand-softer); }
.today-review #today-review { border-color: var(--brand); background: var(--brand); color: white; }
.today-review #today-review:hover { background: var(--brand-active); }
.today-progress { height: 6px; border-radius: 99px; background: var(--surface-muted); overflow: hidden; }
.today-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--brand); }
.study-tools { position: sticky; top: 0; z-index: 1; display: flex; gap: 4px; margin: 16px 0 0; border-bottom: 1px solid var(--border); background: var(--surface); overflow-x: auto; }
.study-tools [role="tab"] { flex: none; min-height: 44px; border: 0; border-bottom: 3px solid transparent; padding: 8px 14px; background: transparent; color: var(--text-secondary); font: inherit; font-weight: 750; cursor: pointer; }
.study-tools [role="tab"][aria-selected="true"] { background: var(--brand-softer); color: var(--brand-active); }
.study-tools [role="tab"]:hover { color: var(--text-primary); background: var(--brand-softer); }
.study-tools [data-count-of]:not(:empty) { margin-left: 4px; border-radius: 99px; padding: 1px 7px; background: var(--surface-muted); font-size: 11px; }
.study-tools + [role="tabpanel"], [role="tabpanel"].study-section { margin-top: 0; border-top: 0; }
.review-dialog { margin: auto; width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); border: 1px solid var(--border); border-radius: 16px; padding: 20px; background: var(--surface); color: var(--text-primary); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.review-dialog::backdrop { background: rgba(20, 16, 12, .45); }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-head h2 { margin: 0; font-size: 18px; }
.review-dialog button { min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px 14px; background: var(--surface); color: var(--text-primary); font: inherit; font-weight: 750; cursor: pointer; }
.review-dialog button:hover { background: var(--brand-softer); }
.review-body { display: grid; gap: 12px; margin: 14px 0; }
.review-front { margin: 8px 0; font-size: 22px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.review-back { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.review-body blockquote { margin: 0; border-left: 3px solid var(--brand); padding-left: 12px; white-space: pre-wrap; font-size: 13px; color: var(--text-secondary); }
.review-body > button { justify-self: start; }
.review-dialog .review-primary { justify-self: start; border-color: var(--brand); background: var(--brand); color: white; }
.review-dialog .review-primary:hover { background: var(--brand-active); }
.review-ratings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.review-dialog .review-rate-1 { border-color: #b23b3b; }
.review-dialog .review-rate-3 { border-color: var(--brand); background: var(--brand-softer); }
.review-done { margin: 12px 0; font-size: 20px; font-weight: 700; }
.review-keys kbd { border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; background: var(--surface-muted); font: inherit; font-size: 11px; }
.study-guide { line-height: 1.65; }
.study-guide p { max-width: 70ch; margin: 8px 0 12px; }
.study-guide h3 { font-size: 20px; line-height: 1.3; margin: 0 0 8px; }
.study-guide-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding: 20px 0 20px 24px; }
.study-guide-steps li { padding-inline-start: 4px; }
.study-guide-steps li::marker { color: var(--brand-active); font-weight: 700; }
.study-guide-example { max-width: 80ch; padding: 16px; border-radius: 8px; background: var(--surface-muted); }
.study-guide-example summary { min-height: 44px; cursor: pointer; font-weight: 600; }
.study-guide-example dt { margin-top: 12px; font-weight: 600; }
.study-guide-example dd { margin: 4px 0; }
.study-guide-deeper { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 24px; }
.study-guide-sources { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 14px; }
.study-guide-sources ul { padding-left: 20px; }
.study-guide-sources li + li { margin-top: 8px; }
#coding-feedback:empty, #review-status:empty { display: none; }
#review-status:not(:empty) { padding: 12px; border-radius: 8px; background: var(--surface-muted); color: var(--text-primary); }
.study-wrap :is(button, select), .study-wrap .coding-bar :is(button, select, input) { min-height: 44px !important; }
.study-wrap :is(.study-search label, .study-library label, .study-notes label, .study-cards label, .study-concepts label, .study-themes label, .coding-bar label, .week-goal, .coding-selection, .coding-bar-more, .study-kit-card p, .study-kit-state, #study-wizard-status) { font-size: 14px; }
.study-wrap :is(#study-wizard-next, #today-review, #notes-save, #cards-save, #concepts-save, #themes-save, #coding-theme-create, #codings-mark, #study-kit-create, #quizzes-save, .review-primary, .cell-summary-save, .study-search button[type="submit"]) { background: var(--brand-active); color: var(--text-on-brand); }
.study-wrap button:active:not(:disabled) { opacity: .8; }
@media (max-width: 780px) {
.study-wrap { padding: 8px 12px 32px; font-size: 17px; }
.study-topbar { padding: 4px 8px; }
.study-logo { font-size: 17px; } .study-logo span { font-size: 10px; }
.study-shell { display: flex; flex-direction: column; }
.study-shell > * { width: 100%; }
.study-wizard { order: -1; grid-template-columns: 1fr; padding: 15px !important; }
.study-wizard-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.study-wizard-controls { grid-template-columns: 1fr 1fr; }
#study-wizard-status { grid-column: 1 / -1; grid-row: 1; text-align: left; }
.study-today { order: -1; } .study-kits { order: 0; } .study-themes { order: 0; } .study-library { order: 1; } .study-search { order: 2; } .study-kit-builder { order: 3; } .study-lesson-list { order: 4; } .study-reader { order: 5; }
.study-lesson-list { position: static; }
.study-kit-actions { grid-column: 1 / -1; grid-row: auto; justify-content: flex-start; margin-top: 6px; }
#study-lessons { max-height: 42dvh; }
.study-transcript { max-height: 65dvh; padding: 12px; }
#study-kit-form, .study-search form { grid-template-columns: minmax(0, 1fr); }
.themes-layout { grid-template-columns: minmax(0, 1fr); }
.themes-matrix { max-height: 60dvh; }
.today-grid { grid-template-columns: minmax(0, 1fr); }
.study-tools { position: static; }
.review-ratings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.review-ratings button { padding-inline: 8px; font-size: 14px; white-space: nowrap; }
.review-front { font-size: 19px; }
.study-shell:is([data-wizard-step="4"], [data-reading="true"], [data-browsing="true"]) > .study-wizard { grid-template-columns: minmax(0, 1fr); }
.study-shell[data-wizard-step="4"] .study-wizard-controls { grid-template-columns: minmax(0, 1fr); }
.study-shell[data-wizard-step="4"] #study-wizard-status { max-width: none; }
.study-guide-steps, .study-guide-deeper { grid-template-columns: minmax(0, 1fr); gap: 16px; }
.study-guide { order: 0; }
.study-guide-sources, .study-hint, .study-courses button small, #study-lessons .study-lesson-open small { font-size: 15px; }
}
@media print {
:root, body { height: auto; overflow: visible; }
body, .study-shell { display: block; }
.study-wrap { overflow: visible; scrollbar-gutter: auto; margin: auto; }
.study-topbar, .study-lesson-list, .coding-bar, .study-tools { position: static; }
.study-transcript { max-height: none; overflow: visible; }
}
