/* Layout: lab-bench app. Left rail lists the 12 labs (top strip on phones); each lab = experiments on cards, a With/Without comparison, challenges and a quiz. */
:root {
  --bg: #f5f5f7; --panel: #ffffff; --panel2: #f5f5f7; --ink: #1d1d1f; --muted: #6e6e73; --line: #e0e0e5;
  --accent: #1a73e8; --accent-soft: #e8f0fe; --accent-ink: #ffffff;
  --good: #1e8e3e; --good-soft: #e6f4ea; --bad: #d93025; --bad-soft: #fce8e6; --warn: #b06000; --warn-soft: #fef7e0;
  --g1: #4285f4; --g2: #34a853; --g3: #ea4335; --g4: #f9ab00; --g5: #a142f4; --g6: #12b5cb; --g7: #6e6e73;
  --display: "Inter", -apple-system, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #000000; --panel: #1c1c1e; --panel2: #2c2c2e; --ink: #f5f5f7; --muted: #a1a1a6; --line: #38383a;
  --accent: #8ab4f8; --accent-soft: #1b2a4a; --accent-ink: #0b0b0c;
  --good: #81c995; --good-soft: #13291b; --bad: #f28b82; --bad-soft: #35191a; --warn: #fdd663; --warn-soft: #33290d;
  --g1: #8ab4f8; --g2: #81c995; --g3: #f28b82; --g4: #fdd663; --g5: #d7aefb; --g6: #78d9ec; --g7: #a1a1a6;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.5); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #000000; --panel: #1c1c1e; --panel2: #2c2c2e; --ink: #f5f5f7; --muted: #a1a1a6; --line: #38383a;
  --accent: #8ab4f8; --accent-soft: #1b2a4a; --accent-ink: #0b0b0c;
  --good: #81c995; --good-soft: #13291b; --bad: #f28b82; --bad-soft: #35191a; --warn: #fdd663; --warn-soft: #33290d;
  --g1: #8ab4f8; --g2: #81c995; --g3: #f28b82; --g4: #fdd663; --g5: #d7aefb; --g6: #78d9ec; --g7: #a1a1a6;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.5); color-scheme: dark }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.55; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--panel); }
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100%; }
.rail { position: sticky; top: env(safe-area-inset-top, 0px); align-self: start; height: calc(100vh - env(safe-area-inset-top, 0px)); overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px 20px max(14px, env(safe-area-inset-left, 0px)); }
.brand { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; line-height: 1.15; margin: 0 6px 4px; }
.logo { vertical-align: -8px; margin-right: 8px; background: #fff; border-radius: 8px; padding: 2px; }
.brand small { display: block; font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--muted); letter-spacing: .04em; margin-top: 4px; }
.rail nav { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; }
.rail a { display: grid; grid-template-columns: 28px 1fr 14px; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 14.5px; }
.rail a .n { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.rail a .tick { font-size: 12px; color: var(--good); }
.rail a:hover { background: var(--panel2); }
.rail a.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.rail a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.progress { margin: 18px 6px 0; font-size: 12.5px; color: var(--muted); }
.pbar { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin-top: 6px; border: 1px solid var(--line); }
.pbar span { display: block; height: 100%; background: var(--good); width: 0; transition: width .3s; }
main { min-width: 0; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 24px 80px; }
.view { max-width: 1060px; margin: 0 auto; }
.mtop { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .mtop { display: block; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 6; background: var(--panel); border-bottom: 1px solid var(--line); padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); padding-block: 8px; }
  .mtop .row1 { display: flex; align-items: center; gap: 10px; }
  .mtop .brand { margin: 0; font-size: 14px; flex: 1; }
  .mtop select { flex: 1.4; min-width: 0; }
}
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: clamp(26px, 4.6vw, 40px); line-height: 1.08; margin: 4px 0 10px; }
h2 { font-size: clamp(19px, 2.6vw, 23px); line-height: 1.2; margin: 0 0 4px; }
h3 { font-size: 16.5px; margin: 0 0 6px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.lede { color: var(--muted); max-width: 70ch; margin: 0 0 6px; font-size: 16.5px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px clamp(14px, 2.4vw, 22px); margin-top: 16px; min-width: 0; }
.card > .sub { color: var(--muted); font-size: 14.5px; margin: -2px 0 12px; max-width: 75ch; }
.kicker { font-family: var(--mono); font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.grid2 > *, .grid3 > * { min-width: 0; }
.ctl { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 8px 0; }
.ctl label { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ctl label b { color: var(--ink); font-family: var(--mono); font-size: 13px; min-width: 3.2em; }
input[type=range] { accent-color: var(--accent); width: 140px; }
input[type=text], input[type=number], select, textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
input[type=number] { width: 80px; font-family: var(--mono); font-size: 14px; }
textarea { width: 100%; font-family: var(--mono); font-size: 13.5px; line-height: 1.5; resize: vertical; }
.btn { font: inherit; font-size: 14.5px; font-weight: 700; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 7px 14px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 13.5px; background: var(--panel); color: var(--ink); border: 0; border-right: 1px solid var(--line); padding: 6px 12px; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 13px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.ctx { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.chip.neg { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.chip.dim { opacity: .45; }
.chip.static { cursor: default; }
.tok { font-family: var(--mono); font-size: 13px; padding: 2px 7px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.tok.unk { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.big { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.stat { display: flex; flex-wrap: wrap; gap: 10px; }
.stat > div { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 120px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-family: var(--mono); font-size: 18px; font-weight: 600; }
.v.good { color: var(--good); } .v.bad { color: var(--bad); } .v.warn { color: var(--warn); }
.tbl { overflow-x: auto; }
table { border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; width: 100%; }
th, td { padding: 6px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-family: var(--mono); font-size: 11.5px; font-weight: 400; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 13px; }
td.zero { color: var(--bad); font-weight: 700; background: var(--bad-soft); }
td.okc { color: var(--good); font-weight: 700; }
tr.kept td { background: var(--good-soft); }
tr.pruned td { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--bad); }
tr.done td { background: var(--accent-soft); }
tr.pick { cursor: pointer; }
tr.picked td { outline: 2px solid var(--accent); outline-offset: -2px; }
.hbars { display: grid; gap: 4px; }
.hb { display: grid; grid-template-columns: minmax(64px, 8.5em) 1fr 5.4em; align-items: center; gap: 8px; font-size: 13px; }
.hb .hl { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb .ht { height: 14px; background: var(--panel2); border-radius: 3px; overflow: hidden; border: 1px solid var(--line); }
.hb .hf { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.hb.unseen .hf { background: var(--warn); } .hb.bad .hf { background: var(--bad); } .hb.good .hf { background: var(--good); }
.hb .hv { font-family: var(--mono); text-align: right; font-size: 12.5px; }
.hb.hi .hl { font-weight: 700; color: var(--accent); }
.vs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; margin-top: 16px; }
.vs > div { border-radius: 10px; padding: 14px 16px; border: 1px solid; min-width: 0; }
.vs .with { background: var(--good-soft); border-color: var(--good); }
.vs .without { background: var(--bad-soft); border-color: var(--bad); }
.vs .lab { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.vs .with .lab { color: var(--good); } .vs .without .lab { color: var(--bad); }
.vs p { margin: 6px 0 0; }
.note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 8px 12px; border-radius: 0 6px 6px 0; margin: 10px 0; font-size: 14.5px; }
.note.warn { border-color: var(--warn); background: var(--warn-soft); }
.note.bad { border-color: var(--bad); background: var(--bad-soft); }
.note.good { border-color: var(--good); background: var(--good-soft); }
.eq { font-family: var(--mono); font-size: 13.5px; background: var(--panel2); border: 1px dashed var(--line); border-radius: 6px; padding: 8px 12px; margin: 8px 0; overflow-x: auto; white-space: pre; }
.try { margin: 0; padding-left: 1.2em; } .try li { margin: 4px 0; }
.quiz .q { border-top: 1px solid var(--line); padding: 12px 0 6px; }
.quiz .q:first-of-type { border-top: 0; }
.quiz .opts { display: grid; gap: 6px; margin-top: 6px; }
.quiz .opts button { font: inherit; font-size: 14.5px; text-align: left; background: var(--panel2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; cursor: pointer; }
.quiz .opts button.right { background: var(--good-soft); border-color: var(--good); }
.quiz .opts button.wrong { background: var(--bad-soft); border-color: var(--bad); }
.quiz .why { font-size: 14px; margin-top: 6px; color: var(--muted); }
.quiz .score { font-family: var(--mono); font-size: 13px; color: var(--muted); }
svg text { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
svg .ax { stroke: var(--line); }
svg .gridl { stroke: var(--line); stroke-dasharray: 2 3; }
.chart { width: 100%; height: auto; display: block; }
.heat td { text-align: center; font-family: var(--mono); font-size: 12.5px; min-width: 52px; }
.heat th { text-align: center; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.flow .arrow { color: var(--muted); font-family: var(--mono); }
.box { border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.vecstrip { display: inline-flex; gap: 2px; vertical-align: middle; }
.vecstrip span { width: 12px; height: 18px; border-radius: 2px; display: inline-block; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; margin-top: 18px; }
.lcard { display: block; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.lcard:hover { border-color: var(--accent); }
.lcard .n { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.lcard h3 { font-family: var(--display); font-size: 15.5px; margin: 4px 0 6px; }
.lcard p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.lcard .wo { color: var(--bad); }
.lcard .done { float: right; font-size: 12px; color: var(--good); font-family: var(--mono); }
.foot-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.flash { animation: flash .6s ease; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } .hb .hf, .pbar span { transition: none; } }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.unroll { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.cell { border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; min-width: 74px; background: var(--panel2); font-family: var(--mono); font-size: 12.5px; }
.cell .hv { font-size: 16px; font-weight: 600; }
.stage { opacity: .4; transition: opacity .2s; } .stage.on { opacity: 1; border-color: var(--accent); }

/* ===== Apple/Google polish: big type, soft shadows, frosted bars, rounded cards ===== */
body { -webkit-font-smoothing: antialiased; }
h1, h2 { font-weight: 700; letter-spacing: -.03em; }
h1 { font-size: clamp(30px, 5.4vw, 52px); letter-spacing: -.04em; }
.rail, .mtop { background: color-mix(in srgb, var(--panel) 72%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.card, .lcard { border: 0; border-radius: 20px; box-shadow: var(--shadow); }
.vs > div { border-radius: 16px; }
.btn, .seg, .seg button:first-child { border-radius: 980px; }
.btn { padding: 8px 18px; transition: transform .15s, filter .15s; } .btn:hover { filter: brightness(1.08); } .btn:active { transform: scale(.97); }
.seg button { transition: background .15s; }
.chip, .tok { transition: transform .12s; } .chip:hover { transform: translateY(-1px); }
.rail a { border-radius: 10px; transition: background .15s; }
.big-btn { font-size: 16px; padding: 12px 26px; text-decoration: none; display: inline-block; }
.view { animation: fadeUp .45s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; align-items: center; padding: 28px 0 8px; }
.hero h1 { margin: 8px 0 14px; }
.cyc { background: linear-gradient(90deg, var(--g1), var(--g5), var(--g3)); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; transition: opacity .25s, transform .25s; }
.cyc.out { opacity: 0; transform: translateY(8px); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--muted); font-size: 14px; } .facts b { color: var(--ink); font-size: 18px; }
.hero-art { width: 100%; height: auto; overflow: visible; }
.hero-art .arc { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw 1.4s ease forwards, pulse 4s ease-in-out infinite; animation-delay: var(--d), calc(var(--d) + 1.4s); opacity: .8; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pulse { 50% { opacity: .35; } }
.hero-art .bob { animation: bob 4s ease-in-out infinite; animation-delay: var(--d); }
@keyframes bob { 50% { transform: translateY(-8px); } }
.hero-art .orb { animation: bob 7s ease-in-out infinite; } .hero-art .d2 { animation-delay: -2s; } .hero-art .d3 { animation-delay: -4s; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } }

.lcard { position: relative; overflow: hidden; padding: 18px 20px; transition: transform .25s, box-shadow .25s; animation: fadeUp .5s ease both; animation-delay: calc(var(--i) * 45ms); }
.lcard::before { content: ""; position: absolute; inset: 0; background: radial-gradient(220px circle at var(--mx, 50%) var(--my, -50%), color-mix(in srgb, var(--cc, var(--accent)) 16%, transparent), transparent 70%); opacity: 0; transition: opacity .25s; pointer-events: none; }
.lcard:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 18px 40px rgba(0,0,0,.14); } .lcard:hover::before { opacity: 1; }
.lcard.c1 { --cc: var(--g1); } .lcard.c2 { --cc: var(--g3); } .lcard.c3 { --cc: var(--g4); } .lcard.c4 { --cc: var(--g2); }
.lcard .ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; margin-bottom: 10px; color: var(--cc); background: color-mix(in srgb, var(--cc) 14%, transparent); transition: transform .3s; }
.lcard:hover .ic { transform: rotate(-6deg) scale(1.1); } .lcard .ic svg { width: 30px; height: 30px; }
.lcard .n { color: var(--cc); } .lcard h3 { font-family: var(--display); font-weight: 650; letter-spacing: -.02em; font-size: 17px; }

.confetti { position: fixed; left: 50%; top: 60%; z-index: 50; pointer-events: none; }
.confetti i { position: absolute; width: 9px; height: 14px; border-radius: 2px; animation: pop 1.5s cubic-bezier(.2,.8,.3,1) forwards; }
@keyframes pop { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .view, .lcard, .hero-art *, .cyc { animation: none !important; transition: none !important; } .hero-art .arc { stroke-dashoffset: 0; } }
