/* Local LMS — editorial design system.
   Warm-neutral surfaces, hairline borders, flat ink primary actions, a single
   restrained amber/copper accent used only for state. No gradients or glows.
   Light / Dark driven by [data-theme] on <html>. */

:root {
  --bg: #f4f3f0;
  --surface: #ffffff;
  --surface-2: #efede8;
  --surface-3: #e6e3dc;
  --border: #e6e3db;
  --border-strong: #d4d0c6;
  --text: #1b1915;
  --text-muted: #6a655c;
  --text-faint: #9c968b;

  --accent: #b45309;          /* copper — progress, current, links, focus */
  --accent-hover: #93420a;
  --accent-weak: #f3e9db;

  --ink: #211e19;             /* primary button / strong surfaces */
  --ink-hover: #38332b;
  --on-ink: #faf8f3;

  --success: #3c7a4b;
  --success-weak: #e4efe4;
  --danger: #a93c33;
  --danger-weak: #f6e6e3;

  --shadow-sm: 0 1px 2px rgba(28, 25, 20, 0.05);
  --shadow-md: 0 8px 24px -8px rgba(28, 25, 20, 0.22);
  --shadow-lg: 0 20px 48px -12px rgba(28, 25, 20, 0.30);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --header-h: 60px;

  --font: "Inter", "Söhne", -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121110;
  --surface: #1a1815;
  --surface-2: #211e1a;
  --surface-3: #2a2621;
  --border: #2d2924;
  --border-strong: #3d3831;
  --text: #f1efea;
  --text-muted: #a7a197;
  --text-faint: #6f685e;

  --accent: #e39338;
  --accent-hover: #efa655;
  --accent-weak: #2a2014;

  --ink: #f1efea;
  --ink-hover: #e1ddd3;
  --on-ink: #1a1815;

  --success: #5aa069;
  --success-weak: #19271b;
  --danger: #d2685d;
  --danger-weak: #2a1815;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 28px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 56px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.006em;
}

a { color: inherit; }
h1, h2, h3 { letter-spacing: -0.02em; font-weight: 650; }

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* themed scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

/* ---- buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 14px; min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer; font-weight: 550; font-size: 13.5px;
  transition: background .14s, border-color .14s, color .14s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(0.5px); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 1px solid transparent;
  border-radius: var(--radius-sm); background: transparent; color: var(--text-muted);
  cursor: pointer; transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---- app header ------------------------------------------------------- */

.app-header {
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.app-header .brand { font-weight: 650; font-size: 15.5px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-header .brand .logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--ink); color: var(--on-ink);
  display: grid; place-items: center; flex: none;
}
.app-header .brand .logo svg { width: 15px; height: 15px; }
.app-header .brand .title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-header .spacer { flex: 1; }

.theme-switch {
  display: inline-flex; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; gap: 1px;
}
.theme-switch button {
  border: none; background: transparent; color: var(--text-faint);
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; transition: background .14s, color .14s;
}
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.theme-switch svg { width: 15px; height: 15px; }

/* ---- library ---------------------------------------------------------- */

.library { max-width: 1160px; margin: 0 auto; padding: 32px 24px 72px; }

.continue-card {
  display: flex; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; margin-bottom: 36px;
  text-decoration: none; transition: border-color .15s;
}
.continue-card:hover { border-color: var(--border-strong); }
.continue-card .thumb {
  width: 128px; height: 72px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--on-ink); flex: none;
  display: grid; place-items: center; overflow: hidden;
}
.continue-card .thumb svg { width: 26px; height: 26px; }
.continue-card .cc-body { min-width: 0; flex: 1; }
.continue-card .cc-eyebrow { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.continue-card .cc-lesson { font-size: 17px; font-weight: 650; margin: 3px 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-card .cc-meta { color: var(--text-muted); font-size: 13px; }
.continue-card .cc-progress { height: 4px; background: var(--surface-3); border-radius: 2px; margin-top: 12px; overflow: hidden; max-width: 460px; }
.continue-card .cc-progress > span { display: block; height: 100%; background: var(--accent); }

.library-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-faint); pointer-events: none; }
.search-box input {
  width: 100%; padding: 10px 12px 10px 38px; min-height: 42px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color .14s;
}
.search-box input:focus { border-color: var(--accent); outline: none; }

.filter-group { display: inline-flex; gap: 1px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }
.filter-group button { border: none; background: transparent; color: var(--text-muted); padding: 7px 13px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 550; min-height: 36px; transition: background .14s, color .14s; }
.filter-group button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.sort-select select { padding: 9px 11px; min-height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 20px; }

.course-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit;
  transition: border-color .15s, transform .15s;
}
.course-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.course-card .art { aspect-ratio: 16 / 9; background: var(--surface-3); position: relative; display: grid; place-items: center; overflow: hidden; }
.course-card .art img { width: 100%; height: 100%; object-fit: cover; }
.course-card .art .fallback {
  width: 100%; height: 100%; display: grid; place-items: center;
  background: #211e19; color: #c3b6a2;
  font-weight: 600; font-size: 30px; letter-spacing: .06em;
}
.course-card .art .badge {
  position: absolute; top: 9px; right: 9px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 4px;
}
.course-card .badge .check { color: var(--success); display: inline-flex; }
.course-card .cc-info { padding: 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.course-card .cc-title { font-weight: 600; font-size: 14.5px; line-height: 1.38; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-card .bar { height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.course-card .bar > span { display: block; height: 100%; background: var(--accent); }
.course-card .cc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.course-card .cc-count { font-size: 12.5px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.course-card .cc-count .check { color: var(--success); display: inline-flex; }
.course-card .cc-action { font-size: 12.5px; font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 4px; transition: gap .15s; }
.course-card:hover .cc-action { gap: 7px; }
.course-card .cc-action svg { width: 14px; height: 14px; }

.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-state .big-icon { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--text-faint); }
.empty-state h2 { color: var(--text); margin: 0 0 8px; font-size: 19px; }
.empty-state p { margin: 0 0 18px; }
.empty-state code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }

/* ---- player workspace ------------------------------------------------- */

.player-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.player-header {
  height: var(--header-h); flex: none; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 20;
}
.player-header .lesson-name { font-weight: 600; font-size: 14.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-header .crumbs { color: var(--text-faint); font-size: 12.5px; }
.player-header .spacer { flex: 1; }

.workspace { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); overflow-y: auto; }

.video-shell { background: #000; display: flex; align-items: center; justify-content: center; width: 100%; position: relative; flex: none; }
.video-shell .video-box { position: relative; width: 100%; max-height: calc(100vh - var(--header-h) - 150px); aspect-ratio: 16 / 9; margin: 0 auto; }
.stage.theater .video-box { max-height: calc(100vh - var(--header-h)); }
.video-box video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: block; touch-action: none; }

.below-video { padding: 18px 24px 48px; max-width: 1080px; width: 100%; margin: 0 auto; }
.stage.theater .below-video { display: none; }

.lesson-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.lesson-bar .ltitle { font-size: 18px; font-weight: 650; min-width: 0; flex: 1; }
.lesson-bar .counter { color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.section-block h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin: 22px 0 10px; font-weight: 650; }
.bookmarks-list { display: flex; flex-direction: column; gap: 6px; }
.bookmark-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.bookmark-row .bm-time { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 600; }
.bookmark-row .bm-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bookmark-row .bm-actions { display: flex; gap: 2px; }
.muted { color: var(--text-muted); } .small { font-size: 13px; }

/* ---- outline ---------------------------------------------------------- */

.outline { width: 336px; flex: none; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.outline.collapsed { display: none; }
.outline-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--border); flex: none; }
.outline-head .otitle { font-weight: 650; font-size: 13px; letter-spacing: .02em; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; text-transform: uppercase; color: var(--text-muted); }
.outline-search { position: relative; }
.outline-search input { width: 100%; padding: 8px 10px 8px 32px; min-height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); transition: border-color .14s; }
.outline-search input:focus { border-color: var(--accent); outline: none; }
.outline-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.outline-progress { font-size: 11.5px; color: var(--text-muted); margin-top: 11px; display: flex; align-items: center; gap: 9px; }
.outline-progress .bar { flex: 1; height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.outline-progress .bar > span { display: block; height: 100%; background: var(--accent); }

.outline-tree { overflow-y: auto; padding: 8px 8px 24px; flex: 1; }
.tree-section > .sec-head { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 8px; border: none; background: transparent; cursor: pointer; border-radius: var(--radius-sm); color: var(--text); font-weight: 600; font-size: 13px; }
.tree-section > .sec-head:hover { background: var(--surface-2); }
.tree-section > .sec-head .chevron { width: 15px; height: 15px; transition: transform .15s; flex: none; color: var(--text-faint); }
.tree-section.open > .sec-head .chevron { transform: rotate(90deg); }
.tree-section > .sec-children { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; padding-left: 15px; }
.tree-section.open > .sec-children { grid-template-rows: 1fr; }
.tree-section > .sec-children > .sec-inner { overflow: hidden; min-height: 0; }
.sec-head .sec-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lesson-item { display: flex; align-items: flex-start; gap: 9px; width: 100%; text-align: left; padding: 7px 8px; border: none; background: transparent; cursor: pointer; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 13px; line-height: 1.4; position: relative; transition: background .12s, color .12s; }
.lesson-item:hover { background: var(--surface-2); color: var(--text); }
.lesson-item .state { width: 15px; height: 15px; flex: none; margin-top: 1px; position: relative; display: inline-flex; align-items: center; justify-content: center; }
.lesson-item .lname { min-width: 0; }
.lesson-item.current { background: var(--accent-weak); color: var(--text); font-weight: 600; }
.lesson-item.current::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2.5px; border-radius: 2px; background: var(--accent); }
.lesson-item.current .state { color: var(--accent); }
.lesson-item.completed .state { color: var(--success); }
.lesson-item.in-progress .state { color: var(--accent); }
.lesson-item.unstarted .state { color: var(--text-faint); }
.lesson-item.not-playable { opacity: .55; }
.lesson-item .lname .tag { font-size: 10.5px; color: var(--text-faint); }
.tree-hidden { display: none !important; }

/* now-playing equalizer */
.lesson-item .eq { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; gap: 2px; }
.lesson-item.playing .eq { display: inline-flex; }
.lesson-item.playing .state > svg { visibility: hidden; }
.lesson-item .eq i { width: 2.5px; height: 40%; background: var(--accent); border-radius: 2px; animation: eqbar .9s ease-in-out infinite; }
.lesson-item .eq i:nth-child(2) { animation-delay: .25s; }
.lesson-item .eq i:nth-child(3) { animation-delay: .5s; }

/* ---- custom video controls ------------------------------------------- */

.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 4px; padding: 10px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,.30) 55%, transparent);
  opacity: 0; transition: opacity .2s; z-index: 5; color: #fff; pointer-events: none;
}
.controls > * { pointer-events: auto; }
.video-box:hover .controls, .video-box.show-controls .controls, .controls:focus-within, .controls.sticky { opacity: 1; }

.seek-row { display: flex; align-items: center; gap: 8px; }
.seek { position: relative; flex: 1; height: 16px; display: flex; align-items: center; cursor: pointer; }
.seek .track { position: absolute; left: 0; right: 0; height: 4px; background: rgba(255,255,255,.26); border-radius: 2px; }
.seek .buffered { position: absolute; left: 0; height: 4px; background: rgba(255,255,255,.4); border-radius: 2px; }
.seek .played { position: absolute; left: 0; height: 4px; background: var(--accent); border-radius: 2px; }
.seek .thumb { position: absolute; width: 12px; height: 12px; background: #fff; border-radius: 50%; transform: translateX(-50%); transition: transform .12s; }
.video-box:hover .seek .thumb, .controls.sticky .seek .thumb { transform: translateX(-50%) scale(1.2); }
.seek .bm-marker { position: absolute; top: 1px; width: 2.5px; height: 12px; background: #fff; border-radius: 2px; transform: translateX(-50%); }
.seek input[type=range] { position: absolute; left: 0; right: 0; width: 100%; margin: 0; height: 16px; opacity: 0; cursor: pointer; }

.controls-row { display: flex; align-items: center; gap: 3px; }
.controls-row .cbtn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; color: #fff; cursor: pointer; border-radius: 7px; transition: background .14s; }
.controls-row .cbtn:hover { background: rgba(255,255,255,.16); }
.controls-row .cbtn svg { width: 19px; height: 19px; }
.controls-row .cbtn.wide { width: auto; padding: 0 9px; font-size: 12.5px; font-weight: 600; gap: 4px; font-variant-numeric: tabular-nums; }
.controls-row .time { font-size: 12px; font-family: var(--mono); padding: 0 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.controls-row .spacer { flex: 1; }
.vol-wrap { display: flex; align-items: center; }
.vol-wrap input[type=range] { width: 0; opacity: 0; transition: width .18s, opacity .18s; height: 3px; accent-color: #fff; }
.vol-wrap:hover input[type=range], .vol-wrap:focus-within input[type=range] { width: 72px; opacity: 1; margin: 0 6px 0 2px; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; bottom: 44px; right: 0; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; min-width: 152px; z-index: 10; max-height: 60vh; overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateY(6px) scale(.98); transform-origin: bottom right;
  transition: opacity .14s, transform .14s, visibility .14s;
}
.menu.open { opacity: 1; visibility: visible; transform: none; }
.menu .menu-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); padding: 5px 9px; font-weight: 650; }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; justify-content: space-between; padding: 8px 9px; border: none; background: transparent; color: inherit; border-radius: 7px; cursor: pointer; font-size: 13px; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button[aria-checked="true"] { color: var(--accent); font-weight: 600; }
.menu button .tick { width: 15px; height: 15px; opacity: 0; }
.menu button[aria-checked="true"] .tick { opacity: 1; }

.video-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; text-align: center; background: rgba(10,9,8,.86); color: #fff; z-index: 8; padding: 20px; }
.video-overlay.show { display: flex; }
.video-overlay .ov-card { max-width: 440px; }
.video-overlay h3 { margin: 0 0 8px; font-size: 18px; }
.video-overlay p { margin: 0 0 18px; color: #c9c4bb; font-size: 13.5px; line-height: 1.6; }
.video-overlay .ov-actions { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }
.big-play { position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%; background: rgba(0,0,0,.55); border: none; color: #fff; display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 6; transition: background .14s, transform .12s; }
.big-play:hover { background: rgba(0,0,0,.72); transform: scale(1.05); }
.big-play.show { display: flex; }
.big-play svg { width: 30px; height: 30px; }
.countdown-ring { font-variant-numeric: tabular-nums; font-weight: 700; }

/* buffering spinner + hold hints + seek tooltip */
.spinner { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 7; pointer-events: none; }
.spinner.show { display: flex; }
.spinner > span { width: 42px; height: 42px; border-radius: 50%; border: 3px solid rgba(255,255,255,.22); border-top-color: #fff; animation: spin .8s linear infinite; }

.hold-hint { position: absolute; top: 0; bottom: 0; width: 40%; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff; z-index: 7; pointer-events: none; }
.hold-hint.left { left: 0; --hx: -4px; background: radial-gradient(ellipse 80% 60% at left center, rgba(0,0,0,.5), transparent 72%); }
.hold-hint.right { right: 0; --hx: 4px; background: radial-gradient(ellipse 80% 60% at right center, rgba(0,0,0,.5), transparent 72%); }
.hold-hint.show { display: flex; }
.hold-hint .hint-glyph { display: flex; }
.hold-hint .hint-glyph svg { width: 28px; height: 28px; animation: hintPulse .7s ease-in-out infinite; }
.hold-hint .hint-glyph svg:nth-child(2) { animation-delay: .14s; margin-left: -8px; }
.hold-hint .hint-text { font: 700 13px/1 var(--font); letter-spacing: .03em; background: rgba(0,0,0,.55); padding: 4px 11px; border-radius: 20px; }

.seek-tip { position: absolute; bottom: 20px; transform: translateX(-50%); background: rgba(10,9,8,.94); color: #fff; font: 600 11px/1 var(--mono); padding: 4px 7px; border-radius: 5px; white-space: nowrap; opacity: 0; transition: opacity .12s; pointer-events: none; z-index: 6; }
.seek-tip.show { opacity: 1; }

/* ---- login ------------------------------------------------------------ */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 356px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 32px 28px; }
.login-box .brand { display: flex; justify-content: center; margin-bottom: 6px; }
.login-box .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; }
.login-box h1 { font-size: 20px; text-align: center; margin: 12px 0 2px; }
.login-box .sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
.login-box label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); display: block; margin: 14px 0 6px; }
.login-box input[type=text], .login-box input[type=password] { width: 100%; padding: 11px 12px; min-height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .14s; }
.login-box input:focus { border-color: var(--accent); outline: none; }
.login-box .btn-primary { width: 100%; margin-top: 22px; min-height: 44px; }
.login-error { background: var(--danger-weak); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-top: 14px; display: flex; align-items: center; gap: 8px; }

/* ---- toast / modal ---------------------------------------------------- */

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--ink); color: var(--on-ink); padding: 11px 17px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(10,9,8,.5); display: none; align-items: center; justify-content: center; z-index: 90; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); color: var(--text); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-width: 440px; width: 100%; padding: 24px; border: 1px solid var(--border); }
.modal h2 { margin: 0 0 16px; font-size: 17px; }
.shortcut-grid { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 13px; }
.shortcut-grid kbd { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 5px; padding: 2px 7px; font-size: 11.5px; justify-self: start; }
.modal .modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* ---- responsive ------------------------------------------------------- */

.outline-drawer-btn { display: none; }
.outline-backdrop { display: none; }

@media (max-width: 900px) {
  .workspace { flex-direction: column; }
  .outline { position: fixed; top: 0; right: 0; bottom: 0; width: min(86vw, 356px); transform: translateX(100%); transition: transform .22s; z-index: 60; border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  .outline.open { transform: translateX(0); }
  .outline.collapsed { display: flex; }
  .outline-drawer-btn { display: inline-flex; }
  .outline-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
  .video-shell .video-box { max-height: 56.25vw; }
  .controls { opacity: 1; }
}

@media (max-width: 560px) {
  .library { padding: 20px 16px 56px; }
  .continue-card { flex-direction: column; align-items: stretch; }
  .continue-card .thumb { width: 100%; height: 150px; }
  .course-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .controls-row .cbtn { width: 40px; height: 40px; }
}

/* ---- motion (restrained) --------------------------------------------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes growBar { from { width: 0; } }
@keyframes pop { 0% { transform: scale(.4); opacity: .4; } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes eqbar { 0%, 100% { height: 28%; } 50% { height: 100%; } }
@keyframes hintPulse { 0%, 100% { opacity: .45; transform: translateX(0); } 50% { opacity: 1; transform: translateX(var(--hx)); } }

.continue-card { animation: fadeUp .4s ease both; }
.course-card { animation: fadeUp .42s ease both; animation-delay: calc(var(--i, 0) * 34ms); }
.stage { animation: fadeIn .3s ease both; }
.course-card .bar > span, .continue-card .cc-progress > span { width: var(--w, 0%); animation: growBar .6s cubic-bezier(.33,1,.68,1) both; }
.course-card .bar > span, .continue-card .cc-progress > span, .outline-progress .bar > span { transition: width .45s cubic-bezier(.33,1,.68,1); }
.lesson-item .state.pop > svg:first-child { animation: pop .4s ease; }
.modal-backdrop.open { animation: fadeIn .16s ease; }
.modal-backdrop.open .modal { animation: modalIn .2s cubic-bezier(.2,.7,.2,1); }
.video-overlay.show { animation: fadeIn .18s ease; }
.big-play.show { animation: fadeIn .16s ease; }

html.theme-anim body, html.theme-anim .app-header, html.theme-anim .player-header,
html.theme-anim .course-card, html.theme-anim .continue-card, html.theme-anim .outline,
html.theme-anim .stage, html.theme-anim .modal, html.theme-anim .login-box, html.theme-anim .btn {
  transition: background-color .3s ease, border-color .3s ease, color .3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .continue-card, .course-card, .stage, .course-card .bar > span, .continue-card .cc-progress > span,
  .lesson-item .state.pop > svg:first-child, .modal-backdrop.open, .modal-backdrop.open .modal,
  .video-overlay.show, .big-play.show { animation: none !important; }
  .course-card .bar > span, .continue-card .cc-progress > span { width: var(--w, 0%); }
  .lesson-item .eq i, .spinner > span, .hold-hint .hint-glyph svg { animation: none !important; }
}
