/* ==========================================================
   Class 9–10 Chemistry · Section 1 · রসায়নের ধারণা
   Theme: "গবেষকের খাতা" — research notebook: cream graph paper, teal ink,
   amber margin notes with tape, red GHS hazard diamonds (age ~15)
   ========================================================== */
:root {
  --paper: #fbf8f1;
  --paper-2: #f2ecdd;
  --ink: #1f2a2c;
  --ink-2: #5d6668;
  --teal: #134e4a;
  --teal-2: #0f766e;
  --teal-l: #dff2ee;
  --amber: #d97706;
  --amber-l: #fff3d6;
  --red: #c81e1e;
  --line: #e4dccb;
  --grid: rgba(19, 78, 74, .07);
}
body { color: var(--ink); background: var(--paper); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 24px 24px; }
::selection { background: var(--amber-l); }
strong { color: var(--teal-2); }
.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(--teal); 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: .45rem var(--gutter); background: rgba(251, 248, 241, .94); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-bottom: 2px solid var(--teal); 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(--teal-2); font-weight: 700; }
.steps-mini { display: flex; gap: .3rem; list-style: none; margin: 0; padding: 0; }
.steps-mini li { width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 2px solid var(--teal); display: grid; place-items: center; font-size: .7rem; font-weight: 700; color: var(--teal); background: #fff; transition: background .3s, color .3s; }
.steps-mini li.on { background: var(--teal); color: #fff; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1.1rem; border-radius: 8px; border: 1.5px solid var(--teal); background: #fff; color: var(--teal); font-weight: 700; transition: transform .12s, background .15s; }
.btn:hover { background: var(--teal-l); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; }
.btn-teal { background: var(--teal); color: #fff; } .btn-teal:hover { background: var(--teal-2); }
.row-btns { display: flex; gap: .6rem; flex-wrap: wrap; margin: .75rem 0; }
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .8rem; }
.tabs button { border: 1.5px solid var(--line); background: #fff; color: var(--ink); padding: .25rem .9rem; border-radius: 8px; font-weight: 700; }
.tabs button[aria-selected="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---------- cards & notes ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: clamp(1rem, 3vw, 1.4rem); box-shadow: 0 1px 0 var(--line), 0 14px 26px -22px rgba(31, 42, 44, .5); }
.card h3 { font-size: var(--fs-lg); margin-top: 0; display: flex; gap: .5rem; align-items: center; color: var(--teal); }
.card + .card, .card + .note, .note + .card, .grid2 + .note, .card + .grid2 { 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 > *, .scope-grid > *, .exp-grid > *, .hub-card > *, .dress > *, .hero-grid > * { min-width: 0; }
.card > svg { width: 100%; height: auto; }
.note { position: relative; background: var(--amber-l); border: 1px solid #f1d38a; border-radius: 4px; padding: 1rem 1.2rem; transform: rotate(-.3deg); }
.note::before { content: ''; position: absolute; top: -10px; left: 40%; width: 90px; height: 20px; background: rgba(217, 119, 6, .25); transform: rotate(-3deg); }
.note .nt { margin: 0 0 .2rem; font-weight: 800; color: var(--amber); font-style: italic; }
.note p:last-child { margin-bottom: 0; }
.note.margin { margin-top: 1.1rem; }
.eqn { font-family: ui-monospace, Menlo, Consolas, monospace; background: #f6f3ea; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .7rem; overflow-x: auto; white-space: nowrap; font-size: .95rem; }

/* ---------- hero ---------- */
.hero { padding: clamp(1.5rem, 4vw, 2.6rem) 0 1rem; }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem; align-items: center; }
.eyebrow { color: var(--teal-2); font-weight: 700; }
.hero h1 { font-size: var(--fs-2xl); margin: .2rem 0 .6rem; color: var(--teal); line-height: 1.3; }
.lede { font-size: var(--fs-lg); }
.defbox { margin: 1rem 0 0; padding: 1rem 1.2rem; border-left: 6px solid var(--teal); background: #fff; border-radius: 0 10px 10px 0; font-size: var(--fs-lg); box-shadow: 0 10px 24px -20px rgba(0, 0, 0, .5); }
#flasks { width: 100%; height: auto; }

/* ---------- layout ---------- */
.block { padding: clamp(2rem, 5vw, 3.2rem) 0; }
.lesson-part { border-top: 1px dashed var(--teal); }
.lesson-part.alt { background: rgba(242, 236, 221, .55); }
.part-tag { display: inline-block; margin: 0 0 .3rem; padding: .05rem .7rem; border-radius: 6px; background: var(--teal); color: #fff; font-weight: 700; font-size: var(--fs-sm); }
h2 { font-size: var(--fs-xl); line-height: 1.35; color: var(--teal); }
.sec-title { display: flex; gap: .6rem; align-items: center; }
.pin { width: .9rem; height: .9rem; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px var(--amber-l); flex: none; }
.sub-title { font-size: var(--fs-lg); margin-top: 2rem; color: var(--teal); }
.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.6rem; }
.goals li::before { content: ''; position: absolute; left: 0; top: .45em; width: .9rem; height: .9rem; border: 2px solid var(--teal); border-radius: 3px; }
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .5s, transform .5s; }
[data-reveal].is-in { opacity: 1; transform: none; }
.note.story[data-reveal].is-in { transform: rotate(-.3deg); }

/* ---------- timeline ---------- */
.timeline { list-style: none; padding: 0 0 0 1.4rem; margin: .5rem 0 0; border-left: 3px solid var(--teal); display: grid; gap: .8rem; }
.timeline li { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem; }
.timeline li::before { content: ''; position: absolute; left: calc(-1.4rem - 9px); top: .9rem; width: 15px; height: 15px; border-radius: 50%; background: var(--paper); border: 3px solid var(--amber); }
.timeline .when { font-weight: 800; color: var(--amber); display: block; font-size: var(--fs-sm); }
.timeline b { color: var(--teal); }
.timeline p { margin: .2rem 0 0; font-size: var(--fs-sm); line-height: 1.7; }
.word { min-height: 5rem; display: grid; place-items: center; font-size: clamp(1.6rem, 1.2rem + 2vw, 2.6rem); font-weight: 800; color: var(--teal); border: 2px dashed var(--line); border-radius: 10px; background: #fff; transition: opacity .3s; }

/* ---------- flips ---------- */
.flips { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: 1rem; }
.flip { perspective: 1000px; border: 0; background: transparent; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; min-height: 15rem; }
.flip-in { position: relative; width: 100%; height: 100%; min-height: 15rem; transition: transform .6s; transform-style: preserve-3d; }
.flip.on .flip-in { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 10px; padding: 1rem 1.1rem; border: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; gap: .4rem; overflow: auto; }
.face.front { justify-content: center; align-items: center; text-align: center; background: var(--teal); color: #fff; }
.face.front .q { font-size: var(--fs-lg); font-weight: 800; }
.face.front .tap { font-size: var(--fs-sm); opacity: .8; }
.face.back { transform: rotateY(180deg); font-size: var(--fs-sm); line-height: 1.7; }
.face.back b { color: var(--teal); }

/* ---------- scope, hub ---------- */
.scope-grid { display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: 1.2rem; align-items: center; }
#scope-svg, #hub-svg, #beaker-svg, #dress-svg { width: 100%; height: auto; }
.scope-grid dl { margin: 0; display: grid; gap: .4rem; }
.scope-grid dt { font-weight: 800; color: var(--teal); }
.scope-grid dd { margin: 0 0 .4rem; }
.hub-card { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.2rem; align-items: center; }
#hub-svg .node { cursor: pointer; }
#hub-svg .node:focus { outline: none; }
#hub-svg .node:hover circle, #hub-svg .node:focus circle, #hub-svg .node.on circle { stroke-width: 5; }
#hub-text h4 { margin: 0 0 .3rem; font-size: var(--fs-lg); color: var(--teal); }

/* ---------- day, good/bad ---------- */
.day-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.day-row button { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .5rem .6rem; min-width: 5.6rem; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-weight: 700; font-size: var(--fs-sm); }
.day-row button .ic { width: 2rem; height: 2rem; }
.day-row button.on { border-color: var(--teal); background: var(--teal-l); }
.good { border-top: 5px solid var(--teal-2); } .bad { border-top: 5px solid var(--red); }
.good ul, .bad ul { padding-left: 1.2rem; margin: 0; }
.good li, .bad li { margin-bottom: .4rem; }

/* ---------- research ---------- */
.flow { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-wrap: wrap; gap: .5rem; counter-reset: f; }
.flow li { counter-increment: f; flex: 1 1 9.5rem; position: relative; padding: .6rem .7rem .6rem 2.4rem; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-size: var(--fs-sm); font-weight: 600; transition: background .3s, border-color .3s; }
.flow li::before { content: counter(f); position: absolute; left: .6rem; top: .6rem; width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 2px solid var(--teal); color: var(--teal); display: grid; place-items: center; font-size: .75rem; font-weight: 800; }
.flow li.on { border-color: var(--teal); background: var(--teal-l); }
.flow li.on::before { background: var(--teal); color: #fff; }
.flow li.cur { box-shadow: 0 0 0 3px var(--amber); }
.exp-body { padding: .7rem .9rem; border-radius: 8px; background: var(--paper); border: 1px dashed var(--line); margin-bottom: 1rem; min-height: 4.5rem; }
.exp-body p { margin: 0 0 .4rem; }
.exp-body .hypo { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.exp-body .hypo button { border: 1.5px solid var(--teal); background: #fff; color: var(--teal); border-radius: 8px; padding: .2rem .8rem; font-weight: 700; }
.exp-body .hypo button.on { background: var(--teal); color: #fff; }
.exp-grid { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 1.2rem; align-items: start; }
.data { width: 100%; border-collapse: collapse; margin-bottom: .6rem; }
.data th, .data td { border: 1px solid var(--line); padding: .35rem .6rem; text-align: center; }
.data th { background: var(--teal-l); color: var(--teal); font-size: var(--fs-sm); }
.data tr.new td { animation: hl 1s; }
@keyframes hl { from { background: var(--amber-l); } to { background: transparent; } }
.chart-box { position: relative; height: 210px; }

/* ---------- safety ---------- */
.dress { display: grid; grid-template-columns: minmax(0, 240px) 1fr; gap: 1.2rem; align-items: center; }
.gear { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.gear button { border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: .35rem .8rem; font-weight: 700; }
.gear button[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-l); color: var(--teal); }
.ghs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(8.5rem, 100%), 1fr)); gap: .7rem; }
.ghs button { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .6rem .4rem; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-weight: 700; font-size: var(--fs-sm); transition: transform .15s; }
.ghs button:hover { transform: translateY(-2px); }
.ghs button[aria-pressed="true"] { border-color: var(--red); background: #fff3f3; }
.ghs svg { width: 74px; height: 74px; }
.ghs-detail { margin-top: 1rem; display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; }
.ghs-detail svg { width: 110px; height: 110px; }
.ghs-detail h4 { margin: 0 0 .3rem; font-size: var(--fs-lg); color: var(--red); }
.ghs-detail p { margin: 0 0 .3rem; }
.match .m-q { font-size: var(--fs-lg); font-weight: 800; text-align: center; margin: 0 0 .8rem; min-height: 3rem; }
.m-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; max-width: 30rem; margin: 0 auto; }
.m-opts button { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: .3rem; display: grid; place-items: center; }
.m-opts button svg { width: 64px; height: 64px; }
.m-opts button.ok { border-color: var(--teal-2); background: var(--teal-l); }
.m-opts button.no { border-color: var(--red); background: #fff0f0; }

/* ---------- player ---------- */
.player { border-radius: 14px; background: #1b2b2a; padding: clamp(.5rem, 2vw, 1rem); color: #fff; }
.stage { position: relative; border-radius: 10px; overflow: hidden; }
#scene { 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(--amber); 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; accent-color: var(--amber); }
.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, .45); background: transparent; color: #e3ece9; border-radius: 8px; padding: .1rem .7rem; font-size: var(--fs-sm); }
.chapters button.on { background: var(--amber); border-color: var(--amber); 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(--teal); color: #fff; font-weight: 800; }
.mcq { display: grid; gap: 1rem; }
.lk-q { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; }
.lk-q-stem { font-weight: 700; margin-bottom: .6rem; }
.lk-q-stem svg.ghs-i { width: 70px; height: 70px; display: block; margin: .4rem 0; }
.lk-q-num { color: var(--amber); }
.mcq-stem-list { 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: 8px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); }
.lk-opt svg.ghs-i { width: 52px; height: 52px; }
.lk-opt:hover { border-color: var(--teal); }
.lk-opt-key { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; }
.lk-opt.is-right { border-color: var(--teal-2); background: var(--teal-l); }
.lk-opt.is-wrong { border-color: var(--red); background: #fff0f0; }
.lk-opt[aria-disabled="true"] { cursor: default; }
.lk-explain { margin: .6rem 0 0; padding: .5rem .8rem; border-radius: 8px; }
.lk-explain.ok { background: var(--teal-l); } .lk-explain.no { background: #fff0f0; }
.qa details, .cq-parts details { background: #fff; border: 1px solid var(--line); border-radius: 8px; 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-stem { font-size: var(--fs-lg); }
.cq-parts { padding-left: 0; list-style: none; display: grid; gap: .1rem; margin-top: .75rem; }
.summary { transform: none; }
.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: 8px; border: 1.5px solid var(--teal); background: #fff; color: var(--teal); 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, .scope-grid, .hub-card, .exp-grid, .dress { grid-template-columns: 1fr; }
  #flasks, #scope-svg, #beaker-svg, #dress-svg { max-width: 340px; margin-inline: auto; display: block; }
}
@media (max-width: 560px) {
  .steps-mini li { width: 1.1rem; height: 1.1rem; font-size: .6rem; }
  .score-pill { top: 5.4rem; }
  .ghs-detail { grid-template-columns: 1fr; }
  .m-opts { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
  .flip-in { transition: none; }
}
.flip, .flip-in, .face, .face span { display: block; }
.face { display: flex; }
.flip { width: 100%; }
.face.back { display: block; }
