/* Course (video) side of the app: course page, lesson cards, Studio → Course, and the lesson theatre.
   Uses the tokens and components from app.css. */

/* ═══════════════════════════ Shared bits ═══════════════════════════ */
.badge.free { background: color-mix(in srgb, var(--g3) 30%, transparent); color: var(--text); }
.btn-icon { width: 36px; padding: 0; justify-content: center; }
.link-plain { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.link-plain:hover { color: var(--accent); }
.page-head .tabs { margin-right: auto; align-self: end; }
.drop > span { display: grid; place-items: center; }
.drop > span svg { width: 28px; height: 28px; color: var(--accent); }

/* ═══════════════════════════ Course page ═══════════════════════════ */
.course-hero-grid { position: relative; z-index: 1; display: grid; gap: clamp(24px, 4vw, 48px); align-items: end; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); }
.course-desc { margin: 0; color: var(--muted); max-width: 60ch; }
.course-side { padding: 24px; display: grid; gap: 14px; justify-items: center; }
.course-side .eyebrow { justify-self: start; }
.course-ring { position: relative; width: 150px; aspect-ratio: 1; display: grid; place-items: center; }
.course-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.course-ring circle { fill: none; stroke-width: 10; stroke: rgb(var(--fg-rgb) / .08); }
.course-ring .ring-fill { stroke: var(--g2); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray 1s var(--ease); }
.course-ring b { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.course-gate { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgb(var(--fg-rgb) / .05); width: 100%; }
.course-gate b { display: block; font-size: 14px; }
.course-gate small { color: var(--muted); font-size: 12.5px; }
.gate-ic { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--grad-diag); color: var(--on-grad); }
.gate-ic svg { width: 18px; height: 18px; }
.course-module .section-head h2 { font-size: clamp(26px, 3.4vw, 40px); max-width: 24ch; }
.course-module + .course-module { padding-top: clamp(40px, 6vw, 72px); }
.course-module[hidden] { display: none; }
.course-tabs { display: flex; justify-content: center; padding-top: clamp(24px, 4vw, 40px); }
.course-tabs .tabs { box-shadow: var(--shadow-card); }
.course-tabs .tabs button { min-width: 110px; font-size: 15px; cursor: pointer; }

.lesson-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.lesson-card { padding: 10px; display: grid; gap: 12px; align-content: start; transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.lesson-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.lesson-card.is-draft { opacity: .75; }
.lesson-body { display: grid; gap: 6px; padding: 2px 6px 8px; }
.lesson-body h3 { font-size: 19px; font-weight: 700; line-height: 1.2; }
.lesson-body p { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lesson-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0; border-radius: calc(var(--r-card) - 8px); overflow: hidden; background: #0b1220; color: #fff; cursor: pointer; container-type: inline-size; }
.lesson-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.lesson-card:hover .lesson-thumb img { transform: scale(1.04); }
.lesson-thumb.static { cursor: default; }
.lt-shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgb(0 0 0 / .55)); }
.lt-play {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; display: grid; place-items: center;
  background: rgb(255 255 255 / .16); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgb(255 255 255 / .3);
  transition: transform .3s var(--spring), background .3s;
}
.lt-play svg { width: 24px; height: 24px; }
.lesson-thumb:hover .lt-play { transform: scale(1.1); background: var(--grad-diag); color: var(--on-grad); border-color: transparent; }
.lt-len { position: absolute; right: 10px; bottom: 10px; padding: 3px 8px; border-radius: 8px; background: rgb(0 0 0 / .65); font-size: 12px; font-weight: 600; }
.lt-free { position: absolute; left: 10px; top: 10px; padding: 3px 9px; border-radius: 999px; background: var(--grad); color: var(--on-grad); font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; }
.lt-done { position: absolute; right: 10px; top: 10px; width: 28px; height: 28px; border-radius: 50%; display: none; place-items: center; background: var(--g2); color: var(--on-grad); box-shadow: 0 4px 12px rgb(0 0 0 / .3); }
.lt-done svg { width: 15px; height: 15px; }
.lesson-card.done .lt-done { display: grid; }
.lt-bar { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--grad); }
.lesson-gen {
  position: absolute; inset: 0; padding: 7cqi; display: grid; align-content: end; gap: 4px; text-align: left;
  background: radial-gradient(120% 90% at 85% 0%, color-mix(in srgb, var(--g2) 50%, transparent), transparent 60%), linear-gradient(160deg, #0b1220, color-mix(in srgb, var(--g1) 60%, #0b1220));
}
.lg-num { font-size: 26cqi; font-weight: 900; line-height: .8; letter-spacing: -.06em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lg-title { font-size: max(11px, 5cqi); font-weight: 700; color: rgb(255 255 255 / .9); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumb-wide { width: 104px; aspect-ratio: 16 / 9; overflow: hidden; position: relative; }
.thumb-wide img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.thumb-wide .lesson-gen { border-radius: 10px; padding: 6px; }
.thumb-wide .lg-title { display: none; }

/* ═══════════════════════════ Studio → Course ═══════════════════════════ */
.course-studio { display: grid; gap: 18px; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); align-items: start; }
.course-studio #course-form { position: sticky; top: 88px; }
.studio-season > summary .ss-actions label.btn { cursor: pointer; }
.bulk-status { padding: 0 20px 18px; }
.empty .bulk-status { padding: 0; width: 100%; }
.bulk-status ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.bulk-status li { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 10px; align-items: baseline; font-size: 13.5px; text-align: left; }
.bulk-status em { font-style: normal; color: var(--muted); text-align: right; }
.bulk-status li.ok em { color: var(--accent); }
.bulk-status li.err em { color: var(--err); }
.bs-bar { grid-column: 1 / -1; display: block; height: 4px; border-radius: 4px; background: rgb(var(--fg-rgb) / .08); overflow: hidden; }
.bs-bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .3s; }
.lesson-editor { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: start; }
.studio-video { width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; background: #000; }
.thumb-pick { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }

/* ═══════════════════════════ Lesson theatre ═══════════════════════════ */
.vtheatre {
  position: fixed; inset: 0; z-index: 130; overflow: hidden; color: #fff; background: #05070f;
  display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); justify-items: stretch;
  padding: max(10px, env(safe-area-inset-top)) clamp(12px, 3vw, 32px) max(12px, env(safe-area-inset-bottom));
  opacity: 0; transform: scale(.985); transition: opacity .3s var(--ease), transform .35s var(--ease);
}
.vtheatre.open { opacity: 1; transform: none; }
html:has(body.fsp-lock) { overflow: hidden; }
.vtheatre[hidden] { display: none; }
.vt-bg { position: absolute; inset: -20%; filter: blur(90px); opacity: .5; pointer-events: none; }
.vt-bg i { position: absolute; border-radius: 50%; width: 50vmax; height: 50vmax; }
.vt-bg i:nth-child(1) { left: -5%; top: -10%; background: radial-gradient(circle, color-mix(in srgb, var(--g1) 70%, transparent), transparent 65%); }
.vt-bg i:nth-child(2) { right: -10%; bottom: -15%; background: radial-gradient(circle, color-mix(in srgb, var(--g2) 35%, transparent), transparent 65%); }
.vt-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; }
.vt-where { display: grid; gap: 2px; min-width: 0; }
.vt-where span { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: color-mix(in srgb, var(--g3) 75%, #fff); }
.vt-where b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt-main { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: clamp(14px, 2vw, 24px); min-height: 0; }
.vt-left { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .2) transparent; padding-bottom: 12px; }

.vt-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100dvh - 190px); margin: 0 auto; background: #000; border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / .9), 0 0 0 1px rgb(255 255 255 / .06); user-select: none;
}
.vt-stage:fullscreen { border-radius: 0; max-height: none; aspect-ratio: auto; }
.vt-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.vt-poster { position: absolute; inset: 0; background: center / contain no-repeat #000; transition: opacity .4s; }
.vtheatre.started .vt-poster { opacity: 0; pointer-events: none; }
.vt-msg {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center; z-index: 3;
  background: rgb(5 7 15 / .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.vt-msg[hidden] { display: none; }
.vt-msg b { font-size: 20px; }
.vt-msg p { margin: 0; color: rgb(255 255 255 / .75); max-width: 42ch; }
.vt-lock { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-diag); color: var(--on-grad); }
.vt-lock svg { width: 26px; height: 26px; }
.vt-big {
  position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; border: 0; z-index: 2;
  display: grid; place-items: center; background: var(--grad-diag); color: var(--on-grad); box-shadow: 0 18px 44px -12px var(--g2);
  transition: opacity .25s, transform .3s var(--spring);
}
.vt-big svg { width: 34px; height: 34px; }
.vt-big:hover { transform: scale(1.06); }
.vtheatre.playing .vt-big, .vtheatre.has-msg .vt-big, .vtheatre.loading .vt-big { opacity: 0; pointer-events: none; transform: scale(.8); }
.vt-spin { position: absolute; inset: 0; display: none; place-items: center; z-index: 2; pointer-events: none; }
.vtheatre.loading:not(.has-msg) .vt-spin { display: grid; }
.vt-resume {
  position: absolute; left: 16px; top: 16px; z-index: 4; display: flex; gap: 12px; align-items: center; padding: 8px 8px 8px 14px; border-radius: 999px;
  background: rgb(0 0 0 / .6); backdrop-filter: blur(10px); font-size: 13.5px; animation: pop .3s var(--ease);
}
.vt-resume[hidden], .vt-next[hidden] { display: none; }
.vt-resume button { border: 0; border-radius: 999px; padding: 5px 12px; background: rgb(255 255 255 / .16); color: #fff; font-size: 13px; font-weight: 600; }
.vt-resume button:hover { background: rgb(255 255 255 / .28); }
.vt-next {
  position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 24px;
  background: rgb(5 7 15 / .78); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.vt-next b { font-size: clamp(18px, 2.4vw, 26px); max-width: 30ch; }
.vt-next .eyebrow { color: color-mix(in srgb, var(--g3) 80%, #fff); }

.vt-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 28px 14px 8px; background: linear-gradient(180deg, transparent, rgb(0 0 0 / .78)); transition: opacity .3s, transform .3s var(--ease); }
.vtheatre.playing:not(.controls):not(.scrubbing) .vt-bar { opacity: 0; transform: translateY(8px); pointer-events: none; }
.vtheatre.playing:not(.controls):not(.scrubbing) .vt-stage { cursor: none; }
.vtheatre.has-msg .vt-bar { display: none; }
.vt-scrub { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.vt-rail { position: relative; width: 100%; height: 4px; border-radius: 4px; background: rgb(255 255 255 / .22); overflow: hidden; transition: height .15s; }
.vt-scrub:hover .vt-rail, .vtheatre.scrubbing .vt-rail { height: 6px; }
.vt-buf, .vt-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0; }
.vt-buf { background: rgb(255 255 255 / .3); }
.vt-played { background: var(--grad); }
.vt-knob { position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / .5); transform: scale(0); transition: transform .15s; }
.vt-scrub:hover .vt-knob, .vt-scrub:focus-visible .vt-knob, .vtheatre.scrubbing .vt-knob { transform: scale(1); }
.vt-tip { position: absolute; bottom: 22px; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; background: rgb(0 0 0 / .8); font-family: var(--mono); font-size: 12px; pointer-events: none; }
.vt-tip[hidden] { display: none; }
.vt-row { display: flex; align-items: center; gap: 2px; }
.vt-btn { width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: #fff; display: grid; place-items: center; transition: background .2s; flex: none; }
.vt-btn:hover { background: rgb(255 255 255 / .12); }
.vt-btn svg { width: 22px; height: 22px; }
.vt-speed { width: auto; padding: 0 10px; font-family: var(--mono); font-weight: 700; font-size: 13px; }
.vt-vol { display: flex; align-items: center; }
.vt-vol input { width: 0; opacity: 0; transition: width .25s var(--ease), opacity .2s; accent-color: var(--g2); }
.vt-vol:hover input, .vt-vol:focus-within input { width: 80px; opacity: 1; margin-right: 6px; }
.vt-time { font-size: 12.5px; color: rgb(255 255 255 / .85); padding: 0 8px; white-space: nowrap; }
.vt-flex { flex: 1; }

.vt-info { padding: 18px 4px 4px; display: grid; gap: 10px; }
.vt-info-head { display: flex; justify-content: space-between; align-items: start; gap: 12px 18px; flex-wrap: wrap; }
.vt-code { font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: color-mix(in srgb, var(--g3) 80%, #fff); }
.vt-info h2 { font-size: clamp(20px, 2.4vw, 28px); font-weight: 800; color: #fff; margin-top: 4px; }
.vt-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.vt-ghost { background: rgb(255 255 255 / .07); border-color: rgb(255 255 255 / .14); color: #fff; }
.vt-ghost:hover { border-color: rgb(255 255 255 / .35); }
.vt-nav button:disabled { opacity: .35; pointer-events: none; }
.vt-nav button[hidden] { display: none; }
#vt-complete.on { background: color-mix(in srgb, var(--g2) 24%, transparent); border-color: color-mix(in srgb, var(--g2) 60%, transparent); }
.vt-summary { margin: 0; color: rgb(255 255 255 / .78); max-width: 72ch; }
.vt-summary[hidden] { display: none; }
.vt-notes { color: rgb(255 255 255 / .82); max-width: 72ch; }
.vt-notes:empty { display: none; }

.vt-list {
  display: flex; flex-direction: column; min-height: 0; border-radius: 22px; background: rgb(10 14 28 / .6); border: 1px solid rgb(255 255 255 / .1);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); overflow: hidden;
}
.vt-list-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 10px 18px; }
.vt-list-head > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.vt-list-head b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt-list-head span { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: rgb(255 255 255 / .55); }
.vt-prog { height: 3px; margin: 0 18px 8px; border-radius: 3px; background: rgb(255 255 255 / .12); overflow: hidden; }
.vt-prog i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .6s var(--ease); }
.vt-lessons { overflow-y: auto; padding: 4px 8px 12px; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .2) transparent; }
.vt-lessons ol { list-style: none; margin: 0; padding: 0; }
.vt-mod { padding: 12px 12px 6px; display: grid; gap: 1px; }
.vt-mod span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: rgb(255 255 255 / .45); }
.vt-mod b { font-size: 13.5px; color: rgb(255 255 255 / .85); }
.vt-item { width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border: 0; border-radius: 14px; background: none; color: #fff; transition: background .2s; }
.vt-item:hover { background: rgb(255 255 255 / .07); }
.vt-item.now { background: color-mix(in srgb, var(--g2) 18%, rgb(255 255 255 / .04)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--g2) 45%, transparent); }
.vt-item-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 700; color: rgb(255 255 255 / .55); background: rgb(255 255 255 / .06); }
.vt-item-ic svg { width: 14px; height: 14px; }
.vt-item.done .vt-item-ic { background: var(--g2); color: var(--on-grad); }
.vt-item.locked { opacity: .6; }
.vtheatre.playing .vt-item.now .eq i { animation: eq 1s ease-in-out infinite; }
.vt-item-main { display: grid; gap: 2px; min-width: 0; position: relative; }
.vt-item-main b { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.vt-item-main small { font-size: 12px; color: rgb(255 255 255 / .55); }
.vt-item-bar { display: block; height: 3px; border-radius: 3px; background: var(--grad); margin-top: 3px; }

@media (max-width: 1099px) {
  .vt-main { grid-template-columns: minmax(0, 1fr); overflow-y: auto; align-content: start; }
  .vt-left { overflow: visible; }
  .vt-list, .vt-lessons { overflow: visible; }
  .vt-stage { max-height: 62dvh; }
}
@media (max-width: 960px) {
  .course-hero-grid, .course-studio, .lesson-editor { grid-template-columns: minmax(0, 1fr); }
  .course-studio #course-form { position: static; }
}
@media (max-width: 600px) {
  .vtheatre { padding-inline: 0; }
  .vt-top { padding-inline: 12px; }
  .vt-stage { border-radius: 0; }
  .vt-info { padding-inline: 14px; }
  .vt-list { border-radius: 18px; margin: 0 10px; }
  .vt-vol input, .vt-row [data-v="back"], .vt-row [data-v="fwd"] { display: none; }
  .vt-big { width: 68px; height: 68px; margin: -34px 0 0 -34px; }
  .thumb-pick { grid-template-columns: minmax(0, 1fr); }
}
