/* HunarLab prototype styles.
 * Palette comes from the resistor colour code (level 0..5 = black, brown, red, orange, yellow, green)
 * on a calm sky > meadow > sunrise gradient. The workbench is a soft pale panel too; the LED glow carries a halo so it still reads. */

:root {
  --ink: #17242F;
  --ink-2: #45596A;
  --bg: #EEF3F6;
  --grid: rgba(23, 36, 47, .045);
  --surface: #FFFFFF;
  --surface-2: #F6F9FB;
  --line: #D5DFE6;
  --line-2: #B4C4D0;
  --bw: 1.5px;
  --btn-bg: #17242F;
  --btn-ink: #FFFFFF;
  --shadow: 0 1px 0 rgba(23, 36, 47, .04), 0 10px 24px -16px rgba(23, 36, 47, .35);
  --sky: #B7D8F0;
  --mint: #D0EEE1;
  --sun: #F8EDC2;
  --amber: #F2C230;
  --gold: #D99A00;
  --red: #D8392B;
  --green: #2F8A4A;
  --blue: #2F6DB5;
  --nav-w: 248px;
  --tabs-h: 62px;
  --body: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --head: 'Gabarito', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --urdu: 'Noto Naskh Arabic', 'Noto Nastaliq Urdu', 'Segoe UI', Tahoma, serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font: 400 16px/1.5 var(--body);
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
html[lang="ur"] body, html[lang="ur"] button, html[lang="ur"] h1, html[lang="ur"] h2, html[lang="ur"] .btn,
html[lang="ur"] .brand, html[lang="ur"] .bead, html[lang="ur"] .bench-svg text { font-family: var(--urdu); }
html[lang="ur"] body { line-height: 1.95; }
html[lang="ur"] h1, html[lang="ur"] h2 { line-height: 1.6; }

h1, h2, .brand, .bead, .btn, .mod-id, .xp b { font-family: var(--head); }
h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 800; margin: .5rem 0; }
h2 { font-size: 1.25rem; line-height: 1.2; font-weight: 800; margin: .25rem 0; }
p { margin: .4rem 0; }
a { color: inherit; }
.muted { color: var(--ink-2); margin: 0 0 .5rem; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; }

/* ---------- shell and chrome */
.shell { max-width: 600px; margin: 0 auto; padding: 0 16px 104px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.brand-mark { display: inline-flex; gap: 3px; padding: 5px 8px; background: #8FBCD6; border: var(--bw) solid var(--line-2); border-radius: 10px; }
.brand-mark i { width: 5px; height: 16px; border-radius: 1px; }
.brand-mark i:nth-child(1) { background: var(--red); }
.brand-mark i:nth-child(2) { background: var(--red); }
.brand-mark i:nth-child(3) { background: #7A4A2B; }
.lang { min-height: 42px; padding: 0 16px; border: var(--bw) solid var(--line-2); border-radius: 999px; background: var(--surface); font-weight: 700; cursor: pointer; }

.crumbs ol { display: flex; flex-wrap: wrap; gap: 2px 8px; list-style: none; padding: 0; margin: 0 0 6px; font-size: .9rem; color: var(--ink-2); }
.crumbs li + li::before { content: '\203A'; margin-inline-end: 8px; opacity: .6; }
[dir="rtl"] .crumbs li + li::before { content: '\2039'; }
.crumbs a { display: inline-block; padding: 6px 0; color: var(--ink-2); }
.crumbs [aria-current] { color: var(--ink); font-weight: 700; padding: 6px 0; }

.page { padding-top: 6px; outline: none; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 22px; border: var(--bw) solid var(--btn-bg); border-radius: 12px;
  background: var(--btn-bg); color: var(--btn-ink); font-size: 1rem; font-weight: 800; text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { filter: brightness(1.15); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { filter: none; }
.btn-ghost:hover { background: var(--surface); }
.btn-small { min-height: 42px; padding: 0 18px; font-size: .95rem; }
.btn.is-disabled, .btn[disabled] { opacity: .38; pointer-events: none; cursor: not-allowed; }

.bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.bar > * { flex: 1; max-width: 272px; }

/* ---------- home */
.hero { padding-top: 6px; }
.hero h1 { font-size: 2.05rem; }
.hero p { max-width: 44ch; color: var(--ink-2); font-size: 1.05rem; }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }
.xp { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 16px; border: var(--bw) solid var(--line-2); border-radius: 999px; background: var(--surface); }
.xp b { font-size: 1.25rem; }

.path { list-style: none; margin: 30px 0 0; padding: 0; }
.level { position: relative; display: grid; grid-template-columns: 46px 1fr; gap: 14px; padding-bottom: 24px; }
.level::before { content: ''; position: absolute; inset-inline-start: 21px; top: 46px; bottom: 0; width: 3px; background: rgba(23, 36, 47, .22); }
.level:last-child::before { display: none; }
.level.is-open::before { background-image: linear-gradient(to bottom, var(--gold) 0 7px, transparent 7px); background-size: 3px 15px; background-repeat: repeat-y; animation: run 1s linear infinite; }
@keyframes run { to { background-position: 0 15px; } }
.bead { width: 46px; height: 46px; display: grid; place-items: center; border: var(--bw) solid var(--line-2); border-radius: 50%; font-size: 1.35rem; font-weight: 800; background: var(--band); color: var(--bandink); }
.level.is-locked { opacity: .62; }
.lvl-body h2 { margin-top: 8px; }
.proto { margin-top: 8px; padding: 10px 14px; border: 2px dashed rgba(23, 36, 47, .35); border-radius: 12px; color: var(--ink-2); font-size: .92rem; }

/* ---------- lists: modules and steps */
.lvl-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; }
.lvl-head h1 { margin: 0; }
.mods { list-style: none; margin: 0; padding: 0; }
.mods li { position: relative; padding-inline-start: 62px; padding-bottom: 14px; }
.mods li::before { content: ''; position: absolute; inset-inline-start: 22px; top: 0; bottom: 0; width: 4px; background: rgba(23, 36, 47, .16); border-radius: 2px; }
.mods li:first-child::before { top: 24px; } .mods li:last-child::before { bottom: auto; height: 24px; }
.mods li.is-done::before { background: var(--green); }
.node { position: absolute; inset-inline-start: 4px; top: 4px; width: 40px; height: 40px; display: grid; place-items: center; border: var(--bw) solid var(--line-2); border-radius: 50%;
  background: var(--surface); font: 800 .8rem var(--head); color: var(--ink); z-index: 1; }
.is-done .node { background: var(--green); color: #fff; border-color: var(--green); }
.is-now .node { background: var(--amber); box-shadow: 0 0 0 5px rgba(242, 194, 48, .35); }
.is-soon .node { border-style: dashed; color: var(--ink-2); background: var(--surface); }
.mod { display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 10px 14px; border: var(--bw) solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--ink); text-decoration: none; }
a.mod:hover { background: var(--surface); }
.is-now .mod { background: var(--surface); box-shadow: 0 6px 0 rgba(23, 36, 47, .12); }
.mod .ico { width: 28px; height: 28px; flex: none; }
.mod-name { flex: 1; font-weight: 700; }
.mod-state { font-size: .9rem; color: var(--ink-2); white-space: nowrap; }
.mod-state .star { font-size: 1rem; }
.pill { display: inline-block; padding: 4px 14px; border-radius: 999px; background: var(--btn-bg); color: var(--btn-ink); font-weight: 800; font-size: .9rem; }
.mod.is-soon { opacity: .6; border-style: dashed; }
.ico { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.mod-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 4px; }
.mod-head .ico { width: 42px; height: 42px; }
.mod-head h1 { margin: 2px 0 0; }
.sub { margin: 18px 0 10px; }
.stepcards { list-style: none; margin: 0; padding: 0; }
.stepcard { display: flex; align-items: center; gap: 14px; min-height: 70px; padding: 12px 14px; margin-bottom: 10px; border: var(--bw) solid var(--line-2); border-radius: 12px;
  background: var(--surface); color: var(--ink); text-decoration: none; }
.stepcard:hover { background: var(--surface); }
.stepcard-mark { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: var(--bw) solid var(--line-2); border-radius: 50%; font: 800 1rem var(--head); }
.stepcard.is-done .stepcard-mark { background: #3E9B55; border-color: #2F7B44; }
.stepcard.is-done .ico { stroke: #fff; stroke-width: 2.6; width: 22px; height: 22px; }
.stepcard-text { flex: 1; }
.stepcard-text b { display: block; font-size: 1.05rem; }
.stepcard-text span { color: var(--ink-2); font-size: .92rem; }

/* ---------- step navigation (resistor-band progress) */
.steps ol { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; list-style: none; padding: 0; margin: 4px 0 10px; }
.step { display: block; padding: 8px 0 2px; text-align: center; text-decoration: none; color: var(--ink-2); font-size: .8rem; }
.step i { display: block; height: 9px; margin-bottom: 5px; border-radius: 5px; background: rgba(23, 36, 47, .2); }
.step.past i { background: var(--ink); }
.step.now { color: var(--ink); font-weight: 700; }
.step.now i { background: var(--amber); box-shadow: 0 0 0 2px var(--ink); }

/* ---------- bench */
.mount { margin: 12px 0; }
.bench { background: linear-gradient(180deg, #FBFDFF 0%, #EEF6FB 100%); border: var(--bw) solid var(--line-2); border-radius: 16px; overflow: hidden; }
.bench-banner { padding: 11px 14px; font-weight: 700; font-size: .95rem; background: #DCEBF5; color: var(--ink); border-bottom: 2px solid rgba(23, 36, 47, .15); }
.bench-banner.is-good { background: #CDEBD6; color: #14502A; }
.bench-banner.is-warn { background: #FBE9A6; color: #5A4300; }
.bench-banner.is-bad { background: #F8D2CD; color: #7D170D; }
.bench-svg { display: block; width: 100%; height: auto; aspect-ratio: 360 / 400; max-height: 62vh; touch-action: none; user-select: none; -webkit-user-select: none; }
.bench-ro .bench-svg { max-height: 44vh; touch-action: auto; }
.bench-svg text { font-family: var(--head); }
.bench-help { padding: 8px 14px 0; color: var(--ink-2); font-size: .9rem; }
.bench-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px 12px; }
.chip { min-height: 44px; padding: 0 16px; border: var(--bw) solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 700; font-size: .92rem; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip.on, .chip-main { background: var(--amber); border-color: var(--amber); color: #17242F; }
.chip[disabled] { opacity: .35; pointer-events: none; }
.vals { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.chip-val { display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; }
.chip-val .mini { display: inline-flex; gap: 2px; }
.chip-val .mini i { width: 4px; height: 16px; border-radius: 1px; }
.term-idle { animation: idle 2.6s ease-in-out infinite; }
@keyframes idle { 50% { stroke: var(--amber); } }
.flow { fill: none; stroke: var(--amber); stroke-width: 4.5; stroke-linecap: round; stroke-dasharray: 1 14; animation: flow var(--dur, 1s) linear infinite; pointer-events: none; }
.flow.rev { animation-direction: reverse; }
@keyframes flow { to { stroke-dashoffset: -15; } }
.puff { fill: #9AA5AD; opacity: 0; transform-box: fill-box; transform-origin: center; animation: puff 1.7s ease-out forwards; }
.puff.p2 { animation-delay: .15s; } .puff.p3 { animation-delay: .3s; }
@keyframes puff { 0% { opacity: 0; transform: translateY(0) scale(.6); } 20% { opacity: .85; } 100% { opacity: 0; transform: translateY(-20px) scale(1.7); } }

/* ---------- watch / meet */
.caption { font-size: 1.15rem; min-height: 4.2em; margin: 12px 0 6px; }
.demo-ctl { display: flex; align-items: center; gap: 14px; margin: 8px 0; }
.dot { position: relative; display: inline-block; width: 18px; height: 18px; padding: 0; border: var(--bw) solid var(--line-2); border-radius: 50%; background: transparent; cursor: pointer; }
.dot::after { content: ''; position: absolute; inset: -12px; }
.dot.on { background: var(--ink); }
.demo-ctl .chip { margin-inline-start: auto; border-color: var(--ink); color: var(--ink); }
.demo-ctl .chip:hover { border-color: var(--ink); }
.note { color: var(--ink-2); font-size: .9rem; }

.part-name { margin-bottom: 0; }
.part-role { font-size: 1.1rem; color: var(--ink-2); }
.meet-art { margin: 12px 0; padding: 10px; background: linear-gradient(180deg, #FBFDFF 0%, #EEF6FB 100%); border: var(--bw) solid var(--line-2); border-radius: 16px; }
.meet-art svg { display: block; width: 100%; height: auto; max-height: 300px; }
.spot { cursor: pointer; outline: none; }
.spot-ring { fill: none; stroke: var(--amber); stroke-width: 2.5; animation: ring 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.spot.on .spot-ring { fill: var(--amber); animation: none; }
.spot:focus-visible .spot-ring { stroke: #fff; stroke-width: 4; }
@keyframes ring { 50% { transform: scale(1.5); opacity: .55; } }
.spot-text { min-height: 3.4em; margin: 10px 0; padding: 10px 14px; border: var(--bw) solid var(--line-2); border-radius: 12px; background: var(--surface); font-size: 1.05rem; }
.where { color: var(--ink-2); }

/* ---------- challenge / recall */
.task-count { display: inline-block; padding: 2px 12px; border: var(--bw) solid var(--line-2); border-radius: 999px; background: var(--surface); font-size: .85rem; font-weight: 700; }
.task-head h1 { margin-top: 10px; }
.goal { font-size: 1.08rem; }
.task-ctl { display: flex; gap: 10px; margin: 14px 0 6px; }
.task-ctl .btn { flex: 1; padding: 0 12px; }
.fail { margin: 10px 0; padding: 10px 14px; border: 2px solid var(--red); border-radius: 12px; background: #FBE3E0; color: #7D170D; font-weight: 700; }
.hints { margin: 12px 0; padding: 0; list-style: none; }
.hints li { margin-bottom: 8px; padding: 10px 14px; border: var(--bw) solid var(--line-2); border-inline-start-width: 8px; border-inline-start-color: var(--amber); border-radius: 12px; background: var(--surface); }
.result { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 14px 0; padding: 16px; border: 2px solid var(--green); border-radius: 14px; background: var(--surface); }
.result-title { display: inline-flex; align-items: center; gap: 8px; font: 800 1.25rem var(--head); }
.result .ico { stroke: var(--green); stroke-width: 2.6; width: 26px; height: 26px; }
.stars { display: inline-flex; gap: 2px; }
.star { font-size: 1.7rem; line-height: 1; color: rgba(23, 36, 47, .22); }
.star.on { color: var(--gold); }
.mod-state .star { font-size: 1rem; }

.question { font-size: 1.5rem; margin: 12px 0; }
.opts { display: grid; gap: 10px; }
.opt { min-height: 58px; padding: 12px 16px; border: var(--bw) solid var(--line-2); border-radius: 12px; background: var(--surface); text-align: start; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.opt:hover:not([disabled]) { background: var(--surface); }
.opt.right { border-color: var(--green); background: #DFF3E4; }
.opt.wrong { border-color: var(--red); background: #FBE3E0; }
.opt[disabled] { cursor: default; }
.feedback { margin-top: 14px; padding: 12px 14px; border: var(--bw) solid var(--line-2); border-radius: 12px; }
.feedback.good { border-color: var(--green); background: #DFF3E4; }
.feedback.bad { border-color: var(--red); background: #FBE3E0; }

/* ---------- done */
.done { text-align: center; padding-top: 12px; }
.done-badge { display: inline-flex; gap: 16px; padding: 12px 34px; background: #8FBCD6; border: var(--bw) solid var(--line-2); border-radius: 34px; }
.done-badge i { width: 15px; height: 40px; border-radius: 2px; }
.done-badge i:nth-child(1), .done-badge i:nth-child(2) { background: var(--red); }
.done-badge i:nth-child(3) { background: #7A4A2B; }
.done-tasks { list-style: none; margin: 16px 0; padding: 0; text-align: start; }
.done-tasks li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; margin-bottom: 8px; border: var(--bw) solid var(--line-2); border-radius: 12px; background: var(--surface); font-weight: 700; }
.xp-earned { font: 800 1.2rem var(--head); }

@media (prefers-reduced-motion: reduce) {
  .level.is-open::before, .term-idle, .spot-ring, .flow, .puff { animation: none; }
  .puff { opacity: .5; }
}

/* ---- account pages ---- */
.top-r { display: flex; align-items: center; gap: 8px; }
.authlink { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border: var(--bw) solid var(--line-2); border-radius: 999px;
  background: var(--amber); color: var(--ink); font-weight: 700; text-decoration: none; max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.authlink:hover { background: #f7d45a; }
.form { display: grid; gap: 14px; background: var(--surface); border: var(--bw) solid var(--line-2); border-radius: 18px; padding: 20px; }
.field { display: grid; gap: 6px; font-weight: 700; }
.field input { min-height: 50px; padding: 0 14px; border: var(--bw) solid var(--line-2); border-radius: 12px; background: var(--surface); font: inherit; color: var(--ink); }
.field input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.form .btn { width: 100%; }
.form-alt { margin: 4px 0 0; text-align: center; }
.form-alt a { color: var(--ink); font-weight: 700; }
.form-err { min-height: 1.4em; margin: 0; color: var(--red); font-weight: 700; }
.acct { display: grid; gap: 10px; background: var(--surface); border: var(--bw) solid var(--line-2); border-radius: 18px; padding: 20px; }
.acct h2 { margin: 0; } .acct p { margin: 0; }
.acct-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.field select { min-height: 50px; padding: 0 12px; border: var(--bw) solid var(--line-2); border-radius: 12px; background: var(--surface); font: inherit; color: var(--ink); }
.field select:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.hint { font-weight: 400; color: var(--ink-2); font-size: .85rem; }
.ok { margin: 0; padding: 10px 14px; border: 2px solid var(--green); border-radius: 12px; background: #DDF2E4; color: #14502A; font-weight: 700; }
.bench-svg .wave { animation: wavepulse .7s ease-in-out infinite alternate; }
.bench-svg .wave.w2 { animation-delay: .25s; }
@keyframes wavepulse { from { opacity: .25; } to { opacity: 1; } }
.bench-math { padding: 10px 14px; background: #FFF8DC; border-top: 2px solid rgba(23, 36, 47, .12); font-size: .9rem; line-height: 1.5; color: var(--ink); }
.bench-math[hidden] { display: none; }
.bench-math b { display: block; font-family: var(--head); margin-bottom: 2px; }
.bench-math div { font-variant-numeric: tabular-nums; }
.calc { background: var(--surface); border: var(--bw) solid var(--line-2); border-radius: 16px; padding: 14px; margin-top: 14px; }
.calc h2 { margin: 0 0 6px; font-size: 1.05rem; }
.calc p { margin: 0 0 10px; }
.calc-opts { display: grid; gap: 8px; }
.calc-ok { background: #E4F4E8; border-color: #3E9B55; }
.calc-ok p { margin: 0; }
.bench-math .step { display: flex; gap: 8px; align-items: flex-start; margin: 5px 0; }
.bench-math .step i { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-style: normal; font-size: .78rem; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
.bench-math .key { margin: 8px 0 0; padding-top: 6px; border-top: 1px dashed rgba(23, 36, 47, .25); font-size: .8rem; opacity: .75; }
.wflow { stroke-dasharray: 5 14; animation: wf var(--dur, 1s) linear infinite; }
@keyframes wf { to { stroke-dashoffset: -38; } }
.wctl { padding: 10px 12px 2px; display: grid; gap: 10px; }
.wrow > span { display: block; font-weight: 700; font-size: .88rem; margin-bottom: 4px; }
.wrow.is-locked { opacity: .55; }
.water .bench-math { border-top: 0; border-bottom: 2px solid rgba(23, 36, 47, .12); }
.think { padding: 14px 12px 6px; }
.chain-title { margin: 0 0 10px; font-size: 1.05rem; }
.chain { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 4px; }
.stage { border: var(--bw) solid var(--line-2); border-radius: 14px; padding: 10px 8px; text-align: center; font: inherit; color: var(--ink); display: flex; flex-direction: column; gap: 6px; }
button.stage { cursor: pointer; }
.stage b { font-family: var(--head); font-size: .95rem; }
.stage span { font-size: .8rem; line-height: 1.3; }
.stage.on { box-shadow: 0 0 0 3px var(--sun, #F2C230); }
.arrow { align-self: center; font-weight: 700; font-size: 1.2rem; }
.bench-ro .stage { animation: stagepulse 4.5s infinite; }
.bench-ro .stage.st1 { animation-delay: 1.5s; }
.bench-ro .stage.st2 { animation-delay: 3s; }
@keyframes stagepulse { 0%, 28%, 100% { box-shadow: none; transform: none; } 6%, 22% { box-shadow: 0 0 0 4px #F2C230; transform: translateY(-3px); } }
.chain-note { margin: 12px 2px 4px; font-size: .92rem; line-height: 1.45; }
.crow { margin-bottom: 14px; }
.clabel { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 8px; font-weight: 700; font-size: .95rem; }
.clabel i { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-style: normal; font-size: .78rem; display: grid; place-items: center; margin-top: 1px; }
@media (max-width: 380px) { .stage span { font-size: .72rem; } }

/* ---- Maker: block code bench */
.bench.code { overflow: visible; }
.code-top { position: sticky; top: 0; z-index: 5; background: #F4F8FB; border-radius: 14px 14px 0 0; box-shadow: 0 3px 8px rgba(23, 36, 47, .18); }
.bench.code .bench-banner { border-radius: 14px 14px 0 0; }
.bench.code .code-kit { display: block; width: 100%; height: auto; max-height: 180px; background: #F4F8FB; }
.bench.code .code-in { padding: 8px 12px 0; }
.bench.code .code-in:empty { display: none; }
.code-prog { padding: 10px 10px 4px; min-height: 40px; }
.code-pal { padding: 6px 12px 0; }
.code-tools { display: flex; gap: 8px; padding: 10px 12px 12px; flex-wrap: wrap; }
.blk { background: var(--surface); border: 2px solid #9DB6C8; border-radius: 12px; margin: 6px 0; padding: 8px 10px; font-weight: 600; font-size: .92rem; line-height: 1.9; color: var(--ink); }
.blk-set, .blk-bright, .blk-change { border-left: 8px solid #2F6DB5; }
.blk-wait { border-left: 8px solid #D99A00; }
.blk-forever, .blk-repeat { border-left: 8px solid #7A4FB5; background: #F3EEFA; }
.blk-if, .blk-until { border-left: 8px solid #3E9B55; background: #EAF6EE; }
.blk.sel { outline: var(--bw) solid var(--line-2); }
.blk.run { box-shadow: 0 0 0 4px #F2C230; }
.blk-sel { font: inherit; font-weight: 700; min-height: 36px; margin: 0 4px; border-radius: 8px; border: 2px solid #9DB6C8; background: var(--surface); color: var(--ink); max-width: 100%; }
.blk-slot { margin: 6px 0 2px 14px; padding-left: 8px; border-left: 3px dashed #9DB6C8; }
.blk-slot-h { font-size: .8rem; font-weight: 800; color: #4A5E6E; }
.blk-ctl { display: flex; gap: 6px; margin-top: 4px; }
.slot { display: block; width: 100%; min-height: 40px; margin: 4px 0; border: 2px dashed #9DB6C8; background: transparent; border-radius: 10px; font: inherit; font-weight: 700; font-size: .85rem; color: #4A5E6E; cursor: pointer; }
.slot.on { border-color: var(--ink); background: #FFF4C2; color: var(--ink); }
.code-kit [data-btn] { touch-action: none; }

/* ---- fields */
.fields { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 14px; }
.fcard { background: var(--surface); border: var(--bw) solid var(--line-2); border-radius: 18px; padding: 14px 16px; text-align: start; }
.fcard.is-cur { box-shadow: 0 0 0 4px var(--gold); }
.fcard.is-soon { opacity: .7; border-style: dashed; }
.fcard h2 { margin: 0; font-size: 1.2rem; }
.fcard p { margin: 8px 0 0; }
.field-top { display: flex; align-items: center; gap: 12px; }
.field-ico { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border: var(--bw) solid var(--line-2); border-radius: 14px; background: var(--band); color: var(--bandink); }
.field-ico .ico { width: 26px; height: 26px; }
.field-ico.is-small { width: 32px; height: 32px; border-width: 2px; border-radius: 10px; }
.field-ico.is-small .ico { width: 18px; height: 18px; }
.field-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.pill-soon { background: #E3E9EE; color: var(--ink); }
.field-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; max-width: none; font-size: .95rem; }
.field-chip a { color: var(--ink); font-weight: 700; margin-inline-start: auto; }

/* ---- my idea + my lab */
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.tool { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--surface); border: var(--bw) solid var(--line-2); border-radius: 16px; color: var(--ink); text-decoration: none; text-align: start; }
.tool .ico { flex: none; width: 28px; height: 28px; }
.tool b { display: block; font-family: var(--head); }
.tool small { display: block; color: var(--ink-2); line-height: 1.3; }
.field textarea { padding: 12px 14px; border: var(--bw) solid var(--line-2); border-radius: 12px; background: var(--surface); font: inherit; color: var(--ink); resize: vertical; }
.field textarea:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.idea-note { margin: 0; text-align: center; font-size: .92rem; }
.idea-note a { color: var(--ink); font-weight: 700; }
.idea-src { display: inline-block; margin: 12px 0 0; padding: 6px 12px; border-radius: 10px; background: #FFF4C2; border: var(--bw) solid var(--line-2); font-size: .9rem; font-weight: 600; }
.projs { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.proj { display: flex; align-items: center; gap: 10px; background: var(--surface); border: var(--bw) solid var(--line-2); border-radius: 14px; padding: 8px 10px; }
.proj-main { flex: 1; min-width: 0; color: var(--ink); text-decoration: none; text-align: start; padding: 4px; }
.proj-main b, .proj-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-main small { color: var(--ink-2); }
.chip-warn { background: #D8392B; color: #fff; border-color: #D8392B; }
.lab-new { justify-content: flex-start; }
.proj-name { margin-bottom: 12px; text-align: start; }
.idg { background: var(--surface); border: var(--bw) solid var(--line-2); border-radius: 16px; padding: 12px; }
.idg-flow { display: flex; align-items: stretch; gap: 6px; }
.idg-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.idg-h { font-size: .74rem; font-weight: 800; color: var(--ink-2); text-align: center; }
html[lang="ur"] .idg-h { letter-spacing: 0; font-size: .85rem; }
.idg-box { display: block; padding: 8px 6px; border: var(--bw) solid var(--line-2); border-radius: 10px; font-size: .84rem; font-weight: 700; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.idg-input { background: #D9ECFA; } .idg-brain { background: #FFE9A8; } .idg-output { background: #CDEBD6; } .idg-power { background: #F9D5D0; } .idg-body { background: #E9EEF2; }
.idg-arrow { align-self: center; font-size: 1.4rem; font-weight: 800; }
.idg-base { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 2px dashed #9DB6C8; }
.idg-base .idg-box { flex: 1 1 40%; }
.partlist, .steplist, .safelist { margin: 8px 0 0; padding: 0; text-align: start; }
.partlist { list-style: none; display: grid; gap: 8px; }
.partlist li { display: flex; gap: 10px; background: var(--surface); border: var(--bw) solid var(--line-2); border-radius: 12px; padding: 8px 10px; }
.partlist small { display: block; color: var(--ink-2); }
.part-q { flex: none; min-width: 2.2em; font-family: var(--head); font-weight: 800; }
.steplist, .safelist { padding-inline-start: 1.4em; }
.steplist li, .safelist li { margin: 6px 0; }

/* ---- community */
.tool-wide { grid-column: 1 / -1; }
.com-tabs { justify-content: flex-start; margin-top: 12px; }
.com-rules { font-size: .88rem; margin-top: 14px; text-align: start; }
.posts, .replies { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.post { display: block; background: var(--surface); border: var(--bw) solid var(--line-2); border-radius: 14px; padding: 10px 12px; color: var(--ink); text-decoration: none; text-align: start; }
.post b { display: block; font-family: var(--head); overflow-wrap: anywhere; }
.post-ex { display: block; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 6px 0 0; font-size: .86rem; color: var(--ink-2); font-weight: 600; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; text-align: start; }
.post-acts { justify-content: flex-start; margin: 12px 0; }
.reply { background: var(--surface); border: 2px solid #9DB6C8; border-radius: 12px; padding: 8px 12px; text-align: start; }
.reply p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply .chip, .post-acts .chip { min-height: 36px; }
#comview .form { margin-top: 14px; }
.field select, .field textarea, .field input { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.field { min-width: 0; }

/* ====================================================================== theme 2: one app for phone, tablet and laptop
 * Light and dark come from the tokens in :root. "Light islands" (the workbench, diagrams, result panels) keep
 * their paper look in dark mode by resetting the tokens locally, so everything inside them stays readable. */
:root[data-theme="dark"] {
  --ink: #EAF1F6; --ink-2: #A9BBC9; --bg: #0F1820; --grid: rgba(234, 241, 246, .035);
  --surface: #17232E; --surface-2: #1E2D3A; --line: #2A3B49; --line-2: #486073;
  --btn-bg: #F2C230; --btn-ink: #17242F; --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 28px -16px rgba(0, 0, 0, .8);
  --blue: #7DB4EC; --red: #F0766A; --green: #5CC07A;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #EAF1F6; --ink-2: #A9BBC9; --bg: #0F1820; --grid: rgba(234, 241, 246, .035);
    --surface: #17232E; --surface-2: #1E2D3A; --line: #2A3B49; --line-2: #486073;
    --btn-bg: #F2C230; --btn-ink: #17242F; --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 28px -16px rgba(0, 0, 0, .8);
    --blue: #7DB4EC; --red: #F0766A; --green: #5CC07A;
    color-scheme: dark;
  }
}
.bench, .meet-art, .idg, .calc, .feedback, .fail, .ok, .result, .idea-src, .opt.right, .opt.wrong, .bench-math, .proj-name input {
  --ink: #17242F; --ink-2: #45596A; --surface: #FFFFFF; --surface-2: #F6F9FB; --line: #D5DFE6; --line-2: #B4C4D0;
  --btn-bg: #17242F; --btn-ink: #FFFFFF; --blue: #2F6DB5; --red: #D8392B; --green: #2F8A4A;
  color: var(--ink); color-scheme: light;
}
.fail { color: #7D170D; } .ok { color: #14502A; }
.bench, .meet-art, .idg { border-color: var(--line-2); }

/* identity marks keep their strong outline */
.bead, .node, .done-badge, .field-ico, .brand-mark, .stepcard-mark, .dot { border-color: var(--ink); border-width: 2px; }
.bead { border-width: 3px; }
.field-ico, .bead { border-color: #17242F; }

/* quiet cards */
.mod, .stepcard, .fcard, .tool, .proj, .post, .form, .acct, .partlist li, .hints li, .done-tasks li, .spot-text, .opt, .reply { box-shadow: var(--shadow); border-radius: 16px; }
.fcard, .tool, .form, .acct { border-radius: 20px; }
.fcard.is-cur { box-shadow: 0 0 0 3px var(--amber), var(--shadow); border-color: var(--amber); }
.is-now .mod { box-shadow: 0 0 0 3px var(--amber), var(--shadow); border-color: var(--amber); }
.xp, .task-count, .lang { border-color: var(--line-2); }
.field input, .field select, .field textarea, .blk-sel { border-color: var(--line-2); border-width: 1.5px; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink); }
.reply { border-color: var(--line); }
.hero h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.9rem); letter-spacing: -.015em; }
html[lang="ur"] .hero h1 { letter-spacing: 0; }
.hero p { max-width: 60ch; }
.page { text-align: start; }
.crumbs ol { margin-top: 2px; }
.level::before { background: var(--line-2); }
.step i { background: var(--line-2); }
.step.past i { background: var(--ink); }
.mods li::before { background: var(--line); }
.authlink { display: none; }
.proto { border-color: var(--line-2); }
.code-top { background: #F4F8FB; }

/* ---- app shell: tab bar on phones, side menu on wide screens */
.nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 5; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: color-mix(in srgb, var(--surface) 94%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.nav-brand, .nav-foot { display: none; }
.nav-list { display: flex; flex: 1; list-style: none; margin: 0; padding: 0; }
.nav-list li { flex: 1; min-width: 0; }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--tabs-h); color: var(--ink-2); text-decoration: none; font-size: .72rem; font-weight: 700; line-height: 1.1; }
html[lang="ur"] .nav-item { font-size: .8rem; line-height: 1.5; }
.nav-item span { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .ico { width: 24px; height: 24px; stroke: currentColor; }
.nav-item[aria-current] { color: var(--ink); }
.nav-item[aria-current] .ico { stroke-width: 2.4; }
.nav-item[aria-current]::before { content: ''; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: var(--amber); }
.nav-list li { position: relative; display: flex; justify-content: center; }
.nav-item { width: 100%; }
.app-shell.is-focus .nav { display: none; }
.app-shell:not(.is-focus) .shell { padding-bottom: calc(var(--tabs-h) + 34px + env(safe-area-inset-bottom)); }
.app-shell:not(.is-focus) .shell:has(.bar) { padding-bottom: calc(var(--tabs-h) + 110px + env(safe-area-inset-bottom)); }
.app-shell:not(.is-focus) .bar { bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0; border: var(--bw) solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn .ico { width: 20px; height: 20px; }
.lang { background: var(--surface); }

/* ---- tablet: more room, lists in two columns */
@media (min-width: 720px) {
  .shell { max-width: 880px; padding-inline: 28px; }
  .fields, .projs, .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tool-wide { grid-column: auto; }
  .path { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .level { padding: 16px; border: var(--bw) solid var(--line-2); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
  .level::before { display: none; }
  .mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
  .stepcards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stepcard { margin-bottom: 0; }
  .opts, .calc-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form, .acct { max-width: 560px; }
  .bar > * { max-width: 300px; }
}

/* ---- laptop: side menu, and the lab sits beside its instructions */
@media (min-width: 1040px) {
  .nav { inset-inline: 0 auto; inset-block: 0; width: var(--nav-w); height: auto; padding: 22px 16px; flex-direction: column; gap: 22px;
    border-top: 0; border-inline-end: 1px solid var(--line); background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav-brand { display: block; padding-inline: 8px; }
  .nav-list { flex: 0 0 auto; flex-direction: column; gap: 4px; }
  .nav-list li { flex: none; }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; height: 46px; padding: 0 12px; border-radius: 12px; font-size: 1rem; }
  html[lang="ur"] .nav-item { font-size: 1.05rem; }
  .nav-item:hover { background: var(--surface-2); color: var(--ink); }
  .nav-item[aria-current] { background: var(--surface-2); }
  .nav-item[aria-current]::before { top: 10px; bottom: 10px; inset-inline-start: 0; width: 4px; height: auto; border-radius: 0 4px 4px 0; }
  [dir="rtl"] .nav-item[aria-current]::before { border-radius: 4px 0 0 4px; }
  .nav-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-inline: 8px; }
  .app-shell.is-focus .nav { display: flex; }
  .app-shell .shell, .app-shell:not(.is-focus) .shell { max-width: 1120px; margin-inline: calc(var(--nav-w) + max(0px, (100vw - var(--nav-w) - 1120px) / 2)) auto; padding: 14px 40px 120px; }
  .top { display: none; }
  .crumbs { padding-top: 6px; }
  .bar, .app-shell:not(.is-focus) .bar { inset-inline-start: var(--nav-w); bottom: 0; padding-bottom: 14px; }
  .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .path { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps { max-width: 620px; }

  /* lab on one side (it stays in view), words and controls on the other */
  .page:has(> .mount), #comview:has(> .mount) { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); column-gap: 36px; align-items: start; align-content: start; }
  .page:has(> .mount) > *, #comview:has(> .mount) > * { grid-column: 2; }
  .page:has(> .mount) > .mount, #comview:has(> .mount) > .mount { grid-column: 1; grid-row: 1 / span 40; margin-top: 0; }
  .page:has(> .mount) > .mount:has(.bench:not(.code)) { position: sticky; top: 16px; }
  .bench-svg { max-height: 74vh; }
  .bench-ro .bench-svg { max-height: 60vh; }
  .caption { min-height: 0; font-size: 1.3rem; }
  .code-top { position: static; box-shadow: none; }
  .bench.code .code-kit { max-height: 300px; }
  .idg, .partlist, .steplist, .safelist { max-width: 640px; }
}
@media (min-width: 1040px) and (max-width: 1240px) { .app-shell .shell, .app-shell:not(.is-focus) .shell { padding-inline: 28px; } .fields, .path { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.bench-svg { max-height: min(62vh, 560px); }
@media (min-width: 1040px) {
  .bench-svg { max-height: calc(100vh - 290px); min-height: 320px; }
  .bench-ro .bench-svg { max-height: calc(100vh - 330px); }
  .field-chip a { margin-inline-start: 8px; }
}

.blk-speed, .blk-angle { border-left: 8px solid #2F6DB5; }
.blk-vset, .blk-vchange { border-left: 8px solid #1F8A8A; }
[dir="rtl"] .blk { border-left-width: 2px; border-left-color: #9DB6C8; border-right-width: 8px; border-right-style: solid; }
[dir="rtl"] .blk-set, [dir="rtl"] .blk-bright, [dir="rtl"] .blk-change, [dir="rtl"] .blk-speed, [dir="rtl"] .blk-angle { border-right-color: #2F6DB5; }
[dir="rtl"] .blk-wait { border-right-color: #D99A00; }
[dir="rtl"] .blk-forever, [dir="rtl"] .blk-repeat { border-right-color: #7A4FB5; }
[dir="rtl"] .blk-if, [dir="rtl"] .blk-until { border-right-color: #3E9B55; }
[dir="rtl"] .blk-vset, [dir="rtl"] .blk-vchange { border-right-color: #1F8A8A; }
[dir="rtl"] .blk-slot { margin: 6px 14px 2px 0; padding-left: 0; padding-right: 8px; border-left: 0; border-right: 3px dashed #9DB6C8; }
:root[data-theme="dark"] .bead { border-color: var(--line-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bead { border-color: var(--line-2); } }
