/* =========================================================================
   Course player page + secure video player (YouTube & HTML5 share one UI)
   ========================================================================= */
.learn-top { position: sticky; top: 0; z-index: 50; height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 clamp(12px, 2vw, 24px); background: var(--ink-brand); color: #fff; }
.learn-top .brand { color: #fff; font-size: 1.05rem; }
.learn-top .brand-mark { width: 30px; height: 30px; border-radius: 8px; box-shadow: none; }
.learn-top .divider { width: 1px; height: 26px; background: rgb(255 255 255 / 0.18); }
.learn-top .course-name { font-weight: 650; font-size: var(--fs-sm); color: rgb(255 255 255 / 0.9); }
.learn-top .btn-ghost { color: rgb(255 255 255 / 0.8); }
.learn-top .btn-ghost:hover { background: rgb(255 255 255 / 0.1); color: #fff; }
.learn-top .ring { --size: 38px; background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgb(255 255 255 / 0.16) 0); color: #fff; }
.learn-top .ring::before { background: var(--ink-brand); }
@media (max-width: 720px) { .learn-top .divider, .learn-top .brand-text, .learn-top .progress-label { display: none; } }

.learn { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: calc(100dvh - 60px); }
.learn-main { min-width: 0; }
.stage { background: #05070d; }
.stage-inner { max-width: 1280px; margin-inline: auto; }
.lesson-head { padding: 22px clamp(16px, 3vw, 32px); display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; border-bottom: 1px solid var(--border); background: var(--surface); }
.lesson-head h1 { font-size: var(--fs-xl); }
.lesson-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.lesson-body { padding: 24px clamp(16px, 3vw, 32px) 64px; max-width: 900px; }
.notes { white-space: normal; color: var(--text-2); line-height: 1.75; }
.doc-frame { width: 100%; height: min(78vh, 900px); border: 0; background: #fff; }
.image-stage { display: grid; place-items: center; padding: 24px; min-height: 360px; }
.image-stage img { max-height: 72vh; border-radius: var(--r-sm); }
.reading-stage { background: var(--surface); padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 48px); }
.reading-stage .notes { max-width: 760px; margin-inline: auto; font-size: var(--fs-md); color: var(--text); }
.link-stage { display: grid; place-items: center; text-align: center; gap: 16px; padding: 64px 24px; color: #fff; }
.link-stage p { color: rgb(255 255 255 / 0.7); }

.curriculum-panel { border-left: 1px solid var(--border); background: var(--surface); position: sticky; top: 60px; height: calc(100dvh - 60px); display: flex; flex-direction: column; }
.curriculum-panel .head { padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.curriculum-panel .list { overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.c-section > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; gap: 10px; align-items: center; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 700; font-size: var(--fs-sm); position: sticky; top: 0; z-index: 1; }
.c-section > summary::-webkit-details-marker { display: none; }
.c-section > summary .meta { margin-left: auto; font-weight: 600; font-size: 12px; color: var(--text-3); }
.c-section > summary .chev { transition: transform var(--t); color: var(--text-3); }
.c-section[open] > summary .chev { transform: rotate(180deg); }
.c-lesson { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); text-decoration: none !important; position: relative; }
.c-lesson:hover { background: var(--surface-2); color: var(--text); }
.c-lesson.is-current { background: var(--brand-50); color: var(--text); font-weight: 650; }
.c-lesson.is-current::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.c-lesson .state { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; flex: none; margin-top: 1px; color: transparent; }
.c-lesson.is-done .state { background: var(--success); border-color: var(--success); color: #fff; }
.c-lesson .state .icon { width: 13px; height: 13px; stroke-width: 3; }
.c-lesson .kind { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--text-3); margin-top: 3px; font-weight: 500; }
.c-lesson .kind .icon { width: 13px; height: 13px; }
.c-lesson .mini { height: 3px; margin-top: 6px; }
@media (max-width: 1080px) {
  .learn { grid-template-columns: minmax(0, 1fr); }
  .lesson-nav { width: 100%; }
  .lesson-nav .btn { flex: 1 1 auto; }
  .curriculum-panel { position: static; height: auto; border-left: 0; border-top: 1px solid var(--border); }
  .curriculum-panel .list { max-height: none; }
}

/* ---- Secure player ----------------------------------------------------- */
.lp { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; color: #fff; font-size: 14px; }
.lp:fullscreen { aspect-ratio: auto; width: 100vw; height: 100vh; }
.lp-media { position: absolute; inset: 0; overflow: hidden; }
.lp-media video { width: 100%; height: 100%; object-fit: contain; background: #000; }
/* Crop YouTube's own title bar + logo out of view */
.lp-media .yt-frame, .lp-media iframe { position: absolute; left: 0; width: 100%; top: -64px; height: calc(100% + 128px); border: 0; pointer-events: none; }
/* Transparent shield: every click lands on our UI, never on YouTube */
.lp-shield { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.lp-poster { position: absolute; inset: 0; z-index: 3; background: #000 center / cover no-repeat; display: grid; place-items: center; transition: opacity 300ms; }
.lp[data-kind="video"] .lp-poster:not([style]) { background-color: transparent; }
.lp-poster::after { content: ""; position: absolute; inset: 0; background: radial-gradient(closest-side, rgb(0 0 0 / 0.1), rgb(0 0 0 / 0.55)); }
.lp.is-started:not(.is-paused):not(.is-ended) .lp-poster { opacity: 0; pointer-events: none; }
.lp.is-started.is-paused .lp-poster { opacity: 0.94; }
.lp-big { position: relative; z-index: 1; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); box-shadow: 0 16px 40px -8px color-mix(in oklab, var(--brand) 80%, transparent); transition: transform var(--t); }
.lp-big:hover { transform: scale(1.06); }
.lp-big .icon { width: 34px; height: 34px; fill: #fff; stroke: none; margin-left: 4px; }
.lp-resume { position: absolute; z-index: 1; bottom: 24px; left: 50%; transform: translateX(-50%); background: rgb(0 0 0 / 0.6); padding: 6px 12px; border-radius: var(--r-full); font-size: 13px; backdrop-filter: blur(6px); white-space: nowrap; }
.lp-spinner { position: absolute; inset: 0; margin: auto; z-index: 4; width: 48px; height: 48px; border-radius: 50%; border: 3px solid rgb(255 255 255 / 0.2); border-top-color: #fff; animation: spin 0.8s linear infinite; display: none; }
.lp.is-buffering .lp-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.lp-watermark { position: absolute; z-index: 5; font-size: 12px; font-weight: 600; color: rgb(255 255 255 / 0.22); pointer-events: none; text-shadow: 0 1px 2px rgb(0 0 0 / 0.4); transition: top 1.2s ease, left 1.2s ease; white-space: nowrap; }

.lp-controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding: 40px 14px 10px; background: linear-gradient(transparent, rgb(0 0 0 / 0.78)); transition: opacity 250ms; }
.lp.is-idle.is-playing .lp-controls { opacity: 0; }
.lp.is-idle.is-playing { cursor: none; }
.lp:not(.is-started) .lp-controls { opacity: 0; pointer-events: none; }
.lp-bar { display: flex; align-items: center; gap: 4px; }
.lp-btn { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; color: #fff; position: relative; }
.lp-btn:hover { background: rgb(255 255 255 / 0.14); }
.lp-btn .icon { width: 22px; height: 22px; }
.lp-btn .icon.fill { fill: #fff; stroke: none; }
.lp-time { font-variant-numeric: tabular-nums; font-size: 13px; margin: 0 8px; color: rgb(255 255 255 / 0.9); white-space: nowrap; }
.lp-spacer { flex: 1; }
.lp-seek { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; margin-bottom: 4px; touch-action: none; }
.lp-seek .lp-track { position: absolute; left: 0; right: 0; height: 4px; border-radius: 4px; background: rgb(255 255 255 / 0.25); transition: height 150ms; }
.lp-seek:hover .lp-track { height: 6px; }
.lp-seek .buffered { position: absolute; left: 0; height: 100%; background: rgb(255 255 255 / 0.3); border-radius: inherit; }
.lp-seek .played { position: absolute; left: 0; height: 100%; background: var(--accent); border-radius: inherit; }
.lp-seek .knob { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff; transform: translateX(-50%) scale(0); transition: transform 150ms; box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 40%, transparent); }
.lp-seek:hover .knob, .lp-seek.is-dragging .knob { transform: translateX(-50%) scale(1); }
.lp-seek .tip { position: absolute; bottom: 22px; transform: translateX(-50%); background: rgb(0 0 0 / 0.85); padding: 3px 7px; border-radius: 6px; font-size: 12px; opacity: 0; pointer-events: none; font-variant-numeric: tabular-nums; }
.lp-seek:hover .tip { opacity: 1; }
.lp-volume { width: 0; opacity: 0; transition: width 200ms, opacity 200ms; accent-color: #fff; }
.lp-vol:hover .lp-volume, .lp-vol:focus-within .lp-volume { width: 80px; opacity: 1; }
.lp-vol { display: flex; align-items: center; }
.lp-menu { position: absolute; right: 0; bottom: 48px; background: rgb(16 18 26 / 0.96); border-radius: 10px; padding: 6px; min-width: 130px; display: none; box-shadow: 0 12px 30px rgb(0 0 0 / 0.5); }
.lp-menu.is-open { display: grid; }
.lp-menu button { padding: 8px 12px; border-radius: 6px; text-align: left; color: #fff; font-size: 13px; }
.lp-menu button:hover { background: rgb(255 255 255 / 0.1); }
.lp-menu button[aria-checked="true"] { color: var(--accent); font-weight: 700; }
.lp-speed-label { font-size: 12px; font-weight: 750; }

.lp-endcard { position: absolute; inset: 0; z-index: 7; display: none; place-items: center; text-align: center; background: rgb(5 7 13 / 0.88); backdrop-filter: blur(4px); padding: 24px; }
.lp.is-ended .lp-endcard { display: grid; }
.lp-endcard h3 { color: #fff; margin: 6px 0 18px; font-size: var(--fs-lg); }
.lp-endcard .eyebrow { color: rgb(255 255 255 / 0.6); }
.lp-endcard .count { width: 64px; height: 64px; margin: 0 auto 10px; }

.lp-toast { position: absolute; z-index: 8; top: 16px; left: 50%; transform: translateX(-50%); background: rgb(0 0 0 / 0.72); padding: 6px 12px; border-radius: var(--r-full); font-size: 13px; opacity: 0; transition: opacity 200ms; pointer-events: none; }
.lp-toast.is-visible { opacity: 1; }

@media (max-width: 600px) {
  .lp-btn { width: 36px; height: 36px; }
  .lp-hide-sm { display: none; }
  .lp-big { width: 64px; height: 64px; }
}

/* quizzes and checklist inside the course content panel */
.c-quiz .kind, .c-task .kind { color: var(--brand-700); }
.c-quiz .state, .c-task .state { background: var(--brand-50); color: var(--brand-700); }
.c-tasks { margin: 12px; padding: 12px; border-radius: 14px; border: 1px dashed var(--border-strong); display: grid; gap: 4px; }
