/* ==========================================================
   Class 8 Science · Section 10 · অম্ল, ক্ষারক ও লবণ
   Theme: "লিটমাস-গোয়েন্দার খাতা" — a detective's notebook on a
   Bangladeshi kitchen shelf. Blush litmus-paper page, slate-ink
   topbar/player with a red | purple | blue litmus stripe;
   acid red, base blue, neutral litmus purple, lichen sage, lemon.
   Band কৌতূহলী (13–14).
   ========================================================== */
:root {
  --bg: #f8f0f3;
  --page: #fffdfd;
  --ink: #2a1f2b;
  --ink-2: #625463;
  --slate: #1f2433;
  --slate-2: #2d3447;
  --acid: #d6304f;
  --acid-d: #9e1d36;
  --acid-s: #fde3e8;
  --base: #2563c4;
  --base-d: #18438a;
  --base-s: #e2ebfb;
  --neut: #7b4fa8;
  --neut-d: #563479;
  --neut-s: #efe6f7;
  --lichen: #7f9a6b;
  --lichen-s: #e9efe2;
  --lemon: #f2c230;
  --line: #e8d6dd;
  --ok: #2f7a3a;
  --no: #b0302a;
}
* { box-sizing: border-box; }
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 95% 0%, rgba(37, 99, 196, .08), transparent 36%),
    radial-gradient(circle at 0% 25%, rgba(214, 48, 79, .07), transparent 40%),
    var(--bg);
}
::selection { background: rgba(123, 79, 168, .25); }
a { color: var(--base-d); }
strong { color: var(--neut-d); }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 2000; }
.skip:focus { left: 8px; }
main, .wrap, .lesson-part > *, .hero-grid > *, .neut-grid > * { min-width: 0; }
sub { line-height: 0; }

/* top bar: slate with a litmus stripe */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: .4rem 1rem; flex-wrap: wrap; padding: .5rem var(--gutter) calc(.5rem + 5px); background: var(--slate); color: #eef0f7; font-size: var(--fs-sm); }
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: linear-gradient(90deg, var(--acid) 0 33%, var(--neut) 33% 67%, var(--base) 67%); }
.crumbs { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.crumbs a { color: #cfd5ea; text-decoration: none; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.crumbs [aria-current] { color: #ffc2cf; font-weight: 700; }
.level { display: flex; align-items: center; gap: .45rem; font-weight: 800; color: #fff; }
.strip-badge { width: 4.6rem; height: 1.1rem; }
.level.pop .strip-badge { animation: dip .55s; }
@keyframes dip { 35% { transform: translateY(3px) scaleY(1.1); } 70% { transform: translateY(-1px); } }

/* hero */
.hero { padding: clamp(1.4rem, 4vw, 2.8rem) 0 2rem; }
.hero-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1fr 1.05fr; } }
.eyebrow { display: inline-block; color: #fff; background: var(--neut); font-weight: 800; padding: .1rem .9rem; border-radius: 999px; font-size: var(--fs-sm); }
h1 { font-size: var(--fs-3xl); line-height: 1.3; margin: .8rem 0 1rem; color: var(--slate); }
.lede { font-size: var(--fs-lg); line-height: 1.75; }
.hint { color: var(--ink-2); border-left: 4px solid var(--neut); padding-left: .8rem; }
.shelf { margin: 0; border-radius: 16px; overflow: hidden; background: var(--slate); border: 4px solid var(--slate); box-shadow: 0 18px 40px rgba(31, 36, 51, .28); }
.shelf > svg { display: block; width: 100%; height: auto; background: #fbf4ea; }
#hero-svg .jar { cursor: pointer; }
#hero-svg .jar:focus { outline: none; }
#hero-svg .jar:focus-visible rect.glass { stroke: #1d7bff; stroke-width: 4; }
.hero-read { margin: 0; padding: .5rem 1rem; background: var(--slate); color: #fff; font-weight: 700; min-height: 3.4em; }

/* blocks */
.block { padding-block: clamp(1.6rem, 4vw, 3rem); }
.lesson-part.alt { background: rgba(255, 253, 253, .65); border-block: 1px solid var(--line); }
.sec-title, .lesson-part h2, #compare h2, #activity h2, #quiz h2, .story h2 { font-size: var(--fs-2xl); line-height: 1.4; margin: .3rem 0 1rem; color: var(--slate); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.story h2 { font-size: var(--fs-xl); }
.sub-title { font-size: var(--fs-xl); margin: 2rem 0 .8rem; color: var(--neut-d); }
.part-tag { display: inline-flex; align-items: center; gap: .5rem; margin: 0; font-weight: 800; color: var(--neut-d); font-size: var(--fs-sm); }
.part-tag::before { content: ''; width: 10px; height: 20px; border-radius: 2px; background: linear-gradient(var(--acid) 0 50%, var(--base) 50%); box-shadow: 0 0 0 1.5px var(--slate); }
.goals { display: grid; gap: .6rem; padding: 0; list-style: none; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); }
.goals li { position: relative; background: var(--page); border-radius: 10px; padding: .8rem 1rem .8rem 2.6rem; border: 1px solid var(--line); }
.goals li::before { content: ''; position: absolute; left: 1rem; top: 1rem; width: 10px; height: 22px; border-radius: 2px; background: linear-gradient(var(--neut) 0 40%, #f3e9f7 40%); box-shadow: 0 0 0 1px var(--neut-d); }

/* notebook card: ruled margin line + a litmus tab */
.card { position: relative; background: var(--page); border-radius: 12px; padding: clamp(1rem, 3vw, 1.6rem); border: 1px solid var(--line); border-left: 6px solid var(--neut); box-shadow: 0 8px 22px rgba(42, 31, 43, .07); overflow: hidden; }
.card::after { content: ''; position: absolute; right: 14px; top: 0; width: 12px; height: 30px; border-radius: 0 0 3px 3px; background: linear-gradient(var(--acid) 0 50%, var(--base) 50%); opacity: .85; }
.card h3 { margin: 0 0 .5rem; font-size: var(--fs-lg); display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; color: var(--slate); padding-right: 2rem; }
.widget { margin: 1.6rem 0; }
.def { margin: 1rem 0; background: var(--neut-s); border-left: 5px solid var(--neut); border-radius: 6px; padding: .8rem 1rem; }
.def b:first-child { color: var(--neut-d); }
.remember { margin: 1.4rem 0 .4rem; background: var(--lichen-s); border-radius: 10px; padding: .9rem 1rem; border: 2px dashed var(--lichen); }
.remember > b:first-child { display: inline-block; background: #5a7448; color: #fff; padding: 0 .7rem; border-radius: 999px; margin-right: .4rem; }
.note-fix { background: #fff7e0; border: 1.5px dashed #c99a1a; border-radius: 8px; padding: .6rem .9rem; margin: .8rem 0; font-size: var(--fs-sm); }
.note-fix b:first-child { color: var(--acid-d); }
.warn-box { display: flex; gap: .5rem; align-items: flex-start; background: var(--acid-s); border-radius: 8px; padding: .6rem .9rem; font-weight: 700; color: var(--acid-d); }
.warn-box .ic { flex: none; margin-top: .25rem; }
.stem-card { border-left-color: var(--lemon); }
.safety { border-left-color: var(--acid); margin: 1.6rem 0; }

.fig { display: block; width: 100%; height: auto; }
#lemon-svg, #lime-svg, #ion-svg, #alk-svg, #bench-svg, #salt-svg { max-width: 560px; margin-inline: auto; background: #fbf4ea; border: 1px solid var(--line); border-radius: 10px; }
.clickable { cursor: pointer; }
.clickable:focus { outline: none; }
.clickable:focus-visible { outline: 3px solid #1d7bff; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.chips button, .seg button { border: 1.5px solid #d9c5d0; background: #fff; color: var(--ink); border-radius: 999px; padding: .1rem .85rem; font: inherit; font-size: var(--fs-sm); cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; box-shadow: 0 2px 0 #eadbe2; }
.chips button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--slate); color: #fff; border-color: var(--slate); box-shadow: 0 2px 0 #000; }
.chips button.done { opacity: .45; text-decoration: line-through; cursor: default; }
.chips button.tried { border-color: var(--neut); }
.chips button.bad, .seg button.bad { animation: shake .4s; border-color: var(--no); }
.seg { display: inline-flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; }
.slider { display: flex; align-items: center; gap: .6rem; font-weight: 700; flex-wrap: wrap; margin: .6rem 0; }
.slider input { accent-color: var(--neut); width: 14rem; max-width: 100%; }
.btn { font: inherit; font-weight: 800; border: 0; background: var(--neut); color: #fff; padding: .3rem 1.1rem; border-radius: 999px; cursor: pointer; box-shadow: 0 3px 0 var(--neut-d); margin: .2rem 0; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--neut-d); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.strip-red { background: var(--acid); box-shadow: 0 3px 0 var(--acid-d); }
.btn.strip-blue { background: var(--base); box-shadow: 0 3px 0 var(--base-d); }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid #d9c5d0; box-shadow: 0 3px 0 var(--line); }
.row-btns { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .4rem 0; }
.msg { min-height: 1.8em; font-weight: 700; margin: .5rem 0; }
.msg.ok { color: var(--ok); } .msg.no { color: var(--no); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.eq { font-weight: 700; text-align: center; font-size: var(--fs-lg); min-height: 1.6em; margin: .4rem 0; overflow-wrap: anywhere; }
.eq-card { background: var(--page); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin: 1rem 0; text-align: center; }
.eq-line { font-size: var(--fs-lg); font-weight: 700; margin: .3rem 0; overflow-wrap: anywhere; }
.eq-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin: 0 0 .6rem; font-size: var(--fs-sm); }
.eq-tags span { border-radius: 999px; padding: 0 .7rem; background: #eee; }
.eq-tags .t-acid { background: var(--acid-s); color: var(--acid-d); }
.eq-tags .t-base { background: var(--base-s); color: var(--base-d); }
.eq-tags .t-salt { background: var(--neut-s); color: var(--neut-d); }

/* observation tables */
.obs { width: 100%; border-collapse: collapse; min-width: 22rem; font-size: var(--fs-sm); }
.obs th, .obs td { border: 1px solid var(--line); padding: .35rem .5rem; text-align: center; }
.obs th { background: var(--slate); color: #fff; }
.obs td:first-child { text-align: left; font-weight: 700; background: #faf3f6; }
.sw { display: inline-block; width: 1.1rem; height: 1.1rem; border-radius: 3px; vertical-align: -.2rem; margin-right: .3rem; border: 1px solid rgba(0, 0, 0, .25); }

/* sorter rows */
.sorter { list-style: none; padding: 0; margin: .6rem 0; display: grid; gap: .5rem; }
.sorter li { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; justify-content: space-between; padding: .45rem .7rem; border-radius: 10px; background: #fff; border: 1px solid var(--line); border-left: 6px solid #d9c5d0; }
.sorter li .t { flex: 1 1 10rem; font-weight: 700; }
.sorter li .seg { margin: 0; }
.sorter li .seg button { font-size: .92rem; }
.sorter li .why { flex-basis: 100%; font-size: var(--fs-sm); color: var(--ink-2); margin: 0; }
.sorter li.ok { background: #eef7ec; border-left-color: var(--ok); }
.sorter li.bad { animation: shake .4s; border-left-color: var(--no); }

/* steps list */
.steps-list { margin: .4rem 0; padding-left: 1.6rem; list-style-type: bengali; font-size: var(--fs-sm); }
.steps-list li { margin: .15rem 0; color: var(--ink-2); }
.steps-list li.on { color: var(--ink); font-weight: 800; }
.steps-list li.done { color: var(--ok); }

/* use cards */
.use-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); margin: .6rem 0; }
.use-card { font: inherit; text-align: left; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: .6rem .8rem; cursor: pointer; color: var(--ink); min-height: 7.2rem; display: flex; flex-direction: column; gap: .25rem; }
.use-card .ic { width: 2rem; height: 2rem; }
.use-card b { color: var(--slate); }
.use-card .back { display: none; font-size: var(--fs-sm); }
.use-card .chem { font-weight: 800; }
.use-card.open { border-color: var(--tone, var(--neut)); background: var(--tone-s, var(--neut-s)); }
.use-card.open .back { display: block; }
.use-card.open .hint-t { display: none; }
.use-card .hint-t { font-size: var(--fs-sm); color: var(--ink-2); }

/* sorter boxes */
.boxes { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); margin: .6rem 0; }
.box { font: inherit; text-align: left; border: 2px dashed #d9c5d0; border-radius: 12px; background: #fff; padding: .5rem .8rem; min-height: 6rem; cursor: pointer; color: var(--ink); }
.box b { display: block; color: var(--tone, var(--neut-d)); }
.box ul { list-style: none; padding: 0; margin: .3rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.box li { background: var(--tone-s, var(--neut-s)); border-radius: 999px; padding: 0 .6rem; font-size: var(--fs-sm); }

/* neutralisation */
.neut-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 760px) { .neut-grid { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); } }
#neut-svg { max-width: 300px; margin-inline: auto; background: #fbf4ea; border: 1px solid var(--line); border-radius: 10px; }
.chart-box { position: relative; height: 260px; }
.chart-note { font-size: var(--fs-sm); color: var(--ink-2); background: var(--lichen-s); border-radius: 8px; padding: .4rem .7rem; }

/* flower tubes */
.tubes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: .6rem 0; }
@media (min-width: 640px) { .tubes { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.tube { font: inherit; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .2rem; color: var(--ink); font-size: .85rem; line-height: 1.3; text-align: center; padding: 0; }
.tube svg { width: 2.4rem; height: 6rem; }
.tube:focus-visible { outline: 3px solid #1d7bff; border-radius: 6px; }

/* player */
.player { border-radius: 16px; background: var(--slate); padding: clamp(.5rem, 2vw, 1rem); color: #fff; box-shadow: 0 16px 36px rgba(31, 36, 51, .3); }
.stage { position: relative; border-radius: 10px; overflow: hidden; }
.stage svg:not(.ic) { width: 100%; height: auto; display: block; }
.big-play { position: absolute; inset: 0; margin: auto; width: 5.5rem; height: 5.5rem; border-radius: 50%; border: 4px solid #fff; background: var(--neut); color: #fff; display: grid; place-items: center; cursor: pointer; }
.big-play .ic { width: 2.4rem; height: 2.4rem; }
.big-play.hide { display: none; }
.caption { min-height: 3.6em; margin: .75rem .25rem; font-size: var(--fs-lg); line-height: 1.6; }
.controls { display: flex; align-items: center; gap: .6rem; }
.ctrl { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 0; background: #fff; color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.controls input { flex: 1; min-width: 0; accent-color: var(--acid); }
.time { font-variant-numeric: tabular-nums; font-size: var(--fs-sm); white-space: nowrap; }
.chapters { display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: .75rem 0 0; list-style: none; }
.chapters button { border: 1px solid rgba(255, 255, 255, .5); background: transparent; color: #eef0f7; border-radius: 999px; padding: .1rem .75rem; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.chapters button.on { background: var(--neut); border-color: var(--neut); color: #fff; }

/* tables */
.table-wrap { overflow-x: auto; margin: .6rem 0 1rem; }
.cmp { width: 100%; border-collapse: collapse; background: var(--page); min-width: 36rem; border: 1px solid var(--line); }
.cmp.small-tbl { min-width: 20rem; }
.cmp th, .cmp td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.cmp thead th { background: var(--slate); color: #fff; }
.cmp thead th.c-acid { background: var(--acid); }
.cmp thead th.c-base { background: var(--base); }
.cmp thead th.c-salt { background: var(--neut); }
.cmp td:first-child { font-weight: 800; background: #faf3f6; }

/* quiz */
.score-pill { display: inline-block; background: var(--neut); color: #fff; padding: .1rem .9rem; border-radius: 999px; font-weight: 700; }
.lk-q { background: var(--page); border-radius: 12px; padding: 1rem; margin: .8rem 0; border: 1px solid var(--line); border-left: 5px solid var(--neut); }
.lk-q-stem { font-weight: 700; margin-bottom: .6rem; }
.lk-opts { display: grid; gap: .45rem; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); }
.lk-opt { display: flex; gap: .6rem; align-items: center; text-align: left; font: inherit; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; }
.lk-opt-key { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--slate); color: #fff; flex: none; font-size: .95rem; }
.lk-opt.is-right { border-color: var(--ok); background: #e7f4e1; }
.lk-opt.is-wrong { border-color: var(--no); background: #fbe7e4; }
.lk-explain { margin: .6rem 0 0; }
.lk-explain.ok { color: var(--ok); } .lk-explain.no { color: var(--no); }
.qa details, .cq-parts details { background: var(--page); border-radius: 10px; padding: .6rem .9rem; margin: .5rem 0; border: 1px solid var(--line); border-left: 5px solid var(--base); }
.cq .cq-parts details { background: #fff; }
.qa summary, .cq-parts summary { cursor: pointer; font-weight: 700; }
.qa details p, .cq-parts details p { margin: .6rem 0 .2rem; }
.cq { margin: 1rem 0; }
.cq-stem { font-weight: 800; font-size: var(--fs-lg); }
.cq-parts { list-style: none; padding: 0; }
.summary ul { padding-left: 1.3rem; }
.summary li { margin: .4rem 0; }

.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 2rem 1rem; }
.pager-btn { display: inline-block; padding: .5rem 1.1rem; border-radius: 999px; background: var(--slate); color: #fff; text-decoration: none; font-weight: 700; }
.pager-btn.disabled { background: var(--line); color: #4a3f4b; }
.credit { color: var(--ink-2); font-size: var(--fs-sm); padding-bottom: 2rem; }

[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s, transform .7s; }
[data-reveal].is-in { opacity: 1; transform: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
