:root {
  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #eef2f8; --ink: #141b2d; --ink-2: #4a5468; --muted: #6b7489;
  --line: #dde3ee; --accent: #2a5bd7; --accent-ink: #ffffff; --accent-soft: #e6eeff;
  --good: #1f7a4d; --good-soft: #e3f4ea; --bad: #b42318; --bad-soft: #fde8e6; --warn: #9a6700; --warn-soft: #fff4d6;
  --bar: #2a5bd7; --track: #e3e8f1; --shadow: 0 1px 2px rgba(20,27,45,.06), 0 2px 8px rgba(20,27,45,.05);
  --reader-size: 17px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1320; --surface: #161d2e; --surface-2: #1d2639; --ink: #e8ecf5; --ink-2: #b9c1d3; --muted: #8e98ae;
    --line: #2a3450; --accent: #6f9bff; --accent-ink: #0e1320; --accent-soft: #1f2c4d;
    --good: #5cc98f; --good-soft: #173528; --bad: #ff8a80; --bad-soft: #3d1e1c; --warn: #f2c14e; --warn-soft: #3a2f12;
    --bar: #6f9bff; --track: #26304a; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1320; --surface: #161d2e; --surface-2: #1d2639; --ink: #e8ecf5; --ink-2: #b9c1d3; --muted: #8e98ae;
  --line: #2a3450; --accent: #6f9bff; --accent-ink: #0e1320; --accent-soft: #1f2c4d;
  --good: #5cc98f; --good-soft: #173528; --bad: #ff8a80; --bad-soft: #3d1e1c; --warn: #f2c14e; --warn-soft: #3a2f12;
  --bar: #6f9bff; --track: #26304a; --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px; line-height: 1.45;
  padding-bottom: calc(64px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }

/* top bar */
#top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; height: 54px; padding: 0 8px 0 12px;
  background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
#title { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#top-actions { display: flex; gap: 2px; }
.icon-btn { border: 0; background: none; min-width: 42px; height: 42px; border-radius: 10px; font-size: 20px; cursor: pointer; color: var(--ink); }
.icon-btn:active, .icon-btn:hover { background: var(--surface-2); }
.icon-btn.small { font-size: 15px; font-weight: 700; }

/* bottom tabs */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 8px; font-size: 11px; color: var(--muted); text-decoration: none; }
#tabs a .ti { font-size: 19px; line-height: 1.2; }
#tabs a.on { color: var(--accent); font-weight: 650; }
body.immersive #tabs { display: none; }
body.immersive { padding-bottom: 0; }

main { max-width: 760px; margin: 0 auto; padding: 14px 16px 24px; outline: none; }
h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 2px 10px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* cards & lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 10px; }
a.row, button.row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; color: inherit; text-decoration: none; min-height: 56px; cursor: pointer; }
a.row:active, button.row:active { transform: scale(.995); background: var(--surface-2); }
.row .ic { flex: 0 0 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.row .ic.done { background: var(--good-soft); color: var(--good); }
/* split chapters: chapter heading (not a link) with its topics indented under it */
.row.chap-h { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin: 14px 0 6px; min-height: 56px; }
a.row.topic { margin-left: 22px; width: calc(100% - 22px); }
a.row.topic .ic { font-size: 13px; }
.row .tx { flex: 1; min-width: 0; }
.row .tx b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.row .tx span { display: block; color: var(--muted); font-size: 13px; }
.row .chev { color: var(--muted); font-size: 18px; }
.row .pbar { margin-top: 6px; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); margin-left: 4px; vertical-align: 1px; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

.pbar { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--bar); border-radius: 999px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  border-radius: 10px; padding: 10px 16px; font-weight: 650; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.plain { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .5; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btns .btn { flex: 1 1 auto; }

/* continue card */
.continue { border: 1px solid var(--accent); background: linear-gradient(0deg, var(--surface), var(--surface)); }
.continue .k { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; }
.continue b { display: block; font-size: 16px; margin: 4px 0 2px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 620px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.tile .v { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; }
.chart .tip.on { opacity: 1; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
details summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-top: 8px; }

/* reader */
.reader { font-size: var(--reader-size); line-height: 1.6; overflow-wrap: break-word; }
.reader h1 { font-size: 1.35em; line-height: 1.25; color: var(--accent); margin: .2em 0 .5em; }
.reader h2 { font-size: 1.12em; margin: 1.6em 0 .5em; padding: 6px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--ink); scroll-margin-top: 64px; }
.reader h3 { font-size: 1.02em; margin: 1.2em 0 .3em; color: var(--accent); scroll-margin-top: 64px; }
.reader p { margin: .45em 0 .7em; }
.reader ul, .reader ol { padding-left: 1.3em; }
.reader li { margin: .2em 0; }
.reader blockquote { margin: .7em 0; padding: 8px 12px; background: var(--warn-soft); border-left: 4px solid var(--warn); border-radius: 6px; }
.reader blockquote p { margin: .2em 0; }
.reader .tablewrap { overflow-x: auto; margin: .6em 0 1em; border: 1px solid var(--line); border-radius: 8px; }
.reader table { border-collapse: collapse; width: 100%; font-size: .86em; line-height: 1.4; }
.reader th, .reader td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px 8px; vertical-align: top; text-align: left; min-width: 90px; }
.reader th { background: var(--surface-2); }
.reader .fig { margin: 12px 0; overflow-x: auto; }
.reader .fig > svg, .reader .fig .mapbox svg { width: 100%; min-width: 520px; height: auto; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.reader code { font-size: .9em; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.reader .cover { text-align: center; padding: 30px 0; }
.reader-progress { position: fixed; left: 0; top: 0; height: 3px; background: var(--accent); z-index: 30; width: 0; }
.chapnav { display: flex; gap: 10px; margin: 28px 0 10px; }
.chapnav a { flex: 1; }
.donebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 24px; }

/* toc sheet */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet .panel { background: var(--surface); width: 100%; max-width: 760px; max-height: 82vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet .panel h3 { margin: 4px 0 10px; font-size: 16px; }
.sheet .panel a.toc { display: block; padding: 9px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.sheet .panel a.toc.l3 { padding-left: 18px; color: var(--ink-2); font-size: 14px; }

/* pdf */
#pdfwrap { background: var(--surface-2); margin: -14px -16px 0; padding: 8px 0 30px; min-height: 80vh; }
.pdfpage { position: relative; margin: 0 auto 8px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); width: calc(100% - 12px); max-width: 900px; }
.pdfpage canvas { display: block; width: 100%; height: 100%; }
.pdfpage .pn { position: absolute; right: 6px; bottom: 4px; font-size: 11px; color: #777; }
.pdfbar { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; box-shadow: 0 2px 10px rgba(0,0,0,.18); font-size: 14px; }
.pdfbar input { width: 64px; padding: 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; text-align: center; }

/* tests */
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.qtext { font-size: 16px; line-height: 1.55; }
.qtext p { margin: 0 0 .5em; }
.passage { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14.5px; line-height: 1.55; max-height: 40vh; overflow: auto; }
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opt { display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; cursor: pointer; min-height: 48px; }
.opt .L { flex: 0 0 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .L { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.right .L { background: var(--good); color: var(--surface); border-color: var(--good); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .L { background: var(--bad); color: var(--surface); border-color: var(--bad); }
.opt[disabled] { cursor: default; }
.explain { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14.5px; }
.explain p { margin: .2em 0; }
.testbar { position: sticky; top: 54px; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--bg); padding: 8px 0; margin-top: -6px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.timer.low { color: var(--bad); }
.qnav { display: flex; gap: 8px; margin-top: 14px; }
.qnav .btn { flex: 1; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.palette button { height: 40px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.palette button.ans { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.palette button.mk { border-color: var(--warn); box-shadow: inset 0 0 0 2px var(--warn); }
.palette button.cur { outline: 2px solid var(--ink); outline-offset: 1px; }
.palette button.r-right { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.palette button.r-wrong { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.palette button.r-drop { opacity: .45; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--muted); margin: 10px 0; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; border: 1.5px solid var(--line); }
.score { text-align: center; padding: 18px 10px; }
.score .big { font-size: 44px; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.score .of { color: var(--muted); }
.seg { display: flex; gap: 6px; overflow-x: auto; margin: 10px 0; }
.seg button { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 13.5px; }
.seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* forms */
select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; }
input[type=search], input[type=text] { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
#toast { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 10px; font-size: 14px; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.on { opacity: 1; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.spinner { text-align: center; color: var(--muted); padding: 40px 0; }

mark { background: #ffe066; color: #111; border-radius: 3px; padding: 0 1px; }


.pdfsearch { position: sticky; top: 54px; z-index: 16; display: flex; align-items: center; gap: 4px; background: var(--surface); border-bottom: 1px solid var(--line); margin: -14px -16px 0; padding: 6px 10px; }
.pdfsearch input { flex: 1; min-width: 0; padding: 8px 10px; }
.pdfsearch #pcount { min-width: 44px; text-align: right; }

.pdfsearch + #pdfwrap { margin-top: 0; }

.readsearch { margin: -14px -16px 10px; }
mark.fm.cur { background: #ff9f1c; outline: 2px solid #ff9f1c; }


.explore { font-size: 13px; margin: 2px 0 10px; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.explore a { text-decoration: none; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--accent); }
.explore.ncert, .explore.places { display: block; line-height: 2.1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.explore.ncert a, .explore.places a { margin-right: 4px; }


.mapbox { position: relative; overflow: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; -webkit-overflow-scrolling: touch; }
.mapbox svg.map { display: block; width: 100%; height: auto; cursor: zoom-in; }
.mapctl { position: sticky; float: right; top: 6px; right: 6px; margin: -100% 6px 0 0; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.mapbox .mapctl { position: absolute; top: 6px; right: 6px; margin: 0; }
.mapctl button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid #c9ced8; background: rgba(255,255,255,0.95); color: #0b3d91; font-size: 18px; font-weight: 700; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.mapfull { position: fixed; inset: 0; z-index: 80; background: #fff; }
.mapstage { position: absolute; inset: 0; overflow: hidden; touch-action: none; display: flex; align-items: center; justify-content: center; }
.mapstage svg { width: 100%; height: 100%; transform-origin: 0 0; }
.mapfull .mapctl.big { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; margin: 0; }
.mapfull .mapctl.big button { width: 44px; height: 44px; font-size: 22px; }
.maphint { position: absolute; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.65); color: #fff; font-size: 12.5px; padding: 6px 12px; border-radius: 999px; pointer-events: none; }

.reader .fig .mapbox svg.map, .reader .mapbox svg.map { min-width: 0; width: 100%; border: 0; }
.reader .fig:has(.mapbox) { overflow: visible; }


.livewrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); margin: 6px 0; }
.livemap { height: 380px; background: #e9eef3; }
.livebar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 12.5px; }
.livebar .livetitle { flex: 1; min-width: 0; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livebar button { border: 1px solid var(--line); background: var(--surface-2); color: var(--accent); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; cursor: pointer; }
.livewrap.full { position: fixed; inset: 0; z-index: 90; border-radius: 0; display: flex; flex-direction: column; }
.livewrap.full .livemap { flex: 1; height: auto; }
.leaflet-tooltip.pinlab { background: rgba(255,255,255,.92); border: 0; box-shadow: 0 1px 2px rgba(0,0,0,.3); padding: 1px 5px; font-size: 11px; color: #111; }
.leaflet-tooltip.pinlab::before { display: none; }
.reader .fig.mapfig { overflow: visible; }
.reader .fig.mapfig > svg.map { margin-top: 6px; }
.mapfig.live > .mapbox, .mapfig.live > svg.map { display: none; }
.mapfig.live.showsvg > .mapbox { display: block; }
.mapfig.live.showsvg .livemap { display: none; }


.livemap svg { max-width: none !important; min-width: 0 !important; width: auto; height: auto; background: none !important; border: 0 !important; border-radius: 0 !important; }
.livemap img { max-width: none !important; }
.livewrap { position: relative; isolation: isolate; }
.livemap.nolabels .leaflet-tooltip.pinlab { display: none; }
.livemap .leaflet-marker-icon { width: 18px !important; height: 30px !important; margin-left: -9px !important; margin-top: -30px !important; }
.livemap .leaflet-marker-shadow { display: none; }


.langbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.langbar .btn.small { padding: 4px 10px; font-size: 13px; }

/* in-chapter practice questions (answer with each question) */
.mcq-set { margin: 14px 0 8px; }
.mcq-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.mcq-bar .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mcq-score { font-weight: 700; color: var(--good); min-width: 90px; }
.mcq { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 10px; margin: 0 0 14px; box-shadow: var(--shadow); }
.mcq-q { font-weight: 600; line-height: 1.55; }
.mcq-q p { display: inline; margin: 0; }
.mcq-n { color: var(--accent); margin-right: 6px; }
.mcq-psg { font-size: .92em; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
.mcq .opts { margin-top: 10px; }
.mcq .opt { font-size: .97em; }
.mcq .opt.right::after { content: "✓"; margin-left: auto; color: var(--good); font-weight: 700; }
.mcq .opt.wrong::after { content: "✗"; margin-left: auto; color: var(--bad); font-weight: 700; }
.mcq-foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.mcq-exp { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--good); background: var(--good-soft); border-radius: 8px; font-size: .95em; }
.mcq-exp p { margin: 0; }
.btn.small { padding: 6px 12px; font-size: 13px; min-height: 34px; }

/* own explainer videos */
.explore a.vx { font-weight: 700; background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 2px 10px; text-decoration: none; }
.vx-ov { position: fixed; inset: 0; background: rgba(5, 10, 20, .82); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 12px; }
.vx-box { background: var(--surface); border-radius: 14px; overflow: hidden; width: min(420px, 100%); max-height: 100%; display: flex; flex-direction: column; }
.vx-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; color: var(--ink); }
.vx-box video { width: 100%; max-height: calc(100vh - 80px); background: #000; display: block; aspect-ratio: 9 / 16; }

/* chapter tabs: Learn / Revise / Practice / Video + section bar */
.ct-hide { display: none !important; }
.rhead { position: sticky; top: 54px; z-index: 16; margin: -14px -16px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.rhead .readsearch { position: static; margin: 0; border-bottom: 1px solid var(--line); }
.rhead .readsearch[hidden] { display: none; }
.ctabs { display: flex; gap: 4px; padding: 6px 8px 0; overflow-x: auto; scrollbar-width: none; }
.ctabs::-webkit-scrollbar { display: none; }
.ctabs button { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px; border: 0; background: transparent; color: var(--ink-2);
  padding: 6px 10px 7px; border-bottom: 3px solid transparent; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; white-space: nowrap; min-height: 44px; }
.ctabs button small { font-size: 11px; font-weight: 500; color: var(--muted); }
.ctabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.ctabs button.on small { color: var(--accent); }
.secbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 13px; border-top: 1px solid var(--line); min-height: 38px; }
.secbar .sx { flex: 0 0 auto; font-weight: 700; color: var(--accent); }
.secbar .sn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.secbar .btn.small { flex: 0 0 auto; padding: 4px 10px; font-size: 13px; }
.reader h2, .reader h3 { scroll-margin-top: 150px; }
.ctnext { margin: 24px 0 8px; }
.ctnext-b { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ctpr { margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ctnote { margin: 2px 0 10px; }
.vxcard { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.vxcard .btn.vx { flex: 0 0 auto; }
.ytl { display: flex; flex-direction: column; gap: 10px; }
.ytl a { text-decoration: none; }

/* chapter opening: What you'll learn + folded sources */
.wyl { margin: 4px 0 12px; border-left: 4px solid var(--accent); }
.wyl > b { font-size: 17px; }
.wyl-meta { color: var(--muted); font-size: 13px; margin: 4px 0 6px; }
.wyl ol { margin: 6px 0 4px; padding-left: 22px; }
.wyl li { margin: 5px 0; line-height: 1.4; }
.wyl li a { text-decoration: none; color: var(--ink); }
.wyl li a:hover { color: var(--accent); }
.wyl-more { display: inline-block; margin: 2px 0 4px 22px; }
.wyl-b { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.srcbox { margin: 0 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.srcbox > summary { cursor: pointer; padding: 10px 14px; font-weight: 650; font-size: 14px; color: var(--ink-2); list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.srcbox > summary::-webkit-details-marker { display: none; }
.srcbox > summary::after { content: "▸"; margin-left: auto; color: var(--muted); }
.srcbox[open] > summary::after { content: "▾"; }
.srcw { font-weight: 500; font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 2px 8px; }
.srcbox > :not(summary) { margin: 0 14px 12px; font-size: 14px; }

/* profile: exam chip, welcome picker, today's plan */
.examchip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); margin: 0 0 12px; }
.examchip b { color: var(--ink); }
.examchip a { margin-left: auto; font-weight: 650; text-decoration: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 14px; }
.pick { display: grid; grid-template-columns: 1fr; gap: 8px; }
.pick.row3 { grid-template-columns: repeat(3, 1fr); }
.pickb { text-align: left; border: 2px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 10px 12px; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-height: 48px; }
.pickb span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.pickb.on { border-color: var(--accent); background: var(--accent-soft); }
.pick.row3 .pickb { text-align: center; align-items: center; }
.setting input[type=date], .setting select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.plan { border-left: 4px solid var(--accent); margin-bottom: 12px; }
.plan-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.plan-h b { font-size: 17px; }
.plan-cd { margin: 6px 0 2px; font-size: 14px; }
.plan-goal { margin: 8px 0 6px; font-size: 13px; color: var(--muted); }
.plan-s { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.plan-c { flex: 0 0 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }
.plan-s.ok .plan-c { background: var(--good, #1a8f4c); border-color: var(--good, #1a8f4c); color: #fff; }
.plan-s.ok b { text-decoration: line-through; color: var(--muted); }
.plan-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.plan-t small { font-size: 12px; color: var(--accent); font-weight: 700; }
.plan-t b { font-size: 14.5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.plan-t em { font-style: normal; font-size: 12px; color: var(--muted); }
details.others { margin-top: 12px; }
details.others > summary { cursor: pointer; color: var(--ink-2); font-weight: 650; padding: 8px 0; }

/* mistakes, saved, weak areas */
.qlinks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.qlinks a { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.qlinks span { font-size: 12.5px; color: var(--muted); }
.bmb { border: 1px solid var(--line); background: transparent; color: var(--ink-2); border-radius: 14px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; margin-right: 6px; }
.bmb.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.explore .bmb { margin-left: 4px; }
.mcq-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mcq-foot .mcq-show { margin-left: auto; }
.rq { margin: 12px 0; }
.rq-src { margin-bottom: 6px; }
.rqbar { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.rqwrap { margin-bottom: 14px; }
.mrow { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.mrow .ic { flex: 0 0 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.mrow .ic.done { background: var(--surface-2); color: var(--muted); }
.mrow .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mrow .tx span { font-size: 12.5px; color: var(--muted); }
.mrow .icon-btn { flex: 0 0 auto; }
.mrow .tx b { font-weight: 600; font-size: 14px; }
.weak .wk { margin: 10px 0; }
.wk-h { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.wk-h a { text-decoration: none; }
.wk-h b.bad { color: var(--bad, #c0392b); } .wk-h b.mid { color: var(--warn, #b7791f); } .wk-h b.good { color: var(--good, #1a8f4c); }

/* offline download box on unit pages */
.offbox { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin: 0 0 12px; border: 1px dashed var(--line); border-radius: 12px; font-size: 13.5px; color: var(--ink-2); }
.offbox.on { border-style: solid; border-color: var(--good, #1a8f4c); }
.offbox .btn.small { padding: 6px 12px; }

/* reading comfort */
.swipe { margin: 8px 0 4px; display: flex; align-items: center; gap: 6px; }
.swipe::before { content: "↔"; font-weight: 700; color: var(--accent); }
.tablewrap.wide { position: relative; box-shadow: inset -14px 0 12px -12px rgba(0, 0, 0, .35); }
.tablewrap.wide.end { box-shadow: none; }
[lang="ta"] { font-family: "Noto Sans Tamil", "Nirmala UI", "Latha", system-ui, sans-serif; line-height: 1.7; }

/* quick 10, daily quiz, share/report */
.quickbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; border-left: 4px solid var(--warn, #b7791f); }
.mcq-set.quick .mcq-bar { display: none; }
.qlinks a.wide { grid-column: 1 / -1; }
.donebar { flex-wrap: wrap; gap: 8px; }
