/* Vidhi: mobile-first styles. No external fonts, so it works offline. */
:root {
  --ink: #1c1f26;
  --muted: #5d6270;
  --paper: #f7f5f0;
  --card: #ffffff;
  --line: #e4e0d6;
  --navy: #1d2b4f;
  --navy-2: #2c3e6b;
  --saffron: #f2a33a;
  --saffron-ink: #9a5a08;
  --green: #1f7a4d;
  --green-bg: #e7f4ec;
  --red: #b3261e;
  --red-bg: #fbeceb;
  --warn-bg: #fff4e0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 14px rgba(20, 30, 60, .05);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", Mangal, sans-serif;
  --serif: Georgia, "Noto Serif", "Noto Serif Devanagari", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.6 var(--sans);
  padding-bottom: 76px;
}
html[lang="hi"] body { line-height: 1.75; }
a { color: var(--navy-2); }
a:hover { color: var(--saffron-ink); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.3; color: var(--navy); }
h1 { font-size: 1.6rem; margin: .2em 0 .4em; }
h2 { font-size: 1.2rem; margin: 1.2em 0 .5em; }
h3 { font-size: 1.05rem; margin: .2em 0 .4em; }
p { margin: .4em 0 .8em; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; margin-right: auto; }
.brand:hover { color: #fff; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand strong { font-family: var(--serif); font-size: 1.15rem; letter-spacing: .3px; }
.brand small { font-size: .72rem; opacity: .8; }
.topnav { display: none; gap: 4px; }
.topnav a { color: #dfe5f3; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .93rem; }
.topnav a:hover, .topnav a.active { background: rgba(255,255,255,.12); color: #fff; }
.lang {
  border: 1.5px solid var(--saffron); background: transparent; color: #fff;
  border-radius: 999px; padding: 6px 14px; font: 600 .9rem var(--sans); cursor: pointer; min-height: 36px;
}
.lang:hover { background: var(--saffron); color: var(--navy); }

/* ---------- bottom nav (mobile) ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 9px; font-size: .7rem; color: var(--muted); text-decoration: none; text-align: center;
}
.bottomnav a span:first-child { font-size: 1.15rem; line-height: 1; }
.bottomnav a.active { color: var(--navy); font-weight: 700; }
.bottomnav a.active span:first-child { color: var(--saffron-ink); }

@media (min-width: 760px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  body { padding-bottom: 0; }
  h1 { font-size: 1.9rem; }
}

/* ---------- layout ---------- */
main { max-width: 820px; margin: 0 auto; padding: 18px 16px 28px; outline: none; }
.foot { max-width: 820px; margin: 0 auto; padding: 8px 16px 24px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin: 12px 0; box-shadow: var(--shadow);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 12px 0; }
.grid .card { margin: 0; }
@media (min-width: 600px) { .grid { grid-template-columns: 1fr 1fr; } }
.grid.two { grid-template-columns: 1fr 1fr; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.meta { font-size: .82rem; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--saffron-ink); margin: 0; }
html[lang="hi"] .eyebrow { text-transform: none; letter-spacing: 0; font-size: .85rem; }
.hero h1 { margin-bottom: .1em; }
.page-head { margin: 4px 0 10px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.crumbs { font-size: .85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 2px solid var(--navy);
  background: var(--navy); color: #fff; font: 600 .95rem var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--navy-2); color: #fff; }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.ghost:hover { background: #eef1f8; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- chips & bars ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: #eef0f5; color: var(--navy); border: 1px solid #dfe3ec; vertical-align: middle;
}
.chip.tiny { font-size: .66rem; padding: 0 6px; }
.chip.ok, .chip-in-force { background: var(--green-bg); color: var(--green); border-color: #cbe7d6; }
.chip.warn { background: var(--warn-bg); color: var(--saffron-ink); border-color: #f5dcb2; }
.chip-repealed, .chip-struck-down { background: var(--red-bg); color: var(--red); border-color: #f2cfcc; }
.chip-bill, .chip-draft, .chip-not-in-force, .chip-partly-in-force { background: var(--warn-bg); color: var(--saffron-ink); border-color: #f5dcb2; }
.chip.type { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.reason { background: var(--warn-bg); color: var(--saffron-ink); border-color: #f5dcb2; }
.lvl-new { background: #f1f1f1; color: #666; }
.lvl-learning { background: #e9eefb; color: #2c4a9a; border-color: #d2dcf5; }
.lvl-familiar { background: #fff1d9; color: var(--saffron-ink); border-color: #f5dcb2; }
.lvl-mastered { background: var(--green-bg); color: var(--green); border-color: #cbe7d6; }
.bar { height: 8px; background: #eceae4; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.bar.thin { height: 5px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--saffron), #e58a1c); border-radius: 99px; transition: width .3s; }
.big-num { font: 700 2.4rem/1 var(--serif); color: var(--navy); margin: 6px 0; }
.big-num small { font-size: 1rem; color: var(--muted); font-weight: 400; }

/* ---------- home ---------- */
.tile { display: block; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(20,30,60,.10); color: inherit; }
.tile-icon {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--navy); color: var(--saffron); font: 700 1.1rem var(--serif); margin-bottom: 6px;
}
.tile.wide { margin: 12px 0; }
.banner { display: flex; flex-direction: column; gap: 8px; border-left: 5px solid var(--saffron); background: #fffaf1; }
@media (min-width: 600px) { .banner { flex-direction: row; justify-content: space-between; align-items: center; } }
.banner h2 { margin: 0; }

/* ---------- constitution ---------- */
.search input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--line);
  font: 1rem var(--sans); background: #fff;
}
.search input:focus { border-color: var(--navy-2); outline: none; box-shadow: 0 0 0 3px rgba(44,62,107,.15); }
.part-list { list-style: none; padding: 0; margin: 14px 0; }
.part-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; background: #fff; text-decoration: none; color: var(--ink);
}
a.part-item:hover { border-color: var(--navy-2); color: var(--ink); }
.part-item strong { flex: 1 1 100%; font-weight: 600; }
.part-item.disabled { background: transparent; color: var(--muted); }
.article-list { list-style: none; padding: 0; margin: 10px 0; }
.article-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line);
  background: #fff; border-radius: 12px; margin: 8px 0; text-decoration: none; color: var(--ink);
}
.article-row:hover { border-color: var(--navy-2); color: var(--ink); }
.art-num {
  flex: 0 0 auto; min-width: 48px; text-align: center; font: 700 1rem var(--serif); color: var(--navy);
  background: #f1efe8; border-radius: 8px; padding: 6px 4px;
}
.art-title { flex: 1; }
.official blockquote {
  margin: 0 0 8px; padding: 12px 16px; border-left: 4px solid var(--navy);
  background: #f8f7f3; font-family: var(--serif); font-size: 1.04rem;
}
.note { font-size: .85rem; color: var(--muted); background: #f6f5f1; border-radius: 8px; padding: 8px 10px; }
.note.warn { background: var(--warn-bg); color: var(--saffron-ink); }
.explain { border-left: 5px solid var(--saffron); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 22px 0 6px; font-weight: 600; }

/* ---------- quiz & story ---------- */
.quiz-top { display: flex; flex-direction: column; gap: 2px; font-size: .85rem; color: var(--muted); }
.question h2, .choice h2 { font-size: 1.15rem; outline: none; }
.options { display: grid; gap: 10px; margin: 12px 0; }
.option {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%;
  min-height: 52px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); font: 1rem/1.45 var(--sans); cursor: pointer;
}
.option:hover:not(:disabled) { border-color: var(--navy-2); background: #f7f8fc; }
.option:disabled { cursor: default; }
.opt-key {
  flex: 0 0 26px; height: 26px; display: grid; place-items: center; border-radius: 7px;
  background: #eef0f5; font-weight: 700; font-size: .85rem; color: var(--navy);
}
.option.is-correct { border-color: var(--green); background: var(--green-bg); }
.option.is-correct .opt-key { background: var(--green); color: #fff; }
.option.is-wrong { border-color: var(--red); background: var(--red-bg); }
.option.is-wrong .opt-key { background: var(--red); color: #fff; }
.feedback { border-radius: 12px; padding: 12px 14px; margin: 10px 0 14px; }
.feedback.ok { background: var(--green-bg); }
.feedback.bad { background: var(--red-bg); }
.feedback.ok > strong { color: var(--green); }
.feedback.bad > strong { color: var(--red); }
.results { text-align: center; }
.results .row { justify-content: center; margin-top: 12px; }
.result-list { list-style: none; padding: 0; text-align: left; margin: 12px 0; }
.result-list li { padding: 8px 10px; border-radius: 8px; margin: 4px 0; font-size: .92rem; }
.result-list li.ok { background: var(--green-bg); }
.result-list li.bad { background: var(--red-bg); }
.recap { border-left: 5px solid var(--saffron); }
.story .scene {
  font-family: var(--serif); font-size: 1.06rem; padding: 4px 2px; margin: 8px 0 14px;
}
.chapter-dots { display: flex; gap: 6px; margin: 6px 0; }
.chapter-dots span { width: 28px; height: 6px; border-radius: 9px; background: #e0ddd3; }
.chapter-dots span.current { background: var(--saffron); }
.chapter-dots span.done { background: var(--green); }
.law-card { border-left: 5px solid var(--navy); }

/* ---------- progress ---------- */
.score-card { display: grid; gap: 14px; }
@media (min-width: 600px) { .score-card { grid-template-columns: 1fr 1.3fr; align-items: center; } }
.stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: .88rem; }
.stats div { background: #f8f7f3; border-radius: 10px; padding: 8px 10px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 700; font-size: 1.1rem; color: var(--navy); }
.review-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.review-box h2 { margin: 0; font-size: 1rem; }
.review-box p { margin: 0; font-weight: 600; }
select {
  min-height: 40px; padding: 6px 10px; border-radius: 9px; border: 1.5px solid var(--line);
  font: .95rem var(--sans); background: #fff; color: var(--ink);
}
.topic summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.topic summary::-webkit-details-marker { display: none; }
.topic summary .bar { grid-column: 1 / -1; }
.topic summary .chip { grid-column: 1 / -1; justify-self: start; }
.topic-title { font-weight: 600; color: var(--navy); }
.topic-score { font-weight: 700; color: var(--navy); }
.topic-list { margin-top: 8px; }
.signin { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; background: #f3f5fb; }
.signin p { margin: 0; flex: 1 1 260px; }
.data-row { margin: 22px 0 6px; }

/* ---------- news ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.news h3 { margin-top: 6px; }
.sources a { word-break: break-word; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0;
  pointer-events: none; transition: all .25s; z-index: 30; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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