/* ===== Faradium: lab-console design system (dark slate, blue accent) ===== */
:root, :root[data-theme="light"] .stage-dark {
  /* neutrals: deep navy ink with a subtle blue tint */
  --bg: #0e1626;
  --bg-2: #0a111f;
  --bench: #131d31;          /* lab workspace */
  --bench-2: #0d1525;        /* optics table */
  --head: rgba(8, 13, 24, .92);
  --head-solid: #080d18;
  --panel: #121b2e;
  --panel-2: #18233a;
  --panel-3: #213049;
  --card: rgba(120, 160, 255, .035);
  --card-line: rgba(140, 175, 255, .10);
  --line: rgba(140, 175, 255, .08);
  --line-2: rgba(140, 175, 255, .16);
  --text: #eef3fc;
  --text-2: #c9d4ea;
  --muted: #8b9abb;
  --faint: #5c6b8c;
  /* brand */
  --accent: #3b82f6;          /* primary actions */
  --accent-2: #60a5fa;
  --accent-rgb: 59, 130, 246;
  --accent-ink: #ffffff;
  --mint: #34d399;            /* radium accent, used sparingly */
  --mint-rgb: 52, 211, 153;
  /* subjects */
  --phys: #60a5fa;
  --chem: #34d399;
  --bio: #f7907a;
  --math: #fbbf24;
  --sim: #a78bfa;
  /* states */
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #34d399;
  --shadow: 0 10px 28px rgba(0, 0, 0, .35);
  --radius: 8px;
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", Helvetica, Arial, sans-serif;
  --mono: Consolas, "SF Mono", ui-monospace, monospace;
  /* surfaces used by floating panels and overlays */
  --strong: #ffffff;
  --float: rgba(13, 20, 35, .96);
  --overlay: rgba(4, 8, 16, .6);
  --tint: rgba(255, 255, 255, .06);
  --sunk: rgba(0, 0, 0, .18);
  --grip: rgba(255, 255, 255, .25);
  color-scheme: dark;
}

/* light theme. Canvas "screens" (.stage-dark) keep the dark palette in both themes. */
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #e9eef6;
  --head: rgba(255, 255, 255, .94);
  --head-solid: #ffffff;
  --panel: #ffffff;
  --panel-2: #eef2f8;
  --panel-3: #e1e7f1;
  --card: rgba(15, 23, 42, .025);
  --card-line: rgba(15, 23, 42, .11);
  --line: rgba(15, 23, 42, .09);
  --line-2: rgba(15, 23, 42, .17);
  --text: #0f172a;
  --text-2: #334155;
  --muted: #5a6a84;
  --faint: #8794aa;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-rgb: 37, 99, 235;
  --mint: #059669;
  --mint-rgb: 5, 150, 105;
  --phys: #2563eb;
  --chem: #059669;
  --bio: #d9573f;
  --math: #c27803;
  --sim: #7c3aed;
  --danger: #dc2626;
  --warn: #b45309;
  --ok: #059669;
  --shadow: 0 10px 28px rgba(15, 23, 42, .13);
  --strong: #0b1220;
  --float: rgba(255, 255, 255, .97);
  --overlay: rgba(15, 23, 42, .38);
  --tint: rgba(15, 23, 42, .045);
  --sunk: rgba(15, 23, 42, .05);
  --grip: rgba(15, 23, 42, .22);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(var(--accent-rgb), .45); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

#app { display: flex; flex-direction: column; height: 100vh; }

/* ===== Top navigation (site pages) ===== */
.topnav { height: 64px; flex: none; display: flex; align-items: center; gap: 28px; padding: 0 28px; background: var(--head-solid); border-bottom: 1px solid rgba(0, 0, 0, .3); z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 38px; height: 38px; display: block; filter: drop-shadow(0 2px 6px rgba(var(--accent-rgb), .35)); transition: transform .2s; }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--strong); }
.brand-name b { color: var(--accent-2); font-weight: 700; }
.topnav-links { display: flex; gap: 6px; flex: 1; justify-content: center; }
.topnav-links a { height: 64px; display: flex; align-items: center; padding: 0 16px; color: var(--text-2); font-size: 15px; border-bottom: 3px solid transparent; transition: .15s; }
.topnav-links a:hover { color: var(--strong); }
.topnav-links a.active { color: var(--strong); border-bottom-color: var(--accent); }
.topnav-fb { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-2); color: var(--text-2); display: flex; align-items: center; font-size: 13.5px; white-space: nowrap; }
.topnav-fb:hover { color: var(--strong); border-color: var(--accent); }
.topnav-menu { flex: 1; display: flex; align-items: center; gap: 14px; }
.topnav-actions { display: flex; align-items: center; gap: 10px; }
.topnav-cta { height: 36px; padding: 0 18px; border-radius: 18px; background: var(--accent); color: #fff; display: flex; align-items: center; font-size: 14px; }
.topnav-cta:hover { background: var(--accent-2); }
body.fullscreen .topnav { display: none; }

#view { flex: 1; min-height: 0; overflow: auto; outline: none; position: relative; }

/* ===== Generic UI ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--tint); color: var(--text); font-size: 13px; cursor: pointer; transition: .12s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(var(--accent-rgb), .3); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--tint); }
.btn.danger { color: #ff8a8a; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.on { background: rgba(var(--accent-rgb), .22); border-color: var(--accent); color: var(--strong); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; background: var(--panel-3); color: var(--muted); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 0 5px; border-radius: 3px; border: 1px solid var(--line-2); background: var(--panel-2); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.input { height: 32px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--sunk); outline: none; width: 100%; color: var(--text); }
.input:focus { border-color: var(--accent); }
select.input { padding-right: 6px; }
select.input option { background: var(--panel); }

/* ===== Lab console shell (chemistry & physics) ===== */
.nb-lab { position: relative; height: 100%; background: var(--bench); overflow: hidden; user-select: none; }
.nb-stage { position: absolute; inset: 64px 0 0 0; }
.nb-stage > canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.nb-head { position: absolute; top: 0; left: 0; right: 0; height: 64px; background: var(--head); display: flex; align-items: center; z-index: 6; }
.nb-back { width: 50px; height: 64px; display: grid; place-items: center; color: var(--text-2); cursor: pointer; }
.nb-back:hover { color: var(--strong); }
.nb-hgroup { display: flex; align-items: center; height: 64px; }
.nb-hbtn { min-width: 40px; height: 64px; padding: 0 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-2); font-size: 12px; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.nb-hbtn svg { width: 20px; height: 20px; }
.nb-hbtn:hover, .nb-hbtn.on { color: var(--accent-2); }
.nb-title { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; font-size: 16px; color: var(--text-2); max-width: 40%; }
.nb-title span { outline: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px dashed transparent; }
.nb-title span:focus { border-bottom-color: var(--accent); color: var(--strong); }
.nb-title svg { width: 15px; height: 15px; opacity: .8; cursor: pointer; flex: none; }
.nb-hright { margin-left: auto; display: flex; align-items: center; padding-right: 14px; }
.nb-module { margin-left: 18px; height: 32px; display: flex; background: var(--sunk); border-radius: 16px; padding: 3px; }
.nb-module a { padding: 0 14px; display: flex; align-items: center; gap: 6px; border-radius: 13px; font-size: 13px; color: var(--text-2); }
.nb-module a svg { width: 15px; height: 15px; }
.nb-module a.on { background: var(--accent); color: #fff; }

/* drawer */
.nb-drawer { position: absolute; top: 64px; right: 0; bottom: 0; width: 316px; background: var(--float); display: flex; z-index: 5; transition: transform .25s ease; }
.nb-drawer.closed { transform: translateX(316px); }
.nb-handle { position: absolute; left: -24px; top: 50%; margin-top: -58px; width: 24px; height: 116px; background: var(--float); border-radius: 8px 0 0 8px; display: grid; place-items: center; color: var(--text-2); cursor: pointer; }
.nb-handle:hover { color: var(--strong); }
.nb-cats { width: 64px; flex: none; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.nb-cat { height: 92px; flex: none; padding-top: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; background: none; border: 0; color: var(--muted); font-size: 12px; line-height: 1.15; text-align: center; }
.nb-cat i { width: 40px; height: 50px; border-radius: 6px; display: grid; place-items: center; color: var(--text-2); }
.nb-cat i svg { width: 28px; height: 28px; }
.nb-cat:hover { color: var(--text-2); }
.nb-cat.on { color: var(--strong); }
.nb-cat.on i { background: var(--accent); color: #fff; }
.nb-letters { display: flex; flex-direction: column; align-items: center; padding: 6px 0 12px; }
.nb-letters button { width: 58px; height: 26px; background: none; border: 0; font-size: 16px; color: rgba(255, 255, 255, .84); cursor: pointer; border-radius: 4px; }
.nb-letters button:hover { color: var(--strong); background: var(--tint); }
.nb-letters button.on { color: var(--accent-2); }
.nb-letters button:disabled { color: rgba(255, 255, 255, .18); cursor: default; background: none; }
.nb-listwrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nb-searchrow { height: 32px; margin: 7px 0 3px; background: rgba(0, 0, 0, .12); display: flex; align-items: center; gap: 6px; padding: 0 8px; color: #999; }
.nb-searchrow svg { width: 18px; height: 18px; flex: none; }
.nb-searchrow input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text-2); font-size: 14px; }
.nb-searchrow input::placeholder { color: var(--muted); }
.nb-list { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(2, 116px); justify-content: space-evenly; align-content: start; gap: 10px 0; padding: 7px 0 16px; }
.nb-list h5 { grid-column: 1 / -1; margin: 6px 12px 0; font-size: 12px; font-weight: 400; color: var(--muted); }
.nb-list > .btn { grid-column: 1 / -1; margin: 0 10px; justify-content: flex-start; }
.nb-card { width: 116px; height: 130px; background: var(--card); border: 1px solid var(--card-line); border-radius: 8px; display: flex; flex-direction: column; align-items: center; cursor: grab; transition: border-color .12s, background .12s; position: relative; }
.nb-card:hover { border-color: rgba(var(--accent-rgb), .8); background: rgba(var(--accent-rgb), .08); }
.nb-card.armed { border-color: var(--accent); background: rgba(var(--accent-rgb), .18); box-shadow: 0 0 0 1px var(--accent) inset; }
.nb-card canvas { width: 104px; height: 80px; margin-top: 6px; flex: none; }
.nb-card .nm { font-size: 13.5px; font-weight: 500; color: var(--text-2); text-align: center; line-height: 1.2; padding: 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nb-card .fm { position: absolute; top: 4px; right: 6px; font-size: 10px; color: var(--muted); font-family: var(--mono); }
.nb-card .fm sub { font-size: 75%; }
.phys-list .item { width: 116px; height: 130px; background: var(--card); border: 1px solid var(--card-line); border-radius: 8px; display: flex; flex-direction: column; align-items: center; cursor: pointer; padding: 6px 4px 0; text-align: center; transition: border-color .12s, background .12s; }
.phys-list .item:hover { border-color: rgba(var(--accent-rgb), .8); background: rgba(var(--accent-rgb), .08); }
.phys-list .item.armed { border-color: var(--accent); background: rgba(var(--accent-rgb), .18); box-shadow: 0 0 0 1px var(--accent) inset; }
.phys-list .item canvas { width: 100px; height: 64px; flex: none; }
.phys-list .item .nm { font-size: 13.5px; font-weight: 500; color: var(--text-2); line-height: 1.2; margin-top: 4px; }
.phys-list .item .fm { font-size: 10.5px; color: var(--muted); line-height: 1.25; margin-top: 2px; }
.phys-panel { top: 80px; max-height: calc(100% - 140px); padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.phys-panel.hidden { display: none; }
.phys-inner { display: flex; flex-direction: column; gap: 10px; }
.physics-lab .nb-title { left: auto; right: 160px; transform: none; font-size: 14px; color: var(--faint); }
.nb-empty { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 30px 10px; font-size: 13px; }

/* floating property panel */
.nb-float { position: absolute; left: 16px; top: 80px; width: 300px; max-height: calc(100% - 150px); overflow: auto; background: var(--float); border-radius: 8px; box-shadow: var(--shadow); z-index: 4; }
.nb-float.hidden { display: none; }
.nb-float .insp-head { position: sticky; top: 0; background: var(--float); z-index: 1; display: flex; align-items: flex-start; gap: 8px; }
.nb-float .insp-head > div { flex: 1; min-width: 0; }
.nb-x { width: 26px; height: 26px; border: 0; background: none; color: #aaa; border-radius: 4px; cursor: pointer; display: grid; place-items: center; flex: none; }
.nb-x:hover { background: var(--tint); color: var(--strong); }
.nb-x svg { width: 16px; height: 16px; }

/* bottom tools */
.nb-bottom { position: absolute; left: 25px; bottom: 10px; display: flex; align-items: center; gap: 8px; z-index: 4; }
.nb-zoom { height: 38px; background: var(--head-solid); border-radius: 8px; display: flex; align-items: center; color: var(--strong); }
.nb-zoom button { height: 38px; background: none; border: 0; color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.nb-zoom button:hover { color: var(--strong); }
.nb-zoom .loc { width: 40px; border-right: 1px solid rgba(255, 255, 255, .12); }
.nb-zoom .val { width: 58px; font-size: 16px; color: var(--strong); }
.nb-zoom .dir { width: 30px; }
.nb-zoom svg { width: 20px; height: 20px; }
.nb-tbtn { width: 38px; height: 38px; border-radius: 6px; background: var(--head-solid); border: 0; color: var(--text-2); display: grid; place-items: center; cursor: pointer; position: relative; }
.nb-tbtn:hover, .nb-tbtn.on { color: var(--accent-2); }
.nb-tbtn svg { width: 20px; height: 20px; }
.nb-tbtn .badge { position: absolute; right: -3px; top: -5px; font-size: 9.5px; background: var(--accent); color: #fff; border-radius: 6px; padding: 0 4px; line-height: 14px; }
.nb-zoommenu { position: absolute; bottom: 44px; left: 0; background: var(--head-solid); border-radius: 6px; padding: 4px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.nb-zoommenu button { height: 28px; width: 136px; border: 0; background: none; color: var(--text-2); text-align: left; padding: 0 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.nb-zoommenu button:hover { background: rgba(var(--accent-rgb), .25); color: var(--strong); }
.nb-warn { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); color: var(--faint); font-size: 15px; line-height: 38px; pointer-events: none; white-space: nowrap; z-index: 3; }
.nb-lab.drawer-open .nb-warn { left: calc(50% - 158px); }

/* overlays inside the stage */
.armed-bar { position: absolute; left: 50%; bottom: 58px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; background: var(--float); border: 1px solid var(--accent); border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; z-index: 5; white-space: nowrap; color: var(--text-2); }
.nb-lab.drawer-open .armed-bar { left: calc(50% - 158px); }
.armed-bar .sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line-2); }
.bench-hint { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); text-align: center; color: var(--muted); pointer-events: none; font-size: 14px; }
.nb-lab.drawer-open .bench-hint { left: calc(50% - 158px); }
.bench-hint b { display: block; font-size: 18px; font-weight: 400; color: var(--muted); margin-bottom: 6px; }

/* property panel internals */
.insp-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.insp-head h3 { margin: 0; font-size: 15px; font-weight: 500; color: var(--strong); }
.insp-sec { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.insp-sec:last-child { border-bottom: 0; }
.insp-sec h4 { margin: 0; font-size: 12px; font-weight: 400; color: var(--muted); display: flex; justify-content: space-between; }
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gauge { background: rgba(0, 0, 0, .22); border-radius: 6px; padding: 6px; text-align: center; }
.gauge b { display: block; font-family: var(--mono); font-size: 17px; font-weight: 400; color: var(--strong); }
.gauge span { font-size: 10.5px; color: var(--muted); }
.ph-bar { height: 8px; border-radius: 4px; position: relative; background: linear-gradient(90deg, #e3262b, #f0612a, #f6a531, #f4d31f, #b5d334, #5fbf4a, #2fa84f, #1b9a8a, #2a7fc2, #3b5bb5, #4f45a6, #5e3797, #6b2c8a, #5a2177, #4a1766); }
.ph-bar i { position: absolute; top: -4px; width: 4px; height: 16px; background: #fff; border-radius: 2px; box-shadow: 0 0 0 1.5px #000; transform: translateX(-50%); transition: left .3s; }
.contents { display: grid; gap: 2px; }
.ct { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 2px 0; }
.ct .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; border: 1px solid rgba(255, 255, 255, .2); }
.ct .f { font-family: var(--mono); font-size: 12px; flex: 1; color: var(--text-2); }
.ct .a { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.st { font-size: 9.5px; padding: 0 5px; border-radius: 3px; }
.st.aq { background: rgba(75, 156, 242, .2); color: var(--accent-2); }
.st.s { background: rgba(240, 180, 41, .2); color: #f5cd6a; }
.st.g { background: rgba(167, 139, 250, .2); color: #c4b5fd; }
.st.l { background: rgba(62, 194, 122, .2); color: #7ee0aa; }
.obs { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.obs-item { font-size: 12.5px; background: rgba(0, 0, 0, .2); border-left: 3px solid var(--accent); border-radius: 4px; padding: 6px 8px; color: var(--text-2); }
.obs-item .eq { font-family: var(--mono); font-size: 11.5px; color: var(--accent-2); margin-top: 3px; }
.obs-item .t { font-size: 10px; color: var(--faint); float: right; }
.eq sub, .eq sup, .f sub, .f sup { font-size: 70%; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* guide (teaching demo steps) */
.guide { position: absolute; right: 332px; top: 80px; width: 300px; max-height: calc(100% - 150px); overflow: auto; background: var(--float); border-radius: 8px; box-shadow: var(--shadow); z-index: 4; }
.nb-lab:not(.drawer-open) .guide { right: 40px; }
.guide-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-start; }
.guide-head h4 { margin: 0; font-size: 14px; font-weight: 500; color: var(--strong); flex: 1; }
.guide-steps { padding: 10px 14px 12px; display: grid; gap: 8px; }
.step { display: flex; gap: 9px; font-size: 12.5px; align-items: flex-start; color: var(--text-2); }
.step .bx { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--faint); flex: none; display: grid; place-items: center; font-size: 10.5px; margin-top: 1px; color: #aaa; }
.step.done .bx { background: var(--ok); border-color: var(--ok); color: var(--strong); }
.step.done span { color: var(--faint); text-decoration: line-through; }
.step.cur .bx { border-color: var(--accent-2); color: #fff; background: var(--accent); }
.guide .explain { padding: 10px 14px 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
.guide .explain a { color: var(--accent-2); }

/* notebook */
.notebook { position: absolute; left: 16px; right: 332px; bottom: 58px; max-height: 42%; display: flex; flex-direction: column; background: var(--float); border-radius: 8px; box-shadow: var(--shadow); z-index: 5; }
.nb-lab:not(.drawer-open) .notebook { right: 40px; }
.notebook-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.notebook-head h4 { margin: 0; flex: 1; font-size: 14px; font-weight: 500; }
.notebook-body { overflow: auto; padding: 10px 14px; display: grid; gap: 6px; }

/* settings popover */
.nb-pop { position: absolute; top: 64px; z-index: 7; background: var(--float); border-radius: 0 0 8px 8px; box-shadow: var(--shadow); padding: 12px 14px; width: 260px; display: grid; gap: 10px; }
.nb-pop h4 { margin: 0; font-size: 12px; font-weight: 400; color: var(--muted); }

/* ===== Modal ===== */
.modal-back { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 50; animation: fade .15s; }
.modal { width: min(1040px, 94vw); max-height: 86vh; overflow: auto; background: var(--panel); border-radius: 8px; box-shadow: var(--shadow); }
.modal-head { position: sticky; top: 0; background: var(--head-solid); display: flex; align-items: center; gap: 12px; padding: 14px 20px; z-index: 1; }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 500; flex: 1; color: var(--strong); }
.modal-body { padding: 18px 20px 22px; }
.exp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.exp-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px; cursor: pointer; transition: .14s; display: flex; flex-direction: column; gap: 6px; }
.exp-card:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), .08); }
.exp-card .em { font-size: 26px; }
.exp-card h3 { margin: 0; font-size: 14px; font-weight: 500; color: var(--strong); }
.exp-card p { margin: 0; color: var(--muted); font-size: 12px; flex: 1; }
.exp-card .lv { font-size: 11px; color: var(--accent-2); }
@keyframes fade { from { opacity: 0; } }

/* ===== Home ===== */
.home { min-height: 100%; }
.home-hero { position: relative; padding: 70px 56px 50px; overflow: hidden; background: radial-gradient(900px 420px at 88% -10%, rgba(var(--accent-rgb), .16), transparent 60%), radial-gradient(700px 320px at 0% 110%, rgba(var(--mint-rgb), .07), transparent 60%), linear-gradient(180deg, var(--bg-2), var(--bg)); }
.home-hero > canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .8; }
/* animated mini-lab beside the headline */
.hero-scene { display: none; }
@media (min-width: 1100px) {
  .home-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 500px); align-items: center; column-gap: 24px; }
  .home-hero .inner { grid-column: 1; grid-row: 1; }
  .hero-scene { display: block; grid-column: 2; grid-row: 1; position: relative; height: 460px; }
}
.hero-scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hs-card { position: absolute; display: grid; gap: 1px; padding: 9px 14px; border-radius: 12px; background: var(--float); border: 1px solid rgba(140, 175, 255, .18); box-shadow: 0 10px 26px rgba(0, 0, 0, .35); backdrop-filter: blur(6px); animation: hsFloat 6s ease-in-out infinite; font-size: 12px; color: var(--muted); white-space: nowrap; }
.hs-card b { color: var(--strong); font-size: 16px; font-weight: 600; font-family: var(--mono); }
.hs-card small { color: var(--mint); font-size: 11.5px; }
.hs-ph { left: 0; top: 2%; min-width: 128px; }
.hs-bar { position: relative; height: 5px; margin-top: 5px; border-radius: 3px; background: linear-gradient(90deg, #e3262b, #f6a531, #f4d31f, #5fbf4a, #1b9a8a, #3b5bb5, #5e3797); }
.hs-bar i { position: absolute; top: -3px; width: 3px; height: 11px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px #000; transform: translateX(-50%); transition: left .4s; }
.hs-temp { left: -2%; top: 31%; animation-delay: -2s; }
.hs-temp b { color: #fca5a5; }
.hs-test { right: -1%; top: 30%; animation-delay: -4s; }
.hs-test b { color: var(--mint); font-family: var(--font); font-size: 14px; }
.hs-eq { left: 50%; bottom: -4px; transform: translateX(-50%); text-align: center; animation: none; padding: 8px 16px; }
.hs-eq b { font-family: var(--font); font-size: 13px; color: var(--accent-2); }
.hs-eq span { font-family: var(--mono); font-size: 13.5px; color: var(--strong); }
@keyframes hsFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@media (prefers-reduced-motion: reduce) { .hs-card { animation: none; } }
.home-hero .inner { position: relative; max-width: 760px; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--accent-2); letter-spacing: .1em; }
.home-hero h1 { font-size: clamp(32px, 4.6vw, 54px); line-height: 1.12; margin: 14px 0 16px; font-weight: 700; color: var(--strong); }
.home-hero h1 .grad { background: linear-gradient(90deg, var(--accent-2), var(--mint)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-hero h1 { text-wrap: balance; }
.home-hero p { font-size: 16px; color: var(--muted); max-width: 600px; margin: 0 0 26px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-cta .btn { height: 42px; padding: 0 22px; font-size: 15px; border-radius: 21px; }
.hero-try { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; margin: -6px 0 24px; padding: 8px 16px; border-radius: 20px; background: rgba(var(--mint-rgb), .09); border: 1px solid rgba(var(--mint-rgb), .35); color: var(--text); font-size: 14.5px; transition: border-color .15s, background .15s; }
.hero-try:hover { background: rgba(var(--mint-rgb), .16); border-color: var(--mint); }
.hero-try b { color: var(--mint); font-weight: 600; white-space: nowrap; }
.try-text { transition: opacity .25s, transform .25s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.try-text.out { opacity: 0; transform: translateY(6px); }
.try-go { color: var(--mint); transition: transform .15s; }
.hero-try:hover .try-go { transform: translateX(3px); }
.hero-new { display: inline-block; margin-top: 18px; color: var(--muted); font-size: 14px; }
.hero-new b { color: var(--mint); font-weight: 500; }
.hero-new:hover { color: var(--strong); }
.stats { display: flex; gap: 40px; margin-top: 36px; flex-wrap: wrap; }
.stat b { display: block; font-size: 28px; font-weight: 700; color: var(--strong); }
.stat span { color: var(--muted); font-size: 12.5px; }
.home-body { padding: 30px 56px 60px; display: grid; gap: 34px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title h2 { margin: 0; font-size: 19px; font-weight: 500; color: var(--strong); }
.wing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.wing { position: relative; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); padding: 22px; cursor: pointer; transition: .18s; min-height: 190px; display: flex; flex-direction: column; }
.wing:hover { border-color: color-mix(in srgb, var(--wc) 60%, transparent); transform: translateY(-2px); }
.wing .wico { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--wc) 15%, transparent); color: var(--wc); border: 1px solid color-mix(in srgb, var(--wc) 30%, transparent); }
.wing .wico svg { width: 28px; height: 28px; }
.wing h3 { margin: 14px 0 6px; font-size: 17px; font-weight: 500; color: var(--strong); }
.wing p { margin: 0; color: var(--muted); font-size: 13.5px; flex: 1; }
.wing .go { margin-top: 14px; font-size: 13px; color: var(--wc); }

.why-faraday { display: flex; gap: 22px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--mint); border-radius: 8px; padding: 20px 24px; }
.why-faraday h2 { margin: 0 0 6px; font-size: 18px; font-weight: 500; color: var(--strong); }
.why-faraday p { margin: 0 0 6px; color: var(--muted); font-size: 14px; max-width: 820px; }
.why-faraday p:last-child { margin-bottom: 0; }
.why-faraday b { color: var(--text); font-weight: 500; }
.why-mark { flex: none; width: 84px; height: 84px; }
.why-mark img { width: 84px; height: 84px; display: block; filter: drop-shadow(0 0 18px rgba(var(--mint-rgb), .25)); }
@media (max-width: 900px) { .why-faraday { flex-direction: column; align-items: flex-start; } }

/* ===== How-to-use guide ===== */
.guide-page { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; max-width: 1180px; margin: 0 auto; padding: 32px 40px 80px; }
.g-toc { position: sticky; top: 24px; align-self: start; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 120px); overflow: auto; }
.g-toc-title { font-size: 12px; letter-spacing: .1em; color: var(--faint); margin: 0 0 8px 12px; }
.g-toc a { padding: 6px 12px; border-left: 2px solid var(--line-2); color: var(--muted); font-size: 13.5px; }
.g-toc a:hover { color: var(--strong); }
.g-toc a.on { color: var(--strong); border-left-color: var(--accent); background: rgba(var(--accent-rgb), .1); }
.g-hero { padding-bottom: 8px; }
.g-hero h1 { margin: 10px 0 8px; font-size: 32px; font-weight: 700; color: var(--strong); }
.g-hero p { color: var(--muted); font-size: 15.5px; max-width: 680px; margin: 0; }
.g-sec { padding: 30px 0 6px; border-bottom: 1px solid var(--line); scroll-margin-top: 16px; }
.g-sec h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-size: 21px; font-weight: 500; color: var(--strong); }
.g-idx { font-size: 12px; font-family: var(--mono); color: var(--accent-2); background: rgba(var(--accent-rgb), .14); border-radius: 6px; padding: 3px 7px; }
.g-sec h4 { margin: 18px 0 8px; font-size: 15px; font-weight: 500; color: var(--strong); }
.g-sec p, .g-sec li { color: var(--text-2); font-size: 14.5px; line-height: 1.65; }
.g-sec p { margin: 0 0 12px; }
.g-lead { font-size: 16px !important; }
.g-ui { color: var(--strong); font-weight: 500; background: var(--tint); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 6px; font-size: 13px; white-space: nowrap; }
.g-steps { counter-reset: s; list-style: none; padding: 0; margin: 4px 0 14px; display: grid; gap: 8px; }
.g-steps li { counter-increment: s; position: relative; padding: 10px 14px 10px 50px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.g-steps li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.g-list { padding-left: 20px; margin: 0 0 12px; display: grid; gap: 6px; }
.g-legend { padding-left: 22px; display: grid; gap: 8px; margin: 14px 0 6px; }
.g-legend li::marker { color: var(--accent-2); font-weight: 700; }
.g-tip { margin: 12px 0; padding: 12px 14px 12px 16px; border-radius: 8px; background: rgba(var(--accent-rgb), .1); border-left: 3px solid var(--accent); color: var(--text-2); font-size: 14px; line-height: 1.6; }
.g-tip b:first-child { display: block; color: var(--accent-2); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 2px; }
.g-tip.note { background: rgba(var(--mint-rgb), .08); border-left-color: var(--mint); }
.g-tip.note b:first-child { color: var(--mint); }
.g-tip.warn { background: rgba(240, 180, 41, .08); border-left-color: var(--warn); }
.g-tip.warn b:first-child { color: var(--warn); }
.g-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 6px 0 4px; }
.g-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; transition: .15s; }
.g-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.g-card h4 { margin: 6px 0 2px !important; }
.g-card p { font-size: 13px !important; color: var(--muted) !important; margin: 0 !important; flex: 1; }
.g-num { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.g-go { color: var(--accent-2); font-size: 13px; margin-top: 8px; }
.g-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.g-two > div > b { color: var(--strong); font-weight: 500; }
.g-table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 14px; background: var(--panel); border-radius: 8px; overflow: hidden; }
.g-table th { text-align: left; font-weight: 500; color: var(--strong); background: rgba(140, 175, 255, .06); padding: 9px 12px; font-size: 13px; }
.g-table td { padding: 8px 12px; border-top: 1px solid var(--line); color: var(--text-2); vertical-align: top; }
.g-sec details { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.g-sec summary { cursor: pointer; padding: 12px 14px; color: var(--strong); font-size: 14.5px; list-style: none; display: flex; justify-content: space-between; }
.g-sec summary::after { content: '+'; color: var(--accent-2); font-size: 18px; line-height: 1; }
.g-sec details[open] summary::after { content: '−'; }
.g-sec details p { padding: 0 14px 12px; margin: 0; }
/* annotated screen mock */
.g-mock { border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--bg); margin: 8px 0 6px; font-size: 12px; color: var(--text-2); }
.g-mock i.m-n { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--mint); color: #0b2a19; font-style: normal; font-weight: 700; font-size: 12px; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--bg); }
.m-head { position: relative; height: 40px; background: var(--head-solid); display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 36px; }
.m-body { position: relative; height: 230px; display: flex; }
.m-panel { position: relative; margin: 12px; width: 150px; height: 140px; background: var(--float); border-radius: 6px; padding: 10px; }
.m-panel i.m-n, .m-bench i.m-n, .m-drawer i.m-n { left: 8px; top: -10px; }
.m-bench { position: relative; flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); border: 1px dashed rgba(255, 255, 255, .12); margin: 12px; border-radius: 6px; }
.m-drawer { position: relative; width: 190px; background: var(--panel); display: flex; }
.m-cats { width: 40px; text-align: center; padding-top: 10px; line-height: 2; color: var(--accent-2); }
.m-items { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; align-content: start; }
.m-items span { height: 54px; border-radius: 6px; background: var(--card); border: 1px solid rgba(255, 255, 255, .08); }
.m-foot { position: relative; height: 40px; display: flex; align-items: center; padding-left: 36px; color: var(--text-2); background: rgba(0, 0, 0, .15); }
/* feedback */
.fb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 10px 0 14px; }
.fb-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); transition: .15s; }
.fb-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.fb-ico { font-size: 24px; }
.fb-card h4 { margin: 4px 0 0 !important; font-size: 14.5px; font-weight: 500; color: var(--strong); }
.fb-card p { margin: 0 !important; font-size: 12.5px !important; color: var(--muted) !important; line-height: 1.45 !important; }
.g-mail a, .site-foot a.mail { color: var(--accent-2); border-bottom: 1px dashed currentColor; }
/* site footer */
.site-foot { border-top: 1px solid var(--line); background: var(--bg-2); padding: 34px 56px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; align-items: center; }
.site-foot h3 { margin: 0 0 6px; font-size: 18px; font-weight: 500; color: var(--strong); }
.site-foot p { margin: 0; color: var(--muted); font-size: 14px; }
.site-foot .foot-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.site-foot .foot-actions a { height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 17px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 13px; color: var(--text-2); }
.site-foot .foot-actions a:hover { border-color: var(--accent); color: var(--strong); }
.site-foot .foot-actions a.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.foot-bottom { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--faint); font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 16px; }
/* first-visit tour (coach marks) */
.tour-ring { position: absolute; border: 2px solid var(--mint); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(4, 8, 18, .66); z-index: 40; pointer-events: none; transition: all .3s ease; }
.tour-card { position: absolute; width: 320px; background: #fff; color: #1d2228; border-radius: 10px; padding: 16px 18px 14px; z-index: 41; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); transition: all .3s ease; }
.tour-card .t-step { font-size: 11.5px; color: var(--accent); font-weight: 700; letter-spacing: .06em; }
.tour-card h4 { margin: 4px 0 6px; font-size: 16px; color: #111; }
.tour-card p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; color: #444b55; }
.tour-card .t-actions { display: flex; align-items: center; gap: 8px; }
.tour-card .t-actions .grow { flex: 1; }
.tour-card button { height: 32px; padding: 0 14px; border-radius: 16px; border: 1px solid #d5dbe3; background: #fff; color: #333; cursor: pointer; font-size: 13px; }
.tour-card button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tour-card .dots { display: flex; gap: 4px; }
.tour-card .dots i { width: 6px; height: 6px; border-radius: 50%; background: #cfd6df; }
.tour-card .dots i.on { background: var(--accent); }
@media (max-width: 900px) {
  .guide-page { grid-template-columns: 1fr; padding: 20px 16px 60px; }
  .g-toc { display: none; }
  .g-two { grid-template-columns: 1fr; }
  .site-foot { grid-template-columns: 1fr; padding: 24px 16px; }
  .site-foot .foot-actions { justify-content: flex-start; }
}

/* ===== Gallery ===== */
.page { padding: 28px 40px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 500; color: var(--strong); }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters .search { width: 260px; border-radius: 16px; }
.pill { height: 32px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-size: 13px; color: var(--text-2); }
.pill:hover { color: var(--strong); border-color: var(--accent); }
.pill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.sim-card { border-radius: 8px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; cursor: pointer; transition: .16s; display: flex; flex-direction: column; }
.sim-card:hover { border-color: color-mix(in srgb, var(--sc) 60%, transparent); transform: translateY(-2px); }
.sim-card canvas { width: 100%; aspect-ratio: 16/10; display: block; background: var(--bg-2); }
.sim-card .meta { padding: 12px 14px 14px; }
.sim-card h3 { margin: 0 0 3px; font-size: 14.5px; font-weight: 500; color: var(--strong); }
.sim-card p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.sim-card .tag { display: inline-block; margin-top: 8px; font-size: 11px; color: var(--sc); background: color-mix(in srgb, var(--sc) 13%, transparent); padding: 1px 8px; border-radius: 10px; }

/* ===== Simulation frame ===== */
.simframe { display: grid; grid-template-columns: 1fr 300px; grid-template-rows: 64px 1fr 54px; height: 100%; }
.sim-top { grid-column: 1 / -1; position: relative; display: flex; align-items: center; background: var(--head); }
.sim-top .nb-title { flex-direction: column; gap: 0; }
.sim-top h2 { margin: 0; font-size: 16px; font-weight: 400; color: var(--text-2); }
.sim-top .sub { color: var(--faint); font-size: 12px; }
.sim-top .grow { flex: 1; }
.sim-stage { position: relative; min-width: 0; min-height: 0; background: var(--bg); }
.sim-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.sim-panel { background: var(--panel); overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; grid-row: 2 / 4; grid-column: 2; }
.sim-bar { display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--bg); }
.sim-bar .btn { background: var(--head-solid); border-color: transparent; height: 34px; }
.ctl-group { background: var(--sunk); border-radius: 8px; padding: 12px; display: grid; gap: 10px; }
.ctl-group h4 { margin: 0; font-size: 12px; font-weight: 400; color: var(--muted); }
.ctl { display: grid; gap: 2px; }
.ctl-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.ctl-row b { font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--accent-2); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--p, 50%), rgba(255, 255, 255, .15) var(--p, 50%)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .15); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
input[type=range]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.check input { accent-color: var(--accent); width: 14px; height: 14px; }
.readout { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; border-bottom: 1px dashed var(--line-2); color: var(--text-2); }
.readout:last-child { border-bottom: 0; }
.readout b { font-family: var(--mono); font-weight: 400; color: var(--strong); }
.seg { display: flex; background: var(--sunk); padding: 3px; border-radius: 16px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; height: 26px; border-radius: 13px; cursor: pointer; font-size: 12px; color: #bbb; }
.seg button.on { background: var(--accent); color: #fff; }

/* ===== Toasts ===== */
#toasts { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; justify-items: center; }
.toast { background: var(--float); border-radius: 6px; padding: 9px 16px; box-shadow: var(--shadow); font-size: 13px; max-width: 460px; color: var(--text); border-left: 3px solid var(--accent); animation: toastIn .25s ease-out; }
.toast.warn { border-left-color: var(--warn); }
.toast.bad { border-left-color: var(--danger); }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }

/* ===== Responsive ===== */
@media (max-width: 1320px) {
  .nb-warn { font-size: 12.5px; left: auto !important; right: 40px; transform: none; }
  .nb-lab.drawer-open .nb-warn { right: 356px; }
}
@media (max-width: 1180px) { .nb-warn { display: none; } }
/* ===== Tablet (≤ 900px) ===== */
@media (max-width: 900px) {
  .topnav { gap: 12px; padding: 0 14px; }
  .topnav-links a { padding: 0 10px; font-size: 14px; }
  .topnav-fb { display: none; }
  .nb-hbtn span { display: none; }
  .nb-hbtn { min-width: 38px; padding: 0 4px; }
  .nb-title { display: none; }
  .nb-warn { display: none; }
  .simframe { grid-template-columns: 1fr; grid-template-rows: 56px minmax(360px, 58vh) auto auto; height: auto; min-height: 100%; }
  .sim-panel { grid-row: 4; grid-column: 1; }
  .sim-bar { grid-row: 3; grid-column: 1; }
  .sim-top .nb-title { display: flex; position: static; transform: none; max-width: none; flex: 1; min-width: 0; align-items: flex-start; padding-left: 4px; }
  .sim-top .nb-title h2 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .sim-top .grow, .sim-top > span { display: none; }
  .home-hero, .home-body, .page { padding-left: 18px; padding-right: 18px; }
  .guide-page { grid-template-columns: minmax(0, 1fr); padding: 20px 18px 60px; }
  .g-body { min-width: 0; }
  .g-toc { display: none; }
  .g-jump { display: block !important; }
  .site-foot { grid-template-columns: 1fr; padding: 26px 18px; }
  .site-foot .foot-actions { justify-content: flex-start; }
}

/* ===== Phone (≤ 760px) ===== */
.nav-toggle, .nb-fab, .nb-sheethead, .g-jump { display: none; }
.sheet-max { display: none; }
.phys-grab { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 6px; color: var(--muted); font-size: 12.5px; cursor: grab; touch-action: none; }
.phys-grab .hint { display: none; }
@media (max-width: 760px) {
  #app { height: 100dvh; }
  body { overflow: hidden; }
  input, select, textarea { font-size: 16px !important; }
  /* top navigation → hamburger menu */
  .topnav { height: 56px; padding: 0 8px 0 14px; position: relative; }
  .brand-name { display: inline; font-size: 18px; }
  .brand-mark { width: 34px; height: 34px; }
  .nav-toggle { display: grid; place-items: center; margin-left: auto; width: 44px; height: 44px; border: 0; background: none; color: var(--text-2); border-radius: 8px; cursor: pointer; }
  .nav-toggle svg { width: 26px; height: 26px; }
  .topnav-menu { display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--head-solid); border-bottom: 1px solid var(--line-2); box-shadow: 0 14px 30px rgba(0, 0, 0, .45); padding: 6px 0 14px; z-index: 30; }
  .topnav.open .topnav-menu { display: flex; }
  .topnav-links { flex-direction: column; gap: 0; }
  .topnav-links a { height: 50px; padding: 0 20px; font-size: 16px; border-bottom: 0; border-left: 3px solid transparent; }
  .topnav-links a.active { border-left-color: var(--accent); background: rgba(var(--accent-rgb), .1); }
  .topnav-actions { display: flex; gap: 10px; padding: 10px 20px 0; }
  .topnav-actions a { flex: 1; justify-content: center; height: 44px !important; display: flex !important; font-size: 15px !important; }
  /* site pages */
  .home-hero { padding: 36px 18px 30px; }
  .home-hero h1 { font-size: 29px; }
  .eyebrow { font-size: 11.5px; letter-spacing: .08em; }
  .hero-try { font-size: 13.5px; padding: 8px 12px; margin-bottom: 20px; }
  .try-text { white-space: normal; }
  .home-hero p { font-size: 15px; }
  .hero-cta .btn { flex: 1 1 auto; height: 46px; }
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
  .stat b { font-size: 24px; }
  .home-body { padding: 24px 16px 40px; gap: 26px; }
  .why-faraday { padding: 18px; gap: 14px; }
  .why-mark { display: none; }
  .wing { min-height: 0; }
  .sim-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .sim-card .meta { padding: 10px 12px 12px; }
  .sim-card p { display: none; }
  .filters .search { width: 100%; }
  .page { padding: 20px 16px 40px; }
  .exp-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .exp-card { padding: 12px; }
  .fb-grid { grid-template-columns: 1fr; }
  .site-foot { padding: 22px 16px; }
  .site-foot .foot-actions a { flex: 1 1 calc(50% - 8px); justify-content: center; height: 42px; }
  .foot-bottom { flex-direction: column; }
  /* guide */
  .g-hero h1 { font-size: 26px; }
  .g-jump { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 10px 0; margin: 0 0 4px; }
  .g-sec h2 { font-size: 19px; }
  .g-steps li { padding: 10px 12px 10px 46px; }
  .g-table { display: block; overflow-x: auto; white-space: nowrap; }
  .g-table td { white-space: normal; min-width: 120px; }
  .g-mock { overflow-x: auto; }
  .g-mock > * { min-width: 560px; }
  .modal-back { place-items: end center; }
  .modal { width: 100vw; max-height: 90dvh; border-radius: 14px 14px 0 0; }
  .modal-head { padding: 12px 14px; flex-wrap: wrap; }
  .modal-head .muted { display: none; }
  .modal-body { padding: 12px; }
  #toasts { top: auto; bottom: 18px; left: 12px; right: 12px; transform: none; }
  .toast { max-width: none; }

  /* ===== labs: header ===== */
  .nb-head { height: 52px; }
  .nb-stage { inset: 52px 0 0 0; }
  .nb-back { width: 40px; height: 52px; }
  .nb-hgroup, .nb-hbtn { height: 52px; }
  .nb-hbtn { min-width: 36px; padding: 0 3px; }
  .nb-hright { padding-right: 4px; }
  .nb-module { margin-left: 4px; height: 34px; }
  .nb-module a { padding: 0 10px; font-size: 12.5px; }
  .physics-lab .nb-title { display: none; }
  .hide-phone { display: none !important; }
  .nb-hbtn { min-width: 33px; }
  .nb-pop { left: 8px !important; right: 8px; width: auto; top: 52px; }
  /* drawer → bottom sheet */
  .nb-drawer { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--sheet-h, min(62dvh, 520px)); background: var(--panel); flex-direction: column; border-radius: 16px 16px 0 0; box-shadow: 0 -12px 34px rgba(0, 0, 0, .5); z-index: 12; }
  .nb-drawer.closed { transform: translateY(105%); }
  .nb-handle { display: none; }
  .nb-sheethead { display: flex; align-items: center; gap: 10px; padding: 16px 10px 6px 16px; min-height: 52px; color: var(--strong); font-size: 15px; position: relative; touch-action: none; cursor: ns-resize; }
  .nb-sheethead::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--grip); }
  .nb-sheethead b { flex: 1; font-weight: 500; }
  .nb-cats { width: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; flex: none; padding: 0 6px; border-bottom: 1px solid var(--line); }
  .nb-cat { width: 78px; height: auto; padding: 6px 0 8px; font-size: 11px; }
  .nb-cat i { width: 38px; height: 38px; }
  .nb-cat i svg { width: 24px; height: 24px; }
  .nb-letters { display: none; }
  .nb-listwrap { min-height: 0; }
  .nb-searchrow { margin: 8px 12px 4px; border-radius: 8px; height: 40px; }
  .nb-list { grid-template-columns: repeat(auto-fill, 104px); gap: 10px 8px; padding: 8px 10px 24px; justify-content: space-evenly; }
  .nb-card { width: 104px; height: 118px; }
  .nb-card canvas { width: 94px; height: 70px; }
  .nb-card .nm { font-size: 12.5px; }
  .phys-list .item { width: 104px; height: 118px; }
  /* floating "+ Add" button */
  .nb-fab { display: flex; position: absolute; top: 62px; right: 10px; height: 42px; padding: 0 16px 0 12px; align-items: center; gap: 6px; border-radius: 21px; border: 0; background: var(--accent); color: #fff; font-size: 15px; font-weight: 500; z-index: 7; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); cursor: pointer; }
  .nb-fab svg { width: 20px; height: 20px; }
  /* properties panel → bottom sheet */
  .nb-float { left: 0; right: 0; bottom: 0; top: auto !important; width: auto; max-height: var(--sheet-h, 42dvh); background: var(--float); border-radius: 16px 16px 0 0; box-shadow: 0 -12px 34px rgba(0, 0, 0, .5); z-index: 10; }
  .nb-float .insp-head { padding-top: 16px; cursor: ns-resize; touch-action: none; }
  .nb-float .insp-head::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--grip); }
  .nb-float.min { max-height: 64px; overflow: hidden; }
  .insp-sec { padding: 10px 14px; }
  .insp-sec .btn.sm { height: 36px; padding: 0 12px; font-size: 13px; }
  .phys-panel { padding: 0 10px 10px; }
  .phys-grab .hint { display: inline; }
  .phys-grab { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; touch-action: none; background: var(--float); padding: 16px 4px 10px; color: var(--strong); font-size: 14px; cursor: pointer; z-index: 1; }
  .phys-grab::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--grip); }
  .phys-panel.min { max-height: 52px; overflow: hidden; }
  /* bench overlays */
  .bench-hint { top: 34%; left: 50% !important; width: calc(100% - 40px); }
  .bench-hint > div { flex-wrap: wrap; }
  .armed-bar { top: 8px; bottom: auto; left: 10px !important; right: 10px; transform: none; flex-wrap: wrap; white-space: normal; justify-content: center; z-index: 8; }
  .guide { top: 62px; left: 10px; right: 10px !important; width: auto; max-height: 56dvh; z-index: 6; }
  .guide.col .guide-steps .step:not(.cur), .guide.col .explain { display: none; }
  .guide.col .guide-steps { padding-top: 6px; padding-bottom: 8px; }
  .guide-head { padding: 10px 8px 10px 12px; }
  .guide .nb-x { width: 40px; height: 40px; }
  .guide.col .guide-end { display: none; }
  .notebook { left: 0; right: 0 !important; bottom: 0; max-height: var(--sheet-h, 60dvh); border-radius: 16px 16px 0 0; z-index: 11; }
  .notebook-head { position: relative; padding-top: 16px; touch-action: none; cursor: ns-resize; }
  .notebook-head::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--grip); }
  .sized { max-height: none; height: var(--sheet-h); }
  .nb-float.sized.min { height: auto; }
  .sized.full { border-radius: 0; }
  .sheet-max { display: grid; width: 40px; height: 40px; }
  .nb-sheethead .sheet-max { margin-right: -6px; }
  .nb-bottom { left: 10px; bottom: 10px; gap: 6px; }
  .nb-bottom .zoom-in { display: none; }
  .nb-zoom .val { width: 50px; font-size: 14px; }
  .nb-lab .nb-warn { display: none; }
  /* tour */
  .tour-card { width: calc(100% - 24px) !important; }
  /* simulation frame */
  .sim-top { height: 56px; }
  .sim-bar { flex-wrap: wrap; padding: 8px 12px; gap: 6px; }
  .sim-bar .seg { width: 100% !important; order: 5; }
  .sim-bar > span { display: none; }
  .sim-panel { padding: 12px 12px 30px; }
}
.m-head i.m-n, .m-foot i.m-n { top: 9px !important; left: 8px !important; }
.topnav-links a { white-space: nowrap; }

/* crawlable fallback content (replaced by the app when JavaScript runs) */
.js .seo-static { display: none; }
.seo-static { max-width: 860px; margin: 0 auto; padding: 30px 20px; }
.seo-static h1 { color: var(--strong); }
.seo-static a { color: var(--accent-2); }

/* ===== Search button + command palette ===== */
.topnav-search { height: 36px; padding: 0 8px 0 12px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--tint); color: var(--text-2); display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-family: inherit; cursor: pointer; white-space: nowrap; }
.topnav-search:hover { color: var(--strong); border-color: var(--accent); }
.topnav-search kbd { font-family: var(--mono); font-size: 10.5px; padding: 2px 6px; border-radius: 9px; background: var(--panel-3); color: var(--muted); }
@media (max-width: 1360px) { .topnav-search span, .topnav-search kbd { display: none; } .topnav-search { padding: 0; width: 36px; justify-content: center; } .topnav-links a { padding: 0 12px; } }
@media (max-width: 1100px) { .topnav-fb { display: none; } }
.pal-overlay { position: fixed; inset: 0; z-index: 200; background: var(--overlay); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; animation: palIn .14s ease-out; }
@keyframes palIn { from { opacity: 0; } }
.pal { width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); overflow: hidden; }
.pal-head { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.pal-mag { font-size: 22px; color: var(--accent-2); }
.pal-input { flex: 1; min-width: 0; height: 54px; border: 0; outline: none; background: none; color: var(--strong); font-size: 17px; font-family: inherit; }
.pal-esc { cursor: pointer; color: var(--muted); height: 22px; }
.pal-list { overflow: auto; padding: 6px; }
.pal-group { padding: 8px 10px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.pal-item.on { background: rgba(var(--accent-rgb), .16); }
.pal-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--panel-2); font-size: 17px; }
.pal-ico.sym { font-weight: 700; font-size: 14px; color: var(--math); }
.pal-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pal-txt b { font-weight: 500; color: var(--strong); font-size: 14px; }
.pal-txt small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-type { font-size: 11px; color: var(--faint); white-space: nowrap; }
.pal-empty { padding: 26px; text-align: center; color: var(--muted); }
.pal-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }
.pal-foot .kbd { margin: 0 2px; }

/* ===== Lab Passport ===== */
.pass-strip { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: 10px; border: 1px solid rgba(var(--accent-rgb), .35); background: linear-gradient(100deg, rgba(var(--accent-rgb), .16), rgba(var(--mint-rgb), .08)); transition: .15s; }
.pass-strip:hover { border-color: var(--accent); transform: translateY(-1px); }
.ps-ico { font-size: 30px; }
.ps-txt { flex: 1; display: grid; gap: 3px; min-width: 0; }
.ps-txt b { color: var(--strong); font-weight: 600; font-size: 15.5px; }
.ps-txt span { color: var(--text-2); font-size: 13.5px; }
.ps-bar { height: 6px; border-radius: 3px; background: var(--tint); max-width: 360px; margin-top: 4px; overflow: hidden; }
.ps-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--mint)); border-radius: 3px; }
.ps-go { color: var(--accent-2); font-size: 14px; white-space: nowrap; }
.pp { display: grid; gap: 30px; }
.pp .page-head { margin-bottom: 0; }
.pp-level { color: var(--mint); font-weight: 600; }
.pp-rings { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.pp-ring { position: relative; display: grid; justify-items: center; gap: 8px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.pp-ring svg { width: 92px; height: 92px; transform: rotate(-90deg); display: block; }
.pp-ring circle { fill: none; stroke-width: 7; }
.pp-ring .bg { stroke: var(--line-2); }
.pp-ring .fg { stroke: var(--rc); stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.pp-ring > b { position: absolute; top: 50px; font-size: 22px; color: var(--strong); font-weight: 600; }
.pp-ring > b small { font-size: 12px; color: var(--muted); font-weight: 400; }
.pp-ring > span { color: var(--text-2); font-size: 13px; }
.pp-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.pp-badge { display: grid; gap: 4px; padding: 16px; text-align: left; font-family: inherit; color: inherit; cursor: default; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); opacity: .5; filter: grayscale(1); }
.pp-badge.got { opacity: 1; filter: none; border-color: rgba(var(--mint-rgb), .45); background: linear-gradient(160deg, rgba(var(--mint-rgb), .12), var(--panel) 60%); }
.pp-badge .ico { font-size: 30px; }
.pp-badge b { color: var(--strong); font-weight: 600; font-size: 14px; }
.pp-badge span { color: var(--muted); font-size: 12.5px; }
.pp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pp-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); color: var(--text-2); font-size: 13.5px; }
.pp-item:hover { border-color: var(--accent); color: var(--strong); }
.pp-item b { flex: 1; font-weight: 400; }
.pp-item i { font-style: normal; color: var(--mint); font-weight: 700; }
.pp-item.done { border-color: rgba(var(--mint-rgb), .35); color: var(--strong); }
.pp-item .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sc); }
.nav-search-m { display: none; }
.pp-fold > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 14px; }
.pp-fold > summary::-webkit-details-marker { display: none; }
.pp-fold > summary h2 { margin: 0; font-size: 19px; font-weight: 500; color: var(--strong); }
.pp-count { font-family: var(--mono); font-size: 12.5px; color: var(--mint); background: rgba(var(--mint-rgb), .12); border-radius: 10px; padding: 2px 9px; }
.pp-fold .chev { margin-left: auto; font-style: normal; color: var(--muted); transition: transform .2s; }
.pp-fold[open] .chev { transform: rotate(180deg); }
.pp-cert { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 20px 24px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); }
.pp-cert h2 { margin: 0 0 4px; font-size: 18px; font-weight: 500; color: var(--strong); }
.pp-cert p { margin: 0; }
.pp-cert-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pp-cert-row .input { width: 240px; height: 36px; }
.pp-cert-row .btn { height: 36px; }

/* ===== Periodic table ===== */
.pill.sm { height: 28px; padding: 0 12px; font-size: 12.5px; font-family: var(--mono); }
.pt-wrap { overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.pt-grid { display: grid; grid-template-columns: repeat(18, minmax(46px, 1fr)); grid-template-rows: repeat(7, auto) 14px auto auto; gap: 4px; min-width: 900px; }
.pt-cell { position: relative; aspect-ratio: 1 / 1.08; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--cc) 45%, transparent); background: color-mix(in srgb, var(--cc) 16%, var(--panel)); color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px; font-family: inherit; transition: transform .12s, opacity .2s, box-shadow .15s; min-width: 0; }
.pt-cell:hover { transform: scale(1.12); z-index: 2; box-shadow: 0 8px 22px rgba(0, 0, 0, .5); border-color: var(--cc); }
.pt-cell.sel { background: color-mix(in srgb, var(--cc) 42%, var(--panel)); border-color: #fff; box-shadow: 0 0 0 2px var(--cc), 0 0 18px color-mix(in srgb, var(--cc) 55%, transparent); z-index: 1; }
.pt-cell.dim { opacity: .18; }
.pt-cell.predicted { border-style: dashed; }
.pt-cell .z { position: absolute; top: 3px; left: 5px; font-size: 9.5px; color: var(--muted); }
.pt-cell b { font-size: clamp(13px, 1.25vw, 19px); font-weight: 600; color: var(--strong); line-height: 1.1; }
.pt-cell .nm { font-size: 8.5px; color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-cell .ms { font-size: 8px; color: var(--muted); }
@media (max-width: 1250px) { .pt-cell .ms { display: none; } }
.pt-ref { display: grid; place-items: center; border-radius: 6px; border: 1px dashed var(--line-2); color: var(--faint); font-size: 10px; }
.pt-inset { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 6px 12px; margin-bottom: 6px; min-width: 0; }
.pt-big { width: 96px; height: 104px; border-radius: 10px; background: linear-gradient(150deg, color-mix(in srgb, var(--cc) 55%, var(--panel)), color-mix(in srgb, var(--cc) 18%, var(--panel))); border: 1px solid var(--cc); display: grid; place-items: center; grid-template-rows: 18px 1fr 18px; padding: 6px; box-shadow: 0 8px 26px color-mix(in srgb, var(--cc) 30%, transparent); }
.pt-big span { justify-self: start; font-size: 12px; color: var(--strong); opacity: .85; }
.pt-big b { font-size: 40px; color: var(--strong); font-weight: 700; line-height: 1; }
.pt-big small { font-size: 11px; color: var(--strong); opacity: .85; font-family: var(--mono); }
.pt-meta { min-width: 0; display: grid; gap: 4px; }
.pt-meta h2 { margin: 0; font-size: 24px; font-weight: 600; color: var(--strong); }
.pt-meta .cat { color: var(--cc); font-size: 13px; font-weight: 600; }
.pt-meta .cfg { font-family: var(--mono); font-size: 13.5px; color: var(--text-2); }
.pt-meta .shells { font-size: 12.5px; color: var(--muted); }
.pt-meta .shells b { color: var(--text-2); font-family: var(--mono); font-weight: 400; }
.pt-bohr { width: 128px; height: 128px; display: block; }
.pt-legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 22px; font-size: 12.5px; }
.pt-chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); font-size: 12.5px; cursor: pointer; font-family: inherit; }
span.pt-chip { cursor: default; }
.pt-chip i { width: 10px; height: 10px; border-radius: 3px; background: var(--cc); }
.pt-chip.on, button.pt-chip:hover { border-color: var(--cc); color: var(--strong); }
.pt-scale { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.pt-scale i { width: 220px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, hsl(220 85% 48%), hsl(170 85% 50%), hsl(120 85% 52%), hsl(70 85% 54%), hsl(20 85% 56%)); }
.pt-detail { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; display: grid; gap: 14px; }
.pt-d-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pt-d-head h2 { margin: 0; font-size: 20px; font-weight: 500; color: var(--strong); }
.pt-fact { margin: 0; padding: 10px 14px; border-radius: 8px; background: rgba(var(--accent-rgb), .1); color: var(--text); font-size: 14px; }
.pt-props { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pt-prop { display: grid; gap: 3px; padding: 10px 14px; background: var(--panel); }
.pt-prop span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pt-prop b { font-weight: 400; color: var(--strong); font-size: 14px; }
.pt-prop small { color: var(--muted); }
.pt-flame { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; }
.pt-lab { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--text-2); }
.pt-tag { padding: 3px 10px; border-radius: 12px; background: rgba(var(--mint-rgb), .12); color: var(--mint); font-size: 12.5px; }
.pt-tag:hover { background: rgba(var(--mint-rgb), .22); }
.mm { margin-top: 22px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--math); border-radius: 10px; padding: 20px 24px; display: grid; gap: 12px; }
.mm h2 { margin: 0 0 4px; font-size: 18px; font-weight: 500; color: var(--strong); }
.mm p { margin: 0; }
.mm > .input { height: 44px; font-size: 17px; font-family: var(--mono); max-width: 520px; }
.mm-ex { display: flex; flex-wrap: wrap; gap: 6px; }
.mm-total { display: flex; align-items: baseline; gap: 12px; }
.mm-total span { color: var(--muted); }
.mm-total b { font-size: 26px; color: var(--strong); font-weight: 600; font-family: var(--mono); }
.mm-rows { display: grid; gap: 6px; max-width: 620px; }
.mm-row { display: grid; grid-template-columns: 40px 130px 1fr 60px; gap: 10px; align-items: center; font-size: 13px; color: var(--text-2); }
.mm-row > b { color: var(--cc); font-size: 15px; }
.mm-bar { height: 8px; border-radius: 4px; background: var(--tint); overflow: hidden; }
.mm-bar i { display: block; height: 100%; width: var(--p); background: var(--cc); border-radius: 4px; }
.mm-err { color: #ff8a8a; }
@media (max-width: 760px) {
  .topnav-search { width: auto !important; padding: 0 14px !important; height: 44px; border-radius: 22px; flex: 1; justify-content: center; }
  .topnav-search span { display: inline !important; }
  .pal-overlay { padding: 10px; }
  .pal { max-height: 80vh; }
  .pal-foot { display: none; }
  .pass-strip { padding: 14px; gap: 12px; }
  .ps-go { display: none; }
  .pt-detail, .mm, .pp-cert { padding: 16px; }
  .mm-row { grid-template-columns: 34px 100px 1fr 50px; }
  .pt-wrap { margin: 0 -16px; padding: 0 16px 6px; }
  .nav-search-m { display: grid; place-items: center; margin-left: auto; width: 44px; height: 44px; border: 0; background: none; color: var(--text-2); border-radius: 8px; cursor: pointer; }
  .nav-search-m svg { width: 22px; height: 22px; }
  .nav-search-m + .nav-toggle { margin-left: 0; }
  .topnav-actions .topnav-search { display: none !important; }
  /* passport: everything tighter so the page is short on phones */
  .pp { gap: 18px; }
  .pp .page-head h1 { font-size: 21px; }
  .pp .page-head p { font-size: 13px; }
  .pp-rings { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .pp-ring { padding: 10px 4px; gap: 4px; }
  .pp-ring svg { width: 54px; height: 54px; }
  .pp-ring > b { top: 25px; font-size: 14px; }
  .pp-ring > b small { font-size: 9px; }
  .pp-ring > span { font-size: 10.5px; text-align: center; line-height: 1.2; }
  .pp .section-title { margin-bottom: 10px; }
  .pp .section-title h2, .pp-fold > summary h2 { font-size: 17px; }
  .pp-badges { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .pp-badge { padding: 10px 6px; justify-items: center; text-align: center; cursor: pointer; }
  .pp-badge .ico { font-size: 24px; }
  .pp-badge b { font-size: 11.5px; line-height: 1.25; }
  .pp-badge span { display: none; font-size: 11px; }
  .pp-badge.open span { display: block; }
  .pp-list { grid-template-columns: 1fr 1fr; gap: 6px; }
  .pp-item { padding: 8px 9px; font-size: 12px; gap: 6px; }
  .pp-cert { gap: 12px; }
  .pp-cert h2 { font-size: 16px; }
  .pp-cert-row, .pp-cert-row .input { width: 100%; }
  .pp-cert-row .btn { flex: 1; }
  .pt-props { grid-template-columns: 1fr 1fr; }
  .topnav-actions a, .topnav-actions button { white-space: nowrap; }
  .topnav-actions { flex-wrap: wrap; }
  .topnav-search { flex: 1 1 100%; }
}

.foot-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--muted); }
.foot-links b { color: var(--text-2); font-weight: 500; }
.foot-links a { color: var(--accent-2); }

/* ===== Lab Verdict ===== */
.vd-hbtn { position: relative; }
.vd-badge { display: none; position: absolute; top: 6px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--mint); color: #06281c; font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center; }
.vd-badge.on { display: block; }
.vd-host { display: contents; }
.vd-tease { --vc: var(--mint); --vc-rgb: var(--mint-rgb); position: absolute; top: 76px; left: 50%; transform: translateX(-50%); z-index: 12; width: min(430px, calc(100vw - 20px)); display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; font-family: inherit; color: var(--text); cursor: pointer; border-radius: 14px; border: 1px solid rgba(var(--vc-rgb), .55); background: linear-gradient(120deg, rgba(var(--vc-rgb), .2), var(--panel) 62%); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); animation: vdIn .32s cubic-bezier(.2, 1.3, .4, 1); }
.vd-tease.partial { --vc: #fbbf24; --vc-rgb: 251, 191, 36; }
.vd-tease.no { --vc: #fb7185; --vc-rgb: 251, 113, 133; }
.vd-tease.out { opacity: 0; transform: translate(-50%, -10px); transition: .2s; }
@keyframes vdIn { from { opacity: 0; transform: translate(-50%, -18px) scale(.96); } }
.vd-tease .seal { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px; clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); background: rgba(var(--vc-rgb), .25); }
.vd-tease .txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.vd-tease small { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--vc); font-weight: 700; }
.vd-tease b { font-size: 15px; font-weight: 600; color: var(--strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vd-tease .cta { font-size: 12.5px; color: var(--text-2); }
.vd-tease .cta::after { content: ' →'; color: var(--vc); }
.vd-tease-x { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.vd-tease-x:hover { background: var(--tint); color: var(--strong); }

.vd-back { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(4, 8, 16, var(--vd-dim, .58)); backdrop-filter: blur(3px); animation: fade .16s; }
.vd { --vc: var(--mint); --vc-rgb: var(--mint-rgb); position: relative; width: min(640px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column; overflow: hidden; border-radius: 18px; background: var(--panel); border: 1px solid rgba(var(--vc-rgb), .35); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.vd.enter { animation: vdPanel .28s cubic-bezier(.2, 1.1, .4, 1); }
.vd.partial { --vc: #fbbf24; --vc-rgb: 251, 191, 36; }
.vd.no { --vc: #fb7185; --vc-rgb: 251, 113, 133; }
@keyframes vdPanel { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.vd-head { display: flex; align-items: center; gap: 14px; padding: 16px 16px 10px 18px; background: linear-gradient(135deg, rgba(var(--vc-rgb), .2), transparent 70%); }
.vd-head .stamp { flex: none; width: 70px; height: 70px; display: grid; place-items: center; border-radius: 50%; border: 2px dashed var(--vc); transform: rotate(-11deg); }
.vd.enter .stamp { animation: vdStamp .36s cubic-bezier(.3, 1.7, .5, 1); }
.vd-head .stamp span { max-width: 58px; font-size: 9.5px; line-height: 1.1; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; text-align: center; color: var(--vc); }
@keyframes vdStamp { from { transform: rotate(-30deg) scale(1.7); opacity: 0; } }
.vd-head .ttl { flex: 1; min-width: 0; }
.vd-head small { display: block; font-size: 12px; color: var(--vc); font-weight: 600; }
.vd-head h2 { margin: 2px 0 0; font-size: 20px; line-height: 1.2; color: var(--strong); font-weight: 600; }
.vd-x { flex: none; align-self: flex-start; }
.vd-sum { margin: 0; font-size: 14.5px; color: var(--text-2); line-height: 1.5; }
.vd-pred { padding: 8px 12px; border-radius: 10px; font-size: 13px; display: grid; gap: 1px; background: rgba(251, 113, 133, .12); }
.vd-pred.ok { background: rgba(var(--mint-rgb), .14); }
.vd-pred b { color: var(--strong); }
.vd-flow { display: grid; grid-template-columns: 1fr 74px 1fr; gap: 6px; align-items: center; padding: 10px; border-radius: 12px; background: var(--bg-2); }
.vd-flow .side { display: flex; flex-wrap: wrap; gap: 6px; align-content: center; }
.vd-flow .side:last-child { justify-content: flex-end; }
.vd-flow .arrow { position: relative; height: 34px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.vd-flow .arrow::after { content: ''; position: absolute; left: 4px; right: 4px; top: 50%; border-top: 2px solid rgba(var(--vc-rgb), .35); }
.vd-flow .arrow::before { content: ''; position: absolute; right: 3px; top: calc(50% - 5px); border-left: 8px solid var(--vc); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.vd-flow .arrow i { position: relative; z-index: 1; width: 6px; height: 6px; border-radius: 50%; background: var(--vc); animation: vdFlow 1.5s linear infinite; }
.vd-flow .arrow i:nth-child(2) { animation-delay: .5s; } .vd-flow .arrow i:nth-child(3) { animation-delay: 1s; }
@keyframes vdFlow { 0%, 100% { opacity: .2; transform: translateX(-12px); } 50% { opacity: 1; transform: translateX(12px); } }
.vd-flow .arrow small { position: absolute; left: 0; right: 0; top: -2px; text-align: center; font-size: 9.5px; color: var(--muted); }
.vd-flow.blocked .arrow i { display: none; }
.vd-flow.blocked .arrow::before { content: '✕'; right: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--panel); color: var(--vc); font-size: 15px; font-weight: 700; z-index: 1; }
.vd-chip { --cc: var(--line-2); display: inline-grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: center; padding: 5px 9px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line-2); min-width: 0; }
.vd-chip .dot { grid-row: span 2; width: 10px; height: 10px; border-radius: 3px; background: var(--cc); }
.vd-chip b { grid-column: 2; font-size: 14px; font-weight: 600; color: var(--strong); }
.vd-chip small, .vd-chip em, .vd-chip u { grid-column: 2; font-size: 10.5px; line-height: 1.25; color: var(--muted); font-style: normal; text-decoration: none; }
.vd-chip em { color: var(--accent-2); }
.vd-tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.vd-tabs button { flex: 1; height: 40px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; border-bottom: 2px solid transparent; }
.vd-tabs button.on { color: var(--strong); border-bottom-color: var(--vc); }
.vd-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 18px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.vd-body.more { -webkit-mask-image: linear-gradient(#000 calc(100% - 34px), transparent); mask-image: linear-gradient(#000 calc(100% - 34px), transparent); }
.vd-step { justify-self: end; min-height: 42px; padding: 0 16px; border-radius: 21px; border: 1px solid rgba(var(--vc-rgb), .5); background: rgba(var(--vc-rgb), .12); color: var(--strong); font: inherit; font-size: 14px; cursor: pointer; }
.vd-opts { display: none; }
.vd-grip { display: none; }
.vd-done { display: none; }
.vd-foot .nav button.fresh { border-color: var(--vc); color: var(--vc); }
.vd-back.leaving { opacity: 0; transition: opacity .18s; pointer-events: none; }
.vd-body h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.vd-before { display: flex; justify-content: center; align-items: center; gap: 22px; }
.vd-before .to { font-size: 20px; color: var(--vc); }
.vd-vial { display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.vd-vial .glass { position: relative; width: 62px; height: 84px; overflow: hidden; border: 2px solid rgba(200, 220, 255, .4); border-top: 0; border-radius: 3px 3px 16px 16px; background: var(--tint); }
.vd-vial .liquid { position: absolute; left: 0; right: 0; bottom: 0; height: var(--level); background: var(--fill); transition: height .5s, background .5s; }
.vd-vial .solid { position: absolute; left: 0; right: 0; bottom: 0; height: 12px; background: var(--solid); border-radius: 50% 50% 0 0 / 60% 60% 0 0; }
.vd-vial .bub { position: absolute; bottom: 6px; left: 30%; width: 6px; height: 6px; border: 1px solid #fff; border-radius: 50%; animation: vdBub 1.5s ease-in infinite; }
.vd-vial .bub.b2 { left: 62%; animation-delay: .6s; }
@keyframes vdBub { to { transform: translateY(-52px); opacity: 0; } }
.vd-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.vd-metrics .m { padding: 9px 11px; border-radius: 10px; background: var(--bg-2); display: grid; gap: 1px; }
.vd-metrics b { font-size: 17px; color: var(--strong); font-family: var(--mono); font-weight: 500; }
.vd-metrics span { font-size: 11.5px; color: var(--muted); }
.vd-metrics .hot b { color: #fb923c; } .vd-metrics .cold b { color: #60a5fa; }
.vd-eqs .eq, .vd-mini { font-family: var(--mono); color: var(--accent-2); font-size: 13px; line-height: 1.6; }
.vd-eqs .eq { padding: 7px 10px; margin-bottom: 5px; border-radius: 8px; background: var(--bg-2); overflow-x: auto; }
.vd-mini { display: block; font-size: 12px; margin-bottom: 2px; }
.vd-note { margin: 0; padding: 9px 12px; border-left: 3px solid var(--vc); background: rgba(var(--vc-rgb), .08); border-radius: 0 8px 8px 0; font-size: 13.5px; color: var(--text-2); }
.vd-spect p { margin: -4px 0 6px; font-size: 12.5px; color: var(--muted); }
.vd-spect .row { display: flex; flex-wrap: wrap; gap: 6px; }
.vd-tablewrap { overflow-x: auto; }
.vd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.vd-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 8px; }
.vd-table td { padding: 6px 8px; border-top: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.vd-table tr.off td { color: #fb7185; } .vd-table tr.warn td { color: #fbbf24; }
.vd-chain { list-style: none; margin: 0; padding: 0; counter-reset: st; display: grid; }
.vd-chain li { counter-increment: st; position: relative; padding: 0 0 13px 36px; }
.vd-chain li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(var(--vc-rgb), .2); color: var(--vc); font-size: 12px; font-weight: 700; }
.vd-chain li::after { content: ''; position: absolute; left: 11.5px; top: 26px; bottom: 2px; border-left: 1px dashed rgba(var(--vc-rgb), .4); }
.vd-chain li:last-child { padding-bottom: 0; } .vd-chain li:last-child::after { display: none; }
.vd-chain li.block::before { content: '✕'; background: rgba(251, 113, 133, .22); color: #fb7185; }
.vd-chain li.hot::before { background: rgba(251, 146, 60, .22); color: #fb923c; } .vd-chain li.cold::before { background: rgba(96, 165, 250, .22); color: #60a5fa; }
.vd-chain b { display: block; font-size: 14.5px; font-weight: 600; color: var(--strong); line-height: 1.35; }
.vd-chain p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.vd-ladder { padding: 10px 12px; border-radius: 12px; background: var(--bg-2); }
.vd-ladder .rail { display: flex; gap: 3px; }
.vd-ladder .rail span { flex: 1; min-width: 0; padding: 6px 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); border-radius: 5px; background: var(--panel-2); }
.vd-ladder .rail .h { outline: 1px dashed var(--line-2); }
.vd-ladder .rail .a { background: var(--vc); color: #071a12; }
.vd-ladder .rail .b { background: var(--accent); color: #fff; }
.vd-ladder .cap { display: flex; justify-content: space-between; margin-top: 3px; font-size: 10.5px; color: var(--faint); }
.vd-ladder p { margin: 6px 0 0; font-size: 13px; color: var(--text-2); }
.vd-forces .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vd-forces .f { position: relative; padding: 9px 10px 9px 34px; border-radius: 10px; background: var(--bg-2); }
.vd-forces .ic { position: absolute; left: 10px; top: 9px; color: #fb7185; font-weight: 700; }
.vd-forces .f.ok .ic { color: var(--mint); }
.vd-forces b { font-size: 13px; color: var(--strong); font-weight: 600; }
.vd-forces p { margin: 1px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.vd-energy { padding: 10px 12px; border-radius: 12px; background: var(--bg-2); }
.vd-energy svg { display: block; width: 100%; max-width: 340px; margin: 0 auto; }
.vd-energy .ax { fill: none; stroke: var(--line-2); }
.vd-energy .lv { fill: none; stroke: var(--text-2); stroke-width: 2.5; }
.vd-energy .cv { fill: none; stroke: var(--vc); stroke-width: 2; stroke-dasharray: 4 3; }
.vd-energy .pt { fill: #fff; }
.vd-energy text { font-size: 9.5px; fill: var(--muted); font-family: inherit; }
.vd-energy p { margin: 6px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.vd-foot-note { margin: 0; font-size: 12px; color: var(--faint); }
.vd-next { display: grid; gap: 8px; }
.vd-next .n { display: flex; gap: 11px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); }
.vd-next .ic { font-size: 18px; }
.vd-next b { font-size: 14px; color: var(--strong); font-weight: 600; }
.vd-next p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.vd-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--bg-2); }
.vd-foot .nav { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.vd-foot .nav button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: none; color: var(--text); font-size: 17px; cursor: pointer; }
.vd-foot .nav button:disabled { opacity: .3; cursor: default; }
.vd-foot .opts { display: flex; gap: 12px; }
.vd-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.vd-empty { padding: 42px 26px 34px; text-align: center; }
.vd-empty .seal { font-size: 34px; color: var(--accent-2); }
.vd-empty h3 { margin: 6px 0; color: var(--strong); font-weight: 600; }
.vd-empty p { margin: 0; color: var(--muted); font-size: 14px; }
.no-report .vd-x { position: absolute; top: 10px; right: 10px; }
.vd-ask { padding: 22px; gap: 10px; text-align: center; width: min(460px, 100%); --vc: var(--accent-2); --vc-rgb: var(--accent-rgb); }
.vd-ask h2 { margin: 0; color: var(--strong); font-size: 21px; font-weight: 600; }
.vd-ask p { margin: 0; color: var(--text-2); font-size: 14.5px; }
.vd-ask .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.vd-ask .opts button { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 12px; text-align: left; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; }
.vd-ask .opts button:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), .14); }
.vd-ask .opts button span { font-size: 20px; }
.vd-ask .opts button:last-child { grid-column: 1 / -1; justify-content: center; }
.vd-ask .btn { justify-self: center; margin-top: 4px; }
.vd-ask { display: block; }
.vd-ask .vd-x { position: absolute; top: 10px; right: 10px; }
@media (prefers-reduced-motion: reduce) { .vd, .vd-tease, .vd-head .stamp, .vd-flow .arrow i, .vd-vial .bub { animation: none; } }
@media (max-width: 760px) {
  .vd-hbtn span:not(.vd-badge) { display: none; }
  .vd-badge { top: 4px; right: 2px; }
  .vd-tease { top: 62px; touch-action: none; }
  .vd-tease-x { width: 40px; height: 40px; }
  .vd-back { place-items: end center; padding: 0; }
  .vd { width: 100%; height: 86dvh; max-height: 86dvh; border-radius: 18px 18px 0 0; border-width: 1px 0 0; }
  .vd.no-report, .vd-ask { height: auto; }
  .vd-grip { display: grid; place-items: center; height: 18px; flex: none; touch-action: none; }
  .vd-grip i { width: 42px; height: 4px; border-radius: 2px; background: var(--line-2); }
  .vd-head, .vd-tabs { touch-action: none; }
  .vd-x { width: 44px; height: 44px; margin: -6px -6px 0 0; }
  .vd-tabs { padding: 0 8px; }
  .vd-tabs button { height: 46px; font-size: 14px; }
  .vd-done { display: block; min-height: 44px; padding: 0 26px; border: 0; border-radius: 22px; background: var(--accent); color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
  .vd-foot .opts { display: none; }
  .vd-foot .nav button { width: 44px; height: 44px; font-size: 20px; }
  .vd-opts { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 10px; border-top: 1px solid var(--line); }
  .vd-toggle { min-height: 40px; font-size: 14px; }
  .vd-toggle input { width: 18px; height: 18px; }
  .vd-chain b { font-size: 15.5px; } .vd-chain p { font-size: 14.5px; }
  .vd-eqs .eq { font-size: 13.5px; overflow: visible; overflow-wrap: anywhere; }
  .vd-mini { overflow-wrap: anywhere; }
  .vd-step { justify-self: stretch; }
  .vd-tablewrap { overflow: visible; }
  .vd-table, .vd-table tbody { display: block; }
  .vd-table tr:first-child { display: none; }
  .vd-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; padding: 9px 11px; margin-bottom: 8px; border-radius: 10px; background: var(--bg-2); }
  .vd-table td { padding: 0; border: 0; white-space: normal; font-size: 14px; }
  .vd-table td::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); }
  .vd.enter { animation-name: vdSheet; }
  @keyframes vdSheet { from { transform: translateY(40px); opacity: 0; } }
  .vd-head { padding: 0 12px 6px 14px; gap: 11px; }
  .vd-head .stamp { width: 60px; height: 60px; } .vd-head .stamp span { font-size: 8px; max-width: 48px; letter-spacing: .02em; }
  .vd-head h2 { font-size: 17.5px; }
  .vd-flow { grid-template-columns: 1fr; padding: 8px; }
  .vd-flow .side:last-child { justify-content: flex-start; }
  .vd-flow .arrow { height: 22px; transform: rotate(90deg); width: 40px; justify-self: center; }
  .vd-flow .arrow small { display: none; }
  .vd-chip u, .vd-chip em { display: none; }
  .vd-chip { padding: 4px 8px; }
  .vd-body { padding: 12px 14px; }
  .vd-forces .f { padding: 8px 8px 8px 26px; } .vd-forces .ic { left: 8px; top: 8px; }
  .vd-foot { padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); }
}

/* ===== Movable panels and the More menu ===== */
.sizing { transition: none !important; user-select: none; }
.placed { left: var(--fx) !important; top: var(--fy) !important; right: auto !important; bottom: auto !important; width: var(--fw); }
.guide.placed { width: min(330px, calc(100% - 20px)); }
.guide.pill.placed { width: auto; }
@media (min-width: 761px) { .placed-wide { left: var(--fx) !important; top: var(--fy) !important; right: auto !important; bottom: auto !important; width: var(--fw); } }
.dragging { opacity: .9; box-shadow: 0 18px 44px rgba(0, 0, 0, .6); user-select: none; z-index: 9; }
.guide-head, .nb-float .insp-head, .notebook-head { cursor: grab; touch-action: none; }
.guide.dragging .guide-head, .dragging .insp-head, .dragging .notebook-head { cursor: grabbing; }
.guide.pill { left: 10px; right: auto !important; width: auto; padding: 0; overflow: visible; background: none; box-shadow: none; }
.guide-pill { display: flex; align-items: center; gap: 6px; height: 46px; padding: 0 14px 0 10px; border: 1px solid rgba(var(--accent-rgb), .6); border-radius: 23px; background: var(--float); color: var(--strong); font: inherit; font-size: 14px; cursor: grab; touch-action: none; box-shadow: var(--shadow); animation: pillIn .25s ease-out; }
.guide-pill span { font-size: 20px; }
.guide-pill b { font-weight: 600; }
@keyframes pillIn { from { transform: scale(.85); opacity: 0; } }
.guide-end { display: block; width: 100%; padding: 9px 14px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--muted); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.guide-end:hover { color: #fb7185; }
.nb-menu { position: absolute; top: 60px; right: 12px; z-index: 13; min-width: 214px; padding: 6px; display: grid; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 18px 44px rgba(0, 0, 0, .55); animation: fade .12s; }
.nb-mitem { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.nb-mitem:hover { background: rgba(var(--accent-rgb), .14); color: var(--strong); }
.nb-mitem svg { width: 19px; height: 19px; flex: none; }
.nb-lab .nb-hright { padding-right: 8px; }
@media (max-width: 760px) { .nb-menu { top: 50px; right: 8px; } .nb-hright .nb-hbtn { min-width: 44px; } }

/* ===== Simulations without a transport bar ===== */
.simframe.no-bar { grid-template-rows: 64px minmax(0, 1fr); }
.simframe.no-bar .sim-panel { grid-row: 2; }

/* ===== Vector Addition ===== */
.vec-list { display: grid; gap: 8px; }
.vec-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr) 36px; align-items: center; gap: 6px; padding: 7px 7px 5px; border-radius: 10px; border: 1px solid var(--line); background: var(--sunk); }
.vec-row.on { border-color: var(--vc); }
.vec-row > b { color: var(--vc); font-size: 17px; text-align: center; }
.vec-f { display: flex; align-items: center; gap: 4px; min-width: 0; }
.vec-f span { color: var(--muted); font-size: 12px; }
.vec-f .input { height: 38px; min-width: 0; padding: 0 6px; font-family: var(--mono); font-size: 15px; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.vec-f .input::-webkit-outer-spin-button, .vec-f .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.vec-del { width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 14px; cursor: pointer; }
.vec-del:hover:not(:disabled) { color: #fb7185; background: rgba(251, 113, 133, .12); }
.vec-del:disabled { opacity: .25; cursor: default; }
.vec-row .mag { grid-column: 2 / -1; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.vec-work { white-space: pre-line; font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.vec-tools { position: absolute; right: 8px; top: 8px; display: grid; gap: 6px; z-index: 2; }
.vec-tool { min-width: 40px; height: 40px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--float); color: var(--text); font: inherit; font-size: 16px; cursor: pointer; }
.vec-tool:hover { border-color: var(--accent); color: var(--strong); }

/* ===== Simulations on phones and tablets: the sim stays on screen, only the controls scroll ===== */
.sim-split, .sim-max-btn { display: none; }
@media (max-width: 900px), (orientation: portrait) and (max-width: 1200px) {
  .simframe, .simframe.no-bar { height: 100%; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px var(--sim-h, minmax(180px, 56%)) 22px auto minmax(0, 1fr); }
  .sim-top { grid-row: 1; }
  .sim-stage { grid-row: 2; grid-column: 1; }
  .sim-split { grid-row: 3; grid-column: 1; display: grid; place-items: center; background: var(--head); cursor: ns-resize; touch-action: none; }
  .sim-split i { width: 46px; height: 4px; border-radius: 2px; background: var(--muted); transition: .15s; }
  .sim-split.on i { background: var(--accent); width: 70px; }
  .sim-bar { grid-row: 4; grid-column: 1; }
  .sim-panel, .simframe.no-bar .sim-panel { grid-row: 5; grid-column: 1; min-height: 0; padding: 10px 12px 20px; overscroll-behavior: contain; }
  .simframe.sim-max { grid-template-rows: 56px minmax(0, 1fr) 0 auto 0; }
  .simframe.sim-max .sim-split, .simframe.sim-max .sim-panel { display: none; }
  .simframe.no-bar .sim-bar { display: none; }
  .sim-max-btn { display: block; position: absolute; right: 8px; bottom: 8px; z-index: 2; width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--float); color: var(--text); font-size: 17px; cursor: pointer; }
  .sim-bar { flex-wrap: nowrap; padding: 6px 10px; gap: 6px; }
  .sim-bar .btn { flex: none; min-width: 44px; height: 38px; font-size: 15px; }
  .sim-bar .tl, .sim-bar > span, .sim-bar > div[style*="flex"] { display: none; }
  .sim-bar .seg { flex: 1; width: auto !important; min-width: 0; order: 0; }
}
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .simframe, .simframe.no-bar { grid-template-columns: minmax(0, 1fr) 270px; grid-template-rows: 46px minmax(0, 1fr) auto; }
  .sim-top { grid-column: 1 / -1; }
  .sim-stage { grid-row: 2; }
  .sim-bar { grid-row: 3; }
  .sim-panel, .simframe.no-bar .sim-panel { grid-row: 2 / 4; grid-column: 2; }
  .sim-split, .sim-max-btn { display: none; }
}

/* ===== Light theme touches ===== */
:root[data-theme="light"] .stage-dark { color: var(--text); }
:root[data-theme="light"] .nb-card canvas, :root[data-theme="light"] .phys-list .item canvas { background: #131d31; border-radius: 6px; }
:root[data-theme="light"] .hero-scene { background: radial-gradient(120% 90% at 50% 40%, #16233b, #0b1322); border-radius: 22px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); }
:root[data-theme="light"] .home-hero .grad { filter: saturate(1.2) brightness(.85); }
:root[data-theme="light"] .nb-head, :root[data-theme="light"] .sim-top, :root[data-theme="light"] .topnav { box-shadow: 0 1px 0 var(--line); }
:root[data-theme="light"] .nb-hbtn { color: var(--text-2); }
:root[data-theme="light"] .nb-drawer, :root[data-theme="light"] .nb-float, :root[data-theme="light"] .nb-menu { box-shadow: 0 12px 34px rgba(15, 23, 42, .14); }
:root[data-theme="light"] .ph-bar i, :root[data-theme="light"] .hs-bar i { box-shadow: 0 0 0 1.5px #334155; }
.theme-btn svg { width: 20px; height: 20px; }
.topnav-theme { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 18px; border: 1px solid var(--line-2); background: none; color: var(--text-2); cursor: pointer; }
.topnav-theme:hover { color: var(--strong); border-color: var(--accent); }
.topnav-theme span { display: none; }
@media (max-width: 760px) { .topnav-theme { width: 44px; height: 44px; border-radius: 22px; flex: none !important; } }
html { transition: background-color .2s; }
:root[data-theme="light"] .btn.danger, :root[data-theme="light"] .mm-err, :root[data-theme="light"] .vd-forces .ic, :root[data-theme="light"] .vd-table tr.off td { color: #dc2626; }
:root[data-theme="light"] .vd-table tr.warn td { color: #b45309; }
:root[data-theme="light"] .vd-metrics .hot b { color: #ea580c; } :root[data-theme="light"] .vd-metrics .cold b { color: #2563eb; }

/* ===== Simulation explainers: live "What's happening" box and self-checking challenges ===== */
.sim-story { background: rgba(var(--accent-rgb), .08); border: 1px solid rgba(var(--accent-rgb), .28); border-radius: 10px; padding: 10px 12px; }
.sim-story h4, .sim-goals h4 { margin: 0 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.sim-story-body { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.sim-story-body p { margin: 0 0 6px; }
.sim-story-body p:last-child { margin: 0; }
.sim-story-body b { color: var(--strong); }
.sim-goals { background: var(--sunk); border-radius: 8px; padding: 12px; }
.sim-goals h4 { color: var(--mint); }
.sim-goals ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sim-goals li { display: flex; gap: 9px; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.sim-goals li i { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font-style: normal; font-size: 11px; color: #fff; }
.sim-goals li.done { color: var(--muted); }
.sim-goals li.done span { text-decoration: line-through; }
.sim-goals li.done i { background: var(--ok); border-color: var(--ok); }
.sim-goals li.done i::after { content: '✓'; }
.toast.ok { border-left-color: var(--ok); }
