/* ==========================================================
   Class 9–10 Chemistry · Section 7 · রাসায়নিক বিক্রিয়া
   Theme: "বিক্রিয়ার রান্নাঘর" — a Bangladeshi kitchen-lab.
   Warm clay paper, charcoal ink, recipe-card panels with a coloured
   left tab per reaction family: redox flame orange / steel blue,
   non-redox leaf green, special plum, exo red / endo ice-blue,
   rate & equilibrium mustard. Top bar: equilibrium beam. (age ~15)
   ========================================================== */
:root {
  --bg: #f7ede3;
  --bg-2: #f0e2d3;
  --card: #fffaf4;
  --line: #e3cfbb;
  --ink: #2b211c;
  --ink-2: #6b5a4f;
  --ox: #e8590c;
  --red: #1c7ed6;
  --leaf: #2f9e44;
  --plum: #9c36b5;
  --exo: #e03131;
  --endo: #1098ad;
  --must: #f08c00;
  --ok: #2b8a3e;
  --no: #c92a2a;
}
body { color: var(--ink); background: var(--bg); background-image: radial-gradient(circle at 8% 0, rgba(232, 89, 12, .08), transparent 40%), radial-gradient(circle at 100% 30%, rgba(28, 126, 214, .06), transparent 35%); }
::selection { background: rgba(232, 89, 12, .2); }
a { color: var(--red); }
strong { color: var(--ox); }
b { color: #1a120e; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; justify-content: center; }
.en { font-size: .55em; font-weight: 600; color: var(--ink-2); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 2000; }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: .4rem 1rem; flex-wrap: wrap; padding: .4rem var(--gutter); background: rgba(247, 237, 227, .94); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.crumbs { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ox); font-weight: 700; }
.eqbar { display: flex; align-items: center; gap: .4rem; }
.eqbar svg { display: block; }
#eq-beam { transition: transform .3s; transform-origin: 60px 16px; }
.eq-read { font-weight: 700; min-width: 7.5rem; white-space: nowrap; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1.1rem; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); font-weight: 700; transition: transform .1s, background .15s; }
.btn:hover { background: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-fire { background: var(--ox); border-color: var(--ox); color: #fff; }
.btn-fire:hover { background: #f76707; }
.btn-leaf { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.btn-leaf:hover { background: #37b24d; }
.btn-plum { background: var(--plum); border-color: var(--plum); color: #fff; }
.btn-sm { padding: .15rem .8rem; font-size: var(--fs-sm); }
.btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.row-btns { display: flex; gap: .6rem; flex-wrap: wrap; margin: .75rem 0; }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .8rem; }
.tabs button { border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); padding: .2rem .85rem; border-radius: 999px; font-weight: 700; font-family: 'Segoe UI', system-ui, var(--bn-font); }
.tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
input[type="range"] { width: 100%; accent-color: var(--ox); }
.slider-row { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: center; margin: .6rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips button { border: 1.5px solid var(--line); background: #fff; color: var(--ink); padding: .15rem .75rem; border-radius: 8px; font-weight: 700; font-family: 'Segoe UI', system-ui, var(--bn-font); }
.chips button:hover { border-color: var(--ink); }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- recipe cards ---------- */
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: clamp(1rem, 3vw, 1.4rem); box-shadow: 0 14px 30px -24px rgba(43, 33, 28, .55); }
.card h3 { font-size: var(--fs-lg); margin-top: 0; }
.card > svg:not(.ic), .card > canvas { width: 100%; height: auto; display: block; }
.tab-phys, .tab-chem, .tab-exo, .tab-non { border-left-width: 6px; }
.tab-phys { border-left-color: var(--red); } .tab-chem { border-left-color: var(--ox); } .tab-exo { border-left-color: var(--exo); } .tab-non { border-left-color: var(--leaf); }
.card + .card, .card + .grid2, .grid2 + .card, .card + .remember, .grid2 + .remember, .card + .tip, .tip + .card, .grid2 + .tip, .grid2 + .grid2, .table-wrap + .card, .card + .table-wrap, .grid2 + .table-wrap, .defbox + .card, .card + .defbox { margin-top: 1.1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); gap: 1.1rem; margin-top: 1.1rem; }
.grid2.tight { margin-top: 0; }
.grid2 > *, .hero-grid > *, .rt-grid > *, .cq-head > * { min-width: 0; }
.remember, .tip { border-radius: 12px; padding: 1rem 1.2rem; margin-top: 1.1rem; }
.remember { background: #eaf5ec; border: 1px solid #b8dfc1; border-left: 5px solid var(--leaf); }
.tip { background: #fff3db; border: 1px solid #f3cf8a; border-left: 5px solid var(--must); }
.rt, .tt { margin: 0 0 .3rem; font-weight: 800; }
.rt { color: var(--leaf); } .tt { color: #b35c00; }
.remember p:last-child, .tip p:last-child { margin-bottom: 0; }
.msg { min-height: 1.8em; margin: .5rem 0 0; }
.msg.ok { color: var(--ok); font-weight: 700; } .msg.no { color: var(--no); font-weight: 700; }
.eqline { font: 700 1.15rem 'Segoe UI', system-ui, sans-serif; text-align: center; background: #fff; border: 1px dashed var(--line); border-radius: 10px; padding: .45rem .8rem; margin: .5rem auto; width: fit-content; max-width: 100%; overflow-x: auto; }
.eqline.small-eq { font-size: 1rem; }
.eqline:empty { visibility: hidden; }
.over { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; vertical-align: middle; }
.over small { font-size: .6em; order: -1; }
.chart-box { position: relative; height: 240px; }
.table-wrap { overflow-x: auto; margin-top: 1rem; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; font-size: var(--fs-sm); }
.tbl caption { text-align: left; font-weight: 700; padding: .3rem 0; color: var(--ink-2); }
.tbl th, .tbl td { border: 1px solid var(--line); padding: .4rem .6rem; text-align: left; }
.tbl th { background: var(--bg-2); }
.receipt { font-family: 'Segoe UI', system-ui, var(--bn-font); background: #fff; border: 1.5px dashed var(--line); border-radius: 8px; padding: .7rem 1rem; line-height: 1.95; margin-top: .6rem; }
.receipt .res { color: var(--ox); font-weight: 800; font-size: 1.2rem; }

/* ---------- hero ---------- */
.hero { padding: clamp(1.5rem, 4vw, 2.8rem) 0 1rem; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 2rem; align-items: center; }
.eyebrow { color: var(--ox); font-weight: 700; margin-bottom: .2rem; }
.hero h1 { font-size: var(--fs-2xl); margin: .2rem 0 .6rem; line-height: 1.3; }
.lede { font-size: var(--fs-lg); }
.defbox { margin: 1rem 0; padding: .9rem 1.2rem; border-left: 5px solid var(--ox); background: var(--card); border-radius: 0 12px 12px 0; font-size: var(--fs-lg); box-shadow: 0 6px 16px -14px rgba(0, 0, 0, .4); }
.defbox.alt { border-left-color: var(--ox); }
.defbox.blue { border-left-color: var(--red); }
.defbox.small-def { font-size: var(--fs-base); margin: .4rem 0 .8rem; }
.hint { color: var(--ink-2); font-size: var(--fs-sm); }
.hero-fig { margin: 0; }
#hero-svg { width: 100%; height: auto; border-radius: 18px; background: #fdf3e7; border: 2px solid var(--ink); }
#hero-svg .hit { cursor: pointer; }
#hero-svg .hit:focus { outline: none; }
#hero-svg .hit:focus .ring, #hero-svg .hit:hover .ring { stroke: var(--ox); stroke-width: 3; }
.hero-cap { min-height: 3.4em; margin: .6rem .2rem 0; font-size: var(--fs-sm); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .4rem .8rem; }

/* ---------- layout ---------- */
.block { padding: clamp(2rem, 5vw, 3.2rem) 0; }
.lesson-part { border-top: 1px solid var(--line); }
.lesson-part.alt { background: var(--bg-2); }
.part-tag { display: inline-block; margin: 0 0 .3rem; padding: .05rem .8rem; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; font-size: var(--fs-sm); }
h2 { font-size: var(--fs-xl); line-height: 1.35; }
.sec-title { display: flex; gap: .6rem; align-items: center; }
.sub-title { font-size: var(--fs-lg); margin-top: 2.2rem; color: var(--ox); }
.goals { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); gap: .4rem 1.5rem; }
.goals li { position: relative; padding-left: 1.7rem; }
.goals li::before { content: ''; position: absolute; left: .1rem; top: .45em; width: .8rem; height: 1rem; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: linear-gradient(180deg, #ffd43b, var(--ox)); }
.story { border-left: 6px solid var(--must); }
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .5s, transform .5s; }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- components ---------- */
.sorter .q { font-weight: 700; font-size: var(--fs-lg); margin: .2rem 0 .6rem; }
.sorter .bins { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.sorter .bins button { padding: .6rem; border-radius: 12px; border: 2px dashed var(--line); background: #fff; font-weight: 800; color: var(--ink); }
.sorter .bins button.p { border-color: var(--red); color: var(--red); } .sorter .bins button.c { border-color: var(--ox); color: var(--ox); }
.sorter .bins button.right { background: #e6f4ea; border-style: solid; } .sorter .bins button.wrong { background: #fde8e8; border-style: solid; }
.halves { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); gap: .5rem; }
.halves div { border-radius: 10px; padding: .4rem .8rem; font: 700 1rem 'Segoe UI', system-ui, var(--bn-font); }
.halves .o { background: #fff0e6; border: 1.5px solid var(--ox); }
.halves .r { background: #e7f1fc; border: 1.5px solid var(--red); }
.halves .s { background: #fff; border: 1.5px solid var(--ink); }
.halves .x { background: #fde8e8; border: 1.5px solid var(--no); color: var(--no); }
.rules { display: grid; gap: .4rem; }
.rules button { display: grid; grid-template-columns: 1fr auto; gap: .5rem; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: .35rem .7rem; color: var(--ink); font-size: var(--fs-sm); }
.rules button b { font-family: 'Segoe UI', system-ui, sans-serif; color: var(--ox); white-space: nowrap; }
.rules button .ex { grid-column: 1 / -1; display: none; font-family: 'Segoe UI', system-ui, var(--bn-font); color: var(--ink-2); }
.rules button[aria-expanded="true"] { border-color: var(--ox); }
.rules button[aria-expanded="true"] .ex { display: block; }
.rt-grid { display: grid; grid-template-columns: minmax(0, 380px) 1fr; gap: 1.2rem; align-items: start; }
.rt-grid svg:not(.ic) { width: 100%; height: auto; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
#rt-body h4, #sp-body h4 { margin: .1rem 0 .3rem; }
#rt-body .eqline, #sp-body .eqline { margin-left: 0; }
.life-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: .8rem; }
.life { perspective: 800px; border: 0; padding: 0; background: none; height: 13.5rem; text-align: left; color: var(--ink); }
.life-in { position: relative; display: block; width: 100%; height: 100%; transition: transform .55s; transform-style: preserve-3d; }
.life.flip .life-in { transform: rotateY(180deg); }
.life-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 14px; border: 1px solid var(--line); background: var(--card); padding: .8rem 1rem; display: flex; flex-direction: column; gap: .3rem; overflow: hidden; }
.life-face .ic { width: 2.6rem; height: 2.6rem; }
.life-face b { font-size: 1.05rem; }
.life-face.back { transform: rotateY(180deg); background: #fff; font-size: .92rem; line-height: 1.6; overflow-y: auto; }
.life-face .eqs { font: 700 .85rem 'Segoe UI', system-ui, sans-serif; color: var(--ox); }
.speed { display: grid; gap: .6rem; }
.speed .row { display: grid; grid-template-columns: 6.5rem 1fr 5rem; align-items: center; gap: .6rem; font-weight: 700; }
.speed .bar { height: 14px; border-radius: 7px; background: var(--bg-2); overflow: hidden; }
.speed .bar i { display: block; height: 100%; width: 0; border-radius: 7px; }
.speed .t { font-size: .9rem; color: var(--ink-2); text-align: right; }
.lc-ctrls { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: .4rem 0; }
.lc-ctrls button { border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; padding: .25rem .9rem; font-weight: 700; color: var(--ink); }
.lc-ctrls button:hover { background: var(--bg); }

/* ---------- player ---------- */
.player { border-radius: 16px; background: #231a15; border: 2px solid var(--ink); padding: clamp(.5rem, 2vw, 1rem); color: #fff; }
.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(--ox); color: #fff; display: grid; place-items: center; }
.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; flex: none; border-radius: 50%; border: 2px solid #fff; background: transparent; color: #fff; display: grid; place-items: center; }
.controls input { flex: 1; min-width: 0; }
.time { 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, .35); background: transparent; color: #f3e6da; border-radius: 999px; padding: .1rem .75rem; font-size: var(--fs-sm); }
.chapters button.on { background: var(--ox); border-color: var(--ox); color: #fff; }

/* ---------- quiz ---------- */
.score-pill { position: sticky; top: 3.6rem; z-index: 5; display: inline-flex; gap: .3rem; align-items: center; padding: .3rem 1rem; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 800; }
.mcq { display: grid; gap: 1rem; }
.lk-q { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.2rem; }
.lk-q-stem { font-weight: 700; margin-bottom: .6rem; }
.lk-q-num { color: var(--ox); }
.mcq-stem-list { display: block; margin: .3rem 0; font-weight: 500; }
.lk-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); gap: .5rem; }
.lk-opt { display: flex; gap: .6rem; align-items: center; text-align: left; padding: .45rem .8rem; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); }
.lk-opt:hover { border-color: var(--ink); }
.lk-opt-key { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--bg); border: 1px solid var(--ox); color: var(--ox); display: grid; place-items: center; font-weight: 700; }
.lk-opt.is-right { border-color: var(--ok); background: #e6f4ea; }
.lk-opt.is-wrong { border-color: var(--no); background: #fde8e8; }
.lk-opt[aria-disabled="true"] { cursor: default; }
.lk-explain { margin: .6rem 0 0; padding: .5rem .8rem; border-radius: 10px; }
.lk-explain.ok { background: #e6f4ea; } .lk-explain.no { background: #fde8e8; }
.qa details, .cq-parts details { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .55rem; }
.qa summary, .cq-parts summary { cursor: pointer; padding: .6rem 1rem; font-weight: 700; }
.qa details p, .cq-parts p { padding: 0 1rem .8rem; margin: 0; }
.cq { margin-top: 1rem; }
.cq-head { display: grid; grid-template-columns: 1fr minmax(0, 300px); gap: 1rem; align-items: center; }
.cq-stem { font-size: var(--fs-lg); margin: 0; }
.cq-fig { width: 100%; height: auto; }
.cq-parts { padding-left: 0; list-style: none; display: grid; gap: .1rem; margin-top: .75rem; }
.summary li { margin-bottom: .4rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 2rem 0 1rem; }
.pager-btn { padding: .55rem 1.1rem; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 700; }
.pager-btn.disabled { opacity: .55; }
.credit { color: var(--ink-2); font-size: var(--fs-sm); padding-bottom: 2rem; }

@media (max-width: 900px) {
  .hero-grid, .rt-grid, .cq-head { grid-template-columns: 1fr; }
  .rt-grid svg:not(.ic) { max-width: 380px; margin-inline: auto; display: block; }
}
@media (max-width: 560px) {
  .crumbs { font-size: .9rem; }
  .eq-read { min-width: 0; }
  .score-pill { top: 5.6rem; }
  .slider-row { grid-template-columns: 1fr; gap: .2rem; }
  .speed .row { grid-template-columns: 5.2rem 1fr 4.2rem; font-size: .9rem; }
  .life { height: 15rem; }
  .eqline { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
  .life-in, #eq-beam { transition: none; }
}
