/* ==========================================================
   Theme: "হালখাতা থেকে ওয়ার্কবুক" — a shopkeeper's red-cloth
   খেরোখাতা meets a spreadsheet. Maroon khero cloth with a mustard
   tie-string (top bar, hero frame, player); pale ledger-paper page
   with a faint green cell grid; widgets are ledger pages (double red
   margin rule, column-letter strip); part tags are name boxes.
   Top-bar badge: a 4×5 mini sheet whose cells fill one by one.
   ========================================================== */
:root {
  --bg: #f6f4ea;
  --paper: #fffef8;
  --ink: #23305c;
  --ink-2: #5a6078;
  --line: #d9dccb;
  --grid: #dbe6d6;
  --cloth: #6d1b2a;
  --cloth-2: #8a2637;
  --cloth-d: #4b111c;
  --thread: #e0a526;
  --thread-d: #9c6f0b;
  --sel: #1f7a4a;
  --sel-l: #e2f2e7;
  --orange: #d66a12;
  --orange-d: #9a4a08;
  --blue: #2f5fa8;
  --margin: #d2475a;
  --tab: var(--cloth);
  --ok: #1f7a4a;
  --no: #b8342a;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  color: var(--ink);
  background-color: var(--bg);
  background-image: linear-gradient(90deg, rgba(31, 122, 74, .06) 1px, transparent 1px), linear-gradient(rgba(31, 122, 74, .06) 1px, transparent 1px);
  background-size: 64px 22px;
}
::selection { background: rgba(224, 165, 38, .35); }
a { color: var(--blue); }
strong { color: var(--cloth); }
code, kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
code { background: #eef3ea; border: 1px solid var(--grid); border-radius: 4px; padding: 0 .3rem; color: var(--sel); white-space: nowrap; }
kbd { background: #fff; border: 1px solid #b9bca9; border-bottom-width: 3px; border-radius: 4px; padding: 0 .35rem; color: var(--ink); }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--thread); color: #111; padding: .5rem 1rem; z-index: 2000; }
.skip:focus { left: 8px; }
main, .wrap, .lesson-part > *, .row-ctrl > *, .hero-grid > *, .ch-grid > *, .wb-wrap > *, .hs-show > *, .ev-item > * { min-width: 0; }

/* top bar: khero cloth with stitching */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: .4rem 1rem; flex-wrap: wrap; padding: .35rem var(--gutter); background: var(--cloth); color: #f7e6d6; font-size: var(--fs-sm); box-shadow: inset 0 -3px 0 var(--cloth-d), 0 4px 0 var(--thread); background-image: repeating-linear-gradient(90deg, transparent 0 10px, rgba(255, 220, 160, .45) 10px 18px); background-size: 100% 2px; background-repeat: no-repeat; background-position: 0 calc(100% - 7px); }
.crumbs { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.crumbs a { color: #f1d3c0; text-decoration: none; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.crumbs [aria-current] { color: #ffd37a; font-weight: 700; }
.level { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: #fff3df; font-family: ui-monospace, Menlo, monospace, var(--bn-font); }
.level.pop { animation: bob .6s; }
@keyframes bob { 40% { transform: translateY(-4px) scale(1.06); } }
.mini-sheet { display: inline-grid; grid-template-columns: repeat(5, 9px); grid-auto-rows: 6px; gap: 1px; padding: 2px; background: #c9cdb8; border-radius: 2px; }
.mini-sheet i { background: #fffef8; transition: background .4s; }
.mini-sheet i.on { background: var(--sel); }
.mini-sheet i.on:nth-child(5n+2) { background: var(--thread); }
.mini-sheet i.on:nth-child(7n+3) { background: var(--orange); }

/* hero */
.hero { padding: clamp(2rem, 5vw, 4rem) 0 2rem; background: linear-gradient(180deg, #efe7d6, transparent); }
.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: #fff; background: var(--cloth); font-weight: 700; padding: .1rem .9rem; border-radius: 3px; font-size: var(--fs-sm); box-shadow: 3px 3px 0 var(--thread); }
h1 { font-size: var(--fs-3xl); line-height: 1.3; margin: .6rem 0 1rem; color: var(--cloth); }
.lede { font-size: var(--fs-lg); line-height: 1.75; }
.hint { color: var(--ink-2); border-left: 4px solid var(--thread); padding-left: .8rem; }
.hero-fig { margin: 0; border-radius: 10px; overflow: hidden; border: 10px solid var(--cloth); box-shadow: inset 0 0 0 2px var(--cloth-d), 0 0 0 3px var(--thread), 0 18px 40px rgba(77, 17, 28, .3); }
.hero-fig > svg { display: block; width: 100%; height: auto; }

/* sections */
.block { padding-block: clamp(1.6rem, 4vw, 3rem); }
.sec-title, .lesson-part h2, #compare h2, #activity h2, #quiz h2 { font-size: var(--fs-2xl); line-height: 1.4; margin: .4rem 0 1rem; color: var(--cloth); }
.sub-title { font-size: var(--fs-xl); color: var(--ink); margin: 2.2rem 0 .6rem; border-bottom: 2px solid var(--grid); padding-bottom: .2rem; }
.goals { list-style: none; padding: 0; display: grid; gap: .6rem; }
.goals li { background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--sel); padding: .6rem .9rem; border-radius: 3px; }
.t-cloth { --tab: var(--cloth); }
.t-ink { --tab: var(--blue); }
.t-green { --tab: var(--sel); }
.part-tag { display: inline-flex; align-items: center; gap: .55rem; margin: 0; font-weight: 800; color: var(--ink); background: #fff; padding: .1rem .9rem .1rem .2rem; border-radius: 2px; font-size: var(--fs-sm); border: 1px solid #b9bca9; }
.part-tag .call { background: #fff; color: var(--tab); padding: 0 .55rem; border: 2px solid var(--tab); border-radius: 2px; font-family: ui-monospace, Menlo, monospace, var(--bn-font); font-size: .9em; }
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .6s, transform .6s; }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ledger-page card */
.card { position: relative; background-color: var(--paper); background-image: repeating-linear-gradient(180deg, transparent 0 2.1rem, #eef1e6 2.1rem 2.17rem); border-radius: 3px; padding: 1.1rem 1rem 1rem 1.6rem; border: 1px solid var(--line); box-shadow: 0 3px 0 #e2e2d2; }
.card::before { content: ""; position: absolute; left: .7rem; top: 0; bottom: 0; width: 5px; border-left: 1.5px solid var(--margin); border-right: 1.5px solid var(--margin); opacity: .55; pointer-events: none; }
.card h3 { margin: 0 0 .5rem; font-size: var(--fs-lg); display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; color: var(--cloth); }
.widget { margin: 1.6rem 0; }
.widget > h3::after { content: "A  B  C  D  E"; margin-left: auto; font: 700 .7rem ui-monospace, Menlo, monospace; letter-spacing: .25em; color: #a9b49f; }
.def { margin: 1rem 0; background: #fff; border-left: 6px solid var(--tab); border-radius: 3px; padding: .8rem 1rem; box-shadow: 0 2px 0 #e2e2d2; }
.def b:first-child { color: var(--tab); }
.fix { margin: 1rem 0; background: #fff6e6; border: 2px dashed var(--orange); border-radius: 4px; padding: .8rem 1rem; }
.fix > b:first-child { display: inline-block; background: var(--orange); color: #fff; padding: 0 .55rem; border-radius: 3px; margin-right: .4rem; }
.remember { margin: 1.4rem 0 .4rem; background: #f0f6ec; border-radius: 3px; padding: .9rem 1rem; border: 1px dashed var(--sel); }
.remember > b:first-child { display: inline-block; background: var(--sel); color: #fff; padding: 0 .6rem; border-radius: 3px; margin-right: .4rem; }

/* controls */
.row-ctrl { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin: .7rem 0; }
.btn { font: inherit; font-weight: 800; border: 0; background: var(--cloth); color: #fff; padding: .3rem 1.05rem; border-radius: 4px; cursor: pointer; box-shadow: 0 4px 0 var(--cloth-d); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.alt { background: var(--sel); box-shadow: 0 4px 0 #11522f; }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); 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); }
.key { font: inherit; font-weight: 700; min-width: 2.6rem; padding: .25rem .7rem; background: #fbfbf4; color: var(--ink); border: 1px solid #b9bca9; border-bottom-width: 4px; border-radius: 6px; cursor: pointer; }
.key:active { transform: translateY(2px); border-bottom-width: 2px; }
.keys .key { font-size: var(--fs-sm); }
.inp-inline { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.inp-inline input { font: inherit; width: 7.5rem; padding: .2rem .5rem; border: 2px solid var(--line); border-radius: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { font: inherit; padding: .2rem .8rem; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-align: left; }
.chip.right { border-color: var(--ok); background: #e6f4ea; }
.chip.wrong { border-color: var(--no); background: #fbe9e7; }

/* story */
.dues { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr)); gap: .4rem; margin: .6rem 0; }
.due { background: #fffaf0; border: 1px solid #e8d8b8; border-left: 4px solid var(--cloth); padding: .3rem .6rem; border-radius: 3px; }
.due b { display: block; font-size: var(--fs-lg); color: var(--cloth); }
.clock { font: 800 1.6rem ui-monospace, Menlo, monospace, var(--bn-font); color: var(--cloth); margin: .2rem 0; }
.st-out { margin-top: .4rem; }

/* history steps */
.steps { list-style: none; padding: 0; margin: .6rem 0; display: flex; flex-wrap: wrap; gap: .4rem; counter-reset: s; }
.steps button { font: inherit; padding: .2rem .8rem; border-radius: 3px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.steps button[aria-pressed="true"] { background: var(--cloth); border-color: var(--cloth); color: #fff; }
.steps button.seen:not([aria-pressed="true"]) { border-color: var(--sel); }
.hs-show { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 700px) { .hs-show { grid-template-columns: 300px 1fr; } }
.hs-show svg:not(.ic) { width: 100%; height: auto; background: #fbf6ea; border: 1px solid var(--line); border-radius: 4px; }

/* software cards */
.sw-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr)); }
.sw-card { font: inherit; text-align: left; color: var(--ink); cursor: pointer; background: #fff; border: 1px solid var(--line); border-top: 5px solid var(--sel); border-radius: 4px; padding: .6rem .8rem; min-height: 9.5rem; display: flex; flex-direction: column; gap: .3rem; }
.sw-card:hover { transform: translateY(-2px); }
.sw-card svg { width: 54px; height: 54px; flex: none; }
.sw-card .yr { font-family: ui-monospace, Menlo, monospace, var(--bn-font); color: var(--orange-d); font-weight: 800; }
.sw-card[aria-expanded="true"] { background: #f5faf2; }
.sw-card .back { display: none; font-size: var(--fs-sm); }
.sw-card[aria-expanded="true"] .back { display: block; }

/* workbook */
.wb-wrap { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 720px) { .wb-wrap { grid-template-columns: 240px 1fr; } }
.wb-svg { width: 100%; max-width: 260px; height: auto; }
.wb-book { border: 1px solid #b9bca9; border-radius: 4px; overflow: hidden; background: #fff; }
.wb-title { background: #dfe8f3; padding: .15rem .6rem; font-size: var(--fs-sm); font-weight: 700; }
.wb-sheet { min-height: 9rem; padding: .3rem; overflow-x: auto; }
.wb-tabs { display: flex; gap: 2px; background: #e9ebe0; padding: 0 .3rem .3rem; border-top: 1px solid #c7cab6; flex-wrap: wrap; }
.wb-tabs button { font: 700 .95rem ui-monospace, Menlo, monospace, var(--bn-font); padding: .1rem .7rem; border: 1px solid #b9bca9; border-top: 0; background: #f4f5ee; border-radius: 0 0 6px 6px; cursor: pointer; color: var(--ink); }
.wb-tabs button[aria-selected="true"] { background: #fff; color: var(--sel); box-shadow: inset 0 3px 0 var(--sel); }
.mini-tbl { border-collapse: collapse; font-size: var(--fs-sm); width: 100%; }
.mini-tbl th, .mini-tbl td { border: 1px solid #d6d9c8; padding: .1rem .45rem; text-align: left; }
.mini-tbl thead th:first-child, .mini-tbl tbody th { width: 2.2rem; }
.mini-tbl thead th, .mini-tbl tbody th { background: #eef0e6; color: #5a6078; font: 600 .85rem ui-monospace, Menlo, monospace, var(--bn-font); text-align: center; }

/* grid explorer */
.gr-top { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: .4rem 0; }
.namebox { display: inline-block; min-width: 4.2rem; text-align: center; font: 800 1.05rem ui-monospace, Menlo, monospace; background: #fff; border: 1px solid #9ea38c; padding: .05rem .5rem; color: var(--sel); }
.gr-q { font-weight: 800; color: var(--cloth); }
.gr-scroll { overflow-x: auto; max-width: 100%; }
.gr { border-collapse: collapse; background: #fff; font: 600 .82rem ui-monospace, Menlo, monospace; user-select: none; }
.gr th { background: #eef0e6; color: #5a6078; border: 1px solid #cfd3bf; width: 2.1rem; height: 1.55rem; text-align: center; font-weight: 600; }
.gr th.hi { background: #cfe8d6; color: var(--sel); }
.gr td { border: 1px solid #e1e4d4; width: 2.6rem; min-width: 2.2rem; height: 1.55rem; padding: 0; }
.gr td button { width: 100%; height: 100%; display: block; border: 0; background: transparent; cursor: pointer; padding: 0; font: inherit; color: var(--sel); }
.gr td.cross { background: #f1f8f2; }
.gr td.on { outline: 2px solid var(--sel); outline-offset: -2px; background: #fff; }
.gr td.good { background: #c9ecd4; }
.gr td.bad { background: #f6d5d0; }

/* pipeline */
.pipe { list-style: none; padding: 0; margin: .5rem 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; }
.pipe li { text-align: center; font-size: var(--fs-sm); font-weight: 700; padding: .3rem .2rem; border-radius: 3px; background: #eef0e6; color: var(--ink-2); border-bottom: 3px solid transparent; }
.pipe li.on { background: var(--sel-l); color: var(--sel); border-bottom-color: var(--sel); }
.pp-stage { min-height: 11rem; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: .6rem; overflow-x: auto; }
.pp-report { border: 2px solid var(--cloth); border-radius: 4px; padding: .5rem .8rem; background: #fffaf3; }
.pp-bars { display: grid; gap: .25rem; }
.pp-bar { display: grid; grid-template-columns: 4.5rem 1fr 2.5rem; align-items: center; gap: .4rem; font-size: var(--fs-sm); }
.pp-bar i { display: block; height: 1rem; background: var(--blue); border-radius: 0 3px 3px 0; transform-origin: left; animation: grow .6s ease-out; }
@keyframes grow { from { transform: scaleX(0); } }

/* events */
.ev-list { display: grid; gap: .8rem; }
.ev-item { border: 1px solid var(--line); border-radius: 4px; padding: .6rem .8rem; background: #fff; }
.ev-item h4 { margin: 0 0 .3rem; color: var(--cloth); font-size: var(--fs-base); }
.ev-item p { margin: 0 0 .4rem; }
.ev-item.done { border-color: var(--ok); background: #f3faf5; }

/* budget / generic mini spreadsheet */
.xl { border: 1px solid #9ea38c; border-radius: 4px; background: #fff; overflow: hidden; width: fit-content; min-width: min(100%, 26rem); max-width: 100%; }
.xl-bar { display: flex; align-items: stretch; gap: .3rem; padding: .3rem; background: #eef0e6; border-bottom: 1px solid #c7cab6; flex-wrap: wrap; }
.xl-name { min-width: 3.6rem; text-align: center; font: 800 1rem ui-monospace, Menlo, monospace; background: #fff; border: 1px solid #9ea38c; padding: .1rem .4rem; color: var(--sel); display: grid; place-items: center; }
.xl-sigma { font: 700 .95rem var(--bn-font); background: #fff; border: 1px solid #9ea38c; border-radius: 3px; cursor: pointer; padding: 0 .5rem; color: var(--ink); white-space: nowrap; }
.xl-sigma b { font-family: Georgia, serif; font-size: 1.15rem; color: var(--sel); margin-right: .15rem; }
.xl-sigma:hover { background: var(--sel-l); }
.xl-fx { font: italic 700 1rem Georgia, serif; color: #7a7f68; display: grid; place-items: center; padding: 0 .2rem; }
.xl-input { flex: 1 1 9rem; min-width: 0; font: 600 1.05rem ui-monospace, Menlo, monospace, var(--bn-font); border: 1px solid #9ea38c; padding: .15rem .45rem; color: var(--ink); background: #fff; }
.xl-input:focus { outline: 2px solid var(--sel); outline-offset: 0; }
.xl-scroll { overflow-x: auto; max-width: 100%; }
.xl-grid { border-collapse: collapse; font-size: 1rem; table-layout: fixed; }
.xl-grid:focus { outline: none; }
.xl-grid th { background: #eef0e6; color: #5a6078; border: 1px solid #cfd3bf; font: 600 .82rem ui-monospace, Menlo, monospace; height: 1.7rem; text-align: center; padding: 0 .2rem; }
.xl-grid th.rh { width: 2.2rem; }
.xl-grid th.hi { background: #cfe8d6; color: var(--sel); }
.xl-grid td { position: relative; border: 1px solid #e1e4d4; height: 2.1rem; padding: 0 .4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: cell; font-family: var(--bn-font); }
.xl-grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.xl-grid td.fx { color: var(--blue); font-weight: 700; }
.xl-grid td.err { color: var(--no); font-weight: 700; }
.xl-grid td.locked { background: #fafaf4; }
.xl-grid td.sel { outline: 2.5px solid var(--sel); outline-offset: -2px; background: #fff; }
.xl-grid td.sel::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 6px; height: 6px; background: var(--sel); border: 1px solid #fff; }
.xl-grid td.rng { background: #e3f0e6; }
.xl-grid td.flash { animation: flash 1s; }
@keyframes flash { 0% { background: #ffe8a3; } 100% { background: transparent; } }
.xl-grid td.h0 { box-shadow: inset 0 0 0 2px #2f5fa8; background: #eef3fb; }
.xl-grid td.h1 { box-shadow: inset 0 0 0 2px #c2410c; background: #fdf1e8; }
.xl-grid td.h2 { box-shadow: inset 0 0 0 2px #7c3aed; background: #f4effd; }
.xl-grid td.h3 { box-shadow: inset 0 0 0 2px #0f766e; background: #ebf7f5; }
.xl-tabs { display: flex; gap: 2px; background: #e9ebe0; padding: 0 .3rem .25rem; border-top: 1px solid #c7cab6; font: 700 .8rem ui-monospace, Menlo, monospace; }
.xl-tabs span { padding: 0 .6rem; background: #fff; border: 1px solid #b9bca9; border-top: 0; border-radius: 0 0 5px 5px; color: var(--sel); }
.xl-hint { font-size: .9rem; color: var(--ink-2); padding: .15rem .45rem; border-top: 1px dashed #d6d9c8; min-height: 1.6em; }
.sheet-card .target-mini { font-size: var(--fs-sm); background: #f5f7ef; border: 1px dashed #b9bca9; border-radius: 4px; padding: .3rem .6rem; margin: .4rem 0 .7rem; }
.navkeys .key { min-width: 3rem; }
.checks { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .25rem; }
.checks li { font-size: var(--fs-sm); color: var(--ink-2); display: flex; gap: .4rem; align-items: center; }
.checks li.ok { color: var(--ok); font-weight: 700; }
.kaj { border-top: 5px solid var(--thread); }
.missions { padding-left: 1.6rem; margin: .3rem 0 .6rem; list-style-type: bengali; }
.missions li { margin: .2rem 0; color: var(--ink-2); }
.missions li.cur { color: var(--cloth); font-weight: 800; }
.missions li.done { color: var(--ok); }
.mission-now { font-weight: 700; background: #fff6e6; border-left: 4px solid var(--orange); padding: .35rem .7rem; border-radius: 3px; min-height: 2.4em; }

/* opening excel */
.desk { position: relative; height: 330px; border-radius: 6px; overflow: hidden; background: linear-gradient(160deg, #2c6aa0, #1b3f6b 70%); border: 3px solid #1d2a3a; }
.desk-icon { position: absolute; left: 14px; top: 14px; display: grid; justify-items: center; gap: 2px; width: 74px; padding: 4px; color: #fff; background: transparent; border: 1px solid transparent; border-radius: 4px; font: 600 .85rem system-ui, sans-serif; cursor: pointer; }
.desk-icon:focus-visible, .desk-icon.picked { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .6); }
.xl-logo { width: 40px; height: 40px; border-radius: 5px; background: #fff; border: 2px solid #1f7a4a; background-image: linear-gradient(#1f7a4a 0 0), linear-gradient(90deg, #cfe3d4 1px, transparent 1px), linear-gradient(#cfe3d4 1px, transparent 1px); background-size: 14px 100%, 10px 10px, 10px 10px; background-repeat: no-repeat, repeat, repeat; }
.taskbar { position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: rgba(10, 20, 35, .85); display: flex; align-items: center; gap: .6rem; padding: 0 .4rem; }
.startbtn { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #9cc7ef; cursor: pointer; background: radial-gradient(circle at 40% 35%, #9fd36a, #2d7d32 60%, #1c4f20); display: grid; place-items: center; }
.startbtn span { width: 14px; height: 14px; background: conic-gradient(#e5533d 0 25%, #7fc241 0 50%, #ffc928 0 75%, #36a5e8 0); border-radius: 2px; }
.startbtn.pulse, .sm-item.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 210, 90, .7); } }
.tb-hint { color: #ffe39b; font-size: .9rem; font-weight: 700; }
.startmenu { position: absolute; left: 6px; bottom: 44px; width: min(270px, calc(100% - 12px)); max-height: 270px; overflow: auto; background: #f4f7fb; border: 2px solid #8ea8c3; border-radius: 6px; padding: .3rem; font: 600 .88rem system-ui, sans-serif; color: #1c2b3a; }
.sm-item { display: flex; align-items: center; gap: .4rem; width: 100%; text-align: left; border: 1px solid transparent; background: transparent; padding: .25rem .4rem; border-radius: 3px; cursor: pointer; font: inherit; color: inherit; }
.sm-item:hover { background: #dfeaf6; border-color: #a9c2dc; }
.sm-item .fd { width: 14px; height: 11px; background: #e8b84a; border-radius: 1px; flex: none; }
.sm-item .ap { width: 13px; height: 13px; border-radius: 2px; flex: none; }
.xlwin-mini { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); width: min(360px, calc(100% - 24px)); height: 230px; background: #fff; border: 2px solid #6f8fb3; border-radius: 5px; overflow: hidden; animation: pop .35s; }
.xlwin-mini .tb { background: linear-gradient(#dfeaf6, #c3d6ec); text-align: center; font: 700 .85rem system-ui, sans-serif; padding: .15rem; color: #1c2b3a; }
.xlwin-mini .mini-grid { height: 100%; background-image: linear-gradient(90deg, #dde2d2 1px, transparent 1px), linear-gradient(#dde2d2 1px, transparent 1px); background-size: 48px 18px; }
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } }

/* excel window anatomy */
.xw { border: 2px solid #7c93ad; border-radius: 6px; overflow: hidden; background: #fff; font: 600 .78rem system-ui, sans-serif; color: #1c2b3a; user-select: none; }
.xw [role="button"] { cursor: pointer; }
.xw [role="button"]:focus-visible { outline: 3px solid var(--orange); outline-offset: -3px; }
.xw-title { display: flex; align-items: center; gap: .4rem; background: linear-gradient(#e3edf8, #c9daee); padding: .2rem .3rem; }
.xw-office { width: 30px; height: 30px; border-radius: 50%; flex: none; background: radial-gradient(circle at 40% 35%, #fff6d6, #f0b43c 55%, #b8770e); border: 1px solid #8c5a07; }
.xw-qat { display: flex; gap: 3px; padding: 2px 4px; border-radius: 3px; }
.xw-qat i { width: 13px; height: 13px; background: #6b8fbf; border-radius: 2px; }
.xw-qat i:nth-child(2) { background: #3d7a3d; } .xw-qat i:nth-child(3) { background: #b0573a; }
.xw-tt { flex: 1; text-align: center; padding: .15rem; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xw-wbtn { display: flex; gap: 2px; }
.xw-wbtn i { width: 16px; height: 12px; background: #b9cbe1; border-radius: 2px; }
.xw-wbtn i:last-child { background: #d0584a; }
.xw-ribbon { background: #dbe6f4; border-bottom: 1px solid #9fb4cf; }
.xw-tabs { display: flex; gap: .7rem; padding: .15rem .6rem 0; overflow: hidden; white-space: nowrap; }
.xw-tabs b { background: #fff; padding: 0 .4rem; border-radius: 3px 3px 0 0; color: #1c4f8a; }
.xw-groups { display: flex; gap: 3px; padding: 4px; background: #f3f7fc; overflow: hidden; }
.xw-groups span { flex: 1 0 auto; display: flex; flex-wrap: wrap; gap: 2px; align-content: flex-start; padding: 3px 3px 0; border: 1px solid #c9d7e8; border-radius: 3px; min-width: 52px; max-width: 120px; position: relative; padding-bottom: 14px; }
.xw-groups i { width: 14px; height: 14px; border-radius: 2px; background: #9fb6d4; font-style: normal; display: grid; place-items: center; font: 700 .7rem Georgia, serif; }
.xw-groups i.sig { background: #fff; color: var(--sel); border: 1px solid #9fb6d4; }
.xw-groups em { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-style: normal; font-size: .62rem; color: #4a6283; background: #e3ebf6; }
.xw-fbar { display: flex; gap: 4px; padding: 3px; background: #f1f4f8; border-bottom: 1px solid #c3cfdd; align-items: center; }
.xw-nb { width: 48px; background: #fff; border: 1px solid #9fb4cf; text-align: center; font-family: ui-monospace, Menlo, monospace; }
.xw-fx { font: italic 700 .9rem Georgia, serif; color: #6b7280; }
.xw-fi { flex: 1; height: 16px; background: #fff; border: 1px solid #9fb4cf; }
.xw-grid { height: 120px; background-color: #fff; background-image: linear-gradient(90deg, #e1e5d6 1px, transparent 1px), linear-gradient(#e1e5d6 1px, transparent 1px); background-size: 52px 16px; position: relative; }
.xw-grid::before { content: ""; position: absolute; left: 0; top: 0; width: 52px; height: 16px; outline: 2px solid #1f2937; outline-offset: -2px; }
.xw-sheets { display: flex; gap: 2px; background: #e7ecf3; padding: 0 .4rem 2px; border-top: 1px solid #b6c4d6; }
.xw-sheets b, .xw-sheets span { padding: 0 .5rem; background: #f8fafc; border: 1px solid #9fb4cf; border-top: 0; border-radius: 0 0 5px 5px; font-family: ui-monospace, Menlo, monospace; }
.xw-sheets b { background: #fff; }
.xw-status { display: flex; justify-content: space-between; background: linear-gradient(#d6e2f0, #c3d4e8); padding: 2px .5rem; }
.xw-status .zoom i { display: inline-block; width: 10px; height: 8px; background: #8ea8c3; margin-right: 2px; }
.xw .hl { box-shadow: inset 0 0 0 3px var(--orange); background-color: #fff1df !important; }
.xw .xw-grid.hl { background-color: #fff6ea !important; }
.wn-info { margin-top: .6rem; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--orange); border-radius: 3px; padding: .5rem .8rem; min-height: 4.2em; }

/* new workbook / sheet */
.nw-desk { position: relative; min-height: 190px; background: #eef2f7; border: 1px solid #b6c4d6; border-radius: 6px; padding: .6rem; display: flex; flex-wrap: wrap; gap: .5rem; align-content: flex-start; }
.nw-book { width: min(15rem, 100%); background: #fff; border: 2px solid #7c93ad; border-radius: 5px; overflow: hidden; animation: drop .35s; }
.nw-book.active { border-color: var(--sel); box-shadow: 0 0 0 3px rgba(31, 122, 74, .25); }
.nw-book .tb { background: linear-gradient(#e3edf8, #c9daee); font: 700 .8rem system-ui, sans-serif; padding: .15rem .4rem; }
.nw-book .gridlet { height: 70px; background-image: linear-gradient(90deg, #e1e5d6 1px, transparent 1px), linear-gradient(#e1e5d6 1px, transparent 1px); background-size: 34px 14px; }
.nw-book .st { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 .3rem 3px; background: #e7ecf3; font: 700 .72rem ui-monospace, Menlo, monospace; }
.nw-book .st span { padding: 0 .35rem; background: #f8fafc; border: 1px solid #9fb4cf; border-top: 0; border-radius: 0 0 4px 4px; }
.nw-book .st span.new { background: #fff3c4; border-color: var(--thread-d); animation: drop .35s; }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }

/* chart builder */
.ch-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .ch-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } }
.ch-steps { flex-direction: column; align-items: stretch; }
.ribbon-mini { display: flex; gap: .3rem; background: #dbe6f4; padding: .25rem; border-radius: 4px; font: 600 .9rem system-ui, sans-serif; align-items: center; flex-wrap: wrap; }
.ribbon-mini span { padding: .1rem .5rem; color: #4a6283; }
.ribbon-mini button, .chart-opts button { font: 700 .9rem system-ui, sans-serif; padding: .15rem .7rem; border: 1px solid #7c93ad; background: #fff; border-radius: 3px; cursor: pointer; color: #1c4f8a; }
.ribbon-mini button[disabled], .chart-opts button[disabled] { opacity: .5; cursor: default; }
.ribbon-mini button.go, .chart-opts button.go { animation: pulse 1.2s infinite; }
.chart-opts { display: flex; gap: .3rem; flex-wrap: wrap; background: #f3f7fc; padding: .3rem; border: 1px solid #c9d7e8; border-radius: 4px; }
.chart-box { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: .4rem; height: 260px; margin-top: .5rem; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1rem; color: var(--ink-2); margin: 0; }
.sc-q { margin-top: .8rem; }

/* player */
.player { border-radius: 8px; background: var(--cloth); padding: clamp(.5rem, 2vw, 1rem); color: #fff; box-shadow: 0 14px 30px rgba(77, 17, 28, .3), inset 0 0 0 3px var(--cloth-d); border: 3px dashed rgba(255, 220, 160, .45); }
.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(--sel); 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(--thread); color: #2b1a10; display: grid; place-items: center; cursor: pointer; flex: none; }
.controls input { flex: 1; min-width: 0; accent-color: var(--thread); }
.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, .4); background: transparent; color: #f7e6d6; border-radius: 3px; padding: .1rem .7rem; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.chapters button.on { background: var(--thread); border-color: var(--thread); color: #2b1a10; }

/* table */
.table-wrap { overflow-x: auto; }
.cmp { width: 100%; border-collapse: collapse; background: var(--paper); min-width: 40rem; }
.cmp th, .cmp td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.cmp thead th { background: var(--cloth); color: #fff; }
.cmp thead th:last-child { background: var(--sel); }
.cmp td:first-child { font-weight: 800; color: var(--cloth); }
.cmp td:last-child { background: #f1f8f2; }
.cmp tbody tr:nth-child(even) td:not(:last-child) { background: #f8f8f1; }

/* quiz */
.score-pill { display: inline-block; background: var(--cloth); color: #fff; font-weight: 800; padding: .1rem .9rem; border-radius: 3px; font-family: ui-monospace, Menlo, monospace, var(--bn-font); }
.lk-q { background: var(--paper); border-radius: 3px; padding: 1rem; margin: .8rem 0; border: 1px solid var(--line); border-top: 4px solid var(--sel); }
.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; overflow-wrap: anywhere; }
.lk-opt:hover { border-color: var(--sel); }
.lk-opt-key { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 3px; background: var(--cloth); color: #fff; flex: none; font-size: .95rem; font-weight: 800; }
.lk-opt.is-right { border-color: var(--ok); background: #e6f4ea; }
.lk-opt.is-wrong { border-color: var(--no); background: #fbe9e7; }
.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); border-radius: 3px; padding: .6rem .9rem; margin: .5rem 0; border: 1px solid var(--line); border-left: 5px solid var(--sel); }
.qa summary, .cq-parts summary { cursor: pointer; font-weight: 700; }
.qa details p, .cq-parts details p { margin: .6rem 0 .2rem; }
.cq-stem { font-weight: 600; }
.cq-parts { list-style: none; padding: 0; }
.summary ul { padding-left: 1.3rem; }
.summary li { margin: .4rem 0; }
.summary h2 { margin-top: 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: 3px; background: var(--cloth); color: #fff; text-decoration: none; font-weight: 700; }
.pager-btn.disabled { background: #e4e3d8; color: #6b6a60; }
.credit { color: var(--ink-2); font-size: var(--fs-sm); padding-bottom: 2rem; }

@media (max-width: 560px) {
  .widget > h3::after { display: none; }
  .card { padding-left: 1.3rem; padding-right: .8rem; }
  .card::before { left: .45rem; }
  .pipe li { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
