/* Swipe slides, styled like a phone app: app bar + part segments on top, content cards on a soft surface,
   bottom action bar with a big Next button. Desktop: same app look, content up to 1100px in two columns. */
:root { --surface: #eef2f7; --chip: #e2ebf5; --shadow: 0 1px 2px rgba(20,40,80,.06), 0 4px 14px rgba(20,40,80,.07); }
html, body.sl-body { height: 100%; }
body.sl-body { margin: 0; overflow: hidden; background: var(--surface); -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, "Noto Sans Devanagari", sans-serif; }
.sl-app { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--surface); }

/* app bar */
.sl-top { flex: none; background: var(--navy); color: #fff; padding-top: env(safe-area-inset-top, 0px);
  box-shadow: 0 2px 10px rgba(16,33,58,.18); z-index: 3; }
.sl-appbar { display: flex; align-items: center; gap: 6px; height: 54px;
  padding: 0 max(6px, env(safe-area-inset-right, 0px)) 0 max(6px, env(safe-area-inset-left, 0px)); }
.sl-icon { flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; background: none; color: #fff; display: grid; place-items: center;
  cursor: pointer; text-decoration: none; }
.sl-icon:active { background: rgba(255,255,255,.16); }
.sl-icon svg, .sl-prev svg, .sl-next svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sl-where { flex: 1; min-width: 0; line-height: 1.2; }
.sl-where b { display: block; font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-where span { display: block; font-size: 12.5px; opacity: .78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-lang { display: flex; background: rgba(255,255,255,.12); border-radius: 16px; padding: 2px; flex: none; }
.sl-lang button { border: 0; background: none; color: #fff; font-size: 12.5px; font-weight: 600; padding: 5px 9px; border-radius: 14px; cursor: pointer; opacity: .75; }
.sl-lang button.on { background: #fff; color: var(--navy); opacity: 1; }

/* one progress segment per part, like stories */
.sl-segs { display: flex; gap: 3px; padding: 0 max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); }
.sl-segs i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.22); overflow: hidden; cursor: pointer; }
.sl-segs b { display: block; height: 100%; width: 0; background: #7fe0a8; border-radius: 2px; transition: width .25s; }

/* track */
.sl-track { flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  scrollbar-width: none; overscroll-behavior-x: contain; }
.sl-track::-webkit-scrollbar { display: none; }
.sl-slide { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto;
  overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
.sl-in { box-sizing: border-box; min-height: 100%; display: flex; flex-direction: column; gap: 10px;
  padding: 14px max(12px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
.sl-kicker { align-self: flex-start; max-width: 100%; box-sizing: border-box; background: var(--chip); color: var(--navy); border-radius: 14px;
  padding: 4px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-card { background: #fff; border-radius: 18px; padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.sl-more { position: sticky; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); margin: -34px auto 0; width: max-content; height: 26px; line-height: 26px;
  padding: 0 12px; border-radius: 13px; background: var(--navy); color: #fff; font-size: 12px; pointer-events: none; opacity: 0; transition: opacity .2s; }
.sl-slide.has-more .sl-more { opacity: .85; }

/* slide content keeps the chapter-page look (.notes) */
.sl-units { display: grid; gap: 10px; align-content: start; font-size: 16.5px; line-height: 1.55; }
.sl-units .sl-unit { min-width: 0; }
.sl-units .sl-unit > :first-child { margin-top: 0; }
.sl-units .sl-unit > :last-child { margin-bottom: 0; }
.notes.sl-units .box { margin: 8px 0; }
.notes.sl-units > .sl-unit > .box:first-child { margin-top: 0; }
.notes.qa .q { margin-top: 0; }
.notes.qa .sl-unit + .sl-unit { border-top: 1px solid var(--grid); padding-top: 10px; }
.notes details.ans summary { display: inline-flex; align-items: center; gap: 6px; list-style: none; background: var(--eq); color: #1F4E9A;
  border-radius: 18px; padding: 6px 14px; margin: 4px 0; font-weight: 600; }
.notes details.ans summary::-webkit-details-marker { display: none; }
.notes details.ans[open] summary { background: var(--hing); color: #1E6B43; }
.notes .tablewrap { max-width: 100%; -webkit-overflow-scrolling: touch; }

/* cover */
.sl-cover .sl-in { gap: 14px; }
.sl-hero { background: linear-gradient(150deg, var(--navy), #2C5F8A); color: #fff; border-radius: 22px; padding: 22px 18px; box-shadow: var(--shadow); }
.sl-chip { display: inline-block; background: rgba(255,255,255,.16); border-radius: 14px; padding: 3px 12px; font-size: 12.5px; font-weight: 600; }
.sl-hero h1 { font-size: 32px; line-height: 1.12; color: #fff; margin: 12px 0 6px; text-wrap: balance; text-align: left; }
.sl-sub { margin: 0; opacity: .85; font-size: 14.5px; }
.sl-parts { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; background: #fff; border-radius: 18px; box-shadow: var(--shadow); counter-reset: p; }
.sl-parts button, .sl-toc button[data-go] { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: none; border-radius: 12px;
  padding: 10px 10px; color: var(--ink); font-size: 15px; text-align: left; cursor: pointer; }
.sl-parts button:active, .sl-toc button[data-go]:active { background: var(--surface); }
.sl-parts li { counter-increment: p; }
.sl-parts button::before, .sl-toc li button::before { content: counter(p); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--chip);
  color: var(--navy); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }
.sl-parts button::after, .sl-toc li button::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 20px; }
.sl-help { color: var(--muted); font-size: 13px; margin: 0; text-align: center; }
.sl-btn { display: block; text-align: center; border: 0; border-radius: 14px; padding: 14px 16px; font-size: 16px; font-weight: 650; cursor: pointer;
  background: var(--hingbar); color: #fff; text-decoration: none; box-shadow: 0 3px 10px rgba(46,139,87,.3); }
.sl-btn.alt { background: #fff; color: var(--navy); border: 1px solid var(--grid); box-shadow: none; }
.sl-hero .sl-btn { margin-top: 16px; width: 100%; background: #fff; color: var(--navy); box-shadow: none; }

/* quick check */
.sl-qh { margin: 0 0 4px; color: var(--hingbar); font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.sl-qtext { font-size: 18px; font-weight: 650; margin-bottom: 12px; }
.sl-opts { display: grid; gap: 10px; }
.sl-opts button { display: flex; gap: 12px; align-items: center; text-align: left; border: 1.5px solid var(--grid); border-radius: 14px; background: #fff;
  padding: 13px 12px; font-size: 16px; cursor: pointer; color: var(--ink); transition: transform .08s; }
.sl-opts button:active { transform: scale(.98); }
.sl-opts button span { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); display: grid; place-items: center;
  font-weight: 700; color: var(--muted); }
.sl-opts button.right { border-color: #2F855A; background: var(--hing); }
.sl-opts button.right span { background: #2F855A; color: #fff; }
.sl-opts button.wrong { border-color: var(--red); background: var(--exam); }
.sl-opts button.wrong span { background: var(--red); color: #fff; }
.sl-why { margin-top: 12px; background: var(--ans); border-radius: 14px; padding: 12px; }
.sl-hing { margin-top: 8px; background: var(--hing); color: #1E4D33; border-left: 4px solid var(--hingbar); border-radius: 8px; padding: 6px 10px; }
.lang-en .sl-hing { display: none; }
.sl-note { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }

/* finish */
.sl-end .sl-in { justify-content: center; align-items: center; text-align: center; }
.sl-ring { width: 104px; height: 104px; border-radius: 50%; background: var(--hingbar); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(46,139,87,.35); }
.sl-ring div { color: #fff; font-size: 48px; line-height: 1; }
.sl-end h2 { color: var(--navy); margin: 10px 0 0; text-wrap: balance; }
.sl-end p { color: var(--muted); margin: 0; }
.sl-btns { display: grid; gap: 10px; width: 100%; max-width: 380px; margin-top: 8px; }

/* bottom action bar */
.sl-nav { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 12px;
  padding: 10px max(14px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid rgba(20,40,80,.08); }
.sl-prev { flex: none; width: 50px; height: 50px; border-radius: 50%; border: 1px solid var(--grid); background: #fff; color: var(--navy);
  display: grid; place-items: center; cursor: pointer; }
.sl-prev:disabled { opacity: .35; cursor: default; }
.sl-count { flex: none; min-width: 64px; text-align: center; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.sl-next { flex: 1; height: 50px; border: 0; border-radius: 25px; background: var(--navy); color: #fff; font-size: 16.5px; font-weight: 650;
  display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; transition: transform .08s; }
.sl-next:active, .sl-prev:active { transform: scale(.96); }
.sl-next:disabled { background: var(--hingbar); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* first-time swipe hint */
.sl-swipe { position: absolute; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 4;
  background: rgba(16,33,58,.88); color: #fff; padding: 8px 16px; border-radius: 20px; font-size: 14px; white-space: nowrap; pointer-events: none; }
.sl-swipe span { display: inline-block; animation: sl-nudge 1.2s ease-in-out infinite; }
@keyframes sl-nudge { 0%, 100% { transform: translateX(6px); } 50% { transform: translateX(-6px); } }

/* parts sheet */
.sl-toc { position: absolute; inset: 0; background: rgba(16,33,58,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sl-toc[hidden], .sl-why[hidden], .sl-swipe[hidden] { display: none; }
.sl-tocbox { background: #fff; width: 100%; max-width: 560px; max-height: 82%; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom, 0px)); animation: sl-up .22s ease-out; }
.sl-tocbox::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--grid); margin: 2px auto 8px; }
@keyframes sl-up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.sl-tochead { display: flex; justify-content: space-between; align-items: center; padding: 0 6px 6px; font-size: 17px; }
.sl-tochead button { border: 0; background: var(--surface); width: 32px; height: 32px; border-radius: 50%; font-size: 15px; cursor: pointer; }
.sl-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: p; }
.sl-toc li { counter-increment: p; }
.sl-toc li.cur button { background: var(--eq); font-weight: 700; color: var(--navy); }

/* narrow phones: language shows only the current choice; tap it to switch to the next */
@media (max-width: 560px) {
  .sl-lang button:not(.on) { display: none; }
  .sl-lang button.on { padding: 5px 10px; }
  .sl-lang button.on::after { content: " ⇄"; font-size: 11px; }
}

/* desktop and wide tablets: full width, two columns */
@media (min-width: 900px) {
  .sl-appbar, .sl-segs, .sl-in, .sl-nav { padding-left: max(24px, calc((100% - 1100px) / 2)); padding-right: max(24px, calc((100% - 1100px) / 2)); }
  .sl-appbar { height: 60px; }
  .sl-in { padding-top: 24px; gap: 14px; }
  .sl-card { padding: 24px 28px; border-radius: 22px; }
  .notes.sl-units { font-size: 18px; }
  .notes.sl-units.n1 { max-width: 860px; width: 100%; margin: 0 auto; }
  .notes.sl-units.n2, .notes.sl-units.n3, .notes.sl-units.n4 { grid-template-columns: 1fr 1fr; gap: 16px 36px; }
  .notes.sl-units.n3:not(.qa) .sl-unit:first-child { grid-column: 1 / -1; }
  .notes.qa .sl-unit + .sl-unit { border-top: 0; padding-top: 0; }
  .sl-cover .sl-in { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 24px; }
  .sl-hero { padding: 36px 32px; }
  .sl-hero h1 { font-size: 52px; }
  .sl-help { grid-column: 1 / -1; }
  .sl-quiz .sl-card { max-width: 860px; width: 100%; margin: 0 auto; box-sizing: border-box; }
  .sl-quiz .sl-kicker { margin-left: max(0px, calc((100% - 860px) / 2)); }
  .sl-opts { grid-template-columns: 1fr 1fr; }
  .sl-opts button { padding: 16px; font-size: 17px; }
  .sl-qtext { font-size: 20px; }
  .sl-nav { justify-content: center; }
  .sl-next { flex: 0 0 260px; }
  .sl-toc { align-items: center; }
  .sl-tocbox { border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .sl-segs b { transition: none; } .sl-swipe span, .sl-tocbox { animation: none; }
}

/* topic title slide (start of every topic in the whole-chapter deck) */
.sl-topic .sl-in { justify-content: center; align-items: center; }
.sl-tcard { width: 100%; max-width: 560px; box-sizing: border-box; border-radius: 24px; padding: 34px 24px; color: #fff; text-align: center;
  background: radial-gradient(circle at 85% 15%, rgba(255,255,255,.14) 0 40px, transparent 41px), linear-gradient(150deg, var(--navy), #2C5F8A);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.sl-tno { background: rgba(255,255,255,.16); border-radius: 14px; padding: 4px 12px; font-size: 13px; font-weight: 700; }
.sl-tlabel { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #7fe0a8; margin-top: 6px; }
.sl-tcard h2 { margin: 0; font-size: 28px; line-height: 1.2; color: #fff; text-wrap: balance; }
.sl-tcard p { margin: 4px 0 0; opacity: .85; }
.sl-toclinks { display: flex; gap: 8px; padding: 12px 6px 4px; border-top: 1px solid var(--grid); margin-top: 8px; }
.sl-toclinks a { flex: 1; text-align: center; padding: 10px 6px; border-radius: 12px; background: var(--surface); color: var(--navy); text-decoration: none; font-weight: 600; font-size: 14px; }
@media (min-width: 900px) { .sl-tcard { padding: 48px 32px; } .sl-tcard h2 { font-size: 38px; } }

/* cover: one centred card */
.sl-cover .sl-in { justify-content: center; align-items: center; }
.sl-cover .sl-hero { width: 100%; max-width: 640px; box-sizing: border-box; }
@media (min-width: 900px) { .sl-cover .sl-in { display: flex; } }

/* topic title slide uses the topic-card look from style.css (.tcard) */
.sl-tc { width: 100%; max-width: 560px; }
.sl-tc:hover { transform: none; }
.sl-tc .tcover { height: 220px; }
.sl-tc .tthumb { max-width: 86%; max-height: 160px; }
.sl-tc .tthumb .fig svg, .sl-tc .tthumb > svg { max-height: 130px; }
.sl-tc .tglyph { font-size: 96px; }
.sl-tc .tbody { padding: 16px 18px 18px; }
.sl-tc .tbody h3 { font-size: 24px; }
.sl-tc .tdek { -webkit-line-clamp: 4; font-size: 15px; }
@media (min-width: 900px) { .sl-tc { max-width: 640px; } .sl-tc .tcover { height: 260px; } .sl-tc .tbody h3 { font-size: 28px; } }

/* "Topics" button in the app bar */
.sl-topicsbtn { flex: none; display: flex; align-items: center; gap: 5px; border: 0; background: #fff; color: var(--navy); border-radius: 18px;
  padding: 7px 12px 7px 10px; font-size: 14px; font-weight: 700; cursor: pointer; margin-right: 4px; }
.sl-topicsbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.sl-topicsbtn:active { transform: scale(.96); }
@media (max-width: 400px) { .sl-where span { display: none; } }

/* search inside the Topics panel */
.sl-search { padding: 0 6px 8px; }
.sl-search input { width: 100%; box-sizing: border-box; border: 1.5px solid var(--grid); border-radius: 14px; padding: 11px 14px; font-size: 16px; background: var(--surface); }
.sl-search input:focus { outline: none; border-color: var(--navy); background: #fff; }
.sl-results { display: grid; gap: 4px; padding: 0 6px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--grid); }
.sl-rhead { margin: 2px 4px 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.sl-results button { display: block; text-align: left; border: 0; background: var(--surface); border-radius: 12px; padding: 9px 12px; font-size: 14px; line-height: 1.45; color: var(--ink); cursor: pointer; }
.sl-results button span { display: block; font-size: 12px; font-weight: 700; color: var(--teal); }
.sl-results mark { background: var(--mark); border-radius: 3px; padding: 0 2px; }
.sl-toc li[hidden] { display: none; }
.sl-notesbtn { display: block; margin: 0 6px 10px; padding: 11px 14px; border-radius: 12px; background: var(--hing); color: #1E6B43; font-weight: 700; text-decoration: none; text-align: center; }
.sl-toc .sl-results button[data-go] { display: block; width: 100%; padding: 9px 12px; gap: 0; }
.sl-toc .sl-results button[data-go]::before, .sl-toc .sl-results button[data-go]::after { content: none; display: none; }
.sl-notesbtn.alt { background: var(--eq); color: var(--navy); margin-top: 10px; }


/* XP star counter in the slide bar */
.sl-xp { flex: none; background: rgba(255,255,255,.14); color: #FFE873; border-radius: 14px; padding: 5px 9px; font-size: 13px; font-weight: 800; }
.sl-xp b { color: #fff; }
.sl-xp.bump { animation: xpbump .5s ease; }
@keyframes xpbump { 30% { transform: scale(1.3); background: #FFE873; } 100% { transform: none; } }
@media (max-width: 400px) { .sl-xp { padding: 5px 7px; font-size: 12px; } }
