/* Paper Tayyari — one small stylesheet, no web fonts, no icon fonts, no images. */
:root {
  --bg: #f6f7fb; --card: #ffffff; --ink: #161827; --muted: #5b6072; --line: #e2e4ee; --line2: #d3d6e3;
  --accent: #4338ca; --accent-2: #5b51e8; --accent-ink: #ffffff; --soft: #eef0ff; --soft-2: #e0e3ff;
  --ok: #137a3a; --ok-bg: #e3f5e9; --bad: #b42318; --bad-bg: #fdeceb; --star: #9a5800; --star-bg: #fff3dc;
  --shadow: 0 1px 2px rgba(22, 24, 39, .05), 0 1px 3px rgba(22, 24, 39, .04);
  --r: 14px; --r-s: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1017; --card: #181a24; --ink: #eceef5; --muted: #a2a7b8; --line: #2a2d3b; --line2: #363a4b;
    --accent: #9a94ff; --accent-2: #b0abff; --accent-ink: #0f1017; --soft: #23244a; --soft-2: #2d2f5e;
    --ok: #6fd68f; --ok-bg: #15301f; --bad: #ff8a80; --bad-bg: #371b1a; --star: #ffc56b; --star-bg: #352811;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1017; --card: #181a24; --ink: #eceef5; --muted: #a2a7b8; --line: #2a2d3b; --line2: #363a4b;
  --accent: #9a94ff; --accent-2: #b0abff; --accent-ink: #0f1017; --soft: #23244a; --soft-2: #2d2f5e;
  --ok: #6fd68f; --ok-bg: #15301f; --bad: #ff8a80; --bad-bg: #371b1a; --star: #ffc56b; --star-bg: #352811;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button { -webkit-tap-highlight-color: transparent; }
/* Language: every text exists in English and Roman Urdu; show the chosen one */
:root[data-lang="ur"] .i-en, :root:not([data-lang="ur"]) .i-ur { display: none; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--card);
  border-bottom: 1px solid var(--line); padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 750; letter-spacing: -.01em;
  text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand::before { content: "PT"; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.hbtns { display: flex; gap: 6px; }
.theme, .lang { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px;
  min-height: 36px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.theme { width: 36px; padding: 0; font-size: 16px; line-height: 1; }
.theme:hover, .lang:hover { border-color: var(--line2); }

/* ---------- layout ---------- */
.wrap { max-width: 780px; margin: 0 auto; padding: 16px 16px 112px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 32px; }
.flinks { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 10px; }
.flinks a { color: var(--muted); font-weight: 600; text-decoration: none; padding: 6px 0; }
.flinks a:hover { color: var(--accent); }
/* About / Contact / Privacy */
.prose { max-width: 680px; }
.prose h2 { font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 24px 0 6px; }
.prose p, .prose li { line-height: 1.65; }
.prose ul { padding-left: 20px; }
.prose .meta { color: var(--muted); font-size: 14px; }
.mailbox { font-size: 18px; font-weight: 700; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); display: inline-block; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; margin: 8px 0 6px; }
h1 .sub { display: block; font-size: 16px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-top: 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 28px 0 10px; }
.lead { color: var(--muted); margin: 4px 0 12px; }
.counts { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.crumb { margin: 4px 0; }
.crumb a { display: inline-flex; align-items: center; min-height: 32px; text-decoration: none; font-size: 14px; font-weight: 600; }
.empty, .none { color: var(--muted); padding: 16px 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  border: 1px solid var(--line2); background: var(--card); color: var(--ink); padding: 0 18px; border-radius: var(--r-s);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.more { width: 100%; margin-top: 8px; }
.cta { margin: 8px 0 16px; }
@media (max-width: 600px) {
  .cta { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--line); z-index: 15; }
  .cta .btn { display: flex; width: 100%; }
}

/* ---------- home ---------- */
.search { width: 100%; min-height: 48px; padding: 0 16px; border: 1px solid var(--line2); border-radius: var(--r);
  background: var(--card); color: var(--ink); font: inherit; margin: 8px 0 4px; box-shadow: var(--shadow); }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft-2); }
.resume { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; padding: 12px 14px; border-radius: var(--r);
  background: var(--soft); color: var(--ink); text-decoration: none; border: 1px solid var(--soft-2); }
.resume small { display: block; color: var(--muted); font-size: 13px; }
.resume b { font-weight: 650; }
.resume .go { margin-left: auto; color: var(--accent); font-weight: 700; white-space: nowrap; }
.subjects, .lectures { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.subjects { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.subjects a { display: flex; flex-direction: column; gap: 2px; height: 100%; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; color: var(--ink); text-decoration: none;
  box-shadow: var(--shadow); transition: border-color .15s; }
.subjects a:hover { border-color: var(--accent); }
.code { display: inline-block; align-self: flex-start; font-size: 12px; font-weight: 800; letter-spacing: .04em;
  color: var(--accent); background: var(--soft); border-radius: 6px; padding: 2px 8px; }
.subjects .nm { font-weight: 650; line-height: 1.3; margin: 6px 0 2px; }
.subjects .lc { color: var(--muted); font-size: 13px; }

/* ---------- subject page ---------- */
.terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 14px 0; }
.term { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; }
.term h3 { margin: 0; font-size: 18px; }
.term .meta { color: var(--muted); font-size: 14px; }
/* progress + buttons sit at the bottom, so both cards line up whatever the text length */
.term .tf { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.term .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.term .acts .btn { flex: 1 1 120px; }
.prog { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.prog i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 99px; transition: width .3s; }
.progt { font-size: 13px; color: var(--muted); }
.lectures a { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 12px 14px; color: var(--ink); text-decoration: none; }
.lectures a:hover { border-color: var(--accent); }
.lectures .ln { flex: none; display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 9px;
  background: var(--soft); color: var(--accent); font-weight: 800; font-size: 14px; }
.lectures .lt { flex: 1; min-width: 0; line-height: 1.35; }
.lectures .lc { flex: none; color: var(--muted); font-size: 13px; text-align: right; max-width: 45%; }
.lectures li.zero a { opacity: .65; }
.lectures li.zero .ln { background: none; border: 1px dashed var(--line2); color: var(--muted); }
@media (max-width: 600px) {
  .lectures a { flex-wrap: wrap; row-gap: 2px; }
  .lectures .lt { flex-basis: calc(100% - 46px); }
  .lectures .lc { flex-basis: 100%; text-align: left; max-width: none; padding-left: 46px; }
}

/* ---------- notes card ---------- */
.notes { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px; margin: 4px 0 12px; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.notes .pdf { flex: none; font-size: 12px; font-weight: 800; color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: 10px 8px; }
.notes .nt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.notes .nt > span { color: var(--muted); font-size: 14px; }
.notes .go { flex: none; color: var(--accent); font-weight: 700; white-space: nowrap; }

/* ---------- practice page ---------- */
.tabs { position: sticky; top: 53px; z-index: 10; display: flex; gap: 4px; background: var(--bg);
  border-bottom: 1px solid var(--line); margin: 8px -16px 12px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 650; min-height: 44px; padding: 0 12px;
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.tools { display: grid; gap: 10px; margin-bottom: 12px; }
.tools .row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line2); background: var(--card); color: var(--ink); border-radius: 99px;
  min-height: 36px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { opacity: .65; font-weight: 500; }
.switch { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; cursor: pointer; min-height: 36px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
select { min-height: 36px; padding: 0 10px; border-radius: var(--r-s); border: 1px solid var(--line2); background: var(--card);
  color: var(--ink); font: inherit; font-size: 14px; }
.stat { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 8px 12px; font-size: 14px; }
.stat .prog { flex: 1; margin: 0; }
.stat b { font-variant-numeric: tabular-nums; }
.linkbtn { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 4px; }

.mcq, .sq { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow); content-visibility: auto; contain-intrinsic-size: auto 260px; }
.sq { contain-intrinsic-size: auto 140px; }
.mhead { display: flex; gap: 8px; align-items: center; }
.num { font-weight: 750; color: var(--muted); font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--accent); }
.tag.pp { background: var(--star-bg); color: var(--star); }
.tag.muted { background: none; color: var(--muted); border: 1px dashed var(--line); }
.bm { flex: none; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px; }
.bm:hover { background: var(--soft); }
.bm[aria-pressed="true"] { color: var(--star); }
.q { margin: 10px 0; font-weight: 650; line-height: 1.45; }
/* keep line breaks and indentation of code in questions/options (CS subjects) */
.q, .opt, .choice-t span { white-space: pre-wrap; }
.opts { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.opt { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 12px; border-radius: var(--r-s);
  border: 1px solid var(--line2); cursor: pointer; transition: background .12s, border-color .12s; }
.opt:hover { border-color: var(--accent); }
.opt .l { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px;
  background: var(--soft); color: var(--accent); font-weight: 800; font-size: 13px; }
.mcq.done .opt, body.answers .opt { cursor: default; }
.mcq.done .opt:hover, body.answers .opt:hover { border-color: var(--line2); }
.mcq.done .opt.ok, body.answers .opt.ok { background: var(--ok-bg); border-color: var(--ok); }
.mcq.done .opt.ok .l, body.answers .opt.ok .l { background: var(--ok); color: var(--card); }
.mcq.done .opt.no { background: var(--bad-bg); border-color: var(--bad); }
.mcq.done .opt.no .l { background: var(--bad); color: var(--card); }
/* answer verdict: drawn by CSS so it costs no HTML per question */
.mcq.done .opts::after { display: block; margin-top: 2px; font-weight: 700; font-size: 14px; }
.mcq.right .opts::after { content: "✓ Correct"; color: var(--ok); }
.mcq.wrong .opts::after { content: "✗ Wrong. The correct answer is in green."; color: var(--bad); }
:root[data-lang="ur"] .mcq.right .opts::after { content: "✓ Sahi jawab"; }
:root[data-lang="ur"] .mcq.wrong .opts::after { content: "✗ Ghalat. Sahi jawab green mein hai."; }
.expl { display: none; margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.mcq.done .expl, body.answers .expl { display: block; }
details { margin-top: 4px; }
details summary { cursor: pointer; color: var(--accent); font-weight: 650; min-height: 36px; display: flex; align-items: center; }
.ans { white-space: pre-wrap; margin: 6px 0 0; padding: 12px; background: var(--bg); border-radius: var(--r-s); }

/* ---------- mock test ---------- */
.setup b { display: block; margin-top: 4px; }
.setup .opt-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.pill { border: 1px solid var(--line2); background: var(--card); color: var(--ink); border-radius: 99px; min-height: 40px; padding: 0 16px;
  font: inherit; font-weight: 600; cursor: pointer; }
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.bar { position: sticky; top: 53px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin: 0 -16px 12px; padding: 10px 16px; background: var(--bg); font-weight: 650; }
.timer { font-variant-numeric: tabular-nums; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 2px 12px; }
.timer.low { color: var(--bad); border-color: var(--bad); }
.choices-t { display: grid; gap: 8px; margin-top: 12px; }
.choice-t { text-align: left; border: 1px solid var(--line2); background: var(--card); color: var(--ink); min-height: 48px;
  padding: 12px 14px; border-radius: var(--r-s); font: inherit; cursor: pointer; display: flex; align-items: flex-start; gap: 10px; }
.choice-t b { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px;
  background: var(--soft); color: var(--accent); font-size: 13px; }
.choice-t.on { border-color: var(--accent); background: var(--soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-t.on b { background: var(--accent); color: var(--accent-ink); }
.nav-t { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }
.nav-t .btn { flex: 1; padding: 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin-top: 12px; }
.cell { border: 1px solid var(--line2); background: var(--card); color: var(--ink); border-radius: 8px; min-height: 40px; font: inherit; cursor: pointer; }
.cell.done { background: var(--soft); border-color: var(--accent); }
.cell.mark { outline: 2px solid var(--star); }
.cell.cur { font-weight: 800; border-width: 2px; border-color: var(--ink); }
.score { font-size: 36px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; font-size: 13px; color: var(--muted); }
.stats > div { background: var(--bg); border-radius: var(--r-s); padding: 8px 4px; }
.stats b { display: block; font-size: 20px; color: var(--ink); }
.stats .c b { color: var(--ok); } .stats .w b { color: var(--bad); }
.rv .yours { color: var(--bad); } .rv .right { color: var(--ok); }
.rv p { margin: 4px 0; }
.hist { width: 100%; border-collapse: collapse; font-size: 14px; }
.hist td, .hist th { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
