/* ==========================================================
   Class 8 Science · Section 7 · পৃথিবী ও মহাকর্ষ
   Theme: "নিক্তি-ঘর: এক কেজি চালের সফর" — a weights-and-measures
   bench. Deep cobalt enamel hero and player (like an old enamel
   spring-balance dial plate), pale enamel blue-white page, white
   cards topped with a ruler of dial ticks, signal-red needle,
   mustard tick-yellow, jute rice-sack tan, moon grey-lilac.
   Badge = a little spring balance whose pointer drops one mark
   per finished task. Band কৌতূহলী (13–14).
   ========================================================== */
:root {
  --bg: #eef2fa;
  --card: #ffffff;
  --ink: #16203d;
  --ink-2: #4d5878;
  --line: #cdd6ea;
  --cobalt: #132150;
  --cobalt-2: #1d3277;
  --cobalt-3: #2c4aa6;
  --enamel: #f7f4ea;
  --needle: #d8342a;
  --mustard: #f2b705;
  --mustard-d: #9a7300;
  --jute: #c8a165;
  --jute-d: #8a6a37;
  --moon: #9d97b8;
  --sky: #4aa3df;
  --ok: #1d8a4e;
  --no: #c4302b;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { color: var(--ink); background: var(--bg); }
::selection { background: rgba(242, 183, 5, .5); }
a { color: var(--cobalt-3); }
strong { color: var(--cobalt-3); }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--mustard); color: var(--cobalt); padding: .5rem 1rem; z-index: 2000; }
.skip:focus { left: 8px; }
.wrap { max-width: var(--content-w); margin-inline: auto; padding-inline: var(--gutter); }
main, .wrap, .lesson-part > *, .grid2 > *, .row-ctrl > *, .defs2 > *, .acts > *, .sliders > * { min-width: 0; }

/* topbar + spring-balance badge */
.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(19, 33, 80, .96); color: #fff; font-size: var(--fs-sm); border-bottom: 3px solid var(--mustard); }
.crumbs { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.crumbs a { color: #c9d3f2; text-decoration: none; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.crumbs [aria-current] { color: var(--mustard); font-weight: 700; }
.level { display: flex; align-items: center; gap: .5rem; font-weight: 800; }
.nk { width: 120px; height: 30px; flex: none; }
.level.pop { animation: bob .6s; }
@keyframes bob { 40% { transform: translateY(4px); } }
.lk-progress { color: var(--mustard); }

/* hero */
.hero { padding: clamp(2rem, 5vw, 4rem) 0 2.4rem; background: radial-gradient(ellipse 70% 60% at 80% 40%, var(--cobalt-2), var(--cobalt) 70%); color: #fff; }
.hero-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.1fr 1fr; } }
.eyebrow { display: inline-block; color: var(--cobalt); background: var(--mustard); font-weight: 800; padding: .1rem .9rem; border-radius: 999px; font-size: var(--fs-sm); }
h1 { font-size: var(--fs-3xl); line-height: 1.25; margin: .7rem 0 1rem; }
.lede { font-size: var(--fs-lg); line-height: 1.75; }
.hint { color: #d5ddf5; border-left: 4px solid var(--needle); padding-left: .8rem; }
.hero b { color: var(--mustard); }
.dial { margin: 0; border-radius: 22px; background: var(--enamel); border: 6px solid #0c163a; box-shadow: 0 0 0 3px var(--mustard), 0 18px 40px rgba(0, 0, 0, .35); overflow: hidden; }
.dial-btn { display: block; width: 100%; padding: 0; margin: 0; border: 0; background: transparent; cursor: pointer; }
.dial-btn > svg { display: block; width: 100%; height: auto; }
.dial-read { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin: 0; padding: .4rem .9rem; background: #0c163a; color: var(--mustard); font-weight: 800; font-variant-numeric: tabular-nums; }
.dial-read #hero-w { color: #fff; }

/* blocks */
.block { padding-block: clamp(1.6rem, 4vw, 3rem); }
.lesson-part.alt { background: linear-gradient(180deg, transparent, #e2e9f7 6%, #e2e9f7 94%, transparent); }
.sec-title, .lesson-part h2, #compare h2, #activity h2, #quiz h2 { font-size: var(--fs-2xl); line-height: 1.35; margin: .2rem 0 1rem; color: var(--cobalt); }
.story h2 { font-size: var(--fs-xl); display: flex; align-items: center; gap: .5rem; }
.sub-title { font-size: var(--fs-xl); margin: 2rem 0 .8rem; color: var(--cobalt-3); }
.part-tag { display: inline-block; margin: 0; font-weight: 800; color: #fff; background: var(--cobalt); padding: 0 .9rem; border-radius: 6px; font-size: var(--fs-sm); border-bottom: 3px solid var(--needle); }
.goals { display: grid; gap: .6rem; padding: 0; list-style: none; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); }
.goals li { background: var(--card); border-radius: 10px; padding: .7rem 1rem; border: 1px solid var(--line); border-left: 6px solid var(--mustard); }

/* cards with a dial-tick ruler on top */
.card { position: relative; background: var(--card); border-radius: 14px; padding: clamp(1.1rem, 3vw, 1.6rem); padding-top: calc(clamp(1.1rem, 3vw, 1.6rem) + 8px); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(19, 33, 80, .07); overflow: hidden; }
.card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 10px; background: repeating-linear-gradient(90deg, var(--cobalt) 0 2px, transparent 2px 12px) bottom / 100% 6px no-repeat, repeating-linear-gradient(90deg, var(--cobalt) 0 2px, transparent 2px 60px) bottom / 100% 10px no-repeat, var(--enamel); border-bottom: 2px solid var(--cobalt); }
.card h3 { margin: 0 0 .5rem; font-size: var(--fs-lg); display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; color: var(--cobalt); }
.widget { margin: 1.6rem 0; }
.def { margin: 1rem 0; background: #e6ecfb; border-left: 5px solid var(--cobalt-3); border-radius: 8px; padding: .8rem 1rem; }
.def > b:first-child { color: var(--cobalt-3); }
.defs2 { display: grid; gap: 0 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); }
.remember { margin: 1.4rem 0 .4rem; background: #fff6d6; border-radius: 10px; padding: .9rem 1rem; border: 1.5px dashed var(--mustard-d); }
.remember > b:first-child { display: inline-block; background: var(--mustard); color: var(--cobalt); padding: 0 .6rem; border-radius: 4px; margin-right: .4rem; }
.fix { margin: 1.2rem 0; background: #fdecea; border-radius: 10px; padding: .8rem 1rem; border-left: 5px solid var(--needle); }
.fix > b:first-child, .note > b:first-child { display: inline-block; background: var(--needle); color: #fff; padding: 0 .6rem; border-radius: 4px; margin-right: .4rem; }
.note { margin: 1.2rem 0; background: #eef0f7; border-radius: 10px; padding: .8rem 1rem; border-left: 5px solid var(--moon); }
.note > b:first-child { background: #5d567c; }
.reasons { padding-left: 1.6rem; }
.reasons li { margin: .5rem 0; }
.reasons li::marker { color: var(--needle); font-weight: 800; }
.newton { display: flex; gap: 1rem; align-items: flex-start; margin: 1.2rem 0; }
.newton p { margin: .2rem 0 0; }
@media (max-width: 520px) { .newton { flex-direction: column; } }

.formula { margin: 1.2rem 0; background: var(--cobalt); color: #fff; border-radius: 14px; padding: 1rem 1.2rem; }
.formula b, .formula strong { color: var(--mustard); }
.formula .muted { color: #c9d3f2; }
.eq { font-family: 'Times New Roman', serif; font-size: 2rem; text-align: center; margin: .2rem 0 .8rem; font-style: italic; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1.2; }
.frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 .2em; }

.grid2 { display: grid; gap: 1.2rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.fig { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--enamel); border: 1px solid var(--line); }
.fig.mid { max-width: 680px; margin-inline: auto; }
.fig.tall { max-width: 340px; margin-inline: auto; }
.fig.cabin { margin-top: .6rem; background: #0c163a; }

/* controls */
.row-ctrl { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin: .7rem 0; }
.sliders { display: grid; gap: .2rem 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); margin-top: .6rem; }
.seg { display: flex; flex-wrap: wrap; gap: .35rem; margin: .3rem 0 .6rem; }
.seg.col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr)); }
.seg button, .opts button, .chips button { font: inherit; font-size: var(--fs-sm); border: 1.5px solid var(--cobalt-3); background: #fff; color: var(--cobalt); border-radius: 999px; padding: .1rem .85rem; cursor: pointer; }
.seg.col button { border-radius: 10px; text-align: left; padding: .3rem .7rem; }
.seg button[aria-pressed="true"] { background: var(--cobalt); color: #fff; border-color: var(--cobalt); box-shadow: inset 0 -3px 0 var(--mustard); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0; }
.chips button { border-style: dashed; }
.lbl { font-weight: 800; margin: .6rem 0 .1rem; color: var(--cobalt); }
.slider { display: flex; align-items: center; gap: .5rem; font-weight: 700; flex-wrap: wrap; margin: .4rem 0; }
.slider input { accent-color: var(--needle); width: 13rem; max-width: 100%; }
.btn { font: inherit; font-weight: 800; border: 0; background: var(--needle); color: #fff; padding: .3rem 1.2rem; border-radius: 999px; cursor: pointer; box-shadow: 0 3px 0 #8f1d17; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #8f1d17; }
.btn.ghost { background: transparent; color: var(--cobalt); border: 1.5px solid var(--cobalt); box-shadow: none; }
.btn[disabled] { opacity: .45; cursor: default; }
.msg { min-height: 1.8em; font-weight: 700; margin: .5rem 0; }
.msg.ok { color: var(--ok); } .msg.no { color: var(--no); }
.big-num { font-size: var(--fs-xl); font-weight: 800; color: var(--needle); margin: .3rem 0; font-variant-numeric: tabular-nums; }
.readout { font-weight: 800; color: var(--cobalt); min-height: 1.6em; }
.readouts { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr)); margin: .8rem 0 .3rem; }
.readouts.one { grid-template-columns: 1fr; }
.readouts p { margin: 0; background: #0c163a; color: #fff; border-radius: 10px; padding: .4rem .8rem; display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; align-items: baseline; }
.readouts span { color: #c9d3f2; font-size: var(--fs-sm); }
.readouts b { color: var(--mustard); font-variant-numeric: tabular-nums; }
.inp { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; flex-wrap: wrap; }
.inp input { font: inherit; width: 5.5rem; text-align: center; padding: .1rem .4rem; border: 1.5px solid var(--cobalt-3); border-radius: 8px; background: #fff; color: var(--ink); }
.chart-box { position: relative; height: 270px; margin: 1rem 0 .4rem; }

/* derivation */
.dsteps { list-style: none; padding: 0; margin: .6rem 0; display: grid; gap: .5rem; counter-reset: ds; }
.dsteps li { counter-increment: ds; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; padding: .5rem .8rem .5rem 2.6rem; border-radius: 10px; background: var(--enamel); border: 1px solid var(--line); position: relative; opacity: .25; transition: opacity .4s, background .4s; }
.dsteps li::before { content: counter(ds); position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--cobalt); color: #fff; display: grid; place-items: center; font-size: .85rem; font-weight: 800; }
.dsteps li.on { opacity: 1; }
.dsteps li.now { background: #fff6d6; border-color: var(--mustard-d); }
.eq-s { font-family: 'Times New Roman', serif; font-style: italic; font-size: 1.4rem; }
.eq-s.big { font-size: 1.8rem; color: var(--needle); }
.why { color: var(--ink-2); font-size: var(--fs-sm); }
.dsteps li.on .cut { text-decoration: line-through; text-decoration-color: var(--needle); text-decoration-thickness: 3px; color: var(--needle); }

/* sorter */
.sorter { list-style: none; padding: 0; margin: .6rem 0; display: grid; gap: .5rem; }
.sorter li { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; justify-content: space-between; padding: .45rem .7rem; border-radius: 10px; background: var(--enamel); border: 1px solid var(--line); }
.sorter li .t { flex: 1 1 14rem; }
.sorter li .seg { margin: 0; }
.sorter li.ok { border-color: var(--ok); background: #e3f4ea; }
.sorter li.bad { animation: shake .4s; border-color: var(--no); }
.sorter li .ex { flex-basis: 100%; font-size: var(--fs-sm); color: var(--ok); margin: 0; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* activity */
.acts { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); }
.opts { display: flex; flex-wrap: wrap; gap: .4rem; }
.opts button.right { background: #e3f4ea; border-color: var(--ok); color: var(--ok); }
.opts button.wrong { background: #fdecea; border-color: var(--no); color: var(--no); animation: shake .4s; }

/* player */
.player { border-radius: 18px; background: var(--cobalt); padding: clamp(.5rem, 2vw, 1rem); border: 4px solid #0c163a; box-shadow: 0 0 0 3px var(--mustard), 0 14px 36px rgba(19, 33, 80, .3); 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(--needle); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.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 { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1.5px solid #c9d3f2; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; }
.controls input { flex: 1; min-width: 0; accent-color: var(--mustard); }
.time { font-variant-numeric: tabular-nums; color: #c9d3f2; 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 #5a6fb0; background: transparent; color: #c9d3f2; border-radius: 999px; padding: .1rem .7rem; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.chapters button.on { background: var(--mustard); border-color: var(--mustard); color: var(--cobalt); font-weight: 700; }

/* table */
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.cmp { width: 100%; border-collapse: collapse; min-width: 34rem; background: var(--card); border: 1px solid var(--line); }
.cmp th, .cmp td { border: 1px solid var(--line); padding: .55rem .75rem; text-align: left; vertical-align: top; }
.cmp thead th { background: var(--cobalt); color: #fff; }
.cmp thead th:nth-child(2) { color: var(--mustard); } .cmp thead th:nth-child(3) { color: #ffb4ad; }
.cmp tbody th { color: var(--ink-2); font-weight: 800; background: var(--enamel); }

/* quiz */
.score-pill { display: inline-block; background: var(--cobalt); color: var(--mustard); padding: .1rem .9rem; border-radius: 999px; font-weight: 700; }
.lk-q { background: var(--card); border-radius: 12px; padding: 1rem; margin: .8rem 0; border: 1px solid var(--line); border-left: 5px solid var(--cobalt-3); }
.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: 1.5px solid var(--line); border-radius: 10px; background: var(--enamel); 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(--cobalt); color: #fff; flex: none; font-size: .95rem; }
.lk-opt.is-right { border-color: var(--ok); background: #e3f4ea; }
.lk-opt.is-wrong { border-color: var(--no); background: #fdecea; }
.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(--card); border-radius: 10px; padding: .6rem .9rem; margin: .5rem 0; border: 1px solid var(--line); border-left: 4px solid var(--mustard); }
.cq .cq-parts details { background: var(--enamel); }
.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: 600; }
.cq-parts { list-style: none; padding: 0; }
.cq-fig { display: block; width: 100%; height: auto; max-width: 520px; margin: .6rem auto; background: #fff; border-radius: 10px; border: 1px solid var(--line); }

.summary ul { padding-left: 1.3rem; }
.summary li { margin: .35rem 0; }
.summary li::marker { color: var(--needle); }

.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(--cobalt); color: #fff; text-decoration: none; font-weight: 700; }
.pager-btn.disabled { background: var(--card); color: var(--ink-2); border: 1px solid var(--line); }
.credit { color: var(--ink-2); font-size: var(--fs-sm); padding-bottom: 2rem; }

[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .6s, transform .6s; }
[data-reveal].is-in { opacity: 1; transform: none; }

@media (max-width: 520px) {
  .nk { width: 90px; }
  .eq { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
