:root {
  color-scheme: light;
  --ink: #182033;
  --muted: #6d7487;
  --muted-2: #9096a7;
  --primary: #5b5bd6;
  --primary-dark: #4747bf;
  --primary-soft: #eeeeff;
  --surface: #ffffff;
  --canvas: #f4f6fb;
  --border: #e6e8f0;
  --success: #20a979;
  --amber: #f2a33a;
  --blue: #4a8ff5;
  --shadow: 0 14px 40px rgba(30, 35, 70, 0.07);
  --radius-lg: 22px;
  --radius-md: 16px;
  --sidebar-width: 236px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2f4fb;
  --muted: #b2b8c9;
  --muted-2: #8f97aa;
  --primary: #8e8cf5;
  --primary-dark: #b1afff;
  --primary-soft: #292949;
  --surface: #202330;
  --canvas: #171923;
  --border: #343847;
  --shadow: 0 14px 40px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
dialog:not([open]) { display: none !important; pointer-events: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); -webkit-font-smoothing: antialiased; }
.notes-only-toggle-input { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.note-only-toggle { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; cursor: pointer; -webkit-app-region: no-drag; }
.notes-only-exit-label { display: none; }
.notes-page:has(.notes-only-toggle-input:checked) { position: fixed; z-index: 1200; inset: 0; width: 100vw; max-width: none; height: 100vh; margin: 0; overflow: hidden; background: var(--canvas); }
.notes-page:has(.notes-only-toggle-input:checked) .notes-only-enter-label { display: none; }
.notes-page:has(.notes-only-toggle-input:checked) .notes-only-exit-label { display: inline; }
.notes-page:has(.notes-only-toggle-input:checked) .notes-page-header { display: none; }
.notes-page:has(.notes-only-toggle-input:checked) .notes-layout { width: 100%; height: 100vh; min-height: 100vh; grid-template-columns: minmax(0,1fr); border: 0; border-radius: 0; box-shadow: none; }
.notes-page:has(.notes-only-toggle-input:checked) .notes-library { display: none; }
.notes-page:has(.notes-only-toggle-input:checked) .notes-workspace { width: 100%; height: 100vh; min-height: 0; padding: 0; overflow: hidden; }
.notes-page:has(.notes-only-toggle-input:checked) .word-note-editor:not([hidden]),.notes-page:has(.notes-only-toggle-input:checked) .drawing-note-editor:not([hidden]),.notes-page:has(.notes-only-toggle-input:checked) .pdf-note-editor:not([hidden]) { width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; }
.notes-page:has(.notes-only-toggle-input:checked) .note-title-row { flex: 0 0 48px; margin: 0; padding: 6px 132px 5px 12px; background: var(--surface); }
.notes-page:has(.notes-only-toggle-input:checked) .word-note-toolbar,.notes-page:has(.notes-only-toggle-input:checked) .drawing-note-toolbar,.notes-page:has(.notes-only-toggle-input:checked) .pdf-annotation-toolbar { flex: 0 0 auto; margin: 0; border-right: 0; border-left: 0; border-radius: 0; }
.notes-page:has(.notes-only-toggle-input:checked) .drawing-canvas-wrap { flex: 1 1 auto; height: auto; min-height: 0; border: 0; border-radius: 0; }
.notes-page:has(.notes-only-toggle-input:checked) .word-note-paper { flex: 1 1 auto; min-height: 0; overflow: auto; border-right: 0; border-bottom: 0; border-left: 0; }
.notes-page:has(.notes-only-toggle-input:checked) .pdf-note-frame-wrap { flex: 1 1 auto; height: auto; min-height: 0; border-radius: 0; }
.notes-page:has(.notes-only-toggle-input:checked) .note-save-status { display: none; }
.window-drag-region { position: fixed; z-index: 1000; inset: 0 0 auto; height: 24px; background: transparent; -webkit-app-region: drag; -webkit-user-select: none; user-select: none; pointer-events: none; }
button, a, input, textarea, select, [contenteditable="true"], canvas, #drawing-note-canvas { -webkit-app-region: no-drag; }
input, textarea, [contenteditable="true"], .flashcard-face, .custom-review-card, .lesson-copy { -webkit-user-select: text; user-select: text; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 2vw, 2.15rem); line-height: 1.15; letter-spacing: -0.035em; font-weight: 750; }
h2 { font-size: 1.14rem; line-height: 1.25; letter-spacing: -0.018em; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(91, 91, 214, 0.25); outline-offset: 3px; }
.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; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 30px 20px 22px; background: #fbfbfe; border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px; font-size: 1.08rem; font-weight: 750; letter-spacing: -0.02em; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; overflow: hidden; box-shadow: 0 7px 16px rgba(91, 91, 214, 0.2); }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.primary-nav { display: grid; gap: 7px; margin-top: 42px; }
.nav-item { position: relative; min-height: 46px; display: flex; align-items: center; gap: 13px; width: 100%; padding: 0 13px; border: 0; border-radius: 12px; background: transparent; color: #777d90; font-size: 0.925rem; font-weight: 600; cursor: pointer; transition: 160ms ease; }
.nav-item svg { width: 21px; height: 21px; }
.nav-item:hover { background: #f3f3fb; color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); }
.nav-item.active::before { content: ""; position: absolute; left: -20px; width: 3px; height: 24px; border-radius: 0 6px 6px 0; background: var(--primary); }
.sidebar-footer { display: grid; gap: 14px; margin-top: auto; }
.settings-button { text-align: left; }
.settings-page { max-width: 1120px; margin: 0 auto; }
.settings-page-header { margin-bottom: 20px; padding: 8px 2px; }
.settings-page-header h2 { margin: 4px 0 7px; font-size: 1.6rem; }
.settings-page-header > div > p:last-child, .settings-card-heading > p { color: var(--muted); font-size: .72rem; line-height: 1.5; }
.settings-card-heading > p { display: none !important; }
#settings-form { display: grid; gap: 14px; }
.settings-tabs { position: sticky; z-index: 8; top: 12px; width: min(420px,100%); display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb,var(--surface) 94%,transparent); box-shadow: 0 8px 22px rgba(38,42,78,.06); backdrop-filter: blur(10px); }
.settings-tabs button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 760; cursor: pointer; }
.settings-tabs button.active { background: var(--primary); color: white; }
.settings-panel { display: grid; gap: 14px; }
.settings-card { padding: 22px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.settings-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.settings-card-heading h3 { margin: 4px 0 0; font-size: 1rem; }
.settings-card-heading > p { max-width: 390px; text-align: right; }
.settings-data-export { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.settings-data-export > div { display: grid; gap: 5px; }
.settings-data-export strong { font-size: .72rem; }
.settings-data-export span,.settings-export-status { color: var(--muted); font-size: .62rem; line-height: 1.5; }
.settings-export-status { margin-top: 12px; }
.site-data-warning { display: grid; gap: 4px; margin-top: 16px; padding: 12px 14px; border: 1px solid #efd7a4; border-radius: 10px; background: #fff9ec; color: #6d5420; }
.site-data-warning strong { font-size: .68rem; }
.site-data-warning span { font-size: .61rem; line-height: 1.5; }
.settings-data-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.settings-check { display: inline-flex; align-items: center; gap: 9px; min-height: 38px; color: var(--ink); font-size: .74rem; }
.settings-check input[type="checkbox"], .theme-options input[type="radio"], .profile-visibility-options input[type="radio"] { width: 16px !important; min-width: 16px !important; height: 16px !important; min-height: 16px !important; margin: 0; padding: 0; accent-color: var(--primary); }
.account-button { text-align: left; }
.account-dialog { width: min(92vw,520px); padding: 0; overflow: hidden; border: 0; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 90px rgba(24,28,55,.28); }
.account-dialog::backdrop { background: rgba(26,30,50,.46); backdrop-filter: blur(5px); }
.account-dialog-shell { display: grid; gap: 20px; padding: 26px; }
.account-dialog h2 { margin-top: 4px; font-size: 1.45rem; }
.account-panel { display: grid; gap: 18px; }
.account-panel[hidden] { display: none; }
.account-panel h3 { margin: 0 0 6px; font-size: 1.05rem; }
.account-panel p { margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.6; }
.account-hero-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: var(--primary-soft); color: var(--primary); }
.account-hero-icon svg { width: 28px; height: 28px; }
.account-message { display: grid; gap: 5px; padding-top: 2px; }
.account-message strong { font-size: .72rem; }
.account-message span { color: var(--muted); font-size: .62rem; line-height: 1.5; }
.account-profile-summary { display: flex; align-items: center; gap: 13px; padding: 13px; border: 1px solid var(--border); border-radius: 14px; background: var(--canvas); }
.account-profile-summary img { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--primary-soft); }
.account-profile-summary > div { min-width: 0; display: grid; gap: 3px; }
.account-profile-summary span,.account-profile-summary small { overflow: hidden; color: var(--muted); font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.account-profile-summary strong { overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
#username-form { display: grid; gap: 9px; }
#username-form > label { color: var(--muted); font-size: .67rem; font-weight: 760; }
.profile-name-field { width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; outline: 0; background: var(--canvas); color: var(--ink); font: inherit; font-size: .82rem; }
.profile-name-field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,91,214,.13); }
.profile-field-help { color: var(--muted); font-size: .59rem; line-height: 1.45; }
.username-field { height: 48px; display: flex; align-items: center; gap: 2px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--canvas); color: var(--muted); }
.username-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,91,214,.13); }
.username-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: .82rem; }
#username-help { color: var(--muted); font-size: .59rem; line-height: 1.45; }
.username-availability { min-height: 1.3em; color: var(--muted); font-size: .63rem; }
.username-availability[data-state="available"] { color: #187c55; }
.username-availability[data-state="taken"],.username-availability[data-state="error"] { color: #b84d40; }
#save-username { justify-self: stretch; margin-top: 4px; }
.username-badge { width: fit-content; padding: 8px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .73rem; font-weight: 800; }
.account-signed-in > .button { justify-self: start; }
.google-signin-button { min-height: 44px; min-width: 220px; display: flex; align-items: center; justify-content: flex-start; }
.google-signin-button[hidden] { display: none; }
.storage-health-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.storage-health-summary > div { display: grid; gap: 5px; }
.storage-health-summary strong { font-size: .78rem; }
.storage-health-summary span,.storage-diagnostics { color: var(--muted); font-size: .65rem; line-height: 1.5; }
.storage-meter { height: 10px; margin: 16px 0 12px; overflow: hidden; border-radius: 999px; background: var(--soft); }
.storage-meter > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width .25s ease; }
.storage-meter.warning > span { background: #d98b32; }
.storage-meter.danger > span { background: #c34f45; }
.storage-diagnostics { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.app-update-summary { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.app-update-summary > div:first-child { display: grid; gap: 5px; }
.app-update-summary strong { font-size: .78rem; }
.app-update-summary span { color: var(--muted); font-size: .65rem; line-height: 1.5; }

.notes-page { max-width: 1440px; margin: -30px auto 0; }
.notes-page-header { position: relative; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 8px; padding: 0 2px; }
.notes-page-header h1 { margin: 0; }
.notes-new-actions { min-width: 0; display: flex; justify-content: flex-end; gap: 8px; -webkit-app-region: no-drag; }
.notes-new-actions .button { min-width: 0; min-height: 42px; padding: 0 14px; white-space: nowrap; }
.note-create-menu { position: relative; }
.note-create-menu > summary { min-height: 42px; display: flex; align-items: center; list-style: none; cursor: pointer; }
.note-create-menu > summary::-webkit-details-marker { display: none; }
.note-create-menu > div { position: absolute; z-index: 80; top: calc(100% + 8px); right: 0; width: 230px; overflow: hidden; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 48px rgba(25,29,58,.24); isolation: isolate; }
.note-create-menu > div button { width: 100%; display: grid; gap: 3px; padding: 11px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.note-create-menu > div button:hover { background: var(--primary-soft); }
.note-create-menu > div strong { font-size: .72rem; }
.note-create-menu > div span { color: var(--muted); font-size: .6rem; }
.notes-layout { min-height: calc(100vh - 120px); display: grid; grid-template-columns: 250px minmax(0,1fr); overflow: hidden; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.notes-library { padding: 16px; border-right: 1px solid var(--border); background: color-mix(in srgb,var(--surface) 91%,var(--primary-soft)); }
.notes-search { display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--muted); }
.notes-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.notes-list { display: grid; align-content: start; gap: 7px; margin-top: 14px; }
.notes-drag-hint { margin-top: 10px; color: var(--muted-2); font-size: .56rem; line-height: 1.4; }
.note-folder { overflow: hidden; border: 1px solid color-mix(in srgb,var(--notebook-color,#d9b66f) 70%,var(--border)); border-radius: 10px; background: color-mix(in srgb,var(--notebook-color,#d9b66f) 20%,var(--surface)); }
.note-folder.drag-over { outline: 2px solid var(--primary); outline-offset: 2px; }
.note-folder-heading { display: flex; align-items: center; gap: 5px; padding: 6px; background: color-mix(in srgb,var(--notebook-color,#d9b66f) 42%,var(--surface)); }
.note-folder-toggle { min-width: 0; flex: 1; display: flex; align-items: center; gap: 7px; padding: 5px; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.note-folder-toggle strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .66rem; }
.note-folder-icon { color: color-mix(in srgb,var(--notebook-color,#d9b66f) 76%,#342b1b); font-size: .88rem; }
.note-folder-action { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: .65rem; cursor: pointer; }
.note-folder-action:hover { background: var(--surface); color: var(--ink); }
.note-folder-study { min-height: 26px; padding: 0 8px; border: 0; border-radius: 7px; background: var(--primary); color: white; font-size: .55rem; font-weight: 800; cursor: pointer; }
.note-folder-study:hover { background: var(--primary-dark); }
.note-folder-study:disabled { opacity: .45; cursor: not-allowed; }
.note-folder-items { display: grid; gap: 5px; padding: 6px; }
.note-folder-empty { padding: 10px; color: var(--muted-2); font-size: .56rem; text-align: center; }
.notes-unfiled-section { display: grid; gap: 5px; min-height: 64px; border: 1px dashed transparent; border-radius: 12px; transition: border-color .15s ease,background .15s ease; }
.notes-unfiled-drop { min-height: 42px; display: grid; align-content: center; gap: 2px; padding: 7px 10px; color: var(--muted-2); }
.notes-unfiled-drop strong { font-size: .55rem; text-transform: uppercase; letter-spacing: .08em; }
.notes-unfiled-drop span { display: none; font-size: .54rem; font-weight: 650; }
.note-drag-active .notes-unfiled-section { min-height: 88px; border-color: color-mix(in srgb,var(--primary) 50%,var(--border)); background: color-mix(in srgb,var(--primary-soft) 65%,transparent); }
.note-drag-active .notes-unfiled-drop span { display: block; }
.notes-unfiled-section.drag-over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.note-list-item { width: 100%; display: grid; grid-template-columns: 35px minmax(0,1fr); gap: 10px; padding: 11px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.note-list-item:hover,.note-list-item.active { background: var(--primary-soft); }
.note-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.note-actions-grid .button { width: 100%; }
.note-list-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; background: var(--surface); color: var(--primary); font-size: .78rem; font-weight: 800; }
.note-list-copy { min-width: 0; display: grid; gap: 4px; }
.note-list-copy strong,.note-list-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-list-copy strong { font-size: .72rem; }
.note-list-copy small { color: var(--muted); font-size: .58rem; }
.notes-workspace { min-width: 0; padding: 8px 10px 10px; background: var(--canvas); }
.notes-empty { min-height: 560px; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; }
.notes-empty > span { font-size: 2.2rem; color: var(--primary); }
.notes-empty p { max-width: 440px; color: var(--muted); font-size: .72rem; line-height: 1.6; }
.notes-empty > div { display: flex; gap: 10px; margin-top: 8px; }
.word-note-editor,.drawing-note-editor,.pdf-note-editor { min-height: 610px; }
.pdf-annotation-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 9px; border: 1px solid var(--border); border-radius: 13px 13px 0 0; background: var(--surface); }
.pdf-annotation-toolbar button { min-height: 34px; padding: 0 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .65rem; font-weight: 700; cursor: pointer; }
.pdf-annotation-toolbar button.active,.pdf-annotation-toolbar button:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.pdf-annotation-toolbar label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .62rem; font-weight: 700; }
.pdf-note-frame-wrap { height: max(620px,calc(100vh - 225px)); overflow: auto; display: grid; justify-items: center; gap: 18px; padding: 18px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 14px 14px; background: #555; }
.pdf-page-shell { position: relative; background: #fff; box-shadow: 0 5px 18px rgba(0,0,0,.28); }
.pdf-page-shell canvas { display: block; }
.pdf-page-annotation { position: absolute; z-index: 2; inset: 0; touch-action: none; cursor: crosshair; }
.notes-page:has(.notes-only-toggle-input:checked) .pdf-note-frame-wrap { height: calc(100vh - 92px); }
.note-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.note-title-row input { min-width: 0; flex: 1; padding: 5px 4px; border: 0; border-bottom: 1px solid var(--border); outline: 0; background: transparent; color: var(--ink); font-size: 1.18rem; font-weight: 760; }
.note-notebook-control { flex: 0 1 190px; min-width: 130px; display: grid; gap: 3px; color: var(--muted); font-size: .5rem; font-weight: 760; text-transform: uppercase; letter-spacing: .05em; }
.note-notebook-control select { width: 100%; height: 34px; padding: 0 28px 0 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: .62rem; font-weight: 690; text-transform: none; letter-spacing: 0; }
.note-folder-add { font-size: .84rem; font-weight: 820; }
.cornell-note-template { box-sizing: border-box; height: calc(100% - 8px); min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) minmax(135px,18%); overflow: hidden; border: 1.5px solid #252a3b; border-radius: 4px; background: #fff; color: #20243a; white-space: normal; }
.cornell-meta { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(135px,.7fr) minmax(135px,.7fr); gap: 16px; padding: 9px 14px 8px; border-bottom: 1.5px solid #252a3b; }
.cornell-topic-field,.cornell-meta-field { min-width: 0; display: grid; grid-template-columns: auto minmax(0,1fr); align-items: end; gap: 9px; }
.cornell-meta-grid { display: contents; }
.cornell-field-label { color: #5c6274; font-size: 8.5pt; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cornell-meta-entry { min-width: 0; min-height: 20px; padding: 1px 2px 2px; overflow: hidden; border-bottom: 1px solid #9499a8; outline: 0; white-space: nowrap; }
.cornell-columns { min-height: 0; display: grid; grid-template-columns: minmax(155px,29%) minmax(0,1fr); }
.cornell-column { min-width: 0; display: grid; grid-template-rows: auto minmax(0,1fr); }
.cornell-cues { border-right: 1.5px solid #252a3b; background: #fbfaff; }
.cornell-section-title { min-height: 43px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 13px 8px; border-bottom: 1px solid #cfd2dc; background: #f1f0ff; }
.cornell-section-title strong { color: #4841bd; font-size: 9.5pt; letter-spacing: .02em; }
.cornell-section-title span { color: #777d8f; font-size: 7.5pt; font-weight: 650; text-align: right; }
.cornell-writing-area { min-height: 0; padding: 14px 15px; outline: 0; line-height: 1.48; white-space: pre-wrap; }
.cornell-summary { min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); border-top: 1.5px solid #252a3b; background: #fffdfa; }
.cornell-summary .cornell-section-title { min-height: 38px; padding-block: 8px 6px; background: #f8f4e8; }
.cornell-summary .cornell-section-title strong { color: #756022; }
.cornell-meta-entry[data-placeholder]:empty::before,.cornell-writing-area[data-placeholder]:empty::before,.cornell-meta-entry[data-placeholder]:has(> br:only-child)::before,.cornell-writing-area[data-placeholder]:has(> br:only-child)::before { color: #9a9faf; content: attr(data-placeholder); font-style: italic; pointer-events: none; }
.cornell-static { -webkit-user-select: none; user-select: none; }
.outline-note-template { min-height: 820px; }
.outline-note-template h2 { margin-top: 0; padding-bottom: 12px; border-bottom: 1px solid #d8dbe7; }
.word-note-toolbar,.drawing-note-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 9px; border: 1px solid var(--border); border-radius: 13px 13px 0 0; background: var(--surface); }
.word-note-toolbar button,.drawing-note-toolbar button { min-height: 34px; padding: 0 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .65rem; font-weight: 700; cursor: pointer; }
.note-font-control { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .6rem; font-weight: 700; }
.note-font-control select { min-height: 34px; padding: 0 28px 0 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .65rem; }
.word-note-toolbar button:hover,.drawing-note-toolbar button:hover,.drawing-note-toolbar button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.word-note-paper { min-height: 540px; padding: 42px clamp(28px,6vw,82px); border: 1px solid var(--border); border-top: 0; outline: 0; background: var(--surface); color: var(--ink); font-size: .9rem; line-height: 1.75; }
.word-note-paper:empty::before { content: attr(data-placeholder); color: var(--muted-2); }
.word-note-paper h2 { margin: 1.25em 0 .45em; font-size: 1.35rem; }
.word-note-paper ul,.word-note-paper ol { padding-left: 26px; }
.note-save-status { display: none; }
.drawing-note-toolbar { position: relative; border-radius: 13px; margin-bottom: 6px; }
.drawing-tools { display: flex; gap: 6px; }
.drawing-note-toolbar .tool-icon-button { position: relative; display: inline-grid; place-items: center; width: 38px; min-width: 38px; height: 38px; min-height: 38px; padding: 0; }
.drawing-note-toolbar .tool-icon-button::after { position: absolute; z-index: 1400; top: calc(100% + 7px); left: 50%; width: max-content; max-width: 150px; padding: 5px 7px; border-radius: 6px; opacity: 0; background: #171b2d; color: #fff; content: attr(aria-label); font-size: .58rem; font-weight: 700; line-height: 1.2; pointer-events: none; transform: translate(-50%,-3px); transition: opacity .12s ease,transform .12s ease; }
.drawing-note-toolbar .tool-icon-button:hover::after,.drawing-note-toolbar .tool-icon-button:focus-visible::after { opacity: 1; transform: translate(-50%,0); }
.drawing-note-toolbar .tool-icon-button svg { width: 21px; height: 21px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drawing-note-toolbar .tool-icon-button[data-note-tool="cursor"] svg { fill: currentColor; stroke-width: 1.2; }
.canvas-text-options { flex: 1 0 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 8px; border-top: 1px solid var(--border); background: color-mix(in srgb,var(--surface) 88%,var(--primary-soft)); }
.canvas-text-options[hidden] { display: none; }
.canvas-text-styles { display: flex; gap: 4px; }
.canvas-text-styles button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.drawing-note-toolbar label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .62rem; font-weight: 700; }
.drawing-note-toolbar input[type="color"] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.inline-color-control { position: relative; overflow: visible !important; }
.inline-color-trigger { width: 28px; min-width: 28px; height: 28px; min-height: 28px !important; padding: 0 !important; border: 2px solid var(--surface) !important; border-radius: 7px !important; background: var(--selected-color) !important; box-shadow: 0 0 0 1px var(--border); }
.inline-color-palette { position: absolute; z-index: 1200; left: 50%; bottom: calc(100% + 10px); width: 156px; display: grid; grid-template-columns: repeat(5,24px); gap: 6px; padding: 9px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 14px 34px rgba(24,28,48,.2); transform: translateX(-50%); }
.inline-color-palette[hidden] { display: none; }
.inline-color-palette::after { position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); content: ""; transform: translateX(-50%) rotate(45deg); }
.inline-color-palette [data-pick-color] { position: relative; z-index: 1; width: 24px; min-width: 24px; height: 24px; min-height: 24px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.inline-color-palette [data-pick-color]:hover { transform: scale(1.12); }
.inline-color-palette.quick-color-palette { width: 246px; grid-template-columns: repeat(8,24px); gap: 6px; }
.inline-color-palette.full-color-palette { width: 260px; max-width: calc(100vw - 24px); max-height: 132px; overflow-y: auto; grid-template-columns: repeat(16,12px); gap: 3px; padding: 7px; }
.inline-color-palette.full-color-palette [data-pick-color] { width: 12px; min-width: 12px; height: 12px; min-height: 12px; border-width: 1px; }
.inline-color-palette.opens-below { top: calc(100% + 10px); bottom: auto; }
.inline-color-palette.opens-below::after { top: -6px; bottom: auto; border: 0; border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.inline-color-palette .more-colors-swatch { width: 24px; min-width: 24px; height: 24px; min-height: 24px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: conic-gradient(#f5222d,#fadb14,#52c41a,#1890ff,#722ed1,#eb2f96,#f5222d); box-shadow: 0 0 0 1px var(--border); color: #fff; font-size: 15px; font-weight: 900; line-height: 20px; text-shadow: 0 1px 3px rgba(0,0,0,.7); cursor: pointer; }
.drawing-zoom-value { min-width: 42px; color: var(--muted); font-size: .62rem; font-weight: 760; text-align: center; }
.note-image-options { position: absolute; z-index: 1350; top: calc(100% + 6px); right: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 4px 6px; border: 1px solid #cbc9f2; border-radius: 9px; background: #f6f5ff; box-shadow: 0 8px 24px rgba(31,35,58,.14); }
.note-image-options[hidden] { display: none; }
.note-image-options > span { padding: 0 4px; color: var(--primary); font-size: .56rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.document-inline-crop { position: absolute; z-index: 5; overflow: visible; pointer-events: none; touch-action: none; }
.canvas-inline-crop { position: absolute; z-index: 1400; overflow: visible; pointer-events: none; touch-action: none; }
.note-inline-crop-source { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; user-select: none; }
.document-inline-crop-selection { position: absolute; box-sizing: border-box; border: 2px dashed #111; box-shadow: 0 0 0 9999px rgba(255,255,255,.58); cursor: move; pointer-events: auto; touch-action: none; }
.document-inline-crop-selection::before,.document-inline-crop-selection::after { position: absolute; inset: 33.333% 0 auto; border-top: 1px dotted rgba(0,0,0,.5); content: ""; pointer-events: none; }
.document-inline-crop-selection::after { inset: 66.666% 0 auto; }
.document-inline-crop-handle { position: absolute; z-index: 2; box-sizing: border-box; width: 14px; height: 14px; border: 1px solid #fff; background: #111; pointer-events: auto; }
.document-inline-crop-handle[data-note-crop-handle="nw"] { top: -8px; left: -8px; cursor: nwse-resize; }
.document-inline-crop-handle[data-note-crop-handle="n"] { top: -8px; left: calc(50% - 7px); cursor: ns-resize; }
.document-inline-crop-handle[data-note-crop-handle="ne"] { top: -8px; right: -8px; cursor: nesw-resize; }
.document-inline-crop-handle[data-note-crop-handle="e"] { top: calc(50% - 7px); right: -8px; cursor: ew-resize; }
.document-inline-crop-handle[data-note-crop-handle="se"] { right: -8px; bottom: -8px; cursor: nwse-resize; }
.document-inline-crop-handle[data-note-crop-handle="s"] { bottom: -8px; left: calc(50% - 7px); cursor: ns-resize; }
.document-inline-crop-handle[data-note-crop-handle="sw"] { bottom: -8px; left: -8px; cursor: nesw-resize; }
.document-inline-crop-handle[data-note-crop-handle="w"] { top: calc(50% - 7px); left: -8px; cursor: ew-resize; }
.document-inline-crop-edge { position: absolute; z-index: 1; display: block; background: transparent; pointer-events: auto; }
.document-inline-crop-edge[data-note-crop-handle="n"],.document-inline-crop-edge[data-note-crop-handle="s"] { right: 0; left: 0; height: 18px; cursor: ns-resize; }
.document-inline-crop-edge[data-note-crop-handle="n"] { top: -9px; }
.document-inline-crop-edge[data-note-crop-handle="s"] { bottom: -9px; }
.document-inline-crop-edge[data-note-crop-handle="e"],.document-inline-crop-edge[data-note-crop-handle="w"] { top: 0; bottom: 0; width: 18px; cursor: ew-resize; }
.document-inline-crop-edge[data-note-crop-handle="e"] { right: -9px; }
.document-inline-crop-edge[data-note-crop-handle="w"] { left: -9px; }
.drawing-note-editor { width: 100%; min-width: 0; overflow: hidden; }
.drawing-canvas-wrap { position: relative; width: 100%; max-width: 100%; height: max(520px,calc(100vh - 245px)); overflow: auto; overflow-anchor: none; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px rgba(20,25,45,.02); contain: layout paint; user-select: none; }
#drawing-note-canvas { display: block; width: 40000px; height: 40000px; max-width: none; margin: 48px; outline: 1px solid #dfe3ec; cursor: crosshair; touch-action: none; background-color: #fff; background-image: linear-gradient(#e6e9f0 1px,transparent 1px),linear-gradient(90deg,#e6e9f0 1px,transparent 1px); background-size: 20px 20px; transform-origin: top left; }
#drawing-note-canvas[hidden] { display: none; }
.open-note-text-layer { position: fixed; z-index: 1290; overflow: hidden; overflow-anchor: none; border-radius: 14px; pointer-events: none; }
.open-note-text-layer[hidden] { display: none; }
.open-note-text-layer .canvas-text-shell { position: absolute; width: auto; height: auto; min-width: 100px; min-height: 32px; pointer-events: auto; user-select: none; }
.open-note-text-layer .canvas-text-editor { box-sizing: border-box; width: 100%; height: 100%; min-height: 32px; padding: 3px 5px; resize: none; overflow: hidden; border: 1px solid transparent; border-radius: 4px; outline: none; background: transparent; line-height: 1.2; caret-color: #5d55e7 !important; -webkit-text-fill-color: currentColor; cursor: text; -webkit-user-select: text; user-select: text; }
.open-note-text-layer .canvas-text-editor:focus { border-color: rgba(102,94,232,.6); background: rgba(255,255,255,.9); box-shadow: 0 0 0 2px rgba(102,94,232,.12); }
.open-note-text-layer .canvas-text-editor::placeholder { color: #9aa0af; opacity: 1; }
.open-note-text-layer .canvas-text-delete { position: absolute; top: -16px; right: -16px; left: auto; width: 30px; height: 30px; display: none; align-items: center; justify-content: center; padding: 0; border: 1px solid #efb6af; border-radius: 9px; opacity: 1; background: #fff5f3; color: #b84d40; font-size: 14px; cursor: pointer; pointer-events: auto; transform: none; }
.open-note-text-layer .canvas-text-shell:hover .canvas-text-delete { display: flex; opacity: 1; pointer-events: auto; transform: none; }
.open-note-text-layer .canvas-text-shell:focus-within:not(:hover) .canvas-text-delete { display: none; }
.pdf-loading-message { align-self: start; margin: 56px auto; padding: 14px 18px; border-radius: 12px; background: rgba(255,255,255,.94); color: #303548; font-size: .72rem; font-weight: 700; box-shadow: 0 5px 18px rgba(0,0,0,.2); }
.pdf-page-shell[data-loading="true"]::after { position: absolute; inset: 0; display: grid; place-items: center; color: #8d93a5; font-size: .68rem; font-weight: 700; content: "Loading page…"; }
#drawing-note-canvas.page-note-surface { margin: 24px auto 12px; background-color: transparent; background-image: none; filter: drop-shadow(0 8px 14px rgba(24,28,48,.12)); }
.page-actions { display: flex; justify-content: center; gap: 9px; margin: 0 0 28px; }
.page-actions button,.page-add-menu > summary { min-width: 145px; box-sizing: border-box; padding: 11px 18px; border: 1px dashed #aaaadb; border-radius: 12px; background: var(--surface); color: var(--primary); font-size: .67rem; font-weight: 800; text-align: center; cursor: pointer; list-style: none; }
.page-actions button:hover,.page-add-menu > summary:hover { border-style: solid; background: var(--primary-soft); }
.page-add-menu { position: relative; }
.page-add-menu > summary::-webkit-details-marker { display: none; }
.page-add-menu > div { position: absolute; z-index: 20; right: 0; bottom: calc(100% + 7px); min-width: 170px; display: grid; gap: 5px; padding: 7px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); box-shadow: 0 12px 30px rgba(24,28,48,.18); }
.page-add-menu > div button { min-width: 0; padding: 9px 11px; border-style: solid; text-align: left; }
.page-actions .remove-note-page { border-color: #e0aaa3; color: #b84d40; }
.page-actions .remove-note-page:disabled { opacity: .4; cursor: not-allowed; }
.page-document-pages { position: absolute; z-index: 2; top: 24px; right: 0; left: 0; display: grid; gap: 44px; pointer-events: none; }
.page-document-pages[hidden] { display: none; }
.page-document-pages.text-editing-active { pointer-events: auto; }
.document-page-shell { position: relative; width: min(800px,calc(100% - 48px)); aspect-ratio: 8 / 11; margin: 0 auto; }
.document-page-number { position: absolute; z-index: 2; top: 14px; left: 18px; color: #8f95a6; font-size: .6rem; font-weight: 780; letter-spacing: .04em; pointer-events: none; }
.document-printed-page-number { position: absolute; z-index: 3; right: 0; bottom: 24px; left: 0; color: #626879; font: 10pt Arial,sans-serif; text-align: center; pointer-events: none; }
.document-printed-page-number[hidden] { display: none; }
.page-document-content { position: absolute; inset: 0; box-sizing: border-box; width: 100%; height: 100%; padding: 76px 82px; overflow: hidden; border: 1px solid transparent; outline: 0; background: transparent; caret-color: #665ee8; color: #171b2d; font-family: Arial,sans-serif; font-size: 11pt; line-height: 1.15; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; cursor: default; -webkit-user-select: none; user-select: none; transition: border-color .14s ease,box-shadow .14s ease; }
.text-editing-active .page-document-content { cursor: text; -webkit-user-select: text; user-select: text; }
.text-editing-active .document-page-shell.active .page-document-content { border-color: rgba(102,94,232,.58); box-shadow: 0 0 0 2px rgba(102,94,232,.12),0 8px 28px rgba(24,28,48,.14); }
.text-editing-active .page-document-content:empty::before { color: #9aa0af; content: attr(data-placeholder); }
.page-document-content h1,.page-document-content h2,.page-document-content h3 { margin: .7em 0 .35em; line-height: 1.25; }
.page-document-content ul,.page-document-content ol { margin: .45em 0; padding-left: 28px; }
.page-document-content table { width: 100%; margin: .7em 0; border-collapse: collapse; table-layout: fixed; }
.page-document-content th,.page-document-content td { min-width: 54px; padding: 7px 8px; border: 1px solid #9aa0af; vertical-align: top; overflow-wrap: anywhere; }
.page-document-content th,.page-document-content td { background: #ffffff; }
.page-document-content th { font-weight: 750; }
.page-document-content [data-active-table-cell] { position: relative; outline: 2px solid var(--primary); outline-offset: -2px; }
:root[data-theme="dark"] .page-document-content th,:root[data-theme="dark"] .page-document-content td { background: #ffffff; color: #171b2d; }
.document-pasted-image { position: relative; box-sizing: border-box; width: min(100%,320px); min-width: 80px; max-width: 100%; margin: 16px auto; padding: 10px; overflow: hidden; resize: horizontal; border: 1px solid #dfe2ec; border-radius: 12px; text-align: center; background: #fff; cursor: ew-resize; }
.document-pasted-image.is-cropping { overflow: visible; resize: none; cursor: default; }
.document-pasted-image img { display: block; width: 100% !important; max-width: 100%; height: auto !important; margin: 0 auto; transform-origin: center; }
.document-pasted-image figcaption { min-height: 1.2em; margin-top: 10px; color: #73798d; font-size: 10pt; }
:root[data-theme="dark"] .document-pasted-image { border-color: #3a4052; background: #202431; }
.document-text-toolbar { flex: 1 0 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.document-text-toolbar[hidden] { display: none; }
.document-toolbar-menu { position: relative; }
.document-toolbar-menu summary { min-height: 34px; display: flex; align-items: center; padding: 0 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .65rem; font-weight: 780; cursor: pointer; list-style: none; }
.document-toolbar-menu summary::-webkit-details-marker { display: none; }
.document-toolbar-menu summary::after { margin-left: 8px; color: var(--muted); content: "▾"; }
.document-toolbar-menu[open] summary { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.document-toolbar-popover { position: absolute; z-index: 1250; top: calc(100% + 7px); left: 0; width: min(520px,calc(100vw - 36px)); display: grid; gap: 9px; padding: 11px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 16px 38px rgba(24,28,48,.2); }
.document-toolbar-group { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.document-toolbar-group > span { width: 70px; color: var(--muted); font-size: .58rem; font-weight: 780; text-transform: uppercase; letter-spacing: .06em; }
.document-format-toggle { display: flex; align-items: center; gap: 8px; padding: 5px 2px; color: var(--ink); font-size: .62rem; font-weight: 700; cursor: pointer; }
.document-format-toggle input { width: 17px; height: 17px; accent-color: var(--primary); }
.document-toolbar-fields { padding-top: 8px; border-top: 1px solid var(--border); }
.document-insert-popover { width: 210px; }
.document-insert-popover button { width: 100%; justify-content: flex-start; }
.document-edit-popover { width: min(430px,calc(100vw - 36px)); }
.document-table-empty { margin: 0; padding: 10px; border-radius: 8px; background: var(--canvas); color: var(--muted); font-size: .63rem; }
.document-table-controls { display: grid; gap: 9px; }
.document-table-controls[hidden] { display: none; }
.document-table-controls label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .6rem; font-weight: 700; }
.document-table-controls select { min-height: 34px; padding: 0 26px 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); }
.document-table-controls input[type="color"] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.document-delete-table { justify-self: start; border-color: #efbbb4 !important; background: #fff3f1 !important; color: #b74f42 !important; }
.document-toolbar-hint { margin-left: 5px; color: var(--muted-2); font-size: .58rem; }
.document-page-controls { display: flex; align-items: center; gap: 5px; margin-left: auto; padding-left: 7px; border-left: 1px solid var(--border); }
.document-page-controls button:disabled { opacity: .4; cursor: not-allowed; }
.document-color-control input { width: 28px; height: 28px; padding: 1px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.document-note-mode .drawing-tools,
.document-note-mode .canvas-text-options,
.document-note-mode .drawing-note-toolbar > .inline-color-control,
.document-note-mode .drawing-note-toolbar > label,
.document-note-mode #undo-note-stroke,
.document-note-mode #redo-note-stroke,
.document-note-mode #note-image-options,
.document-note-mode #drawing-zoom-out,
.document-note-mode #drawing-zoom-in,
.document-note-mode #drawing-zoom-fit,
.document-note-mode #drawing-zoom-value,
.document-note-mode #clear-note-canvas { display: none !important; }
.document-note-mode #drawing-note-canvas { position: relative; z-index: 3; }
.document-note-mode .page-document-pages { z-index: 2; }
.canvas-text-shell { position: relative; width: 100%; height: 100%; min-height: 1.5em; }
.canvas-text-editor { box-sizing: border-box; display: block; width: 100%; height: 100%; min-height: 1.35em; margin: 0; padding: 2px 4px; overflow: hidden; resize: none; border: 0; outline: 0; background: transparent; caret-color: #665ee8; caret-shape: bar; color: #171b2d; font-family: Arial,sans-serif; line-height: 1.25; text-align: left; text-indent: 0; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.canvas-text-editor::placeholder { color: #9aa0af; opacity: 1; }
.canvas-text-editor:focus { background: rgba(102,94,232,.035); box-shadow: inset 0 -1px rgba(102,94,232,.3); }
.canvas-text-delete { position: absolute; z-index: 2; top: 0; left: 0; width: 30px; height: 30px; padding: 0; border: 1px solid #f2b9b1; border-radius: 9px; opacity: 0; background: #fff2ef; color: #b84d40; font-size: 15px; line-height: 1; cursor: pointer; pointer-events: none; transform: translateY(-105%) scale(.88); transform-origin: left bottom; transition: opacity .14s ease,transform .14s ease; }
.canvas-text-shell:hover .canvas-text-delete,.canvas-text-delete:focus-visible { opacity: 1; pointer-events: auto; transform: translateY(-105%) scale(1); }
.canvas-text-shell:focus-within .canvas-text-delete { opacity: 0; pointer-events: none; transform: translateY(-105%) scale(.88); }
:root[data-theme="dark"] .drawing-canvas-wrap { border-color: rgba(255,255,255,.34); }

@media (max-width: 900px) {
  .notes-layout { grid-template-columns: 190px minmax(0,1fr); }
  .notes-page-header { align-items: flex-start; flex-direction: column; }
  .notes-new-actions { width: 100%; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .notes-new-actions .button { width: 100%; padding-inline: 8px; font-size: .63rem; }
  .note-create-menu > summary { justify-content: center; }
}
@media (max-width: 680px) {
  .note-title-row { flex-wrap: wrap; }
  .note-title-row > input { flex-basis: 100%; }
  .note-notebook-control { flex: 1 1 180px; }
  .page-document-content { padding: 52px 24px; }
  .cornell-note-template { border-radius: 2px; }
  .cornell-meta { grid-template-columns: minmax(0,1fr); gap: 9px; padding: 9px 10px; }
  .cornell-meta-grid { gap: 9px; }
  .cornell-topic-field,.cornell-meta-field { gap: 6px; }
  .cornell-field-label { font-size: 7pt; }
  .cornell-meta-entry { min-height: 18px; font-size: 9pt; }
  .cornell-columns { grid-template-columns: minmax(105px,34%) minmax(0,1fr); }
  .cornell-section-title { min-height: 34px; align-items: center; padding: 7px 8px 6px; }
  .cornell-section-title strong { font-size: 7.5pt; line-height: 1.15; }
  .cornell-section-title span { display: none; }
  .cornell-writing-area { padding: 9px 8px; font-size: 9pt; }
  .notes-layout { display: block; }
  .notes-library { border-right: 0; border-bottom: 1px solid var(--border); }
  .notes-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .notes-workspace { padding: 10px; }
}
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.settings-grid label { display: grid; gap: 7px; color: var(--muted); font-size: .64rem; font-weight: 700; }
.settings-grid input, .settings-grid select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; outline: 0; background: var(--canvas); color: var(--ink); font-size: .72rem; }
.settings-grid input:focus, .settings-grid select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,91,214,.13); }
.settings-wide { grid-column: 1 / -1; }
.theme-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.theme-options label { position: relative; cursor: pointer; }
.theme-options input { position: absolute; opacity: 0; }
.theme-options span { min-height: 82px; display: grid; align-content: center; gap: 5px; padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--canvas); }
.theme-options input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.theme-options strong { font-size: .75rem; }
.theme-options small { color: var(--muted); font-size: .59rem; }
.settings-actions { position: sticky; bottom: 15px; display: flex; justify-content: flex-end; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 15px; background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(14px); }

:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .course-tile,
:root[data-theme="dark"] .textbook-search,
:root[data-theme="dark"] .search-field,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .custom-study-page-header,
:root[data-theme="dark"] .custom-review-shell,
:root[data-theme="dark"] .custom-review-card,
:root[data-theme="dark"] .custom-question-practice,
:root[data-theme="dark"] .custom-feynman-practice,
:root[data-theme="dark"] .draft-card-row,
:root[data-theme="dark"] .draft-card-row textarea,
:root[data-theme="dark"] .custom-deck-item,
:root[data-theme="dark"] .anki-mini-picker label,
:root[data-theme="dark"] .anki-card,
:root[data-theme="dark"] .anki-ratings button,
:root[data-theme="dark"] .custom-anki-ratings button,
:root[data-theme="dark"] .create-field input,
:root[data-theme="dark"] .create-field textarea,
:root[data-theme="dark"] .create-field select,
:root[data-theme="dark"] #notes-input,
:root[data-theme="dark"] .card-image-actions button { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .sidebar { background: #1c1f2a; }
:root[data-theme="dark"] .custom-review-card,
:root[data-theme="dark"] .anki-card { background: linear-gradient(145deg,#252936,#1d202b); }
:root[data-theme="dark"] .custom-review-card.revealed { background: linear-gradient(145deg,#292846,#202330); }
:root[data-theme="dark"] .anki-daily-summary,
:root[data-theme="dark"] .anki-today-panel,
:root[data-theme="dark"] .anki-unit-choice,
:root[data-theme="dark"] .built-in-unit-picker,
:root[data-theme="dark"] .anki-note-import { background: #24273a; }
:root[data-theme="dark"] .anki-daily-summary > div,
:root[data-theme="dark"] .anki-today-panel > div,
:root[data-theme="dark"] .built-in-unit-choice span,
:root[data-theme="dark"] .built-in-topic-choice span { background: var(--surface); }
:root[data-theme="dark"] .search-field kbd { background: #292c38; color: var(--muted); }

@media (max-width: 700px) {
  .settings-grid, .theme-options { grid-template-columns: 1fr; }
  .settings-card-heading { display: grid; gap: 7px; }
  .settings-card-heading > p { text-align: left; }
  .account-dialog-shell { padding: 21px; }
  .google-signin-button { justify-self: stretch; }
}

/* True black theme: every reading surface stays dark, with quiet white outlines. */
:root[data-theme="dark"] {
  --ink: #ffffff;
  --muted: #e3e5eb;
  --muted-2: #bfc4cf;
  --surface: #000000;
  --canvas: #000000;
  --border: rgba(255,255,255,.24);
  --primary-soft: #15151f;
  --shadow: none;
}
:root[data-theme="dark"] body,
:root[data-theme="dark"] .main-content,
:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .library-section,
:root[data-theme="dark"] .flashcards-library,
:root[data-theme="dark"] .create-builder,
:root[data-theme="dark"] .saved-decks,
:root[data-theme="dark"] .settings-card,
:root[data-theme="dark"] .settings-tabs,
:root[data-theme="dark"] .settings-actions,
:root[data-theme="dark"] .course-page,
:root[data-theme="dark"] .course-page-header,
:root[data-theme="dark"] .chapter-sidebar,
:root[data-theme="dark"] .lesson-view,
:root[data-theme="dark"] .custom-study-page,
:root[data-theme="dark"] .custom-study-page-header,
:root[data-theme="dark"] .custom-review-shell,
:root[data-theme="dark"] .custom-delete-page,
:root[data-theme="dark"] .custom-delete-card,
:root[data-theme="dark"] .studio-dialog,
:root[data-theme="dark"] .studio-source,
:root[data-theme="dark"] .studio-result,
:root[data-theme="dark"] .assistant-panel,
:root[data-theme="dark"] .task-dialog { background: #000 !important; color: #fff !important; }

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .course-tile,
:root[data-theme="dark"] .custom-deck-item,
:root[data-theme="dark"] .built-in-deck-item,
:root[data-theme="dark"] .settings-grid input,
:root[data-theme="dark"] .settings-grid select,
:root[data-theme="dark"] .theme-options span,
:root[data-theme="dark"] .textbook-search,
:root[data-theme="dark"] .search-field,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .create-field input,
:root[data-theme="dark"] .create-field textarea,
:root[data-theme="dark"] .create-field select,
:root[data-theme="dark"] .rich-notes-input,
:root[data-theme="dark"] .anki-note-import,
:root[data-theme="dark"] .create-content-tabs,
:root[data-theme="dark"] .create-content-tabs button.active,
:root[data-theme="dark"] .inline-manual-card,
:root[data-theme="dark"] .draft-card-row,
:root[data-theme="dark"] .draft-card-row textarea,
:root[data-theme="dark"] .card-image-actions button,
:root[data-theme="dark"] .built-in-unit-picker,
:root[data-theme="dark"] .built-in-unit-choice span,
:root[data-theme="dark"] .built-in-topic-choice span,
:root[data-theme="dark"] .custom-review-card,
:root[data-theme="dark"] .custom-review-card.revealed,
:root[data-theme="dark"] .custom-question-practice,
:root[data-theme="dark"] .custom-question-choices button,
:root[data-theme="dark"] .custom-question-response textarea,
:root[data-theme="dark"] .custom-feynman-practice,
:root[data-theme="dark"] .custom-feynman-response textarea,
:root[data-theme="dark"] .manual-feynman-row,
:root[data-theme="dark"] .feynman-draft-row input,
:root[data-theme="dark"] .custom-study-options > button,
:root[data-theme="dark"] .custom-study-option-card,
:root[data-theme="dark"] .mode-count-picker,
:root[data-theme="dark"] .mode-count-picker input,
:root[data-theme="dark"] .anki-daily-summary,
:root[data-theme="dark"] .anki-daily-summary > div,
:root[data-theme="dark"] .anki-today-panel,
:root[data-theme="dark"] .anki-today-panel > div,
:root[data-theme="dark"] .feynman-mode-timer,
:root[data-theme="dark"] .feynman-mode-timer input,
:root[data-theme="dark"] .feynman-mode-timer select,
:root[data-theme="dark"] .custom-anki-ratings button,
:root[data-theme="dark"] .empty-my-courses,
:root[data-theme="dark"] .atkins-section-outline,
:root[data-theme="dark"] .atkins-equations div,
:root[data-theme="dark"] .offline-card,
:root[data-theme="dark"] .offline-card.revealed,
:root[data-theme="dark"] .anki-card-picker label,
:root[data-theme="dark"] .anki-unit-picker,
:root[data-theme="dark"] .anki-unit-choice,
:root[data-theme="dark"] .anki-mini-picker label,
:root[data-theme="dark"] .feynman-time-setting,
:root[data-theme="dark"] .feynman-time-setting input,
:root[data-theme="dark"] .feynman-time-setting select,
:root[data-theme="dark"] .feynman-prompt,
:root[data-theme="dark"] .feynman-session textarea,
:root[data-theme="dark"] .anki-card,
:root[data-theme="dark"] .anki-equation,
:root[data-theme="dark"] .anki-ratings button,
:root[data-theme="dark"] .flashcard-navigation button,
:root[data-theme="dark"] .offline-quiz,
:root[data-theme="dark"] .offline-quiz button,
:root[data-theme="dark"] .method-option,
:root[data-theme="dark"] .generated-card,
:root[data-theme="dark"] .quiz-item,
:root[data-theme="dark"] .quiz-option,
:root[data-theme="dark"] .feynman-section,
:root[data-theme="dark"] .model-bar,
:root[data-theme="dark"] .assistant-message > div,
:root[data-theme="dark"] .assistant-composer,
:root[data-theme="dark"] .task-dialog input,
:root[data-theme="dark"] .task-dialog select,
:root[data-theme="dark"] .task-dialog textarea { background: #000 !important; color: #fff !important; border-color: rgba(255,255,255,.24) !important; box-shadow: none !important; }

:root[data-theme="dark"] .main-content :is(h1,h2,h3,h4,p,li,label,strong,em),
:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select { color: #fff; }
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder { color: #9da3af; }
:root[data-theme="dark"] button:disabled,
:root[data-theme="dark"] input:disabled,
:root[data-theme="dark"] select:disabled { color: #aeb5c3 !important; opacity: .9; }
:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .secondary-button:disabled,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .icon-button:disabled { background: #fff !important; color: #111827 !important; border-color: #fff !important; opacity: 1; }
:root[data-theme="dark"] .danger-button,
:root[data-theme="dark"] .danger-button:disabled { background: #fff !important; color: #b34d43 !important; border-color: #fff !important; opacity: 1; }
:root[data-theme="dark"] .settings-card .settings-export-status,
:root[data-theme="dark"] .settings-card small { color: #d2d6df; }
:root[data-theme="dark"] .theme-options input:checked + span { background: #c9c9ff !important; color: #101322 !important; border-color: #a5a5ff !important; box-shadow: inset 0 0 0 2px #6868e8, 0 0 0 3px rgba(165,165,255,.28) !important; }
:root[data-theme="dark"] .theme-options input:checked + span small { color: #30334a !important; }
:root[data-theme="dark"] .custom-deck-item,
:root[data-theme="dark"] .built-in-deck-item { background: #fff !important; color: #111827 !important; border-color: #d7dbe7 !important; }
:root[data-theme="dark"] .custom-deck-item :is(h1,h2,h3,h4,p,span,strong,small),
:root[data-theme="dark"] .built-in-deck-item :is(h1,h2,h3,h4,p,span,strong,small) { color: #111827 !important; }
:root[data-theme="dark"] .nav-item:hover,
:root[data-theme="dark"] .mini-unit-button:hover,
:root[data-theme="dark"] .chapter-button:hover,
:root[data-theme="dark"] .custom-study-options > button:hover { background: #101015 !important; }
:root[data-theme="dark"] .deck-wrench { border: 1px solid rgba(255,255,255,.34); background: #000; color: #fff; }
:root[data-theme="dark"] .deck-wrench:hover { border-color: #fff; background: #111; color: #fff; }
.profile-card { display: flex; align-items: center; gap: 10px; padding: 14px 10px 0; border-top: 1px solid var(--border); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 13px; background: #2e3654; color: white; font-weight: 750; }
.profile-copy { min-width: 0; display: grid; gap: 2px; }
.profile-copy strong { font-size: 0.875rem; }
.profile-copy span { color: var(--muted-2); font-size: 0.75rem; }
.profile-menu { margin-left: auto; }

.settings-profile-grid { display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 1fr) minmax(110px, .7fr); gap: 14px; }
.settings-profile-grid label { display: grid; gap: 8px; color: var(--muted); font-size: .67rem; font-weight: 750; }
.settings-profile-grid input, .settings-profile-grid select { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--ink); font: inherit; }
.settings-profile-grid input:focus, .settings-profile-grid select:focus { border-color: #aaaadf; outline: 3px solid rgba(91,91,214,.12); }
.profile-visibility-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.profile-visibility-options label { position: relative; cursor: pointer; }
.profile-visibility-options input { position: absolute; opacity: 0; pointer-events: none; }
.profile-visibility-options span { min-height: 88px; display: grid; align-content: center; gap: 5px; padding: 15px 17px; border: 1px solid var(--border); border-radius: 14px; background: var(--canvas); transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.profile-visibility-options strong { font-size: .76rem; }
.profile-visibility-options small { color: var(--muted); font-size: .61rem; line-height: 1.5; }
.profile-visibility-options input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(91,91,214,.1); }
.profile-visibility-options input:focus-visible + span { outline: 3px solid rgba(91,91,214,.2); outline-offset: 2px; }
.profile-visibility-options input:disabled + span { opacity: .58; cursor: not-allowed; }
.birthday-celebration { position: relative; min-height: 158px; max-width: 1460px; display: grid; grid-template-columns: minmax(0,1fr) 260px; align-items: center; gap: 24px; margin: 0 auto 18px; padding: 24px 30px; overflow: hidden; border: 1px solid #e2dff7; border-radius: var(--radius-lg); background: linear-gradient(125deg,#f8f6ff,#fff8ed); box-shadow: 0 7px 28px rgba(47,44,102,.06); }
.birthday-celebration[hidden] { display: none; }
.birthday-message { position: relative; z-index: 2; }
.birthday-message .section-label { margin-bottom: 7px; }
.birthday-message h2 { margin: 0; font-size: 1.55rem; letter-spacing: -.035em; }
.birthday-message > p:last-child { margin: 7px 0 0; color: var(--muted); font-size: .78rem; }
.birthday-confetti { position: absolute; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }
.birthday-confetti i { position: absolute; top: var(--top); left: var(--left); width: var(--size); height: calc(var(--size) * .58); border-radius: 2px; background: var(--color); transform: rotate(var(--rotation)); box-shadow: 0 1px 3px rgba(31,35,65,.14); }
.birthday-scene { position: relative; z-index: 2; width: 230px; height: 130px; justify-self: end; }
.birthday-balloon { position: absolute; top: 0; width: 76px; height: 94px; border-radius: 52% 48% 48% 52% / 45% 45% 55% 55%; box-shadow: inset -10px -10px 16px rgba(38,35,89,.16), 0 8px 18px rgba(38,35,89,.12); }
.birthday-balloon::before { content: ""; position: absolute; bottom: -8px; left: 33px; border-right: 6px solid transparent; border-bottom: 0; border-left: 6px solid transparent; border-top: 10px solid currentColor; }
.birthday-balloon::after { content: ""; position: absolute; top: 100px; left: 38px; width: 1px; height: 73px; background: rgba(78,82,111,.42); transform: rotate(4deg); transform-origin: top; }
.balloon-one { left: 7px; background: #7978ea; color: #7978ea; transform: rotate(-7deg); }
.balloon-two { top: 15px; left: 83px; background: #f1b84b; color: #f1b84b; transform: rotate(5deg); }
.balloon-three { left: 155px; background: #ee7168; color: #ee7168; transform: rotate(9deg); }
@media (max-width: 760px) { .birthday-celebration { grid-template-columns: minmax(0,1fr) 120px; padding: 22px; } .birthday-scene { width: 150px; transform: scale(.72); transform-origin: center right; } .birthday-confetti i:nth-child(n+45) { display: none; } }
:root[data-theme="dark"] .birthday-celebration { border-color: rgba(255,255,255,.24); background: #000; }
:root[data-theme="dark"] .settings-profile-grid input, :root[data-theme="dark"] .settings-profile-grid select { border-color: rgba(255,255,255,.24); background: #000; color: #fff; }

.main-content { min-height: 100vh; margin-left: var(--sidebar-width); padding: 36px clamp(26px, 4vw, 64px) 52px; }
.library-section[hidden] { display: none; }
.courses-page { max-width: 1460px; margin: 0 auto; }
.courses-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; padding: 8px 2px 0; }
.courses-page-header .intro { max-width: 620px; }
.browse-library-toggle { width: min(720px,100%); display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin-bottom: 22px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: #f1f1f8; }
.browse-library-toggle button { min-height: 46px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: .72rem; font-weight: 780; cursor: pointer; }
.browse-library-toggle button:hover { color: var(--primary); }
.browse-library-toggle button.active { background: white; color: var(--primary); box-shadow: 0 4px 12px rgba(38,42,78,.07); }
.browse-library-panel[hidden] { display: none; }
.community-library-toolbar { display: grid; grid-template-columns: minmax(210px,.8fr) auto; align-items: end; gap: 24px; margin-bottom: 20px; }
.community-library-heading { min-width: 0; }
.community-library-heading h2 { margin: 0; }
.community-library-heading .deck-source-copy { margin: 5px 0 0; }
.community-library-actions { min-width: 0; display: flex; align-items: flex-end; justify-content: flex-end; gap: 10px; }
.community-kind-filter { display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; }
.community-kind-filter button { min-height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: .65rem; font-weight: 760; white-space: nowrap; cursor: pointer; }
.community-kind-filter button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.community-sort-control { display: grid; gap: 4px; color: var(--muted); font-size: .57rem; font-weight: 760; }
.community-sort-control select { min-width: 138px; height: 40px; padding: 0 34px 0 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--ink); font: inherit; font-size: .66rem; font-weight: 720; }
.community-library-actions .study-deck-search { width: min(300px,23vw); }
.my-public-library-toolbar .community-library-actions { align-items: center; }
.my-public-library-toolbar .button { min-height: 40px; }
@media (max-width: 1120px) {
  .community-library-toolbar { grid-template-columns: 1fr; align-items: start; gap: 14px; }
  .community-library-actions { justify-content: flex-start; flex-wrap: wrap; }
  .community-library-actions .study-deck-search { width: min(100%,420px); flex: 1 1 280px; }
}
@media (max-width: 620px) {
  .community-library-actions { align-items: stretch; }
  .community-kind-filter { width: 100%; }
  .community-kind-filter button { flex: 1; }
  .community-sort-control { width: 100%; }
  .community-sort-control select { width: 100%; }
  .community-library-actions .study-deck-search { width: 100%; flex-basis: 100%; }
  .my-public-library-toolbar .button { width: 100%; }
}
.community-item-card { position: relative; gap: 7px; padding: 17px; }
.community-starter-card { border-color: color-mix(in srgb,var(--primary) 34%,var(--border)); background: linear-gradient(180deg,color-mix(in srgb,var(--primary-soft) 36%,var(--surface)),var(--surface) 42%); }
.community-item-card > .built-in-deck-label { margin: 0 0 2px; }
.community-item-card > h3 { margin: 0; line-height: 1.3; }
.community-item-card > p { margin: 0; color: var(--muted); line-height: 1.5; }
.community-card-meta { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.community-author { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; color: var(--muted); font-size: .62rem; line-height: 1.35; }
.community-author button { min-width: 0; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.community-author button:hover strong,.community-author button:focus-visible strong { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.community-author button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 3px; }
.community-author strong { color: var(--ink); }
.community-add-count { flex: 0 0 auto; color: var(--muted); font-size: .59rem; font-weight: 720; }
.community-rating { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 0; color: #d18a00; font-size: .67rem; font-weight: 800; line-height: 1.3; }
.community-rating small { color: var(--muted); font-size: .58rem; font-weight: 650; }
.community-rating-pending { color: var(--muted); }
.community-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.community-card-actions .button { width: 100%; }
.community-added-button,.community-added-button:disabled { border-color: #a9ddc7; background: #e8f8f1; color: #167957; opacity: 1; cursor: default; box-shadow: none; }
.my-public-library .community-item-card { border-color: #cfcdf6; }
.my-public-status { width: fit-content; padding: 5px 9px; border-radius: 999px; background: #eefaf5; color: #167957; font-size: .56rem; font-weight: 820; letter-spacing: .05em; text-transform: uppercase; }
.my-public-updated { color: var(--muted); font-size: .58rem; }
.my-public-login { grid-column: 1/-1; display: grid; justify-items: center; gap: 12px; padding: 34px; }
.community-profile-dialog { width: min(900px,calc(100vw - 28px)); max-height: min(88vh,860px); padding: 0; overflow: hidden; border: 1px solid rgba(214,216,235,.85); border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 90px rgba(20,24,50,.28); }
.community-profile-dialog::backdrop { background: rgba(26,29,49,.5); backdrop-filter: blur(6px); }
.community-profile-shell { max-height: min(88vh,860px); display: grid; grid-template-rows: auto minmax(180px,1fr); overflow: hidden; }
.community-profile-header { position: relative; padding: 94px 28px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.community-profile-cover { position: absolute; inset: 0 0 auto; height: 104px; overflow: hidden; background: linear-gradient(118deg,#5254cc 0%,#6964df 46%,#8c78e6 100%); }
.community-profile-cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 15% 30%,rgba(255,255,255,.2),transparent 25%),radial-gradient(circle at 82% 20%,rgba(255,255,255,.16),transparent 22%); }
.community-profile-cover span { position: absolute; width: 86px; height: 86px; border: 1px solid rgba(255,255,255,.17); border-radius: 24px; transform: rotate(18deg); }
.community-profile-cover span:nth-child(1) { left: 18%; top: -48px; }
.community-profile-cover span:nth-child(2) { right: 28%; bottom: -60px; }
.community-profile-cover span:nth-child(3) { right: 7%; top: -30px; width: 120px; height: 120px; border-radius: 50%; }
.community-profile-close { position: absolute; z-index: 2; top: 17px; right: 17px; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; background: rgba(28,31,69,.24); color: #fff; font: inherit; font-size: 1rem; line-height: 1; cursor: pointer; backdrop-filter: blur(8px); }
.community-profile-close:hover { background: rgba(28,31,69,.42); }
.community-profile-close:focus-visible { outline: 3px solid rgba(255,255,255,.8); outline-offset: 2px; }
.community-profile-heading { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.community-profile-identity { min-width: 0; display: flex; align-items: flex-end; gap: 15px; }
.community-profile-avatar { width: 72px; height: 72px; flex: 0 0 72px; display: grid; place-items: center; border: 5px solid var(--surface); border-radius: 22px; background: linear-gradient(145deg,#f0edff,#dcd8ff); color: var(--primary-dark); font-size: 1.45rem; font-weight: 880; box-shadow: 0 8px 22px rgba(45,48,90,.16); }
.community-profile-identity > div { min-width: 0; display: grid; gap: 2px; padding-bottom: 4px; }
.community-profile-identity h2 { margin: 0; overflow: hidden; font-size: 1.25rem; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.community-profile-identity p,.community-profile-summary { margin: 0; color: var(--muted); font-size: .65rem; line-height: 1.45; }
.community-profile-badge { width: fit-content; margin-bottom: 2px; color: var(--primary); font-size: .52rem; font-weight: 840; letter-spacing: .09em; text-transform: uppercase; }
.community-profile-stats { flex: 0 0 auto; display: flex; align-items: center; gap: 0; padding: 10px 4px; border: 1px solid var(--border); border-radius: 14px; background: var(--canvas); }
.community-profile-stats div { min-width: 88px; display: grid; justify-items: center; gap: 2px; padding: 0 14px; border-right: 1px solid var(--border); }
.community-profile-stats div:last-child { border-right: 0; }
.community-profile-stats strong { font-size: .82rem; }
.community-profile-stats span { color: var(--muted); font-size: .52rem; font-weight: 720; text-transform: uppercase; letter-spacing: .05em; }
.community-profile-library { min-height: 0; display: grid; grid-template-rows: auto minmax(120px,1fr); gap: 14px; padding: 22px 28px 26px; overflow: hidden; background: color-mix(in srgb,var(--canvas) 72%,var(--surface)); }
.community-profile-library-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.community-profile-library-heading > div { display: grid; gap: 3px; }
.community-profile-library-heading h3 { margin: 0; font-size: .83rem; }
.community-profile-items { min-height: 0; overflow-y: auto; display: grid; align-content: start; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 1px 5px 1px 1px; }
.community-profile-item { min-width: 0; min-height: 150px; display: grid; grid-template-rows: auto 1fr auto; gap: 11px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 5px 16px rgba(35,40,80,.045); }
.community-profile-item-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.community-profile-item-top span { color: var(--primary); font-size: .51rem; font-weight: 840; letter-spacing: .09em; text-transform: uppercase; }
.community-profile-item-top small { color: #c68000; font-size: .58rem; font-weight: 820; }
.community-profile-item-copy { min-width: 0; display: grid; align-content: start; gap: 5px; }
.community-profile-item h3 { margin: 0; overflow: hidden; font-size: .75rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.community-profile-item p { margin: 0; color: var(--muted); font-size: .59rem; line-height: 1.45; }
.community-profile-item-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.community-profile-item-meta small { color: var(--muted); font-size: .57rem; font-weight: 720; }
.community-profile-item-meta .button { min-height: 34px; padding: 6px 13px; border-radius: 10px; font-size: .59rem; }
.deck-preview-dialog { width: min(920px,calc(100vw - 28px)); max-height: min(88vh,900px); padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 28px 80px rgba(20,24,50,.3); }
.deck-preview-dialog::backdrop { background: rgba(20,24,45,.52); backdrop-filter: blur(4px); }
.deck-preview-shell { max-height: min(88vh,900px); display: grid; grid-template-rows: auto auto minmax(180px,1fr) auto auto; gap: 14px; padding: 22px; }
.deck-preview-tabs { display: flex; gap: 7px; padding: 5px; border-radius: 13px; background: var(--soft); }
.deck-preview-tabs button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: .67rem; font-weight: 780; cursor: pointer; }
.deck-preview-tabs button.active { background: var(--surface); color: var(--primary); box-shadow: 0 3px 10px rgba(30,35,70,.08); }
.deck-preview-scroll { min-height: 180px; overflow-y: auto; display: grid; align-content: start; gap: 10px; padding: 4px 7px 4px 1px; }
.deck-preview-item { display: grid; gap: 7px; padding: 14px 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--canvas); }
.deck-preview-item span { color: var(--primary); font-size: .57rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.deck-preview-item strong { font-size: .75rem; line-height: 1.45; }
.deck-preview-item p { margin: 0; color: var(--muted); font-size: .67rem; line-height: 1.5; white-space: pre-wrap; }
.deck-preview-image { width: min(100%,220px); margin: 4px auto 0; display: grid; justify-items: center; gap: 5px; }
.deck-preview-image img { display: block; width: 100%; height: 150px; object-fit: contain; border: 0; border-radius: 10px; background: #fff; }
.deck-preview-image figcaption { color: var(--muted); font-size: .52rem; line-height: 1.35; text-align: center; }
.deck-preview-image figcaption a { color: inherit; text-decoration: none; }
.deck-preview-image figcaption a:hover { color: var(--primary); text-decoration: underline; }
.deck-preview-actions { display: flex; justify-content: flex-end; }
.community-feedback { max-height: 300px; overflow-y: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.community-feedback-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.community-feedback-grid.single-panel { grid-template-columns: 1fr; }
.community-feedback form { display: grid; align-content: start; gap: 9px; padding: 13px; border: 1px solid var(--border); border-radius: 13px; }
.community-feedback h3 { margin: 0; font-size: .75rem; }
.community-feedback textarea,.community-feedback select { width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--canvas); color: var(--ink); font: inherit; font-size: .65rem; }
.community-feedback textarea { min-height: 70px; resize: vertical; }
.community-review-list .community-review-entry { padding: 9px 12px; }
.community-review-list .community-review-entry > span { color: #d88900; font-size: 1rem; letter-spacing: .08em; }
.community-feedback label { display: grid; gap: 5px; color: var(--muted); font-size: .61rem; font-weight: 720; }
.rating-picker { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; margin: 0; padding: 0; border: 0; }
.rating-picker legend { margin-bottom: 5px; color: var(--muted); font-size: .61rem; font-weight: 720; }
.rating-picker label { cursor: pointer; }
.rating-picker input { position: absolute; opacity: 0; pointer-events: none; }
.rating-picker span { color: #c7c9d3; font-size: 1.3rem; }
.rating-picker label:hover span,.rating-picker label:hover ~ label span,.rating-picker input:checked ~ span,.rating-picker label:has(input:checked) ~ label span { color: #e2a418; }
.community-review-list { display: grid; gap: 8px; margin-top: 12px; }
.community-review-entry { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--soft); }
.community-review-entry header { display: flex; justify-content: space-between; gap: 10px; font-size: .62rem; }
.community-review-entry p { margin: 0; color: var(--muted); font-size: .63rem; line-height: 1.5; }
.textbook-library-panel { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow); }
.browse-textbook-catalog-button { margin: 0 0 16px; }
:root[data-theme="dark"] .browse-library-toggle,
:root[data-theme="dark"] .browse-library-toggle button.active,
:root[data-theme="dark"] .textbook-library-panel { background: #000; }
.textbook-search { height: 48px; display: grid; grid-template-columns: 21px minmax(0,1fr); align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--border); border-radius: 13px; background: white; box-shadow: 0 5px 18px rgba(38,42,78,.05); }
.textbook-search:focus-within { border-color: #b8b8ea; box-shadow: 0 0 0 3px rgba(91,91,214,.1); }
.textbook-search svg { width: 19px; color: var(--muted-2); }
.textbook-search input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .72rem; }
.course-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.course-heading-actions .textbook-search { width: min(360px,38vw); }
.catalog-search-wrap { display: grid; justify-items: end; gap: 7px; }
.catalog-search-wrap .textbook-search { width: min(400px,40vw); }
.catalog-search-wrap > span { color: var(--muted-2); font-size: .61rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 28px; max-width: 1460px; margin: 0 auto 30px; }
.eyebrow { margin-bottom: 8px; color: var(--primary); font-size: 0.76rem; font-weight: 750; letter-spacing: 0.085em; text-transform: uppercase; }
.intro { margin-top: 7px; color: var(--muted); font-size: 0.92rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.search-field { width: min(18vw, 240px); min-width: 180px; height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); color: var(--muted-2); transition: 160ms ease; }
.search-field:focus-within { border-color: #b8b8ea; box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.1); }
.search-field svg { width: 18px; height: 18px; }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 0.875rem; }
.search-field input::placeholder { color: #9b9faf; }
.search-field kbd { padding: 3px 6px; border: 1px solid var(--border); border-radius: 5px; background: #f8f8fb; color: #9b9faf; font: 0.67rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.icon-button { width: 42px; height: 42px; flex: 0 0 42px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; transition: 160ms ease; }
.icon-button:hover { border-color: #d2d4df; background: #f8f8fb; }
.notification-button { position: relative; }
.notification-dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border: 2px solid white; border-radius: 50%; background: #eb6b77; }
.button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 0; border-radius: 12px; font-size: 0.84rem; font-weight: 700; cursor: pointer; transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease; }
.button:active { transform: translateY(1px); }
.primary-button { background: var(--primary); color: white; box-shadow: 0 8px 18px rgba(91, 91, 214, 0.21); }
.primary-button:hover { background: var(--primary-dark); box-shadow: 0 10px 24px rgba(91, 91, 214, 0.27); }
.primary-button svg { width: 18px; height: 18px; }
.assistant-button { border: 1px solid #dcdcf6; background: #f4f4ff; color: var(--primary-dark); box-shadow: none; }
.assistant-button:hover { background: #eaeaff; }
.assistant-button svg { width: 17px; height: 17px; }
.secondary-button { border: 1px solid var(--border); background: white; color: var(--ink); }
.text-button { min-height: 38px; padding: 0 8px; background: transparent; color: var(--primary); box-shadow: none; }
.text-button:hover { background: var(--primary-soft); }
.text-button svg { width: 17px; height: 17px; }

.stats-grid { max-width: 1460px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 0 auto 18px; }
.stat-card { display: flex; align-items: center; gap: 14px; min-height: 96px; padding: 19px 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: 0 4px 20px rgba(40, 45, 80, 0.035); }
.stat-icon { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; border-radius: 14px; }
.stat-icon.violet { background: #eeeeff; color: var(--primary); }
.stat-icon.blue { background: #eaf3ff; color: var(--blue); }
.stat-icon.amber { background: #fff4df; color: var(--amber); }
.stat-icon svg { width: 24px; height: 24px; }
.stat-card > div { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 11px; }
.stat-card p { grid-column: 1 / -1; margin-bottom: 4px; color: var(--muted); font-size: 0.78rem; }
.stat-card strong { font-size: 1.28rem; letter-spacing: -0.025em; }
.trend { color: var(--muted-2); font-size: 0.7rem; }
.trend.positive { color: var(--success); }

.dashboard-grid { max-width: 1460px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin: 0 auto; align-items: start; }
.primary-column, .secondary-column { display: grid; gap: 18px; }
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 5px 26px rgba(30, 35, 70, 0.04); }
.continue-card { position: relative; min-height: 280px; display: grid; grid-template-columns: 37% 63%; overflow: hidden; border-radius: var(--radius-lg); background: linear-gradient(135deg, #5d5edf 0%, #6668dd 52%, #7778e4 100%); color: white; box-shadow: 0 18px 38px rgba(79, 78, 190, 0.2); }
.continue-card[hidden] { display: none; }
.continue-card::after { content: ""; position: absolute; right: -120px; bottom: -180px; width: 380px; height: 380px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.continue-visual { position: relative; min-height: 100%; display: grid; place-items: center; overflow: hidden; background: rgba(27, 27, 94, 0.1); }
.continue-visual::before { content: ""; position: absolute; inset: 12%; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.16) 0, rgba(255,255,255,.06) 44%, transparent 70%); }
.continue-visual > svg { position: relative; z-index: 2; width: 108px; height: 108px; color: rgba(255,255,255,.95); stroke-width: 1.35; filter: drop-shadow(0 14px 18px rgba(37,36,100,.22)); }
.continue-visual > svg path:first-child { fill: rgba(255,255,255,.08); }
.orbit { position: absolute; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; }
.orbit-one { width: 210px; height: 210px; }
.orbit-two { width: 150px; height: 150px; border-style: dashed; }
.continue-content { position: relative; z-index: 2; display: flex; flex-direction: column; justify-content: center; padding: 34px 38px; }
.card-kicker { margin-bottom: 16px; color: rgba(255,255,255,.74); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; }
.continue-title-row { display: flex; justify-content: space-between; gap: 18px; }
.continue-title-row h2 { font-size: clamp(1.35rem, 2vw, 1.72rem); }
.continue-title-row p { margin-top: 7px; color: rgba(255,255,255,.72); font-size: 0.84rem; }
.course-badge { align-self: flex-start; padding: 6px 9px; border: 1px solid rgba(255,255,255,.22); border-radius: 8px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.85); font-size: 0.66rem; font-weight: 750; letter-spacing: .05em; }
.progress-copy { display: flex; justify-content: space-between; margin: 25px 0 8px; color: rgba(255,255,255,.72); font-size: 0.74rem; }
.progress-copy strong { color: white; }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(20, 20, 80, 0.22); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: white; box-shadow: 0 0 12px rgba(255,255,255,.38); }
.light-button { align-self: flex-start; min-height: 41px; margin-top: 24px; background: white; color: var(--primary-dark); box-shadow: 0 9px 22px rgba(30,30,90,.16); }
.light-button:hover { background: #f6f6ff; }
.light-button svg { width: 17px; height: 17px; }

.tasks-card { padding: 24px; }
.active-anki-card { padding: 24px; }
.active-anki-total { padding: 7px 10px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: .72rem; font-weight: 800; }
.active-anki-intro { margin: 8px 0 16px; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.active-anki-batch { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; margin: -2px 0 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--canvas); }
.active-anki-batch[hidden] { display: none; }
.active-anki-batch label { display: flex; align-items: center; gap: 7px; color: var(--ink); font-size: .68rem; font-weight: 750; cursor: pointer; }
.active-anki-batch input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); }
.active-anki-batch > span { color: var(--muted); font-size: .65rem; }
.active-anki-batch .button { min-height: 38px; padding: 0 15px; }
.active-anki-list { display: grid; gap: 10px; }
.active-anki-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 14px 15px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.active-anki-select { display: grid; place-items: center; cursor: pointer; }
.active-anki-select input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.active-anki-select input:disabled { cursor: default; opacity: .4; }
.active-anki-item.completed { border-color: #8bd0ae; background: linear-gradient(135deg,#f0fff7,#e6f8ee); box-shadow: inset 4px 0 #2fa56f; }
.active-anki-copy { min-width: 0; }
.active-anki-copy small { display: block; margin-bottom: 4px; color: var(--primary); font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.active-anki-copy strong { display: block; overflow: hidden; color: var(--ink); font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.active-anki-counts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; color: var(--muted); font-size: .66rem; }
.active-anki-counts b { color: var(--ink); }
.active-anki-star { color: #e5a516; font-size: .8rem; }
.active-anki-complete-label { margin-top: 6px; color: #178454; font-size: .67rem; font-weight: 800; }
.active-anki-actions { display: flex; align-items: center; gap: 8px; }
.anki-frozen { position: relative; overflow: hidden; border-color: #8dcbd8 !important; background: radial-gradient(circle at 88% 18%, rgba(255,255,255,.95) 0 3px, transparent 4px), radial-gradient(circle at 76% 72%, rgba(255,255,255,.8) 0 2px, transparent 3px), linear-gradient(135deg, #f7fdff 0%, #e6f6fb 50%, #dff1f8 100%) !important; box-shadow: inset 4px 0 #62b7ca, 0 10px 24px rgba(75, 155, 178, .12); }
.anki-frozen::after { content: "❄"; position: absolute; right: 20px; top: -14px; color: rgba(70, 159, 181, .10); font-size: 5rem; line-height: 1; pointer-events: none; transform: rotate(12deg); }
.anki-frozen-label { width: fit-content; margin-top: 8px; padding: 4px 8px; border-radius: 999px; background: #dff4f5; color: #27717a; font-size: .57rem; font-weight: 800; letter-spacing: .02em; }
.active-anki-start { min-height: 38px; padding: 0 15px; white-space: nowrap; }
.active-anki-start:disabled { border-color: #8bd0ae; background: #dff5e9; color: #178454; opacity: 1; cursor: default; }
.active-anki-freeze { min-height: 38px; padding: 0 14px; border: 1px solid #9fd3de; border-radius: 11px; background: #effaff; color: #277a8d; font-weight: 800; white-space: nowrap; cursor: pointer; }
.active-anki-freeze:hover { border-color: #62b7ca; background: #e1f5fb; }
.active-anki-frozen-state { min-height: 38px; padding: 0 14px; border: 1px solid #8dcbd8; border-radius: 11px; background: rgba(255,255,255,.68); color: #28778a; font-weight: 850; opacity: 1 !important; }
:root[data-theme="dark"] .anki-frozen { border-color: #356f7b !important; background: linear-gradient(135deg, #182b32, #173841 58%, #142a33) !important; box-shadow: inset 4px 0 #4da3b6, 0 10px 24px rgba(0,0,0,.22); }
:root[data-theme="dark"] .active-anki-freeze { border-color: #376f7a; background: #19343c; color: #a5e2ef; }
:root[data-theme="dark"] .active-anki-frozen-state { border-color: #376f7a; background: rgba(16,42,50,.75); color: #a5e2ef; }
.active-anki-remove { min-height: 36px; padding: 0 9px; border: 0; background: transparent; color: var(--muted); font-size: .61rem; font-weight: 750; cursor: pointer; }
.active-anki-remove:hover { color: #ad5047; }
.active-anki-remove.confirming { padding: 0 11px; border: 1px solid #d76a60; border-radius: 9px; background: #fff1ef; color: #a53f36; }
:root[data-theme="dark"] .active-anki-remove.confirming { background: #3b1c1a; color: #ffaaa2; }
.active-anki-empty { padding: 22px 14px; border: 1px dashed var(--border); border-radius: 14px; color: var(--muted); font-size: .72rem; text-align: center; }
:root[data-theme="dark"] .active-anki-item.completed { border-color: #28694d; background: linear-gradient(135deg,#102d22,#0d241c); }
.freestyle-feynman-card { padding: 24px; }
.freestyle-feynman-intro { margin: 8px 0 16px; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.freestyle-feynman-setup { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: end; gap: 12px; }
.freestyle-feynman-setup[hidden] { display: none; }
.freestyle-prompt-field, .freestyle-time-fields label, .freestyle-response-field { display: grid; gap: 7px; color: var(--muted); font-size: .65rem; font-weight: 750; }
.freestyle-prompt-field input, .freestyle-time-fields input, .freestyle-time-fields select { height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--ink); font: inherit; }
.freestyle-time-fields { display: grid; grid-template-columns: 76px 112px; gap: 8px; }
.freestyle-feynman-setup > .button { min-height: 44px; }
.freestyle-feynman-session[hidden] { display: none; }
.freestyle-session-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; padding: 18px; border-left: 4px solid var(--primary); border-radius: 0 13px 13px 0; background: var(--primary-soft); }
.freestyle-session-heading small { color: var(--primary); font-size: .58rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.freestyle-session-heading h3 { margin-top: 6px; font-size: 1rem; line-height: 1.45; }
#freestyle-feynman-countdown { flex: 0 0 auto; min-width: 72px; padding: 8px 10px; border-radius: 999px; background: var(--surface); color: var(--primary); font-size: .72rem; font-weight: 850; font-variant-numeric: tabular-nums; text-align: center; }
.freestyle-response-field textarea { width: 100%; min-height: 220px; padding: 14px; resize: vertical; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: .78rem; line-height: 1.6; }
.freestyle-response-field textarea:focus, .freestyle-prompt-field input:focus, .freestyle-time-fields input:focus, .freestyle-time-fields select:focus { border-color: #aaaadf; outline: 3px solid rgba(91,91,214,.12); }
.freestyle-session-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; }
.freestyle-session-footer > span { color: var(--muted); font-size: .65rem; line-height: 1.45; }
.freestyle-session-footer > div { display: flex; gap: 8px; }
.alarm-intro { margin: 8px 0 15px; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.coming-soon-badge { padding: 7px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .62rem; font-weight: 800; }
.alarm-coming-soon { display: flex; align-items: center; gap: 14px; margin-top: 15px; padding: 20px; border: 1px dashed #cfcfea; border-radius: 14px; background: #fafaff; }
.alarm-coming-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 1rem; font-weight: 800; }
.alarm-coming-soon strong { display: block; color: var(--ink); font-size: .78rem; }
.alarm-coming-soon p { margin: 5px 0 0; color: var(--muted); font-size: .67rem; line-height: 1.5; }
:root[data-theme="dark"] .alarm-coming-soon { border-color: #3d3d59; background: #171721; }
.alarm-item { grid-template-columns: 38px minmax(0,1fr) 38px; }
.alarm-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; color: var(--primary); font-weight: 800; }
.remove-alarm { color: #b85248; font-size: 1rem; }
.alarm-empty { display: grid; gap: 5px; padding: 26px 12px; color: var(--muted); text-align: center; }
.alarm-empty strong { color: var(--ink); font-size: .78rem; }
.alarm-empty span { font-size: .66rem; }
.alarm-date-time { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.task-dialog textarea { width: 100%; min-height: 92px; padding: 11px 12px; resize: vertical; border: 1px solid var(--border); border-radius: 11px; background: white; color: var(--ink); font: inherit; font-size: .84rem; line-height: 1.45; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-label { margin-bottom: 5px; color: var(--muted-2); font-size: 0.68rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.task-progress-row { display: flex; align-items: center; gap: 14px; margin: 19px 0 7px; }
.task-progress-row p { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.mini-progress { width: 82px; height: 5px; overflow: hidden; border-radius: 999px; background: #eeeff5; }
.mini-progress span { display: block; height: 100%; border-radius: inherit; background: var(--success); transition: width 240ms ease; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-item { min-height: 66px; display: grid; grid-template-columns: 28px 8px minmax(0, 1fr) 38px; align-items: center; gap: 12px; border-bottom: 1px solid #eef0f5; transition: opacity 180ms ease, background 180ms ease; }
.task-item:last-child { border-bottom: 0; }
.task-check { cursor: pointer; }
.task-check input { position: absolute; opacity: 0; pointer-events: none; }
.task-check > span:not(.sr-only) { width: 24px; height: 24px; display: grid; place-items: center; border: 1.5px solid #d9dce6; border-radius: 8px; color: transparent; background: white; transition: 150ms ease; }
.task-check input:focus-visible + span { outline: 3px solid rgba(91, 91, 214, 0.25); outline-offset: 3px; }
.task-check input:checked + span { border-color: var(--primary); background: var(--primary); color: white; }
.task-check svg { width: 15px; height: 15px; stroke-width: 2.5; }
.subject-dot { width: 8px; height: 8px; border-radius: 50%; }
.subject-dot.psychology { background: #827be8; }
.subject-dot.biology { background: #32a77d; }
.subject-dot.calculus { background: #4ba3e2; }
.subject-dot.literature { background: #e99b5e; }
.task-copy { min-width: 0; display: grid; gap: 4px; }
.task-copy strong { overflow: hidden; font-size: 0.86rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.task-copy span { color: var(--muted-2); font-size: 0.72rem; }
.task-menu { width: 34px; height: 34px; flex-basis: 34px; border-color: transparent; color: var(--muted-2); }
.task-item.completed { opacity: .59; }
.task-item.completed .task-copy strong { text-decoration: line-through; text-decoration-color: #a4a9b8; }

.tip-card { display: flex; gap: 13px; padding: 18px; border: 1px solid #dfe0ff; border-radius: var(--radius-md); background: #eeeeff; }
.tip-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 11px; background: white; color: var(--primary); }
.tip-card strong { font-size: .78rem; }
.tip-card p { margin-top: 5px; color: #666b83; font-size: .69rem; line-height: 1.5; }

.mobile-nav { display: none; }
.task-dialog { width: min(92vw, 460px); padding: 0; border: 0; border-radius: 20px; background: white; box-shadow: 0 30px 80px rgba(28,31,60,.22); }
.task-dialog::backdrop { background: rgba(26,30,50,.42); backdrop-filter: blur(4px); }
.task-dialog form { display: grid; gap: 18px; padding: 25px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.task-dialog label { display: grid; gap: 7px; color: var(--muted); font-size: .76rem; font-weight: 650; }
.task-dialog input, .task-dialog select { width: 100%; height: 45px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; background: white; color: var(--ink); font-size: .84rem; }
.dialog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 5px; }
.publish-dialog { width: min(560px,calc(100vw - 28px)); }
.publish-dialog form { display: grid; gap: 16px; }
.publish-dialog-copy { margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.publish-description-field { display: grid; gap: 7px; color: var(--ink); font-size: .7rem; font-weight: 800; }
.publish-description-field > span { color: var(--muted); font-size: .6rem; font-weight: 650; }
.publish-description-field textarea { width: 100%; min-height: 118px; resize: vertical; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; line-height: 1.5; }
.publish-description-field textarea:focus { outline: 2px solid color-mix(in srgb,var(--primary) 35%,transparent); border-color: var(--primary); }
.publish-description-meta { display: flex; justify-content: space-between; gap: 16px; margin-top: -9px; color: var(--muted); font-size: .6rem; }
.publish-description-meta strong { flex: none; color: var(--ink); }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(360px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 12px; background: #222943; color: white; font-size: .82rem; box-shadow: 0 14px 36px rgba(25,28,54,.24); opacity: 0; transform: translateY(12px); pointer-events: none; transition: 180ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.studio-dialog { width: min(1180px, calc(100vw - 48px)); height: min(820px, calc(100vh - 48px)); max-width: none; max-height: none; padding: 0; overflow: hidden; border: 0; border-radius: 24px; background: #f7f8fc; color: var(--ink); box-shadow: 0 34px 100px rgba(20,24,48,.28); }
.studio-dialog::backdrop { background: rgba(20,24,42,.45); backdrop-filter: blur(5px); }
.studio-shell { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.studio-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.92); }
.studio-heading-row { display: flex; align-items: center; gap: 13px; }
.studio-mark { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; background: var(--primary); color: white; box-shadow: 0 8px 18px rgba(91,91,214,.22); }
.studio-mark svg { width: 22px; height: 22px; }
.studio-layout { min-height: 0; display: grid; grid-template-columns: minmax(360px, .85fr) minmax(420px, 1.15fr); }
.studio-source { min-height: 0; overflow-y: auto; padding: 24px; border-right: 1px solid var(--border); background: white; }
.studio-field-row, .source-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.studio-field-row { display: grid; gap: 7px; margin-bottom: 18px; }
.studio-label, .method-grid legend { color: #555c70; font-size: .74rem; font-weight: 730; }
.studio-source input, .studio-source textarea, .studio-source select { width: 100%; border: 1px solid var(--border); border-radius: 11px; background: #fbfbfd; color: var(--ink); font-size: .79rem; }
.studio-source input { height: 42px; padding: 0 12px; }
.studio-source textarea { height: 170px; margin-top: 8px; padding: 12px; resize: vertical; line-height: 1.55; }
.source-label-row span { color: var(--muted-2); font-size: .65rem; }
.source-hint { display: flex; align-items: flex-start; gap: 6px; margin: 8px 1px 20px; color: var(--muted-2); font-size: .64rem; line-height: 1.45; }
.source-hint svg { width: 14px; height: 14px; flex: 0 0 14px; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 0; padding: 0; border: 0; }
.method-grid legend { grid-column: 1 / -1; margin-bottom: 8px; }
.method-option { position: relative; min-height: 76px; display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--border); border-radius: 13px; background: white; cursor: pointer; transition: 150ms ease; }
.method-option:hover { border-color: #c9cae9; background: #fbfbff; }
.method-option.selected { border-color: #a8a8e7; background: #f5f5ff; box-shadow: 0 0 0 2px rgba(91,91,214,.07); }
.method-option input { position: absolute; opacity: 0; pointer-events: none; }
.method-option:focus-within { outline: 3px solid rgba(91,91,214,.2); outline-offset: 2px; }
.method-option > span:last-child { min-width: 0; display: grid; gap: 4px; }
.method-option strong { font-size: .72rem; }
.method-option small { color: var(--muted-2); font-size: .59rem; line-height: 1.35; }
.method-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; }
.method-icon svg { width: 18px; height: 18px; }
.method-icon.purple { background: #e9e8ff; color: var(--primary); }
.method-icon.blue { background: #e8f3ff; color: #4a8ff5; }
.method-icon.amber { background: #fff2dd; color: #e4952f; }
.method-icon.green { background: #e6f7f0; color: #24986f; }
.studio-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 18px; }
.studio-options label { display: grid; gap: 6px; color: var(--muted); font-size: .63rem; font-weight: 650; }
.studio-options select { height: 39px; padding: 0 9px; }
.studio-generate { width: 100%; min-height: 46px; margin-top: 16px; background: var(--primary); color: white; box-shadow: 0 9px 20px rgba(91,91,214,.2); }
.studio-generate:hover { background: var(--primary-dark); }
.studio-generate:disabled { opacity: .55; cursor: wait; }
.studio-generate svg { width: 17px; height: 17px; }
.studio-local-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; color: var(--muted-2); font-size: .59rem; }
.studio-local-note span { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.studio-result { min-width: 0; min-height: 0; overflow-y: auto; padding: 26px; background: #f6f7fb; }
.studio-empty, .studio-loading { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px; text-align: center; }
.studio-empty > span { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: white; color: var(--primary); box-shadow: var(--shadow); }
.studio-empty > span svg { width: 29px; height: 29px; }
.studio-empty h3, .studio-loading h3 { margin: 19px 0 8px; font-size: 1.02rem; }
.studio-empty p, .studio-loading p { max-width: 340px; color: var(--muted); font-size: .74rem; line-height: 1.6; }
.loading-orbit { position: relative; width: 76px; height: 76px; display: grid; place-items: center; border: 2px solid #dddff4; border-radius: 50%; color: var(--primary); }
.loading-orbit::before { content: ""; position: absolute; inset: -2px; border: 2px solid transparent; border-top-color: var(--primary); border-radius: 50%; animation: spin 1.1s linear infinite; }
.loading-orbit span { position: absolute; width: 8px; height: 8px; top: -5px; border-radius: 50%; background: var(--primary); }
.loading-orbit svg { width: 26px; height: 26px; }
@keyframes spin { to { transform: rotate(360deg); } }
.generated-set { min-height: 100%; }
.generated-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.generated-header h3 { margin: 0; font-size: 1.18rem; letter-spacing: -.02em; }
.generated-actions { display: flex; align-items: center; gap: 6px; }
.generated-actions .button { min-height: 36px; padding: 0 11px; font-size: .68rem; }
.generated-actions svg { width: 15px; height: 15px; }
.generated-list { display: grid; gap: 10px; }
.generated-card { overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: white; box-shadow: 0 4px 16px rgba(34,38,70,.035); }
.generated-card button.card-face { width: 100%; min-height: 106px; display: grid; gap: 8px; padding: 16px 18px; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.generated-card button.card-face:hover { background: #fbfbff; }
.generated-card .card-number { color: var(--primary); font-size: .6rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.generated-card .card-question { font-size: .82rem; font-weight: 680; line-height: 1.45; }
.generated-card .card-answer { display: none; padding-top: 10px; border-top: 1px solid #eceef4; color: #4f566a; font-size: .76rem; font-weight: 400; line-height: 1.55; }
.generated-card.revealed .card-answer { display: block; }
.generated-card .card-tag { justify-self: start; padding: 4px 7px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-dark); font-size: .55rem; font-weight: 700; }
.quiz-item { padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: white; }
.quiz-item + .quiz-item { margin-top: 11px; }
.quiz-question { margin-bottom: 12px; font-size: .8rem; font-weight: 680; line-height: 1.45; }
.quiz-options { display: grid; gap: 7px; }
.quiz-option { min-height: 39px; padding: 8px 11px; border: 1px solid #e4e6ee; border-radius: 9px; background: #fbfbfd; color: #4c5366; font-size: .7rem; text-align: left; cursor: pointer; }
.quiz-option:hover { border-color: #c9cae9; }
.quiz-option.correct { border-color: #80cdb0; background: #eaf8f2; color: #167957; }
.quiz-option.incorrect { border-color: #edaca5; background: #fff0ed; color: #b85248; }
.quiz-explanation { display: none; margin-top: 10px; padding: 10px; border-radius: 8px; background: #f5f6fa; color: var(--muted); font-size: .67rem; line-height: 1.5; }
.quiz-item.answered .quiz-explanation { display: block; }
.feynman-result { display: grid; gap: 13px; }
.feynman-section { padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: white; }
.feynman-section h4 { margin: 0 0 8px; color: var(--primary-dark); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.feynman-section p, .feynman-section li { color: #4f566a; font-size: .76rem; line-height: 1.65; }
.feynman-section ul { margin: 0; padding-left: 18px; }

.assistant-backdrop { position: fixed; z-index: 59; inset: 0; background: rgba(20, 24, 42, .3); opacity: 0; backdrop-filter: blur(3px); transition: opacity 180ms ease; }
.assistant-backdrop.visible { opacity: 1; }
.assistant-panel { position: fixed; z-index: 60; top: 14px; right: 14px; bottom: 14px; width: min(430px, calc(100vw - 28px)); display: grid; grid-template-rows: auto auto auto 1fr auto auto auto; overflow: hidden; border: 1px solid rgba(255,255,255,.7); border-radius: 24px; background: #fbfbfe; box-shadow: 0 28px 80px rgba(22, 26, 54, .24); transform: translateX(calc(100% + 30px)); visibility: hidden; transition: transform 220ms cubic-bezier(.2,.8,.2,1), visibility 220ms; }
.assistant-panel.open { transform: translateX(0); visibility: visible; }
.assistant-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 22px 15px; }
.assistant-title-row { display: flex; align-items: center; gap: 12px; }
.assistant-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(145deg, #5b5bd6, #7879e7); color: white; box-shadow: 0 8px 18px rgba(91,91,214,.24); }
.assistant-mark svg { width: 22px; height: 22px; }
.model-bar { display: grid; grid-template-columns: auto minmax(0,1fr) 36px; align-items: center; gap: 10px; margin: 0 22px; padding: 10px 11px 10px 13px; border: 1px solid var(--border); border-radius: 12px; background: white; }
.model-bar label { color: var(--muted); font-size: .7rem; font-weight: 700; }
.model-bar select { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .76rem; font-weight: 650; }
.model-refresh { width: 34px; height: 34px; flex-basis: 34px; border: 0; background: #f5f5fa; }
.model-refresh svg { width: 16px; height: 16px; }
.assistant-status { min-height: 37px; display: flex; align-items: center; gap: 7px; padding: 0 24px; color: var(--muted); font-size: .68rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b5b8c6; }
.assistant-status.online .status-dot { background: var(--success); box-shadow: 0 0 0 4px rgba(32,169,121,.1); }
.assistant-status.offline .status-dot { background: #e67a6d; box-shadow: 0 0 0 4px rgba(230,122,109,.1); }
.assistant-messages { display: flex; flex-direction: column; gap: 15px; overflow-y: auto; padding: 12px 22px 20px; scroll-behavior: smooth; }
.assistant-message { display: flex; align-items: flex-start; gap: 10px; max-width: 92%; }
.assistant-message > div { padding: 12px 14px; border-radius: 5px 16px 16px 16px; background: white; color: #41485d; box-shadow: 0 4px 18px rgba(31,35,70,.06); }
.assistant-message p { font-size: .79rem; line-height: 1.6; white-space: pre-wrap; }
.assistant-message.user-message { align-self: flex-end; flex-direction: row-reverse; }
.assistant-message.user-message > div { border-radius: 16px 5px 16px 16px; background: var(--primary); color: white; box-shadow: 0 6px 20px rgba(91,91,214,.17); }
.message-avatar { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: .57rem; font-weight: 800; }
.user-message .message-avatar { background: #2e3654; color: white; }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.prompt-chips button { min-height: 31px; padding: 0 10px; border: 1px solid #dfdff4; border-radius: 999px; background: #f7f7ff; color: var(--primary-dark); font-size: .64rem; font-weight: 650; cursor: pointer; }
.prompt-chips button:hover { background: #eeeeff; }
.assistant-message.loading-message p::after { content: ""; display: inline-block; width: 1em; animation: thinking 1s steps(4,end) infinite; }
@keyframes thinking { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%,100% { content: "..."; } }
.assistant-composer { display: grid; grid-template-columns: minmax(0,1fr) 42px; align-items: end; gap: 8px; margin: 0 22px; padding: 7px 7px 7px 13px; border: 1px solid #dfe1ea; border-radius: 15px; background: white; box-shadow: 0 8px 24px rgba(34,38,70,.07); }
.assistant-composer:focus-within { border-color: #b8b8ea; box-shadow: 0 0 0 3px rgba(91,91,214,.1); }
.assistant-composer textarea { max-height: 110px; resize: none; padding: 8px 0 6px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .8rem; line-height: 1.45; }
.assistant-composer textarea::placeholder { color: #a0a4b3; }
.assistant-send { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 11px; background: var(--primary); color: white; cursor: pointer; }
.assistant-send:hover { background: var(--primary-dark); }
.assistant-send:disabled { opacity: .45; cursor: wait; }
.assistant-send svg { width: 18px; height: 18px; }
.assistant-privacy { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 9px 0 14px; color: var(--muted-2); font-size: .6rem; }
.assistant-privacy svg { width: 12px; height: 12px; }

@media (max-width: 1120px) {
  :root { --sidebar-width: 86px; }
  .sidebar { padding-inline: 14px; align-items: center; }
  .brand { padding: 0; }
  .brand > span:last-child, .nav-item span, .profile-copy, .profile-menu { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item.active::before { left: -14px; }
  .profile-card { padding-inline: 0; }
  .main-content { padding-inline: 28px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.4fr) minmax(295px, .8fr); }
  .continue-card { grid-template-columns: 32% 68%; }
  .continue-content { padding-inline: 28px; }
}

@media (max-width: 900px) {
  .courses-page-header { display: grid; }
  .courses-page-header .button { width: fit-content; }
  .course-heading-actions { align-items: stretch; flex-direction: column; }
  .course-heading-actions .textbook-search, .catalog-search-wrap .textbook-search { width: min(520px,100%); }
  .topbar { align-items: flex-start; }
  .search-field { display: none; }
  .assistant-button { width: 43px; padding: 0; font-size: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { align-items: flex-start; padding: 16px; }
  .stat-icon { width: 40px; height: 40px; flex-basis: 40px; }
  .stat-card > div { display: block; }
  .stat-card p { margin-bottom: 5px; }
  .stat-card strong, .stat-card .trend { display: block; }
  .stat-card .trend { margin-top: 4px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .secondary-column { grid-template-columns: 1fr 1fr; align-items: start; }
  .tip-card { grid-column: 1 / -1; }
  .studio-dialog { width: calc(100vw - 24px); height: calc(100vh - 24px); }
  .studio-layout { grid-template-columns: 1fr; overflow-y: auto; }
  .studio-source { overflow: visible; border-right: 0; border-bottom: 1px solid var(--border); }
  .studio-result { min-height: 520px; overflow: visible; }
  .create-layout { grid-template-columns: 1fr; }
  .flashcards-deck-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .saved-decks { order: 0; }
}

@media (max-width: 680px) {
  .active-anki-batch { grid-template-columns: 1fr auto; }
  .active-anki-batch > span { grid-column: 1 / -1; grid-row: 2; }
  .active-anki-item { grid-template-columns: auto minmax(0,1fr); }
  .active-anki-actions { grid-column: 1 / -1; width: 100%; }
  .active-anki-start { flex: 1; }
  .freestyle-feynman-setup { grid-template-columns: 1fr; }
  .freestyle-time-fields { grid-template-columns: 1fr 1fr; }
  .freestyle-session-heading, .freestyle-session-footer { align-items: stretch; flex-direction: column; }
  .freestyle-session-footer > div { display: grid; grid-template-columns: 1fr; }
  body { padding-bottom: 78px; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 24px 16px 26px; }
  .topbar { margin-bottom: 24px; }
  .flashcards-page-header { display: grid; }
  .flashcards-page-header .button { width: 100%; }
  .flashcards-deck-grid { grid-template-columns: 1fr; }
  .topbar-actions { gap: 7px; }
  .notification-button { display: none; }
  .assistant-button { width: 43px; padding: 0; }
  .topbar .primary-button { width: 43px; padding: 0; font-size: 0; }
  .topbar .primary-button svg { margin: 0; }
  .intro { max-width: 220px; font-size: .82rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; overflow: hidden; }
  .stat-card { min-height: 86px; }
  .stat-card:nth-child(3) { grid-column: 1 / -1; }
  .stat-card:nth-child(3) > div { display: grid; grid-template-columns: auto auto; column-gap: 12px; }
  .stat-card:nth-child(3) p { grid-column: 1 / -1; }
  .continue-card { min-height: 330px; grid-template-columns: 1fr; }
  .continue-visual { position: absolute; inset: 0 0 auto auto; width: 42%; height: 44%; min-height: 0; opacity: .45; }
  .continue-visual > svg { width: 76px; height: 76px; }
  .continue-content { justify-content: flex-end; padding: 26px; }
  .continue-title-row { position: relative; }
  .course-badge { display: none; }
  .tasks-card { padding: 20px; }
  .task-item { grid-template-columns: 28px 8px minmax(0,1fr); gap: 9px; }
  .task-menu { display: none; }
  .secondary-column { grid-template-columns: 1fr; }
  .tip-card { grid-column: auto; }
  .mobile-nav { position: fixed; z-index: 30; inset: auto 0 0; height: 70px; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 8px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
  .mobile-nav a, .mobile-nav button { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--muted-2); font-size: .59rem; cursor: pointer; }
  .mobile-nav .active { color: var(--primary); }
  .mobile-nav svg { width: 21px; height: 21px; }
  .dialog-grid { grid-template-columns: 1fr; }
  .toast { right: 16px; bottom: 88px; }
  .assistant-panel { inset: 0; width: 100%; border: 0; border-radius: 0; }
  .assistant-backdrop { display: none; }
  .studio-dialog { width: 100vw; height: 100vh; border-radius: 0; }
  .studio-header { padding: 16px; }
  .studio-source, .studio-result { padding: 18px 16px; }
  .method-grid { grid-template-columns: 1fr; }
  .studio-options { grid-template-columns: 1fr 1fr; }
  .studio-options label:last-child { grid-column: 1 / -1; }
  .generated-header { flex-direction: column; }
  .create-builder { padding: 18px; }
  .manual-card-grid { grid-template-columns: 1fr; }
  .manual-question-grid { grid-template-columns: 1fr; }
  .manual-question-extra-grid, .question-draft-extra-grid { grid-template-columns: 1fr; }
  .manual-feynman-row { grid-template-columns: 1fr; }
  .manual-feynman-row .button { width: 100%; }
  .draft-card-row { grid-template-columns: 28px minmax(0,1fr) 32px; }
  .draft-card-row > label,.draft-card-row > .draft-question-prompt,.draft-card-row > .draft-question-answer { grid-column: 2; }
  .question-draft-row.has-draft-topic > .draft-question-prompt,
  .question-draft-row.has-draft-topic > .draft-question-answer { grid-column: 2; grid-row: auto; }
  .draft-card-row .remove-draft-card { grid-column: 3; grid-row: 1; }
  .question-draft-row .question-draft-extras { grid-column: 2 / 3; }
  .draft-save-row { align-items: stretch; flex-direction: column; }
  .custom-review-card { min-height: 290px; padding: 24px; }
  .custom-study-options { grid-template-columns: 1fr; }
  .custom-feynman-option, .custom-count-option { grid-template-columns: 1fr; }
  .feynman-mode-timer, .mode-count-picker { grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); border-left: 0; }
  .feynman-mode-timer > span { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .stats-grid { gap: 10px; }
  .stat-card { gap: 10px; padding: 13px; }
  .stat-icon { display: none; }
  .card-header .text-button { padding-inline: 5px; }
  .continue-content { padding: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Offline course library */
.library-section { max-width: 1460px; margin: 0 auto 18px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: white; box-shadow: 0 5px 26px rgba(30,35,70,.04); }
.library-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.library-intro { max-width: 650px; margin-top: 7px; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.course-shelf { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.catalog-divider { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 25px 0 13px; padding-top: 20px; border-top: 1px solid var(--border); }
.catalog-divider h3 { margin: 0; font-size: .92rem; }
.catalog-divider > span { color: var(--muted-2); font-size: .65rem; }
.course-tile { position: relative; min-width: 0; display: grid; grid-template-columns: 64px minmax(0,1fr) auto; align-items: center; gap: 12px; min-height: 102px; padding: 12px; border: 1px solid var(--border); border-radius: 15px; background: #fbfbfd; cursor: pointer; transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.course-tile:hover { transform: translateY(-2px); border-color: #cccdeb; box-shadow: 0 10px 24px rgba(35,39,76,.08); }
.course-cover { width: 64px; height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border-radius: 9px 13px 13px 9px; color: white; box-shadow: inset 4px 0 rgba(0,0,0,.08), 0 6px 14px rgba(39,43,74,.12); }
.course-cover span { font-size: 1.65rem; font-weight: 700; }
.course-cover small { font-size: .55rem; font-weight: 800; letter-spacing: .08em; }
.course-cover.violet, .course-mini.violet { background: linear-gradient(145deg,#6667dd,#4e4fbd); }
.course-cover.green, .course-mini.green { background: linear-gradient(145deg,#32a77d,#187b5b); }
.course-cover.blue, .course-mini.blue { background: linear-gradient(145deg,#4f9ce7,#3676bd); }
.course-cover.amber, .course-mini.amber { background: linear-gradient(145deg,#eda947,#cc7e24); }
.course-cover.coral, .course-mini.coral { background: linear-gradient(145deg,#e97867,#bd5144); }
.course-cover.teal, .course-mini.teal { background: linear-gradient(145deg,#36a7a8,#277879); }
.course-tile-copy { min-width: 0; }
.course-tile-copy > span { color: var(--primary); font-size: .57rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.course-tile-copy h3 { margin: 5px 0; overflow: hidden; font-size: .79rem; text-overflow: ellipsis; white-space: nowrap; }
.course-tile-copy p { color: var(--muted); font-size: .63rem; line-height: 1.45; }

/* Personal flashcards and custom creator */
.flashcards-page { max-width: 1260px; margin: 0 auto; }
.flashcards-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; padding: 8px 2px 0; }
.flashcards-page-header .intro { max-width: 670px; }
.flashcards-library { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow); }
.flashcards-page { display: grid; gap: 22px; }
.flashcards-page[hidden] { display: none; }
.built-in-flashcards-library { background: linear-gradient(145deg,#fff 0%,#f7f7ff 100%); }
.deck-source-copy { margin: 5px 0 0; color: var(--muted-2); font-size: .66rem; }
.built-in-deck-label { margin-bottom: 8px; color: var(--accent); font-size: .55rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.built-in-deck-item { border-color: #dcdcff; background: white; }
.personal-deck-item { position: relative; padding-right: 100px; }
.personal-deck-item h3,.personal-deck-item > p { padding-right: 62px; }
.added-built-in-deck { position: relative; padding-right: 48px; }
.study-item-star { position: absolute; z-index: 2; top: 6px; right: 6px; width: 31px; height: 31px; display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 9px; background: white; color: #9aa0b3; font-size: 1rem; line-height: 1; cursor: pointer; }
.personal-deck-item .study-item-star { right: 43px; }
.study-item-star[aria-pressed="true"] { border-color: #efcc72; background: #fff8de; color: #d99a00; }
.starred-study-item.custom-deck-item { border-color: #e9cc79; box-shadow: 0 8px 22px rgba(185,137,25,.1); }
.deck-wrench { position: absolute; top: 6px; right: 6px; width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--muted); cursor: pointer; }
.deck-wrench:hover { border-color: #c9c9ee; background: var(--primary-soft); color: var(--primary); }
.deck-wrench svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.flashcard-catalog-item { grid-column: auto; align-self: start; display: grid !important; grid-template-columns: 52px minmax(0,1fr); align-items: start; gap: 13px; min-height: 0 !important; }
.flashcard-catalog-icon { width: 52px; height: 64px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg,#705fe1,#4c48bf); color: white; font-size: 1.2rem; }
.flashcard-catalog-copy { min-width: 0; }
.flashcard-catalog-copy h3 { font-size: .82rem; }
.flashcard-catalog-copy p { display: -webkit-box; overflow: hidden; font-size: .61rem; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.flashcard-catalog-item > .course-add { grid-column: 1 / -1; align-self: end; width: 100%; margin-top: auto; }
.catalog-card-actions { grid-column: 1 / -1; align-self: start; display: grid; grid-template-columns: .72fr 1.28fr; gap: 8px; width: 100%; margin-top: 2px; }
.catalog-card-actions .button { width: 100%; }
.remove-built-in-deck { color: #ad5047 !important; }
.flashcards-deck-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.flashcards-deck-grid .custom-deck-item { min-height: 150px; display: flex; flex-direction: column; }
.flashcards-deck-grid .custom-deck-actions { margin-top: auto; padding-top: 16px; }
.draggable-study-set { position: relative; cursor: grab; transition: opacity .15s ease, transform .15s ease, box-shadow .15s ease; }
.draggable-study-set:active { cursor: grabbing; }
.dragging-study-set { opacity: .4; transform: scale(.98); }
.study-set-drop-zone { min-height: 96px; padding: 8px; border: 1px dashed transparent; border-radius: 15px; transition: border-color .15s ease, background .15s ease; }
.study-set-drop-zone.deck-drop-active { border-color: var(--primary); background: var(--primary-soft); }
.study-folder-list { display: grid; gap: 14px; margin-top: 18px; }
.study-folder { position: relative; margin-top: 13px; border: 1px solid color-mix(in srgb,var(--folder-color) 76%,#8b6c30); border-radius: 5px 15px 15px 15px; background: color-mix(in srgb,var(--folder-color) 28%,#fff); box-shadow: 0 7px 20px rgba(62,48,23,.08); }
.study-folder.deck-drop-active { outline: 3px solid color-mix(in srgb,var(--primary) 75%,#fff); outline-offset: 4px; box-shadow: 0 12px 28px rgba(83,75,195,.2); }
.study-folder::before { position: absolute; left: -1px; top: -15px; width: 118px; height: 20px; border: 1px solid color-mix(in srgb,var(--folder-color) 76%,#8b6c30); border-bottom: 0; border-radius: 10px 13px 0 0; background: var(--folder-color); content: ""; }
.study-folder-tab { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 82px; padding: 13px 15px; border-radius: 4px 14px 0 0; background: color-mix(in srgb,var(--folder-color) 73%,#fff); }
.study-folder-toggle { min-width: 0; flex: 1; display: flex; align-items: center; gap: 12px; padding: 5px; border: 0; background: transparent; color: #342b1b; text-align: left; cursor: pointer; }
.study-folder-toggle > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.study-folder-toggle .section-label { color: rgba(52,43,27,.66); }
.study-folder-toggle strong { overflow: hidden; font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.study-folder-toggle small { color: rgba(52,43,27,.7); font-size: .6rem; }
.folder-shape-icon { position: relative; width: 38px; height: 29px; flex: 0 0 38px; border-radius: 4px; background: var(--folder-color); box-shadow: inset 0 0 0 1px rgba(62,48,23,.16); }
.folder-shape-icon::before { position: absolute; left: 0; top: -6px; width: 18px; height: 8px; border-radius: 4px 5px 0 0; background: var(--folder-color); content: ""; }
.folder-chevron { margin-left: auto; font-size: 1.05rem; transition: transform .18s ease; }
.study-folder.expanded .folder-chevron { transform: rotate(180deg); }
.study-folder-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.study-folder-actions .button { min-height: 34px; padding: 0 11px; }
.study-folder-actions .folder-star { position: static; flex: 0 0 38px; width: 38px; height: 34px; }
.study-folder.starred-study-item { box-shadow: 0 8px 24px rgba(185,137,25,.18); }
.folder-color-control { position: relative; width: 38px; height: 34px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid rgba(62,48,23,.2); border-radius: 9px; background: rgba(255,255,255,.86); color: #342b1b; cursor: pointer; }
.folder-color-control input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.folder-color-control svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; pointer-events: none; }
.study-folder-contents { padding: 0 15px 15px; }
.study-folder-contents[hidden] { display: none; }
.study-folder-contents .custom-deck-list { margin-top: 3px; }
:root[data-theme="dark"] .study-folder { border-color: rgba(255,255,255,.28); background: #000; }
:root[data-theme="dark"] .study-folder-tab { background: color-mix(in srgb,var(--folder-color) 55%,#000); }
:root[data-theme="dark"] .study-folder-toggle { color: #fff; }
:root[data-theme="dark"] .study-folder-toggle .section-label,
:root[data-theme="dark"] .study-folder-toggle small { color: rgba(255,255,255,.72); }
.folder-editor-color { grid-template-columns: minmax(0,1fr) 64px !important; align-items: center; }
.folder-editor-color input { width: 64px; min-height: 42px; padding: 3px; cursor: pointer; }
@media (max-width: 760px) {
  .study-folder-tab { align-items: flex-start; flex-direction: column; }
  .study-folder-actions { justify-content: flex-start; }
}
.create-page { width: min(1720px, 100%); max-width: none; margin: 0 auto; }
.create-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; padding: 8px 2px 0; }
.create-page-header .intro { max-width: 720px; }
.export-page { max-width: 1120px; margin: 0 auto; }
.export-page-header { margin-bottom: 22px; padding: 8px 2px; }
.export-page-header .intro { max-width: 700px; }
.export-layout { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 16px; }
.export-card { display: grid; align-content: start; gap: 18px; padding: 24px; border: 1px solid var(--border); border-radius: 19px; background: var(--surface); box-shadow: var(--shadow); }
.export-card h2 { margin-top: 4px; }
.export-field { display: grid; gap: 8px; color: var(--muted); font-size: .66rem; font-weight: 750; }
.export-field select { width: 100%; min-height: 48px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--ink); }
.export-selection-summary, .export-status { padding: 13px 14px; border-radius: 11px; background: var(--primary-soft); color: var(--muted); font-size: .66rem; line-height: 1.5; }
.export-format-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.export-format-grid label { position: relative; cursor: pointer; }
.export-format-grid input { position: absolute; opacity: 0; pointer-events: none; }
.export-format-grid span { min-height: 74px; display: grid; align-content: center; gap: 4px; padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.export-format-grid strong { font-size: .72rem; }
.export-format-grid small { color: var(--muted); font-size: .59rem; line-height: 1.4; }
.export-format-grid input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.export-action { width: 100%; }
.note-export-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.note-export-heading { margin-bottom: 16px; }
.note-export-heading h2 { margin: 4px 0 6px; }
.note-export-heading p:last-child { max-width: 720px; color: var(--muted); font-size: .68rem; line-height: 1.55; }
.note-export-layout { grid-template-columns: minmax(300px,.72fr) minmax(0,1.28fr); }
.note-export-crop-fields { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.note-export-crop-fields label { display: grid; gap: 5px; color: var(--muted); font-size: .58rem; font-weight: 760; }
.note-export-crop-fields input { min-width: 0; height: 40px; padding: 0 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--ink); }
.note-export-crop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.note-export-crop-actions .button { min-height: 42px; padding: 0 10px; font-size: .62rem; }
.note-export-preview-card { min-width: 0; }
.note-export-preview-wrap { position: relative; overflow: hidden; min-height: 340px; border: 1px solid var(--border); border-radius: 14px; background: #e8e9ef; }
#export-note-preview { display: block; width: 100%; height: auto; aspect-ratio: 48 / 31; cursor: crosshair; touch-action: none; }
.note-export-preview-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: var(--muted); font-size: .68rem; text-align: center; }
.note-export-help { color: var(--muted); font-size: .61rem; line-height: 1.5; }
:root[data-theme="dark"] .note-export-preview-wrap { background: #151722; }
:root[data-theme="dark"] .export-card,
:root[data-theme="dark"] .export-field select,
:root[data-theme="dark"] .export-format-grid span { background: #000; color: #fff; }
@media (max-width: 760px) { .export-layout, .export-format-grid { grid-template-columns: 1fr; } .note-export-crop-fields { grid-template-columns: repeat(2,minmax(0,1fr)); } }
.create-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 17vw, 290px); align-items: start; gap: 18px; }
.create-builder, .saved-decks { border: 1px solid var(--border); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow); }
.create-builder { padding: 24px; }
.create-field { display: grid; gap: 8px; color: #50576b; font-size: .7rem; font-weight: 740; }
.create-field input, .create-field textarea, .rich-notes-input { width: 100%; border: 1px solid var(--border); border-radius: 12px; background: #fbfbfd; color: var(--ink); font-size: .8rem; line-height: 1.55; outline: none; }
.create-field input { height: 44px; padding: 0 13px; }
.create-field textarea { min-height: 116px; padding: 13px; resize: vertical; }
.create-field input:focus, .create-field textarea:focus, .rich-notes-input:focus { border-color: #b8b8ea; box-shadow: 0 0 0 3px rgba(91,91,214,.1); }
.definition-suggestions { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--soft-shadow); }
.definition-suggestions[hidden] { display: none; }
.definition-suggestion { display: grid; gap: 3px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.definition-suggestion:hover,.definition-suggestion:focus-visible { background: var(--accent-soft); outline: 2px solid rgba(91,91,214,.18); }
.definition-suggestion strong { font-size: .68rem; }
.definition-suggestion-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.definition-suggestion-heading small { flex: 0 0 auto; color: var(--primary); font-size: .5rem; font-weight: 780; }
.definition-suggestion span { overflow: hidden; color: var(--muted); font-size: .61rem; font-weight: 560; text-overflow: ellipsis; white-space: nowrap; }
.create-method-panel { margin-top: 18px; }
.create-builder > .create-field { margin-bottom: 20px; }
.anki-note-import { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 18px; margin-bottom: 20px; padding: 17px 18px; border: 1px solid #dcdcff; border-radius: 14px; background: #f7f7ff; }
.anki-note-import { transition: border-color 150ms ease, background 150ms ease, transform 150ms ease; }
.anki-note-import.drag-over { border-color: var(--primary); border-style: dashed; background: var(--primary-soft); transform: translateY(-2px); }
.anki-note-import h2 { margin: 3px 0 6px; font-size: .9rem; }
.anki-note-import p { margin: 0; color: var(--muted); font-size: .64rem; line-height: 1.55; }
.anki-note-import .anki-import-status { margin-top: 5px; color: var(--muted-2); font-size: .59rem; }
.anki-note-import .button { white-space: nowrap; }
.rich-notes-input { min-height: 230px; max-height: 520px; padding: 13px; overflow: auto; white-space: pre-wrap; }
.rich-notes-input:empty::before { content: attr(data-placeholder); color: #969bad; pointer-events: none; }
.rich-notes-input p, .rich-notes-input div { margin: 0 0 7px; }
.rich-notes-input ul, .rich-notes-input ol { margin: 6px 0 8px; padding-left: 25px; }
.rich-notes-input li { margin: 3px 0; }
.rich-notes-input mark, .rich-notes-input span[style*="background"] { padding: 0 .08em; border-radius: 2px; }
.rich-notes-hint { margin: 0; color: var(--muted-2); font-size: .58rem; font-weight: 560; }
.create-action { margin-top: 15px; }
.single-pass-note { margin-top: 9px; color: var(--muted-2); font-size: .61rem; line-height: 1.5; }
.create-content-tabs { position: sticky; z-index: 8; top: 12px; display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-top: 24px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: rgba(241,241,248,.96); box-shadow: 0 8px 22px rgba(38,42,78,.06); backdrop-filter: blur(10px); }
.create-content-tabs button { min-width: 0; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 780; cursor: pointer; }
.create-content-tabs button:hover { color: var(--primary); }
.create-content-tabs button.active { background: white; color: var(--primary); box-shadow: 0 4px 12px rgba(38,42,78,.07); }
.create-content-tabs button span { display: grid; place-items: center; min-width: 23px; height: 23px; padding: 0 6px; border-radius: 999px; background: #e9e9f4; color: var(--muted); font-size: .58rem; }
.create-content-tabs button.active span { background: var(--primary-soft); color: var(--primary); }
.create-tab-panel { animation: create-tab-in 150ms ease-out; }
.create-tab-panel[hidden] { display: none; }
@keyframes create-tab-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.inline-manual-card { margin-top: 26px; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: #f8f8fc; }
.inline-manual-card h2 { margin: 3px 0 15px; font-size: .92rem; }
.card-maker-mode { display: inline-flex; gap: 5px; margin-bottom: 15px; padding: 4px; border: 1px solid var(--border); border-radius: 11px; background: #eeeef6; }
.card-maker-mode button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: .62rem; font-weight: 780; cursor: pointer; }
.card-maker-mode button.active { background: white; color: var(--primary); box-shadow: 0 3px 10px rgba(35,38,74,.08); }
.manual-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.characteristic-card-maker[hidden] { display: none; }
.characteristic-maker-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 10px; }
.characteristic-maker-heading p { margin: 0; color: var(--muted); font-size: .65rem; line-height: 1.5; }
.characteristic-maker-heading span { flex: 0 0 auto; color: var(--primary); font-size: .59rem; font-weight: 800; }
.characteristic-column-headings,.characteristic-field-row { display: grid; grid-template-columns: minmax(120px,.75fr) minmax(180px,1.25fr) 54px 54px 34px; align-items: center; gap: 8px; }
.characteristic-column-headings { padding: 0 9px 5px; color: var(--muted-2); font-size: .52rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
#characteristic-field-list { display: grid; gap: 7px; }
.characteristic-field-row { padding: 8px; border: 1px solid var(--border); border-radius: 11px; background: white; }
.characteristic-field-row input[type="text"] { width: 100%; min-width: 0; min-height: 36px; padding: 7px 9px; border: 1px solid #e0e2ec; border-radius: 8px; color: var(--ink); font: inherit; font-size: .65rem; }
.characteristic-side-toggle { display: grid; place-items: center; min-height: 36px; cursor: pointer; }
.characteristic-side-toggle input { width: 17px; height: 17px; accent-color: var(--primary); }
.remove-characteristic-field { width: 30px; height: 30px; border: 0; border-radius: 8px; background: #fff0ee; color: #b64f46; font-size: .9rem; cursor: pointer; }
.characteristic-maker-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.extra-column-draft-list { display: block; min-width: 0; }
.extra-column-table-wrap { overflow: auto; max-width: 100%; border: 1px solid var(--border); border-radius: 14px; background: white; }
.extra-column-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: .62rem; }
.extra-column-table th { position: sticky; top: 0; z-index: 1; padding: 9px; background: #f7f7fc; color: var(--muted); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
.extra-column-table td { padding: 6px; border-bottom: 1px solid var(--border); }
.extra-column-table tbody tr:last-child td { border-bottom: 0; }
.extra-column-table input { width: 150px; min-height: 34px; padding: 6px 8px; border: 1px solid #e0e2ec; border-radius: 7px; color: var(--ink); font: inherit; background: white; }
.extra-column-table th:nth-child(2),.extra-column-table td:nth-child(2) { position: sticky; left: 0; z-index: 2; background: white; }
.extra-column-table th:nth-child(2) { z-index: 3; background: #f7f7fc; }
.generated-question-section { margin-top: 26px; }
.draft-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }
.draft-heading, .saved-decks-heading, .draft-save-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.draft-heading { align-items: flex-start; }
.draft-heading h2, .saved-decks-heading h2 { margin-top: 3px; }
.draft-empty { display: grid; place-items: center; gap: 5px; min-height: 130px; margin-top: 14px; border: 1px dashed #d8dae6; border-radius: 14px; color: var(--muted); text-align: center; }
.draft-empty strong { color: var(--ink); font-size: .8rem; }
.draft-empty span { font-size: .68rem; }
.draft-card-list { display: grid; gap: 10px; margin-top: 14px; }
.draft-heading .draft-heading-actions { flex-wrap: wrap; justify-content: flex-end; }
.draft-view-filters { display: grid; grid-template-columns: minmax(150px,1fr) minmax(170px,1fr) auto; align-items: end; gap: 8px; }
.draft-view-filters label { display: grid; gap: 4px; color: var(--muted); font-size: .55rem; font-weight: 800; letter-spacing: .03em; }
.draft-view-filters select { min-width: 0; height: 38px; padding: 0 32px 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: .62rem; }
.draft-view-filters > span { min-width: 72px; height: 38px; display: grid; place-items: center; padding: 0 10px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: .58rem; font-weight: 800; white-space: nowrap; }
.draft-filter-empty { min-height: 120px; display: grid; place-items: center; align-content: center; gap: 5px; padding: 20px; border: 1px dashed var(--border); border-radius: 14px; color: var(--muted); text-align: center; }
.draft-filter-empty strong { color: var(--ink); font-size: .75rem; }
.draft-filter-empty span { font-size: .62rem; }
.draft-card-row { display: grid; grid-template-columns: 30px minmax(0,1fr) minmax(0,1fr) 34px; align-items: start; gap: 9px; padding: 11px; border: 1px solid var(--border); border-radius: 13px; background: #fbfbfd; }
.draft-card-number { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: .62rem; font-weight: 800; }
.draft-card-row label { display: grid; gap: 5px; color: var(--muted-2); font-size: .55rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.draft-card-row.has-draft-topic .draft-card-number { grid-column: 1; grid-row: 1; }
.draft-card-row.has-draft-topic .draft-topic-field { grid-column: 2 / 4; grid-row: 1; }
.draft-card-row.has-draft-topic > label:nth-of-type(2) { grid-column: 2; grid-row: 2; }
.draft-card-row.has-draft-topic > label:nth-of-type(3) { grid-column: 3; grid-row: 2; }
.draft-card-row.has-draft-topic > .remove-draft-card { grid-column: 4; grid-row: 1; }
.question-draft-row.has-draft-topic .question-draft-extras { grid-column: 2 / 4; grid-row: 3; }
.draft-card-row textarea { width: 100%; min-height: 78px; padding: 9px 10px; resize: vertical; border: 1px solid #e1e3ec; border-radius: 9px; background: white; color: var(--ink); font-size: .7rem; line-height: 1.45; }
.card-image-editor { display: grid; gap: 7px; }
.card-image-editor > img { width: 100%; max-height: 170px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; background: white; }
.card-image-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.card-image-actions button { min-height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--primary); font: inherit; font-size: .58rem; font-weight: 750; text-transform: none; letter-spacing: 0; cursor: pointer; }
.card-image-actions button:last-child:not(:first-child) { color: #ad5047; }
.card-image-actions button.confirming-remove { border-color: #d66a60; background: #fff0ed; color: #a83f36; }
:root[data-theme="dark"] .card-image-actions button.confirming-remove { border-color: #ff9188; background: #260b09; color: #ffaaa3; }
.card-tool-dialog { width: min(920px,calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 0; border-radius: 20px; background: white; color: var(--ink); box-shadow: 0 30px 90px rgba(20,24,50,.3); }
.card-tool-dialog::backdrop { background: rgba(20,24,42,.5); backdrop-filter: blur(5px); }
.card-tool-shell { display: grid; gap: 16px; padding: 22px; }
.card-tool-shell h2 { margin-top: 3px; font-size: 1.12rem; }
.drawing-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.drawing-toolbar button, .math-symbol-grid button { min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--ink); font: inherit; font-size: .65rem; font-weight: 720; cursor: pointer; }
.drawing-toolbar button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.drawing-toolbar label { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); font-size: .62rem; font-weight: 700; }
.drawing-toolbar input[type="color"] { width: 27px; height: 27px; padding: 0; border: 0; background: transparent; }
.drawing-stage { overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: white; touch-action: none; }
#flashcard-drawing-canvas { display: block; width: 100%; height: auto; aspect-ratio: 5 / 3; cursor: crosshair; background: transparent; }
.math-expression-label { display: grid; gap: 7px; color: var(--muted); font-size: .67rem; font-weight: 740; }
#math-expression { width: 100%; min-height: 76px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: white; color: var(--ink); font: 1rem/1.55 "Times New Roman",serif; resize: vertical; }
.math-glossary { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; }
.math-glossary-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: #f7f7ff; }
.math-glossary-heading h3 { margin: 2px 0 0; font-size: .76rem; }
.math-glossary-heading input { width: min(280px,42vw); min-height: 36px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--ink); font-size: .64rem; }
.math-glossary-list { display: grid; max-height: 270px; overflow-y: auto; }
.math-glossary-group { padding: 8px 12px 4px; color: var(--primary); font-size: .55rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.math-glossary-entry { display: grid; grid-template-columns: minmax(145px,.7fr) minmax(0,1.3fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 10px 12px; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.math-glossary-entry:hover { background: var(--primary-soft); }
.math-glossary-entry strong { font: .9rem "Times New Roman",serif; }
.math-glossary-entry span { color: var(--muted); font-size: .59rem; line-height: 1.35; }
.math-glossary-entry small { color: var(--primary); font-size: .56rem; font-weight: 800; }
.math-glossary-empty { padding: 24px; color: var(--muted); font-size: .65rem; text-align: center; }
.math-preview { min-height: 112px; display: grid; align-content: center; gap: 7px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #f7f7ff; }
.math-preview span { color: var(--primary); font-size: .56rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.math-preview strong { overflow-wrap: anywhere; font: 1.1rem/1.9 "Times New Roman",serif; }
.math-fraction { display: inline-grid; grid-template-rows: auto auto; align-items: center; min-width: 1.4em; min-height: 1.9em; margin: .12em .16em; vertical-align: middle; text-align: center; line-height: 1.05; }
.math-fraction > span:first-child { padding: 0 .18em .08em; border-bottom: 1px solid currentColor; }
.math-fraction > span:last-child { padding: .08em .18em 0; }
.math-limit { display: inline-grid; grid-template-rows: auto auto; align-items: center; min-height: 1.8em; margin: .12em .16em; vertical-align: middle; text-align: center; line-height: .95; }
.math-limit > small { font-size: .55em; font-weight: 500; }
.math-bounded { display: inline-grid; grid-template-rows: auto auto auto; justify-items: center; align-items: center; min-width: 1.5em; min-height: 2.35em; margin: .18em .24em; vertical-align: middle; line-height: .78; }
.math-bounded > sup, .math-bounded > sub { padding: 0 .08em; font-size: .48em; line-height: 1; }
.math-bounded > sup { grid-row: 1; }
.math-bounded > span { grid-row: 2; font-size: 1.55em; line-height: .75; }
.math-bounded > sub { grid-row: 3; }
.math-help { color: var(--muted); font-size: .62rem; line-height: 1.5; }
.math-help code { padding: 2px 4px; border-radius: 4px; background: var(--primary-soft); color: var(--primary-dark); }
:root[data-theme="dark"] .card-tool-dialog, :root[data-theme="dark"] .card-tool-shell, :root[data-theme="dark"] .drawing-toolbar button, :root[data-theme="dark"] #math-expression, :root[data-theme="dark"] .math-glossary-heading, :root[data-theme="dark"] .math-glossary-heading input, :root[data-theme="dark"] .math-glossary-entry { background: #000; color: #fff; border-color: rgba(255,255,255,.24); }
:root[data-theme="dark"] .math-glossary { border-color: rgba(255,255,255,.24); }
:root[data-theme="dark"] .drawing-stage { border-color: rgba(255,255,255,.35); background: #fff; }
:root[data-theme="dark"] .math-preview { border-color: rgba(255,255,255,.24); background: #000; }
.code-options { display: grid; grid-template-columns: minmax(180px,1fr) auto; align-items: end; gap: 14px; }
.code-options > label, .code-editor-label { display: grid; gap: 7px; color: var(--muted); font-size: .67rem; font-weight: 740; }
.code-options select { min-height: 42px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--ink); }
.code-options .code-line-toggle { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; }
#code-expression { width: 100%; min-height: 190px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 10px; background: #10131c; color: #f3f5ff; font: .75rem/1.55 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace; tab-size: 2; resize: vertical; }
.code-preview { display: grid; gap: 8px; min-height: 100px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: #f7f7ff; }
.code-preview > span { color: var(--primary); font-size: .56rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.code-preview-empty { align-self: center; color: var(--muted); font-size: .65rem; }
.study-code-block { position: relative; display: block; width: min(100%,760px); margin: 12px auto; overflow-x: auto; border: 1px solid #2c3345; border-radius: 10px; background: #10131c; color: #f3f5ff; text-align: left; }
.study-code-language { display: block; padding: 6px 12px; border-bottom: 1px solid #2c3345; color: #9ea8c5; font: 600 .55rem/1.3 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace; letter-spacing: .06em; text-transform: uppercase; }
.study-code-block code { display: grid; padding: 9px 0; font: .68rem/1.55 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace; }
.study-code-line { display: grid; grid-template-columns: 1fr; min-height: 1.55em; padding: 0 13px; white-space: pre; }
.study-code-block.with-line-numbers .study-code-line { grid-template-columns: 2.7em minmax(max-content,1fr); padding-left: 0; }
.study-code-line i { padding-right: 10px; border-right: 1px solid #2c3345; color: #6f7892; font-style: normal; text-align: right; user-select: none; }
.study-code-line b { padding-left: 10px; color: inherit; font: inherit; }
.code-token-keyword { color: #c792ea; font-weight: 750; }
.code-token-string { color: #c3e88d; }
.code-token-number { color: #f78c6c; }
.code-token-comment { color: #77809a; font-style: italic; }
:root[data-theme="dark"] .code-options select, :root[data-theme="dark"] .code-options .code-line-toggle, :root[data-theme="dark"] .code-preview { border-color: rgba(255,255,255,.24); background: #000; color: #fff; }
@media (max-width: 720px) { .math-glossary-heading { align-items: stretch; flex-direction: column; } .math-glossary-heading input { width: 100%; } .math-glossary-entry { grid-template-columns: 1fr auto; } .math-glossary-entry span { grid-column: 1 / -1; } .drawing-toolbar label { flex: 1; } }
@media (max-width: 720px) { .code-options { grid-template-columns: 1fr; } }
.flashcard-paste-hint { margin: 9px 0 0; color: var(--muted); font-size: .62rem; line-height: 1.45; }
.remove-draft-card { width: 32px; height: 32px; border: 0; border-radius: 9px; background: #fff0ed; color: #ad5047; cursor: pointer; }
.draft-save-row { margin-top: 16px; }
.draft-save-row p { max-width: 440px; color: var(--muted); font-size: .64rem; line-height: 1.5; }
.saved-decks { padding: 20px; }
.saved-decks-heading > span { display: grid; place-items: center; min-width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: .7rem; font-weight: 800; }
.saved-decks-heading-actions { display: flex; align-items: center; gap: 10px; }
.saved-decks-heading-actions > span { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: .7rem; font-weight: 800; }
.built-in-library-heading-actions { display: flex; align-items: center; gap: 10px; }
.study-deck-search { width: min(280px, 30vw); }
.saved-decks-heading-actions { flex-wrap: wrap; justify-content: flex-end; }
.built-in-library-heading-actions { flex-wrap: wrap; justify-content: flex-end; }
.built-in-library-heading-actions > span { display: grid; place-items: center; min-width: 86px; height: 40px; padding: 0 14px; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-size: .72rem; font-weight: 800; }
.built-in-library-heading-actions .button { min-height: 40px; padding: 0 15px; }
.library-pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; }
.library-pagination:empty { display: none; }
.library-pagination button { min-width: 76px; min-height: 38px; padding: 0 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--ink); font-size: .64rem; font-weight: 750; cursor: pointer; }
.library-pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.library-pagination button:disabled { opacity: .38; cursor: default; }
.library-pagination span { min-width: 96px; color: var(--muted-2); font-size: .65rem; font-weight: 750; text-align: center; }
:root[data-theme="dark"] .library-pagination button { border-color: rgba(255,255,255,.22); background: #000; color: #fff; }
.danger-text-button { min-height: 34px; padding: 0 12px; border: 1px solid #efc7c1; background: #fff6f4; color: #ad5047; }
:root[data-theme="dark"] .danger-text-button { border-color: rgba(255,255,255,.22); background: #000; color: #ff9188; }
.custom-deck-list { display: grid; gap: 10px; margin-top: 17px; }
.custom-deck-empty { padding: 28px 12px; border: 1px dashed #d8dae6; border-radius: 13px; color: var(--muted); font-size: .68rem; line-height: 1.55; text-align: center; }
.custom-deck-item { padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: #fbfbfd; }
.custom-deck-item h3 { margin: 0; font-size: .78rem; line-height: 1.35; }
.custom-deck-item p { margin-top: 4px; color: var(--muted-2); font-size: .6rem; }
.custom-deck-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.custom-deck-actions button { min-height: 31px; padding: 0 9px; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--muted); font-size: .6rem; font-weight: 720; cursor: pointer; }
.custom-deck-actions button:first-child { border-color: transparent; background: var(--primary); color: white; }
.custom-deck-actions .delete-custom-deck { color: #ad5047; }
.custom-deck-actions .anki-freeze-toggle { color: #27717a; border-color: #b8dfe2; background: #effafb; }
.custom-deck-actions .anki-freeze-toggle.frozen { color: white; border-color: #31828a; background: #31828a; }
.custom-study-page { max-width: 1120px; min-height: calc(100vh - 72px); margin: 0 auto; }
.built-in-unit-picker { margin-bottom: 18px; padding: 18px; border: 1px solid #dcdcff; border-radius: 16px; background: #f7f7ff; }
.built-in-unit-picker[hidden] { display: none; }
.geography-field-picker { margin-bottom: 18px; padding: 20px; border: 1px solid #dcdcff; border-radius: 16px; background: #f7f7ff; }
.geography-field-picker[hidden] { display: none; }
.geography-field-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.geography-field-heading h3 { margin: 4px 0 0; font-size: .95rem; }
.geography-field-heading > p { margin: 0; padding: 8px 11px; border-radius: 999px; background: white; color: var(--primary); font-size: .62rem; font-weight: 800; }
.geography-presets { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.geography-presets button { min-height: 34px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--ink); font-size: .58rem; font-weight: 750; cursor: pointer; }
.geography-presets button:hover { border-color: var(--primary); color: var(--primary); }
.geography-side-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.geography-side-grid fieldset { min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: white; }
.geography-side-grid legend { padding: 0 6px; color: var(--ink); font-size: .63rem; font-weight: 850; }
.geography-side-grid fieldset > div { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.geography-field-choice { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 9px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); font-size: .58rem; font-weight: 750; cursor: pointer; }
.geography-field-choice:has(input:checked) { border-color: #acafff; background: #f0f0ff; color: var(--primary); }
.geography-field-choice input { accent-color: var(--primary); }
.geography-field-help { margin: 11px 0 0; color: var(--muted-2); font-size: .57rem; line-height: 1.45; }
@media (max-width: 760px) { .geography-side-grid { grid-template-columns: 1fr; } .geography-side-grid fieldset > div { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) { .characteristic-column-headings { display: none; } .characteristic-field-row { grid-template-columns: 1fr 1fr 38px 38px 32px; } .characteristic-field-row input[data-characteristic-value] { grid-column: 1 / -1; grid-row: 2; } .characteristic-maker-actions { align-items: stretch; flex-direction: column; } }
.unit-picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.unit-picker-heading h3 { margin-top: 3px; font-size: .88rem; }
.unit-picker-actions { display: flex; align-items: center; gap: 7px; }
.unit-picker-actions button { padding: 7px 10px; border: 0; border-radius: 8px; background: white; color: var(--primary); font-size: .62rem; font-weight: 750; cursor: pointer; }
.unit-picker-actions #toggle-calculus-ab.active { background: var(--primary); color: #fff; }
.built-in-unit-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.built-in-unit-grid.has-ap-subtopics { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
.built-in-unit-group { display: grid; gap: 7px; padding: 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.built-in-topic-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.built-in-topic-choice { position: relative; min-width: 0; cursor: pointer; }
.built-in-topic-choice input { position: absolute; opacity: 0; pointer-events: none; }
.built-in-topic-choice span { min-height: 49px; display: grid; align-content: center; gap: 2px; padding: 8px 9px; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--ink); }
.built-in-topic-choice input:checked + span { border-color: #8d86ea; background: var(--primary-soft); color: var(--primary-dark); box-shadow: inset 0 0 0 1px #8d86ea; }
.built-in-topic-choice strong { display: -webkit-box; overflow: hidden; font-size: .58rem; line-height: 1.3; text-overflow: ellipsis; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.built-in-topic-choice small { color: var(--muted); font-size: .51rem; }
.notebook-topic-help { margin: -5px 0 12px; color: var(--muted); font-size: .6rem; line-height: 1.45; }
.notebook-topic-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.notebook-topic-choice span { min-height: 58px; }
.built-in-unit-choice { position: relative; cursor: pointer; }
.built-in-unit-choice input { position: absolute; opacity: 0; pointer-events: none; }
.built-in-unit-choice span { min-height: 58px; display: grid; align-content: center; gap: 3px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: white; color: var(--ink); }
.built-in-unit-choice input:checked + span { border-color: #8d86ea; background: var(--primary-soft); color: var(--primary-dark); box-shadow: inset 0 0 0 1px #8d86ea; }
.built-in-unit-choice strong { font-size: .67rem; }
.built-in-unit-choice small { color: var(--muted); font-size: .57rem; }
@media (max-width: 900px) {
  .built-in-unit-grid, .built-in-unit-grid.has-ap-subtopics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .built-in-topic-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .flashcard-catalog-item { grid-template-columns: 54px minmax(0,1fr); }
  .flashcard-catalog-icon { width: 54px; height: 66px; }
  .flashcard-catalog-item > .course-add { grid-column: 1 / -1; width: fit-content; }
  .catalog-card-actions { width: 100%; }
}
@media (max-width: 560px) {
  .built-in-unit-grid, .built-in-unit-grid.has-ap-subtopics { grid-template-columns: 1fr; }
  .built-in-topic-grid { grid-template-columns: 1fr; }
}
.custom-study-page > div { animation: custom-page-in 160ms ease-out; }
.custom-study-page-header { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 22px; margin-bottom: 22px; padding: 20px 24px; border: 1px solid var(--border); border-radius: 18px; background: white; box-shadow: var(--shadow); }
.custom-study-page-header h2 { margin-top: 4px; font-size: 1.4rem; }
.custom-review-shell { max-width: 820px; margin: 0 auto; padding: 28px; border: 1px solid var(--border); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.custom-review-shell:has(#custom-matching-practice:not([hidden])) { width: 100%; max-width: none; }
@keyframes custom-page-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.custom-review-shell { padding: 22px; }
.custom-review-shell header, .custom-review-shell footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.custom-review-meta { position: relative; min-height: 34px; display: flex; align-items: center; justify-content: center; margin: 10px 0 9px; }
.custom-review-progress { margin: 0; color: var(--muted-2); font-size: .65rem; font-weight: 700; text-align: center; }
.custom-review-meta > button { position: absolute; right: 0; padding: 7px 10px; border: 0; border-radius: 8px; background: #fff0ed; color: #ad5047; font-size: .6rem; font-weight: 750; cursor: pointer; }
.custom-review-meta > button:hover { background: #ffe3df; }
.custom-anki-source { width: fit-content; margin: 0 auto 10px; padding: 6px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .64rem; font-weight: 800; }
.custom-anki-deck-progress { margin: 0 0 13px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--canvas); }
.custom-anki-deck-progress summary { color: var(--ink); font-size: .66rem; font-weight: 800; cursor: pointer; }
.custom-anki-deck-progress > div { display: grid; gap: 10px; margin-top: 10px; }
.custom-anki-deck-progress-row { display: grid; grid-template-columns: minmax(130px,1fr) minmax(120px,1.5fr); align-items: center; gap: 12px; }
.custom-anki-deck-progress-row > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.custom-anki-deck-progress-row strong { overflow: hidden; color: var(--ink); font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.custom-anki-deck-progress-row span { color: var(--muted); font-size: .6rem; white-space: nowrap; }
.custom-anki-deck-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--border); }
.custom-anki-deck-progress-track > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .2s ease; }
.custom-review-card { width: 100%; min-height: 330px; display: grid; align-content: center; gap: 15px; padding: 34px; border: 1px solid #d8d9e8; border-radius: 18px; background: linear-gradient(145deg,#fff,#f7f7fc); color: var(--ink); text-align: center; cursor: pointer; }
.custom-review-card > span { color: var(--primary); font-size: .61rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.custom-review-card strong { font-size: 1.08rem; line-height: 1.55; white-space: pre-wrap; }
.custom-review-image { display: block; max-width: 100%; max-height: 300px; margin: 0 auto; border-radius: 12px; object-fit: contain; }
.custom-review-image[hidden] { display: none; }
.custom-review-card em { color: var(--muted-2); font-size: .65rem; font-style: normal; }
.custom-review-card.revealed { background: linear-gradient(145deg,#f3f2ff,#fff); }
.custom-review-card.revealed em { visibility: hidden; }
.custom-reveal-button { display: block; min-width: 170px; margin: 13px auto 0; }
.custom-reveal-button[hidden] { display: none; }
.custom-review-shell footer { margin-top: 13px; }
.custom-flashcard-scroll,.custom-matching-practice { padding: 30px; border: 1px solid var(--border); border-radius: 18px; background: #fbfbfd; }
.custom-flashcard-scroll-list { display: grid; gap: 12px; margin-top: 22px; }
.custom-flashcard-scroll-card { width: 100%; min-height: 150px; display: grid; align-content: center; gap: 10px; padding: 22px; border: 1px solid var(--border); border-radius: 15px; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.custom-flashcard-scroll-card:hover { border-color: #b9bae7; }
.custom-flashcard-scroll-card.revealed { border-color: #aaaaf0; background: #f5f4ff; }
.custom-flashcard-scroll-card > span { color: var(--primary); font-size: .58rem; font-weight: 820; letter-spacing: .06em; text-transform: uppercase; }
.custom-flashcard-scroll-card > strong { font-size: .86rem; line-height: 1.55; white-space: pre-wrap; }
.custom-flashcard-scroll-card img { max-width: 100%; max-height: 230px; margin: 0 auto; object-fit: contain; }
.matching-score { padding: 8px 11px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .65rem; white-space: nowrap; }
.custom-matching-bank-panel { margin-top: 22px; padding: 18px; border: 1px solid var(--border); border-radius: 15px; background: #f3f3fa; }
.custom-matching-bank-panel h4 { margin: 7px 0 0; color: var(--ink); font-size: .84rem; }
.custom-matching-bank { min-height: 138px; display: grid; grid-template-columns: repeat(auto-fit,minmax(135px,1fr)); grid-auto-flow: dense; align-items: start; gap: 10px; margin-top: 15px; padding: 10px; border: 2px dashed #d6d6e7; border-radius: 13px; }
.custom-matching-bank:empty::after { content: "All answer tiles have been placed"; grid-column: 1/-1; align-self: center; color: var(--muted-2); font-size: .65rem; text-align: center; }
.custom-matching-tile { height: 124px; min-height: 124px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 13px; border: 1px solid #cfd0e5; border-radius: 12px; background: white; color: var(--ink); font: inherit; font-size: .62rem; font-weight: 690; line-height: 1.45; text-align: center; cursor: grab; box-shadow: 0 4px 12px rgba(44,45,85,.06); transition: border-color .15s ease,box-shadow .15s ease,transform .15s ease; }
.custom-matching-tile-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 6; }
.custom-matching-tile.expanded { height: auto; min-height: 124px; max-height: none; padding: 20px; }
.custom-matching-bank > .custom-matching-tile.expanded { grid-column: 1 / -1; }
.custom-matching-tile.expanded .custom-matching-tile-text { display: block; overflow: visible; -webkit-line-clamp: unset; }
.custom-matching-expand-hint { color: var(--primary); font-size: .5rem; font-weight: 800; letter-spacing: .02em; }
.custom-matching-tile:hover,.custom-matching-tile.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); transform: translateY(-1px); }
.custom-matching-tile.dragging { opacity: .48; cursor: grabbing; }
.custom-matching-tile:disabled { color: #167957; opacity: 1; cursor: default; box-shadow: none; }
.custom-matching-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 22px; }
.custom-matching-row { min-width: 0; display: grid; grid-template-rows: minmax(58px,auto) auto; align-content: start; gap: 12px; padding: 14px; border: 2px solid transparent; border-radius: 13px; background: white; transition: border-color .16s ease,background .16s ease; }
.custom-matching-practice.tile-selected .custom-matching-row:not(.correct) { cursor: pointer; }
.custom-matching-practice.tile-selected .custom-matching-row:not(.correct):hover { border-color: #aaaaf0; background: #f8f7ff; }
.custom-matching-front { min-width: 0; font-size: .72rem; font-weight: 750; line-height: 1.5; }
.custom-matching-drop { min-height: 112px; display: grid; place-items: center; padding: 7px; border: 2px dashed #d2d3e4; border-radius: 12px; background: #fafafe; color: var(--muted-2); font-size: .62rem; text-align: center; transition: border-color .15s ease,background .15s ease; }
.custom-matching-drop:hover,.custom-matching-drop:focus-visible { border-color: var(--primary); background: #f5f4ff; outline: none; }
.custom-matching-drop.filled { padding: 0; border-style: solid; }
.custom-matching-drop.filled > span { display: none; }
.custom-matching-drop .custom-matching-tile { width: 100%; height: 124px; min-height: 124px; }
.custom-matching-drop .custom-matching-tile.expanded { height: auto; min-height: 124px; }
.custom-matching-row.correct { border-color: #59b890; background: #eefaf5; }
.custom-matching-row.correct .custom-matching-drop,.custom-matching-row.correct .custom-matching-tile { border-color: #59b890; background: #f5fff9; }
.custom-matching-row.incorrect { border-color: #df756b; background: #fff4f2; }
.custom-matching-row.incorrect .custom-matching-drop,.custom-matching-row.incorrect .custom-matching-tile { border-color: #df756b; background: #fff9f8; }
.custom-matching-submit { display: block; min-width: 190px; margin: 22px auto 0; }
:root[data-theme="dark"] .flashcard-card-controls,
:root[data-theme="dark"] .flashcard-mode-carousel,
:root[data-theme="dark"] .question-card-controls,
:root[data-theme="dark"] .essay-start-options,
:root[data-theme="dark"] .custom-flashcard-scroll,
:root[data-theme="dark"] .custom-matching-practice,
:root[data-theme="dark"] .custom-flashcard-scroll-card,
:root[data-theme="dark"] .custom-matching-row,
:root[data-theme="dark"] .custom-matching-bank-panel,
:root[data-theme="dark"] .custom-matching-bank,
:root[data-theme="dark"] .custom-matching-tile,
:root[data-theme="dark"] .custom-matching-drop { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .essay-prompt-trigger,
:root[data-theme="dark"] .essay-prompt-panel,
:root[data-theme="dark"] .essay-prompt-filters button,
:root[data-theme="dark"] .essay-prompt-option-icon { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .essay-prompt-search-wrap { background: var(--surface-2); }
:root[data-theme="dark"] .essay-prompt-option:hover { background: var(--surface-2); }
:root[data-theme="dark"] .essay-prompt-option.selected,
:root[data-theme="dark"] .essay-prompt-filters button.active { background: var(--primary-soft); }
:root[data-theme="dark"] .custom-matching-row.correct { background: #08271c; }
:root[data-theme="dark"] .custom-matching-row.incorrect { background: #321310; }
@media (max-width: 900px) {
  .custom-matching-list { grid-template-columns: 1fr; }
  .custom-flashcard-scroll,.custom-matching-practice { padding: 22px 18px; }
}
.custom-question-practice { padding: 30px; border: 1px solid var(--border); border-radius: 18px; background: #fbfbfd; }
.custom-question-scroll-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.custom-question-scroll-heading h3 { margin: 10px 0 0; font-size: 1.15rem; }
.custom-question-scroll-copy { margin: 9px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.custom-question-scroll-list { display: grid; gap: 18px; margin-top: 24px; }
.custom-question-item { padding: 24px; border: 1px solid var(--border); border-radius: 16px; background: white; transition: border-color .18s ease, box-shadow .18s ease; }
.custom-question-item.answered-correct { border-color: #75caaa; box-shadow: inset 4px 0 0 #75caaa; }
.custom-question-item.answered-incorrect { border-color: #e8aaa3; box-shadow: inset 4px 0 0 #e8aaa3; }
.custom-question-item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.custom-question-number { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--ink); color: white; font-size: .66rem; font-weight: 800; }
.custom-question-type { display: inline-flex; padding: 7px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .58rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.custom-question-stimulus { margin: 18px 0 0; padding: 18px; border-left: 4px solid var(--primary); border-radius: 0 12px 12px 0; background: var(--primary-soft); color: var(--ink); font-size: .74rem; line-height: 1.65; white-space: pre-wrap; }
.custom-question-visual { max-width: 720px; margin: 20px auto 4px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: white; text-align: center; }
.custom-question-visual img { display: block; max-width: 100%; max-height: 360px; margin: 0 auto; object-fit: contain; }
.custom-question-visual figcaption { margin-top: 9px; color: var(--muted); font-size: .58rem; line-height: 1.4; }
.custom-question-visual figcaption a { color: var(--primary); }
.custom-question-item h3 { margin: 22px 0; font-size: 1.05rem; line-height: 1.55; }
.custom-question-choices { display: grid; gap: 9px; }
.custom-question-choices button { min-height: 50px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 11px; background: white; color: var(--ink); font-size: .74rem; text-align: left; cursor: pointer; }
.custom-question-choices button:hover:not(:disabled) { border-color: #b9bae7; background: #f6f6ff; }
.custom-question-choices button.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.custom-question-choices button span { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: #f0f1f7; color: var(--muted); font-size: .62rem; font-weight: 800; }
.custom-question-choices button.correct { border-color: #75caaa; background: #eaf8f2; color: #167957; }
.custom-question-choices button.incorrect { border-color: #e8aaa3; background: #fff0ed; color: #b85248; }
.custom-question-response { display: grid; gap: 8px; color: var(--muted); font-size: .65rem; font-weight: 750; }
.custom-question-response input { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 11px; background: white; color: var(--ink); font-size: .75rem; line-height: 1.55; }
.custom-question-response input:focus { border-color: #aaaadf; outline: 3px solid rgba(91,91,214,.12); }
.custom-question-feedback { min-height: 48px; margin-top: 15px; padding: 12px 14px; border-radius: 10px; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.custom-question-feedback.correct { background: #eaf8f2; color: #167957; }
.custom-question-feedback.incorrect { background: #fff0ed; color: #b85248; }
.custom-question-answer-content { display: block; margin-top: 7px; color: inherit; }
.custom-question-explanation { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid currentColor; color: inherit; opacity: .9; }
.custom-question-check { margin-top: 10px; }
.custom-question-finish-bottom { display: block; min-width: 180px; margin: 24px auto 0; }
.custom-essay-practice { padding: 30px; border: 1px solid var(--border); border-radius: 18px; background: #fbfbfd; }
.custom-essay-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.custom-essay-heading h3 { margin: 10px 0 0; font-size: 1.2rem; line-height: 1.35; }
.custom-essay-clock { min-width: 84px; padding: 10px 13px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: .78rem; font-weight: 850; font-variant-numeric: tabular-nums; text-align: center; }
.custom-essay-clock.expired { background: #fff0ed; color: #b85248; }
.custom-essay-prompt { margin: 22px 0; padding: 20px; border-left: 4px solid var(--primary); border-radius: 0 13px 13px 0; background: var(--primary-soft); color: var(--ink); font-size: .82rem; line-height: 1.7; }
.custom-essay-sources { display: grid; gap: 14px; margin: 22px 0; }
.custom-essay-source { overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: white; }
.custom-essay-source header { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: #f8f8fc; }
.custom-essay-source header > span { padding: 6px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .55rem; font-weight: 850; text-transform: uppercase; }
.custom-essay-source header > div { min-width: 0; display: grid; gap: 3px; }
.custom-essay-source header strong { font-size: .72rem; line-height: 1.35; }
.custom-essay-source header small { color: var(--muted); font-size: .58rem; }
.custom-essay-source header a { color: var(--primary); font-size: .6rem; font-weight: 800; text-decoration: none; }
.custom-essay-source > p { margin: 0; padding: 18px; color: var(--ink); font-family: Georgia, serif; font-size: .76rem; line-height: 1.75; white-space: pre-wrap; }
.custom-essay-source > footer { padding: 0 18px 14px; color: var(--muted-2); font-size: .54rem; }
.essay-source-visual { margin: 0; padding: 16px 18px 0; }
.essay-source-visual img { display: block; width: 100%; max-height: 440px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; background: #f4f5f8; }
.essay-source-visual figcaption { margin-top: 8px; color: var(--muted); font-size: .58rem; line-height: 1.45; }
.essay-source-table { overflow-x: auto; }
.essay-source-table table { width: 100%; min-width: 430px; border-collapse: collapse; background: white; font-size: .66rem; }
.essay-source-table th, .essay-source-table td { padding: 9px 10px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.essay-source-table th { background: #f4f4fa; color: var(--ink); font-weight: 800; }
.custom-essay-response { display: grid; gap: 8px; margin-top: 22px; color: var(--muted); font-size: .65rem; font-weight: 750; }
.custom-essay-response textarea { width: 100%; min-height: 360px; padding: 18px; border: 1px solid var(--border); border-radius: 13px; background: white; color: var(--ink); font-family: Georgia, serif; font-size: .8rem; line-height: 1.75; resize: vertical; }
.custom-essay-response textarea:focus { border-color: #aaaadf; outline: 3px solid rgba(91,91,214,.12); }
.custom-essay-checklist { margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; background: white; }
.custom-essay-checklist summary { padding: 13px 15px; color: var(--primary); font-size: .65rem; font-weight: 800; cursor: pointer; }
.custom-essay-checklist p { margin: 0; padding: 0 15px 15px; color: var(--muted); font-size: .68rem; line-height: 1.6; }
.custom-feynman-practice { min-height: 430px; padding: 30px; border: 1px solid var(--border); border-radius: 18px; background: #fbfbfd; }
.custom-feynman-practice h3 { margin: 18px 0 22px; font-size: 1.15rem; line-height: 1.5; }
.custom-feynman-session-timer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-bottom: 18px; }
#custom-feynman-countdown { min-width: 68px; align-self: center; padding: 8px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: .7rem; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; }
.custom-feynman-response { display: grid; gap: 8px; color: var(--muted); font-size: .65rem; font-weight: 750; }
.custom-feynman-response textarea { width: 100%; min-height: 220px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: white; color: var(--ink); font-family: inherit; font-size: .76rem; line-height: 1.6; resize: vertical; }
.custom-feynman-response textarea:focus { border-color: #aaaadf; outline: 3px solid rgba(91,91,214,.12); }
.custom-feynman-status { min-height: 20px; margin-top: 9px; color: var(--muted); font-size: .64rem; line-height: 1.45; }
.question-builder-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.question-builder-heading h2 { margin-top: 3px; }
.question-builder-heading > span, .draft-heading-actions > span { padding: 7px 9px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: .63rem; }
.draft-heading-actions { display: flex; align-items: center; gap: 9px; }
.question-builder-copy { margin: 8px 0 18px; color: var(--muted); font-size: .68rem; line-height: 1.55; }
.manual-question-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr) 150px; align-items: start; gap: 10px; }
.manual-question-copy,.draft-question-prompt { min-width: 0; display: grid; align-content: start; gap: 10px; }
.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field-label-row small { color: var(--muted); font-size: .52rem; font-weight: 650; letter-spacing: 0; text-transform: none; }
.manual-question-copy #manual-question-stimulus { min-height: 68px; }
.draft-question-stimulus { min-height: 58px !important; }
.manual-question-grid textarea { min-height: 88px; }
.manual-question-grid select { height: 44px; padding: 0 10px; border: 1px solid var(--border); border-radius: 11px; background: #fbfbfd; color: var(--ink); font-size: .72rem; }
.question-choice-editor { display: grid; align-content: start; gap: 9px; min-width: 0; padding: 11px; border: 1px solid var(--border); border-radius: 11px; background: #fbfbfd; }
.question-choice-editor[hidden] { display: none; }
.question-choice-editor header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.question-choice-editor header span { color: var(--muted-2); font-size: .55rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.question-choice-editor header small { color: var(--muted); font-size: .56rem; font-weight: 650; }
.question-choice-list { display: grid; gap: 7px; }
.question-choice-row { display: grid; grid-template-columns: 20px 24px minmax(0,1fr) 29px; align-items: center; gap: 7px; }
.question-choice-row > input[type="radio"],.question-choice-row > input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.question-choice-row > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--primary-soft); color: var(--primary); font-size: .58rem; font-weight: 850; }
.question-choice-row > input[type="text"] { width: 100%; min-width: 0; height: 36px; padding: 0 9px; border: 1px solid #dfe1eb; border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .67rem; }
.question-choice-row > input[type="text"]:focus { border-color: var(--primary); outline: 2px solid rgba(102,94,232,.12); }
.question-choice-row > button,.question-choice-add { min-height: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font-weight: 750; cursor: pointer; }
.question-choice-row > button { width: 29px; padding: 0; font-size: .85rem; }
.question-choice-row > button:disabled { opacity: .35; cursor: not-allowed; }
.question-choice-add { justify-self: start; padding: 0 10px; color: var(--primary); font-size: .59rem; }
.draft-question-answer.question-choice-editor { min-height: 0; }
.choice-question-extras .question-draft-extra-grid { grid-template-columns: minmax(0,1fr); }
.manual-question-extras, .question-draft-extras { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; background: #f8f8fc; }
.manual-question-extras summary, .question-draft-extras summary { padding: 11px 13px; color: var(--primary); font-size: .64rem; font-weight: 800; cursor: pointer; }
.manual-question-extra-grid, .question-draft-extra-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 13px 13px; }
.manual-question-extra-grid textarea { min-height: 86px; }
.manual-essay-builder { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0,1fr) 150px; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.manual-essay-builder[hidden] { display: none; }
.manual-essay-builder select,.manual-essay-builder input { width: 100%; min-height: 44px; padding: 0 10px; border: 1px solid var(--border); border-radius: 11px; background: white; color: var(--ink); }
.manual-essay-builder .create-field > span { color: var(--muted); font-size: .58rem; letter-spacing: 0; text-transform: none; }
.question-draft-essay-sources { grid-column: 1 / -1; }
.question-draft-essay-sources textarea { min-height: 150px; }
.manual-essay-sources-field { grid-column: 1 / -1; }
.manual-essay-sources-field small { color: var(--muted); font-size: .57rem; font-weight: 500; letter-spacing: 0; line-height: 1.45; text-transform: none; }
.question-draft-row .question-draft-extras { grid-column: 2 / 4; width: 100%; margin: 0; }
.question-draft-row.has-draft-topic > .draft-question-prompt { grid-column: 2; grid-row: 2; }
.question-draft-row.has-draft-topic > .draft-question-answer { grid-column: 3; grid-row: 2; }
.question-draft-extra-grid label { text-transform: none; letter-spacing: 0; }
.question-draft-extra-grid input { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--ink); font-size: .68rem; }
.question-draft-list { margin-top: 20px; }
.question-type-select { height: 31px; padding: 0 7px; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--muted); font-size: .6rem; }
.feynman-draft-section { margin-top: 26px; }
.manual-feynman-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 10px; margin-bottom: 18px; padding: 16px; border: 1px solid var(--border); border-radius: 13px; background: #f8f8fc; }
.manual-feynman-row .button { min-height: 44px; }
.feynman-draft-list { display: grid; gap: 8px; }
.feynman-draft-row { display: grid; grid-template-columns: 28px minmax(0,1fr) 34px; align-items: center; gap: 9px; }
.feynman-draft-row input { width: 100%; height: 40px; padding: 0 11px; border: 1px solid var(--border); border-radius: 10px; background: #fbfbfd; color: var(--ink); font-size: .7rem; }
:root[data-theme="dark"] .custom-question-visual,
:root[data-theme="dark"] .custom-question-item,
:root[data-theme="dark"] .custom-question-response input,
:root[data-theme="dark"] .custom-essay-practice,
:root[data-theme="dark"] .custom-essay-source,
:root[data-theme="dark"] .custom-essay-response textarea,
:root[data-theme="dark"] .custom-essay-checklist,
:root[data-theme="dark"] .manual-question-extras,
:root[data-theme="dark"] .question-draft-extras,
:root[data-theme="dark"] .question-choice-editor,
:root[data-theme="dark"] .question-choice-row > input[type="text"],
:root[data-theme="dark"] .question-draft-extra-grid input { background: var(--surface); color: var(--ink); }

@media (max-width: 900px) {
  .manual-question-extra-grid,
  .question-draft-extra-grid,
  .manual-essay-builder { grid-template-columns: minmax(0,1fr); }
  .manual-question-grid select { width: 100%; }
  .question-draft-row .question-draft-extras { grid-column: 2 / 3; }
  .custom-question-practice { padding: 22px 18px; }
  .custom-question-scroll-heading { align-items: stretch; flex-direction: column; }
  .custom-question-scroll-heading .button { width: 100%; }
  .custom-question-item { padding: 20px 16px; }
  .custom-essay-practice { padding: 22px 16px; }
  .custom-essay-heading { align-items: flex-start; }
  .custom-essay-source header { grid-template-columns: auto minmax(0,1fr); }
  .custom-essay-source header a { grid-column: 2; }
  .custom-essay-response textarea { min-height: 300px; }
}
.custom-study-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.custom-topic-builder { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.custom-topic-builder-heading,.custom-unit-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.custom-topic-builder-heading h2 { margin: 2px 0 4px; font-size: 1.05rem; }
.custom-topic-builder-heading p:last-child,.custom-topic-empty,.custom-subtopic-list > p { margin: 0; color: var(--muted); font-size: .68rem; }
.custom-topic-empty { display: grid; gap: 4px; line-height: 1.5; }
.custom-topic-empty strong { color: var(--muted); font-size: .7rem; }
.custom-unit-list { display: grid; gap: 10px; }
.custom-unit-editor { padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--canvas); }
.custom-unit-editor-heading input { min-width: 0; flex: 1; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; font-weight: 800; }
.custom-unit-editor-heading button { padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; }
.custom-subtopic-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.custom-subtopic-list label { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 7px; padding: 8px; border-radius: 10px; background: var(--surface); color: var(--muted); font-size: .6rem; font-weight: 800; }
.custom-subtopic-list input,.custom-active-topic select,.draft-topic-field select { min-width: 0; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); }
.custom-active-topic { max-width: 520px; }
.draft-topic-field { align-self: start; width: 100%; color: var(--muted); font-size: .58rem; font-weight: 800; }
.draft-topic-field select { display: block; width: 100%; margin-top: 5px; }
.custom-unit-structure-name { color: var(--ink); font-size: .75rem; }
.custom-unit-structure-count { color: var(--muted); font-size: .6rem; font-weight: 750; }
.custom-subtopic-structure { display: grid; gap: 3px; min-width: 0; padding: 9px 10px; border-radius: 10px; background: var(--surface); }
.custom-subtopic-structure span { color: var(--muted); font-size: .52rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.custom-subtopic-structure strong { overflow: hidden; color: var(--ink); font-size: .63rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.feynman-draft-row.has-draft-topic { align-items: start; }
.feynman-draft-row.has-draft-topic .draft-card-number { grid-column: 1; grid-row: 1; }
.feynman-draft-row.has-draft-topic .draft-topic-field { grid-column: 2; grid-row: 1; }
.feynman-draft-row.has-draft-topic > input { grid-column: 2; grid-row: 2; }
.feynman-draft-row.has-draft-topic > .remove-draft-card { grid-column: 3; grid-row: 1; }
@media (max-width: 680px) {
  .draft-card-row.has-draft-topic .draft-topic-field { grid-column: 2; }
  .draft-card-row.has-draft-topic > label:nth-of-type(2),
  .draft-card-row.has-draft-topic > label:nth-of-type(3) { grid-column: 2; grid-row: auto; }
  .question-draft-row.has-draft-topic .question-draft-extras { grid-column: 2; grid-row: auto; }
}
.custom-study-options > button, .custom-study-option-card { min-height: 180px; border: 1px solid var(--border); border-radius: 18px; background: white; color: var(--ink); box-shadow: var(--shadow); }
.custom-study-options > button { display: grid; align-content: center; gap: 9px; padding: 28px; text-align: left; cursor: pointer; }
.custom-study-options > button:hover { border-color: #bfc0e8; background: #f5f5ff; }
.custom-study-options > button:disabled { opacity: .48; cursor: not-allowed; }
.custom-study-options > button > span, .custom-study-option-main > span { color: var(--primary); font-size: .58rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.custom-study-options > button > strong, .custom-study-option-main > strong { font-size: 1rem; }
.custom-study-options > button > small, .custom-study-option-main > small { color: var(--muted); font-size: .7rem; line-height: 1.55; }
.custom-feynman-option, .custom-count-option { display: grid; grid-template-columns: minmax(0,1fr) 165px; overflow: hidden; }
.flashcard-study-option { grid-template-columns: minmax(0,1fr) 210px; }
.question-study-option { position: relative; grid-template-columns: minmax(0,1fr) 230px; overflow: visible; }
.question-study-option:has(.essay-prompt-panel:not([hidden])) { z-index: 20; }
.flashcard-card-controls { display: grid; align-content: center; border-left: 1px solid var(--border); background: #f8f8fd; }
.question-card-controls { display: grid; align-content: center; border-left: 1px solid var(--border); background: #f8f8fd; }
.question-card-controls .mode-count-picker { border-left: 0; padding-bottom: 12px; }
.question-mode-carousel { padding-top: 16px; }
.essay-start-options { display: grid; gap: 10px; padding: 0 20px 18px; background: #f8f8fd; }
.essay-prompt-picker { position: relative; min-width: 0; }
.essay-prompt-picker-label { display: block; margin-bottom: 5px; color: var(--primary); font-size: .55rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.essay-prompt-trigger { width: 100%; min-width: 0; min-height: 48px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.essay-prompt-trigger:hover,.essay-prompt-trigger[aria-expanded="true"] { border-color: #aaaaf0; box-shadow: 0 0 0 3px var(--primary-soft); }
.essay-prompt-trigger > span { min-width: 0; display: grid; gap: 2px; }
.essay-prompt-trigger small { overflow: hidden; color: var(--primary); font-size: .49rem; font-weight: 800; letter-spacing: .04em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.essay-prompt-trigger strong { overflow: hidden; font-size: .61rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.essay-prompt-trigger > i { color: var(--primary); font-size: .8rem; font-style: normal; transition: transform .15s ease; }
.essay-prompt-trigger[aria-expanded="true"] > i { transform: rotate(180deg); }
.essay-prompt-panel { position: absolute; z-index: 80; top: calc(100% + 8px); right: 0; width: min(510px, calc(100vw - 44px)); display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 15px; background: white; box-shadow: 0 22px 55px rgba(31,33,64,.2); }
.essay-prompt-panel[hidden] { display: none; }
.essay-prompt-search-wrap { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: #fafafe; color: var(--muted-2); }
.essay-prompt-search-wrap input { min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: .68rem; }
.essay-prompt-filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.essay-prompt-filters::-webkit-scrollbar { display: none; }
.essay-prompt-filters button { flex: 0 0 auto; min-height: 30px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: white; color: var(--muted); font-size: .55rem; font-weight: 750; cursor: pointer; }
.essay-prompt-filters button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.essay-prompt-list { max-height: min(380px, 52vh); overflow-y: auto; padding-right: 3px; }
.essay-prompt-group + .essay-prompt-group { margin-top: 12px; }
.essay-prompt-group h4 { margin: 5px 4px 7px; color: var(--muted-2); font-size: .52rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.essay-prompt-option { width: 100%; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px 11px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.essay-prompt-option:hover { background: #f6f6fd; }
.essay-prompt-option.selected { border-color: #c9c9f0; background: var(--primary-soft); }
.essay-prompt-option > span:not(.essay-prompt-option-icon) { min-width: 0; display: grid; gap: 3px; }
.essay-prompt-option strong { font-size: .65rem; line-height: 1.35; }
.essay-prompt-option small { color: var(--muted); font-size: .53rem; }
.essay-prompt-option > i { color: var(--primary); font-size: .9rem; font-style: normal; }
.essay-prompt-option.random { grid-template-columns: 28px minmax(0,1fr); margin-bottom: 8px; }
.essay-prompt-option-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: white; color: var(--primary); font-size: .8rem; }
.essay-prompt-empty { margin: 0; padding: 24px 12px; color: var(--muted); font-size: .65rem; text-align: center; }
.essay-start-options input[type="number"] { min-width: 0; height: 38px; padding: 0 8px; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--ink); font-size: .62rem; }
.essay-timer-row { display: grid; grid-template-columns: 1fr 76px; align-items: center; gap: 8px; }
.essay-timer-toggle,.essay-time-input { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .58rem; font-weight: 750; }
.essay-timer-toggle input { accent-color: var(--primary); }
.flashcard-card-controls .mode-count-picker { border-left: 0; padding-bottom: 12px; }
.flashcard-mode-carousel { display: grid; gap: 8px; padding: 0 20px 18px; background: #f8f8fd; }
.flashcard-mode-carousel > span { color: var(--primary); font-size: .58rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.flashcard-mode-carousel-controls { display: grid; grid-template-columns: 30px minmax(0,1fr) 30px; align-items: stretch; gap: 6px; }
.flashcard-mode-carousel-controls > button { border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--primary); font-size: 1.1rem; font-weight: 800; cursor: pointer; }
.flashcard-mode-carousel-controls > button:hover { border-color: #bfc0e8; background: #f2f2ff; }
#selected-custom-flashcard-mode,#selected-custom-question-mode { min-width: 0; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 44px; padding: 5px; border: 1px solid var(--border); border-radius: 9px; background: white; text-align: center; }
#selected-custom-flashcard-mode strong,#selected-custom-question-mode strong { color: var(--ink); font-size: .66rem; }
#selected-custom-flashcard-mode small,#selected-custom-question-mode small { color: var(--muted-2); font-size: .5rem; }
.flashcard-mode-dots { display: flex; justify-content: center; gap: 5px; }
.flashcard-mode-dots i { width: 5px; height: 5px; border-radius: 50%; background: #d3d4e2; }
.flashcard-mode-dots i.active { width: 14px; border-radius: 4px; background: var(--primary); }
.custom-study-option-main { min-width: 0; display: grid; align-content: center; gap: 9px; padding: 28px; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.custom-study-option-main:hover { background: #f5f5ff; }
.custom-study-option-main:disabled { opacity: .48; cursor: not-allowed; }
.mode-count-picker { display: grid; align-content: center; gap: 7px; padding: 20px; border-left: 1px solid var(--border); background: #f8f8fd; color: var(--primary); font-size: .58rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.mode-count-picker input { width: 100%; height: 40px; padding: 0 9px; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--ink); font-size: .75rem; font-weight: 700; }
.mode-count-picker small { color: var(--muted-2); font-size: .54rem; font-weight: 650; letter-spacing: 0; line-height: 1.35; text-transform: none; }
.mode-count-picker:has(input:disabled) { opacity: .48; }
.anki-daily-summary, .anki-today-panel { display: grid; align-content: center; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 18px; border-left: 1px solid var(--border); background: #f8f8fd; }
.anki-daily-summary > span, .anki-today-panel > span { grid-column: 1/-1; color: var(--primary); font-size: .58rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.anki-daily-summary > div, .anki-today-panel > div { display: grid; gap: 2px; padding: 9px 6px; border: 1px solid var(--border); border-radius: 9px; background: white; text-align: center; }
.anki-daily-summary strong, .anki-today-panel strong { color: var(--ink); font-size: .84rem; }
.anki-daily-summary small, .anki-today-panel small { color: var(--muted-2); font-size: .5rem; font-weight: 750; text-transform: uppercase; }
.anki-today-panel { grid-template-columns: auto 84px 84px; align-items: center; width: fit-content; margin: 0 0 14px auto; border: 1px solid var(--border); border-radius: 12px; }
.anki-today-panel > span { grid-column: auto; padding-right: 5px; }
.feynman-mode-timer { display: grid; align-content: center; gap: 9px; padding: 20px; border-left: 1px solid var(--border); background: #f8f8fd; }
.feynman-mode-timer > span { color: var(--primary); font-size: .58rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.feynman-mode-timer label { display: grid; gap: 4px; color: var(--muted); font-size: .57rem; font-weight: 700; }
.feynman-mode-timer input, .feynman-mode-timer select { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--ink); font: inherit; }
.custom-review-time { color: var(--primary); font-size: .7rem; font-weight: 800; }
.custom-delete-page { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 30px; }
.custom-delete-page[hidden] { display: none; }
.custom-delete-card { width: min(580px,100%); padding: 42px; border: 1px solid #f0cbc6; border-radius: 22px; background: white; box-shadow: var(--shadow); text-align: center; }
.custom-delete-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 50%; background: #fff0ed; color: #b85248; font-size: 1.25rem; font-weight: 850; }
.custom-delete-card h2 { margin: 7px 0 12px; font-size: 1.45rem; }
.custom-delete-card > p:not(.section-label) { color: var(--muted); font-size: .76rem; line-height: 1.6; }
.custom-delete-summary { margin-top: 20px; padding: 13px; border-radius: 11px; background: #f7f7fb; color: var(--muted); font-size: .68rem; font-weight: 700; }
.custom-delete-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.danger-button { border-color: #c65f55; background: #c65f55; color: white; }
.danger-button:hover { background: #ad4c43; }
.custom-anki-ratings { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 7px; margin-top: 13px; }
.custom-anki-ratings:not([hidden]) { display: grid; }
.custom-anki-ratings button { display: grid; gap: 3px; padding: 10px 5px; border: 1px solid var(--border); border-radius: 10px; background: white; color: var(--ink); cursor: pointer; }
.custom-anki-ratings span { color: var(--primary); font-size: .6rem; }
.custom-anki-ratings strong { font-size: .66rem; }
.anki-session-counts { width: fit-content; display: grid; grid-template-columns: minmax(44px,auto) auto minmax(58px,auto) auto minmax(48px,auto); align-items: start; justify-content: center; column-gap: 7px; margin: 12px auto 20px; font-size: .82rem; font-weight: 850; }
.anki-session-counts[hidden] { display: none; }
.anki-session-counts > b { align-self: start; padding-top: 1px; color: var(--ink); font-weight: 650; line-height: 1.05; }
.anki-count-group { min-width: 0; display: grid; justify-items: center; gap: 5px; padding-bottom: 5px; border-bottom: 3px solid transparent; line-height: 1; }
.anki-count-group strong { min-width: 2ch; font: inherit; text-align: center; }
.anki-count-group small { color: var(--muted-2); font-size: .48rem; font-weight: 700; letter-spacing: .04em; line-height: 1; text-transform: uppercase; }
.anki-session-counts .anki-count-new { color: #2778e8; }
.anki-session-counts .anki-count-learning { color: #d64d58; }
.anki-session-counts .anki-count-review { color: #19905f; }
.anki-session-counts[data-current-type="new"] .anki-count-group-new { border-bottom-color: #2778e8; }
.anki-session-counts[data-current-type="learning"] .anki-count-group-learning { border-bottom-color: #d64d58; }
.anki-session-counts[data-current-type="review"] .anki-count-group-review { border-bottom-color: #19905f; }
.anki-review > .anki-session-counts { margin-bottom: 28px; }
.anki-ratings .anki-remove-choice,
.custom-anki-ratings .anki-remove-choice {
  align-self: stretch;
  align-content: center;
  justify-items: center;
  gap: 5px;
  transform: none;
}
.anki-remove-icon { width: 18px; height: 16px; display: grid; place-items: center; }
.anki-remove-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.anki-remove-choice strong { margin-top: 2px; }
.book-status { display: block; margin-top: 7px; color: #a06a1f; font-size: .56rem; font-weight: 700; }
.book-status.connected { color: var(--success); }
.course-open { width: 29px; height: 29px; display: grid; place-items: center; border: 0; border-radius: 9px; background: white; color: var(--primary); cursor: pointer; }
.course-open svg { width: 15px; height: 15px; }
.catalog-course, .enrolled-course { grid-template-columns: 76px minmax(0,1fr) auto; }
.catalog-course { cursor: default; }
.course-add { min-width: 88px; min-height: 38px; padding: 0 12px; background: var(--primary); color: white; font-size: .65rem; }
.course-add:disabled { background: #ececf4; color: var(--muted-2); cursor: default; box-shadow: none; }
.course-remove { align-self: start; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--muted-2); font-size: .59rem; cursor: pointer; }
.course-remove:hover { background: #fff0ed; color: #b85248; }
.empty-my-courses { grid-column: 1 / -1; width: min(520px,100%); display: grid; gap: 5px; padding: 22px; border: 1px dashed #ced1df; border-radius: 14px; background: #fafbfe; }
.empty-my-courses strong { font-size: .78rem; }
.empty-my-courses span { color: var(--muted); font-size: .68rem; }
.empty-search { grid-column: 1/-1; padding: 24px; color: var(--muted); text-align: center; font-size: .78rem; }

.course-page { height: calc(100vh - 72px); max-width: 1460px; display: grid; grid-template-rows: auto minmax(0,1fr); margin: 0 auto; overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: #f8f9fc; box-shadow: var(--shadow); }
.course-page-header { display: flex; align-items: center; gap: 22px; padding: 17px 24px; border-bottom: 1px solid var(--border); background: white; }
.course-page-header > div { min-width: 0; }
.course-page-header h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-to-courses { flex: 0 0 auto; padding: 8px 11px; border: 0; border-radius: 9px; background: var(--primary-soft); color: var(--primary-dark); font-size: .68rem; font-weight: 750; cursor: pointer; }
.library-dialog-body { min-height: 0; display: grid; grid-template-columns: clamp(290px,24vw,330px) minmax(0,1fr); }
.chapter-sidebar { min-height: 0; overflow-y: auto; padding: 20px; border-right: 1px solid var(--border); background: #fbfbfd; }
.back-library { margin-bottom: 16px; padding: 0; border: 0; background: transparent; color: var(--primary); font-size: .7rem; font-weight: 700; cursor: pointer; }
.course-mini { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding: 14px; border-radius: 14px; color: white; }
.course-mini > span { width: 35px; text-align: center; font-size: 1.45rem; }
.course-mini div { display: grid; gap: 3px; }
.course-mini strong { font-size: .76rem; }
.course-mini small { color: rgba(255,255,255,.75); font-size: .6rem; }
.chapter-label { margin: 4px 8px 9px; color: var(--muted-2); font-size: .59rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.chapter-button { width: 100%; display: grid; gap: 4px; padding: 11px 12px; border: 0; border-radius: 11px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.chapter-button:hover { background: #f0f1f7; }
.chapter-button.active { background: var(--primary-soft); color: var(--primary-dark); }
.chapter-button span { color: var(--muted-2); font-size: .56rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.chapter-button strong { font-size: .72rem; line-height: 1.35; }
.unit-group + .unit-group { margin-top: 3px; }
.unit-button.active { border-radius: 11px 11px 7px 7px; }
.mini-unit-list { display: grid; gap: 3px; margin: 4px 0 9px 11px; padding-left: 11px; border-left: 2px solid #e5e5f2; }
.mini-unit-button { width: 100%; min-width: 0; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: start; gap: 9px; padding: 9px; border: 0; border-radius: 9px; background: transparent; color: #5c6376; text-align: left; cursor: pointer; }
.mini-unit-button:hover { background: #f0f1f7; }
.mini-unit-button.active { background: #ececff; color: var(--primary-dark); }
.mini-unit-button span { display: grid; place-items: center; min-width: 28px; min-height: 24px; padding: 2px 4px; border-radius: 7px; background: #f0efff; color: var(--primary); font-size: .59rem; font-weight: 800; line-height: 1; white-space: nowrap; }
.mini-unit-button strong { min-width: 0; overflow-wrap: anywhere; font-size: .64rem; line-height: 1.42; }
.unit-button { position: relative; padding-right: 34px; }
.structure-chevron { align-self: center; color: var(--muted-2); font-size: .72rem; font-style: normal; line-height: 1; }
.unit-button > .structure-chevron { position: absolute; top: 50%; right: 13px; transform: translateY(-50%); }
.atkins-section-list { display: grid; gap: 4px; margin: -1px 0 9px 48px; padding-left: 10px; border-left: 2px solid #e6e8f2; }
.atkins-section-button { padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: #697187; text-align: left; font-size: .58rem; font-weight: 650; line-height: 1.35; cursor: pointer; }
.atkins-section-button:hover, .atkins-section-button.active { background: #f0efff; color: var(--primary); }
.lesson-view { min-width: 0; overflow-y: auto; padding: 28px clamp(24px,4vw,52px) 45px; outline: none; background: white; }
.lesson-tabs { position: sticky; z-index: 2; top: -28px; display: flex; gap: 4px; margin: -4px 0 30px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: rgba(248,249,252,.94); backdrop-filter: blur(10px); }
.lesson-tabs button { flex: 1; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .68rem; font-weight: 700; cursor: pointer; }
.lesson-tabs button.active { background: white; color: var(--primary-dark); box-shadow: 0 3px 10px rgba(35,39,70,.08); }
.lesson-article, .practice-view { max-width: 720px; margin: 0 auto; }
.lesson-number { color: var(--primary); font-size: .65rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.unit-context { margin: -5px 0 18px; color: var(--muted-2); font-size: .68rem; font-weight: 650; }
.atkins-section-outline { margin: 0 0 20px; padding: 15px 17px; border: 1px solid #e3e4f0; border-radius: 12px; background: #fbfbfe; }
.atkins-section-outline > span { color: var(--primary); font-size: .58rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.atkins-section-outline h4 { margin: 5px 0 8px; }
.textbook-section-topics { display: grid; gap: 7px; margin-top: 10px; }
.textbook-section-topics > div { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: baseline; gap: 9px; }
.textbook-section-topics b { min-width: 38px; padding: 3px 6px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-size: .58rem; text-align: center; }
.textbook-section-topics span { color: #50586e; font-size: .72rem; line-height: 1.45; }
:root[data-theme="dark"] .textbook-section-topics span { color: #fff; }
.atkins-equations { display: grid; gap: 8px; margin: 24px 0 28px; }
.atkins-equations h4 { margin-bottom: 2px; }
.atkins-equations div { display: grid; gap: 5px; padding: 11px 13px; border: 1px solid #e2e4ef; border-radius: 10px; background: #fafbff; }
.atkins-equations strong { color: #242b45; font-size: .73rem; }
.atkins-equations span { color: #596177; font-size: .68rem; }
.lesson-article h3, .practice-view h3 { margin: 8px 0 12px; font-size: 1.65rem; letter-spacing: -.035em; }
.lesson-lead, .practice-view > p { color: #50586e; font-size: .9rem; line-height: 1.75; }
.lesson-article h4 { margin: 24px 0 10px; font-size: .82rem; }
.lesson-article ul { display: grid; gap: 9px; margin: 0 0 28px; padding-left: 20px; }
.lesson-article li { color: #50586e; font-size: .78rem; line-height: 1.55; }
.complete-lesson { min-height: 42px; }
.offline-cards { display: grid; gap: 11px; margin-top: 24px; }
.offline-card { min-height: 120px; display: grid; gap: 8px; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: #fbfbfd; color: var(--ink); text-align: left; cursor: pointer; }
.offline-card > span { color: var(--primary); font-size: .58rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.offline-card strong { font-size: .82rem; line-height: 1.45; }
.offline-card em { color: var(--muted-2); font-size: .62rem; font-style: normal; }
.offline-card p { display: none; padding-top: 11px; border-top: 1px solid var(--border); color: #50586e; font-size: .76rem; line-height: 1.55; }
.offline-card.revealed { border-color: #c7c8eb; background: #f6f6ff; }
.offline-card.revealed em { display: none; }
.offline-card.revealed p { display: block; }
.anki-selection-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 22px 0 12px; }
.anki-selection-bar > strong { color: var(--primary-dark); font-size: .72rem; }
.anki-selection-bar > div { display: flex; gap: 6px; }
.anki-selection-bar button, .anki-back, .flashcard-back { padding: 7px 9px; border: 0; border-radius: 8px; background: #f0f1f7; color: var(--primary-dark); font-size: .62rem; font-weight: 750; cursor: pointer; }
.anki-card-picker { display: grid; gap: 7px; max-height: 330px; overflow-y: auto; padding: 4px 5px 4px 1px; }
.anki-card-picker label { display: grid; grid-template-columns: 22px minmax(0,1fr); align-items: start; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: #fbfbfd; cursor: pointer; }
.anki-card-picker label:has(input:checked) { border-color: #bfc0e8; background: #f4f4ff; }
.anki-card-picker input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); }
.anki-card-picker span { display: grid; gap: 4px; }
.anki-card-picker small { color: var(--primary); font-size: .56rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.anki-card-picker strong { font-size: .72rem; line-height: 1.42; }
.anki-deck-picker { display: grid; gap: 10px; max-height: 390px; overflow-y: auto; padding: 2px 5px 2px 1px; }
.anki-unit-picker { overflow: hidden; border: 1px solid var(--border); border-radius: 13px; background: #fbfbfd; }
.anki-unit-choice, .anki-mini-picker label { display: grid; grid-template-columns: 22px minmax(0,1fr); align-items: start; gap: 10px; cursor: pointer; }
.anki-unit-choice { padding: 13px; background: #f4f4fa; }
.anki-unit-choice:has(input:checked) { background: #ececff; }
.anki-mini-picker { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; background: var(--border); border-top: 1px solid var(--border); }
.anki-mini-picker label { min-height: 70px; padding: 12px; background: white; }
.anki-mini-picker label:has(input:checked) { background: #f7f7ff; }
.textbook-chapter-picker { min-width: 0; background: white; }
.textbook-chapter-picker > label { border-bottom: 1px solid var(--border); }
.textbook-subsection-picker { display: grid; gap: 1px; margin: 0 10px 10px 32px; overflow: hidden; border: 1px solid var(--border); border-radius: 9px; background: var(--border); }
.textbook-subsection-picker label { min-height: 54px; padding: 9px 10px; background: #fbfbfe; }
.textbook-subsection-picker strong { font-size: .63rem; }
:root[data-theme="dark"] .textbook-chapter-picker,
:root[data-theme="dark"] .textbook-subsection-picker label { background: #000; }
.anki-unit-choice input, .anki-mini-picker input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); }
.anki-unit-choice span, .anki-mini-picker span { min-width: 0; display: grid; gap: 4px; }
.anki-unit-choice small, .anki-mini-picker small { color: var(--primary); font-size: .56rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.anki-unit-choice strong, .anki-mini-picker strong { font-size: .7rem; line-height: 1.4; }
.anki-card-source { margin-top: -7px; color: var(--muted-2); font-size: .66rem; font-weight: 650; }
.anki-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.anki-card-meta .anki-card-source { margin: 0; }
.anki-card-meta button { padding: 7px 9px; border: 0; border-radius: 8px; background: #fff0ed; color: #ad5047; font-size: .61rem; font-weight: 750; cursor: pointer; }
.anki-card-meta button:hover { background: #ffe3df; }
.anki-removed-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -2px 0 12px; padding: 10px 12px; border-radius: 10px; background: #fff5f3; color: #8f5b55; font-size: .64rem; }
.anki-removed-note button { padding: 5px 7px; border: 0; border-radius: 7px; background: white; color: var(--primary-dark); font-size: .59rem; font-weight: 750; cursor: pointer; }
.anki-next-due { margin: -2px 0 12px; padding: 11px 13px; border-radius: 10px; background: #eef7f4; color: #28745d; font-size: .66rem; font-weight: 700; }
.feynman-time-setting { display: flex; align-items: end; gap: 9px; margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fbfbfd; }
.feynman-time-setting label { flex: 1; display: grid; gap: 7px; color: var(--muted); font-size: .65rem; font-weight: 700; }
.feynman-time-setting input, .feynman-time-setting select { height: 42px; border: 1px solid var(--border); border-radius: 9px; background: white; color: var(--ink); }
.feynman-time-setting input { width: 100%; padding: 0 11px; }
.feynman-time-setting select { min-width: 120px; padding: 0 10px; }
.feynman-countdown { flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; background: #ececff; color: var(--primary-dark); font-size: .7rem; }
.feynman-countdown strong { font-variant-numeric: tabular-nums; }
.feynman-countdown.finished { background: #eaf8f2; color: #167957; }
.feynman-prompt { display: grid; gap: 8px; margin: 18px 0; padding: 20px; border-left: 4px solid var(--primary); border-radius: 0 13px 13px 0; background: #f3f3ff; }
.feynman-prompt small { color: var(--primary); font-size: .58rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.feynman-prompt strong { font-size: .92rem; line-height: 1.6; }
.feynman-response-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .67rem; font-weight: 750; }
.feynman-session textarea { width: 100%; min-height: 280px; padding: 16px; resize: vertical; border: 1px solid var(--border); border-radius: 14px; background: #fff; color: var(--ink); font-family: inherit; font-size: .8rem; line-height: 1.65; }
.feynman-session textarea:focus { border-color: #aaaadf; outline: 3px solid rgba(91,91,214,.12); }
.feynman-session textarea:disabled { background: #f7f8fb; color: #555d72; opacity: 1; }
.feynman-session-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.feynman-session-actions > span { margin-right: auto; color: var(--muted); font-size: .65rem; line-height: 1.45; }
.start-anki { width: 100%; margin-top: 16px; }
.start-anki:disabled { opacity: .45; cursor: not-allowed; }
.anki-back { margin-bottom: 16px; background: transparent; padding-left: 0; }
.anki-session-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.anki-session-heading .lesson-number { margin: 0; }
.anki-time { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; background: #f0f1f7; color: var(--muted); font-size: .66rem; }
.anki-time strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.flashcard-mode-label { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; background: #f0f1f7; color: var(--muted); font-size: .62rem; font-weight: 700; }
.anki-review { margin-top: 24px; }
.anki-card { width: 100%; min-height: 300px; display: grid; align-content: center; gap: 16px; padding: 34px; border: 1px solid #d8d9e8; border-radius: 20px; background: linear-gradient(145deg,#ffffff,#f7f7fc); color: var(--ink); text-align: center; cursor: pointer; box-shadow: 0 14px 34px rgba(37,41,75,.08); }
.anki-card > span { color: var(--primary); font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.anki-card strong { font-size: 1.12rem; line-height: 1.5; }
.anki-card em { color: var(--muted-2); font-size: .66rem; font-style: normal; }
.anki-answer { display: none; padding-top: 18px; border-top: 1px solid var(--border); color: #50586e; font-size: .82rem; line-height: 1.65; }
.anki-answer p { margin: 0; }
.anki-equation, .equation-display { font-family: "Times New Roman", Times, serif; font-variant-numeric: lining-nums; }
.math-relation { display: inline-block; margin: 0 .22em; font-weight: 500; line-height: 1; vertical-align: -.04em; }
.math-negative { display: inline-block; margin: 0 .13em 0 .03em; font-family: Georgia, "Times New Roman", serif; font-weight: 700; line-height: 1; vertical-align: -.03em; }
.anki-equation { display: block; width: fit-content; max-width: 100%; margin: 0 auto 14px; padding: 12px 18px; overflow-wrap: anywhere; border: 1px solid #d9d9ed; border-radius: 12px; background: #f4f4ff; color: #20264a; font-size: 1.18rem; line-height: 1.45; }
.atkins-equations .equation-display { display: block; margin: 7px 0; color: #20264a; font-size: .9rem; line-height: 1.45; }
.anki-ratings { display: none; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; margin-top: 14px; }
.anki-ratings button { display: grid; gap: 3px; padding: 11px 7px; border: 1px solid var(--border); border-radius: 10px; background: white; color: var(--ink); cursor: pointer; }
.anki-ratings button:first-child { color: #b85248; }
.anki-ratings button:nth-child(4) { color: #167957; }
.anki-ratings .anki-remove-choice,
.custom-anki-ratings .anki-remove-choice { border-color: #efc7c1; background: #fff6f4; color: #ad5047; }
.anki-ratings .anki-remove-choice span,
.custom-anki-ratings .anki-remove-choice span { color: #ad5047; }
.anki-ratings strong { font-size: .68rem; }
.anki-ratings span { color: var(--primary); font-size: .59rem; font-weight: 800; }
.anki-review.revealed .anki-answer { display: block; }
.anki-review.revealed .anki-card em { display: none; }
.anki-study .anki-review.revealed .anki-card > span,
.anki-study .anki-review.revealed .anki-card > strong { display: none; }
.anki-study .anki-answer::before { content: "Back"; display: block; margin-bottom: 13px; color: var(--primary); font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.anki-review.ratings-ready .anki-ratings { display: grid; }
.anki-reveal-button { display: block; min-width: 170px; margin: 14px auto 0; }
.anki-review.revealed .anki-reveal-button { display: none; }
.flashcard-navigation { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.flashcard-navigation button { min-width: 120px; padding: 11px 15px; border: 1px solid var(--border); border-radius: 10px; background: white; color: var(--primary-dark); font-size: .68rem; font-weight: 750; cursor: pointer; }
.flashcard-navigation button:last-child { border-color: var(--primary); background: var(--primary); color: white; }
.flashcard-navigation button:disabled { opacity: .4; cursor: not-allowed; }
.quiz-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; padding: 12px 14px; border-radius: 11px; background: var(--primary-soft); color: var(--primary-dark); font-size: .7rem; }
.quiz-summary span { color: var(--muted); }
.offline-quiz-stack { display: grid; gap: 14px; margin-top: 14px; }
.offline-quiz { display: grid; gap: 9px; padding: 23px; border: 1px solid var(--border); border-radius: 16px; background: #fbfbfd; }
.offline-quiz > small { color: var(--primary); font-size: .57rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.offline-quiz > strong { margin-bottom: 8px; font-size: .88rem; line-height: 1.5; }
.offline-quiz button { min-height: 43px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: white; color: #4e566c; font-size: .74rem; text-align: left; cursor: pointer; }
.offline-quiz button:hover:not(:disabled) { border-color: #b9bae7; }
.offline-quiz button.correct { border-color: #75caaa; background: #eaf8f2; color: #167957; }
.offline-quiz button.incorrect { border-color: #e8aaa3; background: #fff0ed; color: #b85248; }
.quiz-feedback { min-height: 20px; margin-top: 5px; color: var(--muted); font-size: .72rem; }
.library-welcome { max-width: 620px; margin: 70px auto; text-align: center; }
.welcome-book { width: 68px; height: 68px; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); font-size: 2rem; }
.library-welcome h3 { margin: 8px 0 12px; font-size: 1.55rem; }
.library-welcome > p:not(.section-label) { color: var(--muted); font-size: .82rem; line-height: 1.65; }
.library-facts { display: flex; justify-content: center; gap: 12px; margin-top: 26px; }
.library-facts span { min-width: 105px; display: grid; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); font-size: .63rem; }
.library-facts strong { color: var(--ink); font-size: 1.2rem; }

@media (max-width: 900px) {
  .course-shelf { grid-template-columns: minmax(280px, 520px); }
  .draft-heading { align-items: stretch; flex-direction: column; }
  .draft-heading .draft-heading-actions { align-items: stretch; justify-content: space-between; }
  .draft-view-filters { flex: 1; }
}
@media (max-width: 680px) {
  .draft-heading .draft-heading-actions { flex-direction: column; }
  .draft-view-filters { width: 100%; grid-template-columns: 1fr; }
  .draft-heading .draft-heading-actions > .button { width: 100%; }
  .profile-visibility-options,.community-profile-items { grid-template-columns: 1fr; }
  .community-profile-header { padding: 84px 18px 18px; }
  .community-profile-cover { height: 92px; }
  .community-profile-heading { align-items: stretch; flex-direction: column; gap: 15px; }
  .community-profile-avatar { width: 62px; height: 62px; flex-basis: 62px; border-radius: 18px; }
  .community-profile-stats { width: 100%; }
  .community-profile-stats div { min-width: 0; flex: 1; }
  .community-profile-library { padding: 18px; }
  .community-profile-library-heading { align-items: start; flex-direction: column; gap: 5px; }
  .library-section { padding: 18px; }
  .browse-library-toggle { width: 100%; }
  .community-feedback-grid { grid-template-columns: 1fr; }
  .deck-preview-shell { padding: 16px; }
  .textbook-library-panel { padding: 18px; }
  .library-heading-row { display: grid; }
  .catalog-divider { display: grid; align-items: start; }
  .catalog-search-wrap { justify-items: stretch; }
  .course-shelf { grid-template-columns: 1fr; }
  .course-page { height: auto; min-height: calc(100vh - 48px); border-radius: 14px; }
  .course-page-header { align-items: flex-start; padding: 14px; }
  .library-dialog-body { grid-template-columns: 1fr; overflow-y: auto; }
  .chapter-sidebar { overflow: visible; border-right: 0; border-bottom: 1px solid var(--border); }
  .lesson-view { overflow: visible; }
  .library-facts { flex-wrap: wrap; }
  .anki-mini-picker { grid-template-columns: 1fr; }
  .feynman-session-actions { align-items: stretch; flex-direction: column; }
  .feynman-session-actions > span { margin: 0 0 4px; }
  .anki-ratings { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .anki-note-import { grid-template-columns: 1fr; }
  .anki-note-import .button { width: 100%; }
  .create-page-header { display: grid; }
  .create-page-header .button { width: 100%; }
  .custom-study-page { min-height: calc(100vh - 48px); }
  .custom-study-page-header { grid-template-columns: 1fr; padding: 16px; }
  .custom-study-options { grid-template-columns: 1fr; }
  .custom-study-options > button, .custom-study-option-main { min-height: 140px; }
  .custom-feynman-option, .custom-count-option { grid-template-columns: 1fr; }
  .feynman-mode-timer, .mode-count-picker { grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); border-left: 0; }
  .question-card-controls { border-top: 1px solid var(--border); border-left: 0; }
  .question-card-controls .mode-count-picker { border-top: 0; }
  .essay-prompt-panel { position: fixed; top: auto; right: 12px; bottom: 76px; left: 12px; width: auto; max-height: calc(100vh - 100px); }
  .essay-prompt-list { max-height: min(430px, 52vh); }
  .feynman-mode-timer > span { grid-column: 1 / -1; }
  .custom-review-shell { padding: 16px; }
  .custom-feynman-practice { padding: 18px; }
  .custom-feynman-session-timer { justify-content: space-between; }
  .custom-delete-page { min-height: calc(100vh - 48px); padding: 10px; }
  .custom-delete-card { padding: 28px 20px; }
  .custom-delete-actions { grid-template-columns: 1fr; }
}

/* Final responsive overrides live after the catalog rules so small screens do
   not inherit the desktop three-column deck grid. */
@media (max-width: 900px) {
  .flashcards-deck-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 680px) {
  .main-content { padding-inline: 12px; }
  .courses-page-header,.flashcards-page-header,.create-page-header { gap: 14px; margin-bottom: 18px; }
  .library-section,.flashcards-library,.textbook-library-panel { padding: 14px; }
  .flashcards-deck-grid { grid-template-columns: minmax(0,1fr); }
  .flashcard-catalog-item { grid-template-columns: 44px minmax(0,1fr); gap: 10px; padding: 12px; }
  .flashcard-catalog-icon { width: 44px; height: 52px; border-radius: 10px; }
  .flashcard-catalog-copy h3,.community-item-card > h3 { font-size: .84rem; line-height: 1.4; overflow-wrap: anywhere; }
  .flashcard-catalog-copy p,.community-item-card > p,.custom-deck-item p { font-size: .68rem; line-height: 1.55; }
  .catalog-card-actions,.community-card-actions { gap: 7px; }
  .catalog-card-actions .button,.community-card-actions .button { min-width: 0; padding-inline: 10px; font-size: .72rem; }
  .community-card-meta { align-items: flex-start; flex-direction: column; gap: 6px; }
  .community-add-count { align-self: flex-start; }
  .library-pagination { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .library-pagination span { grid-column: 1 / -1; grid-row: 1; min-width: 0; padding: 2px 0 4px; }
  .library-pagination button { width: 100%; min-width: 0; min-height: 40px; padding-inline: 8px; }
  .library-pagination button:nth-of-type(1) { grid-column: 1; grid-row: 2; }
  .library-pagination button:nth-of-type(2) { grid-column: 2; grid-row: 2; }
  .library-pagination button:nth-of-type(3) { grid-column: 1; grid-row: 3; }
  .library-pagination button:nth-of-type(4) { grid-column: 2; grid-row: 3; }
  .browse-library-toggle { gap: 4px; padding: 4px; }
  .browse-library-toggle button { min-width: 0; min-height: 42px; padding-inline: 5px; font-size: .64rem; line-height: 1.25; }
  .deck-preview-dialog,.community-profile-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 17px; }
  .deck-preview-scroll { padding-right: 2px; }
  .deck-preview-item { padding: 12px; }
}

@media (max-width: 360px) {
  .main-content { padding-inline: 9px; }
  .library-section,.flashcards-library,.textbook-library-panel { padding: 11px; }
  .browse-library-toggle button { font-size: .59rem; }
  .catalog-card-actions,.community-card-actions { grid-template-columns: 1fr; }
  .notes-list { grid-template-columns: 1fr; }
}

/* Account, accessibility, and performance preferences. */
.account-sync-summary,.danger-zone { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:16px; border:1px solid var(--border); border-radius:14px; background:#fbfbfe; }
.account-sync-summary > div,.danger-zone > div { min-width:0; display:grid; gap:5px; }
.account-sync-summary strong,.danger-zone strong { color:var(--ink); font-size:.76rem; }
.account-sync-summary span,.danger-zone span { color:var(--muted); font-size:.67rem; line-height:1.55; }
.account-legal-copy { margin:0; color:var(--muted-2); font-size:.62rem; line-height:1.55; text-align:center; }
.account-legal-copy a { color:var(--primary); }
.account-terms-consent { display:flex; align-items:center; justify-content:center; gap:8px; color:var(--muted); font-size:.68rem; line-height:1.4; }
.account-terms-consent input { width:16px; height:16px; margin:0; accent-color:var(--primary); }
.settings-preference-grid { align-items:stretch; }
.legal-link-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.legal-link-grid .button { width:100%; }
.site-legal-footer { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:8px 18px; padding:16px 24px 24px; color:var(--muted-2); font-size:.66rem; }
.site-legal-footer a { color:inherit; text-decoration:none; }
.site-legal-footer a:hover,.site-legal-footer a:focus-visible { color:var(--primary); text-decoration:underline; }
.danger-zone { margin-top:14px; border-color:#efc8c2; background:#fff8f7; }
:root[data-theme="dark"] .account-sync-summary,
:root[data-theme="dark"] .danger-zone { background:#08090d; }
.legal-dialog { width:min(720px,calc(100vw - 28px)); max-height:calc(100vh - 28px); padding:0; overflow:hidden; border:0; border-radius:20px; background:var(--surface); color:var(--ink); box-shadow:0 28px 90px rgba(24,29,54,.25); }
.legal-dialog-shell { display:grid; grid-template-rows:auto minmax(0,1fr); max-height:calc(100vh - 28px); }
.legal-dialog .dialog-header { padding:20px 22px; border-bottom:1px solid var(--border); }
.legal-document { overflow:auto; padding:22px; }
.legal-document h3 { margin:24px 0 7px; font-size:.84rem; }
.legal-document p { margin:0 0 13px; color:var(--muted); font-size:.75rem; line-height:1.7; }

/* Long workspaces skip off-screen layout and paint work until needed. */
.settings-card,.flashcard-catalog-item,.community-item-card,.draft-card-row,.deck-preview-item { content-visibility:auto; contain-intrinsic-size:auto 180px; }
img { content-visibility:auto; }

:root[data-reduce-motion="true"] *,
:root[data-reduce-motion="true"] *::before,
:root[data-reduce-motion="true"] *::after { scroll-behavior:auto !important; animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
:root[data-data-saver="true"] .birthday-confetti,
:root[data-data-saver="true"] .birthday-scene { display:none !important; }
:root[data-data-saver="true"] .card,
:root[data-data-saver="true"] .flashcards-library,
:root[data-data-saver="true"] dialog { box-shadow:none !important; }
:root[data-compact="true"] .settings-card,
:root[data-compact="true"] .flashcards-library,
:root[data-compact="true"] .library-section { padding:16px; }
:root[data-compact="true"] .custom-deck-list,
:root[data-compact="true"] .settings-panel { gap:10px; }

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior:auto !important; animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
}

@media (max-width: 680px) {
  .settings-page-header { margin-bottom:16px; }
  .settings-tabs { width:100%; overflow-x:auto; scrollbar-width:none; }
  .settings-tabs button { flex:1 0 auto; min-height:42px; }
  .settings-card { padding:15px; }
  .settings-card-heading { align-items:flex-start; flex-direction:column; gap:6px; }
  .settings-profile-grid,.settings-grid,.legal-link-grid { grid-template-columns:1fr; }
  .site-legal-footer { padding-bottom:88px; }
  .account-sync-summary,.danger-zone { align-items:stretch; flex-direction:column; }
  .account-sync-summary .button,.danger-zone .button { width:100%; }
  .settings-actions { position:sticky; bottom:calc(58px + env(safe-area-inset-bottom)); z-index:5; padding:10px; border:1px solid var(--border); border-radius:14px; background:color-mix(in srgb,var(--surface) 94%,transparent); backdrop-filter:blur(12px); }
  .legal-dialog .dialog-header,.legal-document { padding:16px; }
}

/* Keep secondary controls readable on ordinary laptop and phone displays. */
.note-list-copy small,
.notes-drag-hint,
.note-folder-empty,
.community-author,
.community-add-count,
.community-rating small,
.community-profile-item p,
.community-profile-item-meta small,
.flashcard-catalog-copy p,
.rich-notes-hint,
.single-pass-note,
.anki-note-import .anki-import-status { font-size: max(.66rem, 11px); }
.note-folder-study,
.built-in-deck-label,
.community-sort-control,
.community-profile-badge,
.community-profile-stats span,
.community-profile-item-top span,
.draft-view-filters label,
.characteristic-column-headings { font-size: max(.62rem, 10px); }
.mobile-nav a,.mobile-nav button { font-size: max(.64rem, 11px); }
.app-prompt-dialog {
  width: min(92vw, 470px);
  border: 1px solid var(--border, #e1e3ef);
  border-radius: 24px;
  padding: 0;
  color: var(--ink, #171b2d);
  background: var(--panel, #fff);
  box-shadow: 0 28px 80px rgba(24, 30, 72, .25);
}
.app-prompt-dialog::backdrop { background: rgba(20, 24, 48, .48); backdrop-filter: blur(5px); }
.app-prompt-dialog form { display: grid; gap: 18px; padding: 24px; }
.app-prompt-dialog .dialog-header { margin: 0; }
.app-prompt-dialog p { margin: 0; color: var(--muted, #6e7489); line-height: 1.55; white-space: pre-line; }
.app-prompt-dialog label { display: grid; gap: 8px; font-weight: 700; }
.app-prompt-dialog input { width: 100%; min-height: 48px; border: 1px solid var(--border, #dfe2ee); border-radius: 14px; padding: 0 14px; background: var(--panel, #fff); color: inherit; font: inherit; }
.app-prompt-dialog[data-danger="true"] #app-prompt-confirm { background: #c84d43; }
