:root {
  --bg: #f5f6fa; --card: #fff; --text: #111827; --muted: #6b7280; --line: #e8eaf0; --line-2: #f0f1f5;
  --soft: #f8f9fc;
  --accent: #4f46e5; --accent-2: #6366f1; --accent-weak: #eef0ff; --accent-line: #c7cbfb;
  --danger: #dc2626; --danger-weak: #fef2f2; --ok: #059669; --ok-weak: #ecfdf5; --warn: #d97706; --warn-weak: #fffbeb;
  --r: 12px; --r-sm: 8px;
  --sh-1: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --sh-2: 0 4px 12px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.05);
  --sh-3: 0 24px 60px rgba(16,24,40,.22), 0 4px 14px rgba(16,24,40,.08);
  --ring: 0 0 0 3px rgba(79,70,229,.16);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; }
.hidden, [hidden] { display: none !important; }
::selection { background: var(--accent-weak); }

/* 顶栏 */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  height: 54px; padding: 0 16px; background: rgba(255,255,255,.86); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); }
.bar .title { flex: 1; font-weight: 650; font-size: 16px; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .link { color: var(--muted); font-size: 14px; background: none; border: 0; padding: 6px 10px; border-radius: var(--r-sm); white-space: nowrap; }
.bar .link:hover { background: var(--line-2); color: var(--text); }

.wrap { max-width: 720px; margin: 0 auto; padding: 18px 16px 32px; }
.empty { text-align: center; color: var(--muted); padding: 56px 0; font-size: 14px; }

/* 卡片 / 列表 */
.card { display: block; background: var(--card); border-radius: var(--r); padding: 16px 18px; margin-bottom: 12px;
  color: var(--text); border: 1px solid var(--line); box-shadow: var(--sh-1); transition: box-shadow .2s, transform .2s, border-color .2s; }
a.card:hover, a.card:active { border-color: var(--accent-line); box-shadow: var(--sh-2); transform: translateY(-1px); }
a.card { position: relative; padding-left: 22px; }
a.card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.card p { margin: 0; color: var(--muted); font-size: 13px; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: var(--card);
  border-bottom: 1px solid var(--line-2); color: var(--text); transition: background .15s; }
a.item:hover { background: var(--soft); }
.item:first-child { border-radius: var(--r) var(--r) 0 0; }
.item:last-child { border-radius: 0 0 var(--r) var(--r); border-bottom: 0; }
.item .no { width: 24px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.item .name { flex: 1; min-width: 0; }
.item .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.item.current { background: var(--accent-weak); color: var(--accent); }
.item.current .meta, .item.current .no { color: var(--accent); opacity: .8; }
.item.disabled { color: var(--muted); pointer-events: none; }

/* 登录 */
.login { max-width: 380px; margin: 10vh auto 0; padding: 32px 28px 26px; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--sh-2); }
.login h1 { font-size: 22px; margin: 0 0 6px; text-align: center; font-weight: 700; letter-spacing: .5px; }
.login h1::before { content: ""; display: block; width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 6.8v10.4a.8.8 0 0 0 1.2.7l8.2-5.2a.8.8 0 0 0 0-1.4L10.2 6.1A.8.8 0 0 0 9 6.8z'/%3E%3C/svg%3E") center / 24px no-repeat,
    linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 20px rgba(79,70,229,.3); }
.login h1::after { content: ""; display: block; height: 18px; }
@media (max-width: 440px) { .login { margin: 6vh 14px 0; padding: 28px 20px 22px; } }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input, select, textarea { width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: #d5d8e2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; cursor: pointer; box-shadow: none; }
::placeholder { color: #a6acb9; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 9px 16px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; color: var(--text); font-weight: 500; line-height: 1.4; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: background .15s, border-color .15s, box-shadow .15s, color .15s; }
.btn:hover { background: var(--soft); border-color: #d5d8e2; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.3); }
.btn.primary:hover { background: #4338ca; border-color: #4338ca; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: var(--danger-weak); border-color: #fca5a5; }
.btn.block { display: flex; width: 100%; padding: 11px 16px; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.err { color: var(--danger); font-size: 13px; min-height: 20px; margin: 8px 0; white-space: pre-wrap; }

/* 播放器 */
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.stage .big-play { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border-radius: 50%; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); color: #fff; font-size: 24px; display: flex;
  align-items: center; justify-content: center; z-index: 3; padding-left: 4px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.stage .ctrl { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; align-items: center;
  gap: 8px; padding: 22px 10px 8px; background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff;
  font-size: 12px; transition: opacity .25s; }
.stage .ctrl.off { opacity: 0; pointer-events: none; }
.stage .subs { position: absolute; left: 4%; right: 4%; bottom: 7%; z-index: 3; text-align: center; pointer-events: none;
  font-size: 14px; line-height: 1.35; transition: bottom .2s; }
.stage .subs.lift { bottom: calc(7% + 34px); }
.stage .subs span { display: inline-block; max-width: 100%; padding: .12em .5em; border-radius: 4px; color: #fff;
  background: rgba(0,0,0,.55); white-space: pre-line; text-shadow: 0 1px 2px rgba(0,0,0,.8); word-break: break-word; }
.stage .ctrl #bSub.off { opacity: .45; text-decoration: line-through; }
.stage .ctrl button { background: none; border: 0; color: #fff; padding: 4px 6px; font-size: 14px; min-width: 32px; }
.stage .ctrl input[type=range] { flex: 1; padding: 0; border: 0; background: transparent; accent-color: #fff; min-width: 0; box-shadow: none; }
.stage .ctrl .t { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stage .msg { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.8); color: #fff;
  text-align: center; font-size: 14px; }
.stage .msg button { padding: 6px 18px; border-radius: 16px; border: 1px solid #fff; background: none; color: #fff; }
.stage.pseudo-fs { position: fixed; inset: 0; z-index: 100; width: 100vw; height: 100vh; aspect-ratio: auto; }
.stage.pseudo-fs.rot { inset: auto; top: 0; left: 100vw; width: 100vh; height: 100vw;
  transform-origin: 0 0; transform: rotate(90deg); }
.play-info { padding: 14px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.play-info h2 { margin: 0; font-size: 17px; font-weight: 650; }
.play-info p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.section-title { padding: 18px 16px 8px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .5px; }
#list > .item:first-child { border-top-left-radius: var(--r); border-top-right-radius: var(--r); }

/* 课程页:可折叠的章节(二级目录) */
.cat-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.cat-tools input { flex: 1; min-width: 0; padding: 8px 12px; }
.cat-tools .btn { white-space: nowrap; }
.cat { margin-bottom: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh-1); }
.cat.on { border-color: var(--accent-line); }
.cat-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 15px 16px; border: 0; background: none;
  text-align: left; color: var(--text); }
.cat.on .cat-head { background: var(--accent-weak); }
.cat-head .chev { width: 18px; color: var(--accent); font-size: 16px; text-align: center; }
.cat-head .cat-name { flex: 1; min-width: 0; font-weight: 650; font-size: 16px; }
.cat-head .cat-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.cat-head .cat-meta b { color: var(--ok); font-weight: 600; }
.cat-body { border-top: 1px solid var(--line); }
.cat-body .item { border-radius: 0 !important; }
.cat-body .item:last-child { border-bottom: 0; }
.cont { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 14px 16px; border-radius: var(--r);
  background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 22px rgba(79,70,229,.28); }
.cont .cont-tag { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,.22); white-space: nowrap; }
.cont .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cont .go { font-size: 20px; }
