/* ==========================================================
   Class 9–10 Chemistry · Section 2 · পদার্থের অবস্থা
   Theme: "তাপের সিঁড়ি" — the page is the heating curve (Fig 2.09).
   Dark ink-navy data screen; state colours: ice-blue = কঠিন, aqua = তরল,
   orange = গ্যাস, red = তাপ. Top-bar thermometer climbs −40 → 140 °C. (age ~15)
   ========================================================== */
:root {
  --bg: #0d1620;
  --bg-2: #111d2a;
  --panel: #152434;
  --panel-2: #1b2e42;
  --line: #27405a;
  --ink: #e7eef5;
  --ink-2: #a3b6c8;
  --sol: #7cc4ff;
  --liq: #34d1bf;
  --gas: #ffa94d;
  --heat: #ff6b6b;
  --cool: #6aa8ff;
  --amber: #ffcf5c;
  --ok: #4ade80;
  --no: #ff7a7a;
}
body { color: var(--ink); background: var(--bg); background-image: radial-gradient(circle at 15% -10%, rgba(124, 196, 255, .10), transparent 45%), radial-gradient(circle at 100% 30%, rgba(255, 169, 77, .06), transparent 40%); }
::selection { background: rgba(124, 196, 255, .35); }
a { color: var(--sol); }
strong { color: var(--amber); }
b { color: #fff; }
.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(--sol); color: #000; padding: .5rem 1rem; z-index: 2000; }
.skip:focus { left: 8px; }
.s-sol { color: var(--sol); font-weight: 700; } .s-liq { color: var(--liq); font-weight: 700; } .s-gas { color: var(--gas); font-weight: 700; }

/* ---------- top bar with thermometer ---------- */
.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(13, 22, 32, .92); 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(--sol); font-weight: 700; }
.tbar { display: flex; align-items: center; gap: .6rem; }
.tbar-tube { position: relative; width: clamp(7rem, 22vw, 14rem); height: .7rem; border-radius: 99px; background: #0a121a; border: 1px solid var(--line); overflow: hidden; }
.tbar-tube::before { content: ''; position: absolute; left: 22.2%; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .35); }
.tbar-tube::after { content: ''; position: absolute; left: 77.7%; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .35); }
.tbar-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--sol), var(--liq) 40%, var(--gas) 80%, var(--heat)); background-size: 14rem 100%; transition: width .15s linear; }
.tbar-read { min-width: 8.5rem; font-weight: 700; color: var(--ink); white-space: nowrap; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1.1rem; border-radius: 8px; border: 1.5px solid var(--line); background: var(--panel-2); color: var(--ink); font-weight: 700; transition: transform .12s, background .15s, border-color .15s; }
.btn:hover { border-color: var(--sol); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-pri { background: var(--sol); border-color: var(--sol); color: #06121c; }
.btn-pri:hover { background: #a3d6ff; }
.btn-heat { background: var(--heat); border-color: var(--heat); color: #1a0606; }
.btn-cool { background: var(--cool); border-color: var(--cool); color: #04101f; }
.btn.on { outline: 2px solid var(--amber); outline-offset: 2px; }
.st-sol { border-color: var(--sol); color: var(--sol); } .st-liq { border-color: var(--liq); color: var(--liq); } .st-gas { border-color: var(--gas); color: var(--gas); }
.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-2); color: var(--ink); padding: .25rem .9rem; border-radius: 8px; font-weight: 700; }
.tabs button[aria-selected="true"] { background: var(--sol); border-color: var(--sol); color: #06121c; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; margin: 0 .3rem .4rem 0; }
.seg button { border: 0; background: var(--bg-2); color: var(--ink-2); padding: .2rem .7rem; font-size: var(--fs-sm); font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: #fff; box-shadow: inset 0 -3px 0 var(--amber); }
input[type="range"] { width: 100%; accent-color: var(--heat); }

/* ---------- panels, callouts ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: clamp(1rem, 3vw, 1.4rem); box-shadow: 0 18px 40px -30px #000; }
.panel h3 { font-size: var(--fs-lg); margin-top: 0; color: #fff; }
.panel > svg, .panel > canvas { width: 100%; height: auto; }
.panel + .panel, .panel + .grid2, .grid2 + .panel, .panel + .remember, .grid2 + .remember, .remember + .panel, .grid2 + .tip, .panel + .tip, .tip + .panel, .grid2 + .grid2 { margin-top: 1.1rem; }
.edge-sol { border-top: 4px solid var(--sol); } .edge-liq { border-top: 4px solid var(--liq); } .edge-gas { border-top: 4px solid var(--gas); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); gap: 1.1rem; margin-top: 1.1rem; }
.grid2 > *, .hero-grid > *, .box3d-wrap > *, .candle-card > *, .mp-grid > *, .curve-grid > *, .beakers > *, .cq-head > * { min-width: 0; }
.remember, .tip { border-radius: 10px; padding: 1rem 1.2rem; margin-top: 1.1rem; }
.remember { background: rgba(52, 209, 191, .09); border: 1px solid rgba(52, 209, 191, .45); border-left: 5px solid var(--liq); }
.tip { background: rgba(255, 207, 92, .08); border: 1px solid rgba(255, 207, 92, .4); border-left: 5px solid var(--amber); }
.rt, .tt { margin: 0 0 .3rem; font-weight: 800; }
.rt { color: var(--liq); } .tt { color: var(--amber); }
.remember p:last-child, .tip p:last-child { margin-bottom: 0; }
.msg { min-height: 1.8em; margin: .5rem 0 0; }
.eq { font-family: 'Segoe UI', system-ui, sans-serif; font-weight: 700; text-align: center; color: #fff; background: var(--bg-2); border: 1px dashed var(--line); border-radius: 8px; padding: .4rem .8rem; margin: .6rem auto 0; width: fit-content; max-width: 100%; }
.eq.big { font-family: var(--bn-font); font-size: var(--fs-lg); }
.eq .en { display: block; font-family: 'Segoe UI', system-ui, sans-serif; font-size: .7em; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }

/* ---------- 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(--sol); font-weight: 700; margin-bottom: .2rem; }
.hero h1 { font-size: var(--fs-2xl); margin: .2rem 0 .6rem; color: #fff; line-height: 1.3; }
.lede { font-size: var(--fs-lg); color: var(--ink); }
.defbox { margin: 1rem 0; padding: 1rem 1.2rem; border-left: 5px solid var(--sol); background: var(--panel); border-radius: 0 10px 10px 0; font-size: var(--fs-lg); }
.hint { color: var(--ink-2); font-size: var(--fs-sm); }
.hero-fig { margin: 0; }
#hero-cv { width: 100%; height: auto; border-radius: 12px; background: #0a121a; border: 1px solid var(--line); }
.hero-cap { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-top: .4rem; }

/* ---------- 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 .7rem; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); color: var(--amber); font-weight: 700; font-size: var(--fs-sm); }
h2 { font-size: var(--fs-xl); line-height: 1.35; color: #fff; }
.sec-title { display: flex; gap: .6rem; align-items: center; }
.sub-title { font-size: var(--fs-lg); margin-top: 2rem; color: var(--sol); }
.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: 0; top: .5em; width: .85rem; height: .85rem; border-radius: 50%; background: linear-gradient(135deg, var(--sol), var(--gas)); }
.story { border-left: 5px solid var(--gas); }
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .5s, transform .5s; }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- 2.1 ---------- */
.state-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: 1rem; margin-top: 1rem; }
.sc { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; border-top: 4px solid var(--c); }
.sc h3 { margin: 0 0 .2rem; color: var(--c); font-size: var(--fs-lg); }
.sc .sc-en { font-size: var(--fs-sm); color: var(--ink-2); font-family: 'Segoe UI', system-ui, sans-serif; }
.sc svg:not(.ic) { width: 100%; height: auto; max-height: 120px; margin: .4rem 0; }
.sc ul { margin: 0; padding-left: 1.1rem; font-size: var(--fs-sm); line-height: 1.75; }
.sc .ex { margin: .5rem 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.sorter .s-q { text-align: center; font-size: var(--fs-lg); font-weight: 700; min-height: 2em; }

/* ---------- 2.2 3D ---------- */
.box3d-wrap { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.2rem; align-items: center; }
.box3d-stage { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #1d3349, #0a121a); border: 1px solid var(--line); overflow: hidden; touch-action: none; }
#box3d { width: 100%; height: 100%; display: block; }
.box3d-state { position: absolute; left: .7rem; top: .5rem; margin: 0; padding: .05rem .7rem; border-radius: 6px; background: rgba(0, 0, 0, .45); font-weight: 800; }
.slider-lab { display: flex; justify-content: space-between; font-weight: 700; }
.meter { display: grid; grid-template-columns: 9.5rem 1fr; gap: .6rem; align-items: center; margin-top: .6rem; font-size: var(--fs-sm); }
.meter .bar { height: .8rem; border-radius: 99px; background: #0a121a; border: 1px solid var(--line); overflow: hidden; display: block; }
.meter .bar i { display: block; height: 100%; background: var(--sol); transition: width .2s; }
.meter .bar.ke i { background: var(--heat); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.cmp { width: 100%; border-collapse: collapse; min-width: 34rem; font-size: var(--fs-sm); background: var(--panel); }
.cmp th, .cmp td { padding: .55rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.cmp thead th { background: var(--panel-2); }
.cmp tbody th { color: var(--ink-2); font-weight: 700; }
.c-sol { color: var(--sol); } .c-liq { color: var(--liq); } .c-gas { color: var(--gas); }

/* ---------- 2.3 diffusion ---------- */
.beakers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.bk { text-align: center; }
.bk canvas { width: 100%; max-width: 260px; height: auto; margin: .3rem auto 0; display: block; }
.fillbar { height: .5rem; max-width: 260px; margin: .4rem auto 0; border-radius: 99px; background: #0a121a; border: 1px solid var(--line); overflow: hidden; }
.fillbar i { display: block; height: 100%; width: 0; background: #d63ca0; }
.bk-msg { margin: .3rem 0 0; min-height: 1.6em; }
#tube-svg { margin-top: .5rem; }

/* ---------- 2.4 effusion ---------- */
#leak-svg { max-width: 340px; margin: 0 auto; display: block; }

/* ---------- 2.5 candle ---------- */
.candle-card { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 1.4rem; align-items: center; }
#candle-svg { width: 100%; height: auto; }
#candle-svg .zone { cursor: pointer; }
#candle-svg .zone:focus-visible { outline: none; }
#candle-svg .zone.on .ring { stroke: var(--amber); stroke-width: 3; }
.candle-text { min-height: 7.5em; padding: .8rem 1rem; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.candle-text h4 { margin: 0 0 .2rem; font-size: var(--fs-lg); }
.flow-line { margin-top: 1rem; font-size: var(--fs-sm); }
@keyframes flicker { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(.94, 1.06); } 60% { transform: scale(1.05, .95); } }
.flame-in { transform-origin: 150px 120px; transform-box: view-box; animation: flicker 1.2s ease-in-out infinite; }

/* ---------- 2.6 ---------- */
.mp-grid { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 1.4rem; align-items: center; }
#mp-svg { width: 100%; height: auto; }
.mp-read { display: flex; gap: .8rem; align-items: baseline; margin: 0; }
.mp-read span { color: var(--ink-2); }
.mp-read b { font-size: var(--fs-2xl); color: var(--heat); font-family: 'Segoe UI', system-ui, sans-serif; }
.mp-state { font-weight: 800; font-size: var(--fs-lg); margin: .2rem 0; }
.curve-grid { display: grid; grid-template-columns: 220px 1fr; gap: 1.2rem; align-items: start; }
#cv-beaker { width: 100%; height: auto; max-width: 220px; margin: 0 auto; display: block; }
.cv-read { text-align: center; font-size: var(--fs-xl); font-weight: 800; margin: .2rem 0; font-family: 'Segoe UI', system-ui, var(--bn-font); }
.mix { display: flex; height: .9rem; border-radius: 99px; overflow: hidden; background: #0a121a; border: 1px solid var(--line); }
.mix i { display: block; height: 100%; transition: width .1s linear; }
.mx-ice { background: var(--sol); width: 100%; } .mx-wat { background: var(--liq); width: 0; } .mx-vap { background: var(--gas); width: 0; }
.mix-legend { display: flex; justify-content: space-between; font-size: var(--fs-sm); margin: .3rem 0 0; }

/* ---------- 2.7 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .6rem 0; }
.chips button { border: 1.5px solid var(--line); background: var(--bg-2); color: var(--ink); border-radius: 99px; padding: .2rem .85rem; font-size: var(--fs-sm); font-weight: 700; }
.chips button[aria-pressed="true"] { border-color: var(--gas); background: rgba(255, 169, 77, .16); }
.chips button.ok { border-color: var(--ok); background: rgba(74, 222, 128, .16); }
.chips button.no { border-color: var(--no); background: rgba(255, 122, 122, .14); }
.chips button.miss { border-style: dashed; border-color: var(--ok); }

/* ---------- player ---------- */
.player { border-radius: 14px; background: #08111a; border: 1px solid var(--line); 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(--heat); 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(--heat); }
.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: #dbe6f0; border-radius: 8px; padding: .1rem .7rem; font-size: var(--fs-sm); }
.chapters button.on { background: var(--heat); border-color: var(--heat); color: #1a0606; }

/* ---------- 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(--sol); color: #06121c; font-weight: 800; }
.mcq { display: grid; gap: 1rem; }
.lk-q { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; }
.lk-q-stem { font-weight: 700; margin-bottom: .6rem; }
.lk-q-num { color: var(--amber); }
.mcq-stem-list { margin: .3rem 0; font-weight: 500; }
.lk-q-stem svg.q-fig { width: 100%; max-width: 300px; height: auto; display: block; margin: .5rem 0; }
.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: var(--bg-2); color: var(--ink); }
.lk-opt svg.o-fig { width: 140px; height: auto; }
.lk-opt:hover { border-color: var(--sol); }
.lk-opt-key { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--sol); color: var(--sol); display: grid; place-items: center; font-weight: 700; }
.lk-opt.is-right { border-color: var(--ok); background: rgba(74, 222, 128, .12); }
.lk-opt.is-wrong { border-color: var(--no); background: rgba(255, 122, 122, .12); }
.lk-opt[aria-disabled="true"] { cursor: default; }
.lk-explain { margin: .6rem 0 0; padding: .5rem .8rem; border-radius: 8px; }
.lk-explain.ok { background: rgba(74, 222, 128, .12); } .lk-explain.no { background: rgba(255, 122, 122, .12); }
.qa details, .cq-parts details { background: var(--bg-2); 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; color: var(--ink); }
.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: 8px; border: 1.5px solid var(--sol); background: var(--panel); color: var(--sol); 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, .box3d-wrap, .candle-card, .mp-grid, .curve-grid, .cq-head { grid-template-columns: 1fr; }
  #candle-svg, #mp-svg { max-width: 300px; margin-inline: auto; display: block; }
}
@media (max-width: 560px) {
  .tbar-read { min-width: 0; }
  .score-pill { top: 5.4rem; }
  .beakers { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .seg button { padding: .15rem .45rem; }
  .meter { grid-template-columns: 1fr; gap: .2rem; }
  .chart-box.tall { height: 280px; }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
  .flame-in { animation: none; }
  .tbar-fill, .meter .bar i { transition: none; }
}
