:root {
  --bg: #f5f6f8; --surface: #fff; --text: #1b2330; --muted: #5d6878; --border: #dde1e7;
  --brand: #1f3a5f; --accent: #2f6fb2; --good: #1e7f4f; --bad: #b3372f; --warn: #a86a00;
  --good-bg: #e6f4ec; --bad-bg: #fbeaea; --accent-bg: #e8f0fa;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151b; --surface: #1a2029; --text: #e6e9ee; --muted: #9aa4b2; --border: #2c3542;
    --brand: #9cc3ee; --accent: #6aa8e8; --good: #5cc48d; --bad: #f08a80; --warn: #e3b04b;
    --good-bg: #173326; --bad-bg: #3a1d1b; --accent-bg: #1c2b3d; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 10px 16px; }
.brand { font-weight: 800; color: var(--brand); text-decoration: none; font-size: 18px; }
.brand span { font-weight: 500; color: var(--muted); font-size: 14px; }
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: 14px; }
nav a.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
main { max-width: 980px; margin: 0 auto; padding: 20px 16px 40px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
h1 { font-size: 26px; margin: 0 0 6px; } h2 { font-size: 20px; margin: 24px 0 10px; } h3 { margin: 0 0 6px; font-size: 17px; } h4 { margin: 16px 0 4px; font-size: 15px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.stat .n { font-size: 28px; font-weight: 800; } .stat .l { color: var(--muted); font-size: 13px; }
.btn { display: inline-block; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: 8px; font: inherit; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.lo-list a { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--text); }
.lo-list a:hover { background: var(--accent-bg); }
.lo-list .done::after { content: "✓"; color: var(--good); font-weight: 700; }
.notes-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.notes-layout aside { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; }
.notes-body ul, .notes-body ol { padding-left: 22px; } .notes-body li { margin: 3px 0; }
.tip { background: var(--accent-bg); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 6px; }
.flash { min-height: 230px; display: flex; flex-direction: column; justify-content: center; text-align: center; cursor: pointer; font-size: 19px; padding: 28px; }
.flash .ans { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border); color: var(--text); font-size: 17px; }
.opt { display: block; width: 100%; text-align: left; margin: 8px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt.sel { border-color: var(--accent); background: var(--accent-bg); }
.opt.right { border-color: var(--good); background: var(--good-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt .k { display: inline-block; width: 24px; font-weight: 700; color: var(--muted); }
.expl { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--accent-bg); font-size: 15px; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 4px; }
.qgrid button { padding: 6px 0; font-size: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; cursor: pointer; }
.qgrid button.ans { background: var(--accent-bg); border-color: var(--accent); }
.qgrid button.flag { outline: 2px solid var(--warn); }
.qgrid button.cur { font-weight: 800; border-width: 2px; border-color: var(--text); }
.qgrid button.right { background: var(--good-bg); border-color: var(--good); }
.qgrid button.wrong { background: var(--bad-bg); border-color: var(--bad); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.timer.low { color: var(--bad); }
select, input[type=text], input[type=password], input[type=date] { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); max-width: 100%; }
.good-t { color: var(--good); } .bad-t { color: var(--bad); } .muted { color: var(--muted); }
.welcome { margin-bottom: 16px; border-left: 4px solid var(--accent); }
.welcome .steps { padding-left: 22px; margin: 8px 0 14px; } .welcome .steps li { margin: 4px 0; }
.welcome .steps a { text-decoration: none; }
.docnote { margin-top: 22px; border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: 8px; padding: 0 14px; }
.docnote summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.docnote[open] summary { border-bottom: 1px dashed var(--border); margin-bottom: 6px; }
.tbl { overflow-x: auto; margin: 10px 0; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.check input { margin-top: 5px; }
.check.on span { color: var(--muted); text-decoration: line-through; }
.pq { padding: 10px 0; border-bottom: 1px solid var(--border); }
/* ---- video lessons ---- */
.lessons { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lesson { text-decoration: none; color: var(--text); display: block; overflow: hidden; padding: 0; }
.lesson .thumb { aspect-ratio: 16/9; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; color: #fff; position: relative; }
.lesson .thumb b { font-size: 34px; line-height: 1; opacity: .9; }
.lesson .thumb span { font-weight: 700; font-size: 16px; }
.lesson .thumb::after { content: "▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -60%); width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: 22px; padding-left: 4px; box-sizing: border-box; transition: transform .2s; }
.lesson:hover .thumb::after { transform: translate(-50%, -60%) scale(1.12); }
.lesson .meta { padding: 10px 14px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }
.player { background: #0b1220; border-radius: 12px; overflow: hidden; color: #fff; }
.player:fullscreen { display: flex; flex-direction: column; justify-content: center; border-radius: 0; }
.stage { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.player:fullscreen .stage { aspect-ratio: auto; flex: 1; }
.bg { position: absolute; inset: 0; transition: background 1s; }
.bg::before, .bg::after { content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .35; animation: drift 18s ease-in-out infinite alternate; }
.bg::before { width: 45%; height: 60%; background: #6aa8e8; top: -10%; right: -5%; }
.bg::after { width: 40%; height: 50%; background: #e3b04b; bottom: -15%; left: -8%; animation-delay: -9s; opacity: .22; }
@keyframes drift { to { transform: translate(-8%, 10%) scale(1.15); } }
.scene { position: absolute; inset: 0; padding: 5% 6% 13%; display: flex; flex-direction: column; justify-content: center; animation: sceneIn .6s ease both; }
@keyframes sceneIn { from { opacity: 0; transform: translateY(18px); } }
.scene .kicker { font-size: clamp(11px, 1.6vw, 14px); letter-spacing: .08em; text-transform: uppercase; color: #9cc3ee; font-weight: 700; margin-bottom: .6em; }
.scene h2 { font-size: clamp(18px, 3.4vw, 34px); margin: 0 0 .7em; line-height: 1.2; }
.scene.title h2 { font-size: clamp(24px, 5vw, 52px); }
.scene .big-sub { font-size: clamp(13px, 2vw, 20px); color: #c9d6e6; }
.scene ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55em; font-size: clamp(12px, 1.9vw, 19px); line-height: 1.4; }
.scene li { padding: .45em .8em; border-radius: 8px; border-left: 3px solid transparent; background: rgba(255,255,255,.04); opacity: 0; transform: translateX(-14px); transition: all .45s ease; }
.scene li.in { opacity: .72; transform: none; }
.scene li.now { opacity: 1; background: rgba(106,168,232,.16); border-left-color: #6aa8e8; }
.scene li ul { font-size: .88em; margin-top: .3em; gap: .2em; } .scene li li { opacity: 1; transform: none; background: none; padding: 0 0 0 1em; }
.scene li b { color: #ffd98a; }
.scene .qa { font-size: clamp(15px, 2.6vw, 26px); }
.scene .qa .a { margin-top: 1em; color: #8fe0b0; opacity: 0; transition: opacity .5s; } .scene .qa .a.in { opacity: 1; }
.scene .think { margin-top: .8em; color: #9cc3ee; font-size: .7em; }
.cc { position: absolute; left: 6%; right: 6%; bottom: 4%; text-align: center; font-size: clamp(11px, 1.6vw, 16px); background: rgba(0,0,0,.55); padding: .4em .8em; border-radius: 6px; }
.cc:empty { display: none; }
.bigplay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); border: 0; color: #fff; font-size: 64px; cursor: pointer; }
.bigplay[hidden] { display: none; }
.scene.mcq { justify-content: center; }
.scene .mq { font-size: clamp(14px, 2.4vw, 24px); font-weight: 700; margin-bottom: .8em; line-height: 1.3; }
.scene .mopts { display: grid; grid-template-columns: 1fr 1fr; gap: .5em; }
.scene .mo { text-align: left; font: inherit; font-size: clamp(11px, 1.7vw, 17px); color: #fff; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.18); border-radius: 8px; padding: .55em .8em; cursor: pointer; display: flex; gap: .6em; align-items: baseline; transition: all .25s; }
.scene .mo span { font-weight: 800; color: #9cc3ee; }
.scene .mo:hover:not(:disabled) { background: rgba(106,168,232,.22); border-color: #6aa8e8; transform: translateY(-1px); }
.scene .mo.right { background: rgba(92,196,141,.25); border-color: #5cc48d; }
.scene .mo.wrong { background: rgba(240,138,128,.22); border-color: #f08a80; }
.scene .mo.dim { opacity: .45; }
.scene .mfb { margin-top: .8em; font-size: clamp(11px, 1.6vw, 16px); padding: .5em .8em; border-radius: 8px; background: rgba(255,255,255,.06); }
.scene .mfb.ok { border-left: 3px solid #5cc48d; } .scene .mfb.no { border-left: 3px solid #f08a80; }
.scene .think .linkbtn { background: none; border: 0; color: #9cc3ee; text-decoration: underline; font: inherit; cursor: pointer; padding: 0; }
.timeline .tick.qtick { background: #e3b04b; width: 4px; }
.watchbtn { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 6px 0 14px; background: var(--accent-bg); }
.watchbtn:hover { border-color: var(--accent); }
.watchbtn > span { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; padding-left: 3px; box-sizing: border-box; }
.watchbtn small { display: block; color: var(--muted); }
@media (max-width: 560px) { .scene .mopts { grid-template-columns: 1fr; } .scene { padding-bottom: 15%; } }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px 10px; background: #111a2b; font-size: 14px; }
.controls button, .controls select { background: transparent; border: 1px solid #2c3a52; color: #fff; border-radius: 6px; padding: 5px 10px; font: inherit; cursor: pointer; }
.controls select option { color: #000; }
.controls .grow { flex: 1; }
.timeline { height: 6px; background: #2c3a52; cursor: pointer; position: relative; }
.timeline i { position: absolute; inset: 0 auto 0 0; background: #6aa8e8; transition: width .3s; }
.timeline .tick { position: absolute; top: 0; bottom: 0; width: 2px; background: #0b1220; }
.chapters { margin-top: 12px; }
.chapters button { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 8px 4px; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.chapters button.cur { color: var(--accent); font-weight: 700; }
@media (max-width: 720px) {
  .notes-layout { grid-template-columns: 1fr; }
  .notes-layout aside { position: static; max-height: none; }
  nav a { padding: 6px 8px; }
}
