/* READ.EDU.NP — course app layout */
.wrap-wide { width: min(1440px, 100% - 32px); margin-inline: auto; display: flex; align-items: center; gap: 12px; height: 64px; }
.crumb { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; color: var(--ink2); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumb a:hover { color: var(--brand); }
.crumb .sep { color: var(--muted); }
.crumb .cur { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.search-trigger { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 600; font-size: 14px; width: 330px; transition: border .15s, box-shadow .15s; }
.search-trigger:hover { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(99,102,241,.1); }
.search-trigger .st-text { flex: 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
kbd { font: 700 11px var(--font); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); }
.xp { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 12px; font-weight: 800; font-size: 13px; background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #92400E; white-space: nowrap; position: relative; }
[data-theme="dark"] .xp { background: linear-gradient(135deg, #78350F, #92400E); color: #FDE68A; }
.xp small { font-weight: 700; opacity: .75; }
.xp-pop { position: fixed; z-index: 120; font-weight: 800; color: #F59E0B; pointer-events: none; animation: xpop 1.1s ease-out forwards; text-shadow: 0 2px 8px rgba(245,158,11,.4); font-size: 18px; }
@keyframes xpop { 0% { transform: translate(-50%, 0) scale(.6); opacity: 0; } 20% { transform: translate(-50%, -10px) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -60px) scale(1); opacity: 0; } }

/* shell */
.shell { width: min(1440px, 100% - 32px); margin-inline: auto; display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 28px; padding: 22px 0 80px; align-items: start; }
.rail { position: sticky; top: 86px; max-height: calc(100vh - 104px); overflow: auto; scrollbar-width: thin; padding-right: 4px; }
.rail-course { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 14px; }
.rail-course .sym { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; font: italic 24px "Times New Roman", serif; }
.rail-course b { display: block; font-size: 15px; line-height: 1.25; }
.rail-course small { color: var(--muted); font-weight: 700; font-size: 12px; }
.rail-course .bar { height: 6px; border-radius: 9px; background: var(--line); margin-top: 8px; overflow: hidden; }
.rail-course .bar i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, var(--ok), #34D399); transition: width .5s; }
.nav-sec { margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--ink2); transition: background .15s, color .15s; text-align: left; }
.nav-item:hover { background: var(--soft); color: var(--ink); }
.nav-item.on { background: var(--ink); color: var(--bg); }
.nav-item .ic { width: 22px; text-align: center; }
.nav-item .ct { margin-left: auto; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.nav-item.on .ct { background: rgba(255,255,255,.18); color: inherit; }
[data-theme="dark"] .nav-item.on .ct { background: rgba(0,0,0,.25); }
.nav-sub { margin: 2px 0 8px 22px; padding-left: 10px; border-left: 2px solid var(--line); }
.nav-sub .nav-item { padding: 7px 10px; font-size: 13px; font-weight: 600; }
.nav-sub .nav-item.on { background: var(--soft); color: var(--brand); box-shadow: inset 2px 0 0 var(--brand); border-radius: 0 10px 10px 0; }
[data-theme="dark"] .nav-sub .nav-item.on { color: #A5B4FC; }
.nav-sub .nav-item.on .ct { background: var(--card); color: inherit; }
.dot { flex: none; width: 20px; height: 20px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--bg); border: 1px solid var(--line); color: var(--ink2); }
.dot.done { background: var(--ok); color: #fff; border-color: var(--ok); }
.rail-h { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 16px 12px 6px; }

/* view */
.view { min-width: 0; }
.view.enter { animation: viewIn .38s cubic-bezier(.2,.8,.2,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

/* mode switch (by chapter / by resource) */
.mode-switch { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 14px; position: relative; }
.mode-switch a { position: relative; z-index: 1; padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--ink2); display: inline-flex; gap: 6px; align-items: center; transition: color .2s; }
.mode-switch a.on { color: #fff; }
.mode-switch .pillbg { position: absolute; z-index: 0; top: 4px; bottom: 4px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--brand2)); transition: left .3s cubic-bezier(.2,.8,.2,1), width .3s; }

/* headers */
.v-head { position: relative; overflow: hidden; border-radius: 24px; padding: 26px 28px; color: #fff; margin-bottom: 16px; box-shadow: var(--shadow-lg); }
.v-head::after { content: attr(data-sym); position: absolute; right: 16px; bottom: -36px; font: italic 170px/1 "Times New Roman", serif; opacity: .13; pointer-events: none; }
.v-head .k { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.v-head h1 { margin: 4px 0 6px; font-size: clamp(24px, 3.2vw, 34px); letter-spacing: -.03em; line-height: 1.15; position: relative; z-index: 1; }
.v-head p { margin: 0; opacity: .92; max-width: 680px; position: relative; z-index: 1; }
.v-head .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; position: relative; z-index: 1; }
.v-head .btn { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.v-head .btn:hover { background: rgba(255,255,255,.3); }
.v-head .btn.done { background: #fff; color: #059669; }
.v-head .btn:disabled { opacity: .45; cursor: default; }

/* chip row (secondary axis) */
.chiprow { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 10px; margin: 0 -2px; }
.chiprow::-webkit-scrollbar { display: none; }
.chiprow .chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 13px; }
.chiprow .chip .c { font-size: 11px; opacity: .7; }
.chiprow-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 2px 0 6px; }

/* sticky tab rail */
.tabs2 { position: sticky; top: 64px; z-index: 6; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 10px 2px; margin: 0 -2px 10px; border-bottom: 1px solid var(--line); }
.tabs2::-webkit-scrollbar { display: none; }
.tab2 { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 12px; font-weight: 700; font-size: 13.5px; color: var(--ink2); border: 1px solid transparent; transition: all .18s; }
.tab2:hover { background: var(--card); border-color: var(--line); }
.tab2 .c { font-size: 11px; font-weight: 800; padding: 0 7px; border-radius: 99px; background: var(--line); color: var(--ink2); }
.tab2.on { background: var(--tc, var(--ink)); color: #fff; box-shadow: 0 8px 18px -10px var(--tc, var(--ink)); }
.tab2.on .c { background: rgba(255,255,255,.25); color: #fff; }
.tab2.empty { opacity: .45; }

.panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 8px 0 14px; }
.panel-bar h2 { margin: 0; font-size: 21px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.panel-bar h2 i { font-style: normal; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; background: color-mix(in srgb, var(--tc, var(--brand)) 14%, transparent); }
.panel-bar .tools { display: flex; gap: 8px; flex-wrap: wrap; }

.group { margin-bottom: 26px; }
.grp-h { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-weight: 800; font-size: 15px; }
.grp-h .n { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 13px; background: var(--brand); }
.grp-h a { margin-left: auto; font-size: 13px; color: var(--brand); }

/* overview */
.welcome { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.ring { width: 120px; height: 120px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 800; }
.ring b small { display: block; font-size: 11px; font-weight: 700; opacity: .8; text-align: center; margin-top: -26px; }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; position: relative; z-index: 1; }
.stat { padding: 10px 14px; border-radius: 14px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); }
.stat b { display: block; font-size: 18px; line-height: 1.1; }
.stat span { font-size: 12px; font-weight: 600; opacity: .85; }
.sec-t { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 28px 0 12px; }
.sec-t h3 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.sec-t a { font-weight: 700; font-size: 14px; color: var(--brand); }
.sec-t p { margin: 2px 0 0; color: var(--muted); font-size: 14px; font-weight: 600; }

.ch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.ch-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; overflow: hidden; animation: rise .4s both; }
.ch-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.ch-card .num { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px; }
.ch-card h4 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.01em; }
.ch-card p { margin: 0; color: var(--ink2); font-size: 13.5px; flex: 1; }
.ch-card .mini { display: flex; gap: 6px; flex-wrap: wrap; }
.ch-card .mini span { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--bg); color: var(--ink2); }
.ch-card .done-badge { position: absolute; top: 16px; right: 16px; font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: rgba(16,185,129,.14); color: var(--ok); }

.type-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.type-tile { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s, border-color .2s; animation: rise .4s both; }
.type-tile:hover { transform: translateY(-4px); border-color: var(--tc); box-shadow: 0 16px 30px -18px var(--tc); }
.type-tile i { font-style: normal; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: color-mix(in srgb, var(--tc) 15%, transparent); transition: transform .25s; }
.type-tile:hover i { transform: scale(1.1) rotate(-6deg); }
.type-tile b { font-size: 15px; }
.type-tile small { color: var(--muted); font-weight: 700; font-size: 12px; margin-top: -6px; }
.type-tile.empty { opacity: .55; }

.paper-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.paper-c { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; animation: rise .4s both; }
.paper-c::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--brand), var(--brand2), var(--accent)); }
.paper-c h4 { margin: 0; font-size: 17px; }
.paper-c p { margin: 0; font-size: 13.5px; color: var(--ink2); flex: 1; }
.paper-c .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.paper-c .meta span { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 8px; background: var(--bg); color: var(--ink2); }
.paper-c .acts { display: flex; gap: 8px; flex-wrap: wrap; }

.quick-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.qg { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: left; transition: transform .2s; }
.qg:hover { transform: translateY(-3px); }
.qg i { font-style: normal; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; background: linear-gradient(135deg, #FDE68A, #F59E0B); flex: none; }
.qg b { display: block; font-size: 14px; }
.qg small { color: var(--muted); font-weight: 600; font-size: 12px; }

/* activity */
.activity { border-left: 4px solid #14B8A6; }
.activity .tag { background: rgba(20,184,166,.14); color: #0F766E; }
[data-theme="dark"] .activity .tag { color: #5EEAD4; }
.diff-Easy { background: rgba(16,185,129,.14) !important; color: #047857 !important; }
.diff-Medium { background: rgba(245,158,11,.16) !important; color: #B45309 !important; }
.diff-Hard { background: rgba(239,68,68,.14) !important; color: #B91C1C !important; }
.ch-link { display: inline-flex; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 7px; background: var(--soft); color: var(--brand); margin-left: 8px; flex: none; }
[data-theme="dark"] .ch-link { color: #A5B4FC; }

.hl { animation: hl 2.2s ease-out; }
@keyframes hl { 0%, 30% { box-shadow: 0 0 0 4px var(--accent), var(--shadow); } 100% { box-shadow: var(--shadow); } }

/* exam timer */
.exam-timer { position: sticky; top: 64px; z-index: 6; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: var(--ink); color: var(--bg); margin-bottom: 14px; box-shadow: var(--shadow-lg); }
.exam-timer b { font-size: 20px; font-variant-numeric: tabular-nums; }
.exam-timer .tb { flex: 1; height: 6px; border-radius: 9px; background: rgba(255,255,255,.2); overflow: hidden; }
.exam-timer .tb i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--bad)); transition: width 1s linear; }
.locked .reveal-btn { opacity: .4; pointer-events: none; }

/* match game */
.match-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mt { min-height: 92px; padding: 10px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 13.5px; transition: transform .15s, border-color .15s, background .15s; overflow: hidden; }
.mt:hover:not(:disabled) { border-color: var(--brand); transform: translateY(-2px); }
.mt.sel { border-color: var(--brand); background: var(--soft); transform: scale(1.03); }
.mt.ok { border-color: var(--ok); background: rgba(16,185,129,.12); opacity: .7; }
.mt.no { border-color: var(--bad); background: rgba(239,68,68,.1); animation: shake .35s; }
.mt .katex { font-size: 1em; }

/* search */
.search-ov { position: fixed; inset: 0; z-index: 95; background: rgba(8,10,25,.55); backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; animation: fade .15s; }
.search-ov[hidden] { display: none; }
.search-box { width: min(680px, 100%); background: var(--card); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .2s; display: flex; flex-direction: column; max-height: 76vh; }
.search-in { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); font-size: 18px; }
.search-in input { flex: 1; border: 0; outline: 0; background: none; color: var(--ink); font-size: 17px; font-weight: 600; min-width: 0; }
.search-res { overflow: auto; padding: 8px; }
.sr { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; }
.sr:hover, .sr.act { background: var(--soft); }
.sr i { font-style: normal; flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); }
.sr b { display: block; font-size: 14px; }
.sr small { display: block; color: var(--ink2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.sr em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.sr mark { background: rgba(245,158,11,.3); color: inherit; border-radius: 3px; }
.search-empty { padding: 30px; text-align: center; color: var(--muted); font-weight: 600; }
.search-hints { padding: 14px; display: flex; flex-wrap: wrap; gap: 8px; }

/* bottom nav (mobile) */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: none; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; font-size: 11px; font-weight: 700; color: var(--muted); transition: color .15s, background .15s; }
.bottom-nav i { font-style: normal; font-size: 20px; transition: transform .2s; }
.bottom-nav .on { color: var(--brand); background: var(--soft); }
.bottom-nav .on i { transform: translateY(-2px) scale(1.1); }

@media (max-width: 1180px) { .search-trigger { width: 230px; } }
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; padding-top: 14px; }
  .rail { display: none; }
  .bottom-nav:not([hidden]) { display: flex; }
  body.course-page { padding-bottom: 76px; }
  body.course-page .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .search-trigger { width: 40px; padding: 0; justify-content: center; }
  .search-trigger .st-text, .search-trigger kbd { display: none; }
  .crumb { display: none; }
  .hide-md { display: none; }
}
@media (max-width: 600px) {
  .shell, .wrap-wide { width: calc(100% - 24px); }
  .v-head { padding: 20px; border-radius: 20px; }
  .welcome { grid-template-columns: 1fr; }
  .welcome .ring { display: none; }
  .ch-cards { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; scrollbar-width: none; }
  .ch-cards > * { scroll-snap-align: start; }
  .ch-cards.all { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr; overflow: visible; }
  .type-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .type-tile { padding: 14px; }
  .match-grid { grid-template-columns: repeat(2, 1fr); }
  .search-ov { padding: 0; align-items: stretch; }
  .search-box { border-radius: 0; max-height: none; height: 100%; }
  .xp small { display: none; }
  .stat-row { gap: 8px; flex-wrap: nowrap; }
  .stat { flex: 1; padding: 8px 10px; min-width: 0; }
  .stat b { font-size: 16px; }
  .stat span { font-size: 11px; }
  .grp-h { flex-wrap: wrap; }
  .mode-switch { display: flex; }
  .mode-switch a { flex: 1; justify-content: center; }
  .exam-timer { top: 64px; }
}
@media print {
  .bottom-nav, .rail, .tabs2, .chiprow, .mode-switch, .v-head, .exam-timer, .panel-bar .tools { display: none !important; }
  .shell { display: block; }
}

/* ===== master-format components ===== */
.chip-s { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 99px; background: var(--soft); color: var(--ink2); white-space: nowrap; }
.chip-s i { font-style: normal; opacity: .7; font-weight: 700; }
.chip-s.lv1 { background: rgba(16,185,129,.14); color: #047857; } .chip-s.lv2 { background: rgba(245,158,11,.16); color: #B45309; }
.chip-s.lv3 { background: rgba(249,115,22,.16); color: #C2410C; } .chip-s.lv4 { background: rgba(239,68,68,.14); color: #B91C1C; }
[data-theme="dark"] .chip-s.lv1 { color: #6EE7B7; } [data-theme="dark"] .chip-s.lv2 { color: #FCD34D; } [data-theme="dark"] .chip-s.lv3 { color: #FDBA74; } [data-theme="dark"] .chip-s.lv4 { color: #FCA5A5; }
.chip-s.src { background: rgba(99,102,241,.12); color: var(--brand); }
[data-theme="dark"] .chip-s.src { color: #A5B4FC; }
.cog { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 6px; font-size: 10px; font-weight: 800; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.mk { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--muted); padding: 3px 9px; border: 1px solid var(--line); border-radius: 8px; white-space: nowrap; }
.qcard .qhead, .mcq .qhead { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.qno { font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 9px; background: var(--ink); color: var(--bg); }
.stem { color: var(--ink); margin-bottom: 8px; }
.parts { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 8px; }
.parts li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.pl { flex: none; font-weight: 800; color: var(--brand); min-width: 26px; }
[data-theme="dark"] .pl { color: #A5B4FC; }
.pq { flex: 1; min-width: 0; color: var(--ink); overflow-x: auto; }
.pm { flex: none; display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink2); }
.qbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: flex-start; }
.qbtns .reveal { margin: 0; }
.qbtns .reveal.open { flex-basis: 100%; }
.reveal.hint .reveal-btn { background: rgba(245,158,11,.14); color: #B45309; }
.reveal.full .reveal-btn { background: var(--bg); color: var(--ink2); border: 1px solid var(--line); }
.pa { display: flex; gap: 10px; padding: 4px 0; } .pa > div { flex: 1; min-width: 0; overflow-x: auto; }
.sol { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.answer .sol:first-child { margin: 0; padding: 0; border: 0; }
.fig { margin: 10px 0; display: flex; justify-content: center; overflow-x: auto; }
.fig img { max-width: 100%; border-radius: 10px; }
.jxg { max-width: 100%; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.jxg.jxg-pending { background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 10px, var(--card) 10px, var(--card) 20px); }
.ono { display: inline-block; font-size: 11px; font-weight: 800; color: var(--muted); margin-right: 8px; }
.review .qc { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(245,158,11,.08); border: 1px dashed rgba(245,158,11,.5); }
.terms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.terms span { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 7px; background: var(--bg); color: var(--muted); }
.formula .fx { font-size: 18px; color: var(--ink); text-align: center; padding: 8px 0; overflow-x: auto; }
.formula .mean { margin: 0; color: var(--ink2); font-size: 14px; text-align: center; }
.csec summary .c { margin-left: auto; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.csec summary::after { margin-left: 10px !important; }
.csec .body { display: grid; gap: 12px; color: var(--ink); }
.blk h5, .call h5 { margin: 6px 0 4px; font-size: 15px; }
.call { padding: 12px 14px; border-radius: 14px; border-left: 4px solid var(--brand); background: var(--soft); }
.call-h { font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.call-definition { border-color: #2563EB; background: rgba(37,99,235,.07); }
.call-note, .call-remember { border-color: #F59E0B; background: rgba(245,158,11,.08); }
.call-did_you_know { border-color: #8B5CF6; background: rgba(139,92,246,.08); }
.call-common_mistake { border-color: #EF4444; background: rgba(239,68,68,.07); }
.call-real_life, .call-project { border-color: #10B981; background: rgba(16,185,129,.07); }
.call-think_discuss, .call-self_check, .call-digital_link { border-color: #14B8A6; background: rgba(20,184,166,.07); }
.act-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.act-h h4 { margin: 0; }
.act-no { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 9px; background: rgba(20,184,166,.14); color: #0F766E; }
[data-theme="dark"] .act-no { color: #5EEAD4; }
.given { margin: 10px 0; }
.tasks { list-style: none; counter-reset: t; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); gap: 8px; }
.tasks li { counter-increment: t; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.tasks li::before { content: counter(t, lower-alpha) "."; font-weight: 800; color: #0F766E; }
.tq { flex: 1 1 220px; min-width: 0; color: var(--ink); }
.tans { display: none; font-weight: 800; color: var(--ok); }
.show-ans .tans { display: block; flex-basis: 100%; padding-left: 22px; }
.tasks li.tnl .tspace, .tasks li.tnl .tans { flex-basis: 100%; padding-left: 22px; } .show-ans .tspace { display: none; }
@media (max-width: 600px) { .tasks { grid-template-columns: 1fr; } .parts li { flex-wrap: wrap; } .pm { margin-left: 36px; } }
/* LaTeX conversion helpers */
.tx-table-wrap { overflow-x: auto; margin: 8px 0; }
.tx-table { border-collapse: collapse; font-size: 14px; min-width: 50%; }
.tx-table td, .tx-table th { border: 1px solid var(--line); padding: 7px 10px; text-align: center; vertical-align: middle; }
.tx-table th { background: var(--soft); font-weight: 800; }
.tx-ol, .tx-ul { margin: 6px 0; padding-left: 26px; } .tx-ol li, .tx-ul li { margin: 4px 0; }
.tx-ol.tx-paren { list-style: none; counter-reset: p; padding-left: 30px; }
.tx-ol.tx-paren > li { counter-increment: p; position: relative; }
.tx-ol.tx-paren[type="a"] > li::before { content: "(" counter(p, lower-alpha) ")"; position: absolute; left: -30px; font-weight: 700; }
.tx-ol.tx-paren[type="i"] > li::before { content: "(" counter(p, lower-roman) ")"; position: absolute; left: -30px; font-weight: 700; }
.tx-ol.tx-paren[type="1"] > li::before { content: "(" counter(p) ")"; position: absolute; left: -30px; font-weight: 700; }
.tx-ol li.tx-lab { list-style: none; } .tx-ol li.tx-lab::before { content: attr(data-lab) " "; font-weight: 700; }
.tx-center { text-align: center; } .tx-mini { display: inline-block; vertical-align: top; max-width: 100%; margin: 4px 0; }
.tx-fig { margin: 8px 0; text-align: center; } .tx-cap { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tx-callout { padding: 12px 14px; border-radius: 12px; background: var(--soft); border-left: 4px solid var(--brand); margin: 8px 0; }
.tx-callout > b { display: block; margin-bottom: 4px; }
.tx-ans { display: inline-block; min-width: 110px; height: 1.4em; border-bottom: 2px dotted var(--muted); vertical-align: bottom; }
.tx-tick { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--muted); border-radius: 4px; vertical-align: middle; }
.tx-figph { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 12px; border: 1.5px dashed var(--line); color: var(--muted); font-weight: 700; font-size: 13px; background: var(--bg); }
.tx-ld { display: inline-block; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); margin: 2px 6px 2px 0; font-weight: 700; }
.tx-circ { display: inline-grid; place-items: center; width: 1.4em; height: 1.4em; border: 1.5px solid currentColor; border-radius: 50%; font-size: .85em; }
.tx-fbox { border: 1px solid var(--ink2); padding: 2px 6px; border-radius: 4px; }
.tx-venn { position: relative; width: min(280px, 100%); margin: 8px auto; display: block; }
.tx-venn svg { width: 100%; display: block; }
.tx-venn rect { fill: none; stroke: var(--ink2); stroke-width: 1.5; }
.tx-venn circle { fill: color-mix(in srgb, var(--brand) 12%, transparent); stroke: var(--brand); stroke-width: 1.8; }
.tx-venn .vl, .tx-venn .vt { position: absolute; transform: translate(-50%, -50%); font-size: 13px; text-align: center; white-space: nowrap; }
.tx-venn .vl { transform: none; font-weight: 800; }
.paper-head .ph-k { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stack > *, .qbtns > *, .card { min-width: 0; }
.qbtns .reveal { max-width: 100%; }
.answer { max-width: 100%; overflow-x: auto; }
.card .body, .stem, .pq, .pa > div, .sol { overflow-wrap: anywhere; }
.katex-display { max-width: 100%; }
.v-head .intro { opacity: .95; max-width: 760px; position: relative; z-index: 1; font-size: 15px; }
.v-head .intro .katex { color: inherit; }
.ch-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; position: relative; z-index: 1; }
.ch-stats span { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 9px; background: rgba(255,255,255,.18); }
.more-btn { display: flex; margin: 14px auto 0; }
.more-btn[hidden] { display: none; }
.paper-c p { flex: 0; }
@media (max-width: 600px) { .stat-row .stat:nth-child(4) { display: none; } }
.sol-open { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.sol-close { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-weight: 500; }
.tx-hs { display: inline-block; }
.tx-vs { display: block; }

/* stacked fractions in answers: keep a little space between lines */
.katex .base:has(.mfrac) { margin: 4px 0; }
