:root {
  --bg: #f5f7fb; --panel: #ffffff; --ink: #0f1b2d; --ink-2: #33415a; --muted: #6a7890; --line: #e3e8f0; --line-2: #d3dbe7;
  --brand: #0f2a4a; --brand-2: #1d5fa8; --brand-soft: #e8f0fb; --accent: #e8792b; --accent-soft: #fdf1e6;
  --ok: #17864b; --ok-soft: #e6f5ec; --bad: #c43535; --bad-soft: #fcebeb; --warn: #9a6400; --warn-soft: #fff5db;
  --chip: #eef2f8; --hl: #fff0a3;
  --gt: #8a3ea0; --gs: #1d5fa8; --apt: #1f8073; --ca: #c4581a; --pyq: #8a5a00;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .05);
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 8px 24px -12px rgba(15, 27, 45, .14);
  --fs: 1; --radius: 14px; --top: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c121a; --panel: #141c26; --ink: #e8eef6; --ink-2: #c3cedc; --muted: #8e9cb0; --line: #233041; --line-2: #2e3d51;
    --brand: #0b1b2f; --brand-2: #78b0ec; --brand-soft: #172840; --accent: #f3a259; --accent-soft: #33251a;
    --ok: #5fd08f; --ok-soft: #133024; --bad: #ff8b8b; --bad-soft: #3a1b1d; --warn: #f0c46a; --warn-soft: #362b14;
    --chip: #1c2734; --hl: #5a4c10; --gt: #d08ce0; --gs: #78b0ec; --apt: #6fd1bd; --ca: #f39b67; --pyq: #e7b85b;
    --shadow-sm: none; --shadow: none; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: calc(15px * var(--fs))/1.6 "Inter", "Noto Sans Tamil", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--brand-2); }
.ta { font-family: "Noto Sans Tamil", "Inter", sans-serif; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.only-mobile { display: none; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; gap: 14px; align-items: center; min-height: var(--top);
  padding: calc(8px + env(safe-area-inset-top, 0px)) 20px 8px; background: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.06), var(--shadow); }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; min-width: 0; }
.brand b { display: block; font: 700 17px/1.2 "Noto Serif Tamil", serif; white-space: nowrap; }
.brand small { display: block; opacity: .7; font-size: 11.5px; white-space: nowrap; letter-spacing: .2px; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #f39a4a, #d9661c); display: grid; place-items: center; font: 700 18px "Noto Serif Tamil", serif; flex: none; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.search { flex: 1; max-width: 560px; margin-left: auto; position: relative; }
.search::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-52%); font-size: 18px; opacity: .7; pointer-events: none; }
.search input { width: 100%; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; padding: 9px 12px 9px 34px; font: inherit; font-size: 14px; background: rgba(255,255,255,.1); color: #fff; transition: background .15s, border-color .15s; }
.search input::placeholder { color: rgba(255,255,255,.65); }
.search input:focus { outline: none; border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.18); }
.tools { display: flex; gap: 8px; }
.seg { display: inline-flex; border: 1px solid rgba(255,255,255,.25); border-radius: 9px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 6px 11px; font-size: 13px; color: inherit; }
.seg button + button { border-left: 1px solid rgba(255,255,255,.25); }
.seg button:hover { background: rgba(255,255,255,.1); }
.seg button.on { background: #fff; color: var(--brand); font-weight: 700; }
.icon-btn { background: none; border: 0; color: #fff; font-size: 22px; padding: 2px 6px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: calc(100vh - var(--top)); }
.sidebar { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 12px 40px; scrollbar-width: thin; }
main { padding: 24px clamp(16px, 3vw, 40px) 90px; max-width: 1240px; width: 100%; margin: 0 auto; outline: none; }
.scrim { display: none; }

/* sidebar */
.nav-home, .nav-extra { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; }
.nav-home .muted { font-weight: 400; font-size: 12.5px; }
.nav-extra .cnt { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.ic { width: 22px; text-align: center; color: var(--brand-2); }
.nav-home:hover, .nav-extra:hover, .nav-unit:hover { background: var(--chip); }
.nav-home.on, .nav-extra.on { background: var(--brand-soft); color: var(--brand-2); }
.nav-group { margin-top: 18px; }
.nav-group h4 { margin: 0 0 4px; padding: 0 10px; font-size: 11.5px; letter-spacing: .5px; color: var(--muted); display: flex; justify-content: space-between; font-weight: 600; }
.nav-group h4 span:first-child { display: flex; align-items: center; gap: 7px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pc, var(--brand-2)); flex: none; }
.nav-unit { display: flex; gap: 8px; justify-content: space-between; padding: 7px 10px 7px 25px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-size: 13.5px; position: relative; }
.nav-unit.on { background: var(--brand-soft); color: var(--ink); font-weight: 600; }
.nav-unit.on::before { content: ""; position: absolute; left: 10px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--pc, var(--brand-2)); }
.nav-unit .nm { font-family: "Noto Sans Tamil", sans-serif; line-height: 1.4; }
.nav-unit .ct { font-size: 12px; color: var(--muted); align-self: center; font-weight: 500; }
.nav-sub { display: block; padding: 4px 10px 4px 34px; font-size: 12.5px; color: var(--muted); text-decoration: none; border-radius: 8px; font-family: "Noto Sans Tamil", sans-serif; line-height: 1.45; }
.nav-sub.on, .nav-sub:hover { color: var(--ink); background: var(--chip); }

/* ---------- generic ---------- */
h1.page { font: 700 calc(25px * var(--fs))/1.3 "Noto Serif Tamil", serif; margin: 4px 0 4px; letter-spacing: -.2px; }
.page-sub { color: var(--muted); margin: 0 0 18px; }
.h2 { font: 700 18px/1.3 "Noto Sans Tamil", "Inter", sans-serif; margin: 26px 0 10px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand-2); text-decoration: underline; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.ph { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ph h3 { margin: 0; font: 700 15.5px/1.3 "Noto Sans Tamil", "Inter", sans-serif; }
.ph .muted { font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.grid + .grid, .grid + .panel, .panel + .sec, .kpis + .grid { margin-top: 16px; }
.g3 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.btn { display: inline-flex; gap: 6px; align-items: center; justify-content: center; border: 1px solid var(--line-2); background: var(--panel); border-radius: 10px; padding: 8px 15px; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink); transition: border-color .15s, background .15s, transform .1s; }
.btn:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.ghost { background: transparent; border-style: dashed; color: var(--muted); }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.lg { padding: 11px 18px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.cta { margin: 18px 0 6px; gap: 10px; }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--panel); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--ink-2); border: 1px solid var(--line-2); }
.chip b { font-weight: 600; color: var(--muted); font-size: 12px; }
button.chip:hover { border-color: var(--brand-2); }
button.chip.on { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
button.chip.on b { color: rgba(255,255,255,.85); }
.tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: var(--chip); color: var(--muted); }
.tag.rep { background: var(--accent-soft); color: var(--accent); }
.tag.exp { background: var(--ok-soft); color: var(--ok); }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--chip); border-radius: 11px; margin: 14px 0 12px; max-width: 100%; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 14px; }
.tabs button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.part-gt { --pc: var(--gt); } .part-gs { --pc: var(--gs); } .part-apt { --pc: var(--apt); } .part-ca { --pc: var(--ca); } .part-pyq { --pc: var(--pyq); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 2px 8px; border-radius: 6px; color: #fff; background: var(--pc, var(--brand-2)); }

/* ---------- dashboard ---------- */
.hero { position: relative; overflow: hidden; border-radius: 18px; padding: 30px 32px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #2a6db8 0%, rgba(42,109,184,0) 55%), linear-gradient(135deg, #0f2a4a 0%, #163d6b 100%); box-shadow: var(--shadow); }
.hero::after { content: "அ"; position: absolute; right: 26px; bottom: -40px; font: 700 200px/1 "Noto Serif Tamil", serif; opacity: .07; pointer-events: none; }
.hero .eyebrow { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; opacity: .75; font-weight: 600; }
.hero h1 { font: 700 calc(30px * var(--fs))/1.25 "Noto Serif Tamil", serif; margin: 6px 0 8px; }
.hero p { margin: 0 0 18px; max-width: 720px; opacity: .92; }
.hero p .en { opacity: .75; font-size: 13.5px; }
.hero-btn { background: #fff; border-color: #fff; color: var(--brand); }
.hero-btn:hover { color: var(--brand); filter: brightness(.96); }
.hero-ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.35); color: #fff; }
.hero-ghost:hover { border-color: #fff; color: #fff; background: rgba(255,255,255,.14); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); margin-top: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); border-top: 3px solid var(--brand-2); }
.kpi.k-rep { border-top-color: var(--accent); } .kpi.k-exp { border-top-color: var(--ok); }
.kpi .v { font: 700 26px/1.15 "Inter", sans-serif; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .l { font-weight: 600; font-size: 13.5px; margin-top: 4px; font-family: "Noto Sans Tamil", "Inter", sans-serif; }
.kpi .s { color: var(--muted); font-size: 12px; }
.stack { display: flex; height: 16px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--line); }
.stack i { background: var(--pc); min-width: 4px; }
.stack-legend { display: grid; gap: 8px; margin-top: 14px; }
.stack-legend > div { display: grid; grid-template-columns: 14px 1fr auto 56px; align-items: center; gap: 8px; font-size: 14px; }
.stack-legend b { font-variant-numeric: tabular-nums; }
.stack-legend .muted { text-align: right; font-size: 12.5px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 64px; gap: 10px; align-items: center; font-size: 14px; margin: 9px 0; }
.hbar .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 10px; border-radius: 99px; background: var(--chip); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 99px; background: var(--brand-2); }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; }
.bars .hbar { grid-template-columns: minmax(0, 42%) 1fr 52px; margin: 7px 0; font-size: 13.5px; }
.bars .hbar .nm { font-family: "Noto Sans Tamil", sans-serif; color: var(--ink-2); text-decoration: none; }
.bars a.nm:hover { color: var(--brand-2); text-decoration: underline; }
.bars .hbar b { font-size: 13px; color: var(--ink-2); }
.toplist { margin: 0; padding: 0; list-style: none; counter-reset: t; }
.toplist li { counter-increment: t; display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.toplist li:last-child { border-bottom: 0; }
.toplist li::before { content: counter(t); width: 22px; height: 22px; border-radius: 6px; background: var(--chip); color: var(--muted); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.toplist a { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; min-width: 0; }
.toplist a:hover .nm { color: var(--brand-2); }
.toplist .nm { font-family: "Noto Sans Tamil", sans-serif; font-size: 14px; line-height: 1.35; }
.toplist .muted { font-size: 12px; }
.toplist b { font-variant-numeric: tabular-nums; }
.sec { margin-top: 30px; }
.sec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sec-head h2 { margin: 0; font: 700 19px/1.3 "Noto Sans Tamil", sans-serif; }
.sec-head .muted { font-size: 13px; }

/* unit cards */
.unit-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.unit-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--pc); }
.unit-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.uc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.unit-card h3 { margin: 0; font: 600 15.5px/1.4 "Noto Sans Tamil", sans-serif; }
.uc-n { font: 700 20px/1.2 "Inter", sans-serif; color: var(--pc); font-variant-numeric: tabular-nums; }
.unit-card .en { color: var(--muted); font-size: 12.5px; }
.uc-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.uc-go { margin-top: auto; padding-top: 10px; font-size: 13px; font-weight: 600; color: var(--pc); opacity: 0; transform: translateX(-4px); transition: .15s; }
.unit-card:hover .uc-go, .unit-card:focus-visible .uc-go { opacity: 1; transform: none; }

/* sub cards */
.sub-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.sub-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 13px 16px; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
.sub-card:hover { border-color: var(--pc, var(--brand-2)); box-shadow: var(--shadow); }
.sub-card .nm { font: 500 14.5px/1.4 "Noto Sans Tamil", sans-serif; }
.sub-card .en { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.sub-card .n { font: 700 18px "Inter", sans-serif; color: var(--pc, var(--brand-2)); min-width: 40px; text-align: center; background: var(--chip); border-radius: 10px; padding: 4px 8px; }

/* charts */
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--ink-2); font-size: 12px; font-family: "Noto Sans Tamil", "Inter", sans-serif; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.tbl-wrap.flat { border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--chip); font-size: 12px; letter-spacing: .3px; color: var(--muted); position: sticky; top: 0; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--chip) 50%, transparent); }
tr.tot td { font-weight: 700; background: var(--chip); }
td.ans { color: var(--ok); font-weight: 600; }
td.num { color: var(--muted); white-space: nowrap; }

/* ---------- list toolbar ---------- */
.row.noprint { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; gap: 6px; }
#srcSel { appearance: auto; background: var(--panel); color: var(--ink-2); }

/* ---------- question card ---------- */
.qlist { display: grid; gap: 14px; }
.q { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 14px; box-shadow: var(--shadow-sm); scroll-margin-top: calc(var(--top) + 14px); transition: border-color .2s, box-shadow .2s; }
.q.correct { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); box-shadow: 0 0 0 3px var(--ok-soft); }
.q.wrong { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); box-shadow: 0 0 0 3px var(--bad-soft); }
.q.revealed { border-color: var(--line-2); box-shadow: 0 0 0 3px var(--brand-soft); }
.q-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.q-no { font: 700 13px/1 "Inter", sans-serif; color: var(--brand-2); background: var(--brand-soft); border-radius: 7px; padding: 5px 8px; margin-right: 2px; }
.badge { border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; }
.b-rep { background: var(--accent-soft); color: var(--accent); }
.b-new { background: var(--warn-soft); color: var(--warn); }
.b-fig { background: var(--chip); color: var(--muted); }
.b-con { background: var(--bad-soft); color: var(--bad); }
.b-ocr { background: var(--chip); color: var(--muted); }
.b-exp { background: var(--ok-soft); color: var(--ok); }
.src { font-size: 12px; color: var(--muted); }
.stem { white-space: pre-line; font-size: calc(15.5px * var(--fs)); margin: 2px 0; font-weight: 500; line-height: 1.65; }
.stem.ta, .opt .ta { font-size: calc(15px * var(--fs)); }
.stem + .stem { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-weight: 400; color: var(--ink-2); }
.passage { background: var(--chip); border-radius: 10px; padding: 8px 12px; margin: 6px 0 10px; font-size: 14px; white-space: pre-line; }
.passage summary { cursor: pointer; font-weight: 600; color: var(--brand-2); }
.opts { display: grid; gap: 8px; margin-top: 12px; }
@media (min-width: 760px) { .opts { grid-template-columns: 1fr 1fr; } }
.opt { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; text-align: left; border: 1.5px solid var(--line); background: var(--panel); border-radius: 11px; padding: 9px 12px; min-height: 48px; transition: border-color .12s, background .12s, transform .08s; }
.opt .k { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 13px "Inter", sans-serif; color: var(--muted); background: var(--chip); }
.opt .ta { display: block; color: var(--muted); }
.opt .en + .ta { margin-top: 1px; }
@media (hover: hover) {
  button.opt:hover { border-color: var(--brand-2); background: var(--brand-soft); }
  button.opt:hover .k { background: var(--brand-2); color: #fff; }
}
button.opt:active { transform: scale(.995); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .k { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad); color: #fff; }
.explain { margin-top: 12px; border-radius: 12px; background: var(--ok-soft); padding: 12px 14px; font-size: 14px; animation: fadein .2s ease; }
.explain.bad { background: var(--bad-soft); }
.explain b.res { display: block; margin-bottom: 4px; font-size: 15px; }
.q.correct .explain b.res { color: var(--ok); } .q.wrong .explain b.res { color: var(--bad); }
.why { margin-top: 10px; display: grid; gap: 8px; }
.why-ok, .why-no { background: var(--panel); border-left: 3px solid var(--ok); border-radius: 0 10px 10px 0; padding: 8px 12px; }
.why-no { border-left-color: var(--bad); }
.why-no ul { margin: 4px 0 0; padding-left: 18px; }
.why-no li { margin: 3px 0; }
.why-k { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 12px; }
.kural-box { margin-top: 10px; padding: 10px 14px; border-left: 3px solid var(--gt); background: var(--panel); border-radius: 0 10px 10px 0; }
.kural-box .kt { font: 600 calc(16px * var(--fs))/1.8 "Noto Serif Tamil", serif; }
.q-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px; }

/* notes */
.notes { margin-bottom: 16px; }
.notes summary { cursor: pointer; font-weight: 700; color: var(--brand-2); font-size: 15px; }
.notes .body { margin-top: 10px; font-size: 14.5px; }
.notes .body h4 { margin: 12px 0 4px; }
.notes .body ul { margin: 4px 0; padding-left: 20px; }

/* pager */
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 18px 0; flex-wrap: wrap; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.loading { padding: 50px; text-align: center; color: var(--muted); }
.loading::after { content: ""; display: inline-block; width: 16px; height: 16px; margin-left: 8px; border: 2px solid var(--line); border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
mark { background: var(--hl); color: inherit; border-radius: 3px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(30px); opacity: 0; background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 10px; font-size: 14px; transition: .25s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%); }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* ---------- responsive: small laptop / tablet landscape ---------- */
@media (min-width: 1600px) { main { max-width: 1320px; } }
@media (max-width: 1280px) and (min-width: 1101px) {
  .layout { grid-template-columns: 260px minmax(0, 1fr); }
}

/* ---------- tablet portrait & phone: sidebar becomes a drawer ---------- */
@media (max-width: 1100px) {
  .only-mobile { display: inline-block; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; height: 100vh; height: 100dvh; width: min(330px, 86vw); transform: translateX(-102%); transition: transform .2s; padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .sidebar.open { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
}
@media (max-width: 900px) {
  :root { --top: 112px; }
  .topbar { flex-wrap: wrap; gap: 8px 10px; padding-left: 12px; padding-right: 12px; }
  .brand { flex: 1; }
  .brand > span:last-child { min-width: 0; }
  .brand b { overflow: hidden; text-overflow: ellipsis; }
  .brand small { display: none; }
  .tools { margin-left: auto; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  main { padding-top: 18px; }
  .hero { padding: 24px 22px; border-radius: 16px; }
  .hero h1 { font-size: calc(25px * var(--fs)); }
  .hero::after { font-size: 150px; bottom: -30px; }
}

/* ---------- phone ---------- */
@media (max-width: 600px) {
  .tools .seg:last-child { display: none; }
  .seg button { padding: 5px 8px; font-size: 12px; }
  .logo { width: 32px; height: 32px; font-size: 16px; }
  .brand b { font-size: 15px; }
  main { padding: 14px 12px 80px; }
  h1.page { font-size: calc(21px * var(--fs)); }
  .hero { padding: 20px 18px; }
  .hero h1 { font-size: calc(22px * var(--fs)); }
  .hero p { font-size: 14px; }
  .hero .row .btn { flex: 1 1 100%; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 12px 13px; }
  .kpi .v { font-size: 22px; }
  .panel { padding: 15px 14px; }
  .grid { gap: 12px; }
  .hbar { grid-template-columns: 1fr 60px; gap: 4px 10px; }
  .hbar .track { grid-column: 1 / -1; grid-row: 2; }
  .bars .hbar { grid-template-columns: 1fr 52px; }
  .stack-legend > div { grid-template-columns: 14px 1fr auto 50px; font-size: 13.5px; }
  .g3 { grid-template-columns: 1fr; }
  .uc-go { opacity: 1; transform: none; }
  .sub-list { grid-template-columns: 1fr; }
  .btn.lg { flex: 1 1 100%; }
  .q { padding: 13px 12px 12px; border-radius: 12px; }
  .opt { padding: 9px 10px; gap: 9px; }
  .q-actions .btn { flex: 1; }
  .row.noprint { padding: 8px; }
  #srcSel { flex: 1 1 100%; }
  .pager { gap: 6px; }
  .hide-sm { display: none; }
  .tabs { display: flex; }
  .tabs button { flex: 1; padding: 7px 8px; font-size: 13px; }
  th, td { padding: 8px 10px; }
}
@media print {
  .topbar, .sidebar, .tabs, .q-actions, .pager, .row.noprint { display: none !important; }
  .layout { display: block; }
  main { padding: 0; max-width: none; }
  .q, .panel, .tbl-wrap { box-shadow: none; break-inside: avoid; }
}

/* ---------- previous-year papers ---------- */
.yr-group { margin: 18px 0 6px; }
.yr-group h3 { margin: 0 0 8px; font: 600 15px/1.3 "Inter", "Noto Sans Tamil", sans-serif; color: var(--ink-2); display: flex; gap: 8px; align-items: baseline; }
.paper-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.paper-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--pyq); border-radius: 12px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.paper-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--line-2); border-left-color: var(--pyq); }
.paper-card .code { font: 600 14.5px/1.3 "Inter", sans-serif; letter-spacing: .2px; }
.paper-card .meta { color: var(--muted); font-size: 12.5px; }
.src.pyq { color: var(--pyq); font-weight: 600; }
.key-note { color: var(--warn); }

/* ---------- question assistant (chat) ---------- */
.btn.ask { border-color: color-mix(in srgb, var(--brand-2) 45%, var(--line-2)); color: var(--brand-2); background: var(--brand-soft); }
.btn.ask:hover { background: var(--brand-2); color: #fff; }
.chat { position: fixed; z-index: 60; right: 18px; bottom: 18px; width: min(420px, calc(100vw - 36px)); height: min(680px, calc(100vh - var(--top) - 36px));
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden;
  box-shadow: 0 18px 50px -12px rgba(15, 27, 45, .35), 0 2px 6px rgba(15, 27, 45, .08); animation: chatIn .2s ease-out; }
.chat[hidden] { display: none; }
@keyframes chatIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.chat-h { display: flex; gap: 10px; align-items: center; padding: 12px 12px 12px 14px; background: var(--brand); color: #fff; }
.bot-ava { width: 34px; height: 34px; flex: none; border-radius: 50%; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 18px; }
.chat-ti { min-width: 0; flex: 1; }
.chat-ti b { display: block; font-size: 15px; }
.chat-ti small { display: block; opacity: .75; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-x { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 15px; flex: none; }
.chat-x:hover { background: rgba(255,255,255,.25); }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); scrollbar-width: thin; }
.cb { max-width: 92%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.55; word-wrap: break-word; animation: chatIn .18s ease-out; }
.cb p { margin: 0 0 6px; } .cb p:last-child { margin-bottom: 0; }
.cb.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.cb.me { align-self: flex-end; background: var(--brand-2); color: #fff; border-bottom-right-radius: 4px; }
.cb .kural-box { margin: 6px 0; }
.cb-ok { color: var(--ok); font-weight: 600; } .cb-bad { color: var(--bad); font-weight: 600; }
.cb-sec { margin-top: 8px; }
.cb-t { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.cb-hit { display: block; text-decoration: none; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; margin-top: 5px; font-size: 13px; }
.cb-hit:hover { border-color: var(--brand-2); }
.cb-hit b { display: block; color: var(--ok); font-weight: 600; margin-top: 2px; }
.cb-hit small { display: block; color: var(--muted); font-size: 11.5px; }
.cb-note { background: var(--warn-soft); border-radius: 10px; padding: 7px 10px; margin-top: 5px; font-size: 13px; color: var(--ink-2); }
.cb.typing { display: flex; gap: 4px; padding: 12px 14px; }
.cb.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: dot 1s infinite ease-in-out; }
.cb.typing span:nth-child(2) { animation-delay: .15s; } .cb.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-chips { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; border-top: 1px solid var(--line); background: var(--panel); scrollbar-width: none; }
.chat-chips .chip { white-space: nowrap; flex: none; }
.chat-in { display: flex; gap: 8px; padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--panel); }
.chat-in input { flex: 1; min-width: 0; border: 1px solid var(--line-2); border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 14px; background: var(--bg); color: var(--ink); }
.chat-in input:focus { outline: none; border-color: var(--brand-2); }
.chat-in .btn { border-radius: 50%; width: 40px; height: 40px; padding: 0; font-size: 16px; }
@media (max-width: 700px) {
  .chat { left: 0; right: 0; bottom: 0; width: 100%; height: 82vh; height: 82dvh; border-radius: 18px 18px 0 0; border-bottom: 0; }
  body.chat-open { overflow: hidden; }
  .chat-in input { font-size: 16px; }
  .q-actions .spacer { display: none; }
  .q-actions .btn.ask { flex: 0 0 auto; }
}
@media print { .chat, .btn.ask { display: none !important; } }
.cb-code { margin: 4px 0; padding-left: 4px; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 2px 10px; }
.cb-pairs { margin: 4px 0; padding-left: 0; list-style: none; display: grid; gap: 5px; }
.cb-pairs li { background: var(--bg); border-radius: 8px; padding: 5px 8px; font-size: 13px; }

/* ---------- mock test ---------- */
.mock-card { display: flex; gap: 14px; align-items: flex-start; text-align: left; border: 1.5px solid var(--line-2); background: var(--panel); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .1s; }
.mock-card:hover { border-color: var(--brand-2); }
.mock-card:active { transform: translateY(1px); }
.mock-card b { display: block; font-size: 16px; }
.mock-card .muted, .mock-card .small { display: block; margin-top: 2px; }
.mc-ic { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; font: 700 20px "Noto Serif Tamil", serif; }
.panel.resume { border-left: 4px solid var(--accent); margin-bottom: 8px; }
.panel.resume .row { margin-top: 10px; }
.paper-sel { flex: 1; min-width: 0; max-width: 100%; padding: 8px 10px; font-size: 14px; }
.mock-run { margin: -8px 0 0; }
.mock-bar { position: sticky; top: var(--top); z-index: 20; display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.mb-ti { flex: 1; min-width: 0; }
.mb-ti b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-ti .muted { font-size: 12.5px; }
.timer { font: 700 18px "Inter", sans-serif; font-variant-numeric: tabular-nums; padding: 4px 10px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-2); white-space: nowrap; }
.timer.low { background: var(--bad-soft); color: var(--bad); animation: dot 1s infinite; }
.mock-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.mock-q { margin-bottom: 12px; }
.opt.sel { border-color: var(--brand-2); background: var(--brand-soft); }
.opt.sel .k { background: var(--brand-2); color: #fff; }
.mock-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kbd-hint { margin-top: 10px; }
.mock-pal { position: sticky; top: calc(var(--top) + 76px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; max-height: calc(100vh - var(--top) - 96px); overflow-y: auto; }
.pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 5px; }
.pal-sec { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 6px; }
.pal { height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); font-size: 12.5px; font-variant-numeric: tabular-nums; padding: 0; }
.pal.seen { background: var(--chip); }
.pal.ans { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 700; }
.pal.mark { box-shadow: inset 0 -3px 0 var(--accent); }
.pal.cur { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.pal-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.pal-legend span { display: inline-flex; gap: 5px; align-items: center; }
.pal-legend i.pal { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.pal-toggle { display: none; }
.score-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.score-hero .kpis { flex: 1; margin: 0; }
.ring { --p: 0; width: 130px; height: 130px; flex: none; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--panel) 78%, transparent 79%), conic-gradient(var(--ok) calc(var(--p) * 1%), var(--line) 0); }
.ring b { font: 700 28px "Inter", sans-serif; display: block; }
.ring span { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) {
  .kbd-hint { display: none; }
  .mock-body { grid-template-columns: 1fr; }
  .pal-toggle { display: inline-flex; }
  .mock-pal { display: none; position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 55; max-height: 60vh; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
  .mock-pal.open { display: block; }
}
@media (max-width: 600px) {
  .mock-bar { flex-wrap: wrap; padding: 8px 10px; }
  .mb-ti { flex-basis: 100%; }
  .mock-nav .btn { flex: 1 1 auto; }
  .ring { width: 110px; height: 110px; }
}

/* ---------- sign-in, user menu ---------- */
body.locked .sidebar, body.locked .search, body.locked .tools, body.locked #navToggle { display: none; }
body.locked .layout { grid-template-columns: 1fr; }
.login-wrap { min-height: calc(100vh - var(--top) - 120px); display: grid; place-items: center; }
.login-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px; box-shadow: var(--shadow); display: grid; gap: 12px; text-align: center; }
.login-card h1 { font: 700 22px "Noto Serif Tamil", serif; margin: 4px 0 0; }
.login-card p { margin: 0; }
.logo.big { width: 56px; height: 56px; font-size: 26px; margin: 0 auto; color: #fff; }
.login-card label, .form label { display: grid; gap: 4px; text-align: left; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.login-card input, .form input[type=password], .form input[type=text], .form input:not([type]) { font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--ink); }
.login-card input:focus, .form input:focus { outline: none; border-color: var(--brand-2); }
.login-err { color: var(--bad); min-height: 1.2em; font-size: 13.5px; }
.form { display: grid; gap: 12px; max-width: 460px; margin-top: 14px; }
.form h3 { margin: 0; }
.form label.inline { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.narrow { max-width: 760px; }
.user-wrap { position: relative; }
.user-btn { display: inline-flex; gap: 7px; align-items: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 999px; padding: 3px 10px 3px 3px; font-size: 13px; }
.user-btn .av { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-weight: 700; }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; min-width: 230px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow), 0 12px 30px rgba(0,0,0,.18); padding: 6px; }
.user-menu[hidden] { display: none; }
.user-menu a, .user-menu button { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); background: none; border: 0; font-size: 14px; }
.user-menu a:hover, .user-menu button:hover { background: var(--chip); }
.um-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; }
.um-head .muted { font-size: 12px; }

/* ---------- bookmarks ---------- */
.bm-btn { background: none; border: 1px solid var(--line-2); border-radius: 8px; width: 32px; height: 28px; padding: 0; font-size: 14px; filter: grayscale(1); opacity: .65; }
.bm-btn:hover { opacity: 1; filter: none; border-color: var(--brand-2); }
.bm-btn.on { filter: none; opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.bm-show { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); border-left: 3px solid var(--accent); font-size: 14px; }
.bm-show.tag-rev { background: var(--brand-soft); border-left-color: var(--brand-2); }
.bm-show.tag-doubt { background: var(--warn-soft); border-left-color: var(--warn); }
.bm-show span { flex: 1 1 200px; white-space: pre-wrap; }
.linkish { background: none; border: 0; color: var(--brand-2); padding: 0; font-size: 13px; text-decoration: underline; }
.bm-edit { margin-top: 10px; display: grid; gap: 8px; padding: 10px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--panel); }
.bm-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.bm-note { font: inherit; font-size: 15px; min-height: 64px; resize: vertical; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--ink); }
.chip.t2 { text-decoration: none; background: var(--brand-soft); border-color: transparent; color: var(--brand-2); }
@media print { .bm-btn, .bm-edit, .user-wrap { display: none !important; } }
.nav-top { display: block; padding: 3px 10px 3px 48px; font-size: 12px; color: var(--muted); text-decoration: none; border-radius: 8px; line-height: 1.4; position: relative; }
.nav-top::before { content: "◇"; position: absolute; left: 36px; font-size: 9px; top: 6px; }
.nav-top.on, .nav-top:hover { color: var(--ink); background: var(--chip); }
.topic-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -2px 0 14px; }
.topic-chips .chip { text-decoration: none; }
.topic-chips .chip.on { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.topic-chips .chip.on b { color: rgba(255,255,255,.85); }
