/* ============================================================
   LearnMaxx — shared theme (Blazor RCL). Dark media-player look.
   ============================================================ */
:root {
  --ink-950: #0a0c12;
  --ink-900: #0e1118;
  --ink-850: #12151f;
  --ink-800: #171b27;
  --ink-700: #1f2433;
  --ink-600: #2a3042;
  --ink-500: #3a4255;
  --accent-200: #ffdd8a;
  --accent-300: #ffca52;
  --accent-400: #ffba2e;
  --accent-500: #ffb020;
  --accent-600: #e0930b;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --emerald: #34d399;
  --danger: #f87171;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  background: var(--ink-950);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-400); outline-offset: 2px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--ink-600) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--ink-600); border-radius: 9999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-500); }

/* ---------- App shell ---------- */
.app-shell { display: flex; flex-direction: column; height: 100vh; }
.app-main { flex: 1; min-height: 0; }
/* stable gutter: the centered content must not shift when a filter change
   makes the scrollbar appear/disappear */
.scroll-area { height: 100%; overflow-y: auto; scrollbar-gutter: stable; }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 30; height: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--ink-800);
  background: color-mix(in srgb, var(--ink-950) 90%, transparent);
  backdrop-filter: blur(8px);
}
.header__left { display: flex; align-items: center; gap: 20px; }
.header__right { display: flex; align-items: center; gap: 10px; }

/* Sync status chip (click = sync now) */
.sync-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px;
  border: 1px solid var(--ink-700); border-radius: 999px; background: transparent;
  font-size: 12px; color: var(--text-dim); white-space: nowrap;
  transition: background .15s, color .15s;
}
.sync-chip:hover { background: var(--ink-800); color: var(--text); }
.sync-chip:disabled { opacity: .6; pointer-events: none; }
.sync-chip__dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
@media (max-width: 680px) {
  .sync-chip { padding: 0 9px; }
  .sync-chip__label { display: none; }
}
.brand { display: flex; align-items: center; gap: 10px; color: #f8fafc; }
.brand__mark {
  display: flex; align-items: center; justify-content: center;
  height: 32px; width: 32px; border-radius: 9px; color: #f8fafc;
  background: linear-gradient(135deg, #242b48 0%, #1d243b 100%);
  border: 1px solid #2b3452;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.brand__name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav__link {
  border-radius: 8px; padding: 6px 12px; font-size: 14px; font-weight: 500;
  color: var(--text-dim); background: transparent; border: none; transition: background .15s, color .15s;
}
.nav__link:hover { background: color-mix(in srgb, var(--ink-800) 60%, transparent); color: var(--text); }
.nav__link--active { background: var(--ink-800); color: #f1f5f9; }
@media (max-width: 639px) { .nav { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; border: none; border-radius: 8px; font-weight: 600;
  height: 40px; padding: 0 16px; font-size: 14px; transition: background .15s, color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; pointer-events: none; }
.btn--sm { height: 32px; padding: 0 12px; border-radius: 8px; }
.btn--lg { height: 44px; padding: 0 20px; border-radius: 12px; font-size: 16px; }
/* Primary action: dark slate-indigo with a subtle premium gradient. Each state
   keeps a gradient (background-image can't transition, so a flat hover would
   snap) — the pairs average out to the spec'd flat tones #1f253d/#293250/#181e32. */
.btn--primary {
  background: linear-gradient(135deg, #1d243b 0%, #242b48 100%);
  color: #f8fafc;
  border: 1px solid #2b3452;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: background-color 150ms ease, border-color 150ms ease, transform 100ms ease, opacity .15s;
}
.btn--primary:hover { background: linear-gradient(135deg, #262e4a 0%, #2c3656 100%); border-color: #394464; }
.btn--primary:active { background: linear-gradient(135deg, #161c2e 0%, #1a2036 100%); transform: translateY(1px); }
.btn--primary:focus-visible { outline: 2px solid #64748b; outline-offset: 2px; }
.btn--subtle { background: var(--ink-700); color: #f1f5f9; }
.btn--subtle:hover { background: var(--ink-600); }
.btn--ghost { background: transparent; color: var(--text-dim); }
.btn--ghost:hover { background: var(--ink-700); color: var(--text); }
.btn--danger { background: color-mix(in srgb, var(--danger) 90%, transparent); color: #fff; }
.btn--danger:hover { background: var(--danger); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; width: 36px; border-radius: 8px; border: none; background: transparent;
  color: var(--text-dim); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--ink-700); color: var(--text); }
.icon-btn:disabled { opacity: .4; pointer-events: none; }

/* ---------- Inputs ---------- */
.field { display: block; }
.field__label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--text); }
.field__hint { display: block; margin-top: 4px; font-size: 12px; color: var(--text-faint); }
.input, .textarea {
  width: 100%; border: 1px solid var(--ink-600); background: var(--ink-900); color: #f1f5f9;
  border-radius: 8px; padding: 8px 12px; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent-500); box-shadow: 0 0 0 1px var(--accent-500); }
.textarea { min-height: 80px; resize: vertical; }

.search { position: relative; }
.search__icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search input { width: 100%; border: 1px solid var(--ink-600); background: var(--ink-900); color: #f1f5f9; border-radius: 8px; padding: 8px 32px; font-size: 14px; }
.search input:focus { outline: none; border-color: var(--accent-500); box-shadow: 0 0 0 1px var(--accent-500); }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: none; background: none; color: var(--text-faint); padding: 2px; border-radius: 4px; }
.search__clear:hover { color: var(--text); }

/* ---------- Progress bar ---------- */
.progress { height: 4px; width: 100%; overflow: hidden; border-radius: 9999px; background: var(--ink-600); }
.progress__fill { height: 100%; border-radius: 9999px; background: var(--accent-500); transition: width .3s; }
.progress--done .progress__fill { background: var(--emerald); }

/* ---------- Page containers ---------- */
.page { max-width: 1152px; margin: 0 auto; padding: 32px 24px; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page__title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; color: #f8fafc; }
.page__subtitle { margin-top: 4px; font-size: 14px; color: var(--text-dim); }

/* ---------- Empty / message states ---------- */
.empty { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 96px 24px; }
.empty__art { position: relative; margin-bottom: 24px; display: flex; height: 96px; width: 96px; align-items: center; justify-content: center; border-radius: 24px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent-500) 20%, transparent), color-mix(in srgb, var(--accent-600) 10%, transparent)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-500) 20%, transparent); color: var(--accent-400); }
.empty h2 { font-size: 20px; font-weight: 600; color: #f1f5f9; }
.empty p { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--text-dim); }
.no-results { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 1px dashed var(--ink-700); border-radius: 12px; padding: 64px 24px; text-align: center; color: var(--text-dim); }
.link-btn { background: none; border: none; color: var(--accent-400); font-size: 14px; }
.link-btn:hover { color: var(--accent-300); }

/* ---------- Folder-access prompt (player: reconnect / connect course) ---------- */
/* Sits inside .empty for centering; adds a privacy-forward badge, a status
   chip, a full-width touch target, and a "files stay on device" footer. */
.access__badge { position: relative; margin-bottom: 20px; display: flex; height: 88px; width: 88px; align-items: center; justify-content: center; border-radius: 24px; background: color-mix(in srgb, var(--accent-500) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-500) 22%, transparent); color: var(--accent-300); }
.access__sub { position: absolute; right: -6px; bottom: -6px; display: flex; height: 34px; width: 34px; align-items: center; justify-content: center; border-radius: 999px; background: var(--ink-800); box-shadow: 0 0 0 1px var(--ink-600); }
.access__sub--lock { color: var(--accent-400); }
.access__sub--ok { color: #5dcaa5; }
.access__chip { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 12px; border-radius: 999px; border: 1px solid var(--ink-700); background: var(--ink-850); padding: 3px 11px; font-size: 12px; color: var(--text-dim); }
.access__chip--ok { color: #5dcaa5; border-color: color-mix(in srgb, #5dcaa5 35%, var(--ink-700)); }
.access .access__text { max-width: 20rem; }
.access__btn { margin-top: 22px; width: 100%; max-width: 320px; justify-content: center; }
.access__note { margin-top: 14px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-500); }
.access__error { margin-top: 12px; max-width: 30rem; font-size: 13px; color: var(--danger); }

/* ---------- Home layout: library sidebar + course grid ---------- */
.home { display: flex; height: 100%; }
.home__sidebar { width: 380px; flex-shrink: 0; border-right: 1px solid var(--ink-700); background: var(--ink-900); min-height: 0; overflow-y: auto; }
@media (max-width: 767px) { .home__sidebar { display: none; } }
.home__main { flex: 1; min-width: 0; }
.home__menu-btn { display: none; }
@media (max-width: 767px) { .home__menu-btn { display: inline-flex; } }
/* The sidebar eats 380px, so the card grid gets its own breakpoints. */
.home__main .grid { grid-template-columns: 1fr; }
@media (min-width: 640px) { .home__main .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) and (max-width: 1279px) { .home__main .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1280px) { .home__main .grid { grid-template-columns: 1fr 1fr 1fr; } }
/* Full HD and up: widen the page cap (default 1152px) so 4 columns fit at
   the same ~350px card width the 3-column layout has. */
@media (min-width: 1700px) {
  .home__main .page { max-width: 1560px; }
  .home__main .grid { grid-template-columns: repeat(4, 1fr); }
}

.hsb { display: flex; flex-direction: column; gap: 20px; min-height: 100%; width: 100%; padding: 24px 16px 16px; }
.hsb__label { margin-bottom: 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.hsb__chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* constant font-weight: the active state must not change chip width */
.chip { border: 1px solid var(--ink-600); background: transparent; color: var(--text-dim); border-radius: 9999px; padding: 4px 12px; font-size: 12px; font-weight: 500; }
.chip:hover { color: var(--text); border-color: var(--ink-500); }
/* Active = the buttons' slate gradient. Border is a step brighter than the
   buttons' (#2b3452) because the inactive chip border (--ink-600 #2a3042) is
   nearly the same color — the active edge must still read at chip size. */
.chip--active {
  background: linear-gradient(135deg, #1d243b 0%, #242b48 100%);
  border-color: #394464; color: #f8fafc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.chip--active:hover { color: #f8fafc; border-color: #465278; background: linear-gradient(135deg, #262e4a 0%, #2c3656 100%); }
.hsb__select {
  width: 100%; appearance: auto; border: 1px solid var(--ink-600); border-radius: 8px;
  background: var(--ink-850); color: var(--text); font: inherit; font-size: 13px; padding: 8px 10px;
}
.hsb__select:hover { border-color: var(--ink-500); }
.hsb__stats { margin-top: auto; display: flex; gap: 20px; border-top: 1px solid var(--ink-800); padding-top: 14px; }
.hsb__stat { font-size: 11px; color: var(--text-faint); }
.hsb__stat b { display: block; font-size: 16px; font-weight: 600; color: #f1f5f9; }

/* ---------- Tags: display chips + picker ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 9999px; background: color-mix(in srgb, var(--accent-500) 14%, transparent);
  color: var(--accent-300); padding: 2px 9px; font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.tag--more { background: var(--ink-700); color: var(--text-dim); }
/* Card tags double as filter shortcuts (rendered as buttons). */
.tag--link { border: none; }
.tag--link:hover { background: color-mix(in srgb, var(--accent-500) 28%, transparent); color: var(--accent-200); }
.card__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.tags { position: relative; }
.tags__box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  border: 1px solid var(--ink-600); border-radius: 10px; background: var(--ink-850);
  padding: 8px 10px; cursor: text;
}
.tags__box:focus-within { border-color: var(--accent-500); }
.tag--edit { font-size: 12px; padding: 3px 6px 3px 10px; }
.tag__x { display: flex; align-items: center; border: none; background: none; color: inherit; padding: 2px; border-radius: 9999px; opacity: .7; }
.tag__x:hover { opacity: 1; background: rgba(0,0,0,.3); }
.tags__input { flex: 1; min-width: 120px; border: none; background: none; color: var(--text); font: inherit; font-size: 14px; outline: none; padding: 2px; }
.tags__input::placeholder { color: var(--text-faint); }
.tags__menu {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30; margin-top: 6px;
  max-height: 240px; overflow-y: auto; border: 1px solid var(--ink-600); border-radius: 10px;
  background: var(--ink-800); box-shadow: 0 10px 30px rgba(0,0,0,.5); padding: 4px 0;
}
.tags__option {
  display: flex; width: 100%; align-items: center; gap: 8px; border: none; background: none;
  padding: 7px 12px; text-align: left; font-size: 13px; color: var(--text);
}
.tags__option:hover { background: var(--ink-700); }
.tags__option--custom { color: var(--accent-300); }

.cw {
  display: flex; flex-direction: column; gap: 6px; width: 100%; margin-bottom: 8px;
  border: 1px solid var(--ink-800); border-radius: 10px; background: var(--ink-850);
  padding: 10px 12px; text-align: left;
}
.cw:hover { border-color: var(--ink-600); background: var(--ink-800); }
.cw__name { font-size: 13px; font-weight: 500; color: #f1f5f9; }
.cw__lesson { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; color: var(--text-dim); }

/* ---------- Course grid + cards ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .grid { grid-template-columns: 1fr 1fr 1fr; } }

.card {
  display: flex; flex-direction: column; overflow: hidden; border-radius: 16px;
  border: 1px solid var(--ink-700); background: var(--ink-850); cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-2px); border-color: var(--ink-600); box-shadow: 0 20px 40px -20px rgba(0,0,0,.6); }
.card__thumb { position: relative; height: 128px; overflow: hidden; }
.card__thumb-icon { position: absolute; right: -12px; bottom: -24px; color: rgba(255,255,255,.10); }
.thumb-art { position: absolute; inset: 0; display: grid; }
.thumb-art__panel { display: flex; align-items: center; justify-content: center; min-width: 0; color: rgba(255,255,255,.55); }
.thumb-art__mono { font-size: 44px; font-weight: 700; color: rgba(255,255,255,.5); }
.thumb-art__brand { object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.card__badge { position: absolute; left: 12px; top: 12px; border-radius: 9999px; background: rgba(0,0,0,.4); padding: 2px 8px; font-size: 12px; font-weight: 500; color: var(--emerald); backdrop-filter: blur(4px); }
.card__menu { position: absolute; right: 8px; top: 8px; }
.card__body { display: flex; flex: 1; flex-direction: column; padding: 16px; }
.card__name-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card__name { font-weight: 600; line-height: 1.3; color: #f1f5f9; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__time { flex-shrink: 0; padding-top: 2px; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card__instructor { margin-top: 2px; font-size: 14px; color: var(--text-dim); }
.card__offdevice {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 6px;
  font-size: 11px; color: var(--accent-400);
}
.card__instructor--empty { font-style: italic; color: var(--text-faint); }
/* Instructor doubles as a search shortcut (rendered as a button). */
.card__instructor--link { display: block; width: fit-content; max-width: 100%; background: none; border: none; padding: 0; text-align: left; }
.card__instructor--link:hover { color: var(--text); text-decoration: underline; }
.card__foot { margin-top: auto; padding-top: 16px; }
.card__stats { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.card__cont { margin-top: 16px; width: 100%; }
.card__next { margin-top: 8px; text-align: center; font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Dropdown menu ---------- */
.menu { position: relative; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; width: 176px;
  overflow: hidden; border-radius: 10px; border: 1px solid var(--ink-600); background: var(--ink-800);
  padding: 4px 0; box-shadow: 0 24px 48px -12px rgba(0,0,0,.6);
}
.menu__item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 12px; text-align: left; font-size: 14px; color: var(--text); background: none; border: none; }
.menu__item:hover { background: var(--ink-700); }
.menu__item--danger { color: var(--danger); }
.trigger-overlay { background: rgba(0,0,0,.3); color: #fff; backdrop-filter: blur(4px); }
.trigger-overlay:hover { background: rgba(0,0,0,.5); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay__bg { position: absolute; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.modal { position: relative; z-index: 10; width: 100%; max-width: 512px; overflow: hidden; border-radius: 16px; border: 1px solid var(--ink-600); background: var(--ink-850); box-shadow: 0 30px 60px -15px rgba(0,0,0,.6); }
.modal--lg { max-width: 640px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--ink-700); padding: 16px 20px; }
.modal__title { font-size: 18px; font-weight: 600; color: #f1f5f9; }
.modal__body { max-height: 70vh; overflow-y: auto; padding: 20px; }
.modal__foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--ink-700); background: color-mix(in srgb, var(--ink-900) 60%, transparent); padding: 16px 20px; }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: flex-start; gap: 8px; border-radius: 8px; padding: 12px; font-size: 14px; }
.alert--warn { border: 1px solid color-mix(in srgb, var(--accent-500) 30%, transparent); background: color-mix(in srgb, var(--accent-500) 10%, transparent); color: var(--accent-200); }
.alert--error { border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); color: #fca5a5; }
.alert--ok { border: 1px solid color-mix(in srgb, var(--emerald) 30%, transparent); background: color-mix(in srgb, var(--emerald) 10%, transparent); color: #6ee7b7; }

/* ---------- Course player layout ---------- */
.player { display: flex; height: 100%; min-height: 0; }
.player__sidebar { display: flex; width: 380px; flex-shrink: 0; border-right: 1px solid var(--ink-700); background: var(--ink-900); }
@media (max-width: 767px) { .player__sidebar { display: none; } }
.player__main { display: flex; min-width: 0; flex: 1; flex-direction: column; overflow-y: auto; background: var(--ink-950); }
.player__video-wrap { position: relative; }
.player__below { margin: 0 auto; width: 100%; max-width: 896px; padding: 20px 24px; }
.player__section-label { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); overflow-wrap: anywhere; }
.player__title { margin-top: 4px; font-size: 22px; font-weight: 700; line-height: 1.2; color: #f8fafc; overflow-wrap: anywhere; }
.player__actions { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.player__spacer { flex: 1; }
.player__upnext { margin-top: 12px; font-size: 14px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__desc { margin-top: 24px; border-top: 1px solid var(--ink-800); padding-top: 20px; font-size: 14px; line-height: 1.7; color: var(--text-dim); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Auto-play next: "Up next" countdown overlay ---------- */
.upnext {
  position: absolute; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 24px; text-align: center;
  background: rgba(0, 0, 0, .8);
}
.upnext__label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.upnext__name { font-size: 18px; font-weight: 600; color: #f1f5f9; max-width: 32rem; overflow: hidden; text-overflow: ellipsis; }
.upnext__timer { font-size: 14px; color: var(--accent-300); font-variant-numeric: tabular-nums; }
.upnext__btns { display: flex; gap: 10px; margin-top: 14px; }
.autonext--on { color: var(--accent-300); }

/* ---------- Course resources (below the video) ---------- */
.resources { margin-top: 20px; border: 1px solid var(--ink-800); border-radius: 10px; background: var(--ink-900); overflow: hidden; }
.resources__head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 12px 14px; border: none; background: transparent;
  font-size: 14px; font-weight: 500; color: var(--text); text-align: left;
}
.resources__head:hover { background: var(--ink-850); }
.resources__count {
  font-size: 12px; color: var(--text-dim); background: var(--ink-700);
  border-radius: 9999px; padding: 1px 8px;
}
.resources__chevron { margin-left: auto; display: flex; color: var(--text-dim); transition: transform .15s ease; }
.resources__chevron--open { transform: rotate(180deg); }
.resources__body { padding: 4px 8px 10px; border-top: 1px solid var(--ink-800); }
.resources__group { margin: 8px 8px 2px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.resources__list { list-style: none; margin: 0; padding: 0; }
.resource {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border: none; border-radius: 8px; background: transparent;
  font-size: 14px; color: var(--text-dim); text-align: left;
}
.resource:hover { background: var(--ink-800); color: var(--text); }
.resource__name { min-width: 0; }
.resources__error { margin: 8px; font-size: 13px; color: var(--danger); }

.video-area { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #000; overflow: hidden; }
.video-area video { height: 100%; width: 100%; }
.video-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }

/* ---------- Custom video player ---------- */
.lm-player { position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; background: #000; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; container-type: size; }
.lm-player video, .lm-video { height: 100%; width: 100%; }
.lm-player:fullscreen { width: 100vw; height: 100vh; max-height: 100vh; }
.lm-player:fullscreen video { width: 100%; height: 100%; object-fit: contain; }

.lm-surface { position: absolute; inset: 0; z-index: 10; cursor: pointer; }

.lm-center { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; pointer-events: none; transition: opacity .2s; }
.lm-center__btn { display: flex; height: 64px; width: 64px; align-items: center; justify-content: center; border-radius: 9999px; background: rgba(0,0,0,.55); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); backdrop-filter: blur(4px); }
.lm-center__btn svg { margin-left: 4px; }

.lm-controls { position: absolute; inset-inline: 0; bottom: 0; z-index: 20; padding: 4px 12px 8px; transition: opacity .2s; filter: drop-shadow(0 1px 2px rgba(0,0,0,.85)); }
.lm-player--idle .lm-controls { opacity: 0; pointer-events: none; }
.lm-player--idle { cursor: none; }
.lm-player--idle .lm-center { opacity: 0; }

.lm-bar { margin-top: 6px; display: flex; align-items: center; gap: 8px; color: #fff; }
.lm-spacer { flex: 1; }
.lm-time { margin-left: 2px; font-size: 12px; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.8); white-space: nowrap; }

.lm-btn { display: flex; height: 36px; width: 36px; align-items: center; justify-content: center; border-radius: 6px; border: none; background: none; color: #fff; transition: background .15s, color .15s; }
.lm-btn:hover { background: rgba(255,255,255,.15); }
.lm-btn.is-active { color: var(--accent-300); }

.lm-speed { display: flex; height: 36px; align-items: center; gap: 2px; border: none; background: none; border-radius: 6px; padding: 0 8px; font-size: 14px; font-weight: 500; color: rgba(255,255,255,.9); transition: background .15s; }
.lm-speed:hover { background: rgba(255,255,255,.15); }
.lm-speed__chev { opacity: .7; }

.lm-pop { position: relative; }
.lm-vol { display: flex; align-items: center; }
.lm-vol__slider { margin-left: 4px; width: 0; opacity: 0; transition: width .2s, opacity .2s; }
.lm-vol:hover .lm-vol__slider, .lm-vol__slider:focus { width: 80px; opacity: 1; }

.lm-backdrop { position: absolute; inset: 0; z-index: 15; }
.lm-menu { position: absolute; bottom: 100%; right: 0; z-index: 31; margin-bottom: 8px; overflow: hidden; border-radius: 8px; border: 1px solid var(--ink-600); background: color-mix(in srgb, var(--ink-800) 96%, transparent); padding: 4px 0; box-shadow: 0 10px 30px rgba(0,0,0,.5); backdrop-filter: blur(8px); animation: lm-scale-in .12s ease-out; }
.lm-menu--speed { width: 96px; }
.lm-menu--cc { width: 216px; }
.lm-menu__sep { margin: 4px 0; border-top: 1px solid var(--ink-600); }
.lm-menu__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 4px 12px; font-size: 13px; color: var(--text-dim); }
.lm-stepper { display: flex; align-items: center; gap: 2px; }
.lm-stepper button { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: none; border-radius: 6px; background: none; color: var(--text); }
.lm-stepper button:hover:not(:disabled) { background: var(--ink-700); }
.lm-stepper button:disabled { opacity: .3; cursor: default; }
.lm-stepper__val { min-width: 54px; text-align: center; font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.lm-menu__item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; border: none; background: none; padding: 6px 12px; text-align: left; font-size: 14px; color: var(--text); transition: background .15s; }
.lm-menu__item:hover { background: var(--ink-700); }
.lm-menu__item.is-active { color: var(--accent-300); }
.lm-menu__note { padding: 6px 12px; font-size: 13px; color: var(--text-faint); }
.lm-dot { color: var(--accent-400); }
.lm-spin { display: inline-block; height: 16px; width: 16px; border-radius: 9999px; border: 2px solid rgba(255,255,255,.25); border-top-color: rgba(255,255,255,.85); animation: spin 1s linear infinite; }
@keyframes lm-scale-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

.lm-range { -webkit-appearance: none; appearance: none; height: 5px; border-radius: 9999px; background: var(--ink-600); cursor: pointer; outline: none; }
.lm-seek { display: block; width: 100%; }

/* ---------- Custom caption layer ---------- */
/* Drawn by player.js from the hidden track's cues. Size scales with the
   player itself (cqh) so windowed, fullscreen and phone all look right. */
.lm-captions {
  position: absolute; inset-inline: 0; bottom: 1.5cqh; z-index: 15;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 0 5%; pointer-events: none; text-align: center;
  font-size: calc(var(--cap-scale, 1.5) * 3.2cqh);
  transition: bottom .25s ease;
}
.lm-cue {
  background: var(--cap-bg, rgba(0,0,0,.75)); color: #fff;
  padding: .12em .45em; border-radius: .18em; line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.lm-cue i { font-style: italic; }
/* Bottom position slides up while the control bar is visible, back down when
   it hides (Udemy-style: idle = nearly flush with the bottom edge, shown =
   just clearing the bar). The lift is FIXED px because the control bar has a
   fixed height — a percentage would overshoot in fullscreen. */
.lm-player:not(.lm-player--idle)[data-cap-pos="0"] .lm-captions { bottom: 67px; }
.lm-player[data-cap-pos="1"] .lm-captions { bottom: 25cqh; }
.lm-player[data-cap-pos="2"] .lm-captions { bottom: 48cqh; }
.lm-player[data-cap-pos="3"] .lm-captions { bottom: 82cqh; }

/* ---------- Lesson title (top-left, shows with controls) ---------- */
.lm-title {
  position: absolute; top: 0; inset-inline: 0; z-index: 12;
  padding: 12px 16px 28px; pointer-events: none;
  background: linear-gradient(rgba(0,0,0,.55), transparent);
  font-size: 15px; font-weight: 500; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.8); transition: opacity .2s;
}
.lm-title .truncate { display: block; max-width: 70%; }
.lm-player--idle .lm-title { opacity: 0; }

/* ---------- On-video prev/next (label expands toward the middle on hover) ---------- */
.lm-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 20;
  display: flex; align-items: center; max-width: 55%;
  border: none; border-radius: 9999px; padding: 10px;
  background: rgba(0,0,0,.55); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
  transition: opacity .2s, background .15s;
}
.lm-nav:hover { background: rgba(0,0,0,.85); }
.lm-nav--prev { left: 12px; }
.lm-nav--next { right: 12px; flex-direction: row-reverse; }
.lm-nav__label {
  max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap;
  font-size: 13px; transition: max-width .25s ease, opacity .2s, margin .25s ease;
}
.lm-nav:hover .lm-nav__label, .lm-nav:focus-visible .lm-nav__label { max-width: 260px; opacity: 1; margin-inline: 6px; }
.lm-player--idle .lm-nav { opacity: 0; pointer-events: none; }
@media (max-width: 639px) { .lm-nav__label { display: none; } }
.lm-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent-500); box-shadow: 0 0 0 1px rgba(0,0,0,.35); transition: transform .1s ease; }
.lm-range:hover::-webkit-slider-thumb { transform: scale(1.18); }
.lm-range::-moz-range-thumb { width: 13px; height: 13px; border: none; border-radius: 50%; background: var(--accent-500); }
.lm-range:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-400) 60%, transparent); }

video::cue { background-color: rgba(0,0,0,.75); color: #fff; font-size: .95em; }
.spinner { height: 36px; width: 36px; border-radius: 9999px; border: 2px solid rgba(255,255,255,.2); border-top-color: rgba(255,255,255,.8); animation: spin 1s linear infinite; }
.spinner--accent { border-color: var(--ink-600); border-top-color: var(--accent-400); height: 32px; width: 32px; }
@keyframes spin { to { transform: rotate(360deg); } }

.float-controls { position: absolute; left: 12px; top: 12px; z-index: 30; display: flex; align-items: center; gap: 8px; }
.float-btn { display: inline-flex; align-items: center; gap: 6px; border: none; border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; padding: 8px 10px; font-size: 14px; font-weight: 500; backdrop-filter: blur(4px); }
.float-btn:hover { background: rgba(0,0,0,.75); }
@media (min-width: 768px) { .float-btn--mobile { display: none; } }
@media (max-width: 767px) { .float-btn--desktop { display: none; } }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; height: 100%; width: 100%; min-width: 0; flex-direction: column; overflow-x: hidden; }
.sidebar__head { border-bottom: 1px solid var(--ink-700); padding: 16px; }
.sidebar__title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sidebar__title { font-weight: 600; line-height: 1.3; color: #f1f5f9; overflow-wrap: anywhere; }
.sidebar__instructor { margin-top: 2px; font-size: 14px; color: var(--text-dim); overflow-wrap: anywhere; }
.sidebar__time { margin-top: 4px; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.sidebar__progress { margin-top: 12px; }
.sidebar__progress-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.sidebar__search { border-bottom: 1px solid var(--ink-700); padding: 8px 12px; }
.sidebar__list { min-height: 0; flex: 1; overflow-y: auto; }
.sidebar__empty { padding: 24px 16px; text-align: center; font-size: 14px; color: var(--text-faint); }
.section { border-bottom: 1px solid color-mix(in srgb, var(--ink-800) 80%, transparent); }
.section__head { display: flex; width: 100%; align-items: center; gap: 8px; padding: 12px 16px; text-align: left; background: none; border: none; transition: background .15s; }
.section__head:hover { background: var(--ink-800); }
.section__chevron { flex-shrink: 0; color: var(--text-faint); transition: transform .2s; }
.section__chevron--closed { transform: rotate(-90deg); }
.section__name { font-size: 14px; font-weight: 500; color: #e2e8f0; overflow-wrap: anywhere; }
.section__meta { font-size: 12px; color: var(--text-faint); }
.section__meta .done { color: var(--emerald); }
.section__time { flex-shrink: 0; align-self: flex-start; padding-top: 1px; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lessons { list-style: none; margin: 0; padding: 0 0 4px; }
.lesson { display: flex; align-items: flex-start; gap: 10px; border-left: 2px solid transparent; padding: 8px 12px 8px 16px; transition: background .15s; }
.lesson:hover { background: var(--ink-800); }
.lesson--current { border-left-color: var(--accent-500); background: color-mix(in srgb, var(--accent-500) 10%, transparent); }
.lesson__check { flex-shrink: 0; background: none; border: none; padding: 0; display: flex; }
.lesson__check .done { color: var(--emerald); }
.lesson__check .todo { color: var(--ink-500); }
.lesson__check:hover .todo { color: var(--text-dim); }
.lesson__select { display: flex; min-width: 0; flex: 1; align-items: center; gap: 8px; text-align: left; background: none; border: none; padding: 0; }
.lesson__name { min-width: 0; flex: 1; font-size: 14px; color: var(--text-dim); overflow-wrap: anywhere; }
.lesson__name--current { font-weight: 500; color: var(--accent-200); }
.lesson__dur { flex-shrink: 0; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.hl { border-radius: 4px; background: color-mix(in srgb, var(--accent-500) 30%, transparent); color: var(--accent-200); }

/* ---------- Password gate ---------- */
.gate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--ink-950); }
.gate__card { width: 100%; max-width: 360px; text-align: center; }
.gate__logo {
  display: inline-flex; align-items: center; justify-content: center; height: 64px; width: 64px;
  border-radius: 16px; margin-bottom: 18px; color: #f8fafc;
  background: linear-gradient(135deg, #242b48 0%, #1d243b 100%);
  border: 1px solid #2b3452;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.gate__title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; color: #f8fafc; }
.gate__subtitle { margin-top: 6px; font-size: 14px; color: var(--text-dim); }
.gate__form { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.gate__input { text-align: center; }
.gate__error { font-size: 13px; color: var(--danger); }
.gate__btn { width: 100%; }

/* ---------- Mobile drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 40; }
@media (min-width: 768px) { .drawer { display: none; } }
.drawer__bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.drawer__panel { position: absolute; inset-block: 0; left: 0; width: 85%; max-width: 384px; border-right: 1px solid var(--ink-700); background: var(--ink-900); box-shadow: 0 0 60px rgba(0,0,0,.6); display: flex; flex-direction: column; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--ink-700); padding: 8px 12px; }

/* ---------- Manage table ---------- */
.table { overflow: hidden; border-radius: 12px; border: 1px solid var(--ink-700); }
.table__head, .table__row { display: grid; grid-template-columns: 1fr 140px 75px 150px 105px 120px; gap: 16px; align-items: center; padding: 12px 16px; }
.table__head { border-bottom: 1px solid var(--ink-700); background: color-mix(in srgb, var(--ink-900) 60%, transparent); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
/* Sortable column headers: styled as the plain head text, arrow marks the active column. */
.table__th { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-start; background: none; border: none; padding: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; }
.table__th:hover { color: var(--text); }
.table__arrow { font-size: 8px; line-height: 1; }
.table__rows > * + * { border-top: 1px solid var(--ink-800); }
.table__name { display: flex; min-width: 0; align-items: center; gap: 12px; background: none; border: none; text-align: left; }
.table__swatch { display: flex; height: 36px; width: 36px; flex-shrink: 0; align-items: center; justify-content: center; border-radius: 8px; color: rgba(255,255,255,.8); }
.table__name-text { min-width: 0; }
.table__name-text b { display: block; font-weight: 500; color: #f1f5f9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table__name-text:hover b { color: var(--accent-300); }
.table__sub { display: none; font-size: 12px; color: var(--text-faint); }
.table__actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.table__msg { padding: 0 16px 12px; font-size: 12px; }
.muted { color: var(--text-faint); }
@media (max-width: 767px) {
  .table__head { display: none; }
  .table__row { grid-template-columns: 1fr auto; }
  .table__col-hide { display: none !important; }
  .table__sub { display: block; }
}

/* ---------- Stats page ---------- */
.stats__cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.statcard { display: flex; flex-direction: column; gap: 2px; background: var(--ink-900); border: 1px solid var(--ink-700); border-radius: 12px; padding: 14px 16px; }
.statcard__label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.statcard__value { display: flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.statcard__of { font-size: 15px; font-weight: 500; color: var(--text-faint); }
.statcard__flame { color: var(--accent-400); }
.statcard__sub { font-size: 12px; color: var(--text-faint); }

.stats__panel { background: var(--ink-900); border: 1px solid var(--ink-700); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.stats__panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.stats__panel-title { font-size: 14px; font-weight: 600; }
.stats__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stats__row .stats__panel { margin-bottom: 0; min-width: 0; }

.heatmap-scroll { overflow-x: auto; padding-bottom: 4px; }
.heatmap { display: flex; gap: 6px; width: max-content; }
.heatmap__days { display: grid; grid-template-rows: repeat(7, 12px); gap: 3px; margin-top: 18px; font-size: 10px; color: var(--text-faint); }
.heatmap__days span { line-height: 12px; }
.heatmap__months { display: grid; grid-template-columns: repeat(53, 12px); gap: 3px; height: 15px; font-size: 10px; color: var(--text-faint); }
.heatmap__months span { white-space: nowrap; }
.heatmap__grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); grid-auto-columns: 12px; gap: 3px; }
.hm { width: 12px; height: 12px; border-radius: 3px; background: var(--ink-800); }
.hm--future { visibility: hidden; }
.hm-1 { background: color-mix(in srgb, var(--accent-500) 25%, var(--ink-800)); }
.hm-2 { background: color-mix(in srgb, var(--accent-500) 45%, var(--ink-800)); }
.hm-3 { background: color-mix(in srgb, var(--accent-500) 70%, var(--ink-800)); }
.hm-4 { background: var(--accent-400); }
.heatmap__legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 8px; font-size: 11px; color: var(--text-faint); }

.statbar { display: flex; align-items: center; gap: 10px; }
.statbar + .statbar { margin-top: 8px; }
.statbar__name { width: 150px; flex-shrink: 0; font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statbar__track { flex: 1; height: 6px; border-radius: 9999px; background: var(--ink-800); overflow: hidden; }
.statbar__fill { display: block; height: 100%; border-radius: 9999px; background: var(--accent-600); }
.statbar__value { width: 64px; flex-shrink: 0; text-align: right; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.hl { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); min-width: 0; }
.hl + .hl { margin-top: 10px; }
.hl__icon { display: flex; flex-shrink: 0; color: var(--text-faint); }
.hl--accent .hl__icon { color: var(--accent-400); }
.hl b { color: var(--text); font-weight: 600; white-space: nowrap; }
.hl__course { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  .stats__cards { grid-template-columns: repeat(2, 1fr); }
  .stats__row { grid-template-columns: 1fr; }
  .statbar__name { width: 110px; }
}

/* ---------- Picker dropzone ---------- */
.dropzone { display: flex; width: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 12px; border: 2px dashed var(--ink-600); border-radius: 12px; background: color-mix(in srgb, var(--ink-900) 50%, transparent); padding: 40px 24px; text-align: center; color: var(--text); transition: border-color .15s, background .15s; }
.dropzone:hover { border-color: color-mix(in srgb, var(--accent-500) 60%, transparent); background: var(--ink-800); }
.dropzone__icon { display: flex; height: 48px; width: 48px; align-items: center; justify-content: center; border-radius: 9999px; background: var(--ink-700); color: var(--accent-400); }
.folder-card { border: 1px solid var(--ink-600); border-radius: 12px; background: color-mix(in srgb, var(--ink-900) 50%, transparent); padding: 16px; }
.folder-card__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.folder-card__info { display: flex; min-width: 0; align-items: center; gap: 12px; }
.folder-card__icon { display: flex; height: 40px; width: 40px; flex-shrink: 0; align-items: center; justify-content: center; border-radius: 8px; background: var(--ink-700); color: var(--accent-400); }
.folder-card__sections { margin-top: 12px; max-height: 160px; overflow-y: auto; border-top: 1px solid var(--ink-700); padding-top: 12px; list-style: none; }
.folder-card__sections li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 8px; font-size: 14px; }

/* Bulk add: one row per detected course folder */
.bulk { max-height: 420px; overflow-y: auto; }
.bulk__row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; }
.bulk__row + .bulk__row { border-top: 1px solid var(--ink-800); }
.bulk__row--off { opacity: .45; }
.bulk__row input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; accent-color: var(--accent-500); }
.bulk__meta { font-size: 12px; color: var(--text-faint); margin-top: 1px; }
.bulk__tags { display: flex; gap: 4px; flex-shrink: 0; max-width: 220px; overflow: hidden; }

.stack > * + * { margin-top: 20px; }
.stack-sm > * + * { margin-top: 16px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabnum { font-variant-numeric: tabular-nums; }

/* Subtitle cue */
video::cue { background: rgba(0,0,0,.75); color: #fff; }

/* ---------- History timeline ---------- */
.hist__filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 4px; }
.hist__filter { font-size: 12px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--ink-700); background: transparent; color: var(--text-dim); transition: background .15s, color .15s, border-color .15s; }
.hist__filter:hover { background: var(--ink-800); color: var(--text); }
.hist__filter--on { background: var(--ink-800); border-color: var(--ink-600); color: #f1f5f9; }
.hist__daylabel { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin: 22px 0 6px; }
.hist__list { display: flex; flex-direction: column; }
.hist__row { display: flex; align-items: flex-start; gap: 12px; }
.hist__marker { position: relative; flex-shrink: 0; display: flex; justify-content: center; width: 30px; align-self: stretch; }
/* Connecting line between markers (not after the last row of a day). */
.hist__row:not(:last-child) .hist__marker::after { content: ''; position: absolute; top: 36px; bottom: -2px; left: 50%; width: 1px; background: var(--ink-700); transform: translateX(-50%); }
.hist__icon { margin-top: 6px; z-index: 1; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--ink-800); color: var(--text-dim); }
.hist__icon--watched { color: var(--accent-400); background: color-mix(in srgb, var(--accent-500) 14%, var(--ink-800)); }
.hist__icon--completed { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 14%, var(--ink-800)); }
.hist__icon--coursefinished { color: var(--accent-300); background: color-mix(in srgb, var(--accent-500) 14%, var(--ink-800)); }
.hist__body { flex: 1; min-width: 0; padding: 8px 0; }
.hist__title { font-size: 14px; color: #f1f5f9; }
.hist__sub { margin-top: 2px; font-size: 12px; color: var(--text-dim); }
.hist__time { flex-shrink: 0; padding-top: 12px; font-size: 12px; color: var(--text-faint); white-space: nowrap; }

/* ---------- Toasts (app-wide transient notifications) ---------- */
.toasts { position: fixed; z-index: 3000; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 12px; background: var(--ink-800); border: 1px solid var(--ink-600); box-shadow: 0 12px 32px rgba(0,0,0,.5); color: #f1f5f9; font-size: 14px; line-height: 1.45; cursor: pointer; animation: toast-in .22s ease; }
.toast__icon { flex-shrink: 0; display: flex; margin-top: 1px; color: var(--text-dim); }
.toast__msg { flex: 1; min-width: 0; }
.toast__close { flex-shrink: 0; display: flex; background: none; border: none; color: var(--text-faint); padding: 3px; border-radius: 6px; }
.toast__close:hover { color: var(--text); background: var(--ink-600); }
.toast--success { border-color: color-mix(in srgb, var(--emerald) 45%, var(--ink-600)); }
.toast--success .toast__icon { color: var(--emerald); }
.toast--error { border-color: color-mix(in srgb, var(--danger) 45%, var(--ink-600)); }
.toast--error .toast__icon { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 560px) { .toasts { left: 12px; right: 12px; bottom: 12px; width: auto; } }
