:root, [data-theme="warm"] {
  --bg: #f1e8dc; --panel: #f7f0e6; --card: #fcf8f2; --line: #eadccb; --ink: #2b2118; --ink2: #5a4836; --muted: #a08d77;
  --accent: #d1803f; --accent-ink: #b5652a; --chip: #fbe8d4; --chip-line: #edc29a; --green: #2f8a5b; --green-soft: #dcefe2;
  --red: #c4404f; --warn: #b4472f; --shadow: 0 1px 2px #6b4a2a14, 0 6px 20px #6b4a2a0f;
}
[data-theme="dark"] {
  --bg: #10121c; --panel: #171a28; --card: #1f2336; --line: #2c3150; --ink: #e9eaf5; --ink2: #b8bbd6; --muted: #7c80a3;
  --accent: #8f96ff; --accent-ink: #aab0ff; --chip: #2a2f55; --chip-line: #4c538f; --green: #5cc192; --green-soft: #1c3a30;
  --red: #e0606e; --warn: #e0705a; --shadow: 0 1px 2px #0006, 0 6px 20px #0004;
}
[data-theme="mint"] {
  --bg: #e4eee6; --panel: #eef5ef; --card: #f8fbf8; --line: #d3e2d6; --ink: #1d2b22; --ink2: #3f5446; --muted: #7d9183;
  --accent: #2f8a5b; --accent-ink: #26744c; --chip: #dcefe2; --chip-line: #a5d0b3; --green: #2f8a5b; --green-soft: #cfe8d7;
  --red: #c4404f; --warn: #b4472f; --shadow: 0 1px 2px #1d3a2614, 0 6px 20px #1d3a260f;
}
:root { --sans: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "PingFang SC", "Helvetica Neue", sans-serif; --fs: 17px; }
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: .35; cursor: default; }
input, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; display: block; }
.muted { color: var(--muted); } .small { font-size: 13px; } .warn { color: var(--warn); min-height: 1.2em; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.rec { background: var(--red); border-color: var(--red); }
.chip, .tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--chip); color: var(--accent-ink); border: 1px solid var(--chip-line); font-size: 12px; font-weight: 600; }

/* ---------- library ---------- */
.nav { display: flex; align-items: center; gap: 28px; padding: 14px 26px; background: var(--panel); border-radius: 22px; box-shadow: var(--shadow); }
.nav .back { display: flex; align-items: center; gap: 2px; color: var(--ink2); }
.nav .back svg { width: 18px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; }
.mark { width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 18px; }
.nav nav { display: flex; gap: 32px; margin-left: auto; margin-right: auto; color: var(--ink2); font-weight: 600; }
.nav nav a.on, .nav nav a:hover { color: var(--accent-ink); }
.lib { max-width: 1080px; margin: 0 auto; padding: 16px 16px 60px; }
.hero { padding: 40px 6px 20px; }
.hero h1 { font-size: 38px; margin: 0; letter-spacing: -.5px; }
.hero p { color: var(--muted); margin: 8px 0 0; }
.ltabs { display: flex; gap: 8px; margin: 10px 0 20px; }
.ltabs button { padding: 7px 16px; border-radius: 999px; background: var(--panel); font-weight: 600; color: var(--ink2); }
.ltabs button.on { background: var(--accent); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.ep { display: flex; flex-direction: column; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); transition: transform .15s; }
.ep:hover { transform: translateY(-3px); }
.ep .cv { position: relative; }
.ep img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; background: var(--line); }
.ep .body { padding: 12px 14px 0; }
.ep h3 { display: flex; gap: 7px; align-items: flex-start; margin: 0 0 12px; font-size: 15px; line-height: 1.4; }
.ep h3 svg { flex: none; width: 17px; height: 17px; margin-top: 1px; color: var(--muted); }
.ep h3 span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep h3 b { font-weight: 800; }
.props { display: grid; grid-template-columns: 60px 1fr; gap: 9px 10px; align-items: center; margin: 0; font-size: 13px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; min-width: 0; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--muted); display: grid; place-items: center; color: transparent; }
.ck svg { width: 13px; height: 13px; stroke-width: 3.5; }
.ck.on { background: var(--green); border-color: var(--green); color: #fff; }
.badge-cv { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: #000a; color: #fff; font-size: 12px; font-weight: 700; }
.badge-cv svg { width: 12px; height: 12px; }
.badge-cv.ok { background: var(--green); color: #fff; }
.fv { position: absolute; right: 10px; top: 10px; width: 28px; height: 28px; border-radius: 50%; background: #000a; color: #ffc94d; display: grid; place-items: center; }
.fv svg { width: 15px; height: 15px; fill: currentColor; }
.ep .pbar { margin: 14px 14px 14px; }
.vbar { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin: 4px 0 14px; border-bottom: 1px solid var(--line); }
.views { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.views button { display: flex; align-items: center; gap: 6px; padding: 12px 0; margin-bottom: -1px; border-bottom: 2.5px solid transparent; font-weight: 700; font-size: 14px; color: var(--muted); white-space: nowrap; }
.views button svg { width: 16px; height: 16px; }
.views button.on { color: var(--ink); border-color: var(--ink); }
.vbar .lfilter { flex: 1; justify-content: flex-end; margin: 0; padding: 6px 0; }
.grp { margin-bottom: 30px; }
.grp h2 { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 14px; font-size: 20px; }
.grp h2 small { color: var(--muted); font-size: 14px; }
.rows { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto auto 40px 20px; align-items: center; gap: 14px; padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; font-size: 14px; }
.row:hover { border-color: var(--chip-line); }
.row .vol { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.row .rt { display: grid; min-width: 0; }
.row .rt b, .row .rt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .rt small { color: var(--muted); }
.row .rp { text-align: right; color: var(--accent-ink); font-weight: 700; font-size: 13px; }
@media (max-width: 860px) {
  .vbar .lfilter { flex-basis: 100%; }
  .vbar .lfilter input { max-width: none; }
  .row { grid-template-columns: 52px minmax(0, 1fr) auto 20px; gap: 10px; padding: 12px; }
  .row .rc + .rc, .row .rp { display: none; }
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag.lock { background: var(--panel); color: var(--muted); border-color: var(--line); }
.tag.ok { background: var(--green-soft); color: var(--green); border-color: transparent; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---------- learn: desktop ---------- */
body.learn { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding: 14px 16px 0; gap: 12px; }
body.learn .nav { flex: none; }
body.folded .nav { display: none; }
.fold { position: absolute; left: 50%; top: 66px; transform: translateX(-50%); width: 60px; height: 22px; border-radius: 0 0 14px 14px; background: var(--panel); color: var(--muted); display: grid; place-items: center; z-index: 3; }
.fold svg { width: 16px; }
body.folded .fold { top: 0; transform: translateX(-50%) rotate(180deg); border-radius: 14px 14px 0 0; }
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: 92px minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 14px; }

.side { display: flex; flex-direction: column; gap: 8px; background: var(--panel); border-radius: 22px; padding: 14px 8px; box-shadow: var(--shadow); }
.side button { position: relative; display: grid; justify-items: center; gap: 8px; padding: 12px 4px; border-radius: 16px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.side button i { width: 46px; height: 46px; border-radius: 50%; background: var(--card); display: grid; place-items: center; box-shadow: var(--shadow); }
.side button.on { background: var(--chip); }
.side button.on i { background: var(--accent); color: #fff; }
.badge { position: absolute; top: 4px; right: 12px; min-width: 22px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; border: 2px solid var(--panel); }

.stage { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.titlebar { flex: none; display: flex; align-items: center; gap: 12px; }
.epno { flex: none; padding: 6px 14px; border-radius: 999px; background: var(--chip); color: var(--accent-ink); font-weight: 700; font-size: 14px; }
.titlebar h1 { flex: 1; min-width: 0; margin: 0; font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { flex: none; display: flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 999px; background: var(--panel); color: var(--accent-ink); font-weight: 700; font-size: 14px; box-shadow: var(--shadow); }
.pill svg { width: 16px; height: 16px; }
.pill.green.on { background: var(--green); color: #fff; }
.pill[data-act="fav"].on svg, .rb.st.on svg, .acts .on svg, .wc-acts .on svg { fill: currentColor; }
.pill[data-act="fav"].on { background: var(--chip); }

.vcard { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; background: var(--panel); border-radius: 22px; padding: 16px; box-shadow: var(--shadow); }
.player { position: relative; flex: none; border-radius: 16px; overflow: hidden; background: #000; cursor: pointer; }
.player video { display: block; width: 100%; aspect-ratio: 16/9; max-height: 52vh; object-fit: contain; pointer-events: none; }
.player .big { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; opacity: 0; transition: opacity .15s; pointer-events: none; }
.player .big::after { content: ""; position: absolute; left: 22px; top: 12px; border-left: 46px solid #fffe; border-top: 26px solid transparent; border-bottom: 26px solid transparent; filter: drop-shadow(0 2px 8px #0005); border-radius: 6px; }
.player.paused .big { opacity: 1; }
.vtop { display: none; }

.cur { flex: 1; min-height: 0; overflow-y: auto; background: var(--card); border-radius: 18px; padding: 22px 24px 16px; display: flex; flex-direction: column; }
.cbody { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 4px; }
.cur .fr { font-size: calc(var(--fs) + 7px); font-weight: 700; line-height: 1.6; }
.cur .zh { font-size: calc(var(--fs) + 1px); color: var(--ink2); margin-top: 8px; line-height: 1.6; font-weight: 600; }
.cur .row { display: flex; gap: 8px; margin-top: 14px; justify-content: center; flex-wrap: wrap; align-items: center; }
.cur textarea { width: 100%; min-height: 90px; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: calc(var(--fs) + 3px); background: var(--panel); resize: vertical; text-align: left; outline: none; }
.cur textarea:focus { border-color: var(--chip-line); }
#score { font-weight: 700; color: var(--accent-ink); }
#result { margin-top: 12px; }
.cfoot { flex: none; display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 14px; font-weight: 600; }
.cfoot .tag { font-size: 13px; }
.hid { filter: blur(8px); user-select: none; }

.subs { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.subs-h { flex: none; padding: 16px 22px 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.printhead { display: none; }
.tabs { flex: none; display: flex; gap: 30px; padding: 6px 26px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { position: relative; padding: 12px 0; font-weight: 700; font-size: 17px; color: var(--ink2); white-space: nowrap; }
.tabs button.on { color: var(--ink); }
.tabs button.on::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 40px; height: 3px; margin-left: -20px; border-radius: 3px; background: var(--accent); }
.list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.s { background: var(--card); border: 2px solid transparent; border-radius: 18px; padding: 16px 18px 8px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s; }
.s.active { border-color: var(--chip-line); box-shadow: 0 0 0 4px var(--chip), var(--shadow); }
.s .fr { font-size: var(--fs); font-weight: 700; line-height: 1.75; }
.s .zh { font-size: calc(var(--fs) - 1px); color: var(--ink2); margin-top: 8px; line-height: 1.6; font-weight: 500; }
.foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 13px; font-weight: 600; }
.acts { margin-left: auto; display: flex; gap: 2px; }
.acts button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.acts button:not(:disabled):hover { background: var(--chip); color: var(--accent-ink); }
.acts svg { width: 17px; height: 17px; }
.acts .on { color: var(--accent); }
.acts .rec { color: #fff; background: var(--red) !important; }
/* word categories: one hue each, chip colors derived from it */
.c-vocab { --c: #b3712f; } .c-colloc { --c: #b5506d; } .c-pattern { --c: #5d62a3; } .c-slang { --c: #8a7a3c; }
.c-term { --c: #4c805a; } .c-interj { --c: #2f8590; } .c-grammar { --c: #b04a3c; }
[data-theme="dark"] .c-vocab { --c: #e8a467; } [data-theme="dark"] .c-colloc { --c: #ee8fa8; } [data-theme="dark"] .c-pattern { --c: #a9adff; }
[data-theme="dark"] .c-slang { --c: #d6c57e; } [data-theme="dark"] .c-term { --c: #8fd09f; } [data-theme="dark"] .c-interj { --c: #7fd2dc; } [data-theme="dark"] .c-grammar { --c: #f19a8b; }
.w, .cz, .chip[class*="c-"] { color: var(--c); background: color-mix(in srgb, var(--c) 13%, var(--card)); border: 1.5px solid color-mix(in srgb, var(--c) 40%, transparent); }
.w { padding: 2px 9px; border-radius: 999px; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.w:hover { border-color: var(--c); }
.w.saved::after { content: "★"; font-size: .7em; margin-left: 3px; vertical-align: 1px; }
.cz { font: inherit; font-weight: 700; padding: 1px 10px; border-radius: 999px; cursor: pointer; letter-spacing: 1px;
  background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, transparent) 0 4px, transparent 4px 8px); color: transparent; min-width: 4em; }
.cz.rev { background-image: none; color: var(--c); letter-spacing: 0; }
.dz { font: inherit; font-weight: 700; text-align: center; padding: 1px 8px; margin: 2px 0; border-radius: 10px; outline: none; color: var(--c);
  background: color-mix(in srgb, var(--c) 8%, var(--card)); border: 1.5px solid color-mix(in srgb, var(--c) 40%, transparent); }
.dz:focus { border-color: var(--c); }
.dz.ok { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.dz.given { border-style: dashed; }
.fd { width: 100%; min-height: 70px; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--panel); font-size: var(--fs); resize: vertical; outline: none; }
.fd:focus { border-color: var(--chip-line); }
.dres:not(:empty) { margin-top: 8px; }
.dres .score { font-weight: 800; color: var(--accent-ink); font-size: 13px; }
.ans { display: none; margin-top: 8px; padding-top: 8px; border-top: 1.5px dashed var(--line); color: var(--ink2); }
.s.shown .ans { display: block; }
.stage-card { margin: 8px 4px; background: var(--card); border-radius: 22px; padding: 28px 22px 20px; text-align: center; box-shadow: var(--shadow); display: grid; gap: 10px; justify-items: center; }
.stage-card .fr { font-size: calc(var(--fs) + 6px); font-weight: 800; line-height: 1.6; }
.stage-card .zh { color: var(--ink2); font-weight: 600; }
.stage-card.hidden .fr, .stage-card.hidden .zh { filter: blur(8px); user-select: none; }
.tchips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tchips span { padding: 4px 12px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 700; font-size: 13px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.blank { display: inline-block; min-width: 3.2em; border-bottom: 2.5px solid var(--accent); color: transparent; user-select: none; }
.blind .s:not(.shown) .fr, .blind .s:not(.shown) .zh { filter: blur(7px); user-select: none; }
.gap { border: 0; border-bottom: 2.5px solid var(--accent); background: transparent; font-weight: 700; font-size: inherit; text-align: center; padding: 0 2px; outline: none; color: var(--accent-ink); }
.gap.ok { color: var(--green); border-color: var(--green); }
.ok { color: var(--green); } .bad { color: var(--warn); text-decoration: underline wavy; }
body.fr-only .s .zh, body.fr-only .cur .zh, body[data-mode="cloze"] .s .zh, body[data-mode="cloze"] .cur .zh { display: none; }

.dock { flex: none; margin: 0 -16px; padding: 0 24px 10px; background: var(--panel); border-top: 1px solid var(--line); }
:is(#seek, #imseek) { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer; --p: 0%; }
:is(#seek, #imseek)::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line) var(--p)); }
:is(#seek, #imseek)::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line) var(--p)); }
:is(#seek, #imseek)::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--card); border: 3px solid var(--accent); }
:is(#seek, #imseek)::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 3px solid var(--accent); }
.dmeta { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.dmeta b { font-size: 20px; color: var(--ink); }
.tools { display: flex; justify-content: center; align-items: flex-end; gap: 4px; margin-top: 2px; }
.tools > button { display: grid; justify-items: center; gap: 4px; min-width: 60px; padding: 2px 4px; font-size: 12px; font-weight: 600; color: var(--ink2); }
.tools > button i { width: 44px; height: 44px; border-radius: 50%; background: var(--card); display: grid; place-items: center; box-shadow: var(--shadow); color: var(--ink); }
.tools > button i.txt { font-style: normal; font-weight: 800; font-size: 13px; }
.tools > button.on i { background: var(--accent); color: #fff; }
.tools > button.play i { width: 56px; height: 56px; background: var(--accent); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent); }
.tools > button.play svg { width: 22px; height: 22px; }
.tools .m { display: none; }
body[data-mode="shadow"] .tools .tn, body:not([data-mode="shadow"]) .tools .ts { display: none !important; }
.sep { width: 1px; height: 44px; background: var(--line); margin: 0 14px 20px; }

/* sheets */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: #2b211866; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: min(940px, 100%); max-height: 86vh; overflow-y: auto; background: var(--panel); border-radius: 26px 26px 0 0; padding: 10px 22px 26px; box-shadow: 0 -10px 40px #0003; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.grab { width: 44px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 10px; }
.sh-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.sh-t { flex: 1; min-width: 0; }
.sh-head h2 { margin: 0 0 8px; font-size: 26px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.x { flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--chip); color: var(--accent-ink); display: grid; place-items: center; }
.x.bk { background: var(--card); color: var(--ink2); }
.wcard { background: var(--card); border-radius: 18px; padding: 18px 20px 12px; border-top: 4px solid var(--c, var(--red)); box-shadow: var(--shadow); }
.wc-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.wc-top b { font-size: 22px; color: var(--c, var(--accent-ink)); }
.wc-top .cat { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--c); }
.qm { cursor: pointer; letter-spacing: 2px; opacity: .6; }
.wc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wc-top i { color: var(--muted); font-size: 14px; }
.ipa { display: flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--ink2); font-size: 14px; min-height: 28px; }
.ib { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); }
.ib svg { width: 16px; height: 16px; }
.wcard hr { border: 0; border-top: 1.5px dashed var(--line); margin: 12px 0; }
.lab { font-size: 12px; letter-spacing: 1.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.def { color: var(--ink); }
.zhm { font-size: 22px; font-weight: 800; margin: 8px 0 12px; }
.ex { background: var(--panel); border-left: 3px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 10px; }
.exf { font-style: italic; font-size: 17px; }
.exz { color: var(--ink2); margin-top: 4px; font-size: 14px; }
.ex.src { border-left-color: var(--chip-line); }
.ex.src .exf { font-style: normal; font-size: 15px; }
.cefr { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-weight: 700; letter-spacing: 1px; color: var(--ink2); background: var(--panel); }
.wc-acts { display: flex; justify-content: flex-end; gap: 12px; }
.wc-acts button { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); display: grid; place-items: center; font-weight: 800; color: var(--ink2); }
.wc-acts button.on { color: var(--accent); border-color: var(--chip-line); background: var(--chip); }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.vitem { text-align: left; background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); border: 1.5px solid transparent; }
.vitem:hover { border-color: var(--chip-line); }
.vitem b { display: block; color: var(--accent-ink); font-size: 16px; }
.vitem span { color: var(--ink2); font-size: 13px; }
.vitem.saved { border-color: var(--green); }
.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.toc { display: flex; flex-direction: column; gap: 10px; }
.ti { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); border: 2px solid transparent; }
.ti.here { border-color: var(--chip-line); }
.ti img { width: 120px; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: var(--line); flex: none; }
.ti div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ti small { color: var(--accent-ink); font-weight: 700; }
.ti span { color: var(--muted); font-size: 13px; }
.ti em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--green); }
.ti em.lock { color: var(--muted); }
.moregrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 8px; }
.moregrid button { display: grid; justify-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.moregrid i { width: 52px; height: 52px; border-radius: 50%; background: var(--card); display: grid; place-items: center; box-shadow: var(--shadow); color: var(--ink); }
.moregrid button.on i { background: var(--accent); color: #fff; }
.help p { line-height: 1.7; margin: 0 0 10px; }
.toast { position: fixed; left: 50%; bottom: 150px; transform: translate(-50%, 10px); z-index: 50; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.lockbox { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 94%, transparent); z-index: 30; display: grid; place-items: center; }
.lockbox > div { background: var(--panel); border-radius: 22px; padding: 30px; width: min(380px, 90vw); text-align: center; box-shadow: var(--shadow); }
.lockbox h2 { margin: 0; }
.lockbox input { width: 100%; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; margin: 14px 0 10px; text-align: center; letter-spacing: 2px; text-transform: uppercase; background: var(--card); }
[hidden] { display: none !important; }

/* ---------- learn: phone ---------- */
@media (max-width: 860px) {
  .nav nav { display: none; }
  .lib .nav { gap: 16px; padding: 12px 16px; }
  body.learn { padding: 0; gap: 0; }
  body.learn .nav, .fold, .titlebar, .subs-h, .side button i { display: none; }
  .app, .stage { display: contents; }
  .vcard { display: contents; }
  .player { order: 1; border-radius: 0; }
  .player video { max-height: 40vh; }
  .vtop { display: flex; align-items: center; gap: 10px; position: absolute; left: 0; right: 0; top: 0; padding: max(10px, env(safe-area-inset-top)) 12px 10px; background: linear-gradient(#0008, transparent); color: #fff; }
  .vtop span { flex: 1; text-align: center; font-weight: 800; font-size: 17px; text-shadow: 0 1px 4px #0008; }
  .rb { width: 40px; height: 40px; border-radius: 50%; background: #5a5f6a99; color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
  .rb.ok.on { background: var(--green); } .rb.st.on { background: var(--accent); }
  .subs { order: 2; flex: 1; border-radius: 0; box-shadow: none; background: var(--bg); }
  .tabs { padding: 0 22px; gap: 26px; background: var(--panel); }
  .tabs button { font-size: 16px; }
  .cur { order: 3; flex: none; max-height: 34vh; margin: 0 10px 8px; padding: 14px 16px 10px; box-shadow: var(--shadow); }
  .cur { display: none !important; }
  .cur .fr { font-size: calc(var(--fs) + 2px); }
  .cfoot { margin-top: 8px; font-size: 12px; }
  .list { padding: 10px; gap: 10px; }
  .s { padding: 14px 16px 6px; }
  .acts button { width: 32px; height: 32px; }
  .dock { order: 4; margin: 0; padding: 0 10px 4px; }
  .dmeta b { font-size: 16px; }
  .tools { justify-content: space-between; gap: 0; }
  .tools .d { display: none; }
  .tools .m { display: grid; }
  .tools > button { min-width: 0; flex: 1; background: none; }
  .tools > button i { width: 36px; height: 36px; background: none; box-shadow: none; }
  .tools > button.on i { background: var(--chip); color: var(--accent-ink); }
  .tools > button.play { flex: 1.2; }
  .tools > button.play i { width: 50px; height: 50px; background: var(--accent); color: #fff; margin-top: -10px; }
  .o1 { order: 1; } .o2 { order: 2; } .o3 { order: 3; } .o4 { order: 4; } .o5 { order: 5; } .o6 { order: 6; } .o7 { order: 7; }
  .side { order: 5; flex-direction: row; gap: 0; border-radius: 0; padding: 0 0 env(safe-area-inset-bottom); box-shadow: none; border-top: 1px solid var(--line); }
  .side button { flex: 1; display: flex; justify-content: center; align-items: center; gap: 6px; padding: 14px 0; border-radius: 0; font-size: 15px; }
  .side button.on { background: var(--chip); }
  .badge { position: static; border: 0; order: 2; }
  .toast { bottom: 170px; }
  .sheet { max-height: 88vh; padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); }
  .sh-head h2 { font-size: 22px; }
  .bgrid { grid-template-columns: 1fr; }
  .vgrid { grid-template-columns: repeat(2, 1fr); }
  .ti img { width: 96px; }
}

/* ---------- print (PDF) ---------- */
@media print {
  body.learn { display: block; height: auto; overflow: visible; padding: 0; background: #fff; }
  .nav, .fold, .side, .stage, .dock, .tabs, .subs-h, .acts, .sheet-bg, .toast, .lockbox { display: none !important; }
  .app, .subs, .list { display: block; overflow: visible; background: none; box-shadow: none; }
  .printhead { display: block; font-size: 22px; margin: 0 0 12px; }
  .s { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; margin-bottom: 8px; padding: 10px 14px; }
  .s .fr, .s .zh { filter: none !important; }
  .w { background: none; border: 0; padding: 0; text-decoration: underline; color: inherit; }
}
.hov { position: fixed; z-index: 35; width: min(460px, calc(100vw - 16px)); max-height: 70vh; overflow-y: auto; border-radius: 18px; box-shadow: 0 12px 40px #2b211833; animation: fade .12s; }
.hov .wcard { box-shadow: none; }

/* tabs toggle icon */
.tabs button { display: inline-flex; align-items: center; gap: 4px; }
.tabs .tg svg { width: 14px; height: 14px; }
.tabs .tg { color: var(--muted); }
/* video overlays */
.osd { position: absolute; left: 6%; right: 6%; bottom: 14px; text-align: center; pointer-events: none; display: grid; gap: 4px; justify-items: center; }
.osd b, .osd span { background: #000a; color: #fff; padding: 3px 10px; border-radius: 8px; line-height: 1.45; }
.osd b { font-size: calc(var(--fs) + 1px); } .osd span { font-size: calc(var(--fs) - 2px); color: #ffe6c8; }
.aonly { display: none; position: absolute; inset: 0; background: #12100e; color: #fff8; place-items: center; font-weight: 700; letter-spacing: 2px; pointer-events: none; }
.player.audio .aonly { display: grid; }
/* sheet controls */
.pg { display: inline-flex; gap: 6px; padding: 4px; border-radius: 14px; background: var(--card); }
.pg.wrap { display: flex; flex-wrap: wrap; background: none; padding: 0; }
.pb { padding: 7px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--ink2); background: var(--card); }
.pb.on { background: var(--ink); color: var(--bg); }
.pb.tg.on { background: var(--accent); color: #fff; }
.vctl { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.vtabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.vtabs button { flex: 1; padding: 10px 0; font-weight: 700; color: var(--ink2); position: relative; }
.vtabs button small { color: var(--muted); font-weight: 600; }
.vtabs button.on { color: var(--accent-ink); }
.vtabs button.on::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: -1px; height: 3px; border-radius: 3px; background: var(--accent); }
.sw { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink2); cursor: pointer; }
.sw input { display: none; }
.sw span { width: 40px; height: 24px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: .15s; }
.sw span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 3px #0003; }
.sw input:checked + span { background: var(--accent); }
.sw input:checked + span::after { left: 19px; }
.row-sw { display: flex; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--card); margin-top: 14px; }
.row-sw b { color: var(--ink); font-size: 15px; }
.setbox { display: grid; gap: 12px; margin-bottom: 16px; }
.big-val { font-size: 22px; font-weight: 800; text-align: center; padding: 16px; border-radius: 16px; background: var(--card); }
.btn.done, .btn.wide { width: 100%; justify-content: center; padding: 13px; font-size: 16px; }
.fprev { display: grid; gap: 6px; justify-items: center; padding: 18px; border-radius: 16px; background: var(--card); }
.fprev b { font-size: 20px; }
#fsr { width: 100%; accent-color: var(--accent); }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 16px; }
.thm { text-align: left; padding: 12px; border-radius: 18px; background: var(--card); border: 2px solid transparent; display: grid; gap: 8px; }
.thm.on { border-color: var(--accent); }
.tprev { border-radius: 12px; padding: 12px; background: var(--bg); display: grid; gap: 8px; }
.tprev .tb { height: 12px; border-radius: 6px; background: var(--panel); }
.tprev .tc { border-radius: 10px; background: var(--card); padding: 10px; display: grid; gap: 6px; position: relative; }
.tprev .tc div { height: 7px; border-radius: 4px; background: var(--line); width: 80%; }
.tprev .tc div + div { width: 55%; }
.tprev .tc span { position: absolute; right: 10px; top: 8px; width: 26px; height: 22px; border-radius: 8px; background: var(--accent); }
.tname { display: flex; align-items: center; gap: 8px; }
.segbar { padding: 12px 16px; border-radius: 14px; background: var(--card); font-size: 14px; }
.segbar b { color: var(--accent-ink); }
.seglist { display: grid; gap: 8px; margin-top: 14px; }
.segi { display: flex; gap: 12px; align-items: baseline; text-align: left; padding: 11px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid transparent; font-weight: 600; }
.segi span { color: var(--accent-ink); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.segi.in { border-color: var(--chip-line); background: var(--chip); }
.tocf { margin-bottom: 12px; }
.ti .no { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--chip); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.ti.here .no { background: var(--accent); color: #fff; }
.ti em { padding: 3px 9px; border-radius: 999px; background: var(--panel); color: var(--muted); }
.ti em.done { background: var(--green-soft); color: var(--green); }
.hov .wcard .wc-acts button { width: 40px; height: 40px; }
@media (max-width: 860px) {
  .vtop { transition: opacity .25s; }
  body.playing:not(.pin) .vtop { opacity: 0; pointer-events: none; }
  .stage-card { margin: 8px 0; }
  .vctl .pg { flex: 1; } .vctl .pb { flex: 1; }
}
@media print { .osd, .hov { display: none !important; } }
.lfilter { display: flex; gap: 10px; margin: -6px 0 20px; }
.lfilter input, .lfilter select { padding: 9px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--panel); font-weight: 600; outline: none; }
.lfilter input { flex: 1; max-width: 360px; }
.pbar { height: 4px; border-radius: 4px; background: var(--line); margin: 10px 6px 4px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------- account ---------- */
.acct { position: relative; flex: none; margin-left: auto; }
.nav nav + .acct { margin-left: 0; }
.av { display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border-radius: 999px; background: var(--card); font-weight: 700; color: var(--ink2); box-shadow: var(--shadow); }
.av b, .avb { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 15px; }
.amenu { position: absolute; right: 0; top: calc(100% + 10px); z-index: 40; width: 230px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 8px; box-shadow: 0 12px 40px #0003; animation: fade .15s; }
.amenu .who { padding: 8px 12px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.amenu button, .mlist button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; font-weight: 600; color: var(--ink2); text-align: left; }
.amenu button:hover, .mlist button:hover { background: var(--chip); color: var(--accent-ink); }
.amenu svg, .mlist svg { width: 18px; height: 18px; }
.amenu .out, .mlist .out { color: var(--warn); }
.amodal-bg { position: fixed; inset: 0; z-index: 60; background: #0007; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.amodal { position: relative; width: min(400px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border-radius: 24px; padding: 26px 24px 22px; box-shadow: 0 20px 60px #0004; }
.amodal > .x { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 12px; }
.amodal h2 { margin: 0 50px 6px 0; font-size: 22px; }
.amodal h2.c { margin: 8px 0 18px; text-align: center; }
.amodal .who { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.amodal .who h2 { margin: 0; }
.mlist { display: grid; gap: 2px; margin-top: 8px; }
.ok-big { width: 64px; height: 64px; margin: 10px auto 0; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.ok-big svg { width: 30px; height: 30px; }
.field { display: grid; gap: 7px; margin: 14px 0; font-size: 13px; font-weight: 700; color: var(--ink2); }
.field input { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-size: 16px; font-weight: 500; outline: none; transition: border-color .15s; }
.field input:focus { border-color: var(--accent); }
.field input.code { text-transform: uppercase; letter-spacing: 2px; }
.btn.wide { display: flex; width: 100%; justify-content: center; padding: 12px; font-size: 15px; border-radius: 14px; }
.btn.wide + .btn.wide { margin-top: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 16px 0 20px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; word-break: break-all; }
.rights { margin: 12px 0; padding: 14px 16px; border-radius: 16px; background: var(--chip); color: var(--accent-ink); font-weight: 700; font-size: 14px; }
.rights.no { background: var(--card); color: var(--muted); }
.banner { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 16px; border-radius: 16px; background: var(--chip); color: var(--accent-ink); font-size: 14px; font-weight: 600; }
.banner span { flex: 1; }
.banner button { font-weight: 700; white-space: nowrap; }
.banner button.muted { font-weight: 600; }
body.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, var(--chip), transparent 45%), radial-gradient(circle at 85% 90%, var(--green-soft), transparent 40%), var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--panel); border-radius: 28px; padding: 34px 28px 28px; box-shadow: var(--shadow), 0 30px 80px #0000000f; }
.auth-card .logo { justify-content: center; font-size: 26px; }
.auth-card > p { text-align: center; margin: 10px 0 18px; }
.auth-card h2 { margin: 6px 0 10px; }
.auth-card #forgot p { line-height: 1.7; margin-bottom: 22px; }
.auth-links { display: flex; justify-content: center; gap: 8px; margin: 18px 0 12px; font-size: 13px; color: var(--muted); }
.auth-links a { color: var(--accent-ink); font-weight: 700; }
.lockbox .btn.primary { margin-top: 14px; }
.lockbox p { line-height: 1.6; }
@media (max-width: 860px) {
  .acct { margin-left: auto !important; }
  .av { padding-right: 4px; } .av span { display: none; }
  .banner { margin: 10px 0 0; }
}
.steps { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--panel); font-size: 15px; }
.steps li > i { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--card); color: var(--accent-ink); }
.steps li > i svg { width: 20px; height: 20px; }
.steps small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.ibanner svg { flex: none; width: 18px; height: 18px; }
.imtop button.imtip { width: auto; height: 34px; padding: 0 14px; border-radius: 17px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.imtop button.imtip[hidden] { display: none; }
@media print { .acct, .banner, .amodal-bg { display: none !important; } }

/* ---------- immersive (看剧) ---------- */
.imsub, .imui { display: none; }
body.immersive { overflow: hidden; }
body.immersive .player { position: fixed; inset: 0; z-index: 45; border-radius: 0; cursor: default; }
body.immersive .player video { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
body.immersive .vtop, body.immersive .osd { display: none !important; }
body.immersive .imsub { display: grid; gap: 6px; justify-items: center; position: absolute; left: 5%; right: 5%; bottom: max(7%, 28px); text-align: center; pointer-events: none; transition: bottom .25s, opacity .15s; }
body.immersive.imshow .imsub, body.immersive .player.paused .imsub { bottom: 132px; }
.imsub.gap { opacity: 0; }
.imsub b, .imsub span { padding: 2px 12px; border-radius: 8px; background: #0008; color: #fff; line-height: 1.45; text-shadow: 0 1px 3px #000; }
.imsub b { font-size: clamp(18px, 2.6vw, 34px); font-weight: 700; }
.imsub span { font-size: clamp(15px, 2vw, 26px); font-weight: 600; color: #ffe1b8; }
body.immersive .imui { display: flex; flex-direction: column; justify-content: space-between; position: absolute; inset: 0; color: #fff; pointer-events: none; transition: opacity .25s; }
body.immersive.playing:not(.imshow) .imui { opacity: 0; }
body.immersive.playing:not(.imshow) .player { cursor: none; }
.imtop, .imbot { pointer-events: auto; padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
body.immersive.playing:not(.imshow) .imtop, body.immersive.playing:not(.imshow) .imbot { pointer-events: none; }
.imtop { display: flex; align-items: center; gap: 12px; padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: 30px; background: linear-gradient(#000b, transparent); }
.imtop span { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 4px #000; }
.imtop button, .imrow > button { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #ffffff26; color: #fff; }
.imbot { padding-top: 40px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, #000d); }
.imrow { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.imrow > button.play { width: 50px; height: 50px; background: #fff; color: #111; }
.imrow > button.rt { width: auto; padding: 0 14px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.imtime { font-size: 14px; color: #fffc; font-variant-numeric: tabular-nums; white-space: nowrap; }
.imsubs { margin-left: auto; display: flex; padding: 3px; border-radius: 999px; background: #ffffff26; }
.imsubs button { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #fffd; white-space: nowrap; }
.imsubs button.on { background: #fff; color: #111; }
@media (max-width: 700px) {
  .imtime { display: none; }
  .imrow { gap: 8px; flex-wrap: wrap; }
  .imsubs { order: 5; margin: 6px auto 0; }
  .imsubs button { padding: 7px 12px; }
  .imrow > button.rt { margin-left: auto; }
  body.immersive.imshow .imsub, body.immersive .player.paused .imsub { bottom: 170px; }
}
