/* ==========================================================
   Class 7 Science · Section 6 · পদার্থের গঠন
   Theme: "পদার্থের নীলনকশা" — engineer's blueprint (age ~12)
   ========================================================== */
:root {
  --bp: #0f3d75;
  --bp-2: #14497f;
  --bp-3: #0b2f5c;
  --line: #eaf4ff;
  --line-2: rgba(234, 244, 255, .72);
  --cyan: #7fd8ff;
  --yellow: #ffd23f;
  --grid: rgba(255, 255, 255, .09);
  --grid-b: rgba(255, 255, 255, .18);
  --el: #7ee08a;   /* element */
  --cp: #ffb36b;   /* compound */
  --mx: #c9a6ff;   /* mixture */
  --o: #ff6b6b; --h: #ffffff; --n: #6fa8ff; --c: #4a4a4a; --na: #b48cff; --cl: #7ee08a; --fe: #e0a060; --cu: #e07b3c;
}
body {
  color: var(--line);
  background-color: var(--bp);
  background-image:
    linear-gradient(var(--grid-b) 1px, transparent 1px), linear-gradient(90deg, var(--grid-b) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
}
::selection { background: var(--yellow); color: var(--bp); }
strong, b { color: #fff; }
strong { color: var(--yellow); }
a { color: var(--cyan); }
.muted { color: var(--line-2); }
.small { font-size: var(--fs-sm); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--yellow); color: var(--bp); 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: .5rem 1rem; flex-wrap: wrap; padding: .45rem var(--gutter); background: var(--bp-3); border-bottom: 2px solid var(--line); font-size: var(--fs-sm); }
.crumbs { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--line-2); text-decoration: none; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.crumbs [aria-current] { color: var(--yellow); font-weight: 700; }
.sheets { display: flex; gap: .5rem; align-items: center; }
.sh-label { font-weight: 700; color: var(--line-2); }
.sheets ol { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.sheets li { width: 16px; height: 20px; border: 1.5px dashed var(--line-2); border-radius: 2px; transition: .4s; }
.sheets li.earned { background: var(--line); border-style: solid; box-shadow: 2px 2px 0 var(--cyan); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1.15rem; border: 2px solid var(--line); border-radius: 4px; background: transparent; color: var(--line); font-weight: 700; text-decoration: none; transition: background .2s, color .2s, transform .15s; }
.btn:hover { background: var(--line); color: var(--bp); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ink { background: var(--yellow); border-color: var(--yellow); color: var(--bp); }
.btn-ink:hover { background: #fff; border-color: #fff; }
.btn-small { padding: .3rem .8rem; font-size: var(--fs-sm); }
.btn.el { border-color: var(--el); color: var(--el); } .btn.el:hover { background: var(--el); color: var(--bp); }
.btn.cp { border-color: var(--cp); color: var(--cp); } .btn.cp:hover { background: var(--cp); color: var(--bp); }
.btn.mx { border-color: var(--mx); color: var(--mx); } .btn.mx:hover { background: var(--mx); color: var(--bp); }
.row-btns { display: flex; gap: .6rem; flex-wrap: wrap; margin: .75rem 0; }

/* ---------- sheet card ---------- */
.sheet { position: relative; border: 2px solid var(--line); background: rgba(11, 47, 92, .55); padding: clamp(1rem, 3vw, 1.6rem); border-radius: 2px; }
.sheet::before { content: ''; position: absolute; inset: 5px; border: 1px solid rgba(234, 244, 255, .25); pointer-events: none; }
.sheet-no { position: absolute; top: -.85rem; right: 1rem; background: var(--bp); border: 2px solid var(--line); padding: 0 .6rem; font-size: .85rem; font-weight: 700; letter-spacing: .02em; }
.sheet h3 { font-size: var(--fs-lg); display: flex; gap: .5rem; align-items: center; }
.verdict { border: 1px dashed var(--line-2); padding: .8rem 1rem; margin-top: .75rem; min-height: 5rem; }
.verdict p { margin: 0 0 .3rem; }
.verdict p:last-child { margin: 0; }

/* ---------- hero ---------- */
.hero { padding: clamp(1.5rem, 4vw, 3.5rem) 0 1.5rem; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; align-items: center; }
.title-block { border: 3px solid var(--line); padding: 0 1.5rem 1.5rem; background: rgba(11, 47, 92, .6); }
.tb-row { display: grid; grid-template-columns: auto 1fr auto 1fr; border-bottom: 2px solid var(--line); margin: 0 -1.5rem 1rem; font-size: var(--fs-sm); }
.tb-row > * { padding: .35rem .7rem; border-right: 1px solid var(--line-2); }
.tb-row > *:last-child { border-right: 0; }
.tb-row span { color: var(--line-2); }
.eyebrow { color: var(--cyan); font-weight: 700; margin: 0; }
.hero h1 { font-size: var(--fs-3xl); margin: .3rem 0 .75rem; text-shadow: 3px 3px 0 var(--bp-3); }
.hero-sub { font-size: var(--fs-lg); }
.hero-art svg:not(.ic) { width: 100%; max-width: 400px; height: auto; margin-inline: auto; }
.draw { stroke-dasharray: var(--len, 1200); stroke-dashoffset: var(--len, 1200); animation: draw 2.4s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.orbit-spin { transform-box: view-box; transform-origin: 200px 200px; animation: spin var(--dur, 8s) linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.block { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.lesson-part.alt { background: rgba(11, 47, 92, .45); border-block: 2px dashed var(--line-2); }
.part-tag { display: inline-block; margin: 0 0 .3rem; padding: 0 .7rem; border: 2px solid var(--cyan); color: var(--cyan); font-weight: 700; font-size: var(--fs-sm); }
h2 { font-size: var(--fs-2xl); }
.h2-sub { margin-top: .5rem; }
.sec-title { font-size: var(--fs-xl); display: flex; gap: .6rem; align-items: center; }
.dim { font-size: .9rem; border: 2px solid var(--cyan); color: var(--cyan); padding: 0 .4rem; }
.sub-title { font-size: var(--fs-xl); margin-top: 2.5rem; display: flex; gap: .5rem; align-items: center; }
.goals { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.goals li { padding-left: 2rem; position: relative; }
.goals li::before { content: ''; position: absolute; left: .2rem; top: .5em; width: .9rem; height: .9rem; border: 2px solid var(--yellow); transform: rotate(45deg); }
.remember { margin-top: 1.5rem; padding: 1rem 1.25rem; border: 2px solid var(--yellow); background: rgba(255, 210, 63, .08); }
.chart-box { position: relative; min-height: 220px; }
.chart-box.sm { max-width: 240px; width: 100%; margin-inline: auto; }
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .6s, transform .6s; }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- splitter ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; }
.chip-row button, .seg button { border: 1.5px solid var(--line-2); background: transparent; color: var(--line); padding: .25rem .8rem; border-radius: 2px; font-weight: 600; }
.chip-row button.on, .seg button.on { background: var(--line); color: var(--bp); border-color: var(--line); }
.seg { display: inline-flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .75rem; }
.split-body { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 1.25rem; align-items: start; }
#split-svg { width: 100%; height: auto; border: 1px solid var(--line-2); }
.tag { display: inline-block; padding: 0 .6rem; font-weight: 800; color: var(--bp); border-radius: 2px; }
.tag.e { background: var(--el); } .tag.c { background: var(--cp); } .tag.m { background: var(--mx); }
.defs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: 1rem; margin-top: 1.5rem; }
.defs.two { grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); }
.def h4 { margin-bottom: .3rem; }
.def p { margin: 0; }
.def.el { border-color: var(--el); } .def.el h4 { color: var(--el); }
.def.cp { border-color: var(--cp); } .def.cp h4 { color: var(--cp); }
.def.mx { border-color: var(--mx); } .def.mx h4 { color: var(--mx); }
.arrange { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.arrange figure { margin: 0; text-align: center; }
.arrange canvas { width: 100%; height: auto; border: 1px solid var(--line-2); background: var(--bp-3); }
.arrange figcaption { margin-top: .4rem; font-weight: 700; }
.rust svg:not(.ic) { width: 100%; height: auto; }
.rust input { width: 100%; accent-color: #c2622d; margin: .4rem 0 1rem; }
.sort-card { font-size: var(--fs-lg); font-weight: 700; text-align: center; border: 2px dashed var(--line-2); padding: 1rem; margin: 0; min-height: 4rem; display: grid; place-items: center; }
.sort-btns { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin: 1rem 0 .5rem; }
.sort-fb { text-align: center; min-height: 1.8em; margin: 0; }

/* ---------- theory ---------- */
.timeline { display: grid; grid-template-columns: repeat(3, 1fr); position: relative; margin: 1.5rem 0 1rem; }
.timeline::before { content: ''; position: absolute; left: 4%; right: 4%; top: 1.15rem; border-top: 2px dashed var(--line-2); }
.tl-item { position: relative; background: none; border: 0; color: var(--line); display: flex; flex-direction: column; align-items: center; gap: .3rem; padding-top: 2.4rem; }
.tl-item::before { content: ''; position: absolute; top: .45rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 3px solid var(--line); background: var(--bp); }
.tl-item.on::before { background: var(--yellow); border-color: var(--yellow); }
.tl-year { font-size: var(--fs-sm); color: var(--cyan); }
.tl-name { font-weight: 800; text-align: center; }
.tl-info h4 { color: var(--yellow); margin-bottom: .3rem; }
.tl-info p { margin: 0 0 .3rem; }
.dalton { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: .75rem; }
.dalton li { border: 2px solid var(--line); padding: .8rem 1rem .8rem 3.2rem; position: relative; background: rgba(11, 47, 92, .55); }
.dalton span { position: absolute; left: .8rem; top: .8rem; width: 1.8rem; height: 1.8rem; border: 2px solid var(--yellow); color: var(--yellow); display: grid; place-items: center; font-weight: 800; }

/* ---------- molecule builder ---------- */
.bins { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: .75rem; }
.atom-btn { width: 5rem; height: 5rem; border-radius: 50%; border: 3px solid var(--bp-3); font-size: 1.6rem; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 0 0 3px var(--line); }
.atom-btn small { font-size: .65rem; font-weight: 600; margin-top: .2rem; }
.atom-btn.o { background: var(--o); color: #fff; }
.atom-btn.h { background: var(--h); color: var(--bp); }
.atom-btn:active { transform: scale(.94); }
#build-svg { width: 100%; height: auto; border: 1px dashed var(--line-2); }
.three-box { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.25rem; align-items: start; }
.three-stage { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--line-2); background: radial-gradient(circle at 50% 40%, #1b5596, var(--bp-3)); touch-action: none; }
.three-stage canvas { width: 100% !important; height: 100% !important; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }

/* ---------- symbols ---------- */
.elements { display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem; align-items: center; margin-bottom: 1rem; }
.rule-box h4 { color: var(--yellow); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(7.5rem, 100%), 1fr)); gap: .6rem; margin-bottom: 1.5rem; }
.tile { perspective: 600px; background: none; border: 0; padding: 0; height: 7.5rem; color: var(--bp); }
.tile-in { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s; }
.tile.on .tile-in { transform: rotateY(180deg); }
.tile-f, .tile-b { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 2px solid var(--bp-3); box-shadow: 0 0 0 2px var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tile-f { background: var(--tc, #fff); }
.tile-f b { font-size: 2.4rem; line-height: 1; color: var(--bp); font-family: Georgia, 'Times New Roman', serif; }
.tile-f small { font-size: .8rem; margin-top: .3rem; color: var(--bp); }
.tile-b { background: #fff; transform: rotateY(180deg); padding: .4rem; text-align: center; line-height: 1.4; font-size: .9rem; color: var(--bp); }
.tile-b em { font-style: normal; font-weight: 700; font-family: Georgia, serif; }
.rg-q { font-size: var(--fs-lg); margin: 0 0 .5rem; }
.rg-opts { display: flex; gap: .6rem; flex-wrap: wrap; }
.rg-opts button { min-width: 4.5rem; font-family: Georgia, serif; font-size: 1.4rem; font-weight: 700; padding: .3rem .9rem; border: 2px solid var(--line); background: transparent; color: var(--line); border-radius: 2px; }
.rg-opts button.right { background: var(--el); color: var(--bp); border-color: var(--el); }
.rg-opts button.wrong { background: var(--o); color: #fff; border-color: var(--o); }
.mini { width: 100%; border-collapse: collapse; margin-top: .6rem; font-size: var(--fs-sm); }
.mini th, .mini td { border: 1px solid var(--line-2); padding: .3rem .5rem; text-align: left; }
.mini th { background: rgba(234, 244, 255, .12); }
.mini caption { text-align: left; font-weight: 700; margin-bottom: .4rem; }
.mini.center td, .mini.center th { text-align: center; }
#f-svg { width: 100%; height: auto; margin-top: .5rem; }
.decoder .chip-row button { font-family: Georgia, serif; }

/* ---------- particles ---------- */
.charges { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.ch { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; align-items: center; }
.ch .ball { grid-row: span 2; width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; color: var(--bp); }
.ch h4 { margin: 0; } .ch p { margin: 0; font-size: var(--fs-sm); }
.ch.p .ball { background: var(--o); color: #fff; } .ch.n .ball { background: #cfd8e3; } .ch.e .ball { background: var(--yellow); }
.ab-body { display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: 1.25rem; align-items: center; }
#atom-svg { width: 100%; height: auto; }
.counters { display: grid; gap: .5rem; }
.counter { display: grid; grid-template-columns: 1fr auto auto auto; gap: .5rem; align-items: center; border: 1px solid var(--line-2); padding: .4rem .6rem; }
.counter b { font-size: 1.3rem; min-width: 2.2rem; text-align: center; }
.counter button { width: 2.2rem; height: 2.2rem; border: 2px solid var(--line); background: transparent; color: var(--line); font-weight: 800; font-size: 1.2rem; border-radius: 2px; }
.counter button:hover { background: var(--line); color: var(--bp); }
.cq-atom { width: 200px; height: auto; margin: .5rem 0; }

/* ---------- lab ---------- */
.tubes { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem 1rem; margin: .5rem 0; }
.tube { background: none; border: 0; color: var(--line); display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: 0; }
.tube svg { width: 46px; height: 110px; overflow: visible; }
.tube .t-name { font-size: .82rem; text-align: center; line-height: 1.3; }
.tube .t-kind { font-size: .7rem; padding: 0 .35rem; border-radius: 2px; color: var(--bp); font-weight: 700; }
.t-kind.in { background: var(--cyan); } .t-kind.or { background: var(--el); }
.tube.shaking svg { animation: shake .5s ease-in-out 2; }
@keyframes shake { 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.grains { transition: opacity 1.2s; }
.legend { font-size: var(--fs-sm); color: var(--line-2); margin-top: .75rem; }
.lg { display: inline-block; padding: 0 .4rem; color: var(--bp); font-weight: 700; border-radius: 2px; }
.lg.in { background: var(--cyan); } .lg.or { background: var(--el); }

/* ---------- player ---------- */
.player { border: 3px solid var(--line); background: var(--bp-3); padding: clamp(.5rem, 2vw, 1rem); }
.stage { position: relative; border: 1px solid var(--line-2); }
#scene { width: 100%; height: auto; }
.big-play { position: absolute; inset: 0; margin: auto; width: 5.5rem; height: 5.5rem; border-radius: 50%; border: 3px solid var(--line); background: var(--yellow); color: var(--bp); 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: 2px solid var(--line); background: transparent; color: var(--line); display: grid; place-items: center; border-radius: 2px; }
.controls input { flex: 1; min-width: 0; accent-color: var(--yellow); }
.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 var(--line-2); background: transparent; color: var(--line-2); padding: .1rem .7rem; font-size: var(--fs-sm); border-radius: 2px; }
.chapters button.on { background: var(--yellow); color: var(--bp); border-color: var(--yellow); }

/* ---------- quiz ---------- */
.score-pill { position: sticky; top: 3.6rem; z-index: 5; display: inline-flex; gap: .3rem; align-items: center; padding: .3rem 1rem; background: var(--yellow); color: var(--bp); font-weight: 800; border: 2px solid var(--bp-3); }
.quiz-fig { max-width: 26rem; margin: 1rem 0 1.5rem; }
.mcq { display: grid; gap: 1rem; }
.lk-q { border: 2px solid var(--line); padding: 1rem 1.25rem; background: rgba(11, 47, 92, .55); }
.lk-q-stem { font-weight: 700; margin-bottom: .6rem; }
.lk-q-num { color: var(--yellow); }
.mcq-stem-list { margin: .3rem 0; font-weight: 500; }
.lk-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); gap: .5rem; }
.lk-opt { display: flex; gap: .6rem; align-items: center; text-align: left; padding: .45rem .8rem; border: 1.5px solid var(--line-2); background: transparent; color: var(--line); border-radius: 2px; }
.lk-opt:hover { border-color: #fff; }
.lk-opt-key { flex: none; width: 1.8rem; height: 1.8rem; border: 2px solid var(--cyan); color: var(--cyan); display: grid; place-items: center; font-weight: 700; }
.lk-opt.is-right { border-color: var(--el); background: rgba(126, 224, 138, .18); }
.lk-opt.is-wrong { border-color: var(--o); background: rgba(255, 107, 107, .18); }
.lk-opt[aria-disabled="true"] { cursor: default; }
.lk-explain { margin: .6rem 0 0; padding: .5rem .8rem; border-left: 4px solid var(--el); background: rgba(126, 224, 138, .1); }
.lk-explain.no { border-left-color: var(--o); background: rgba(255, 107, 107, .1); }
.qa details, .cq-parts details { border: 1.5px solid var(--line-2); margin-bottom: .6rem; background: rgba(11, 47, 92, .55); }
.qa summary, .cq-parts summary { cursor: pointer; padding: .65rem 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 li { margin-bottom: .4rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 2rem 0 1rem; }
.pager-btn { padding: .65rem 1.1rem; border: 2px solid var(--line); color: var(--line); text-decoration: none; font-weight: 700; }
.pager-btn:hover { background: var(--line); color: var(--bp); }
.pager-btn.disabled { opacity: .5; }
.credit { color: var(--line-2); font-size: var(--fs-sm); padding-bottom: 2rem; }

@media (max-width: 860px) {
  .hero-grid, .split-body, .three-box, .elements, .ab-body { grid-template-columns: 1fr; }
  .hero-art { max-width: 320px; margin-inline: auto; }
  #split-svg, #atom-svg { max-width: 360px; margin-inline: auto; }
}
@media (max-width: 560px) {
  .sh-label { display: none; }
  .arrange { grid-template-columns: 1fr; }
  .tubes { grid-template-columns: repeat(3, 1fr); }
  .tb-row { grid-template-columns: auto 1fr; }
  .score-pill { top: 5.2rem; }
  .timeline { grid-template-columns: 1fr; gap: .5rem; }
  .timeline::before { display: none; }
  .tl-item { flex-direction: row; padding: 0 0 0 2.2rem; justify-content: flex-start; }
  .tl-item::before { top: .25rem; left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
  .draw { animation: none; stroke-dashoffset: 0; }
  .orbit-spin { animation: none; }
}
