/* CS Topper Path — "ink & highlighter" */
:root {
  --ink: #1E2A5E; --ink-2: #33438A; --ink-soft: #E6EAF7;
  --paper: #F4F6FB; --surface: #FFFFFF; --surface-2: #F9FAFD; --line: #DFE3EF;
  --text: #191C2B; --muted: #596079; --hl: #FFE45C; --hl-soft: #FFF5BF; --hl-text: #191C2B;
  --ok: #18804F; --ok-soft: #E3F4EA; --bad: #B83A33; --bad-soft: #FBE9E7;
  --radius: 14px; --radius-s: 9px;
  --shadow: 0 1px 2px rgba(30, 42, 94, .06), 0 6px 18px rgba(30, 42, 94, .06);
  --on-ink: #FFFFFF;
  --f-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Hind", "Noto Sans Devanagari", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #AFC0FF; --ink-2: #C9D4FF; --ink-soft: #232A4D;
    --paper: #0F1328; --surface: #171C36; --surface-2: #1C2242; --line: #2B3360;
    --text: #E9EBF5; --muted: #A3A9C6; --hl: #F0D445; --hl-soft: #3A3620; --hl-text: #15182A;
    --ok: #5CCB92; --ok-soft: #173327; --bad: #FF8A80; --bad-soft: #3A1E1E;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --on-ink: #10142A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #AFC0FF; --ink-2: #C9D4FF; --ink-soft: #232A4D;
  --paper: #0F1328; --surface: #171C36; --surface-2: #1C2242; --line: #2B3360;
  --text: #E9EBF5; --muted: #A3A9C6; --hl: #F0D445; --hl-soft: #3A3620; --hl-text: #15182A;
  --ok: #5CCB92; --ok-soft: #173327; --bad: #FF8A80; --bad-soft: #3A1E1E;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --on-ink: #10142A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font: 400 17px/1.6 var(--f-body); }
h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); font-weight: 800; }
h2, .h2 { font-size: 1.35rem; font-weight: 700; margin-top: 1.6rem; }
h3 { font-size: 1.12rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: var(--ink); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
:focus-visible { outline: 3px solid var(--hl); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--hl); color: var(--hl-text); padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow: auto; background: #1E2A5E; color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; padding: 4px 6px; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; background: #fff; color: #1E2A5E; display: grid; place-items: center; font: 800 15px var(--f-head); position: relative; overflow: hidden; }
.brand-mark::after { content: ""; position: absolute; left: -4px; right: -4px; bottom: 7px; height: 9px; background: var(--hl); transform: rotate(-7deg); mix-blend-mode: multiply; }
.brand b { font-family: var(--f-head); font-size: 1.05rem; display: block; line-height: 1.1; }
.brand small { opacity: .75; font-size: .82rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { color: #E3E7F7; text-decoration: none; padding: 9px 12px; border-radius: 10px; display: flex; gap: 12px; align-items: center; font-weight: 500; position: relative; }
.nav a i { font-style: normal; width: 22px; text-align: center; font-family: var(--f-head); font-weight: 700; opacity: .8; }
.nav a:hover { background: rgba(255,255,255,.08); }
.nav a.active { color: #fff; background: rgba(255,255,255,.1); }
.nav a.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--hl); }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.15); font-size: .9rem; }
.side-foot .streak b { font: 800 1.6rem var(--f-head); color: var(--hl); margin-right: 6px; }
.side-foot .who { opacity: .75; }
.main-col { min-width: 0; }
#main { min-width: 0; outline: none; }
.appbar { display: none; }
.install-card { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1.5px solid var(--hl); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.install-card img { border-radius: 10px; } .install-card p { margin: 0; color: var(--muted); font-size: .88rem; } .install-card div { flex: 1; }
body:not(.can-install) .install-card [data-install] { display: none; }
.grand-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--ink); color: var(--on-ink); border-radius: var(--radius); padding: 16px 20px; text-decoration: none; margin-bottom: 18px; }
.grand-card b { font: 800 1.2rem var(--f-head); } .grand-card p { margin: 2px 0 0; opacity: .8; font-size: .9rem; } .grand-card span { font-weight: 700; white-space: nowrap; background: var(--hl); color: var(--hl-text); padding: 6px 12px; border-radius: 99px; }
.mock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 4px; }
.mk-set { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .mk-set > span { grid-column: 1 / 3; font: 600 .85rem var(--f-head); color: var(--ink-2); }
.mk { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border: 1.5px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); }
.mk b { font: 800 1rem var(--f-head); } .mk small { color: var(--muted); font-size: .75rem; }
.mk.pass { background: var(--ok-soft); border-color: var(--ok); } .mk.fail { background: var(--bad-soft); border-color: var(--bad); }
.res-list { list-style: none; padding: 0; margin: 0; } .res-list li { padding: 10px 0; border-bottom: 1px solid var(--line); } .res-list small { display: block; color: var(--muted); }
.page { max-width: 1120px; margin: 0 auto; padding: 32px 28px 96px; }
.page.narrow { max-width: 820px; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.tabbar { display: none; }

/* ---------- common ---------- */
.page-head { margin-bottom: 22px; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 70ch; }
.note { color: var(--muted); font-size: .93rem; }
.code { font: 600 .82rem var(--f-head); color: var(--ink-2); letter-spacing: .02em; }
.back { display: inline-block; margin-bottom: 14px; text-decoration: none; color: var(--muted); font-weight: 500; }
.back:hover { color: var(--ink); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.card.soft { background: var(--surface-2); }
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0; }
.ok { color: var(--ok); } .bad { color: var(--bad); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.clean { padding-left: 1.2em; margin: .4em 0 .8em; } .clean li { margin: .3em 0; }
.clean.small { font-size: .92rem; } .clean.num { list-style: decimal; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--ink-soft); color: var(--ink); font-size: .85rem; font-weight: 500; text-decoration: none; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip-btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 99px; font: inherit; cursor: pointer; color: var(--text); }
.link { color: var(--ink); font-weight: 500; text-decoration-color: var(--hl); text-decoration-thickness: 3px; text-underline-offset: 3px; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--ink); color: var(--on-ink); font: 600 .97rem var(--f-body); padding: 10px 18px; border-radius: 10px; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.sm { padding: 7px 13px; font-size: .9rem; }
.btn.big { padding: 14px 24px; font-size: 1.05rem; }
.btn.danger { color: var(--bad) !important; }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 1rem; padding: 4px 6px; border-radius: 6px; color: var(--muted); }
.icon-btn:hover { background: var(--ink-soft); }

/* the signature: highlighter-stroke meter */
.meter { height: 10px; background: var(--ink-soft); border-radius: 3px; overflow: hidden; position: relative; }
.meter > span { display: block; height: 100%; background: var(--hl); border-radius: 2px 6px 3px 7px; transform: skewX(-12deg); transform-origin: left; transition: width .5s; }
mark { background: linear-gradient(100deg, transparent 2%, var(--hl) 4%, var(--hl) 96%, transparent 98%); color: var(--hl-text); padding: 0 2px; border-radius: 2px; }

/* ---------- forms ---------- */
.form label, label { display: block; font-weight: 500; margin-bottom: 12px; }
input[type=text], input:not([type]), input[type=number], input[type=date], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: var(--radius-s); border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: 400 1rem/1.5 var(--f-body);
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--hl-soft); }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 600; margin-bottom: 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; font-weight: 600; height: 100%; }
.seg span small { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.seg input:checked + span { border-color: var(--ink); box-shadow: inset 0 -5px 0 var(--hl); }
.seg input:focus-visible + span { outline: 3px solid var(--hl); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rules { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.agree { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.agree input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--ink); }
.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.inline select { width: auto; margin: 0; }
.hero-setup { padding: 20px 0 10px; }

/* ---------- today ---------- */
.today-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 18px; flex-wrap: wrap; }
.day-tag { font: 600 .95rem var(--f-head); color: var(--ink-2); margin: 0 0 6px; }
.hi { color: var(--muted); font-weight: 400; }
.today-stats { display: flex; gap: 22px; }
.today-stats div { text-align: right; }
.today-stats b { display: block; font: 800 1.9rem/1 var(--f-head); }
.today-stats small { color: var(--muted); font-size: .82rem; }
.minimum { display: flex; gap: 18px; align-items: center; background: var(--surface); border: 1.5px solid var(--bad); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.minimum.met { border-color: var(--ok); }
.minimum p { margin: 2px 0 0; color: var(--muted); font-size: .93rem; }
.min-ring { --p: 0; flex: none; width: 74px; height: 74px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: radial-gradient(closest-side, var(--surface) 76%, transparent 78%), conic-gradient(var(--hl) calc(var(--p) * 360deg), var(--ink-soft) 0); }
.min-ring b { font: 800 1.25rem/1 var(--f-head); } .min-ring small { font-size: .72rem; color: var(--muted); }
.gate-link { margin-left: auto; white-space: nowrap; font-weight: 600; color: var(--ink); }
.timeline { margin: 4px 0 18px; }
.tl-strip { display: flex; gap: 4px; height: 54px; }
.tl-b { min-width: 30px; border-radius: 8px; background: var(--surface); border: 1.5px solid var(--line); display: grid; place-items: center; text-decoration: none; color: var(--ink); font: 700 1rem var(--f-head); transition: transform .15s; }
.tl-b:hover { transform: translateY(-2px); border-color: var(--ink); }
.tl-b.done { background: var(--hl); border-color: var(--hl); color: var(--hl-text); }
.tl-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; margin-top: 6px; }
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 6px 4px 14px; }
.task.done .tt { text-decoration: line-through; text-decoration-color: var(--hl); text-decoration-thickness: 3px; color: var(--muted); }
.task-main { flex: 1; display: flex; align-items: center; gap: 12px; padding: 10px 8px; text-decoration: none; color: var(--text); min-width: 0; }
.ti { width: 32px; height: 32px; flex: none; border-radius: 9px; background: var(--ink-soft); color: var(--ink); display: grid; place-items: center; font: 700 .9rem var(--f-head); }
.tt { flex: 1; min-width: 0; } .tt small { color: var(--muted); }
.tm { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.tick input { position: absolute; opacity: 0; }
.tick span { display: block; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); cursor: pointer; }
.tick input:checked + span { background: var(--hl); border-color: var(--hl); box-shadow: inset 0 0 0 4px var(--surface); }
.tick input:focus-visible + span { outline: 3px solid var(--hl); }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--text); }
.stat-card h4 { color: var(--muted); font: 600 .9rem var(--f-body); margin-bottom: 4px; }
.stat-card .big { font: 800 2rem/1.1 var(--f-head); margin-bottom: 8px; }
.stat-card small { color: var(--muted); }
.paper-list { display: flex; flex-direction: column; gap: 6px; }
.paper-row { display: grid; grid-template-columns: 110px 1fr 200px; gap: 14px; align-items: center; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); }
.paper-row .pp { display: flex; align-items: center; gap: 8px; } .paper-row .pp .meter { flex: 1; } .paper-row small { color: var(--muted); width: 36px; text-align: right; }

/* ---------- plan ---------- */
.phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.phase { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.phase p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.cal { display: grid; grid-template-columns: repeat(15, 1fr); gap: 6px; }
.cal-d { --p: 0; aspect-ratio: 1; border-radius: 8px; border: 1.5px solid var(--line); cursor: pointer; font: 600 .82rem var(--f-head); color: var(--text); background: linear-gradient(to top, var(--hl) calc(var(--p) * 100%), var(--surface) 0); }
.cal-d.ph-revise { border-style: dashed; } .cal-d.ph-mock { border-color: var(--ink-2); }
.cal-d.now { outline: 3px solid var(--ink); outline-offset: 1px; }
.cal-d.done { color: var(--hl-text); }

/* ---------- study ---------- */
.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.paper-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 6px; }
.paper-card:hover { border-color: var(--ink); }
.paper-card h3 { margin: 2px 0; } .paper-card p { color: var(--muted); font-size: .9rem; margin: 0 0 6px; } .paper-card small { color: var(--muted); }
.more-books { margin-top: 26px; } .more-books summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
.paper-head .pattern { background: var(--surface-2); border-left: 4px solid var(--hl); padding: 10px 14px; border-radius: 0 10px 10px 0; max-width: 75ch; font-size: .95rem; }
.head-meter { display: flex; align-items: center; gap: 10px; max-width: 420px; } .head-meter .meter { flex: 1; } .head-meter small { color: var(--muted); white-space: nowrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin: 6px 0 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 4px solid transparent; margin-bottom: -1.5px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--hl); }
.legend { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.prio { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font: 800 .8rem var(--f-head); vertical-align: middle; }
.prio.pA { background: var(--hl); color: var(--hl-text); } .prio.pB { background: var(--ink-soft); color: var(--ink); } .prio.pC { border: 1.5px solid var(--line); color: var(--muted); }
.lesson-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.part-head { font: 700 .95rem var(--f-head); color: var(--ink-2); margin: 14px 0 2px; }
.lesson-row { display: grid; grid-template-columns: 36px 1fr 28px 140px; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); }
.lesson-row:hover { border-color: var(--ink); }
.lesson-row .ln { font: 800 1.05rem var(--f-head); color: var(--ink-2); }
.lesson-row .lt small { display: block; color: var(--muted); font-size: .85rem; }
.lesson-row.done .ln::after { content: " ✓"; color: var(--ok); }
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.steps { padding-left: 1.3em; } .steps li { margin: .45em 0; }
.meta { color: var(--muted); font-size: .88rem; }
.topics { columns: 2; padding-left: 1.4em; font-size: .95rem; } .topics li { break-inside: avoid; margin: .2em 0; }
.pager { display: flex; justify-content: space-between; margin-top: 30px; } .pager a { font-weight: 600; text-decoration: none; }

/* reader */
.reader-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 26px; align-items: start; }
.parts-nav { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.parts-nav ol { list-style: none; padding: 0; margin: 0; }
.parts-nav a { display: flex; gap: 10px; padding: 7px 8px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .86rem; line-height: 1.3; }
.parts-nav a span { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font: 700 .78rem var(--f-head); border: 1.5px solid var(--line); }
.parts-nav li.ok a span { background: var(--hl); border-color: var(--hl); color: var(--hl-text); }
.parts-nav li.cur a { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.reader { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px clamp(18px, 4vw, 44px); min-width: 0; }
.reader-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 18px; }
.rt-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.rtext { max-width: 70ch; line-height: 1.75; }
.rtext p { margin: 0 0 1em; }
.rtext .rli { padding-left: 1.2em; position: relative; } .rtext .rli::before { content: ""; position: absolute; left: 2px; top: .7em; width: 7px; height: 7px; border-radius: 2px; background: var(--ink-2); }
.rtext .rh { font-size: 1.08em; margin: 1.5em 0 .6em; color: var(--ink); }
abbr.v { text-decoration: underline dotted var(--ink-2); text-underline-offset: 4px; cursor: help; position: relative; }
abbr.v:hover::after, abbr.v:focus::after, abbr.v.open::after { content: attr(data-hi); position: absolute; left: 0; bottom: calc(100% + 6px); background: var(--ink); color: var(--on-ink); font: 500 .82rem/1.4 var(--f-body); padding: 6px 10px; border-radius: 8px; width: max-content; max-width: 260px; z-index: 5; white-space: normal; }
.hl-btn { position: absolute; z-index: 30; background: var(--hl); color: var(--hl-text); border: 0; font: 700 .9rem var(--f-body); padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow); cursor: pointer; }
.checkpoint { margin-top: 28px; border-top: 2px dashed var(--line); padding-top: 20px; }
.cp-done { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.roundup li { margin: .45em 0; }
.hl-list { list-style: none; padding: 0; } .hl-list li { margin: 8px 0; }
.gloss { display: grid; gap: 10px; margin: 0; }
.gloss > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.gloss dt { font: 700 1.02rem var(--f-head); } .gloss dt .hi { margin-left: 8px; font: 500 .95rem var(--f-body); }
.gloss dd { margin: 4px 0 0; color: var(--text); }
.qlist { padding-left: 1.3em; } .qlist > li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.qlist.compact > li { padding: 8px 12px; font-size: .93rem; }
.qtext { white-space: pre-wrap; font-family: var(--f-body); font-size: .97rem; margin: 0; line-height: 1.55; overflow-x: auto; }
.qlist.tp .qtext { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; white-space: pre; }
.tp-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
iframe.pdf { width: 100%; height: 80vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* video */
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 14px 0; }
.vid-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 0 10px; cursor: pointer; font: inherit; color: var(--text); overflow: hidden; display: flex; flex-direction: column; gap: 8px; }
.vid-card img, .vid-card .pl { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--ink); display: grid; place-items: center; color: #fff; font: 700 1rem var(--f-head); }
.vid-card span { padding: 0 12px; font-weight: 500; font-size: .93rem; line-height: 1.35; }
.vid-card .meter { margin: 0 12px; height: 6px; }
.vid-card:hover { border-color: var(--ink); }
.vp { margin: 16px 0; }
.vp-frame { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 12px; overflow: hidden; }
.vp-frame iframe, .vp-player { position: absolute; inset: 0; width: 100%; height: 100%; }
.vp-overlay { position: absolute; inset: 0; background: rgba(15, 19, 40, .92); display: grid; place-items: center; padding: 20px; z-index: 3; }
.vp-task { background: var(--surface); color: var(--text); border-radius: 14px; padding: 20px; max-width: 560px; width: 100%; max-height: 100%; overflow: auto; }
.kicker { font: 600 .85rem var(--f-head); color: var(--ink-2); margin-bottom: 6px; }
.vp-meta { margin-top: 10px; } .vp-title { font: 700 1.05rem var(--f-head); } .vp-sub { color: var(--muted); font-size: .88rem; }
.vp-segs { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.vp-segs button { width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; font: inherit; color: var(--text); cursor: pointer; position: relative; }
.vp-segs b { display: block; font: 700 .9rem var(--f-head); } .vp-segs small { color: var(--muted); font-size: .78rem; }
.vp-segs i { position: absolute; right: 8px; top: 8px; font-style: normal; font-size: .85rem; }
.vp-segs .cur button { border-color: var(--ink); }
.vp-segs .ok button { background: var(--hl-soft); border-color: var(--hl); }
.vp-segs .locked button { opacity: .55; cursor: not-allowed; }
.seg-meter { display: block; height: 4px; background: var(--ink-soft); border-radius: 2px; margin-top: 6px; overflow: hidden; } .seg-meter span { display: block; height: 100%; background: var(--hl); }
.vp-foot { font-size: .88rem; }
.add-vid { display: flex; gap: 10px; align-items: flex-end; margin: 10px 0; } .add-vid label { flex: 1; margin: 0; }

/* quiz */
.quiz { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.quiz-top { display: flex; justify-content: space-between; color: var(--muted); font-size: .88rem; margin-bottom: 8px; }
.quiz .meter { margin-bottom: 14px; height: 6px; }
.q { font-weight: 600; font-size: 1.05rem; }
.opts { display: grid; gap: 8px; margin: 12px 0; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 11px 14px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface); font: inherit; color: var(--text); cursor: pointer; }
.opt:hover { border-color: var(--ink); }
.opt .ol { flex: none; width: 26px; height: 26px; border-radius: 7px; background: var(--ink-soft); color: var(--ink); display: grid; place-items: center; font: 700 .82rem var(--f-head); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); } .opt.wrong { border-color: var(--bad); background: var(--bad-soft); } .opt.dim { opacity: .55; }
.fb p { margin-bottom: 10px; }
.quiz-end { text-align: center; padding: 10px; }
.quiz-end .big, .big { font: 800 3rem/1 var(--f-head); }
.review { text-align: left; } .review li { margin: 10px 0; } .review p { margin: 2px 0; }
.omr { padding-left: 1.4em; } .omr li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
.omr label { display: flex; gap: 8px; font-weight: 400; margin: 4px 0; cursor: pointer; } .omr input { accent-color: var(--ink); margin-top: 6px; }
.mock-bar { position: sticky; top: var(--appbar-h, 0px); z-index: 10; display: flex; gap: 14px; align-items: center; background: var(--paper); padding: 10px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
#clock { font: 800 1.8rem var(--f-head); font-variant-numeric: tabular-nums; }
.prac-h { display: flex; gap: 12px; align-items: baseline; } .prac-h .code { white-space: nowrap; } .prac-h h3 { margin: 0; }
.prac-stats { display: flex; gap: 20px; color: var(--muted); font-size: .92rem; margin-top: 6px; } .prac-stats b { color: var(--text); }

/* answer studio */
.studio-grid { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.writer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.writer-bar { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .9rem; }
.writer textarea { font-size: 1.02rem; line-height: 1.7; min-height: 380px; background: repeating-linear-gradient(transparent 0 calc(1.7em - 1px), var(--line) calc(1.7em - 1px) 1.7em); background-attachment: local; background-position: 0 10px; }
.guide-side { position: sticky; top: 16px; font-size: .94rem; }
.tip { background: var(--hl-soft); color: var(--text); padding: 10px 12px; border-radius: 10px; font-size: .92rem; }
.result .res-top { display: flex; gap: 18px; align-items: center; margin-bottom: 12px; } .result .big small { font-size: 1.2rem; color: var(--muted); }
.rubric { width: 100%; border-collapse: collapse; font-size: .93rem; } .rubric td { padding: 6px 4px; } .rubric .rm { width: 40%; } .tip-row td { color: var(--muted); font-size: .86rem; padding-top: 0; }
.kw .chip { margin: 2px; }
.ans-list { list-style: none; padding: 0; } .ans-list li { display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 6px; font-size: .93rem; }
.ans-list .sc { font: 800 1.05rem var(--f-head); } .ans-list small { color: var(--muted); }
pre.model { white-space: pre-wrap; font-family: var(--f-body); font-size: .97rem; line-height: 1.6; background: var(--surface-2); border: 1px solid var(--line); padding: 14px 16px; border-radius: 10px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; margin: 10px 0; } .tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; } .tbl th { font: 700 .88rem var(--f-head); color: var(--muted); }
.prio-tbl td:last-child { width: 140px; }
.guide details summary, .card > summary { cursor: pointer; } details.card summary b { font-family: var(--f-head); }
.model-card summary { line-height: 1.5; }

/* english */
.eng-track { margin-bottom: 30px; }
.eng-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; } .eng-h span { color: var(--muted); font-weight: 600; white-space: nowrap; }
.eng-track > .meter { margin: 6px 0 14px; }
.mod-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.mod-list a { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); height: 100%; }
.mod-list a small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.35; }
.mod-list .mn { flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--ink-soft); color: var(--ink); display: grid; place-items: center; font: 800 .9rem var(--f-head); }
.mod-list li.ok .mn { background: var(--hl); color: var(--hl-text); }
.mod-list i { margin-left: auto; font-style: normal; }
.locked { opacity: .55; }
.wk { margin: 18px 0 8px; font-size: 1rem; color: var(--ink-2); }
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.day-chip { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); font-size: .88rem; line-height: 1.3; }
.day-chip b { font: 800 1.2rem var(--f-head); color: var(--ink-2); flex: none; width: 28px; }
.day-chip.ok { background: var(--hl-soft); border-color: var(--hl); }
.notes li { margin: .4em 0; }
.pairs { list-style: none; padding: 0; } .pairs li { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pairs .en { font-weight: 600; } .pairs .hi { color: var(--muted); }
.tr-row { border-bottom: 1px dashed var(--line); padding: 10px 0; } .tr-row .hi { color: var(--text); font-weight: 500; margin-bottom: 4px; }
.tr-fb { margin-top: 8px; font-size: .95rem; }
.speak-top { display: flex; align-items: center; gap: 16px; }
.btn.rec .dot { width: 10px; height: 10px; border-radius: 50%; background: #ff6b6b; }
.btn.rec.on .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .2; } }
.speak-timer { font: 700 1.3rem var(--f-head); font-variant-numeric: tabular-nums; }
.transcript { min-height: 70px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; margin: 12px 0; } .transcript .interim { color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; margin: 10px 0; }
.metrics b { display: block; font: 800 1.5rem var(--f-head); } .metrics small { color: var(--muted); font-size: .8rem; }
audio { width: 100%; margin: 6px 0; }
.check { list-style: none; padding: 0; } .check label { display: flex; gap: 8px; font-weight: 400; margin: 4px 0; }

/* revise */
.fc-wrap { max-width: 620px; margin: 0 auto; text-align: center; }
.fc-meta { color: var(--muted); font-size: .88rem; margin-bottom: 10px; }
.fc { width: 100%; min-height: 240px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; padding: 28px; font: inherit; color: var(--text); cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 16px; box-shadow: var(--shadow); }
.fc-f { font: 700 1.35rem/1.3 var(--f-head); } .fc-b { font-size: 1.05rem; border-top: 2px dashed var(--line); padding-top: 14px; } .fc-hint { color: var(--muted); }
.fc-grade { display: flex; gap: 8px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }

/* analysis */
.an-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; } .an-h h3 { margin: 0; }
.an-stats { display: flex; gap: 18px; color: var(--muted); } .an-stats b { color: var(--text); }

/* completion */
.gates { list-style: none; padding: 0; margin: 0; }
.gates li { display: grid; grid-template-columns: 1fr 160px 44px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.gates li small { display: block; color: var(--muted); } .gates li > span { text-align: right; font-weight: 700; } .gates li.ok > span { color: var(--ok); }
.cert { text-align: center; border: 3px double var(--ink); border-radius: 18px; padding: 40px 24px; background: var(--surface); }
.cert h2 { font-size: 2.2rem; } .cert-k { font: 600 .95rem var(--f-head); color: var(--ink-2); }
.out h1 { color: var(--bad); }

/* notice / legal / modal */
.notice-wrap, .modal-wrap { position: fixed; inset: 0; background: rgba(12, 16, 36, .65); z-index: 100; display: grid; place-items: center; padding: 16px; }
.notice-box { background: var(--surface); border-radius: 18px; max-width: 680px; width: 100%; max-height: 92vh; overflow: auto; padding: 28px clamp(18px, 4vw, 36px); border-top: 8px solid var(--hl); }
.notice ol li { margin: .6em 0; }
.legal h3 { margin-top: 1.4em; }
.modal { position: relative; background: var(--surface); border-radius: 16px; max-width: 640px; width: 100%; max-height: 90vh; overflow: auto; padding: 24px; }
.modal.wide { max-width: 980px; }
.modal-x { position: absolute; right: 10px; top: 10px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--ink); color: var(--on-ink); padding: 10px 18px; border-radius: 10px; opacity: 0; transition: .25s; z-index: 200; font-weight: 500; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); }
.more-list { display: flex; flex-direction: column; } .more-list a { padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 600; color: var(--text); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  :root { --appbar-h: calc(52px + env(safe-area-inset-top)); }
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .appbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 60; background: #1E2A5E; color: #fff; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; min-height: 52px; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
  .ab-back { color: #fff; text-decoration: none; font: 400 2rem/1 var(--f-head); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; margin-left: -4px; }
  .ab-back:active { background: rgba(255,255,255,.15); }
  .ab-back[hidden] { display: none; }
  .ab-back:not([hidden]) + .ab-logo { display: none; }
  .ab-logo { width: 30px; height: 30px; border-radius: 8px; background: #fff; color: #1E2A5E; display: grid; place-items: center; font: 800 .8rem var(--f-head); box-shadow: inset 0 -6px 0 var(--hl); }
  .ab-title { flex: 1; font: 700 1.05rem/1.2 var(--f-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ab-streak { font-weight: 700; font-size: .9rem; background: rgba(255,255,255,.12); padding: 4px 10px; border-radius: 99px; }
  .back { display: none; }
  .page-head h1, .today-head h1 { font-size: 1.6rem; }
  .btn { min-height: 44px; } .btn.sm { min-height: 38px; }
  .opt { min-height: 48px; }
  .mock-grid { grid-template-columns: 1fr; }
  body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; padding: 4px 0; border-radius: 10px; }
  .tabbar a i { font: 700 1.05rem var(--f-head); font-style: normal; }
  .tabbar a.active { color: var(--ink); background: var(--hl-soft); }
  .page { padding: 20px 16px 100px; }
  .reader-wrap, .studio-grid, .ov-grid, .grid2 { grid-template-columns: 1fr; }
  .parts-nav { position: static; max-height: 210px; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: var(--surface); }
  .guide-side { position: static; }
  .cal { grid-template-columns: repeat(10, 1fr); }
  .phases { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .grid3 { grid-template-columns: 1fr; }
  .seg, .seg.three, .two { grid-template-columns: 1fr; }
  .paper-row { grid-template-columns: 1fr; gap: 6px; }
  .lesson-row { grid-template-columns: 30px 1fr 24px; } .lesson-row .lp { grid-column: 2 / 4; }
  .today-stats { width: 100%; justify-content: space-between; } .today-stats div { text-align: left; }
  .minimum { flex-wrap: wrap; } .gate-link { margin-left: 0; }
  .tl-strip { height: 44px; } .tl-b { min-width: 22px; font-size: .8rem; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .pairs li { grid-template-columns: 1fr; gap: 2px; }
  .topics { columns: 1; }
  .gates li { grid-template-columns: 1fr 70px; } .gates li .meter { display: none; }
  .ans-list li { grid-template-columns: 50px 1fr; } .ans-list small { grid-column: 2; }
  .cal { grid-template-columns: repeat(7, 1fr); }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; } .prio-tbl td:nth-child(2) { white-space: normal; min-width: 180px; }
  .add-vid { flex-direction: column; align-items: stretch; }
  .tabs a { padding: 10px 10px; }
}
@media print { .side, .tabbar, .btn { display: none !important; } .shell { display: block; } body { background: #fff; } }

/* --- practice papers, accounting lab, 5000 words, question bank --- */
.chip-btn.on { background: var(--brand, #1E2A5E); color: #fff; border-color: transparent; }
.chip-btn.weak { border-color: #d97706; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.warn { background: #fff7e6; border: 1px solid #f5c26b; color: #7a4b00; padding: 8px 12px; border-radius: 10px; font-size: .92rem; }
.chip.ok { background: #e7f6ec; color: #17663a; }
.alt { font-size: .9rem; color: var(--muted); margin: 6px 0; }
details.mdl { margin: 8px 0; } details.mdl summary { cursor: pointer; font-weight: 600; color: var(--brand, #1E2A5E); }
pre.model, pre.qtext { white-space: pre-wrap; overflow-x: auto; }
.qlist.tp pre.qtext, pre.model { font-size: .9rem; }
.pp-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.tbl-wrap { overflow-x: auto; } .tbl.words td:nth-child(2) { font-family: ui-monospace, monospace; font-size: .82rem; }
ol.spell li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; } ol.spell input { flex: 1 1 160px; min-width: 0; }
@media (prefers-color-scheme: dark) { .warn { background: #3a2a0a; color: #ffd28a; border-color: #7a5a1a; } .chip.ok { background: #12351f; color: #8fe0ad; } }
