:root {
  --bg: #f5f5f3; --surface: #ffffff; --surface-2: #efefec; --surface-3: #e6e6e2; --line: #deded9;
  --text: #1a1b1c; --text-2: #50545a; --accent: #1b6f5e; --accent-hover: #155a4c; --accent-ink: #ffffff;
  --accent-soft: #dff0ea; --danger: #a33a2c; --stage: #0b0c0d;
  --ow: 300px; --pw: 420px; --radius: 8px;
  --shadow: 0 12px 32px -12px rgb(0 0 0 / .28), 0 2px 8px -2px rgb(0 0 0 / .12);
  color-scheme: light;
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111213; --surface: #18191b; --surface-2: #141517; --surface-3: #222427; --line: #2b2d31;
    --text: #ebebe8; --text-2: #a9adb2; --accent: #4dbfa3; --accent-hover: #6fd0b8; --accent-ink: #062019;
    --accent-soft: #163029; --danger: #ef8b7b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111213; --surface: #18191b; --surface-2: #141517; --surface-3: #222427; --line: #2b2d31;
  --text: #ebebe8; --text-2: #a9adb2; --accent: #4dbfa3; --accent-hover: #6fd0b8; --accent-ink: #062019;
  --accent-soft: #163029; --danger: #ef8b7b; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
a.brand:hover, .les-main:hover .t { text-decoration: underline; text-underline-offset: 3px; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.ph, .ph-fill { font-size: 18px; line-height: 1; vertical-align: -3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ shell */
.app { display: grid; grid-template-rows: 52px 1fr; grid-template-columns: minmax(0, 1fr); height: 100dvh; }  /* long titles must not widen the page */
.top { display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; white-space: nowrap; }
.brand .ph-fill { color: var(--accent); font-size: 20px; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-2); font-size: 13px; }
.crumbs span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .ph { font-size: 12px; }
.top .grow { flex: 1; }
.search-btn { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; min-width: 240px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.search-btn:hover { border-color: var(--text-2); }
.search-btn kbd { margin-left: auto; }
kbd { font: 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 3px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--text-2); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius); color: var(--text-2); }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.sync { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.sync .ph-fill { color: var(--accent); font-size: 14px; }
.account { position: relative; }
.account > button { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 4px; border-radius: 17px; border: 1px solid var(--line); }
.account > button:hover { background: var(--surface-3); }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.acct-email { font-size: 13px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: 42px; z-index: 40; width: 300px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.menu h3 { margin: 6px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; text-align: left; font-size: 14px; }
.menu button:hover { background: var(--surface-3); }
.menu .check { margin-left: auto; color: var(--accent); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .hint { margin: 4px 10px 6px; font-size: 12px; color: var(--text-2); }

/* ------------------------------------------------------------ home */
.home { overflow: auto; padding: 32px 24px 64px; }
.home-inner { max-width: 960px; margin: 0 auto; }
.home h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.01em; }
.home h2 { font-size: 17px; margin: 32px 0 10px; }
.list { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.row h3 { margin: 0; font-size: 15px; font-weight: 600; }
.row p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 8px; max-width: 420px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 550; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.btn[aria-pressed="true"] .ph-fill { color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ------------------------------------------------------------ lesson layout */
.lesson { display: grid; grid-template-columns: var(--ow) 5px minmax(0, 1fr) 5px var(--pw); min-height: 0; }
.lesson.no-outline { grid-template-columns: 0 0 minmax(0, 1fr) 5px var(--pw); }
.lesson.no-panel { grid-template-columns: var(--ow) 5px minmax(0, 1fr) 0 0; }
.lesson.no-outline.no-panel { grid-template-columns: 0 0 minmax(0, 1fr) 0 0; }
.lesson.no-outline .outline, .lesson.no-panel .panel, .lesson.no-outline .g1, .lesson.no-panel .g2 { visibility: hidden; }
.gutter { cursor: col-resize; position: relative; background: transparent; }
.gutter::before { content: ""; position: absolute; top: 0; bottom: 0; left: 2px; width: 1px; background: var(--line); }
.gutter::after { content: ""; position: absolute; inset: 0 -4px; }
.gutter:hover::before, .gutter.drag::before { left: 1px; width: 3px; background: var(--accent); }
.outline, .panel { background: var(--surface-2); min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.main { min-height: 0; overflow: auto; padding: 16px 20px 40px; }
.main-inner { max-width: 1280px; margin: 0 auto; }

/* outline */
.o-head { padding: 12px 12px 8px; border-bottom: 1px solid var(--line); }
.o-head select { width: 100%; height: 34px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 8px; font-weight: 600; }
.o-prog { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.o-head .bar { max-width: none; margin-top: 4px; }
.o-filter { position: relative; margin-top: 10px; }
.o-filter input { width: 100%; height: 32px; padding: 0 8px 0 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.o-filter .ph { position: absolute; left: 9px; top: 7px; color: var(--text-2); }
.o-body { overflow: auto; padding: 4px 0 24px; flex: 1; }
.mod { border-bottom: 1px solid var(--line); }
.mod-row { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 10px; }
.mod-row .toggle { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; text-align: left; font-weight: 600; font-size: 14px; }
.mod-row .toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-row .toggle .ph { transition: transform .18s ease-out; color: var(--text-2); flex: none; }
.mod.open .mod-row .toggle .ph { transform: rotate(90deg); }
.mod-count { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.sec { padding: 10px 12px 4px 40px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.les { display: flex; align-items: flex-start; gap: 8px; padding: 6px 10px 6px 12px; position: relative; }
.les:hover { background: var(--surface-3); }
.les.current { background: var(--accent-soft); }
.les.current::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: var(--accent); }
.tick { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--text-2); margin-top: 1px; }
.tick:hover { background: var(--surface); color: var(--accent); }
.tick[aria-checked="true"] { color: var(--accent); }
.tick[aria-checked="mixed"] { color: var(--accent); }
.tick .ph, .tick .ph-fill { font-size: 20px; }
.les-main { flex: 1; min-width: 0; text-align: left; font-size: 14px; }
.les-main .t { display: block; }
.les-main .m { display: flex; gap: 10px; font-size: 12px; color: var(--text-2); margin-top: 1px; }
.les-main .m .ph { font-size: 13px; vertical-align: -2px; }
.les .bar { margin-top: 5px; height: 3px; }
.mod-empty { padding: 4px 12px 12px 40px; font-size: 13px; color: var(--text-2); }

/* player */
.player { position: relative; background: var(--stage); border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; max-height: calc(100dvh - 210px); margin: 0 auto; user-select: none; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--stage); }
.player video::cue { font-size: clamp(14px, 2.1vw, 24px); background: rgb(0 0 0 / .78); color: #fff; }
.player:fullscreen { max-height: none; border-radius: 0; }
.cap { position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%); max-width: 80%; padding: 4px 10px; background: rgb(0 0 0 / .78); color: #fff; font-size: clamp(14px, 2vw, 22px); line-height: 1.35; border-radius: 4px; text-align: center; pointer-events: none; }
.cap:empty { display: none; }
.ctrl { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 12px 8px; background: linear-gradient(transparent, rgb(0 0 0 / .72)); color: #f2f2f2; transition: opacity .2s ease-out; }
.player.idle .ctrl { opacity: 0; }
.player.idle { cursor: none; }
.ctrl .icon-btn { color: #f2f2f2; }
.ctrl .icon-btn:hover { background: rgb(255 255 255 / .14); color: #fff; }
.ctrl .icon-btn[aria-pressed="true"] { color: #7fe0c8; }
.ctrl-row { display: flex; align-items: center; gap: 2px; }
.ctrl-row .time { font-size: 13px; margin: 0 8px; white-space: nowrap; }
.ctrl-row .grow { flex: 1; }
.scrub { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.scrub .track { position: relative; height: 4px; width: 100%; border-radius: 2px; background: rgb(255 255 255 / .28); }
.scrub:hover .track { height: 6px; }
.scrub .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: #7fe0c8; }
.scrub .knob { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; }
.scrub .tip { position: absolute; bottom: 20px; transform: translateX(-50%); padding: 2px 6px; border-radius: 4px; background: rgb(0 0 0 / .85); font-size: 12px; display: none; }
.scrub:hover .tip { display: block; }
.speed-btn { height: 34px; min-width: 56px; padding: 0 8px; border-radius: var(--radius); color: #f2f2f2; font-weight: 650; font-size: 14px; }
.speed-btn:hover { background: rgb(255 255 255 / .14); }
.speed-pop { position: absolute; right: 12px; bottom: 64px; z-index: 5; width: 280px; padding: 14px; border-radius: 10px; background: #1c1e20; color: #eee; box-shadow: var(--shadow); }
.speed-pop .big { display: flex; align-items: center; justify-content: space-between; }
.speed-pop .big output { font-size: 24px; font-weight: 650; }
.speed-pop .step { width: 36px; height: 36px; border-radius: 8px; background: rgb(255 255 255 / .1); color: #fff; font-size: 18px; }
.speed-pop .step:hover { background: rgb(255 255 255 / .18); }
.speed-pop input[type=range] { width: 100%; margin: 14px 0 6px; accent-color: #7fe0c8; }
.speed-pop .scale { display: flex; justify-content: space-between; font-size: 11px; color: #b6b9bd; }
.big-play { position: absolute; inset: 0; display: grid; place-items: center; }
.big-play span { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: rgb(0 0 0 / .55); color: #fff; }
.big-play .ph-fill { font-size: 34px; }
.player.playing .big-play { display: none; }

/* lesson info */
.info { max-width: 1280px; margin: 14px auto 0; }
.info h1 { font-size: 20px; line-height: 1.3; margin: 0; letter-spacing: -0.005em; }
.info .meta { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.actions .grow { flex: 1; }
.resume-note { margin-top: 10px; font-size: 13px; color: var(--text-2); }
.upnext { margin-top: 28px; }
.upnext h2 { font-size: 15px; margin: 0 0 6px; }
.upnext a { display: flex; gap: 12px; align-items: baseline; padding: 9px 4px; border-top: 1px solid var(--line); font-size: 14px; }
.upnext a:hover { background: var(--surface-3); }
.upnext .n { color: var(--text-2); font-size: 13px; margin-left: auto; white-space: nowrap; }
@media (max-width: 820px) { .upnext { display: none; } }

/* panel */
.p-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); }
.p-tab { height: 38px; padding: 0 10px; font-size: 14px; font-weight: 550; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.p-tab:hover { color: var(--text); }
.p-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.p-tab .n { font-size: 12px; color: var(--text-2); margin-left: 3px; }
.p-tabs .grow { flex: 1; }
.p-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane { flex: 1; min-height: 0; overflow: auto; }
.pane[hidden] { display: none; }
.res-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px; font-size: 13px; color: var(--text-2); }
.res-group { padding: 10px 12px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.res { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; }
.res:hover { background: var(--surface-3); }
.res.sel { background: var(--accent-soft); }
.res .open { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-align: left; }
.res .ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); }
.res .ico .ph { font-size: 18px; }
.res .nm { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .sz { display: block; font-size: 12px; color: var(--text-2); }
.res .icon-btn { width: 30px; height: 30px; }
.preview { border-top: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; flex: 1.4; background: var(--surface); }
.preview[hidden] { display: none; }
.pv-bar { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.pv-bar .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pv-doc { flex: 1; overflow: auto; padding: 16px; background: var(--surface-3); }
.page { max-width: 560px; margin: 0 auto; aspect-ratio: 1 / 1.414; background: #fff; color: #1a1b1c; border-radius: 3px; box-shadow: 0 1px 3px rgb(0 0 0 / .18); padding: 9% 9%; display: flex; flex-direction: column; }
.page .kind { font-size: 12px; font-weight: 600; color: #50545a; }
.page h4 { margin: 6px 0 14px; font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; }
.page p { margin: 0 0 10px; font-size: 14px; color: #3d4045; max-width: 46ch; }
.page .foot { margin-top: auto; font-size: 12px; color: #50545a; border-top: 1px solid #e3e3df; padding-top: 10px; }
.notes { padding: 14px 16px 24px; font-size: 15px; max-width: 70ch; }
.notes .src { font-size: 12px; color: var(--text-2); margin-bottom: 12px; display: flex; gap: 6px; align-items: center; }
.notes ul { padding-left: 20px; margin: 8px 0; }
.notes li { margin: 3px 0; }
.empty { padding: 28px 20px; text-align: center; color: var(--text-2); font-size: 14px; }
.empty .ph { font-size: 28px; display: block; margin: 0 auto 8px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 15px; }
.tr-tools { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
.tr-tools input { flex: 1; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.follow { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.tr-line { display: grid; grid-template-columns: 56px 1fr; gap: 6px; width: 100%; padding: 8px 14px 8px 8px; text-align: left; font-size: 14px; line-height: 1.5; }
.tr-line:hover { background: var(--surface-3); }
.tr-line .ts { font-size: 12px; color: var(--accent); padding-top: 2px; text-align: right; }
.tr-line.on { background: var(--accent-soft); }
.tr-line mark { background: #f3d36b; color: #1a1b1c; border-radius: 2px; }
.tr-dl { display: flex; gap: 6px; padding: 10px 12px 18px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text-2); }
.tr-dl .btn { height: 30px; padding: 0 10px; font-size: 13px; }

/* search */
dialog.search { width: min(720px, calc(100vw - 24px)); max-height: min(640px, calc(100dvh - 80px)); margin-top: 8vh; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog.search::backdrop { background: rgb(0 0 0 / .35); }
.s-in { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.s-in input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; }
.s-scope { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.s-scope button { padding: 4px 10px; border-radius: 14px; border: 1px solid var(--line); font-size: 13px; }
.s-scope button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.s-res { overflow: auto; max-height: calc(min(640px, 100dvh - 80px) - 110px); padding: 4px 0 10px; }
.s-group { padding: 10px 14px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.s-hit { display: block; width: 100%; text-align: left; padding: 8px 14px; }
.s-hit:hover, .s-hit:focus-visible { background: var(--surface-3); outline-offset: -2px; }
.s-hit .a { font-size: 14px; font-weight: 550; }
.s-hit .b { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.s-hit mark { background: #f3d36b; color: #1a1b1c; border-radius: 2px; }
.s-note { padding: 8px 14px 4px; font-size: 12px; color: var(--text-2); }

/* toast + shortcuts */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 32px); padding: 9px 14px; border-radius: 8px; background: #1f2123; color: #f1f1f1; font-size: 14px; box-shadow: var(--shadow); }
.toast[hidden] { display: none; }
dialog.keys { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); padding: 18px 20px; width: min(460px, calc(100vw - 24px)); }
dialog.keys::backdrop { background: rgb(0 0 0 / .35); }
dialog.keys h2 { margin: 0 0 10px; font-size: 17px; }
dialog.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0; font-size: 14px; }
dialog.keys dt { white-space: nowrap; }
.mtabs { display: none; }
.scrim { display: none; }

/* ------------------------------------------------------------ tablet: outline becomes a drawer */
@media (max-width: 1180px) and (min-width: 821px) {
  .lesson, .lesson.no-outline { grid-template-columns: 0 0 minmax(0, 1fr) 5px var(--pw); }
  .lesson.no-panel, .lesson.no-outline.no-panel { grid-template-columns: 0 0 minmax(0, 1fr) 0 0; }
  .g1 { display: none; }
  .outline { position: fixed; left: 0; top: 52px; bottom: 0; width: min(340px, 86vw); z-index: 30; box-shadow: var(--shadow); transform: translateX(-102%); transition: transform .2s ease-out; visibility: visible !important; }
  .lesson.drawer .outline { transform: none; }
  .lesson.drawer .scrim { display: block; position: fixed; inset: 52px 0 0 0; z-index: 29; background: rgb(0 0 0 / .3); }
  .search-btn { min-width: 0; }
  .search-btn .lbl, .search-btn kbd { display: none; }
}

/* ------------------------------------------------------------ phones: sticky player + tabs */
@media (max-width: 820px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; grid-template-rows: 48px auto; }
  .top { padding: 0 6px 0 12px; gap: 4px; }
  .crumbs, .sync, .acct-email, .search-btn .lbl, .search-btn kbd, .desk { display: none !important; }
  .search-btn { min-width: 0; width: 34px; padding: 0; justify-content: center; border: 0; background: none; }
  .account > button { border: 0; padding: 0 4px; }
  .lesson, .lesson.no-outline, .lesson.no-panel, .lesson.no-outline.no-panel { display: flex; flex-direction: column; }
  .player { order: 1; } .info { order: 2; } .mtabs { order: 3; } .outline, .panel { order: 4; } .upnext { order: 5; }
  .gutter { display: none; }
  .main, .main-inner { display: contents; } /* lets the player and tab bar stay pinned over the lists below */
  .player { position: sticky; top: 0; z-index: 20; border-radius: 0; max-height: none; width: 100%; }
  .info { padding: 12px 16px 0; margin-top: 0; }
  .info h1 { font-size: 18px; }
  .actions { margin-top: 12px; }
  .actions .btn { flex: 1; padding: 0 8px; }
  .actions .grow { display: none; }
  .mtabs { display: flex; position: sticky; top: calc(100vw * 9 / 16); z-index: 15; background: var(--surface); border-bottom: 1px solid var(--line); margin-top: 14px; overflow-x: auto; }
  .mtabs button { flex: 1; height: 44px; padding: 0 10px; font-size: 14px; font-weight: 550; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; }
  .mtabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
  .outline, .panel { visibility: visible !important; background: var(--surface-2); min-height: 60vh; }
  .o-body, .pane { overflow: visible; }
  .lesson[data-mtab="lessons"] .panel, .lesson:not([data-mtab="lessons"]) .outline { display: none; }
  .p-tabs { display: none; }
  .preview { flex: none; }
  .pv-doc { overflow: visible; }
  .cap { bottom: 56px; font-size: 14px; }
  .ctrl { padding: 22px 6px 4px; }
  .ctrl .hide-s { display: none; }
  .speed-pop { right: 8px; left: 8px; width: auto; bottom: 56px; }
  .home { padding: 20px 16px 48px; overflow: visible; }
  .row { grid-template-columns: 1fr; gap: 10px; }
  .row .btn { justify-self: start; }
  .les { padding: 9px 12px; }
  .tick { width: 30px; height: 30px; margin-top: -3px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ------------------------------------------------------------ app additions over the approved mockup */
.login { display: grid; place-items: center; padding: 24px 16px; overflow: auto; }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 6px; padding: 28px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.login-card h1 { display: flex; align-items: center; gap: 8px; font-size: 20px; margin: 0 0 14px; }
.login-card h1 .ph-fill { color: var(--accent); font-size: 22px; }
.login-card label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-top: 6px; }
.login-card input { height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font-size: 16px; }
.login-card input:focus-visible { outline-offset: 0; }
.lg-err { min-height: 18px; margin: 4px 0 2px; font-size: 13px; color: var(--danger); }
.login-card .btn { height: 40px; }
body.signed-out .account, body.signed-out .search-btn, body.signed-out .sync { display: none !important; }
.poster { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 6% 7%; color: #f2f2f2; pointer-events: none; }
.poster .k { color: #7fe0c8; font-size: clamp(12px, 1.6vw, 18px); font-weight: 600; }
.poster .t { font-size: clamp(18px, 3.4vw, 40px); font-weight: 700; line-height: 1.15; margin-top: 8px; max-width: 24ch; }
.poster .ph { font-size: clamp(28px, 5vw, 56px); color: #7fe0c8; margin-bottom: 12px; }
.player.is-text { display: none; }
.text-body { max-width: 72ch; margin: 4px 0 0; font-size: 15px; line-height: 1.6; }
.text-body a, .notes a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.warn { margin-top: 10px; font-size: 13px; color: var(--danger); }
.spin { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.spin i { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgb(255 255 255 / .25); border-top-color: #fff; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.player:not(.waiting) .spin { display: none; }
.node-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 10px; }
.node-row .toggle { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; text-align: left; font-size: 14px; font-weight: 600; }
.node-row .toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-row .toggle .ph { transition: transform .18s ease-out; color: var(--text-2); flex: none; }
.node.open > .node-row .toggle .ph { transform: rotate(90deg); }
.node .node { margin-left: 14px; border-left: 1px solid var(--line); }
.node .node .node-row .toggle { font-weight: 550; }
.node.root { border-bottom: 1px solid var(--line); }
.mod-files { padding: 4px 12px 8px 40px; font-size: 13px; color: var(--text-2); }
.skel { height: 14px; margin: 10px 14px; border-radius: 4px; background: var(--surface-3); }
.pdfv { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pdfv canvas { width: 100%; max-width: 900px; height: auto; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .18); border-radius: 2px; }
.pdfv .pg { width: 100%; max-width: 900px; aspect-ratio: 1 / 1.414; background: #fff; opacity: .6; border-radius: 2px; }
.pv-img { max-width: 100%; height: auto; display: block; margin: 0 auto; background: #fff; }
.pv-text { white-space: pre-wrap; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface); padding: 14px; border-radius: 6px; margin: 0; color: var(--text); }
.pv-audio { width: 100%; }
.pv-note { padding: 18px; color: var(--text-2); font-size: 14px; text-align: center; }
.zip-dir { padding: 8px 12px 2px 24px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.res.child { padding-left: 28px; }
.res .caret { width: 22px; color: var(--text-2); }
.sync.off .ph-fill, .sync.off .ph { color: var(--danger); }
.who { font-size: 12px; color: var(--text-2); margin: 0 10px 6px; }
.outline, .panel, .main { min-width: 0; }
