:root {
  color-scheme: light;
  --ink: #2d1831;
  --ink-soft: #77586c;
  --paper: #fff8fc;
  --card: #fffefe;
  --line: #efd8e5;
  --purple: #BB3960;
  --purple-deep: #8f2949;
  --lilac: #f8e5ec;
  --pink: #f5cbd8;
  --mint: #f5dfe7;
  --amber: #f3edf1;
  --red-soft: #fde4ed;
  --shadow: 0 14px 36px rgba(126, 45, 96, 0.1);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); scroll-behavior: smooth; }

body { margin: 0; min-height: 100vh; color: var(--ink); background:
  radial-gradient(circle at 92% 8%, rgba(249, 207, 225, 0.72), transparent 22rem),
  radial-gradient(circle at 3% 30%, rgba(246, 224, 239, 0.62), transparent 18rem),
  var(--paper); }

button, input, select { font: inherit; }
button, .button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, .lesson-pane:focus-visible {
  outline: 3px solid rgba(177, 63, 125, 0.35);
  outline-offset: 2px;
}

a { color: var(--purple-deep); }

.skip-link { position: fixed; left: 12px; top: -50px; z-index: 10; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff; transition: top 0.2s; }
.skip-link:focus { top: 12px; }

.app-header { position: relative; z-index: 1000; display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1440px; margin: 0 auto; padding: 11px clamp(12px, 4vw, 64px) 7px; }
.header-actions { position: relative; z-index: 1002; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 1 auto; min-width: 0; }
.brand-lockup { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
.brand-copy { min-width: 0; padding-top: 0; }
.brand-copy .eyebrow { white-space: nowrap; }
.brand-logo { display: block; flex: 0 0 auto; width: 52px; height: 52px; border-radius: 14px; background: #BB3960; box-shadow: 0 8px 18px rgba(112, 30, 62, 0.24); object-fit: cover; }
.eyebrow { margin: 0 0 5px; color: var(--purple); font-size: 0.71rem; font-weight: 800; letter-spacing: 0.15em; line-height: 1.25; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.15rem, 2.2vw, 1.45rem); letter-spacing: -0.03em; }
.content-set-picker { position: relative; z-index: 1003; display: inline-flex; max-width: min(100%, 290px); min-width: 0; color: var(--ink); }
.content-set-button { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0; padding: 0 0 0 0; border: 0; color: inherit; background: transparent; font-size: clamp(1.2rem, 2.6vw, 1.55rem); font-weight: 900; letter-spacing: -0.045em; line-height: 1.15; text-align: left; cursor: pointer; }
.content-set-button:disabled { color: var(--ink-soft); cursor: wait; }
.content-set-button:focus-visible { outline-offset: 5px; }
.content-set-button-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-set-arrow { flex: 0 0 auto; color: var(--purple); font-size: 1.35rem; font-weight: 900; line-height: 1; transition: transform 0.15s ease; }
.content-set-picker.is-open .content-set-arrow { transform: rotate(180deg); }
.content-set-menu { position: absolute; top: calc(100% + 9px); left: -12px; z-index: 1100; display: grid; gap: 3px; width: max-content; min-width: 220px; max-width: min(300px, calc(100vw - 30px)); padding: 7px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 255, 255, 0.98); box-shadow: 0 16px 35px rgba(54, 33, 75, 0.16); }
.content-set-option { display: block; width: 100%; min-width: 0; padding: 10px 12px; overflow: hidden; border: 0; border-radius: 10px; color: var(--ink); background: transparent; font-size: 0.88rem; font-weight: 800; line-height: 1.2; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.content-set-option:hover, .content-set-option:focus-visible { color: var(--purple-deep); background: var(--lilac); outline: 0; }
.content-set-option[aria-selected="true"] { color: var(--purple-deep); background: var(--pink); }
.pack-menu { position: relative; z-index: 1003; }
.pack-menu summary { list-style: none; }
.pack-menu summary::-webkit-details-marker { display: none; }
.pack-status { display: inline-flex; align-items: center; gap: 8px; max-width: min(300px, 52vw); padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.78); color: var(--ink-soft); font-size: 0.78rem; font-weight: 700; cursor: pointer; }
.pack-status #pack-status-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack-menu[open] .pack-status { border-color: #cdb2e5; background: var(--lilac); }
.pack-menu-popover { position: absolute; top: calc(100% + 9px); right: 0; z-index: 1100; width: min(340px, calc(100vw - 24px)); padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,0.98); box-shadow: 0 18px 42px rgba(54, 33, 75, 0.18); }
.pack-menu-popover .import-heading { align-items: flex-start; }
.pack-menu-popover .import-heading h2 { font-size: 1rem; }
.status-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #a7a0b3; }
.pack-status[data-tone="good"] .status-dot { background: #2a9a73; }
.pack-status[data-tone="warn"] .status-dot { background: #d48a19; }
.pack-status[data-tone="bad"] .status-dot { background: #cf4f5a; }

.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 8px clamp(18px, 4vw, 64px) 32px; }
.toolbar { position: relative; z-index: 40; display: flex; align-items: center; gap: 7px; margin-bottom: 12px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 246, 251, 0.88); box-shadow: 0 7px 20px rgba(126, 45, 96, 0.06); }
.filter-row { display: contents; }
.search-field, .select-field { position: relative; display: flex; align-items: center; min-height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: 0 5px 16px rgba(126, 45, 96, 0.04); }
.search-field { flex: 1 1 auto; }
.search-field { padding-left: 43px; }
.search-field input, .select-field select { width: 100%; height: 38px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-field input { padding: 0 38px 0 0; }
.search-field input::placeholder { color: #9990a7; }
.search-icon { position: absolute; left: 15px; color: var(--purple); font-size: 1.4rem; line-height: 1; }
.icon-button { position: absolute; right: 8px; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; color: var(--ink-soft); background: transparent; font-size: 1.25rem; cursor: pointer; }
.icon-button:hover { background: var(--lilac); }
.select-field { padding: 0 12px; }
.select-field select { cursor: pointer; }
.filter-toggles { display: flex; align-items: center; flex: 0 0 auto; flex-wrap: wrap; gap: 8px; }
.filter-toggle[hidden] { display: none; }
.filter-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 10px; border: 1px solid #e7bfd3; border-radius: 10px; color: var(--purple-deep); background: #fff; font-size: 0.72rem; font-weight: 800; cursor: pointer; white-space: nowrap; }
.filter-toggle:hover { background: var(--lilac); }
.filter-toggle input { width: 17px; height: 17px; margin: 0; accent-color: var(--purple); cursor: pointer; }
.facet-filters { display: flex; align-items: stretch; flex: 0 1 auto; flex-wrap: wrap; gap: 6px; max-width: 100%; overflow: visible; }
.facet-filter { position: relative; z-index: 1; display: grid; flex: 1 1 130px; align-content: center; gap: 3px; min-width: 112px; max-width: 190px; padding: 7px 9px 8px; border: 1px solid var(--line); border-radius: 11px; color: var(--purple-deep); background: rgba(255,255,255,0.96); box-shadow: 0 4px 12px rgba(126, 45, 96, 0.06); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.facet-filter.is-open { z-index: 20; border-color: #caa9df; box-shadow: 0 0 0 3px rgba(177, 63, 125, 0.11), 0 8px 18px rgba(126, 45, 96, 0.1); }
.facet-filter-label { color: var(--purple); font-size: 0.58rem; font-weight: 900; letter-spacing: 0.08em; line-height: 1; }
.facet-filter-button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; padding: 0; border: 0; color: var(--ink); background: transparent; font-size: 0.72rem; font-weight: 800; line-height: 1.15; text-align: left; cursor: pointer; }
.facet-filter-button:focus-visible { outline: 0; }
.facet-filter-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet-filter-chevron { flex: 0 0 auto; width: 7px; height: 7px; margin: -4px 2px 0 0; border-right: 2px solid var(--purple); border-bottom: 2px solid var(--purple); transform: rotate(45deg); transition: transform 0.15s ease; }
.facet-filter.is-open .facet-filter-chevron { margin-top: 4px; transform: rotate(225deg); }
.facet-filter-menu { position: absolute; top: calc(100% + 6px); left: -1px; z-index: 100; display: grid; gap: 3px; width: max-content; min-width: calc(100% + 2px); max-width: min(280px, calc(100vw - 30px)); max-height: min(320px, 52vh); overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,0.99); box-shadow: 0 16px 35px rgba(54, 33, 75, 0.17); }
.facet-filter-option { display: block; width: 100%; min-width: 0; padding: 8px 10px; overflow: hidden; border: 0; border-radius: 8px; color: var(--ink); background: transparent; font-size: 0.74rem; font-weight: 700; line-height: 1.2; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.facet-filter-option:hover, .facet-filter-option:focus-visible { color: var(--purple-deep); background: var(--lilac); outline: 0; }
.facet-filter-option[aria-selected="true"] { color: var(--purple-deep); background: var(--pink); }
.facet-filter-clear { align-self: center; min-height: 34px; padding: 0 9px; border: 1px solid #d9c0e8; border-radius: 9px; color: var(--purple-deep); background: var(--lilac); font-size: 0.67rem; font-weight: 800; cursor: pointer; }
.facet-filter-clear:hover { background: var(--pink); }

.import-panel { margin-bottom: 14px; padding: 17px 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,0.72); }
.import-heading, .section-heading, .content-heading, .lesson-heading-row, .app-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.import-heading h2, .section-heading h2 { margin-bottom: 0; font-size: 1.15rem; letter-spacing: -0.03em; }
.pack-contract, .subtle-label, .result-count { color: var(--ink-soft); font-size: 0.76rem; font-weight: 700; }
.pack-contract { padding: 5px 8px; border-radius: 7px; background: var(--lilac); color: var(--purple-deep); }
.import-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.progress-actions { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 2px; white-space: nowrap; }
.progress-actions-label { margin-right: 5px; color: var(--purple); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.12em; line-height: 1.25; text-transform: uppercase; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 13px; border: 1px solid transparent; border-radius: 10px; font-size: 0.82rem; font-weight: 800; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, background 0.15s; }
.button:hover { transform: translateY(-1px); box-shadow: 0 7px 14px rgba(54, 33, 75, 0.1); }
.button-secondary { border-color: #dbcbe9; color: var(--purple-deep); background: #fff; }
.button-quiet { border-color: transparent; color: var(--ink-soft); background: transparent; }
.button-update { border-color: #237f60; color: #fff; background: #2a9a73; }
.button-update:hover { border-color: #1d694f; background: #237f60; }
.button-update:disabled { border-color: #9ac9b8; color: #edf8f3; background: #83bda8; cursor: wait; }
.button input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.inline-message { min-height: 1.1em; margin: 9px 0 0; color: var(--ink-soft); font-size: 0.78rem; }
.inline-message[data-tone="bad"] { color: #a23b49; }
.inline-message[data-tone="good"] { color: #237459; }
.course-pack-list { display: grid; gap: 7px; max-height: min(310px, 42vh); margin: 12px 0; overflow: auto; }
.course-pack-card { min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px; background: #fffafd; }
.course-pack-card.is-active { border-color: #dba0bf; background: var(--lilac); }
.course-pack-heading, .course-pack-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.course-pack-heading strong { min-width: 0; overflow: hidden; font-size: 0.8rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.course-pack-badges { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 3px; }
.course-pack-badge { padding: 3px 5px; border-radius: 6px; color: var(--purple-deep); background: var(--pink); font-size: 0.58rem; font-weight: 800; white-space: nowrap; }
.course-pack-stats { margin: 6px 0 7px; color: var(--ink-soft); font-size: 0.67rem; line-height: 1.35; }
.course-pack-footer { align-items: baseline; }
.course-pack-source { min-width: 0; overflow: hidden; color: var(--ink-soft); font-size: 0.63rem; text-overflow: ellipsis; white-space: nowrap; }
.course-pack-action { flex: 0 0 auto; padding: 4px 8px; border: 1px solid #dbcbe9; border-radius: 7px; color: var(--purple-deep); background: #fff; font-size: 0.64rem; font-weight: 800; cursor: pointer; }
.course-pack-action:hover { background: var(--pink); }
.course-pack-empty { margin: 12px 0; color: var(--ink-soft); font-size: 0.76rem; }
.pack-menu-popover .import-actions { align-items: center; }
.pack-menu-popover .button-quiet { padding-right: 4px; padding-left: 4px; font-size: 0.7rem; }
.hosted-update-card { display: grid; gap: 10px; margin: 0 0 13px; padding: 12px; border: 1px solid #a9d8c4; border-radius: 13px; background: #effaf5; }
.hosted-update-heading { display: flex; align-items: flex-start; gap: 9px; color: #1e654e; }
.hosted-update-heading strong { display: block; font-size: 0.82rem; }
.hosted-update-heading p { margin: 4px 0 0; color: #477968; font-size: 0.74rem; line-height: 1.4; }
.hosted-update-icon { display: grid; flex: 0 0 auto; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: #fff; background: #2a9a73; font-size: 1rem; font-weight: 900; }
.hosted-update-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; color: #477968; font-size: 0.7rem; font-weight: 800; }
.hosted-update-progress progress { width: 100%; height: 8px; accent-color: #2a9a73; }

.library-layout { display: grid; grid-template-columns: minmax(260px, 0.34fr) minmax(0, 1fr); align-items: start; gap: 12px; }
.course-pane, .lesson-pane { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,0.78); box-shadow: var(--shadow); }
.course-pane { position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow: hidden; }
.section-heading { padding: 14px 16px 8px; }
.course-list { max-height: calc(100vh - 86px); overflow: auto; padding: 0 8px 9px; }
.course-list::-webkit-scrollbar, .lesson-list::-webkit-scrollbar { width: 8px; }
.course-list::-webkit-scrollbar-thumb, .lesson-list::-webkit-scrollbar-thumb { border-radius: 8px; background: #ded5e6; }
.course-selector { display: grid; width: 100%; min-width: 0; flex: 0 0 100%; box-sizing: border-box; gap: 2px; padding: 0 4px 6px; }
.course-selector-options { display: flex; width: 100%; min-width: 0; gap: 8px; overflow-x: auto; padding: 0 0 7px; }
.course-selector-options + .course-selector-options { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.course-selector-options::-webkit-scrollbar { height: 8px; }
.course-selector-options::-webkit-scrollbar-thumb { border-radius: 8px; background: #ded5e6; }
.course-selector-card { flex: 0 0 min(220px, 56vw); width: auto; min-width: 0; margin: 0; }
.course-selector-card:disabled { color: #93838f; background: #f3eff2; cursor: not-allowed; opacity: 0.72; }
.course-selector-card:focus-visible { outline: 3px solid rgba(177, 63, 125, 0.25); outline-offset: 1px; }
.course-card { width: 100%; margin: 0 0 5px; padding: 10px 11px; border: 1px solid transparent; border-radius: 12px; color: var(--ink); text-align: left; background: transparent; cursor: pointer; }
.course-card:hover { background: #faf6fd; }
.course-card[aria-current="true"] { border-color: #d8c3ec; background: var(--lilac); }
.course-card-title { display: flex; align-items: flex-start; gap: 9px; font-weight: 800; line-height: 1.25; }
.course-order { flex: 0 0 auto; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; color: var(--purple-deep); background: rgba(255,255,255,0.72); font-size: 0.7rem; }
.course-card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 0 33px; color: var(--ink-soft); font-size: 0.7rem; }
.course-empty { padding: 30px 14px; color: var(--ink-soft); text-align: center; font-size: 0.85rem; }

.lesson-pane { min-height: 600px; padding: clamp(16px, 2.2vw, 27px); }
.lesson-picker { margin: -4px 0 14px; border-bottom: 1px solid var(--line); }
.lesson-picker-heading { padding: 0 0 9px; }
.lesson-picker-heading > div:first-child, .lesson-heading-row > div:first-child { min-width: 0; }
.lesson-picker-heading h2 { width: 100%; max-width: 680px; overflow: hidden; line-height: 1.12; }
.lesson-picker-actions { display: flex; align-items: center; gap: 11px; }
.back-button { padding: 6px 9px; border: 1px solid #dbcbe9; border-radius: 8px; color: var(--purple-deep); background: #fff; font-size: 0.72rem; font-weight: 800; cursor: pointer; }
.back-button:hover { background: var(--lilac); }
.lesson-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; max-height: min(420px, 48vh); overflow: auto; padding: 0 0 11px; }
.chapter-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: min(420px, 48vh); overflow: auto; padding: 0 0 11px; }
.chapter-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 15px; border: 1px solid transparent; border-radius: 15px; color: var(--ink); text-align: left; background: linear-gradient(135deg, #fff0f7, #fffafd); cursor: pointer; }
.chapter-card:hover { border-color: #e5b5cd; background: #fff; box-shadow: 0 7px 16px rgba(126, 45, 96, 0.09); }
.chapter-card.is-locked { color: #93838f; background: #f3eff2; }
.chapter-card.is-locked:hover { border-color: #ded4dc; background: #f7f4f6; }
.chapter-card-number { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--purple-deep); background: var(--pink); font-size: 1.15rem; font-weight: 900; }
.chapter-card-main { display: block; min-width: 0; }
.chapter-card-main strong { display: block; font-size: 0.94rem; line-height: 1.2; }
.chapter-card-main span { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 0.72rem; }
.chapter-card-meta { line-height: 1.35; }
.chapter-card-progress { width: 100%; height: 5px; margin-top: 9px !important; overflow: hidden; border-radius: 999px; background: #edd6e2; }
.chapter-card-progress span { display: block; width: 0; height: 100%; margin: 0 !important; border-radius: inherit; background: linear-gradient(90deg, #d35c96, #b13f7d); }
.chapter-card.is-locked .chapter-card-number { color: #857682; background: #e3dce2; }
.chapter-card.is-locked .chapter-card-progress { background: #e3dce2; }
.chapter-card.is-locked .chapter-card-progress span { background: #a99ca7; }
.chapter-card-chevron { flex: 0 0 auto; margin-left: auto; color: var(--purple); font-size: 1.35rem; }
.lesson-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 3px; min-width: 0; padding: 0; border: 1px solid transparent; border-radius: 12px; color: var(--ink); background: #fff6fa; }
.lesson-row:hover { border-color: #e5b5cd; background: #fff; }
.lesson-row.is-current { border-color: #dba0bf; background: var(--lilac); }
.lesson-row.is-locked { color: #958593; border-color: #ebe2e8; background: #f3eff2; }
.lesson-row.is-locked:hover { border-color: #ddd3db; background: #f7f4f6; }
.lesson-row-open { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; padding: 10px 4px 10px 11px; border: 0; border-radius: 11px; color: inherit; text-align: left; background: transparent; cursor: pointer; }
.lesson-row-open:focus-visible { outline: 2px solid rgba(177, 63, 125, 0.45); outline-offset: -2px; }
.lesson-row-order { flex: 0 0 auto; min-width: 29px; color: var(--purple); font-size: 0.7rem; font-weight: 800; }
.lesson-row-main { display: block; min-width: 0; }
.lesson-row-main strong { display: block; min-height: 2.5em; max-height: 2.5em; overflow: hidden; font-size: 0.8rem; line-height: 1.25; overflow-wrap: anywhere; white-space: normal; }
.lesson-row-meta { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 0.67rem; }
.lesson-row-chevron { flex: 0 0 auto; margin-left: auto; color: var(--purple); font-size: 1.25rem; }
.lesson-row.is-locked .lesson-row-order, .lesson-row.is-locked .lesson-row-meta, .lesson-row.is-locked .lesson-row-chevron { color: #a597a2; }
.lesson-row.is-locked .lesson-row-main strong { color: #8f808c; }
.lesson-progress, .lesson-progress-detail { display: grid; place-items: center; border: 1px solid #e0a9c3; color: var(--purple-deep); background: #fff; font-weight: 900; cursor: pointer; }
.lesson-progress { align-self: center; width: 27px; height: 27px; margin: 0 8px 0 2px; border-radius: 9px; font-size: 1rem; }
.lesson-progress:hover, .lesson-progress[aria-pressed="true"] { border-color: var(--purple); background: var(--pink); }
.lesson-progress:disabled { border-color: #dcd3da; color: #a99da8; background: #e8e2e7; cursor: not-allowed; }
.lesson-progress-detail { min-height: 34px; padding: 7px 10px; border-radius: 10px; color: var(--purple-deep); font-size: 0.72rem; white-space: nowrap; }
.lesson-progress-detail:hover, .lesson-progress-detail[aria-pressed="true"] { background: var(--pink); }
.lesson-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
.empty-state { display: grid; place-items: center; min-height: 540px; padding: 30px; color: var(--ink-soft); text-align: center; }
.empty-state h2 { margin-bottom: 8px; color: var(--ink); font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -0.04em; }
.empty-state p:last-child { max-width: 440px; margin-bottom: 0; line-height: 1.55; }
.empty-icon { display: grid; place-items: center; width: 62px; height: 62px; margin-bottom: 18px; border-radius: 21px; color: var(--purple); background: var(--lilac); font-size: 2.2rem; }
.lesson-breadcrumb { margin-bottom: 11px; color: var(--ink-soft); font-size: 0.78rem; font-weight: 700; }
.lesson-breadcrumb span { color: var(--purple); }
.lesson-detail { scroll-margin-top: 12px; }
.lesson-heading-row { align-items: flex-start; margin-bottom: 18px; }
.lesson-heading-row h2 { max-width: 840px; margin-bottom: 0; font-size: clamp(1.7rem, 3.6vw, 3rem); line-height: 1.02; letter-spacing: -0.055em; }
#lesson-detail[data-access="locked"] .markdown-card, #lesson-detail[data-access="locked"] .resources-card { border-color: #e6dce3; background: #f7f3f6; }
#lesson-detail[data-access="locked"] .markdown-body { color: #958692; }
.access-badge { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; color: #8a3769; background: var(--mint); font-size: 0.72rem; font-weight: 800; }
.access-badge[data-access="locked"] { color: #827480; background: var(--amber); }
.video-card { position: relative; margin-bottom: 21px; overflow: hidden; border-radius: 18px; background: #201c27; box-shadow: 0 12px 28px rgba(32, 23, 52, 0.16); }
.video-card video { display: block; width: 100%; max-height: min(66vh, 640px); background: #201c27; cursor: pointer; touch-action: manipulation; }
.video-card video:fullscreen { width: 100vw; height: 100vh; max-height: none; border-radius: 0; object-fit: contain; background: #000; }
.video-card video:-webkit-full-screen { width: 100vw; height: 100vh; max-height: none; border-radius: 0; object-fit: contain; background: #000; }
.video-card:fullscreen { width: 100vw; height: 100vh; margin: 0; border-radius: 0; background: #000; }
.video-card:-webkit-full-screen { width: 100vw; height: 100vh; margin: 0; border-radius: 0; background: #000; }
.video-empty { display: grid; place-items: center; min-height: 180px; padding: 28px; color: #f6edf9; text-align: center; font-size: 0.9rem; line-height: 1.5; }
.lesson-content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 0.3fr); gap: 16px; align-items: start; }
.markdown-card, .resources-card { min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.content-heading { min-height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.content-heading h3 { margin: 0; font-size: 0.94rem; }
.markdown-body { padding: 22px clamp(16px, 3vw, 31px) 29px; color: #393245; font-size: 0.96rem; line-height: 1.72; overflow-wrap: anywhere; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 1.4em 0 0.5em; color: var(--ink); line-height: 1.2; letter-spacing: -0.03em; }
.markdown-body h1:first-child, .markdown-body h2:first-child, .markdown-body h3:first-child { margin-top: 0; }
.markdown-body h1 { font-size: 1.65rem; }.markdown-body h2 { font-size: 1.35rem; }.markdown-body h3 { font-size: 1.12rem; }.markdown-body h4 { font-size: 1rem; }
.markdown-body p { margin: 0 0 1em; }
.markdown-body ul, .markdown-body ol { margin: 0 0 1.1em; padding-left: 1.35em; }
.markdown-body li + li { margin-top: 0.32em; }
.markdown-body blockquote { margin: 1em 0; padding: 9px 15px; border-left: 4px solid #cdaae9; border-radius: 0 10px 10px 0; color: var(--ink-soft); background: #faf7fd; }
.markdown-body pre { overflow: auto; margin: 1em 0; padding: 13px; border-radius: 10px; color: #f9f4ff; background: #2b2238; font-size: 0.83rem; line-height: 1.5; }
.markdown-body code { padding: 2px 5px; border-radius: 5px; color: var(--purple-deep); background: #f2e9f8; font-size: 0.88em; }
.markdown-body pre code { padding: 0; color: inherit; background: transparent; }
.markdown-body hr { margin: 1.8em 0; border: 0; border-top: 1px solid var(--line); }
.markdown-body img { max-width: 100%; border-radius: 9px; }
.text-placeholder { color: var(--ink-soft); }
.resource-list { display: grid; gap: 8px; margin: 0; padding: 13px; list-style: none; }
.resource-item a, .resource-item .resource-missing { display: block; padding: 10px 11px; border-radius: 10px; font-size: 0.81rem; line-height: 1.3; text-decoration: none; }
.resource-item a { color: var(--purple-deep); background: #faf7fd; }.resource-item a:hover { background: var(--lilac); }
.resource-item .resource-missing { color: var(--ink-soft); background: #f7f5f8; }
.resource-name { display: block; font-weight: 800; }.resource-meta { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 0.7rem; }
.lesson-extras { display: grid; gap: 11px; padding: 0 16px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fffafd, #fff); }
.pbt-meta-row { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 14px; }
.pbt-meta-chip { display: inline-flex; align-items: baseline; gap: 5px; max-width: 100%; padding: 6px 8px; border: 1px solid #ead8e5; border-radius: 8px; color: var(--ink-soft); background: #fff; font-size: 0.68rem; line-height: 1.3; }
.pbt-meta-chip strong { color: var(--purple-deep); font-size: 0.63rem; text-transform: uppercase; letter-spacing: 0.04em; }
.pbt-extra-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; min-width: 0; }
.pbt-extra-card { min-width: 0; padding: 11px; border: 1px solid #ead8e5; border-radius: 12px; background: #fff; }
.pbt-collapsible { overflow: hidden; }
.pbt-collapsible > summary { list-style: none; margin: -11px; padding: 11px; cursor: pointer; }
.pbt-collapsible > summary::-webkit-details-marker { display: none; }
.pbt-collapsible > summary::after { flex: 0 0 auto; color: var(--purple); content: "+"; font-size: 1rem; font-weight: 900; }
.pbt-collapsible[open] > summary { margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.pbt-collapsible[open] > summary::after { content: "−"; }
.pbt-extra-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pbt-collapsible > summary.pbt-extra-heading { margin: -11px; }
.pbt-collapsible[open] > summary.pbt-extra-heading { margin: -11px -11px 8px; }
.pbt-extra-heading h4, .pbt-extra-title { margin: 0; color: var(--ink); font-size: 0.82rem; font-weight: 800; }
.pbt-extra-heading span { color: var(--ink-soft); font-size: 0.64rem; text-align: right; }
.pbt-extra-heading .pbt-extra-title { color: var(--ink); text-align: left; }
.pbt-chapter-list, .pbt-exercise-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; max-height: 290px; overflow: auto; }
.pbt-chapter-button, .pbt-exercise-link { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px; border: 1px solid transparent; border-radius: 9px; color: var(--ink); text-align: left; background: #fff8fc; cursor: pointer; }
.pbt-chapter-button:hover, .pbt-exercise-link:hover { border-color: #e2b8d0; background: var(--lilac); }
.pbt-chapter-time { flex: 0 0 auto; min-width: 32px; color: var(--purple); font-size: 0.65rem; font-variant-numeric: tabular-nums; font-weight: 800; }
.pbt-chapter-button strong, .pbt-exercise-link strong { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.7rem; }
.pbt-chapter-button small, .pbt-exercise-link small { display: block; margin-top: 2px; overflow: hidden; color: var(--ink-soft); text-overflow: ellipsis; white-space: nowrap; font-size: 0.62rem; }
.pbt-chapter-button > span:nth-child(2), .pbt-exercise-link > span:first-child { min-width: 0; flex: 1 1 auto; }
.pbt-chapter-button > span:last-child, .pbt-exercise-link > span:last-child { flex: 0 0 auto; color: var(--purple); font-weight: 900; }
.pbt-exercise-link.unavailable { color: var(--ink-soft); background: #f7f4f6; cursor: default; }
.pbt-exercise-link.unavailable:hover { border-color: transparent; background: #f7f4f6; }
.pbt-plan-card p { margin: 0; color: var(--ink-soft); font-size: 0.76rem; line-height: 1.5; }

.app-footer { max-width: 1440px; margin: 0 auto; padding: 16px clamp(18px, 4vw, 64px) 28px; color: var(--ink-soft); font-size: 0.73rem; }
.footer-cert-link { color: var(--ink-soft); font-size: 0.66rem; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.footer-cert-link:hover { color: var(--purple-deep); }
.app-header { z-index: 5000; }
.app-header .content-set-menu, .app-header .pack-menu-popover { z-index: 5100; }
.account-bar { display: flex; align-items: center; justify-content: flex-end; gap: 5px; min-width: 0; }
.profile-picker { display: inline-flex; min-width: 0; }
.profile-picker select, .account-button { min-height: 32px; border: 1px solid var(--line); border-radius: 9px; color: var(--purple-deep); background: #fff; font-size: 0.68rem; font-weight: 800; }
.profile-picker select { max-width: 132px; padding: 0 24px 0 8px; cursor: pointer; }
.account-button { padding: 0 8px; cursor: pointer; }
.account-button:hover { border-color: #dca7c0; background: var(--lilac); }
.account-button:disabled { color: #a89aa5; background: #f3eff2; cursor: not-allowed; }
.account-email { max-width: 160px; overflow: hidden; color: var(--ink-soft); font-size: 0.64rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.auth-gate { display: grid; min-height: min(68vh, 620px); place-items: center; padding: 36px 18px; }
.auth-card { width: min(100%, 470px); padding: clamp(24px, 5vw, 42px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,0.84); box-shadow: var(--shadow); text-align: center; }
.auth-card h2 { margin: 0 0 10px; font-size: clamp(1.6rem, 4vw, 2.25rem); letter-spacing: -0.05em; }
.auth-card p:not(.eyebrow) { margin: 0 auto 22px; max-width: 34rem; color: var(--ink-soft); line-height: 1.55; }
.button-primary { border-color: var(--purple-deep); color: #fff; background: var(--purple-deep); }
.button-primary:hover { border-color: #722039; background: #722039; }
.lesson-store-detail { min-height: 34px; padding: 7px 10px; border: 1px solid #dbcbe9; border-radius: 10px; color: var(--purple-deep); background: #fff; font-size: 0.72rem; font-weight: 800; white-space: nowrap; cursor: pointer; }
.lesson-store-detail:hover { border-color: #dca7c0; background: var(--lilac); }
.lesson-store-detail[data-state="stored"] { border-color: #a9d8c4; color: #237459; background: #effaf5; }
.lesson-store-detail[data-state="busy"] { color: var(--ink-soft); background: #f7f3f6; cursor: wait; }
.online-mode .import-actions { display: none; }
.online-mode .pack-contract { display: none; }
.online-mode .app-header { position: relative; }
.noscript-message { position: fixed; inset: 12px; z-index: 20; padding: 20px; border-radius: 12px; color: #fff; background: var(--ink); }
.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; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .library-layout { grid-template-columns: 1fr; }
  .course-pane { position: static; max-height: none; }
  .course-list { display: flex; gap: 8px; max-height: none; overflow-x: auto; padding: 0 10px 12px; }
  .course-card { flex: 0 0 min(220px, 56vw); margin: 0; }
  .lesson-content-grid { grid-template-columns: 1fr; }
  .resources-card { order: -1; }
}

@media (min-width: 901px) {
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
  .filter-row { display: flex; align-items: stretch; width: 100%; min-width: 0; gap: 6px; overflow: visible; }
  .filter-row .facet-filters, .filter-row .filter-toggles { display: contents; }
  .filter-row .facet-filter, .filter-row .filter-toggle, .filter-row .facet-filter-clear { flex: 1 1 0; min-width: 0; max-width: none; }
  .filter-row .filter-toggle { justify-content: center; overflow: hidden; text-overflow: ellipsis; }
  .course-selector { gap: 8px; }
  .course-selector-options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; overflow: visible; padding-bottom: 0; }
  .course-selector-card { flex: 0 0 auto; width: 100%; }
}

@media (max-width: 760px) {
  .app-header { gap: 8px; padding-right: 12px; padding-left: 12px; }
  .brand-lockup { gap: 8px; }
  .header-actions { gap: 6px; }
  .pack-menu { min-width: 0; }
  .pack-status { max-width: min(210px, 30vw); }
  .pack-menu-popover { right: 0; }
  .account-bar { gap: 4px; }
  .account-email { display: none; }
  .profile-picker select { max-width: 112px; }
  .account-button { padding-right: 7px; padding-left: 7px; }
}

@media (max-width: 640px) {
  .app-header { gap: 6px; padding-top: 8px; padding-right: 10px; padding-left: 10px; }
  .brand-logo { width: 43px; height: 43px; border-radius: 11px; }
  .brand-lockup { gap: 7px; }
  .brand-copy { max-width: clamp(112px, 37vw, 190px); }
  .eyebrow { margin-bottom: 3px; font-size: 0.52rem; letter-spacing: 0.08em; }
  .content-set-picker { max-width: 100%; }
  .content-set-button { gap: 5px; font-size: 1.14rem; }
  .content-set-arrow { font-size: 1.22rem; }
  .content-set-menu { left: 0; min-width: min(220px, calc(100vw - 24px)); }
  .pack-status { width: clamp(120px, 38vw, 180px); max-width: 44vw; padding: 6px 7px; gap: 5px; font-size: 0.59rem; }
  .pack-menu-popover { right: -4px; }
  .account-bar { max-width: 46vw; overflow-x: auto; }
  .account-button { min-width: 32px; padding: 0 6px; overflow: hidden; font-size: 0.61rem; text-overflow: ellipsis; }
  .profile-picker select { max-width: 92px; font-size: 0.61rem; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 4px; margin-bottom: 9px; padding: 4px; }
  .search-field { min-width: 0; }
  .search-field, .search-field input { min-height: 35px; height: 35px; }
  .search-field input { font-size: 0.8rem; }
  .filter-row { display: flex; align-items: stretch; width: 100%; min-width: 0; flex: 0 0 auto; gap: 5px; overflow: visible; }
  .filter-row .facet-filters, .filter-row .filter-toggles { display: contents; }
  .filter-row[data-filter-count="1"] .facet-filter, .filter-row[data-filter-count="1"] .filter-toggle, .filter-row[data-filter-count="1"] .facet-filter-clear { flex-basis: 100%; }
  .filter-row[data-filter-count="2"] .facet-filter, .filter-row[data-filter-count="2"] .filter-toggle, .filter-row[data-filter-count="2"] .facet-filter-clear { flex-basis: calc((100% - 5px) / 2); }
  .filter-row[data-filter-count="3"] .facet-filter, .filter-row[data-filter-count="3"] .filter-toggle, .filter-row[data-filter-count="3"] .facet-filter-clear,
  .filter-row[data-filter-count="0"] .facet-filter, .filter-row[data-filter-count="0"] .filter-toggle, .filter-row[data-filter-count="0"] .facet-filter-clear { flex-basis: calc((100% - 10px) / 3); }
  .filter-toggle { flex: 0 0 calc((100% - 10px) / 3); min-width: 0; justify-content: center; min-height: 32px; padding: 0 5px; gap: 4px; overflow: hidden; font-size: 0.61rem; text-overflow: ellipsis; white-space: nowrap; }
  .filter-toggle input { width: 14px; height: 14px; }
  .facet-filter { flex: 0 0 calc((100% - 10px) / 3); min-width: 0; max-width: none; padding: 6px 7px 7px; border-radius: 10px; }
  .facet-filter-label { font-size: 0.54rem; }
  .facet-filter-button { font-size: 0.68rem; }
  .facet-filter-menu { width: calc(100% + 2px); max-width: min(280px, calc(100vw - 24px)); }
  .facet-filter-clear { flex: 0 0 calc((100% - 10px) / 3); min-height: 32px; }
  .import-panel { padding: 15px; }
  .lesson-pane { min-height: 480px; padding: 14px 10px; border-radius: 16px; }
  .lesson-list { grid-template-columns: 1fr; max-height: min(48vh, 390px); }
  .chapter-list { grid-template-columns: 1fr; max-height: min(48vh, 390px); }
  .lesson-picker-actions { gap: 7px; }
  .lesson-heading-row { gap: 9px; }
  .lesson-heading-actions { align-items: flex-end; flex-direction: column; }
  .lesson-heading-row h2 { font-size: 1.75rem; }
  .access-badge { padding: 6px 8px; font-size: 0.65rem; }
  .video-empty { min-height: 140px; }
  .lesson-extras { padding-right: 10px; padding-left: 10px; }
  .pbt-extra-pair { gap: 6px; }
  .pbt-chapter-list, .pbt-exercise-list { grid-template-columns: 1fr; max-height: 260px; }
  .pbt-meta-chip { max-width: calc(50% - 3px); overflow: hidden; }
  .pbt-meta-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .course-selector { gap: 2px; padding-right: 0; padding-left: 0; }
  .course-selector-card { padding: 10px 9px; }
  .app-footer { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (max-width: 360px) {
  .app-header { gap: 5px; padding-right: 8px; padding-left: 8px; }
  .brand-logo { width: 40px; height: 40px; border-radius: 10px; }
  .brand-lockup { gap: 7px; }
  .brand-copy { max-width: 122px; }
  .brand-copy .eyebrow { font-size: 0.47rem; letter-spacing: 0.06em; }
  .content-set-button { font-size: 1.02rem; }
  .content-set-arrow { font-size: 1.15rem; }
  .pack-status { width: 128px; max-width: 128px; font-size: 0.53rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.001ms !important; }
}
