:root {
  --bg: #F6F8FF; --card: #FFFFFF; --text: #16162B; --body: #32384A; --muted: #8C92A6;
  --line: #E3E7F3; --accent: #3B5BFE; --accent2: #1FC998; --callout: #EEF2FF; --warn: #E8A23A;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--body);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { color: var(--text); line-height: 1.3; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top::after { content: ""; display: block; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.top-row { display: flex; justify-content: space-between; align-items: center; height: 56px; gap: 12px; }
.brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.who { color: var(--muted); font-size: 14px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.gate { margin-top: 48px; text-align: center; }
.course-title { margin: 28px 0 4px; font-size: 26px; }
.overall { margin: 16px 0 24px; }
.overall-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.bar { position: relative; height: 10px; background: var(--callout); border-radius: 99px; overflow: visible; }
.bar-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; }
.bar-mark { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--text); opacity: .5; }
.done-banner { margin-top: 14px; padding: 12px 14px; border-radius: 8px; background: #E6FAF3; color: #0F7A5A; font-weight: 600; }
.part-h { margin: 24px 0 10px; font-size: 15px; color: var(--muted); font-weight: 600; letter-spacing: .5px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.item { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; font: inherit; color: inherit; }
.item:hover:not(:disabled) { border-color: var(--accent); }
.item:disabled { cursor: not-allowed; opacity: .55; }
.num { flex: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
  background: var(--callout); color: var(--accent); font-weight: 700; }
.item.done .num { background: #E6FAF3; color: #0F9A70; }
.item-body { flex: 1; min-width: 0; }
.item-title { color: var(--text); font-weight: 600; }
.item-meta { font-size: 13px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; gap: 8px; }
.mini { height: 4px; margin-top: 8px; background: var(--callout); border-radius: 99px; overflow: hidden; }
.mini > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.tag-done { color: #0F9A70; font-weight: 600; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 16px 0 4px; font: inherit; }
.part { color: var(--muted); font-size: 14px; margin-top: 8px; }
#pTitle { margin: 4px 0 14px; font-size: 22px; }
.video-box { background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; }
video { width: 100%; height: 100%; display: block; }
.player-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; font-size: 14px; }
.speed button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 2px 8px; margin-left: 4px; cursor: pointer; font: inherit; font-size: 13px; }
.speed button.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.nav-row { display: flex; justify-content: space-between; margin: 20px 0 40px; }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; }
.btn.ghost { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); }

/* 管理頁 */
.admin h1 { margin: 24px 0 8px; font-size: 22px; }
.admin textarea { width: 100%; min-height: 110px; font: 14px/1.5 ui-monospace, Menlo, monospace; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.admin input[type=password] { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; width: 260px; max-width: 100%; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.stat .n { font-size: 28px; font-weight: 700; color: var(--text); }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 40px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
th { background: var(--callout); color: var(--text); position: sticky; top: 0; }
td.l, th.l { text-align: left; }
td.ok { color: #0F9A70; font-weight: 700; }
td.part { color: var(--warn); }
td.none { color: #C5CAD8; }
.small-btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 2px 8px; cursor: pointer; font: inherit; font-size: 12px; }
.small-btn.danger { color: #C0392B; }
.notice { background: #FFF6E5; color: #8A5A00; font-size: 13px; text-align: center; padding: 6px 16px; }
.link-box { width: 220px; font: 12px ui-monospace, Menlo, monospace; padding: 3px 6px; border: 1px solid var(--accent); border-radius: 6px; }
.admin .wrap { max-width: 1240px; }
