/* ==========================================================
   Class 6 Math · Section 2 · অনুপাত ও শতকরা
   Theme: "ঠিকাদারের নীলনকশা" — a contractor's blueprint. Deep
   blueprint navy with a fine chalk grid; work happens on pale
   tracing-paper panels. Safety orange + hazard yellow accents,
   stencil-like tags. Band কৌতূহলী (age 11–12).
   ========================================================== */
:root {
  --bp: #123a63;
  --bp-2: #0d2c4c;
  --chalk: #eaf2fb;
  --chalk-2: #b9cde3;
  --paper: #f4f8fc;
  --line: #c9d9ea;
  --ink: #12304f;
  --ink-2: #4d6582;
  --orange: #e8662a;
  --yellow: #f4c430;
  --yellow-soft: #fdf0c4;
  --teal: #1f8a7a;
  --teal-soft: #d3eee9;
  --red: #c23b2e;
  --ok: #1f7a4a;
  --no: #b03a2e;
}
* { box-sizing: border-box; }
body { color: var(--chalk); background: var(--bp); background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px); background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px; }
::selection { background: rgba(244, 196, 48, .45); color: var(--ink); }
a { color: var(--yellow); }
strong { color: var(--yellow); }
.panel strong, .widget strong { color: var(--orange); }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--yellow); color: var(--ink); 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 > * { min-width: 0; }

.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1.15; margin: 0 .12em; font-size: .9em; }
.fr i { font-style: normal; padding: 0 .2em; }
.fr i:first-child { border-bottom: 2px solid currentColor; }

/* 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(13, 44, 76, .95); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-bottom: 3px solid var(--yellow); font-size: var(--fs-sm); background-image: repeating-linear-gradient(-45deg, transparent 0 14px, rgba(244, 196, 48, .07) 14px 28px); }
.crumbs { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--chalk-2); text-decoration: none; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.crumbs [aria-current] { color: var(--yellow); font-weight: 700; }
.meter { display: flex; align-items: center; gap: .45rem; color: var(--chalk); font-weight: 700; }
.meter-bar { width: 90px; height: 10px; border-radius: 5px; background: #2c5784; overflow: hidden; }
.meter-bar span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--yellow) 0 8px, #3a3a3a 8px 12px); transition: width .6s; }

/* hero */
.hero { padding: clamp(2rem, 5vw, 4rem) 0 2rem; }
.hero-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.05fr 1fr; } }
.eyebrow { display: inline-block; color: var(--ink); background: var(--yellow); font-weight: 800; letter-spacing: .03em; padding: .1rem .8rem; font-size: var(--fs-sm); clip-path: polygon(0 0, 100% 0, 96% 100%, 0 100%); }
h1 { font-size: var(--fs-3xl); line-height: 1.25; margin: .5rem 0 1rem; color: #fff; }
.lede { font-size: var(--fs-lg); line-height: 1.75; }
.hint { color: var(--chalk-2); border-left: 4px solid var(--orange); padding-left: .8rem; }
.bp-card { margin: 0; border: 2px solid rgba(255, 255, 255, .5); border-radius: 6px; background: var(--bp-2); box-shadow: 0 0 0 6px rgba(255, 255, 255, .06); }
.bp-card > svg { display: block; width: 100%; height: auto; }

/* blocks */
.block { padding-block: clamp(1.6rem, 4vw, 3rem); }
.sec-title, .lesson-part h2, #video h2, #compare h2, #activity h2, #quiz h2 { font-size: var(--fs-2xl); line-height: 1.35; margin: .2rem 0 1rem; color: #fff; }
.panel .sec-title, .panel h2 { color: var(--ink); }
.sub-title { font-size: var(--fs-xl); margin: 2rem 0 .8rem; color: var(--yellow); }
.part-tag { display: inline-block; margin: 0; font-weight: 800; color: var(--ink); background: var(--chalk); padding: .05rem .8rem; border: 2px dashed var(--bp); outline: 2px solid var(--chalk); font-size: var(--fs-sm); letter-spacing: .04em; }
.goals { display: grid; gap: .6rem; padding: 0; list-style: none; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); }
.goals li { border: 1.5px solid rgba(255, 255, 255, .45); border-left: 6px solid var(--yellow); padding: .7rem 1rem; border-radius: 4px; background: rgba(255, 255, 255, .04); }

.panel { position: relative; color: var(--ink); background: var(--paper); border-radius: 6px; padding: clamp(1rem, 3vw, 1.6rem); box-shadow: 0 8px 0 rgba(0, 0, 0, .18); background-image: linear-gradient(rgba(18, 48, 79, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(18, 48, 79, .05) 1px, transparent 1px); background-size: 20px 20px; }
.panel::before { content: ""; position: absolute; top: -8px; left: 22px; width: 70px; height: 16px; background: rgba(244, 196, 48, .85); transform: rotate(-3deg); }
.panel h3 { margin: 0 0 .5rem; font-size: var(--fs-lg); display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; color: var(--ink); }
.panel.mini { padding-top: 1.2rem; }
.panel a { color: var(--orange); }
.widget { margin: 1.6rem 0; }
.story p { margin: .6rem 0; }

.def { margin: 1rem 0; background: rgba(255, 255, 255, .08); border: 2px solid var(--chalk); border-radius: 4px; padding: .8rem 1rem; }
.def b:first-child { color: var(--yellow); }
.remember { margin: 1.4rem 0 .4rem; background: var(--yellow-soft); color: var(--ink); border-radius: 4px; padding: .9rem 1rem; border-left: 8px solid var(--orange); }
.remember > b:first-child { display: inline-block; background: var(--ink); color: var(--yellow); padding: 0 .6rem; margin-right: .4rem; }

.grid2 { display: grid; gap: 1.4rem; grid-template-columns: 1fr; margin: 1.2rem 0; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid2 > .widget { margin: 0; }
.tight { margin: .4rem 0; padding-left: 1.3rem; }
.tight li { margin: .35rem 0; }
.steps { padding-left: 1.4rem; }
.steps li { margin: .4rem 0; animation: rise .4s both; }
.steps li.final { font-weight: 800; color: var(--teal); }
.tight-steps li { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.rules { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); margin: 1rem 0; }
.rule { border: 1.5px solid rgba(255, 255, 255, .45); border-radius: 4px; padding: .7rem .9rem; background: rgba(255, 255, 255, .04); }
.rule > b:first-child { display: inline-block; padding: 0 .55rem; margin-right: .4rem; background: var(--orange); color: #fff; }

.fig { display: block; width: 100%; height: auto; }
.ms-svg { max-width: 420px; margin: 0 auto; }

/* controls */
.row-ctrl { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin: .7rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.chips button, .seg button { border: 2px solid var(--ink); background: #fff; color: var(--ink); border-radius: 4px; padding: .05rem .7rem; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.chips button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--ink); color: var(--yellow); }
.seg { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.inp { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; }
.inp input, .qty input, .bl-list input { font: inherit; width: 7rem; max-width: 100%; padding: .15rem .5rem; border: 2px solid var(--ink); border-radius: 4px; background: #fff; color: var(--ink); }
.qty { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.qty input { width: 4.4rem; }
.unit { font-weight: 700; color: var(--ink-2); }
.vs { font-size: 2rem; font-weight: 900; color: var(--orange); }
.slider { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; flex-wrap: wrap; }
.slider input { accent-color: var(--orange); width: 9rem; }
.btn { font: inherit; font-weight: 800; border: 0; background: var(--orange); color: #fff; padding: .35rem 1.1rem; border-radius: 4px; cursor: pointer; box-shadow: 0 4px 0 #9c3f12; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #9c3f12; }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid var(--ink); box-shadow: none; }
.btn[disabled] { opacity: .5; cursor: default; }
.msg { min-height: 1.8em; font-weight: 700; margin: .5rem 0; }
.msg.ok { color: var(--ok); } .msg.no { color: var(--no); }

/* blanks */
.bl-list { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); }
.bl-item { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: 1.2rem; font-weight: 700; background: #fff; border: 1.5px solid var(--line); border-radius: 4px; padding: .5rem .7rem; }
.bl-list input { width: 4rem; text-align: center; }
.bl-item.ok { border-color: var(--ok); background: #e6f4ec; }

/* sorter */
.so-cards { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 1rem; }
.so-cards button { font: inherit; font-weight: 800; font-size: 1.15rem; padding: .25rem .8rem; border: 2px solid var(--ink); border-radius: 4px; background: var(--yellow-soft); color: var(--ink); cursor: pointer; }
.so-cards button[aria-pressed="true"] { background: var(--yellow); box-shadow: 0 0 0 3px var(--orange); }
.so-cards button.placed { opacity: .25; pointer-events: none; }
.so-trucks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); gap: .6rem; }
.truck { font: inherit; text-align: left; border: 2px dashed var(--ink-2); border-radius: 6px; background: #fff; padding: .5rem .7rem; cursor: pointer; color: var(--ink); min-height: 6rem; }
.truck b { display: block; font-size: 1.1rem; }
.truck .load { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.truck .load span { background: var(--teal-soft); border-radius: 3px; padding: 0 .4rem; font-weight: 700; }
.mx-out { font-size: 1.15rem; margin-top: .5rem; }
.mx-out p { margin: .35rem 0; }

/* percent grid */
.pg-grid-wrap { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 760px) { .pg-grid-wrap { grid-template-columns: minmax(0, 320px) 1fr; } }
.pg-svg { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto; }
.pg-forms { display: grid; gap: .5rem; }
.pg-forms .inp { justify-content: space-between; max-width: 18rem; }
.pg-forms .inp input { width: 9rem; }
.pg-forms .inp input.bad { border-color: var(--no); background: #fbecea; }
.chart-box { position: relative; height: 180px; max-width: 320px; }

/* unitary */
.un-q { font-weight: 700; font-size: 1.1rem; }
.un-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .un-grid { grid-template-columns: 1.3fr 1fr; } }
.un-lines { font-size: 1.12rem; min-height: 9rem; }
.un-line { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; padding: .35rem .5rem; margin: .3rem 0; border-left: 4px solid var(--teal); background: #fff; animation: rise .4s both; }
.un-line .tag { font-size: .8rem; font-weight: 800; color: #fff; background: var(--teal); padding: 0 .4rem; border-radius: 3px; }
.un-line .tag.inv { background: var(--orange); }
.un-line.final { border-left-color: var(--orange); font-weight: 800; }
.un-svg { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto; }

/* player */
.player { border-radius: 6px; background: var(--bp-2); border: 2px solid rgba(255, 255, 255, .4); padding: clamp(.5rem, 2vw, 1rem); color: #fff; }
.stage { position: relative; border-radius: 4px; 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(--orange); 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: var(--yellow); color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.controls input { flex: 1; min-width: 0; accent-color: var(--yellow); }
.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, .45); background: transparent; color: var(--chalk); border-radius: 4px; padding: .1rem .7rem; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.chapters button.on { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }

/* tables */
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.cmp { width: 100%; border-collapse: collapse; background: var(--paper); color: var(--ink); min-width: 36rem; }
.cmp.two { min-width: 30rem; }
.cmp th, .cmp td { border: 1px solid var(--line); padding: .55rem .7rem; text-align: left; vertical-align: top; }
.cmp thead th { background: var(--ink); color: var(--yellow); }
.cmp.two thead th:first-child { background: var(--teal); color: #fff; }
.cmp.two thead th:last-child { background: var(--orange); color: #fff; }
.cmp tbody th { background: var(--yellow-soft); white-space: nowrap; }

/* quiz */
.score-pill { display: inline-block; background: var(--yellow); color: var(--ink); padding: .1rem .9rem; border-radius: 4px; font-weight: 800; }
.lk-q { background: var(--paper); color: var(--ink); border-radius: 6px; padding: 1rem; margin: .8rem 0; }
.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: 2px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); cursor: pointer; }
.lk-opt-key { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 3px; background: var(--ink); color: var(--yellow); flex: none; font-size: .95rem; }
.lk-opt.is-right { border-color: var(--ok); background: #e5f4ea; }
.lk-opt.is-wrong { border-color: var(--no); background: #fbe9e6; }
.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(--paper); color: var(--ink); border-radius: 4px; padding: .6rem .9rem; margin: .5rem 0; border-left: 5px solid var(--yellow); }
.cq .cq-parts details { border: 1.5px solid var(--line); border-left: 5px solid var(--orange); 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: 700; }
.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: 4px; background: var(--yellow); color: var(--ink); text-decoration: none; font-weight: 800; }
.pager-btn.disabled { background: #34597f; color: var(--chalk-2); }
.credit { color: var(--chalk-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; }
: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; }
}
