[hidden] { display: none !important; }
:root {
  --bg: #f6f3ee; --surface: #fffdf9; --surface-2: #f0ebe3; --ink: #1b2430; --muted: #5b6675;
  --line: #e4ddd2; --accent: #c2410c; --accent-soft: #fde7da; --ok: #15803d; --bad: #b91c1c;
  --gs1: #7c3aed; --gs2: #0369a1; --gs3: #15803d; --gs4: #b45309; --pre: #be185d;
  --radius: 14px; --shadow: 0 1px 2px rgba(27,36,48,.05), 0 6px 24px rgba(27,36,48,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161c; --surface: #1a2029; --surface-2: #222a35; --ink: #e8e4dc; --muted: #9aa4b2;
    --line: #2c3542; --accent: #fb923c; --accent-soft: #3a2518; --ok: #4ade80; --bad: #f87171;
    --gs1: #a78bfa; --gs2: #38bdf8; --gs3: #4ade80; --gs4: #fbbf24; --pre: #f472b6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 24px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 Inter, system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; letter-spacing: -.01em; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 16px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 24px; background: var(--surface); }
.brand { display: flex; gap: 10px; align-items: center; }
.brand b { display: block; font-family: Fraunces, serif; font-size: 18px; }
.brand small { color: var(--muted); font-size: 12px; }
.logo { width: 40px; height: 40px; border-radius: 10px; display: block; }
.logo.sm { width: 30px; height: 30px; border-radius: 8px; display: none; }
.logo.lg { width: 64px; height: 64px; border-radius: 16px; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--ink); font-weight: 500; }
nav a i { font-style: normal; width: 18px; text-align: center; color: var(--muted); }
nav a:hover { background: var(--surface-2); text-decoration: none; }
nav a.active { background: var(--accent-soft); color: var(--accent); }
nav a.active i { color: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }

main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 32px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.crumb { font-weight: 600; color: var(--muted); }
.crumb-wrap { display: flex; gap: 10px; align-items: center; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.view { padding: 28px 32px 60px; max-width: 1180px; }

.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px;
  padding: 8px 14px; font: 500 14px Inter, sans-serif; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.icon { padding: 7px 10px; position: relative; }
.btn:disabled { opacity: .55; cursor: default; }
.badge { position: absolute; top: -4px; right: -4px; background: var(--accent); color: #fff; border-radius: 99px;
  font-size: 11px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; }
.bell-wrap { position: relative; }
.panel { position: absolute; right: 0; top: 44px; width: 340px; max-height: 420px; overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.panel .n { padding: 10px; border-radius: 10px; display: block; color: var(--ink); }
.panel .n:hover { background: var(--surface-2); text-decoration: none; }
.panel .n.unread { background: var(--accent-soft); }
.panel .n b { display: block; font-size: 14px; }
.panel .n span { font-size: 13px; color: var(--muted); }

.hero { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.hero h1 { font-size: 32px; }
.hero p { margin: 6px 0 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; margin: 18px 0 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { font: 700 24px Fraunces, serif; display: block; }
.stat span { color: var(--muted); font-size: 13px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: 13px;
  cursor: pointer; color: var(--ink); font-family: Inter, sans-serif; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.input { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 12px;
  font: 14px Inter, sans-serif; min-width: 0; }
.input:focus, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.cards { display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h3 { font-size: 18px; line-height: 1.35; margin: 6px 0 8px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.tag { border-radius: 6px; padding: 2px 8px; font-weight: 600; font-size: 11.5px; border: 1px solid currentColor; }
.tag.GS1 { color: var(--gs1); } .tag.GS2 { color: var(--gs2); } .tag.GS3 { color: var(--gs3); }
.tag.GS4 { color: var(--gs4); } .tag.Prelims { color: var(--pre); }
.tag.src { color: var(--muted); }
.tag.stage { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.tag.ai { color: var(--accent); }
.card ul { margin: 6px 0 0; padding-left: 18px; }
.card li { margin: 2px 0; }
.sect { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.box { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.box .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.box ul { padding-left: 16px; margin: 0; }
.q { font-style: italic; }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; gap: 10px; flex-wrap: wrap; }

.empty { text-align: center; padding: 60px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h2 { margin-bottom: 8px; }

.months { display: grid; gap: 22px; }
.month h2 { font-size: 20px; margin-bottom: 10px; }
.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.day b { font-family: Fraunces, serif; font-size: 17px; }
.day .row { display: flex; gap: 6px; }
.day .row .btn { padding: 5px 10px; font-size: 13px; }

.quiz-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.qcard { display: flex; flex-direction: column; gap: 8px; }
.question { margin-bottom: 18px; }
.question .qt { font-weight: 600; white-space: pre-line; margin-bottom: 10px; }
.opt { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; font: 14px Inter, sans-serif; }
.opt:hover { border-color: var(--accent); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.explain { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.score { font: 700 40px Fraunces, serif; color: var(--accent); }

.form { display: grid; gap: 16px; max-width: 640px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.form label span { font-weight: 400; color: var(--muted); font-size: 13px; }
.radio { display: flex; gap: 8px; flex-wrap: wrap; }
.note { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 20; font-size: 14px; }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ---------- importance & sections ---------- */
.imp { border-radius: 99px; padding: 2px 10px; font-weight: 700; font-size: 11.5px; letter-spacing: .02em; }
.imp.High { background: var(--accent); color: #fff; }
.imp.Medium { background: var(--accent-soft); color: var(--accent); }
.imp.Low { background: var(--surface-2); color: var(--muted); }
.card.imp-High { border-left: 4px solid var(--accent); }
.stat.hi b { color: var(--accent); }
.mark { margin-left: auto; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 6px; min-width: 40px; min-height: 36px; }
.mark.on { color: #d97706; }
details { margin-top: 10px; }
details summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); padding: 6px 0; list-style: none; }
details summary::before { content: "▸ "; }
details[open] summary::before { content: "▾ "; }
.toc { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: thin; }
.toc-i { flex: none; display: inline-flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px; color: var(--ink); font-size: 14px; white-space: nowrap; }
.toc-i:hover { text-decoration: none; border-color: var(--accent); }
.toc-i b { color: var(--muted); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot.GS1 { background: var(--gs1); } .dot.GS2 { background: var(--gs2); } .dot.GS3 { background: var(--gs3); }
.dot.GS4 { background: var(--gs4); } .dot.Prelims { background: var(--pre); }
.subject { margin: 26px 0 8px; scroll-margin-top: 80px; }
.subject-h { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.subject-h h2 { font-size: 22px; }
.hero-actions, .row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.sep { width: 8px; }
.filters .input[type=search] { flex: 1; min-width: 200px; }
.h2s { margin: 28px 0 10px; }
.submit-bar { z-index: 4; display: flex; gap: 12px; align-items: center; position: sticky; bottom: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.who { font-weight: 600; font-size: 14px; color: var(--ink); padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.who:empty { display: none; }
.lbl-sm { white-space: pre; }

/* ---------- auth ---------- */
.auth { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: grid; place-items: center; padding: 20px; overflow: auto; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 32px 28px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.auth-card h1 { font-size: 28px; }
.auth-card p { margin: 0; }
.auth-card label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.auth-card .input { font-size: 16px; padding: 12px 14px; }
.btn.big { justify-content: center; padding: 12px; font-size: 16px; }
.err { color: var(--bad); font-size: 14px; min-height: 1em; }
body.signed-out .shell { display: none; }

/* ---------- touch / tablet ---------- */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 10px 16px; }
  .chip { min-height: 38px; padding: 7px 14px; }
  .opt { padding: 14px 16px; font-size: 15px; }
  nav a { padding: 12px 14px; }
  .input { min-height: 44px; font-size: 16px; }
}
/* Galaxy Tab landscape (~1280 px): sidebar stays. Portrait (~800 px) and phones: bottom tab bar. */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; z-index: 10; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line); flex-direction: row; }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 12px; padding: 6px 8px; min-width: 64px; text-align: center; }
  .nav a i { font-size: 18px; width: auto; }
  .logo.sm { display: block; }
  .crumb-wrap { display: flex; gap: 10px; align-items: center; }
  .crumb { font-family: Fraunces, serif; font-size: 18px; color: var(--ink); }
  .view { padding: 22px 22px 110px; }
  .top { padding: 10px 22px; }
  .hero h1 { font-size: 28px; }
  .submit-bar { bottom: 84px; }
  .toast { bottom: 96px; }
}
@media (max-width: 640px) {
  .lbl-sm { display: none; }
  .view, .top { padding-left: 16px; padding-right: 16px; }
  .nav a span { font-size: 11px; }
  .nav a { min-width: 0; padding: 6px 4px; }
  .panel { width: calc(100vw - 32px); right: -60px; }
  .hero h1 { font-size: 24px; }
  .sect { grid-template-columns: 1fr; }
}

/* ---------- sources & brief rows ---------- */
.title-link { color: var(--ink); }
.title-link:hover { color: var(--accent); }
.source { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: space-between; align-items: center; margin-top: 12px;
  padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; }
.source a { font-weight: 600; }
.also { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.also .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); }
.also ul { list-style: none; margin: 6px 0 0; padding: 0; }
.brief { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.brief:first-child { border-top: 0; }
.brief a { color: var(--ink); font-weight: 500; }
.brief .mark { font-size: 18px; min-height: 30px; }
.lanlinks { display: flex; flex-wrap: wrap; gap: 10px; }
.lan { font: 600 20px Inter, sans-serif; background: var(--accent-soft); padding: 8px 14px; border-radius: 10px; }

/* ---------- app feel ---------- */
.install-banner { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 15; width: min(620px, calc(100vw - 32px));
  display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.install-banner img { width: 44px; height: 44px; border-radius: 10px; }
.install-banner div { flex: 1; display: grid; }
.install-banner span { font-size: 13px; color: var(--muted); }
.install-banner .x { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 6px; }
@media (min-width: 1101px) { .install-banner { bottom: 24px; } }
@media (display-mode: standalone) {
  .top { padding-top: calc(10px + env(safe-area-inset-top)); }
  #installBtn, .install-banner { display: none !important; }
}
html { -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: contain; }

.upd { position: relative; }
.upd.has-update { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.upd-dot { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

/* =================== v2 visual design: tiles, figures, learning cards =================== */
:root { --gs1-bg: #f3edff; --gs2-bg: #e6f3fb; --gs3-bg: #e8f6ec; --gs4-bg: #fdf3e2; --pre-bg: #fde9f2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --gs1-bg: #2a2340; --gs2-bg: #15303f; --gs3-bg: #183223; --gs4-bg: #3a2e17; --pre-bg: #3a1c2b; } }
.p-GS1 { --pc: var(--gs1); --pbg: var(--gs1-bg); } .p-GS2 { --pc: var(--gs2); --pbg: var(--gs2-bg); }
.p-GS3 { --pc: var(--gs3); --pbg: var(--gs3-bg); } .p-GS4 { --pc: var(--gs4); --pbg: var(--gs4-bg); }
.p-Prelims { --pc: var(--pre); --pbg: var(--pre-bg); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

/* glance header */
.glance { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: stretch; }
.glance-text { display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.glance-text .hero-actions { margin-top: 10px; }
.glance-figs { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding: 16px 18px; }
.fig { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.donut { width: 132px; height: 132px; }
.d-big { font: 700 26px Fraunces, serif; fill: var(--ink); } .d-small { font: 500 11px Inter, sans-serif; fill: var(--muted); }
.fig-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; font-size: 12px; color: var(--muted); max-width: 170px; }
.fig-legend b { color: var(--ink); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.High, .seg.High { background: var(--accent); } .sw.Medium, .seg.Medium { background: #f59e0b; } .sw.Low, .seg.Low { background: var(--line); }
.fig-imp .lbl { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.impbar { display: flex; gap: 3px; height: 16px; border-radius: 99px; overflow: hidden; }
.implegend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 13px; }
.implegend em { color: var(--muted); font-style: normal; font-size: 12px; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.mini-stats span { background: var(--surface-2); border-radius: 10px; padding: 6px 10px; font-size: 13px; }

/* section headings */
.row-h { font-size: 20px; margin: 26px 0 12px; }

/* must-read strip: square tiles */
.must { display: grid; grid-auto-flow: column; grid-auto-columns: 200px; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.must-tile { scroll-snap-align: start; aspect-ratio: 1 / 1; border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 6px;
  background: var(--pbg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--pc) 25%, transparent); position: relative; overflow: hidden; }
.must-tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.must-tile .mt-icon { font-size: 26px; }
.must-tile .mt-sub { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--pc); }
.must-tile b { font: 600 15px/1.3 Fraunces, serif; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.must-tile .mt-src { margin-top: auto; font-size: 12px; color: var(--muted); }

/* subject tiles (square) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.tile { aspect-ratio: 1 / 1; border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
  background: var(--pbg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--pc) 22%, transparent); transition: transform .15s, box-shadow .15s; }
.tile::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--pc); opacity: .10; }
.tile:hover, .tile:active { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow); }
.t-icon { font-size: 34px; line-height: 1; }
.t-paper { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 700; color: #fff; background: var(--pc); border-radius: 99px; padding: 2px 9px; }
.t-name { font: 700 18px/1.2 Fraunces, serif; margin-top: 10px; }
.t-count { font-size: 13px; color: var(--muted); } .t-count b { color: var(--ink); font-size: 16px; }
.t-hot { align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--surface); border-radius: 99px; padding: 2px 8px; }
.t-peek { margin-top: auto; font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; position: relative; z-index: 1; }

/* subject page */
.subj-hero { background: var(--pbg); border-radius: 22px; padding: 18px 22px 20px; margin-bottom: 18px; border: 1px solid color-mix(in srgb, var(--pc) 22%, transparent); }
.subj-hero .back { font-weight: 600; font-size: 14px; color: var(--pc); }
.sh-row { display: flex; gap: 16px; align-items: center; margin-top: 8px; }
.sh-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--surface); display: grid; place-items: center; font-size: 34px; flex: none; }
.subj-hero .eyebrow { color: var(--pc); } .subj-hero h1 { font-size: 28px; } .subj-hero p { margin: 4px 0 0; color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* learning card */
.ncard h3 { font-size: 19px; }
.keypoint { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; font-size: 15.5px; line-height: 1.5; margin: 6px 0 4px; }
.keypoint span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; margin-top: 12px; }
.tile-box { border-radius: 14px; padding: 12px 14px; font-size: 14px; background: var(--surface-2); }
.tile-box .lbl { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.tile-box ul { margin: 0; padding-left: 18px; } .tile-box p { margin: 0; }
.tile-box.static { background: var(--gs2-bg); grid-column: 1 / -1; } .tile-box.static .lbl { color: var(--gs2); }
.tile-box.pre .lbl { color: var(--pre); } .tile-box.mains .lbl { color: var(--gs3); } .tile-box.q .lbl { color: var(--gs4); }
.upsc { margin-top: 6px; font-size: 13px; font-weight: 600; }

@media (max-width: 860px) {
  .glance { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .glance-figs { grid-template-columns: 1fr; justify-items: center; }
  .t-name { font-size: 16px; } .t-icon { font-size: 28px; } .tile { padding: 12px; border-radius: 16px; }
  .must { grid-auto-columns: 160px; }
}

/* ---------- My documents ---------- */
.dropzone { display: flex; align-items: center; gap: 16px; cursor: pointer; border: 2px dashed var(--accent); background: var(--accent-soft); box-shadow: none; padding: 22px; }
.dropzone:hover { filter: brightness(1.02); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.dropzone > div:last-child { display: flex; flex-direction: column; gap: 2px; }
.dz-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 24px; flex: none; }
.reader-line { margin: 10px 2px 0; }
.dz-status { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.dz-status.err { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--bad); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.doc-tile { aspect-ratio: 1 / 1; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); color: var(--ink); overflow: hidden; }
.doc-tile:hover { text-decoration: none; border-color: var(--accent); }
.doc-tile b { font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.doc-ico { font-size: 30px; }
.doc-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 5px; }
.doc-meta span { font-size: 11px; font-weight: 600; background: var(--surface-2); border-radius: 99px; padding: 3px 8px; }
.doc-hero h1 { font-size: 26px; margin: 8px 0 4px; }
.doc-hero .row-btns { margin: 10px 0 0; }
.doc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0 12px; }
.doc-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.doc-stats b { display: block; font-size: 24px; color: var(--accent); }
.doc-stats span { font-size: 12px; color: var(--muted); }
.doc-jump { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; background: var(--bg); margin-bottom: 8px; }
.doc-jump a { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 13px; font-size: 13px; color: var(--ink); }
.doc-sec { margin-bottom: 18px; scroll-margin-top: 60px; }
.doc-sec h2 { margin-top: 0; }
.doc-summary { font-size: 16px; line-height: 1.7; margin: 0; }
.kp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.kp { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.kp.hi { border-left-color: var(--accent); }
.paper-tag { align-self: flex-start; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 7px; }
.doc-sec details summary { cursor: pointer; color: var(--accent); margin-top: 6px; }
@media (max-width: 560px) { .doc-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .doc-stats { grid-template-columns: repeat(2, 1fr); } .doc-tile { padding: 12px; } }

/* ---------- Why it matters ---------- */
.tile-box.why { grid-column: 1 / -1; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.tile-box.why .lbl { color: var(--accent); }
.why-lead { font-weight: 600; margin: 2px 0 8px !important; }
.angles { display: grid; gap: 8px; }
.angle { display: grid; grid-template-columns: 190px 1fr; gap: 10px; align-items: start; }
.angle .dim { font-size: 12px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; justify-self: start; }
@media (max-width: 640px) { .angle { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- Weekly report ---------- */
.week-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin: 4px 0 8px; }
.week-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); color: var(--ink);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.week-banner:hover { text-decoration: none; border-color: var(--accent); }
.week-banner > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.wb-ico { font-size: 28px; } .wb-go { color: var(--accent); font-weight: 700; font-size: 14px; white-space: nowrap; }
.dimbars { display: grid; gap: 7px; margin-top: 8px; }
.dimbar { display: grid; grid-template-columns: 170px 1fr 28px; align-items: center; gap: 8px; font-size: 13px; }
.dimbar i { height: 10px; border-radius: 99px; background: var(--accent); display: block; min-width: 6px; }
.dimbar b { text-align: right; }
.week-brief { margin-bottom: 18px; } .week-brief h2 { margin-top: 0; }
.wk-subj { margin-bottom: 12px; } .wk-subj h3 { margin: 0 0 6px; }
.wk-item { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.wk-item p { margin: 2px 0 0; font-size: 14px; }
.wk-why { display: flex; flex-direction: column; gap: 3px; font-size: 13px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; margin-top: 4px; }
@media (max-width: 640px) { .dimbar { grid-template-columns: 130px 1fr 24px; } }
.dz-status.ready { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 16px; }
.ready-file { display: flex; gap: 12px; align-items: center; }
.ready-file > span:last-child { display: flex; flex-direction: column; }
.btn.big { padding: 11px 22px; font-size: 16px; font-weight: 700; }
.rel-card h2 { display: flex; align-items: center; gap: 10px; }
.rel-card .tile-box.why { margin-top: 10px; }

/* ---------- Quiz answer review ---------- */
.review { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 6px; font-size: 14px; }
.rv-head { font-weight: 700; } .rv-head.ok { color: var(--ok); } .rv-head.bad { color: var(--bad); }
.rv-ans { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-radius: 10px; padding: 8px 12px; }
.rv-exp { color: var(--ink); }
.rv-ref { display: grid; gap: 4px; } .rv-ref .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rv-src { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border-radius: 10px; padding: 8px 12px; color: var(--ink); }
.rv-src:hover { text-decoration: none; outline: 1px solid var(--accent); }
.rv-src > span { display: flex; flex-direction: column; }
.rv-quote { font-style: italic; color: var(--muted); }
.question.missed { border-left: 4px solid var(--bad); } .question.got { border-left: 4px solid var(--ok); }
.doc-score { display: flex; gap: 10px; align-items: center; margin: 4px 0 12px; flex-wrap: wrap; }
.from-docs { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.saved-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 18px 0 6px; }
.saved-head h2 { margin: 0; flex: 1 0 auto; }
.saved-head .input { width: 260px; max-width: 100%; }
.date-group { margin: 16px 0 10px; font-size: 16px; display: flex; gap: 8px; align-items: baseline; }
.up-date { font-size: 12px; font-weight: 600; color: var(--accent); }
@media (max-width: 560px) { .saved-head .input { width: 100%; } }

/* ---------- Theme switch: the top-bar toggle sets data-theme on <html> ---------- */
:root[data-theme="dark"] {
    --bg: #12161c; --surface: #1a2029; --surface-2: #222a35; --ink: #e8e4dc; --muted: #9aa4b2;
    --line: #2c3542; --accent: #fb923c; --accent-soft: #3a2518; --ok: #4ade80; --bad: #f87171;
    --gs1: #a78bfa; --gs2: #38bdf8; --gs3: #4ade80; --gs4: #fbbf24; --pre: #f472b6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 24px rgba(0,0,0,.25);
  }
:root[data-theme="dark"] {
  --gs1-bg: #2a2340; --gs2-bg: #15303f; --gs3-bg: #183223; --gs4-bg: #3a2e17; --pre-bg: #3a1c2b; }
:root[data-theme="dark"] { color-scheme: dark; } :root[data-theme="light"] { color-scheme: light; }
.theme-btn { font-size: 16px; padding: 7px 10px; }

/* ---------- Document reader ---------- */
.to-read { background: var(--accent-soft) !important; color: var(--accent); }
.reader-bar { position: sticky; top: 0; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.rb-title { display: flex; flex-direction: column; flex: 1 1 200px; min-width: 0; }
.rb-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader { display: flex; flex-direction: column; align-items: center; gap: 14px; overflow-x: auto; }
.pdf-page { position: relative; background: #fff; box-shadow: var(--shadow); border-radius: 4px; max-width: none; }
.pdf-page canvas { display: block; border-radius: 4px; }
.pg-no { position: absolute; top: 8px; left: 8px; opacity: .75; background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 2px 7px; z-index: 1; }
.reader-img { max-width: 100%; border-radius: 8px; box-shadow: var(--shadow); }
.reader-doc, .reader-text { width: 100%; max-width: 820px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; line-height: 1.7; font-size: 16px; }
.reader-text { white-space: pre-wrap; font-family: inherit; }
.reader-doc img { max-width: 100%; }
.prog { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.prog-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.prog-bar i { display: block; height: 100%; width: 35%; border-radius: 99px; background: var(--accent); animation: prog 1.4s ease-in-out infinite; }
@keyframes prog { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.doc-hero .dz-status { margin-top: 12px; }

/* =================== v3 public website: account, Premium, ads, footer, policies =================== */
.who { display: inline-flex; gap: 8px; align-items: center; padding: 4px 8px; text-decoration: none !important; }
.who img, .who .av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.av { display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; border-radius: 50%; }
.av.lg, .acct-row img { width: 52px; height: 52px; font-size: 22px; border-radius: 50%; }
.who:has(.btn) { background: none; padding: 0; }
.btn.sm { padding: 6px 12px; font-size: 13px; min-height: 0; }
.pro { font: 700 10px Inter, sans-serif; letter-spacing: .06em; background: var(--accent); color: #fff; border-radius: 6px; padding: 2px 6px; }
nav a.locked span::after { content: " 🔒"; font-size: .8em; }
@media (max-width: 1100px) { .nav-acct { display: none !important; } }

.login-sheet { position: fixed; inset: 0; z-index: 40; background: rgba(15, 20, 28, .55); display: grid; place-items: center; padding: 16px; overflow: auto; }
.login-card { position: relative; width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 28px 24px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.login-card h2 { font-size: 26px; }
.login-card form { display: grid; gap: 12px; }
.login-card label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.login-card .input { font-size: 16px; padding: 12px 14px; }
.login-card .x { position: absolute; top: 10px; right: 10px; border: 0; background: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 8px; }
.login-card p { margin: 0; }
.btn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; gap: 10px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
#loginMsg.ok { color: var(--ok); }

.hero.premium { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border: 1px solid var(--line); border-radius: 20px; padding: 26px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.perks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.perk { display: grid; gap: 6px; padding: 16px; }
.perk-i { font-size: 22px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 10px; }
.plan { display: grid; gap: 8px; padding: 18px; }
.plan-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.plan-h b { font-size: 17px; }
.price { font: 700 26px Fraunces, serif; color: var(--accent); }
.price s { font-size: 16px; color: var(--muted); font-weight: 500; margin-right: 6px; }
.coupon { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 14px; }
.coupon .input { width: 180px; text-transform: uppercase; }
.coupon-msg { font-size: 13px; }
.coupon-msg.ok { color: var(--ok); } .coupon-msg.bad { color: var(--bad); }
.acct { gap: 14px; }
.acct-row { display: flex; gap: 14px; align-items: center; }
.acct-row div { display: grid; }
.plan-status { padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-size: 15px; }
.plan-status.on { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.free-strip { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0 0 18px; padding: 12px 16px;
  border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.free-strip span { font-size: 14px; }

.ad-slot { margin: 18px 0; display: grid; gap: 4px; min-height: 90px; }
.ad-lbl { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ad-ph { display: grid; place-items: center; min-height: 100px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 13px; }

.site-foot { display: flex; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; padding: 18px 32px 28px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px; max-width: 1180px; }
.site-foot .foot-links { display: flex; flex-direction: row; gap: 4px 16px; flex-wrap: wrap; }
.side-legal a { color: var(--muted); }
@media (max-width: 1100px) { .view { padding-bottom: 24px; } .site-foot { padding: 16px 22px 110px; } }
@media (max-width: 640px) { .site-foot { padding-left: 16px; padding-right: 16px; } }
.legal { max-width: 820px; padding: 26px 28px; line-height: 1.65; }
.legal h1 { font-size: 30px; margin-bottom: 4px; }
.legal h2 { font-size: 19px; margin: 22px 0 6px; }
.legal ul { padding-left: 20px; }
.legal-links { margin-top: 18px; }
.help-fab { position: fixed; right: 18px; bottom: 24px; z-index: 12; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow); font: 700 22px Inter, sans-serif; }
.help-fab:hover { text-decoration: none; filter: brightness(1.05); }
@media (max-width: 1100px) { .help-fab { bottom: 92px; right: 14px; width: 44px; height: 44px; } }
.form-embed { padding: 0; overflow: hidden; }
.form-embed iframe { width: 100%; height: 1100px; border: 0; display: block; background: #fff; }

/* My documents: sections */
.sec-filter { margin: 0 0 8px; flex-wrap: wrap; }
.sec-filter .chip b { margin-left: 4px; }
.sec-chip { background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 1px 8px; font-weight: 600; }
.suggest { display: grid; gap: 2px; margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.suggest .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.suggest b { font-size: 17px; }
.dz-status label.small { display: grid; gap: 6px; font-weight: 600; margin-bottom: 12px; }
.sec-select { max-width: 100%; }
.rb-sec { display: flex; gap: 6px; align-items: center; }
.rb-sec .input { padding: 6px 10px; }
.prerender h1 { font-size: 28px; } .prerender ul { padding-left: 20px; }

/* In-app reader for source links */
.viewer { position: fixed; inset: 0; z-index: 35; background: var(--bg); display: flex; flex-direction: column; }
.viewer-bar { display: flex; gap: 8px; align-items: center; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; border-bottom: 1px solid var(--line); background: var(--surface); }
.vb-title { flex: 1; min-width: 0; display: grid; }
.vb-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-note { padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.viewer-note p { margin: 4px 0; }
.vn-sum { font-weight: 500; }
.viewer iframe { flex: 1; width: 100%; border: 0; background: #fff; }
body.viewing { overflow: hidden; }
body.viewing .help-fab { display: none; }
.viewer-notes { flex: 1; overflow: auto; padding: 14px; max-width: none; }
