/* ---------- rang: pehle theme, phir har subject ka apna accent ---------- */
:root {
  --bg: #f4f5fb; --card: #ffffff; --soft: #eef0f8; --text: #171c2e; --muted: #4d546a; --line: #d6dbe9;
  --sl: #3440b8; --sd: #a8b4ff; --accent-text: #ffffff;
  --good: #11683a; --good-bg: #e2f4e8; --warn: #7a4d00; --warn-bg: #fff0c9; --bad: #a61b1b; --bad-bg: #fde5e5;
  --mark: #fff09a; --shadow: 0 1px 3px rgba(20, 30, 60, .08), 0 6px 18px rgba(20, 30, 60, .05);
  --m0: #b3261e; --m1: #0b5cad; --m2: #1b6b2f; --m3: #7a3db8; --m4: #8a5200; --m5: #0f6b6b;
  --header-h: 62px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f121a; --card: #181c28; --soft: #232939; --text: #e9ebf3; --muted: #aab1c6; --line: #343b51;
  --accent-text: #0c1020;
  --good: #7fdca4; --good-bg: #143223; --warn: #f4c560; --warn-bg: #382b0c; --bad: #ff9d9d; --bad-bg: #401b1b;
  --mark: #5a4d0a; --shadow: none;
  --m0: #ff9a91; --m1: #7cc4ff; --m2: #86e29b; --m3: #cba6ff; --m4: #f5c45f; --m5: #5eead4;
  color-scheme: dark;
}
[data-subject="maharashtra"] { --sl: #a83c00; --sd: #ffab66; }
[data-subject="itihas"] { --sl: #8f2146; --sd: #f79ab6; }
[data-subject="rajyashastra"] { --sl: #3b3fb6; --sd: #adb6ff; }
[data-subject="bhugol"] { --sl: #0c6464; --sd: #5eead4; }
[data-subject="arthashastra"] { --sl: #725400; --sd: #f2cd55; }
[data-subject="vigyan"] { --sl: #6a27b4; --sd: #cda9ff; }
[data-subject="paryavaran"] { --sl: #1a672d; --sd: #86e29b; }
[data-subject="ganit"] { --sl: #0a569f; --sd: #80c6ff; }
[data-subject="reasoning"] { --sl: #9c1578; --sd: #ff9fe0; }
[data-subject="marathi"] { --sl: #ab231c; --sd: #ff9f96; }
[data-subject="english"] { --sl: #3e4f68; --sd: #bccbe4; }
[data-subject="current-affairs"] { --sl: #7a481b; --sd: #e6b98e; }

:root, [data-subject] {
  --accent: var(--sl); --link: var(--sl);
  --tint: color-mix(in srgb, var(--accent) 9%, var(--card));
  --hero-bg: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 58%, #0d0f2e));
  --hero-text: #ffffff;
}
:root[data-theme="dark"], :root[data-theme="dark"] [data-subject] {
  --accent: var(--sd); --link: var(--sd);
  --tint: color-mix(in srgb, var(--accent) 12%, var(--card));
  --hero-bg: linear-gradient(135deg, color-mix(in srgb, var(--accent) 40%, #11142a), color-mix(in srgb, var(--accent) 13%, #181c28) 75%);
  --hero-text: #f4f5fa;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 "Segoe UI", system-ui, "Nirmala UI", "Noto Sans Devanagari", Mangal, sans-serif;
  overflow-wrap: break-word;
}
html:lang(mr) body { line-height: 1.8; }
h1, h2, h3, h4, h5 { line-height: 1.35; margin: 0 0 8px; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.55rem, 4.6vw, 2.3rem); }
h2 { font-size: clamp(1.2rem, 3.4vw, 1.45rem); color: var(--accent); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 10px; }
a { color: var(--link); }
img { max-width: 100%; }
pre { background: var(--soft); padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
.content { white-space: pre-line; overflow-wrap: anywhere; }
.lead { font-size: 1.08rem; }
.small { font-size: .875rem; }
.muted { color: var(--muted); }
.warn-text { color: var(--warn); font-weight: 600; }
.error-text { color: var(--bad); }
.good-text { color: var(--good); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 1.15em; height: 1.15em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hero :focus-visible { outline-color: var(--hero-text); }
main:focus, section:focus:not(:focus-visible), article:focus:not(:focus-visible), .view-title:focus:not(:focus-visible) { outline: none; }
.skip { position: absolute; left: 8px; top: -80px; z-index: 60; background: var(--accent); color: var(--accent-text); padding: 10px 14px; border-radius: 6px; }
.skip:focus { top: 8px; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 3px solid var(--accent); box-shadow: var(--shadow); }
.bar-top { display: flex; align-items: center; gap: 10px; max-width: 1280px; margin: 0 auto; padding: 9px 14px; }
.brand { font-weight: 800; text-decoration: none; color: var(--accent); white-space: nowrap; }
.brand-short { display: none; }
.searchbox { flex: 1; position: relative; min-width: 0; }
input[type="search"], select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-height: 40px; max-width: 100%;
}
input[type="search"] { width: 100%; }
.search-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 10px; box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
}
.search-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 6px; }
.search-results { list-style: none; margin: 0; padding: 0; }
.search-results a { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px; border-radius: 6px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.search-results a:hover, .search-results a:focus-visible { background: var(--soft); }
.result-title { font-weight: 600; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.search-results .muted { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.topic-bar { border-top: 1px solid var(--line); background: var(--tint); }
.topic-bar-in { display: flex; align-items: center; gap: 10px; max-width: 1280px; margin: 0 auto; padding: 5px 14px; }
.topic-bar .crumbs { flex: 1; margin: 0; flex-wrap: nowrap; min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: .875rem; margin: 0 0 10px; }
.crumb-wide { white-space: nowrap; }
.crumb-here { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar-pager { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.bar-count { font-size: .85rem; font-weight: 700; white-space: nowrap; }
.bar-arrow { min-width: 36px; }
.bar-arrow.is-off { opacity: .35; }
.topic-bar .menu-btn { display: none; }

/* ---------- layout ---------- */
main { max-width: 1140px; margin: 0 auto; padding: 18px 14px 30px; }
.topic-page main { max-width: 1280px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: clamp(14px, 2.6vw, 24px); margin-bottom: 18px; box-shadow: var(--shadow); min-width: 0; }
.site-footer { max-width: 1140px; margin: 0 auto; padding: 0 14px 30px; color: var(--muted); font-size: .875rem; }
.notice { background: var(--warn-bg); }
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.view { min-width: 0; }
.view-in { animation: view-in .28s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- controls ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 40px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); color: var(--text); text-decoration: none; max-width: 100%;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-small { min-height: 34px; padding: 3px 10px; font-size: .85rem; border-radius: 8px; }
.btn-big { min-height: 50px; font-size: 1.05rem; width: 100%; margin-bottom: 12px; }
.btn-good { background: var(--good-bg); color: var(--good); }
.btn-warn { background: var(--warn-bg); color: var(--warn); }
.btn[aria-pressed="true"] { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.btn-read[aria-pressed="true"] { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.map-tools .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 2px; max-width: 100%; min-width: 0; }
.field label { font-size: .85rem; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.chip { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.chip-accent { background: var(--tint); color: var(--accent); border-color: var(--accent); }
.chip-good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 4px; border: 1px solid currentColor; white-space: nowrap; }
.badge-verified { color: var(--good); background: var(--good-bg); }
.badge-disputed { color: var(--warn); background: var(--warn-bg); border-style: dashed; }
.badge-unverified { color: var(--bad); background: var(--bad-bg); border-style: dotted; border-width: 2px; }
.proof { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; min-width: 0; }
.src { min-width: 0; }
.src summary { cursor: pointer; font-size: .85rem; color: var(--link); }
.source-list { margin: 4px 0 0; padding-left: 22px; overflow-wrap: anywhere; font-size: .9rem; }
.item-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: flex-start; margin-top: 10px; }
.inline-list { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 0 0 10px; }
progress { width: 100%; height: 12px; accent-color: var(--accent); }

/* ---------- icons, ring, meter ---------- */
.subject-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 52px; height: 52px; border-radius: 16px; background: var(--accent); color: var(--accent-text); }
.subject-icon .icon { width: 30px; height: 30px; stroke-width: 1.7; }
.glyph { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.ring { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 62px; height: 62px; flex: 0 0 auto; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: color-mix(in srgb, currentColor 18%, transparent); }
.ring-bar { stroke: var(--accent); stroke-linecap: round; animation: ring-fill .9s ease; }
.hero .ring-bar { stroke: currentColor; }
@keyframes ring-fill { from { stroke-dashoffset: var(--ring-len); } }
.ring-text { font-size: .85rem; font-weight: 800; }
.meter { display: block; height: 8px; border-radius: 8px; background: var(--soft); overflow: hidden; border: 1px solid var(--line); }
.meter-fill { display: block; height: 100%; background: var(--accent); }

/* ---------- hero ---------- */
.hero { position: relative; background: var(--hero-bg); color: var(--hero-text); border-radius: 20px; padding: clamp(18px, 3.4vw, 32px); margin-bottom: 18px; }
.hero h1, .hero h2 { color: inherit; }
.hero a:not(.btn) { color: inherit; }
.hero .muted { color: inherit; opacity: .92; }
.hero-top { display: flex; align-items: center; gap: 12px; font-weight: 700; margin-bottom: 10px; }
.hero .subject-icon { background: #fff; color: var(--accent); }
:root[data-theme="dark"] .hero .subject-icon { background: var(--accent); color: var(--accent-text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.btn-hero { background: #fff; color: var(--accent); border-color: #fff; min-height: 46px; }
:root[data-theme="dark"] .btn-hero { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-ghost { background: transparent; color: inherit; border-color: color-mix(in srgb, currentColor 55%, transparent); min-height: 46px; }
.btn-hero:hover, .btn-ghost:hover { border-color: currentColor !important; text-decoration: underline; }
.hero-ring { display: flex; flex-direction: column; align-items: center; gap: 4px; position: absolute; top: 18px; right: 18px; max-width: 150px; text-align: center; }
.topic-page .hero:has(.hero-ring) .hero-top, .hero:has(.hero-ring) > h1 { padding-right: 84px; }
.home-hero { background: linear-gradient(120deg, #8f2146, #3b3fb6 48%, #0c6464); color: #fff; }
:root[data-theme="dark"] .home-hero { background: linear-gradient(120deg, #4a1c33, #252a6b 48%, #0f4040); }
.home-hero .btn-hero { background: #fff; color: #23277a; border-color: #fff; }
.home-hero:has(.hero-ring) > h1, .home-hero:has(.hero-ring) > .lead { padding-right: 165px; }
.tool-hero { padding-top: 16px; padding-bottom: 10px; }
.tool-hero .subject-icon { width: 38px; height: 38px; border-radius: 12px; }
.tool-hero .subject-icon .icon { width: 22px; height: 22px; }
.view-title { overflow-wrap: anywhere; }
.view-title:focus-visible { outline: 2px dashed currentColor; outline-offset: 4px; }
.kicker { font-weight: 800; font-size: .85rem; margin-bottom: 4px; opacity: .9; }

/* ---------- home ---------- */
.tile-grid, .ready-grid, .topic-grid { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 14px; }
.tile-grid { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px; border-radius: 18px; text-decoration: none; color: var(--text);
  background: linear-gradient(180deg, var(--tint), var(--card) 70%); border: 1px solid var(--line); border-top: 6px solid var(--accent); box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease;
}
.tile:hover, .tile:focus-visible { transform: translateY(-3px); border-color: var(--accent); }
.tile-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 62px; color: var(--accent); }
.tile-name { font-size: 1.25rem; font-weight: 800; color: var(--accent); }
.tile-about { font-size: .875rem; color: var(--muted); flex: 1; }
.tile-count { font-weight: 700; font-size: .9rem; }
.tile-soon { border-top-style: dashed; }
.tile-dots { display: flex; flex-wrap: wrap; gap: 5px; }
.tile-dots span { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--accent); }
.tile-dots span.on { background: var(--accent); }
.ready-grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.ready-card { display: flex; gap: 12px; align-items: center; height: 100%; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: 14px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.ready-card:hover { border-color: var(--accent); }
.ready-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.ready-subject { font-size: .75rem; font-weight: 800; color: var(--accent); }
.ready-name { font-weight: 700; }
.verify-legend { list-style: none; padding: 0; margin: 0; }
.verify-legend li { margin-bottom: 8px; }

.subject-hero { display: flex; gap: 18px; align-items: flex-start; }
.subject-hero > div:nth-child(2) { flex: 1; min-width: 0; }
.subject-hero .subject-icon { width: 76px; height: 76px; border-radius: 22px; }
.subject-hero .subject-icon .icon { width: 46px; height: 46px; }
.subject-hero .glyph { font-size: 2.2rem; }
.subject-hero .hero-ring { position: static; }
.topic-grid { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.topic-card { min-width: 0; }
.topic-card > a, .topic-soon { display: flex; gap: 12px; align-items: flex-start; height: 100%; padding: 14px; border-radius: 16px; text-decoration: none; color: var(--text); }
.topic-card > a { background: var(--card); border: 2px solid var(--accent); box-shadow: var(--shadow); transition: transform .18s ease; }
.topic-card > a:hover, .topic-card > a:focus-visible { transform: translateY(-3px); background: var(--tint); }
.topic-soon { border: 2px dashed var(--line); color: var(--muted); }
.topic-num { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; font-weight: 800; background: var(--accent); color: var(--accent-text); }
.topic-soon .topic-num { background: transparent; color: var(--muted); border: 2px dashed var(--line); }
.topic-body { display: flex; flex-direction: column; align-items: stretch; gap: 6px; flex: 1; min-width: 0; }
.topic-soon .topic-body { align-items: flex-start; }
.topic-name { font-weight: 800; }
.topic-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: .85rem; }
.status-count { white-space: nowrap; }
.switcher h2 { margin-top: 20px; }
.switcher ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.switcher a { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); text-decoration: none; font-weight: 700; }
.switcher a[aria-current] { border: 2px solid var(--accent); background: var(--tint); }
.switcher .subject-icon { width: 30px; height: 30px; border-radius: 50%; }
.switcher .subject-icon .icon { width: 17px; height: 17px; }
.switcher .glyph { font-size: .85rem; }

/* ---------- kaalrekha link ---------- */
.kr-home { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 12px; }
.kr-home a { display: flex; align-items: center; gap: 14px; height: 100%; padding: 16px 18px; border-radius: 16px; background: var(--hero-bg); color: var(--hero-text); text-decoration: none; box-shadow: var(--shadow); }
.kr-home a:hover .kr-home-name { text-decoration: underline; }
.kr-home .icon { width: 30px; height: 30px; }
.kr-home .icon:last-child { width: 22px; height: 22px; }
.kr-home-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.45; }
.kr-home-name { font-size: 1.25rem; font-weight: 800; }
.kr-home-count { font-weight: 700; }

/* ---------- sidebar ---------- */
.sidebar { position: sticky; top: calc(var(--header-h) + 12px); max-height: calc(100vh - var(--header-h) - 24px); overflow-y: auto; overscroll-behavior: contain; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); }
.side-head { border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side-subject { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; margin-bottom: 8px; }
.side-subject .subject-icon { width: 38px; height: 38px; border-radius: 12px; }
.side-subject .subject-icon .icon { width: 22px; height: 22px; }
.side-subject .glyph { font-size: 1.05rem; }
.side-title { font-weight: 800; line-height: 1.4; }
.side-progress p { margin: 0 0 8px; }
.side-close { display: none; }
.side-group { font-size: .75rem; font-weight: 800; color: var(--muted); margin: 12px 4px 4px; }
.side-list { list-style: none; padding: 0; margin: 0; }
.side-list a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; text-decoration: none; color: var(--text); font-size: .92rem; line-height: 1.4; min-height: 38px; }
.side-list a:hover { background: var(--soft); }
.side-list a[aria-current] { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.side-list a:focus-visible { outline-offset: -3px; }
.side-list a[aria-current]:focus-visible { outline-color: var(--text); }
.side-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.side-num, .side-avatar { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; font-weight: 800; font-size: .85rem; background: var(--tint); color: var(--accent); border: 2px solid var(--accent); }
.side-avatar .photo-frame { width: 100%; height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; display: flex; align-items: center; justify-content: center; }
.side-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.side-avatar .initials { font-size: .7rem; }
.side-tick { visibility: hidden; color: var(--good); background: var(--good-bg); border-radius: 50%; display: inline-flex; padding: 2px; }
.is-read .side-tick { visibility: visible; }
.side-count { margin-left: auto; min-width: 22px; text-align: center; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-weight: 800; font-size: .75rem; padding: 0 6px; }
.backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(5, 8, 18, .55); }

/* ---------- overview ---------- */
.unit-grid { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 16px; }
.unit-grid-people { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.unit-grid-sections { grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); }
.unit-grid li { min-width: 0; }
.unit-card { position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: 18px; background: var(--card); color: var(--text); text-decoration: none; border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .18s ease, border-color .18s ease; }
.unit-card:hover, .unit-card:focus-visible { transform: translateY(-3px); border-color: var(--accent); }
.unit-portrait { display: block; background: var(--tint); border-bottom: 4px solid var(--accent); }
.unit-portrait .photo-frame { border: 0; border-radius: 0; background: transparent; aspect-ratio: 4 / 5; }
.unit-text { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; flex: 1; }
.unit-card-person .unit-num { position: absolute; top: 10px; left: 10px; }
.unit-num { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 800; font-size: 1rem; }
.unit-card-section { border-top: 6px solid var(--accent); background: linear-gradient(180deg, var(--tint), var(--card) 65%); }
.unit-bignum { font-size: 3rem; line-height: 1; font-weight: 900; color: var(--accent); }
.unit-name { font-weight: 800; font-size: 1.12rem; line-height: 1.4; }
.unit-years { font-weight: 800; color: var(--accent); }
.unit-about { font-size: .875rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex: 0 0 auto; }
.unit-credit { margin-top: auto; padding-top: 6px; font-size: .68rem; line-height: 1.45; color: var(--muted); }
.unit-blocks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.unit-block { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--accent); }
.unit-done { position: absolute; top: 10px; right: 10px; display: none; align-items: center; gap: 4px; font-size: .75rem; font-weight: 800; background: var(--good-bg); color: var(--good); border: 1px solid currentColor; border-radius: 999px; padding: 2px 9px; }
.is-read .unit-done { display: inline-flex; }
.block-head { display: flex; align-items: center; gap: 12px; }
.block-head > .icon { width: 38px; height: 38px; padding: 8px; border-radius: 12px; background: var(--tint); color: var(--accent); }
.block-head > span { display: flex; flex-direction: column; min-width: 0; }
.block-kind { font-size: .75rem; font-weight: 800; color: var(--muted); }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 0 18px; }
.status-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0 0 10px; }
.status-tiles li { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--soft); border-radius: 12px; padding: 8px 4px; }
.status-tiles strong { font-size: 1.6rem; }
.status-tiles .badge { white-space: normal; text-align: center; }
.trick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.trick { border: 2px dashed var(--accent); border-radius: 14px; padding: 12px 14px; min-width: 0; background: var(--tint); }
.trick-label { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.trick-text { font-size: 1.1rem; font-weight: 700; }
.trick p:last-child { margin-bottom: 0; }

/* ---------- unit view ---------- */
.jump ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 18px; }
.jump li { min-width: 0; max-width: 100%; }
.jump-chip { font: inherit; font-weight: 700; font-size: .875rem; display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-height: 36px; padding: 4px 13px; border-radius: 999px; border: 1px solid var(--accent); background: var(--card); color: var(--accent); cursor: pointer; text-align: left; }
.jump-chip:hover { background: var(--tint); }
.section-hero { display: flex; gap: clamp(12px, 3vw, 28px); align-items: flex-start; }
.section-hero > div { flex: 1; min-width: 0; }
.hero-num { font-size: clamp(3.2rem, 10vw, 6.5rem); font-weight: 900; line-height: .95; opacity: .9; }
.person-hero { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: clamp(16px, 3vw, 30px); align-items: start; }
.person-intro { min-width: 0; }
.tagline { font-weight: 700; font-size: 1.1rem; }

.photo { margin: 0; min-width: 0; }
.photo-frame { display: block; aspect-ratio: 3 / 4; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.photo-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.photo-button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 14px; }
.portrait .photo-frame { border: 4px solid #fff; background: color-mix(in srgb, #fff 82%, var(--accent)); box-shadow: 0 10px 28px rgba(0, 0, 0, .28); }
:root[data-theme="dark"] .portrait .photo-frame { border-color: var(--accent); background: var(--soft); }
.photo-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 12px; text-align: center; color: var(--muted); background: var(--soft); }
.initials { font-size: 2.8rem; font-weight: 800; color: var(--accent); }
.photo figcaption { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; overflow-wrap: anywhere; font-size: .875rem; }
.credit { display: flex; flex-direction: column; gap: 1px; font-size: .78rem; }
.lightbox { width: min(760px, 94vw); max-height: 94vh; border: 2px solid var(--accent); border-radius: 16px; background: var(--card); color: var(--text); padding: 16px; }
.lightbox::backdrop { background: rgba(4, 6, 14, .75); }
.lightbox-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; }
.lightbox .photo-frame { aspect-ratio: auto; height: min(66vh, 800px); margin-bottom: 10px; }

.life-strip { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, 180px) minmax(0, 1fr); gap: 0; align-items: stretch; margin-bottom: 18px; }
.life-card { background: var(--card); border: 1px solid var(--line); border-top: 6px solid var(--accent); border-radius: 16px; padding: 14px 16px; min-width: 0; box-shadow: var(--shadow); }
.life-died { border-top-color: var(--muted); }
.life-card h2 { font-size: 1rem; margin: 0; }
.life-year { font-size: 2.8rem; font-weight: 900; line-height: 1.15; color: var(--accent); margin: 0; }
.life-date { font-size: 1.1rem; font-weight: 700; }
.life-span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 6px; font-weight: 800; }
.life-line { display: block; width: 100%; height: 8px; border-radius: 8px; background: linear-gradient(90deg, var(--accent), var(--muted)); transform-origin: left; animation: grow 1.1s ease; }
@keyframes grow { from { transform: scaleX(0); } }

.info-grid, .formula-grid, .gallery { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.info-grid { grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); }
.info-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; min-width: 0; background: var(--card); padding: 0 16px 14px; }
.info-head { margin: 0 -16px 12px; padding: 12px 16px; background: var(--tint); border-bottom: 3px solid var(--accent); }
.info-head h3 { margin: 4px 0 0; font-size: 1.15rem; }
.info-tag { display: inline-block; font-size: .75rem; font-weight: 800; padding: 1px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-text); overflow-wrap: anywhere; }
.info-year { font-weight: 800; color: var(--accent); }
.info-card dl { margin: 0; flex: 1; }
.info-field { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.info-field:last-child { border-bottom: 0; }
.info-field dt { font-size: .78rem; font-weight: 800; color: var(--muted); }
.info-field dd { margin: 0; font-weight: 600; }
.info-card .item-foot { margin-top: auto; padding-top: 10px; }

.notes { list-style: none; padding: 0; margin: 0; counter-reset: note; display: grid; gap: 10px; }
.notes li { counter-increment: note; position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px 58px; min-width: 0; }
.notes li::before { content: counter(note); position: absolute; left: 12px; top: 12px; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; background: var(--tint); color: var(--accent); border: 2px solid var(--accent); }
html:lang(mr) .notes li::before { content: counter(note, devanagari); }
.notes li > p { margin: 0; }

.unit-foot { margin-top: 26px; }
.unit-foot .btn-row { margin-bottom: 14px; }
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pager-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--accent); background: var(--card); text-decoration: none; color: var(--text); min-width: 0; }
.pager-card:hover { background: var(--tint); }
.pager-card > .icon { width: 26px; height: 26px; color: var(--accent); }
.pager-card > span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pager-next { flex-direction: row-reverse; text-align: right; }
.arrow-hint { margin-top: 10px; }

/* ---------- timeline ---------- */
.strip { margin-bottom: 18px; background: var(--tint); border-radius: 14px; padding: 10px 12px 6px; }
.strip-track { position: relative; margin: 0 12px; border-bottom: 4px solid var(--accent); }
.strip-dot { position: absolute; width: 22px; height: 22px; margin-left: -11px; padding: 0; border-radius: 50%; border: 2px solid var(--accent); background: var(--card); color: var(--accent); font: 800 .68rem/1 "Segoe UI", system-ui, sans-serif; cursor: pointer; }
.strip-dot:hover, .strip-dot:focus-visible { background: var(--accent); color: var(--accent-text); z-index: 2; }
.strip-ends { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; font-size: .85rem; margin-top: 4px; }
.strip-help { margin: 0; font-size: .78rem; }
.vtl { list-style: none; margin: 0; padding: 0; position: relative; overflow-x: clip; }
.vtl::before, .vtl::after { content: ""; position: absolute; left: 16px; top: 0; width: 5px; border-radius: 3px; }
.vtl::before { bottom: 0; background: var(--line); }
.vtl::after { height: calc(var(--fill, 1) * 100%); background: var(--accent); }
.vt-item { position: relative; padding-bottom: 16px; border-radius: 14px; }
.vt-gap { display: table; position: relative; z-index: 1; margin: 0 0 10px 52px; font-size: .8rem; font-weight: 800; color: var(--accent); background: var(--tint); border: 1px dashed var(--accent); border-radius: 999px; padding: 0 12px; }
.vt-row { display: grid; grid-template-columns: minmax(0, 168px) minmax(0, 1fr); gap: 14px; padding-left: 52px; }
.vt-when { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 6px; min-width: 0; }
.vt-num { position: absolute; left: 0; width: 37px; height: 37px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem; background: var(--accent); color: var(--accent-text); border: 3px solid var(--accent); z-index: 1; }
.vt-date { font-weight: 900; font-size: 1.35rem; line-height: 1.3; color: var(--accent); overflow-wrap: anywhere; }
.vt-date-long { font-size: 1.05rem; }
.vt-age { font-size: .78rem; font-weight: 700; background: var(--soft); border-radius: 999px; padding: 1px 10px; }
.vt-card { border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 14px; padding: 12px 16px; background: var(--card); min-width: 0; box-shadow: var(--shadow); }
.vt-card h3 { margin: 0 0 6px; }
.animate-ready .vt-card { transform-origin: left center; transition: transform .45s ease, border-color .45s ease; }
.animate-ready .vt-num { transition: background-color .3s ease, color .3s ease, transform .3s ease; }
.animate-ready .vt-item:not(.seen) .vt-card { transform: scale(.965); border-style: dashed; }
.animate-ready .vt-item:not(.seen) .vt-num { background: var(--card); color: var(--accent); transform: scale(.8); }
.hl { animation: highlight 2s ease; }
@keyframes highlight { 0%, 40% { box-shadow: 0 0 0 4px var(--warn); } 100% { box-shadow: 0 0 0 4px transparent; } }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.data-table thead th { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.data-table tbody th { background: var(--tint); font-weight: 800; }
.data-table tbody tr:nth-child(even) td { background: var(--soft); }
.data-table td, .data-table tbody th { min-width: 7em; }
.data-table .col-proof { width: 150px; }
/* Shabd beech se na tootein; jagah kam ho to table khud scroll kare */
.data-table .cell { overflow-wrap: break-word; }
.data-table .item-foot { margin: 0; flex-direction: column; align-items: flex-start; }

/* ---------- flow ---------- */
.flow-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.flow-status { margin: 0; font-weight: 800; color: var(--accent); }
.flow { list-style: none; margin: 8px 0 0; padding: 0; }
.flow-step { position: relative; display: flex; gap: 14px; padding-bottom: 24px; border-radius: 14px; }
.flow-step:last-child { padding-bottom: 0; }
.flow-step:not(:last-child)::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 6px; width: 4px; background: var(--accent); border-radius: 4px; }
.flow-step:not(:last-child)::after { content: ""; position: absolute; left: 12px; bottom: 4px; border: 9px solid transparent; border-top-color: var(--accent); border-bottom: 0; }
.flow-num { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; background: var(--accent); color: var(--accent-text); border: 3px solid var(--accent); }
.flow-card { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px 12px; background: var(--card); }
.flow-card h3 { margin: 4px 0 6px; }
.flow.walking .flow-step { transition: opacity .3s ease; }
.flow.walking .is-current .flow-card { border: 3px solid var(--accent); background: var(--tint); animation: pop .35s ease; }
.flow.walking .is-ahead .flow-num { background: var(--card); color: var(--accent); border-style: dashed; }
.flow.walking .is-ahead::before { background: var(--line); }
.flow.walking .is-ahead::after, .flow.walking .is-current::after { border-top-color: var(--line); }
.flow.walking .is-current::before { background: var(--line); }
.flow.walking .is-ahead .flow-card { border-style: dashed; }
.flow.walking .is-ahead .flow-card h3, .flow.walking .is-ahead .flow-body { display: none; }
.flow.walking .is-ahead .flow-card::after { content: "?"; display: block; font-size: 1.4rem; font-weight: 900; color: var(--muted); }
@keyframes pop { from { transform: scale(.96); } }

/* ---------- formulas, examples ---------- */
.formula-grid { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.formula-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; min-width: 0; display: flex; flex-direction: column; }
.formula { font-family: "Cambria Math", Cambria, "Nirmala UI", serif; font-size: 1.45rem; font-weight: 700; line-height: 1.7; text-align: center; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--tint); border: 2px solid var(--accent); border-radius: 12px; padding: 12px; }
.formula-example { border-left: 4px solid var(--line); padding-left: 12px; margin-bottom: 10px; }
.formula-example p { margin: 0; }
.formula-card .trick { margin-bottom: 4px; }
.formula-card > .item-foot { margin-top: auto; padding-top: 10px; }
.examples { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.example { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; min-width: 0; }
.ex-label { font-size: .78rem; font-weight: 800; color: var(--accent); margin: 0; }
.ex-question { font-size: 1.15rem; font-weight: 700; }
.ex-steps { list-style: none; padding: 0; margin: 0 0 10px; counter-reset: exstep; }
.ex-step { counter-increment: exstep; position: relative; padding: 8px 12px 8px 50px; margin-bottom: 6px; background: var(--soft); border-radius: 10px; animation: step-in .35s ease; }
.ex-step::before { content: counter(exstep); position: absolute; left: 10px; top: 8px; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; background: var(--accent); color: var(--accent-text); }
html:lang(mr) .ex-step::before { content: counter(exstep, devanagari); }
.ex-answer { background: var(--good-bg); border: 2px solid var(--good); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; animation: step-in .35s ease; }
.ex-answer p:last-child { margin: 0; }
.ex-answer-text { font-size: 1.1rem; }
.veiled { display: none !important; }
@keyframes step-in { from { opacity: 0; transform: translateX(-14px); } }

.gallery { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.gallery li { min-width: 0; }
.gallery .photo-frame { aspect-ratio: 4 / 3; }

/* ---------- map ---------- */
.map-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.map-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.map-key { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--card); }
.map-figure { margin: 0 0 10px; }
.map-figure figcaption { margin-top: 6px; }
.map-canvas { max-width: 760px; min-height: 180px; border: 2px dashed var(--line); border-radius: 14px; overflow: hidden; background: var(--tint); }
.map-svg { display: block; max-width: 100%; height: auto; font-family: "Segoe UI", system-ui, "Nirmala UI", sans-serif; }
.map-grid line { stroke: color-mix(in srgb, var(--muted) 30%, transparent); stroke-width: 1; }
.map-grid line.map-zero { stroke: var(--muted); stroke-width: 2; }
.map-grid text, .map-scale text { fill: var(--muted); font-size: 11px; }
.map-north path { fill: var(--text); }
.map-north text { fill: var(--text); font-size: 12px; font-weight: 800; }
.map-scale path { stroke: var(--text); stroke-width: 2; fill: none; }
.map-leaders line { stroke: var(--muted); stroke-width: 1; }
.map-leaders circle { fill: var(--muted); }
.c0 { --m: var(--m0); } .c1 { --m: var(--m1); } .c2 { --m: var(--m2); } .c3 { --m: var(--m3); } .c4 { --m: var(--m4); } .c5 { --m: var(--m5); }
.map-key, .map-badge { background: var(--m); }
.map-marker { cursor: pointer; }
.map-marker .map-dot { fill: var(--m); stroke: var(--card); stroke-width: 2; }
.map-marker text { fill: var(--accent-text); font-size: 11px; font-weight: 800; }
.map-marker.is-selected .map-dot { stroke: var(--text); stroke-width: 3; }
.map-marker.is-found .map-dot { stroke: var(--good); stroke-width: 4; }
.map-pulse { fill: none; stroke: var(--m); stroke-width: 3; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { from { transform: scale(.7); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.map-labels text { fill: var(--text); font-size: 12px; font-weight: 700; paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.map-labels text.is-selected { font-size: 13px; fill: var(--accent); }
.map-info { margin-bottom: 12px; }
.map-detail { border: 2px solid var(--accent); border-radius: 12px; padding: 10px 14px; max-width: 760px; }
.map-detail-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.map-badge { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; font-weight: 800; font-size: .85rem; color: var(--accent-text); }
.map-game { border: 2px solid var(--accent); background: var(--tint); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; max-width: 760px; }
.map-question { font-weight: 800; }
.map-feedback { min-height: 1.6em; margin: 0 0 6px; }
.map-numbers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.map-numbers .btn { min-width: 40px; }
.map-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 10px; }
.map-list.in-game, .map-item.is-filtered { display: none; }
.map-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.map-item.is-selected { border: 2px solid var(--accent); background: var(--tint); }
.map-pick { display: flex; align-items: center; gap: 10px; width: 100%; font: inherit; font-weight: 800; text-align: left; background: none; border: 0; padding: 0; margin-bottom: 6px; color: var(--text); cursor: pointer; border-radius: 6px; }
.map-name { overflow-wrap: anywhere; min-width: 0; }

/* ---------- combined chart ---------- */
.chart { --label-w: 200px; }
.chart-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.slider-wrap { display: flex; flex: 1 1 260px; gap: 8px; align-items: center; min-width: 0; }
.slider-wrap label { font-size: .85rem; color: var(--muted); }
.slider-wrap input { flex: 1; min-width: 80px; min-height: 32px; accent-color: var(--accent); }
.year-out { font-size: 1.5rem; font-weight: 800; min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums; color: var(--accent); }
.life-rows { list-style: none; padding: 0; margin: 0; }
.life-row, .axis-row { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); column-gap: 16px; padding: 0 8px; }
.life-row { align-items: stretch; border-bottom: 1px solid var(--line); }
.life-label { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 6px 0; min-width: 0; }
.life-label a { font-weight: 700; overflow-wrap: anywhere; }
.life-years { font-size: .8rem; color: var(--muted); }
.track { position: relative; min-height: 44px; align-self: stretch; }
.bar { position: absolute; top: 50%; height: 16px; margin-top: -8px; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--accent) 25%, transparent); border: 2px solid var(--accent); }
.bar-lived { height: 100%; width: 100%; background: var(--accent); }
.bar-disputed { border: 2px dashed var(--warn); }
.bar-disputed .bar-lived { background: repeating-linear-gradient(90deg, var(--warn) 0 5px, var(--accent) 5px 12px); }
.bar-unverified { border: 2px dotted var(--bad); }
.bar-unverified .bar-lived { background: repeating-linear-gradient(135deg, var(--accent) 0 5px, color-mix(in srgb, var(--accent) 45%, var(--card)) 5px 10px); }
.bar-open { -webkit-mask-image: linear-gradient(90deg, #000 55%, transparent); mask-image: linear-gradient(90deg, #000 55%, transparent); }
.not-alive .bar { opacity: .45; }
.dot { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--card); border: 2px solid var(--text); cursor: pointer; }
.dot-future { opacity: .35; }
.dot-now { background: var(--mark); transform: scale(1.7); z-index: 2; }
.cursor { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); z-index: 1; pointer-events: none; }
.axis { position: relative; height: 24px; }
.tick { position: absolute; top: 2px; transform: translateX(-50%); font-size: .75rem; color: var(--muted); white-space: nowrap; }
.tick-first { transform: none; }
.tick-last { transform: translateX(-100%); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 8px 0; font-size: .8rem; color: var(--muted); }
.swatch { display: inline-block; position: relative; width: 30px; height: 12px; margin-right: 6px; border-radius: 6px; border: 2px solid var(--accent); background: var(--accent); vertical-align: -1px; }
.swatch.bar-disputed { border: 2px dashed var(--warn); background: repeating-linear-gradient(90deg, var(--warn) 0 5px, var(--accent) 5px 12px); }
.swatch.bar-unverified { border: 2px dotted var(--bad); background: repeating-linear-gradient(135deg, var(--accent) 0 5px, color-mix(in srgb, var(--accent) 45%, var(--card)) 5px 10px); }
.swatch.bar-open { position: relative; top: 0; height: 12px; margin-top: 0; }
.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; background: var(--soft); border-radius: 10px; padding: 12px 14px; margin: 8px 0; min-height: 56px; }
.readout > p { margin: 0; }
.readout h4 { margin: 0 0 4px; }
.readout ul { margin: 0; padding-left: 18px; overflow-wrap: anywhere; }
.readout .alive-list { display: flex; flex-wrap: wrap; gap: 4px 8px; list-style: none; padding: 0; }
.alive-list li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 10px; min-width: 0; overflow-wrap: anywhere; font-size: .9rem; }
/* Slider chalate waqt neeche ki pattiyan upar-neeche na hon */
.scrubbing .readout { height: 168px; overflow-y: auto; align-content: start; }
.chart-table summary { cursor: pointer; color: var(--link); }
.chart-table table { margin-top: 8px; }
.chart-table thead th { background: var(--soft); }
.chart-table tbody th { min-width: 8em; }
.scroll { overflow-x: auto; }

/* ---------- revision mode ---------- */
.revision-count { font-weight: 800; color: var(--accent); margin: 0; }
.revision-unit h2 { display: flex; align-items: center; gap: 12px; }
.revision-unit .trick-grid { margin-bottom: 14px; }
.quick-notes { margin: 0 0 14px; padding-left: 20px; }
.quick-notes li { margin-bottom: 10px; }
.quick-notes .proof { margin-top: 2px; }
.quick-notes li::marker { color: var(--accent); }
.recall-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 12px; align-items: start; }
.recall { border: 2px solid var(--line); border-radius: 14px; min-width: 0; overflow: hidden; }
.recall.is-open { border-color: var(--accent); }
.recall-q { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; min-height: 110px; padding: 12px 14px; font: inherit; text-align: left; color: var(--text); background: var(--tint); border: 0; cursor: pointer; }
.recall-q:focus-visible { outline-offset: -4px; }
.recall-text { font-weight: 700; white-space: pre-line; overflow-wrap: anywhere; }
.recall-hint { margin-top: auto; color: var(--accent); font-weight: 700; }
.recall.is-open .recall-hint { display: none; }
.recall.is-open .recall-q { min-height: 0; }
.recall-a { display: none; padding: 12px 14px; }
.recall.is-open .recall-a { display: block; animation: unfold .3s ease; }
.recall-main { font-size: 1.15rem; font-weight: 800; color: var(--accent); }
@keyframes unfold { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- flashcards ---------- */
.flashcard {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%; max-width: 660px; min-height: 260px; margin: 0 auto 10px;
  font: inherit; color: var(--text); background: var(--tint); border: 3px solid var(--accent); border-radius: 20px; padding: 22px; cursor: pointer; text-align: center; box-shadow: var(--shadow);
}
.flashcard.is-back { background: var(--card); border-style: double; border-width: 6px; }
.flashcard:disabled { cursor: default; color: var(--muted); }
.face-tag { font-size: .75rem; font-weight: 800; color: var(--accent); }
.face-text { display: block; max-width: 100%; white-space: pre-line; overflow-wrap: anywhere; }
.face-main { font-size: 1.3rem; font-weight: 800; }
.turn { animation: turn .35s ease; }
@keyframes turn { from { transform: rotateX(75deg); } to { transform: rotateX(0); } }
.flash-below, .flashbox > .btn-row, .flashbox > p[role="status"] { max-width: 660px; margin-left: auto; margin-right: auto; }
.flashbox > .btn-row { justify-content: center; }
.flash-below { margin-bottom: 10px; }

/* ---------- quiz ---------- */
fieldset { border: 0; padding: 0; margin: 0 0 10px; min-width: 0; }
.quiz-question { font-weight: 800; font-size: 1.15rem; padding: 0; margin-bottom: 12px; white-space: pre-line; overflow-wrap: anywhere; }
.option { display: flex; align-items: flex-start; gap: 10px; border: 2px solid var(--line); border-radius: 12px; padding: 11px 14px; margin-bottom: 8px; cursor: pointer; }
.option:hover { border-color: var(--accent); }
.option input { margin-top: 6px; accent-color: var(--accent); flex: 0 0 auto; width: 18px; height: 18px; }
.option-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.option-right { background: var(--good-bg); border: 2px solid var(--good); animation: pop .35s ease; }
.option-wrong { background: var(--bad-bg); border: 2px dashed var(--bad); }
.feedback { border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--line); border-left-width: 6px; }
.feedback .btn { margin-top: 8px; }
.feedback-good { border-left-color: var(--good); }
.feedback-bad { border-left-color: var(--bad); }
.score { font-size: 1.6rem; font-weight: 900; color: var(--accent); }

/* ---------- aakritiyan (figure.js) ---------- */
/* --h = zyada se zyada unchai; chaudai anupaat (--ratio) se, aur jagah kam ho to simat jati hai */
.drawing { --h: 180px; display: block; width: calc(var(--h) * var(--ratio, 1)); max-width: 100%; margin: 0 auto; color: var(--text); }
.drawing svg { display: block; width: 100%; height: auto; overflow: visible; }
.dr-shape { stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.dr-fill-none { fill: none; }
.dr-fill-shade { fill: currentColor; fill-opacity: .24; }
.dr-fill-solid { fill: currentColor; }
.dr-dashed { stroke-dasharray: 6 5; stroke-linecap: butt; }
.dr-dot, .dr-text { fill: currentColor; stroke: none; }
.dr-text { font-family: "Segoe UI", system-ui, "Nirmala UI", "Noto Sans Devanagari", Mangal, sans-serif; font-weight: 600; white-space: pre; }
.drawing-question { --h: 170px; margin: 0 auto 14px; }
.drawing-option { --h: 110px; }
.drawing-thumb { --h: 56px; margin: 4px 0 0; }
.drawing-broken { width: auto; color: var(--bad); }

.figure-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px; }
.figure-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.figure-card > .drawing { margin: auto; }
.figure-card > p { margin: 0; }

/* chitra wale option: naam upar, chitra neeche; 360px par bhi do khaane */
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(128px, 100%), 1fr)); gap: 8px; margin-bottom: 8px; }
.option-grid .option { flex-wrap: wrap; align-content: flex-start; gap: 6px 8px; margin: 0; padding: 8px; min-width: 0; }
.option-grid .option-text { flex-basis: calc(100% - 30px); }
.option-grid .chip { order: 1; } /* "Sahi / Aapka" chitra ke neeche, taaki saare chitra ek line mein rahein */
.option > .drawing { flex: 0 0 100%; }
.art-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100px, 100%), 1fr)); gap: 6px; width: 100%; }
.art-option { display: flex; flex-direction: column; gap: 2px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--card); text-align: center; }
.art-option .drawing { --h: 80px; margin: auto; }
.recall-art { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.recall-art > .drawing-question { margin-bottom: 0; }
.flashcard > .drawing { flex: 0 0 auto; }
.recall-q > .drawing { align-self: center; }

.sheet ul.sheet-figures { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.sheet-figures li { flex: 1 1 150px; min-width: 0; max-width: 100%; text-align: center; }
.sheet-figures .drawing { --h: 110px; }

/* ---------- notes, revise ---------- */
.sheet-preview { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-wrap: anywhere; overflow-x: auto; }
.sheet h3 { margin-top: 0; }
.sheet h4 { margin: 12px 0 4px; color: var(--accent); font-size: 1.05rem; }
.sheet h5 { margin: 8px 0 2px; font-size: .95rem; }
.sheet p { margin: 0 0 3px; }
.sheet ul, .sheet ol { margin: 4px 0; padding-left: 20px; }
.sheet-columns { columns: 2 300px; column-gap: 28px; }
.sheet-table { margin: 4px 0; font-size: .9em; }
.sheet-table th, .sheet-table td { padding: 3px 6px; overflow-wrap: break-word; }
.sheet-formula { font-family: "Cambria Math", Cambria, "Nirmala UI", serif; font-weight: 700; white-space: pre-wrap; }
.mark { font-size: .75rem; font-weight: 700; white-space: nowrap; }
.mark-verified { color: var(--good); }
.mark-disputed { color: var(--warn); }
.mark-unverified { color: var(--bad); }
.sheet-sources { font-size: .8rem; }
.print-url { display: none; }
.revise-list { list-style: none; padding: 0; margin: 0; }
.revise-list li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.revise-text { display: flex; flex-direction: column; flex: 1 1 220px; min-width: 0; }
.revise-list .btn-row { margin: 0; }

#print-root { display: none; }

/* ---------- tablet / mobile ---------- */
@media (max-width: 960px) {
  .layout { display: block; }
  .topic-bar .menu-btn { display: inline-flex; }
  .crumb-wide { display: none; }
  .sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(330px, 88vw); max-height: none; border-radius: 0 16px 16px 0; transform: translateX(-102%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
  .sidebar.open { transform: none; visibility: visible; transition: transform .25s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .side-close { display: inline-flex; float: right; margin-left: 8px; }
  .side-subject { min-height: 38px; }
  html.menu-open { overflow: hidden; }
}
@media (max-width: 700px) {
  .bar-top { gap: 6px; padding: 8px 8px; }
  .brand-full { display: none; }
  .brand-short { display: inline; }
  .bar-top .btn { padding: 4px 8px; font-size: .85rem; }
  .searchbox { position: static; }
  input[type="search"] { padding: 7px 8px; }
  .search-panel { left: 8px; right: 8px; top: 100%; max-height: 60vh; }
  .topic-bar-in { padding: 5px 8px; gap: 8px; }
  main { padding: 12px 10px 24px; }
  .panel { padding: 14px 12px; border-radius: 14px; }
  .hero { border-radius: 16px; }
  .hero-ring { top: 12px; right: 12px; }
  .home-hero .hero-ring, .subject-hero .hero-ring { position: static; flex-direction: row; max-width: none; margin-top: 12px; text-align: left; }
  .home-hero:has(.hero-ring) > h1, .home-hero:has(.hero-ring) > .lead, .subject-hero > h1 { padding-right: 0; }
  .subject-hero { flex-wrap: wrap; gap: 12px; }
  .subject-hero > div:nth-child(2) { flex: 1 1 100%; }
  .subject-hero .subject-icon { width: 56px; height: 56px; }
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: 10px; }
  .tile { padding: 12px; }
  .tile-about { display: none; }
  .tile-top .subject-icon { width: 44px; height: 44px; }
  .tile-name { font-size: 1.05rem; }
  .tile-count { margin-top: auto; }
  /* Mobile par naam photo ke upar: chehra aur naam ek saath dikhein */
  .person-hero { display: flex; flex-direction: column; gap: 0; }
  .person-intro { display: contents; }
  .person-intro > * { order: 2; }
  .person-intro > .kicker, .person-intro > .view-title { order: 0; }
  .person-hero .portrait { order: 1; width: 100%; max-width: 300px; margin: 4px auto 16px; }
  .unit-grid-people { grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
  .life-strip { grid-template-columns: minmax(0, 1fr); }
  .life-line { width: 8px; height: 34px; background: linear-gradient(180deg, var(--accent), var(--muted)); animation: none; }
  .life-span { padding: 4px; }
  .life-span p { margin: 0; }
  .block-head > .icon { width: 32px; height: 32px; padding: 6px; }
  .notes li { padding: 52px 12px 12px; }
  .vtl::before, .vtl::after { left: 11px; width: 4px; }
  .vt-row { grid-template-columns: minmax(0, 1fr); gap: 4px; padding-left: 38px; }
  .vt-when { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding-top: 2px; }
  .vt-num { width: 27px; height: 27px; font-size: .75rem; }
  .vt-gap { margin-left: 38px; }
  .vt-date { font-size: 1.15rem; }
  .vt-card { padding: 10px 12px; }
  .strip { padding: 8px 6px 6px; }
  .strip-dot { width: 20px; height: 20px; margin-left: -10px; }
  .flow-step { gap: 10px; }
  .flow-num { width: 32px; height: 32px; }
  .flow-step:not(:last-child)::before { left: 14px; top: 30px; }
  .flow-step:not(:last-child)::after { left: 7px; }
  .flow-card { padding: 8px 12px 10px; }
  .formula { font-size: 1.2rem; }
  /* Table: har row ek card */
  .data-table, .data-table tbody, .data-table tr, .data-table tbody th, .data-table td { display: block; width: auto !important; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .data-table tr { border: 2px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
  .data-table tbody th, .data-table td { border: 0; border-bottom: 1px solid var(--line); }
  .data-table td::before, .data-table tbody th::before { content: attr(data-label); display: block; font-size: .75rem; font-weight: 800; color: var(--muted); }
  .data-table td.col-proof::before { content: none; }
  .data-table .item-foot { flex-direction: row; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .arrow-hint { display: none; }
  .life-row, .axis-row { grid-template-columns: minmax(0, 1fr); padding: 0 6px; }
  .axis-row .life-label { display: none; }
  .life-label { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: baseline; gap: 2px 10px; padding: 6px 0 0; }
  .track { min-height: 30px; }
  .tick-alt { display: none; }
  .scrubbing .readout { height: 210px; font-size: .9rem; }
  .readout-events { order: -1; }
}
@media (max-width: 420px) {
  .topic-bar .menu-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .status-tiles .badge { font-size: .65rem; padding: 1px 4px; }
}
@media (max-width: 960px) and (max-height: 500px) {
  .site-header { position: static; }
  html { scroll-padding-top: 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .hl { box-shadow: 0 0 0 4px var(--warn); }
  .tile:hover, .topic-card > a:hover, .unit-card:hover { transform: none; }
}

/* ---------- print ---------- */
@media print {
  :root, :root[data-theme="dark"], [data-subject], :root[data-theme="dark"] [data-subject] {
    --bg: #fff; --card: #fff; --soft: #fff; --tint: #fff; --text: #000; --muted: #333; --line: #bbb; --accent: #143a9e; --accent-text: #fff; --link: #000;
    --good: #0b4d2a; --good-bg: #fff; --warn: #6b4400; --warn-bg: #fff; --bad: #8a1212; --bad-bg: #fff; --shadow: none; --hero-bg: #fff; --hero-text: #000;
    --m0: #b3261e; --m1: #0b5cad; --m2: #1b6b2f; --m3: #7a3db8; --m4: #8a5200; --m5: #0f6b6b;
    color-scheme: light;
  }
  @page { margin: 12mm; }
  body { font-size: 11pt; line-height: 1.45; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; animation: none !important; transition: none !important; }
  .kr-home, .site-header, .site-footer, .skip, .btn, .btn-row, .toolbar, .sidebar, .backdrop, .jump, .unit-foot, .hero-actions, .hero-ring, .chart-controls, .readout, .strip, .flow-controls, .map-tools, .map-game, .map-info, .recall-hint, .switcher { display: none !important; }
  .layout { display: block; }
  main { max-width: none; padding: 0; }
  .view { margin: 0; }
  .hero, .panel { border: 0; padding: 0; box-shadow: none; }
  .hero.home-hero { background: #fff; color: #000; }
  h2, h3, h4, h5 { break-after: avoid; }
  .vt-item, .info-card, .trick, .life-card, .life-row, .sheet-unit li, tr, figure, .flow-step, .example, .formula-card, .map-item, .recall, .notes li { break-inside: avoid; }
  .animate-ready .vt-item .vt-card { transform: none !important; border-style: solid !important; }
  .animate-ready .vt-item .vt-num { background: var(--accent) !important; color: #fff !important; transform: none !important; }
  .vtl::after { height: 100% !important; }
  :focus, :focus-visible { outline: none !important; }
  /* Chhupa hua jawab bhi chhape */
  .veiled { display: block !important; }
  li.veiled { display: list-item !important; }
  .recall-a { display: block !important; }
  .flow.walking .is-ahead .flow-card h3, .flow.walking .is-ahead .flow-body { display: block; }
  .flow.walking .is-ahead .flow-card::after { content: none; }
  .map-item.is-filtered { display: block; }
  .map-list.in-game { display: grid; }
  .bar-lived { width: 100% !important; }
  .cursor { display: none !important; }
  .not-alive .bar { opacity: 1; }
  .dot { opacity: 1 !important; }
  .person-hero { grid-template-columns: 150px minmax(0, 1fr); }
  .sheet-preview { border: 0; padding: 0; overflow: visible; }
  .sheet { font-size: 10pt; }
  .sheet-columns { columns: 2; }
  .print-url { display: inline; font-size: 8pt; overflow-wrap: anywhere; }
  th, td { overflow-wrap: anywhere; }

  /* Sirf short notes */
  .printing-notes body > * { display: none !important; }
  .printing-notes body > #print-root { display: block !important; }
}
