/* ───────────────────────── Molecule Shapes ─────────────────────────
   Calm, warm, glassy — in the spirit of zperiod.app                */

:root {
  --bg: #fdfbf7;
  --bg-rgb: 253, 251, 247;
  --text: #2c2420;
  --text2: #5d544f;
  --muted: #9a948e;
  --slate: #6b7fa6;
  --line: rgba(60, 40, 20, 0.08);
  --glass: rgba(255, 255, 255, 0.92);
  --glass-strong: rgba(255, 255, 255, 0.96);
  --glass-edge: transparent;
  --edge: rgba(60, 40, 20, 0.09);
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.05);
  --shadow-lg: 0 8px 30px rgba(60, 40, 20, 0.12);
  --chip: rgba(60, 40, 20, 0.045);
  --chip-hover: rgba(60, 40, 20, 0.085);
  --seg-track: rgba(60, 40, 20, 0.05);
  --seg-thumb: #ffffff;
  --accent: #1f6f78;
  --accent-soft: rgba(31, 111, 120, 0.10);
  --accent2: #1f6f78;
  --ink: #2c2420;
  --ink-fg: #fdfbf7;
  --good: #2e8758;
  --good-soft: rgba(46, 135, 88, 0.12);
  --warn: #b7791f;
  --bad: #c0434b;
  --bad-soft: rgba(192, 67, 75, 0.10);
  --grad: var(--accent);
  --grad-brand: var(--accent);
  --field1: rgba(181, 204, 255, 0.36);
  --field2: rgba(185, 239, 211, 0.36);
  --field3: rgba(252, 217, 176, 0.36);
  --radius: 16px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --spring: cubic-bezier(0.2, 0.7, 0.2, 1); /* no overshoot: motion is functional, not decorative */
}
:root[data-theme="dark"] {
  --bg: #131316;
  --bg-rgb: 19, 19, 22;
  --text: #f3efe9;
  --text2: #b9b2ab;
  --muted: #837d76;
  --slate: #8fa3cc;
  --line: rgba(255, 255, 255, 0.08);
  --glass: rgba(34, 34, 40, 0.93);
  --glass-strong: rgba(34, 34, 40, 0.97);
  --glass-edge: transparent;
  --edge: rgba(255, 255, 255, 0.09);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --chip: rgba(255, 255, 255, 0.06);
  --chip-hover: rgba(255, 255, 255, 0.11);
  --seg-track: rgba(255, 255, 255, 0.06);
  --seg-thumb: rgba(255, 255, 255, 0.14);
  --accent: #6bbdc4;
  --accent-soft: rgba(107, 189, 196, 0.15);
  --ink: #f3efe9;
  --ink-fg: #131316;
  --good: #52c08a;
  --good-soft: rgba(82, 192, 138, 0.15);
  --bad: #e0707a;
  --bad-soft: rgba(224, 112, 122, 0.15);
  --field1: rgba(61, 79, 184, 0.17);
  --field2: rgba(29, 122, 90, 0.17);
  --field3: rgba(138, 74, 28, 0.17);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.5s var(--ease), color 0.4s;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: 0.45; }
input { font: inherit; color: inherit; }
sub, sup { line-height: 0; }
h1, h2, h3, h4, p { margin: 0; }
.ic { width: 20px; height: 20px; flex: none; }
.ic.big { width: 40px; height: 32px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────── Background ─────────
   Three soft colour fields painted once as static gradients (no blurred, animated layers to recomposite every frame). */
.bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; transition: background-color 0.5s;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle 34vmax at 9vmax 7vmax, var(--field1), transparent),
    radial-gradient(circle 30vmax at calc(100% - 8vmax) 26vmax, var(--field2), transparent),
    radial-gradient(ellipse 30vmax 24vmax at calc(28vw + 18vmax) calc(100% + 3vmax), var(--field3), transparent); }
.blob { display: none; }

/* ───────── Stage ───────── */
.stage { position: fixed; inset: 0; z-index: 1; transition: opacity 0.45s var(--ease); }
.stage.hidden { opacity: 0; pointer-events: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.overlay-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.overlay-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.overlay-svg path.arc { stroke: var(--arc, rgba(60, 45, 35, 0.55)); stroke-width: 2.4; }
.overlay-svg path.hull { stroke: rgba(90, 100, 150, 0.5); stroke-width: 2; stroke-dasharray: 2 7; }
:root[data-theme="dark"] .overlay-svg path.arc { stroke: rgba(255, 255, 255, 0.7); }
:root[data-theme="dark"] .overlay-svg path.hull { stroke: rgba(190, 205, 255, 0.5); }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.mlabel { position: absolute; left: 0; top: 0; will-change: transform; white-space: nowrap; font-weight: 700; user-select: none; }
.mlabel.ang { font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--edge); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1); font-variant-numeric: tabular-nums; }
.mlabel.sym { font-size: 15px; font-weight: 800; color: #2c2420; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45); }
.mlabel.sym.on-dark { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.mlabel.pc { font-size: 12px; padding: 1px 6px; border-radius: 8px; background: var(--glass-strong); border: 1px solid var(--edge); }
.mlabel.pc.plus { color: #d6336c; }
.mlabel.pc.minus { color: #1c7ed6; }
.mlabel.dip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #ff6b57; color: #fff; box-shadow: 0 4px 14px rgba(255, 107, 87, 0.4); }

/* ───────── Glass / cards ───────── */
.glass {
  background: var(--glass);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge);
}
.card { border-radius: var(--radius); padding: 14px 16px 16px; }
.card-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--slate);
  margin-bottom: 10px;
}
:lang(zh) .card-h, :lang(zh) .stat .k, :lang(zh) .kicker { letter-spacing: 0.06em; text-transform: none; }
.k { font-size: 10.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--slate); }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 650; font-size: 14px;
  background: var(--chip); color: var(--text);
  transition: transform 0.25s var(--spring), background 0.2s, box-shadow 0.25s, opacity 0.2s;
}
.btn:hover { background: var(--chip-hover); }
.btn:active { transform: scale(0.96); }
.btn.primary { color: #fff; background: var(--grad); box-shadow: 0 8px 22px rgba(118, 75, 162, 0.32); }
.btn.primary:hover { box-shadow: 0 10px 28px rgba(118, 75, 162, 0.42); transform: translateY(-1px); }
.btn.primary:active { transform: scale(0.96); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--edge); }
.btn.ghost:hover { background: var(--chip); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.wide { width: 100%; }
.btn.lg { height: 48px; padding: 0 24px; font-size: 15px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  color: var(--text2); transition: background 0.2s, color 0.2s, transform 0.25s var(--spring);
}
.icon-btn:hover { background: var(--chip-hover); color: var(--text); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.muted { opacity: 0.55; }
.lang-txt { font-weight: 800; font-size: 13px; }

/* ───────── Nav ───────── */
.nav {
  position: fixed; z-index: 50; top: 10px; left: 10px; right: 10px; height: 54px; border-radius: 27px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 12px 0 16px;
  animation: dropIn 0.8s var(--ease) both;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-16px); } }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); justify-self: start; }
.logo { width: 30px; height: 30px; filter: drop-shadow(0 3px 6px rgba(106, 92, 255, 0.25)); transition: transform 0.6s var(--spring); }
.brand:hover .logo { transform: rotate(-12deg) scale(1.08); }
.wordmark { font-size: 19px; letter-spacing: -0.03em; display: flex; align-items: flex-start; }
.wordmark b { font-weight: 800; }
.wordmark sup { font-size: 8.5px; font-weight: 800; margin: 3px 0 0 2px; letter-spacing: 0.04em; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-actions { display: flex; gap: 2px; justify-self: end; }
.tabs .short { display: none; }

.seg { position: relative; display: inline-flex; padding: 4px; border-radius: 999px; background: var(--seg-track); }
.seg button { position: relative; z-index: 1; padding: 7px 16px; border-radius: 999px; font-weight: 650; font-size: 13.5px; color: var(--text2); transition: color 0.25s; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.active { color: var(--text); }
.seg-thumb { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; border-radius: 999px; background: var(--seg-thumb); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06); transition: transform 0.45s var(--spring), width 0.45s var(--spring); }
.seg.sm button { padding: 5px 14px; font-size: 13px; }
.seg.sm .seg-thumb { top: 3px; bottom: 3px; }
.seg.sm { padding: 3px; }

/* ───────── Screens ───────── */
.screen { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.35s var(--ease), visibility 0s 0.35s; }
.screen.active { opacity: 1; visibility: visible; transition: opacity 0.4s var(--ease); }
.screen.scroll { overflow-y: auto; overflow-x: hidden; }
.screen.scroll.active { pointer-events: auto; }
.panels { position: absolute; inset: 0; pointer-events: none; }
.col { position: absolute; top: 78px; bottom: 84px; width: 304px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding: 2px 2px 8px; scrollbar-width: none; pointer-events: none; }
.col::-webkit-scrollbar { display: none; }
.col.left { left: 12px; }
.col.right { right: 12px; }
.col > .card { pointer-events: auto; flex: none; }
.screen.active .col.left > * { animation: slideL 0.7s var(--ease) both; }
.screen.active .col.right > * { animation: slideR 0.7s var(--ease) both; }
.screen.active .col > *:nth-child(2) { animation-delay: 0.07s; }
.screen.active .col > *:nth-child(3) { animation-delay: 0.14s; }
.screen.active .col > *:nth-child(4) { animation-delay: 0.21s; }
@keyframes slideL { from { opacity: 0; transform: translateX(-26px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(26px); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(22px); } }

/* ───────── Switch ───────── */
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: rgba(120, 110, 100, 0.25); transition: background 0.3s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28); transition: transform 0.35s var(--spring); }
.switch input:checked + i { background: var(--grad); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.sw-row + .sw-row { border-top: 1px solid var(--line); }

/* ───────── Model: name / insights ───────── */
.rev + .rev { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.rev-h { display: flex; align-items: center; justify-content: space-between; font-weight: 650; font-size: 13px; color: var(--text2); cursor: pointer; }
.rev-v { min-height: 34px; margin-top: 4px; display: flex; align-items: center; }
.rv { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.rv.ph { font-size: 14px; letter-spacing: 0.35em; color: var(--muted); font-weight: 700; }
.rv.in { animation: revealIn 0.6s var(--ease) both; }
@keyframes revealIn { from { opacity: 0; transform: translateY(10px); } }

.axe-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.axe { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; font-family: var(--font); }
.axe.empty { opacity: 0.35; }
.axe-sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--chip); border-radius: 14px; padding: 8px 11px 9px; min-width: 0; }
.stat b { display: block; font-size: 15px; font-weight: 750; margin-top: 1px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.measure { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding: 8px 11px; border-radius: 14px; background: var(--accent-soft); }
.measure b { font-size: 14px; font-weight: 750; color: var(--accent); font-variant-numeric: tabular-nums; }
.explain { margin-top: 12px; font-size: 12.8px; line-height: 1.6; color: var(--text2); }
.examples { margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { padding: 5px 11px; border-radius: 999px; background: var(--chip); font-weight: 700; font-size: 13px; transition: background 0.2s, transform 0.25s var(--spring), color 0.2s; }
.chip:hover { background: var(--accent-soft); color: var(--accent); transform: translateY(-1px); }
.chip.active { background: var(--grad); color: #fff; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 750; }
.pill.polar { background: rgba(255, 107, 87, 0.15); color: #e0452f; }
.pill.nonpolar { background: var(--good-soft); color: var(--good); }
.pill.ion { background: var(--accent-soft); color: var(--accent); }
:root[data-theme="dark"] .pill.polar { color: #ff8a78; }
.pop { animation: pop 0.5s var(--spring); }
@keyframes pop { from { opacity: 0.2; transform: translateY(5px) scale(0.92); } }

/* collection */
.collection { display: flex; align-items: center; gap: 14px; cursor: pointer; transition: transform 0.3s var(--spring), box-shadow 0.3s; }
.collection:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-edge); }
.collection .card-h { margin-bottom: 8px; }
.ring { position: relative; width: 46px; height: 46px; flex: none; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 0 200; transition: stroke-dasharray 0.9s var(--ease); }
.ring b { font-size: 15px; font-weight: 800; }
.col-info { min-width: 0; }
.col-dots { display: flex; flex-wrap: wrap; gap: 5px; }
.col-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); transition: background 0.4s, transform 0.4s var(--spring); }
.col-dots i.on { background: var(--grad-brand); }
.col-dots i.cur { transform: scale(1.35); box-shadow: 0 0 0 2px var(--accent); }

/* ───────── Model: build ───────── */
.count { font-size: 11.5px; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--chip); transition: all 0.3s; }
.count.full { color: var(--warn); background: rgba(232, 137, 12, 0.14); }
.build-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.build-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 11px 6px 9px;
  border-radius: 16px; background: var(--chip); font-weight: 650; font-size: 12.5px; color: var(--text2);
  transition: transform 0.3s var(--spring), background 0.2s, color 0.2s, box-shadow 0.3s;
}
.build-btn:hover { background: var(--chip-hover); color: var(--text); transform: translateY(-2px); box-shadow: 0 8px 18px rgba(60, 40, 20, 0.08); }
.build-btn:active, .build-btn.pressed { animation: press 0.4s var(--spring); }
@keyframes press { 40% { transform: scale(0.9); } }
.build-btn kbd { position: absolute; top: 6px; right: 7px; }
kbd { font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; border-radius: 6px; background: var(--chip); color: var(--muted); border-bottom: 2px solid var(--line); font-weight: 600; }
.meter { display: flex; gap: 6px; justify-content: space-between; margin: 12px 0; }
.meter.shake { animation: shake 0.45s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.slot { position: relative; flex: 1; aspect-ratio: 1; max-width: 40px; border-radius: 50%; border: 1.5px dashed var(--line); display: grid; place-items: center; transition: all 0.3s var(--spring); }
.slot.filled { border-style: solid; border-color: transparent; background: var(--chip); animation: pop 0.45s var(--spring); }
.slot.filled:hover { background: var(--bad-soft); transform: scale(1.08); }
.slot-bond { width: 15px; height: 15px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #c5ccdc); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.slot-bond.o2 { box-shadow: 0 0 0 2px var(--glass-strong), 0 0 0 3.5px #aab2c4; }
.slot-bond.o3 { box-shadow: 0 0 0 2px var(--glass-strong), 0 0 0 3.5px #aab2c4, 0 0 0 5.5px var(--glass-strong), 0 0 0 7px #aab2c4; width: 12px; height: 12px; }
.slot-lone { width: 18px; height: 14px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 60% 35%, #d6e4ff, #7aa2f7); position: relative; box-shadow: 0 1px 3px rgba(60, 90, 200, 0.4); }
.slot-lone::after { content: ""; position: absolute; left: 6px; top: 5px; width: 3px; height: 3px; border-radius: 50%; background: #ffc928; box-shadow: 5px 0 0 #ffc928; }
.slot-x { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: var(--bad); color: #fff; opacity: 0; transition: opacity 0.2s; }
.slot-x .ic { width: 14px; height: 14px; }
.slot.filled:hover .slot-x { opacity: 1; }

.dropzone { position: fixed; top: 78px; bottom: 84px; right: 12px; width: 304px; z-index: 5; border-radius: 26px; border: 2px dashed var(--bad); background: var(--bad-soft); display: grid; place-items: center; opacity: 0; pointer-events: none; transform: scale(0.97); transition: all 0.3s var(--ease); color: var(--bad); font-weight: 700; }
.dropzone > div { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dropzone .ic { width: 34px; height: 34px; }
.dropzone.show { opacity: 1; transform: none; }
.dropzone.hot { background: rgba(239, 71, 111, 0.24); border-style: solid; transform: scale(1.01); }

/* ───────── Dock / lesson / hint ───────── */
.dock { position: fixed; z-index: 20; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 3px; padding: 6px; border-radius: 24px; pointer-events: auto; animation: dockIn 0.8s var(--ease) 0.2s both; }
@keyframes dockIn { from { opacity: 0; transform: translate(-50%, 24px); } }
.dock-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; min-width: 42px; padding: 0 10px; border-radius: 17px; color: var(--text2); font-weight: 650; font-size: 13.5px; transition: background 0.2s, color 0.2s, transform 0.3s var(--spring); }
.dock-btn:hover { background: var(--chip-hover); color: var(--text); transform: translateY(-2px); }
.dock-btn:active { transform: scale(0.92); }
.dock-btn.on { background: var(--accent-soft); color: var(--accent); }
.dock-btn.wide { padding: 0 16px 0 12px; }
.dock-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }

.lesson { position: fixed; z-index: 22; bottom: 84px; left: 50%; width: min(500px, calc(100vw - 680px)); min-width: 340px; border-radius: 24px; padding: 16px 18px 14px; pointer-events: auto; opacity: 0; transform: translate(-50%, 22px) scale(0.98); transition: opacity 0.4s var(--ease), transform 0.5s var(--spring); }
.lesson.in { opacity: 1; transform: translate(-50%, 0); }
.lesson[hidden] { display: none; }
.lesson-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.lesson h4 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.lesson p { font-size: 13.5px; color: var(--text2); line-height: 1.6; }
.lesson-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 10px; }
.dots { display: flex; gap: 5px; flex-wrap: wrap; }
.dots i { width: 7px; height: 7px; border-radius: 99px; background: var(--line); transition: all 0.4s var(--spring); }
.dots i.past { background: var(--accent-soft); }
.dots i.on { width: 20px; background: var(--grad); }
.lesson-btns { display: flex; gap: 6px; }
.lesson-btns .btn { height: 36px; padding: 0 14px; }

.hint-pill { position: fixed; z-index: 15; top: 76px; left: 50%; transform: translate(-50%, -8px); padding: 7px 16px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text2); background: var(--glass); border: 1px solid var(--edge); opacity: 0; transition: opacity 0.5s, transform 0.5s var(--ease); pointer-events: none; white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
.hint-pill.show { opacity: 1; transform: translate(-50%, 0); }

/* ───────── Toasts / modal / confetti ───────── */
.toasts { position: fixed; z-index: 120; bottom: 86px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 12px; border-radius: 999px; font-weight: 600; font-size: 13.5px; opacity: 0; transform: translateY(-14px) scale(0.94); transition: all 0.45s var(--spring); max-width: calc(100vw - 24px); }
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(-10px) scale(0.96); }
.toast-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.toast.good .toast-ic { background: var(--good-soft); color: var(--good); }
.toast.warn .toast-ic { background: rgba(232, 137, 12, 0.16); color: var(--warn); }
.toast.bad .toast-ic { background: var(--bad-soft); color: var(--bad); }
.toast-ic .ic { width: 15px; height: 15px; }
.modal-back { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: rgba(20, 15, 10, 0.36); opacity: 0; transition: opacity 0.3s; }
.modal-back.in { opacity: 1; }
.modal { position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 28px; padding: 26px 28px 24px; background: var(--glass-strong); box-shadow: var(--shadow-lg); transform: translateY(18px) scale(0.96); transition: transform 0.5s var(--spring); }
.modal-back.in .modal { transform: none; }
.modal-x { position: absolute; top: 14px; right: 14px; }
.help h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0 12px; }
.help h4 { margin: 18px 0 8px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--slate); }
.help-list { margin: 0; padding-left: 18px; color: var(--text2); line-height: 1.7; }
.kbd-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; align-items: center; font-size: 13.5px; color: var(--text2); }
.credit-line { margin: 18px 0 16px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.confetti { position: fixed; inset: 0; z-index: 200; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; display: block; }

/* ───────── Responsive (shared) ───────── */
@media (max-width: 1180px) {
  .col { width: 272px; }
  .dropzone { width: 272px; }
  .lesson { width: min(460px, calc(100vw - 620px)); }
}
@media (max-width: 900px) {
  .nav { grid-template-columns: auto 1fr auto; padding: 0 8px 0 12px; gap: 6px; }
  .wordmark { display: none; }
  .tabs { justify-self: center; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs button { padding: 7px 11px; font-size: 12.5px; }
  .tabs .full { display: none; } .tabs .short { display: inline; }
  .nav-actions #btn-help { display: none; }
  .panels { pointer-events: none; }
  .panels { top: auto; bottom: 0; left: 0; right: 0; inset: auto 0 0 0; max-height: 47vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 24px 10px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, rgba(var(--bg-rgb), 0.86) 22px); pointer-events: auto; }
  .col { position: static; width: auto; overflow: visible; padding: 0; bottom: auto; top: auto; }
  .col.right { order: -1; }
  .dropzone { display: none; }
  .dock { bottom: auto; top: 70px; left: auto; right: 10px; transform: none; flex-direction: column; padding: 5px; border-radius: 20px; animation: none; }
  .dock-btn.wide span { display: none; }
  .dock-btn.wide { padding: 0 10px; }
  .dock-sep { width: 22px; height: 1px; margin: 3px 0; }
  .lesson { bottom: auto; top: 70px; left: 10px; right: 64px; width: auto; min-width: 0; transform: translateY(-14px); }
  .lesson.in { transform: none; }
  .hint-pill { display: none; }
  .toasts { top: 68px; }
  .modal { padding: 22px 18px; }
}
@media (max-width: 480px) {
  .nav { left: 6px; right: 6px; padding: 0 4px 0 8px; gap: 2px; }
  .tabs button { padding: 7px 9px; font-size: 12px; }
  .icon-btn { width: 32px; height: 32px; }
  .nav-actions #btn-sound { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}

/* ───────── Real molecules ───────── */
.real-top { position: fixed; z-index: 12; top: 68px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.real-title { display: flex; align-items: center; gap: 6px; pointer-events: auto; }
.screen.active .real-top { animation: dropIn 0.8s var(--ease) 0.1s both; }
.real-name { text-align: center; min-width: 170px; }
.formula { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.formula sub { font-size: 0.55em; vertical-align: baseline; position: relative; top: 0.22em; }
.formula sup { font-size: 0.5em; vertical-align: baseline; position: relative; top: -0.5em; }
.real-name .sub { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.real-top .seg { pointer-events: auto; }
.picker .search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 13px; background: var(--chip); color: var(--muted); transition: box-shadow 0.2s, background 0.2s; }
.picker .search:focus-within { background: var(--glass-strong); box-shadow: 0 0 0 2px var(--accent); }
.picker .search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); font-weight: 600; font-size: 13.5px; }
.picker .search input::-webkit-search-cancel-button { display: none; }
.filter { flex-wrap: nowrap; margin: 10px -4px 10px 0; padding-bottom: 2px; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.filter::-webkit-scrollbar { display: none; }
.filter .chip { flex: none; }
.filter .chip { padding: 4px 10px; font-size: 12px; }
.mol-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 270px; overflow-y: auto; padding: 2px; margin: -2px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.mol-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 0; padding: 8px 4px 7px; border-radius: 14px; background: var(--chip); transition: background 0.2s, transform 0.3s var(--spring), box-shadow 0.3s, color 0.2s; }
.mol-btn b { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.mol-btn b sub { font-size: 0.65em; } .mol-btn b sup { font-size: 0.65em; }
.mol-btn span { font-size: 10px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mol-btn:hover { background: var(--chip-hover); transform: translateY(-2px); }
.mol-btn.active { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(118, 75, 162, 0.35); }
.mol-btn.active span { color: rgba(255, 255, 255, 0.8); }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 16px 0; font-weight: 600; }
.arows { display: flex; flex-direction: column; gap: 6px; }
.arow { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; background: var(--chip); font-variant-numeric: tabular-nums; }
.al { font-weight: 700; font-size: 13px; }
.av { display: flex; gap: 6px; align-items: baseline; }
.av b { font-size: 14px; } .av i { font-style: normal; font-size: 11.5px; color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(150, 140, 130, 0.5); }
.ad { min-width: 46px; text-align: center; font-size: 11.5px; font-weight: 750; padding: 2px 7px; border-radius: 99px; background: var(--chip-hover); color: var(--muted); }
.ad.neg { background: var(--bad-soft); color: var(--bad); }
.ad.pos { background: var(--good-soft); color: var(--good); }
.explain.small { font-size: 12px; margin-top: 10px; }
.lewis-box { display: grid; place-items: center; }
.lewis { width: 100%; max-width: 250px; height: auto; color: var(--text); overflow: visible; }
.lewis text { font-family: var(--font); }

@media (max-width: 900px) {
  .real-top { top: 62px; }
  .formula { font-size: 26px; }
  .real-name { min-width: 120px; }
  .mol-grid { max-height: 190px; }
}

/* ───────── Learn ───────── */
.page { max-width: 1120px; margin: 0 auto; padding: 96px 22px 60px; }
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.hero { text-align: center; padding: 34px 0 26px; }
.hero h1 { font-size: clamp(34px, 6.2vw, 68px); line-height: 1.05; font-weight: 800; letter-spacing: -0.04em; margin: 12px auto 16px; max-width: 14ch; color: var(--text); }
:lang(zh) .hero h1 { max-width: 16ch; letter-spacing: -0.02em; }
.hero-sub { max-width: 640px; margin: 0 auto 26px; font-size: 16.5px; line-height: 1.65; color: var(--text2); }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hero-orbit { display: flex; justify-content: center; align-items: flex-end; gap: 4px; margin-top: 34px; flex-wrap: nowrap; }
.hero-mini { width: 150px; height: 150px; flex: none; filter: drop-shadow(0 18px 20px rgba(60, 40, 20, 0.12)); animation: floaty 7s ease-in-out infinite; }
.hero-mini.h0 { width: 108px; height: 108px; animation-delay: -1s; }
.hero-mini.h1 { width: 128px; height: 128px; animation-delay: -3s; }
.hero-mini.h2 { width: 158px; height: 158px; animation-delay: -5s; }
.hero-mini.h3 { width: 134px; height: 134px; animation-delay: -2s; }
.hero-mini.h4 { width: 112px; height: 112px; animation-delay: -4s; }
@keyframes floaty { 50% { transform: translateY(-14px); } }

.sec-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 56px 0 20px; flex-wrap: wrap; }
.sec-h h2 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.sec-h p { margin-top: 6px; color: var(--text2); max-width: 560px; }
.prog { min-width: 230px; padding: 12px 16px; border-radius: 18px; }
.prog-top { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 650; color: var(--text2); margin-bottom: 8px; }
.prog-top b { color: var(--accent); font-variant-numeric: tabular-nums; }
.bar { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad-brand); transition: width 1s var(--ease); }

.chart-grid { display: flex; flex-direction: column; gap: 14px; }
.chart-head, .chart-row { display: grid; grid-template-columns: 168px repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.chart-col-h { text-align: center; display: flex; flex-direction: column; gap: 0; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.chart-col-h b { font-size: 22px; color: var(--text); letter-spacing: -0.02em; line-height: 1.1; }
.row-h { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 0 6px 0 2px; }
.row-h b { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.row-h .eg { font-weight: 700; color: var(--accent); font-size: 14px; }
.row-h .hy { font-size: 12px; color: var(--muted); font-weight: 650; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; padding: 12px 8px 14px; border-radius: 22px; background: var(--glass); border: 1px solid var(--edge); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge); transition: transform 0.45s var(--spring), box-shadow 0.4s, opacity 0.8s var(--ease); text-align: center; }
.tile:hover { transform: translateY(-6px) scale(1.02); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-edge); }
.tile:active { transform: scale(0.98); }
.tile.ghost { background: none; border: 1.5px dashed var(--line); box-shadow: none; pointer-events: none; }
.tile canvas.mini { width: 124px; height: 124px; max-width: 100%; }
.t-axe { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; margin-top: 2px; }
.t-name { font-size: 12.5px; font-weight: 650; color: var(--text2); margin-top: 1px; }
.t-badge { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--good); transform: scale(0); transition: transform 0.5s var(--spring); }
.t-badge .ic { width: 13px; height: 13px; stroke-width: 3; }
.tile.found .t-badge { transform: scale(1); }
.tile:not(.found)::after { content: ""; position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }

.ideas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.idea { position: relative; padding: 20px 20px 22px; }
.idea-n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; background: var(--grad); color: #fff; font-weight: 800; margin-bottom: 14px; box-shadow: 0 6px 16px rgba(118, 75, 162, 0.3); }
.idea h4 { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.idea p { color: var(--text2); font-size: 13.5px; line-height: 1.6; }
.gloss { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 28px; margin: 0; }
.gl { padding: 14px 0; border-top: 1px solid var(--line); }
.gl dt { font-weight: 800; margin-bottom: 3px; }
.gl dd { margin: 0; color: var(--text2); font-size: 13.5px; line-height: 1.55; }
.page-foot { margin-top: 56px; text-align: center; font-size: 12px; color: var(--muted); }

.modal.wide { width: min(860px, 100%); padding: 22px; }

@media (max-width: 900px) {
  .page { padding: 78px 14px 40px; }
  .hero-orbit { transform: scale(0.62); transform-origin: top center; height: 100px; margin-top: 22px; }
  .chart-head { display: none; }
  .chart-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .row-h { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .tile.ghost { display: none; }
  .ideas { grid-template-columns: 1fr 1fr; }
  .gloss { grid-template-columns: 1fr; }
  .sec-h h2 { font-size: 24px; }
}
@media (max-width: 520px) { .ideas { grid-template-columns: 1fr; } }

/* ───────── Quiz ───────── */
.quiz-menu { position: absolute; inset: 70px 0 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px; padding: 20px; pointer-events: none; overflow-y: auto; }
.quiz-menu[hidden], .q-result[hidden], .panels[hidden] { display: none; }
.quiz-head { text-align: center; max-width: 620px; }
.quiz-head h1 { font-size: clamp(32px, 5vw, 54px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; margin: 8px 0 10px; color: var(--text); }
.quiz-head p { color: var(--text2); font-size: 16px; }
.screen.active .quiz-head { animation: riseIn 0.8s var(--ease) both; }
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: min(900px, 100%); pointer-events: auto; }
.mode-card { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 24px 22px 20px; border-radius: 28px; transition: transform 0.45s var(--spring), box-shadow 0.4s; position: relative; overflow: hidden; }
.screen.active .mode-card { animation: riseIn 0.8s var(--ease) both; animation-delay: calc(0.12s + var(--i) * 0.09s); }
.mode-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-edge); }
.mode-card:active { transform: scale(0.98); }
.mode-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px; background: var(--grad); color: #fff; margin-bottom: 18px; box-shadow: 0 10px 24px rgba(118, 75, 162, 0.35); }
.mode-ic .ic { width: 26px; height: 26px; }
.mode-card h3 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.mode-card p { color: var(--text2); font-size: 13.5px; line-height: 1.55; flex: 1; }
.mode-foot { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 20px; font-size: 13px; font-weight: 650; }
.mode-foot .best { color: var(--muted); } .mode-foot .best b { color: var(--text); font-variant-numeric: tabular-nums; }
.mode-foot .go { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); transition: gap 0.3s var(--spring); }
.mode-card:hover .go { gap: 12px; }

.q-card { position: relative; }
.q-top { display: flex; align-items: center; justify-content: space-between; }
.q-stats { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.q-score { font-variant-numeric: tabular-nums; font-size: 16px; }
.q-streak { display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px 2px 6px; border-radius: 99px; background: var(--chip); color: var(--muted); font-size: 13px; transition: all 0.4s var(--spring); }
.q-streak .ic { width: 15px; height: 15px; }
.q-streak.hot { background: rgba(255, 140, 50, 0.16); color: #ee7a1f; transform: scale(1.06); }
.q-dots { display: flex; gap: 5px; margin: 10px 0 14px; }
.q-dots i { flex: 1; height: 5px; border-radius: 9px; background: var(--line); transition: background 0.4s; }
.q-dots i.ok { background: var(--good); } .q-dots i.no { background: var(--bad); } .q-dots i.cur { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.q-prompt { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.3; margin-bottom: 12px; }
.q-opts { display: flex; flex-direction: column; gap: 8px; }
.q-opt { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 16px; background: var(--chip); font-weight: 700; font-size: 14.5px; text-align: left; transition: transform 0.3s var(--spring), background 0.2s, box-shadow 0.3s; }
.q-opt:hover:not(:disabled) { background: var(--chip-hover); transform: translateX(4px); }
.q-opt:active:not(:disabled) { transform: scale(0.98); }
.q-opt:disabled { opacity: 1; cursor: default; }
.q-opt span { flex: 1; }
.q-mark { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; opacity: 0; transform: scale(0.4); transition: all 0.4s var(--spring); }
.q-opt.right { background: var(--good-soft); box-shadow: inset 0 0 0 2px var(--good); }
.q-opt.right .q-mark { opacity: 1; transform: none; background: var(--good); }
.q-opt.right .q-mark::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 800; }
.q-opt.wrong { background: var(--bad-soft); box-shadow: inset 0 0 0 2px var(--bad); animation: shake 0.45s; }
.q-opt.wrong .q-mark { opacity: 1; transform: none; background: var(--bad); }
.q-opt.wrong .q-mark::after { content: "✕"; color: #fff; font-size: 12px; font-weight: 800; }
.q-opt:disabled:not(.right):not(.wrong) { opacity: 0.5; }
.q-fb { max-height: 0; overflow: hidden; opacity: 0; font-size: 13px; line-height: 1.6; color: var(--text2); transition: max-height 0.6s var(--ease), opacity 0.4s, margin 0.4s; }
.q-fb.show { max-height: 320px; opacity: 1; margin-top: 14px; }
.q-fb .fb-h { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 4px; }
.q-fb .fb-h .ic { width: 18px; height: 18px; padding: 3px; border-radius: 50%; color: #fff; stroke-width: 3; box-sizing: content-box; }
.q-fb.good .fb-h { color: var(--good); } .q-fb.good .fb-h .ic { background: var(--good); }
.q-fb.bad .fb-h { color: var(--bad); } .q-fb.bad .fb-h .ic { background: var(--bad); }
.q-fb.bad { color: var(--text2); }
.q-fb.hint { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: rgba(245, 180, 40, 0.14); color: var(--text); }
.q-fb.hint .ic { color: #e0a000; margin-top: 2px; }
.q-fb .pts { margin-left: auto; font-size: 13px; padding: 1px 9px; border-radius: 99px; background: var(--good-soft); color: var(--good); font-weight: 800; }
.q-fb .fb-ans { margin-bottom: 4px; }
.q-fb p { margin: 0; }
.q-actions { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }
.q-actions:empty { display: none; }
.q-actions .btn { flex: none; }
.q-actions .btn.wide { flex: 1; }
.q-actions.shake { animation: shake 0.45s; }
.q-quit { display: block; margin: 12px auto -2px; font-size: 12px; color: var(--muted); font-weight: 650; transition: color 0.2s; }
.q-quit:hover { color: var(--text); }
.q-target { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); margin-bottom: 8px; }
.q-target b { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--accent); }
.q-target span { font-size: 12.5px; color: var(--text2); font-weight: 600; }
.q-have { min-height: 22px; font-size: 13px; color: var(--text2); }
.q-have b { color: var(--text); font-weight: 800; }
.q-formula { text-align: center; font-size: 42px; }
.q-sub { text-align: center; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.q-val { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 8px; }
.q-val b { color: var(--text); }

.q-result { position: absolute; inset: 70px 0 0 0; display: grid; place-items: center; padding: 20px; pointer-events: none; overflow-y: auto; }
.result { pointer-events: auto; width: min(520px, 100%); text-align: center; padding: 30px 28px 26px; border-radius: 32px; animation: pop 0.7s var(--spring) both; }
.result h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 18px; }
.stars { display: flex; justify-content: center; gap: 8px; margin-bottom: 10px; }
.star { width: 54px; height: 54px; color: var(--line); transform: scale(0.7); }
.star .ic { width: 100%; height: 100%; fill: currentColor; stroke-width: 1.2; }
.star.on { color: #ffc43d; animation: starIn 0.7s var(--spring) both; animation-delay: var(--d); filter: drop-shadow(0 6px 14px rgba(255, 180, 40, 0.5)); }
@keyframes starIn { 0% { transform: scale(0) rotate(-90deg); } 100% { transform: scale(1) rotate(0); } }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: left; }
.res-stats b { font-size: 22px; }
.review { margin-top: 16px; text-align: left; }
.rv-row { display: flex; justify-content: space-between; padding: 8px 12px; margin-top: 6px; border-radius: 12px; background: var(--chip); font-size: 13.5px; }
.rv-row span { color: var(--text2); font-weight: 650; }
.res-cta { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }

@media (max-width: 900px) {
  .mode-grid { grid-template-columns: 1fr; gap: 10px; }
  .mode-card { padding: 16px 18px; border-radius: 22px; }
  .mode-ic { width: 40px; height: 40px; margin-bottom: 10px; border-radius: 14px; }
  .mode-card p { display: none; }
  .mode-foot { margin-top: 10px; }
  .quiz-menu { gap: 18px; justify-content: flex-start; padding-top: 18px; }
  .quiz-head h1 { font-size: 30px; }
  .quiz-head p { font-size: 14px; }
  .q-prompt { font-size: 17px; }
  .q-opts { display: grid; grid-template-columns: 1fr 1fr; }
  .q-opt { padding: 10px 11px; font-size: 13px; }
  .q-opt kbd { display: none; }
}

/* ───────── Accessibility utilities ───────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: -64px; z-index: 400; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 700; text-decoration: none; transition: top 0.2s; }
.skip:focus { top: 12px; }
#app:focus { outline: none; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }

/* ───────── Nav tabs (icons + labels) ───────── */
.tab-ic { display: none; } .tab-ic .ic { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .tabs .tab-t { display: none; } .tabs .tab-ic { display: inline-flex; }
  .tabs button { padding: 8px 13px !important; }
}

/* ───────── Practice hub ───────── */
.hub, .p-result { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; pointer-events: auto; padding: 84px 20px 40px; }
.hub[hidden], .p-result[hidden] { display: none; }
.hub-inner { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.hub-head { text-align: center; max-width: 640px; margin: 12px auto 6px; }
.hub-head h1 { font-size: clamp(32px, 5vw, 54px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; margin: 8px 0 10px; color: var(--text); }
.hub-head p { color: var(--text2); font-size: 16px; }
.hub-count { display: inline-block; margin-top: 12px; padding: 3px 12px; border-radius: 99px; background: var(--chip); font-size: 12px; font-weight: 700; color: var(--slate); }
.screen.active .hub-inner > * { animation: riseIn 0.8s var(--ease) both; }
.screen.active .hub-inner > *:nth-child(2) { animation-delay: 0.08s; } .screen.active .hub-inner > *:nth-child(3) { animation-delay: 0.16s; }
.builder { padding: 20px 22px 22px; border-radius: 28px; }
.builder-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.builder-top .card-h { margin: 0; gap: 10px; }
.link-btn { color: var(--accent); font-weight: 700; font-size: 13px; padding: 4px 8px; border-radius: 8px; }
.link-btn:hover { background: var(--accent-soft); }
.topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.topic-tile { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--chip); text-align: left; box-shadow: inset 0 0 0 2px transparent; transition: transform 0.35s var(--spring), background 0.25s, box-shadow 0.25s, opacity 0.25s; opacity: 0.62; }
.topic-tile:hover { transform: translateY(-2px); opacity: 1; }
.topic-tile.on { opacity: 1; background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.tt-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--glass-strong); color: var(--accent); flex: none; }
.tt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tt-body b { font-size: 14.5px; font-weight: 800; letter-spacing: -0.01em; }
.tt-body span { font-size: 12px; color: var(--text2); line-height: 1.35; }
.tt-body i { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; margin-top: 2px; }
.tt-check { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; transform: scale(0); transition: transform 0.35s var(--spring); }
.tt-check .ic { width: 13px; height: 13px; stroke-width: 3; }
.topic-tile.on .tt-check { transform: scale(1); }
.ring.sm { width: 40px; height: 40px; } .ring.sm b { font-size: 12px; }
.ring.xl { width: 112px; height: 112px; } .ring.xl circle { stroke-width: 3.4; } .ring.xl b { font-size: 30px; letter-spacing: -0.03em; }
.builder-bar { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.ctl { display: flex; flex-direction: column; gap: 6px; }
.builder-bar .btn.primary { margin-left: auto; }
.mode-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mode-grid3 .mode-card { padding: 20px 20px 16px; }
.mode-grid3 .mode-card:nth-child(n) .mode-ic { margin-bottom: 14px; }

/* question card additions */
.panels.center .col.left { display: none; }
.panels.center .col.right { left: 12px; right: 12px; width: min(600px, calc(100% - 24px)); margin: 0 auto; }
.q-meta { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.topic-chip, .lvl-chip { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--chip); color: var(--text2); }
.lvl-chip.l1 { color: var(--good); background: var(--good-soft); } .lvl-chip.l2 { color: #c27c00; background: rgba(245, 180, 40, 0.16); } .lvl-chip.l3 { color: var(--bad); background: var(--bad-soft); }
.q-opt.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.q-timer { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 9px; border-radius: 99px; background: var(--chip); font-weight: 800; font-variant-numeric: tabular-nums; }
.q-timer .ic { width: 15px; height: 15px; }
.q-timer.warn { background: var(--bad-soft); color: var(--bad); animation: pulse 1s ease-in-out infinite; }
.q-nav { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 14px; }
.qn { width: 28px; height: 28px; border-radius: 9px; background: var(--chip); font-size: 12px; font-weight: 750; color: var(--text2); position: relative; transition: all 0.2s var(--spring); font-variant-numeric: tabular-nums; }
.qn:hover { transform: translateY(-2px); }
.qn.ans { background: var(--accent-soft); color: var(--accent); }
.qn.cur { box-shadow: 0 0 0 2px var(--accent); color: var(--text); background: var(--glass-strong); }
.qn.flag::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); border: 2px solid var(--bg); }
.q-note { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 10px; }
.btn.sm { height: 34px; padding: 0 13px; font-size: 13px; gap: 6px; }
.btn.sm .ic { width: 16px; height: 16px; }
.btn.danger-fill { background: var(--bad); color: #fff; }
.q-actions .grow { flex: 1; }
.q-actions { align-items: center; }

/* results report */
.p-result { display: flex; justify-content: center; align-items: flex-start; }
.report { width: min(780px, 100%); padding: 28px 28px 24px; border-radius: 30px; animation: pop 0.7s var(--spring) both; height: max-content; }
.rep-head { display: flex; align-items: center; gap: 22px; margin-bottom: 18px; }
.score-ring { position: relative; width: 104px; height: 104px; flex: none; display: grid; place-items: center; }
.score-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 3.6; }
.score-ring .ring-fg { stroke: var(--accent); }
.score-ring b { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.rep-title h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 4px; }
.rep-title p { color: var(--text2); }
.best-tag { color: #d98a00; }
.rep-sec { margin-top: 20px; }
.rep-sec > .k { display: block; margin-bottom: 8px; }
.tb { display: flex; flex-direction: column; gap: 8px; }
.tb-row { display: grid; grid-template-columns: 160px 1fr 44px; align-items: center; gap: 12px; font-size: 13px; font-weight: 650; }
.tb-row b { text-align: right; font-variant-numeric: tabular-nums; }
.bar i.g { background: var(--good); } .bar i.y { background: #f5b428; } .bar i.r { background: var(--bad); }
.bar.sm { display: inline-block; width: 70px; height: 6px; vertical-align: middle; margin-right: 6px; }
.code-row { display: flex; gap: 10px; align-items: stretch; }
code, .code-row code { display: block; flex: 1; word-break: break-all; padding: 10px 12px; border-radius: 12px; background: var(--chip); font: 12px/1.5 var(--mono); user-select: all; }
.rv-list { display: flex; flex-direction: column; gap: 6px; }
.rvw { border-radius: 10px; background: var(--chip); overflow: hidden; }
.rvw summary { display: grid; grid-template-columns: 26px 1fr 22px; gap: 10px; align-items: center; padding: 10px 14px; cursor: pointer; list-style: none; font-weight: 650; font-size: 13.5px; }
.rvw summary::-webkit-details-marker { display: none; }
.rv-n { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--glass-strong); }
.rv-s .ic { width: 18px; height: 18px; stroke-width: 3; }
.rvw.ok .rv-s { color: var(--good); } .rvw.no .rv-s { color: var(--bad); } .rvw.no .rv-n { background: var(--bad-soft); color: var(--bad); } .rvw.ok .rv-n { background: var(--good-soft); color: var(--good); }
.rv-body { padding: 0 14px 14px 50px; font-size: 13px; color: var(--text2); line-height: 1.6; display: flex; flex-direction: column; gap: 4px; }
.rv-body .k { margin-right: 6px; }
.rv-body p { margin: 4px 0 0; }
.res-cta { flex-wrap: wrap; }
.res-stats { grid-template-columns: repeat(3, 1fr); }

/* modals: confirm / tool / settings / welcome */
.modal.small { width: min(440px, 100%); }
.modal.wide2 { width: min(700px, 100%); }
.confirm h3 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 6px; padding-right: 36px; }
.confirm p { color: var(--text2); margin-bottom: 8px; }
.confirm-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.warn-txt { color: var(--warn) !important; font-weight: 700; font-size: 13px; }
.muted { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field-row { display: flex; gap: 18px; flex-wrap: wrap; }
.field input, .field textarea { width: 100%; padding: 11px 13px; border-radius: 13px; border: 0; background: var(--chip); color: var(--text); font: inherit; font-weight: 600; outline: none; transition: box-shadow 0.2s, background 0.2s; resize: vertical; }
.field textarea { font: 12px/1.5 var(--mono); }
.field input:focus, .field textarea:focus { background: var(--glass-strong); box-shadow: 0 0 0 2px var(--accent); }
.field i { font-style: normal; color: var(--muted); font-weight: 500; }
.tool-modal h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0 6px; padding-right: 36px; }
.chips.pick .chip.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.code-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.rp-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 10px; }
.rp-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rp-table { max-height: 280px; overflow: auto; border-radius: 14px; background: var(--chip); }
.rp-table table, .tool-modal table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rp-table th, .rp-table td { padding: 8px 12px; text-align: left; white-space: nowrap; }
.rp-table th { position: sticky; top: 0; background: var(--glass-strong); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.rp-table tr + tr td { border-top: 1px solid var(--line); }
.settings-modal { width: min(520px, 100%); }
.settings h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0 14px; }
.seg.full { display: flex; width: 100%; } .seg.full button { flex: 1; }
.s-panel { margin-top: 8px; } .s-panel[hidden] { display: none; }
.s-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; font-weight: 650; }
.s-row + .s-row { border-top: 1px solid var(--line); }
.about-p { color: var(--text2); line-height: 1.7; margin: 8px 0; font-size: 13.5px; }
.welcome h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; margin: 6px 0 8px; padding-right: 30px; line-height: 1.15; }
.welcome > p { color: var(--text2); }
.wl { list-style: none; padding: 0; margin: 18px 0 22px; display: flex; flex-direction: column; gap: 12px; }
.wl li { display: flex; gap: 14px; align-items: flex-start; font-size: 13.5px; color: var(--text2); line-height: 1.5; }
.wl li > span { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 13px; background: var(--accent-soft); color: var(--accent); }
.wl b { display: block; color: var(--text); font-size: 15px; }
.toast-btn { margin-left: 8px; padding: 3px 12px; border-radius: 99px; background: var(--accent); color: #fff; font-weight: 700; font-size: 12.5px; pointer-events: auto; }
.toasts { pointer-events: none; } .toast { pointer-events: auto; }
.webgl-note { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 32px)); text-align: center; pointer-events: auto; z-index: 3; }
.webgl-note h3 { font-size: 18px; margin-bottom: 6px; } .webgl-note p { color: var(--text2); font-size: 13.5px; }
.fact-card .fact { font-size: 13.5px; line-height: 1.65; color: var(--text2); margin: 0; }

/* ───────── Progress ───────── */
.pg-progress .hub-head { margin-top: 20px; }
.overview { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; margin-top: 20px; }
.ov-main { display: flex; align-items: center; gap: 24px; padding: 26px 28px; border-radius: 28px; }
.ov-text h3 { font-size: 20px; letter-spacing: -0.02em; margin: 4px 0 14px; font-weight: 700; }
.ov-text h3 b { color: var(--accent); }
.ov-text p { color: var(--text2); margin: 6px 0 14px; }
.ov-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-content: stretch; }
.ov-stats .stat { padding: 14px 16px; border-radius: 18px; display: flex; flex-direction: column; justify-content: center; }
.ov-stats .stat b { font-size: 22px; margin-top: 4px; }
.ov-stats small { font-size: 12px; color: var(--muted); font-weight: 650; margin-left: 2px; }
.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; margin-top: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.tp-list { display: flex; flex-direction: column; gap: 12px; }
.tp-row { display: grid; grid-template-columns: 34px 1fr 30px auto; gap: 12px; align-items: center; }
.tp-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--chip); color: var(--accent); }
.tp-ic .ic { width: 18px; height: 18px; }
.tp-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.tp-top span { color: var(--muted); font-weight: 600; font-size: 12px; }
.tp-m { font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; }
.heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 5px; background: var(--line); }
.heat i.h1 { background: rgba(106, 92, 255, 0.25); } .heat i.h2 { background: rgba(106, 92, 255, 0.5); } .heat i.h3 { background: rgba(106, 92, 255, 0.75); } .heat i.h4 { background: var(--accent); }
.heat i.hf { opacity: 0; }
.ss-row { display: grid; grid-template-columns: 54px 1fr auto 46px; gap: 10px; padding: 8px 0; font-size: 13px; align-items: center; }
.ss-row + .ss-row { border-top: 1px solid var(--line); }
.ss-d, .ss-t { color: var(--muted); font-size: 12px; font-weight: 600; } .ss-m { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.badge { display: flex; flex-direction: column; gap: 3px; padding: 16px; border-radius: 20px; background: var(--chip); opacity: 0.55; filter: grayscale(1); transition: all 0.4s var(--spring); }
.badge.on { opacity: 1; filter: none; background: var(--glass); border: 1px solid var(--edge); box-shadow: var(--shadow); }
.badge.on:hover { transform: translateY(-4px); }
.bd-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: var(--grad); color: #fff; margin-bottom: 8px; }
.badge b { font-size: 14.5px; } .badge span:last-child { font-size: 12px; color: var(--text2); line-height: 1.4; }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tool { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 20px; border-radius: 24px; text-align: left; transition: transform 0.4s var(--spring), box-shadow 0.4s; }
.tool:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-edge); }
.tool b { font-size: 16px; letter-spacing: -0.01em; }
.tool .mode-ic { margin: 0; }
.data-sec { margin-top: 34px; padding: 18px 20px; }
.data-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-progress section:last-child { margin-bottom: 20px; }

/* ───────── Print (worksheets & reports) ───────── */
#print-root { display: none; }
@media print {
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; color: #000; font: 11.5pt/1.5 Georgia, "Songti SC", serif; padding: 0; }
  #print-root h1 { font: 700 20pt/1.2 system-ui, sans-serif; margin: 0 0 4pt; }
  #print-root .meta { color: #444; margin: 0 0 12pt; }
  #print-root .big { font: 700 16pt system-ui, sans-serif; margin: 0 0 12pt; }
  #print-root table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  #print-root th, #print-root td { border-bottom: 0.5pt solid #bbb; padding: 4pt 6pt; text-align: left; vertical-align: top; }
  #print-root tr.no td { background: #f6e8ea; } 
  .ws-q { display: flex; gap: 10pt; margin-bottom: 14pt; break-inside: avoid; }
  .ws-n { font: 700 12pt system-ui; width: 20pt; flex: none; }
  .ws-b p { margin: 0 0 4pt; } .ws-img { float: right; width: 80pt; height: 80pt; }
  .ws-lewis svg { width: 130pt; height: auto; color: #000; }
  .ws-o { list-style: none; padding: 0; margin: 4pt 0 0; columns: 2; } .ws-o li { margin-bottom: 2pt; } .ws-o li span { display: inline-block; width: 16pt; font-weight: 700; }
  .ws-line { margin-top: 10pt; }
  .page-break { break-after: page; }
  .ws-key { padding-left: 16pt; } .ws-key li { margin-bottom: 6pt; } .ws-why { font-size: 9.5pt; color: #444; }
}

/* ───────── Responsive additions ───────── */
@media (max-width: 900px) {
  .hub, .p-result { padding: 70px 12px 32px; }
  .topic-grid { grid-template-columns: 1fr; }
  .mode-grid3 { grid-template-columns: 1fr; }
  .mode-grid3 .mode-card p { display: block; }
  .builder { padding: 16px; border-radius: 22px; }
  .builder-bar { gap: 12px; } .builder-bar .btn.primary { margin-left: 0; width: 100%; }
  .overview, .two-col, .tools { grid-template-columns: 1fr; }
  .ov-stats { grid-template-columns: repeat(2, 1fr); }
  .ov-main { flex-direction: column; text-align: center; }
  .panels.center { max-height: calc(100vh - 70px); }
  .panels.center .col.right { left: 0; right: 0; width: auto; }
  .rep-head { flex-direction: column; text-align: center; }
  .tb-row { grid-template-columns: 110px 1fr 40px; }
  .rv-body { padding-left: 14px; }
}


/* ═════════════════════════════════════════════════════════════════
   Refinement layer — flat colour, quiet motion.
   Selected = solid ink. Hover = tint only. No glows, no bounce, no lift.
   ═════════════════════════════════════════════════════════════════ */
.glass { box-shadow: var(--shadow); }
.nav.glass, .dock.glass { box-shadow: 0 1px 3px rgba(60, 40, 20, 0.07); }
.card { border-radius: 16px; }

/* typography: calmer weights, no gradient text */
.axe, .t-axe { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--text); font-weight: 700; letter-spacing: -0.02em; }
.axe sub, .t-axe sub { color: var(--accent); }
.wordmark sup { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--accent); }
.hero h1, .hub-head h1, .quiz-head h1 { font-weight: 700; letter-spacing: -0.03em; }
.formula, .sec-h h2, .detail h2, .report h2 { font-weight: 700; }
.logo { filter: none; }
.brand:hover .logo { transform: none; }

/* buttons */
.btn { transition: background-color 0.15s, color 0.15s, opacity 0.15s, box-shadow 0.15s; }
.btn:active { transform: none; opacity: 0.85; }
.btn.primary { background: var(--ink); color: var(--ink-fg); box-shadow: none; }
.btn.primary:hover { background: var(--ink); opacity: 0.86; box-shadow: none; transform: none; }
.btn.primary:active { opacity: 0.75; transform: none; }
.btn.ghost { box-shadow: inset 0 0 0 1px var(--edge); }
.btn.ghost:hover { background: var(--chip); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger-fill { background: var(--bad); color: #fff; }
.icon-btn { transition: background-color 0.15s, color 0.15s; }
.icon-btn:active { transform: none; background: var(--chip-hover); }
.btn.primary .ic, .btn.primary svg { color: inherit; }

/* selected states: solid ink */
.chip { border-radius: 8px; transition: background-color 0.15s, color 0.15s; }
.chip:hover { transform: none; background: var(--chip-hover); color: var(--text); }
.chip.active { background: var(--ink); color: var(--ink-fg); box-shadow: none; }
.chips.pick .chip.active { background: var(--ink); color: var(--ink-fg); box-shadow: none; }
.mol-btn { border-radius: 10px; transition: background-color 0.15s, color 0.15s; }
.mol-btn:hover { transform: none; background: var(--chip-hover); }
.mol-btn.active { background: var(--ink); color: var(--ink-fg); box-shadow: none; }
.mol-btn.active span { color: var(--ink-fg); opacity: 0.72; }
.dock-btn { transition: background-color 0.15s, color 0.15s; }
.dock-btn:hover { transform: none; }
.dock-btn:active { transform: none; background: var(--chip-hover); }
.dock-btn.on { background: var(--ink); color: var(--ink-fg); }
.seg-thumb { transition: transform 0.22s var(--ease), width 0.22s var(--ease); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
:root[data-theme="dark"] .seg-thumb { box-shadow: none; background: rgba(255, 255, 255, 0.14); }
.switch i { transition: background-color 0.18s; }
.switch i::after { transition: transform 0.18s var(--ease); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.switch input:checked + i { background: var(--accent); }

/* cards & tiles: no lift, no coloured shadow */
.build-btn { border-radius: 12px; transition: background-color 0.15s; }
.build-btn:hover { transform: none; box-shadow: none; background: var(--chip-hover); }
.build-btn:active, .build-btn.pressed { animation: none; transform: scale(0.98); }
.tile { border-radius: 16px; transition: background-color 0.15s, box-shadow 0.15s; }
.tile:hover { transform: none; box-shadow: 0 0 0 1.5px var(--ink); }
.tile:active { transform: none; }
.mode-card, .tool, .collection { transition: box-shadow 0.15s, background-color 0.15s; }
.mode-card:hover, .tool:hover, .collection:hover { transform: none; box-shadow: 0 0 0 1.5px var(--ink); }
.mode-card:active, .tool:active { transform: none; opacity: 0.92; }
.mode-card { border-radius: 16px; }
.mode-card:hover .go { gap: 6px; }
.mode-ic, .bd-ic, .idea-n { background: var(--accent-soft); color: var(--accent); box-shadow: none; border-radius: 10px; }
.mode-ic { width: 42px; height: 42px; }
.mode-ic .ic { width: 22px; height: 22px; }
.idea-n { border-radius: 8px; }
.badge.on:hover { transform: none; }
.topic-tile { border-radius: 14px; transition: background-color 0.15s, box-shadow 0.15s, opacity 0.15s; }
.topic-tile:hover { transform: none; }
.topic-tile.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.tt-ic { border-radius: 10px; }
.tt-check { transition: transform 0.15s var(--ease); }
.q-opt { border-radius: 12px; transition: background-color 0.15s, box-shadow 0.15s; }
.q-opt:hover:not(:disabled) { transform: none; background: var(--chip-hover); }
.q-opt:active:not(:disabled) { transform: none; }
.q-opt.wrong { animation: none; }
.q-opt.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.q-mark { transition: opacity 0.15s; transform: none; }
.qn { transition: background-color 0.15s; border-radius: 8px; } .qn:hover { transform: none; background: var(--chip-hover); }
.stat, .arow, .measure, .rvw, .tp-ic { border-radius: 10px; }
.q-target { border-radius: 12px; } .modal { border-radius: 20px; } .report { border-radius: 20px; } .builder { border-radius: 16px; } .ov-main { border-radius: 18px; }
.badge, .tool { border-radius: 14px; }
.lesson { border-radius: 16px; } .dock { border-radius: 16px; } .dock-btn { border-radius: 11px; }
.slot.filled { animation: none; }
.slot.filled:hover { transform: none; }
.q-streak.hot { transform: none; background: var(--chip); color: var(--text); }
.meter.shake, .q-actions.shake { animation: none; }
.count.full { color: var(--warn); }

/* score / progress visuals: a single accent */
.bar i { background: var(--accent); }
.ring-fg { stroke: var(--accent); transition: stroke-dasharray 0.4s var(--ease); }
.dots i.on { background: var(--ink); }
.q-dots i.cur { background: var(--ink); animation: none; }
.q-dots i.ok { background: var(--good); } .q-dots i.no { background: var(--bad); }
.bar i.g { background: var(--good); } .bar i.y { background: #c9962b; } .bar i.r { background: var(--bad); }
.heat i.h1 { background: color-mix(in srgb, var(--accent) 25%, transparent); } .heat i.h2 { background: color-mix(in srgb, var(--accent) 50%, transparent); } .heat i.h3 { background: color-mix(in srgb, var(--accent) 75%, transparent); } .heat i.h4 { background: var(--accent); }
.col-dots i.on { background: var(--accent); } .col-dots i.cur { transform: none; box-shadow: 0 0 0 2px var(--ink); }
.t-badge { background: var(--good); transition: transform 0.15s var(--ease); }
.tile.found .t-badge { transform: scale(1); }
.bd-ic { background: var(--accent); color: #fff; }
.badge:not(.on) .bd-ic { background: var(--chip-hover); color: var(--muted); }
.pill.polar { background: rgba(192, 100, 60, 0.12); color: #a9532a; } :root[data-theme="dark"] .pill.polar { color: #e69a74; }
.score-ring .ring-fg { stroke: var(--accent); }
.best-tag { color: var(--accent); }

/* motion: short, ease-out, small distances */
@keyframes slideL { from { opacity: 0; transform: translateX(-10px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(10px); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes dockIn { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes pop { from { opacity: 0.35; } }
@keyframes revealIn { from { opacity: 0; transform: translateY(4px); } }
@keyframes starIn { from { opacity: 0; } }
.screen.active .col.left > *, .screen.active .col.right > * { animation-duration: 0.3s; animation-timing-function: var(--ease); }
.screen.active .col > *:nth-child(2) { animation-delay: 0.04s; } .screen.active .col > *:nth-child(3) { animation-delay: 0.08s; } .screen.active .col > *:nth-child(4) { animation-delay: 0.12s; }
.nav { animation-duration: 0.35s; } .dock { animation-duration: 0.35s; animation-delay: 0.05s; }
.screen.active .hub-inner > *, .screen.active .quiz-head, .screen.active .mode-card { animation-duration: 0.35s; animation-delay: 0s; }
.screen.active .hub-inner > *:nth-child(2) { animation-delay: 0.04s; } .screen.active .hub-inner > *:nth-child(3) { animation-delay: 0.08s; }
.reveal { transform: translateY(8px); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); }
.hero-mini { animation: none !important; filter: none; }
.rv-body, .q-fb { transition-duration: 0.25s; }
.report { animation: riseIn 0.3s var(--ease) both; } .result { animation: none; }
.modal { transform: translateY(6px); transition: transform 0.2s var(--ease); }
.modal-back { transition: opacity 0.2s; }
.toast { transform: translateY(6px); transition: opacity 0.2s, transform 0.2s var(--ease); border-radius: 12px; box-shadow: var(--shadow-lg); }
.toast.out { transform: translateY(6px); }
.lesson { transform: translate(-50%, 8px); transition: opacity 0.25s, transform 0.25s var(--ease); }
.hint-pill { transition: opacity 0.3s, transform 0.3s var(--ease); }
.rev-v .rv.in { animation-duration: 0.2s; }
.stage { transition: opacity 0.25s; }
.screen, .screen.active { transition-duration: 0.2s; }
.brand .logo { transition: none; }
@media (max-width: 900px) { .lesson { transform: translateY(-6px); } }

.count { white-space: nowrap; flex: none; }
.lewis-card .card-h { flex-wrap: nowrap; }

.mlabel.dip { font-size: 12px; padding: 1px 8px; background: transparent; color: var(--dip-ink, #b5472f); box-shadow: none; font-style: italic; font-weight: 700; }
:root[data-theme="dark"] .mlabel.dip { --dip-ink: #ff9f8c; }
.mlabel.dip-plus { width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; font-size: 14px; line-height: 1; padding: 0; background: var(--glass-strong); border: 1.5px solid #e0654f; color: #c24a33; font-weight: 800; }

.lewis-box { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lewis-note { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); text-align: center; max-width: 250px; }
.lewis { color: var(--text); }

.overlay-svg path.wedge { stroke-linejoin: round; }
.mlabel.ang { font-size: 12px; padding: 2px 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.mlabel.ang.in { background: var(--glass-strong); }
.overlay-svg path.arc { stroke-width: 2.2; }

.persp-box { width: 100%; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.persp { display: block; max-width: 100%; height: auto; background: transparent; border-radius: 12px; padding: 6px; box-sizing: border-box; }
:root[data-theme="dark"] .persp { background: #fafafa; }

/* ───────── Learn: shape pop-up — same proportions, glass and blur as the zperiod.app element window ───────── */
:root { --zp-bg: rgba(255, 255, 255, 0.92); --zp-info: #ffffff; --zp-head: #f9f6f0; --zp-text: #1a1a1a; --zp-card-text: #111827; --zp-btn: rgba(0, 0, 0, 0.04); --zp-btn-fg: #4f5d75;
  --zp-glow: rgba(200, 215, 235, 0.7); --zp-edge: rgba(0, 0, 0, 0.04); --zp-row: rgba(255, 255, 255, 0.3); --zp-row-edge: rgba(255, 255, 255, 0.4); --zp-inner: rgba(255, 255, 255, 0.2);
  --zp2: #a7c5d9; --zp3: #9dcbc3; --zp4: #b0bed1; --zp5: #c5b9d6; --zp6: #dbc59c; }
:root[data-theme="dark"] { --zp-bg: rgba(22, 22, 30, 0.94); --zp-info: #1c1c1e; --zp-head: #181820; --zp-text: #ffffff; --zp-card-text: rgba(255, 255, 255, 0.92); --zp-btn: rgba(255, 255, 255, 0.08); --zp-btn-fg: #ffffff;
  --zp-glow: rgba(30, 40, 60, 0.5); --zp-edge: rgba(255, 255, 255, 0.04); --zp-row: rgba(255, 255, 255, 0.05); --zp-row-edge: rgba(255, 255, 255, 0.08); --zp-inner: rgba(255, 255, 255, 0.03);
  --zp2: #1c2a35; --zp3: #1d2e2b; --zp4: #1d2430; --zp5: #262236; --zp6: #2a211d; }
/* the page behind is static while the window is open, so this blur is computed once */
.modal-back.zp { background: rgba(200, 195, 190, 0.2); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); transition: opacity 0.4s ease; }
:root[data-theme="dark"] .modal-back.zp { background: rgba(0, 0, 0, 0.45); }
.modal.shape-modal { width: calc(100vw - clamp(10px, 6vw, 200px)); max-width: 1300px; height: calc(100vh - clamp(16px, 10vh, 200px)); max-height: 750px; padding: 0; overflow: hidden;
  border-radius: 32px; background: var(--zp-bg); border: 1px solid rgba(0, 0, 0, 0.06); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
  transform: scale(0.96); transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-back.zp.in .modal.shape-modal { transform: scale(1); }
.modal.shape-modal .modal-x { top: 20px; right: 20px; z-index: 5; width: 40px; height: 40px; border-radius: 50%; background: var(--zp-btn); color: var(--zp-btn-fg); box-shadow: none; transition: background 0.2s, color 0.2s, transform 0.2s; }
.modal.shape-modal .modal-x:hover { background: rgba(0, 0, 0, 0.85); color: #fff; transform: rotate(90deg); }
:root[data-theme="dark"] .modal.shape-modal .modal-x:hover { background: rgba(255, 255, 255, 0.9); color: #000; }
.sd { display: flex; height: 100%; color: var(--zp-text); }
.sd.n2 { --tint: var(--zp2); } .sd.n3 { --tint: var(--zp3); } .sd.n4 { --tint: var(--zp4); } .sd.n5 { --tint: var(--zp5); } .sd.n6 { --tint: var(--zp6); }
.sd-info { flex: 0 0 480px; min-width: 320px; height: 100%; display: flex; flex-direction: column; background: var(--zp-info); position: relative; z-index: 2; }
.sd-head { flex: none; height: 105px; box-sizing: border-box; display: flex; align-items: center; padding: 20px 40px 12px; background: var(--zp-head); border-bottom: 1px solid var(--zp-edge); }
.sd-left { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.sd-nums { display: flex; flex-direction: column; align-items: flex-end; font-size: 2.2rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.sd-axe { font-size: 4.5rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.sd-name { flex: 1; min-width: 0; margin: 0 0 0 24px; text-align: center; font-size: 2.5rem; font-weight: 700; line-height: 1.15; }
.sd-name.long { font-size: 1.75rem; }
.sd-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 40px 40px 26px; }
.sd-card { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; border-radius: 30px; padding: 20px; background: var(--tint); box-shadow: 0 3px 8px color-mix(in srgb, var(--tint) 40%, transparent); color: var(--zp-card-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, var(--font); }
:root[data-theme="dark"] .sd-card { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.08); }
.sd-card::-webkit-scrollbar { display: none; }
.sd-page { display: flex; flex-direction: column; min-height: 100%; }
.sd-page[hidden] { display: none; }
.sd-title { display: block; margin: 2px 0 14px; text-align: center; font-size: 0.85rem; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; opacity: 0.4; }
.sd-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.sd-row .k { font-size: 0.85rem; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; opacity: 0.5; white-space: nowrap; }
.sd-row b { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; text-align: right; }
.sd-inner { flex: 1; display: flex; flex-direction: column; gap: 10px; margin-top: 4px; padding: 14px 12px; border-radius: 20px; background: var(--zp-inner); }
.sd-cap { display: block; text-align: center; font-size: 0.85rem; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; opacity: 0.4; margin-bottom: 2px; }
.sd-mol { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 14px 24px; border-radius: 18px; border: 1px solid var(--zp-row-edge); background: var(--zp-row); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02); color: inherit; text-align: left; transition: transform 0.2s ease; }
.sd-mol:active { transform: scale(0.96); }
.sd-mol .f { font-family: Baskerville, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif; font-size: 1.6rem; font-weight: 700; line-height: 1; }
.sd-mol .f sub { vertical-align: baseline; position: relative; top: 0.3em; font-size: 0.7em; line-height: 0; }
.sd-mol .f sup { vertical-align: baseline; position: relative; top: -0.4em; font-size: 0.6em; line-height: 0; }
.sd-mol .v { font-size: 1.05rem; opacity: 0.75; }
.sd-text { margin: 4px 0 16px; font-size: 1.02rem; line-height: 1.6; }
.sd-mol.on { background: var(--zp-text); color: var(--zp-info); border-color: transparent; }
.sd-mol.on .v { opacity: 0.8; }
.sd-mol[disabled] { cursor: default; opacity: 1; }
.sd-mol[disabled]:active { transform: none; }
.sd-mol .v b { font-weight: 700; font-variant-numeric: tabular-nums; }
.sd-mol .v s { opacity: 0.5; font-size: 0.9em; }
.sd-small { margin: 2px 6px 0; font-size: 0.85rem; line-height: 1.5; opacity: 0.7; text-align: center; }
.sd-inner + .sd-inner { margin-top: 12px; }
.sd-inner .sd-text { margin: 0 6px; }
.sd-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: auto; padding-top: 16px; }
.sd-dots { display: flex; justify-content: center; padding-top: 22px; }
.sd-dots [data-page] { position: relative; width: 8px; height: 8px; margin: 0 5px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.1); transition: background 0.22s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1); }
.sd-dots [data-page]::after { content: ""; position: absolute; inset: -8px; }
.sd-dots [data-page]:hover, .sd-dots [data-page].on { background: var(--zp-text); transform: scale(1.15); }
:root[data-theme="dark"] .sd-dots [data-page] { background: rgba(255, 255, 255, 0.15); }
:root[data-theme="dark"] .sd-dots [data-page].on, :root[data-theme="dark"] .sd-dots [data-page]:hover { background: #fff; }
.sd-vis { flex: 1; min-width: 0; height: 100%; position: relative; overflow: hidden; border-left: 1px solid var(--zp-edge); background: radial-gradient(circle at center, var(--zp-glow) 0%, transparent 75%); }
.sd-stage { position: absolute; inset: 0; }
.sd-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
.sd-stage canvas:active { cursor: grabbing; }
.sd-stage .sd-fallback { position: static; width: 300px; height: 300px; margin: auto; }
.sd-tools { position: absolute; z-index: 5; top: 20px; left: 20px; right: 76px; display: flex; flex-wrap: wrap; gap: 8px; }
.sd-tool { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--zp-btn); color: var(--zp-btn-fg); transition: background 0.2s, color 0.2s, transform 0.15s; }
.sd-tool .ic { width: 19px; height: 19px; }
.sd-tool:hover { background: rgba(0, 0, 0, 0.09); }
.sd-tool:active { transform: scale(0.92); }
.sd-tool.on { background: #1b1f2a; color: #fff; }
:root[data-theme="dark"] .sd-tool:hover { background: rgba(255, 255, 255, 0.14); }
:root[data-theme="dark"] .sd-tool.on { background: #eceef3; color: #17171b; }
.sd-views { position: absolute; z-index: 5; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 2px; padding: 5px; border-radius: 999px; background: var(--zp-info); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); white-space: nowrap; }
.sd-views button { padding: 9px 20px; border: 0; border-radius: 999px; background: none; color: var(--text2); font-size: 14px; font-weight: 700; letter-spacing: 0.04em; transition: background 0.15s, color 0.15s; }
.sd-views button:hover { color: var(--zp-text); }
.sd-views button.on { background: #1b1f2a; color: #fff; }
:root[data-theme="dark"] .sd-views button.on { background: #eceef3; color: #17171b; }
.sd-stage.flat canvas, .sd-stage.flat .overlay-svg, .sd-stage.flat .labels { visibility: hidden; }
.sd-flat { position: absolute; inset: 70px 40px 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.sd-flat[hidden] { display: none; }
.sd-draw { width: 100%; display: grid; place-items: center; color: var(--zp-text); }
.lewis-big svg { width: var(--w); max-width: 100%; max-height: 100%; height: auto; }
.persp-big .persp { width: min(360px, 100%); height: auto; max-height: 52vh; padding: 0; border-radius: 0; background: none; box-shadow: none; }
/* the sketch is drawn in black ink like the textbook; on the dark theme it needs a light sheet to stay readable */
:root[data-theme="dark"] .persp-big .persp { padding: 18px; border-radius: 22px; background: #f4f4f6; }
.sd-flat-note { max-width: 420px; margin: 0; text-align: center; font-size: 13px; line-height: 1.55; color: var(--text2); }
.sd-help { position: absolute; z-index: 5; right: 20px; bottom: 20px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--zp-btn); color: var(--zp-btn-fg); font: 700 1.4rem/1 inherit; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); transition: background 0.2s, color 0.2s, transform 0.2s; }
.sd-help:hover { background: rgba(0, 0, 0, 0.85); color: #fff; transform: scale(1.1); }
:root[data-theme="dark"] .sd-help { color: #999; }
:root[data-theme="dark"] .sd-help:hover { background: rgba(255, 255, 255, 0.9); color: #111; }
.sd-tip { position: absolute; z-index: 5; right: 20px; bottom: 72px; max-width: 320px; padding: 12px 14px; border-radius: 16px; background: var(--zp-info); color: var(--zp-text); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12); font-size: 13px; line-height: 1.55; }
@media (max-width: 860px) {
  .modal.shape-modal { width: calc(100vw - 16px); height: calc(100vh - 16px); height: calc(100dvh - 16px); max-height: none; border-radius: 26px; }
  .sd { flex-direction: column; }
  .sd-vis { order: -1; flex: 0 0 42%; border-left: 0; border-bottom: 1px solid var(--zp-edge); }
  .sd-info { flex: 1; min-width: 0; min-height: 0; }
  .sd-head { height: auto; padding: 14px 22px; }
  .sd-nums { font-size: 1.35rem; } .sd-axe { font-size: 2.6rem; } .sd-name, .sd-name.long { font-size: 1.35rem; margin-left: 14px; }
  .sd-body { padding: 16px 16px 12px; }
  .sd-card { border-radius: 24px; padding: 16px; }
  .sd-row b { font-size: 1.15rem; } .sd-row { margin-bottom: 12px; }
  .sd-mol { padding: 11px 18px; } .sd-mol .f { font-size: 1.3rem; }
  .sd-dots { padding-top: 14px; }
  .modal.shape-modal .modal-x { top: 12px; right: 12px; }
  .sd-help { right: 12px; bottom: 12px; } .sd-tip { right: 12px; bottom: 60px; }
  .sd-tools { top: 12px; left: 12px; right: 60px; gap: 6px; } .sd-tool { width: 34px; height: 34px; }
  .sd-views { bottom: 10px; } .sd-views button { padding: 7px 13px; font-size: 12.5px; }
  .sd-flat { inset: 54px 16px 54px; } .persp-big .persp { max-height: 24vh; } .lewis-big svg { max-height: 24vh; }
}

/* ═════════════════ Home: tool picker ═════════════════ */
#tabs[hidden] { display: none; }
.home { max-width: 1080px; }
.home-head { text-align: center; max-width: 660px; margin: 18px auto 34px; }
.home-head h1 { font-size: clamp(34px, 5.4vw, 58px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.04; margin: 8px 0 12px; }
.home-head p { color: var(--text2); font-size: 16.5px; line-height: 1.55; }
.home-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.home-tool { display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; border-radius: 26px; transition: transform 0.25s var(--ease), box-shadow 0.25s; }
.home-tool:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ht-art { display: grid; place-items: center; height: 220px; background: radial-gradient(circle at center, var(--zp-glow) 0%, transparent 72%); border-bottom: 1px solid var(--line); }
.ht-c { width: 210px; height: 210px; }
.ht-body { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 26px 24px; }
.ht-body h2 { margin: 0; font-size: 27px; font-weight: 800; letter-spacing: -0.03em; }
.ht-body p { margin: 0; color: var(--text2); font-size: 14.5px; line-height: 1.55; }
.ht-last { position: absolute; top: 22px; right: 24px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.ht-feats { list-style: none; margin: 2px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; font-weight: 600; color: var(--text2); }
.ht-feats li { display: flex; align-items: center; gap: 6px; }
.ht-feats .ic { width: 15px; height: 15px; color: var(--accent); }
.ht-stats { display: flex; gap: 8px; margin-top: 4px; }
.ht-stats div { flex: 1; padding: 8px 12px; border-radius: 14px; background: var(--chip); }
.ht-stats span { display: block; font-size: 11.5px; font-weight: 650; color: var(--muted); }
.ht-stats b { font-size: 17px; font-variant-numeric: tabular-nums; }
.ht-go { align-self: flex-start; margin-top: 6px; pointer-events: none; }
.home-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.hs-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-align: left; border-radius: 20px; transition: transform 0.2s var(--ease); }
.hs-item:hover { transform: translateY(-2px); }
.hs-item .mode-ic { margin: 0; width: 42px; height: 42px; border-radius: 14px; box-shadow: none; }
.hs-item .mode-ic .ic { width: 21px; height: 21px; }
.hs-item b { display: block; font-size: 15px; }
.hs-item span { font-size: 12.5px; color: var(--text2); }
@media (max-width: 820px) { .home-tools, .home-strip { grid-template-columns: 1fr; } .ht-art { height: 170px; } .ht-c { width: 160px; height: 160px; } }

/* ═════════════════ Build an Atom ═════════════════ */
:root { --p-col: #e53935; --n-col: #9e9e9e; --e-col: #1e3cff; }
:root[data-theme="dark"] { --p-col: #e05353; --n-col: #8a8a8a; --e-col: #64d2ff; }
.stage.blank canvas, .stage.blank .overlay-svg, .stage.blank .labels { visibility: hidden; }
.pb-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.pb-row + .pb-row { border-top: 1px solid var(--line); }
.pb-ball { width: 22px; height: 22px; flex: none; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #fff 0 8%, var(--ball) 46%); box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.18); }
.proton .pb-ball, .stp.proton .stp-l::before { --ball: var(--p-col); }
.neutron .pb-ball, .stp.neutron .stp-l::before { --ball: var(--n-col); }
.electron .pb-ball, .stp.electron .stp-l::before { --ball: var(--e-col); }
.electron .pb-ball { width: 15px; height: 15px; margin: 0 3.5px; }
.pb-name { flex: 1; font-weight: 650; font-size: 14px; }
.pb-n { min-width: 26px; text-align: center; font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pb-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: var(--chip); font-size: 19px; font-weight: 700; line-height: 1; transition: background 0.15s, transform 0.15s; }
.pb-btn:hover:not(:disabled) { background: var(--chip-hover); }
.pb-btn:active:not(:disabled) { transform: scale(0.9); }
.pb-btn:disabled { opacity: 0.35; cursor: default; }
.pb-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.a-el-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 2px 0 10px; }
.a-el-name { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.a-el-cat { font-size: 12px; font-weight: 650; color: var(--muted); text-align: right; }
.a-meter { display: flex; align-items: center; gap: 12px; }
.a-meter-track { position: relative; flex: 1; height: 12px; border-radius: 99px; background: var(--chip); overflow: hidden; }
.a-meter-fill { position: absolute; top: 0; bottom: 0; transition: left 0.35s var(--ease), width 0.35s var(--ease), background 0.3s; }
.a-meter-fill.pos { background: var(--p-col); } .a-meter-fill.neg { background: var(--e-col); }
.a-meter-zero { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--text); opacity: 0.35; }
.a-q { min-width: 42px; text-align: right; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.a-meter-scale { display: flex; justify-content: space-between; padding: 3px 54px 0 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
.a-mass { display: flex; align-items: baseline; gap: 12px; }
.a-A { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.a-A-sum { font-size: 13.5px; font-weight: 650; color: var(--text2); }
.a-abund b { color: var(--text); }
.a-config { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; font-weight: 700; letter-spacing: 0.02em; margin: 2px 0 10px; }
.a-boxes { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.ob { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ob span { font-size: 11px; font-weight: 700; color: var(--muted); }
.ob div { display: flex; }
.ob i { width: 24px; height: 26px; display: grid; place-items: center; border: 1.5px solid var(--text); margin-left: -1.5px; font-style: normal; font-size: 13px; font-weight: 700; letter-spacing: -2px; color: var(--e-col); }
.ob i:first-child { margin-left: 0; border-radius: 6px 0 0 6px; } .ob i:last-child { border-radius: 0 6px 6px 0; } .ob i:only-child { border-radius: 6px; }
.a-top { pointer-events: none; }
.a-top.empty { opacity: 0; }
.a-title { display: flex; flex-direction: column; align-items: center; gap: 6px; transition: opacity 0.3s; }
.a-name { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; min-height: 1px; }
.a-badges { display: flex; gap: 6px; }
.a-badges .pill { font-size: 13px; padding: 3px 12px; }
.a-sym { display: grid; place-items: center; padding: 4px 0 8px; }
/* periodic table (zperiod.app category colours) */
.ptable { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(7, auto) 5px repeat(2, auto); gap: 2px; }
.ptable.compact { grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: none; gap: 5px; }
.pt-el { position: relative; aspect-ratio: 1; min-width: 0; display: grid; place-items: center; padding: 0; border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.05); background: var(--cbg, #e0e0e0); color: var(--cfg, #555); font-size: 7px; line-height: 1; transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s; }
.pt-el b { font-size: 1em; font-weight: 700; }
.pt-el .pt-z { display: none; }
.pt-el.off { opacity: 0.35; cursor: default; }
.pt-el:not(.off):hover { transform: scale(1.25); z-index: 2; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18); }
.pt-el.found::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.pt-el.on { outline: 2px solid var(--text); outline-offset: 0; z-index: 3; transform: scale(1.3); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); }
.ptable.compact .pt-el { border-radius: 9px; font-size: 13px; }
.ptable.compact .pt-el .pt-z { display: block; position: absolute; top: 3px; left: 4px; font-size: 8.5px; opacity: 0.55; font-weight: 600; }
.ptable.compact .pt-el.on { transform: scale(1.08); }
.ptable.compact .pt-el.found::after { width: 5px; height: 5px; right: 3px; bottom: 3px; }
.alkali-metal { --cbg: #ffcccc; --cfg: #5d2e2e; } .alkaline-earth-metal { --cbg: #ffe5cc; --cfg: #5d402e; } .transition-metal { --cbg: #fff2cc; --cfg: #5d522e; }
.post-transition-metal { --cbg: #d9e2f3; --cfg: #2e3a5d; } .metalloid { --cbg: #d1e7dd; --cfg: #2e5d4b; } .other-nonmetal { --cbg: #e2f0d9; --cfg: #3a5d2e; }
.halogen { --cbg: #ffffcc; --cfg: #5d5d2e; } .noble-gas { --cbg: #e0ccff; --cfg: #4b2e5d; } .lanthanide { --cbg: #fce4d6; --cfg: #5d3a2e; } .actinide { --cbg: #fddddd; --cfg: #5d2e2e; } .unknown { --cbg: #e0e0e0; --cfg: #666; }
:root[data-theme="dark"] .alkali-metal { --cbg: #6c303d; --cfg: #ffdbe1; } :root[data-theme="dark"] .alkaline-earth-metal { --cbg: #6b5425; --cfg: #ffe9c2; } :root[data-theme="dark"] .transition-metal { --cbg: #666122; --cfg: #fff6c4; }
:root[data-theme="dark"] .post-transition-metal { --cbg: #354782; --cfg: #dde5ff; } :root[data-theme="dark"] .metalloid { --cbg: #1f5d53; --cfg: #cdf3ea; } :root[data-theme="dark"] .other-nonmetal { --cbg: #446227; --cfg: #e2f5cf; }
:root[data-theme="dark"] .halogen { --cbg: #6c6a27; --cfg: #fffbc6; } :root[data-theme="dark"] .noble-gas { --cbg: #5a347f; --cfg: #eedcff; } :root[data-theme="dark"] .lanthanide { --cbg: #8b5b2d; --cfg: #ffe6cc; } :root[data-theme="dark"] .actinide { --cbg: #7a3655; --cfg: #ffd9e8; } :root[data-theme="dark"] .unknown { --cbg: #2a2a32; --cfg: #aaa; }
/* nuclear symbol tile */
.sym-tile { position: relative; width: 150px; aspect-ratio: 1; border-radius: 22px; background: var(--cbg); color: var(--cfg); box-shadow: 0 3px 10px color-mix(in srgb, var(--cbg) 55%, transparent); font-variant-numeric: tabular-nums; }
.sym-tile.big { width: 172px; }
.sym-s { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); font-size: 64px; font-weight: 800; letter-spacing: -0.03em; color: var(--cfg); }
.sym-a, .sym-z, .sym-q { position: absolute; font-size: 22px; font-weight: 800; }
.sym-a { top: 12px; left: 16px; }
.sym-z { bottom: 30px; left: 16px; color: var(--p-col); }
.sym-q { top: 12px; right: 16px; color: var(--e-col); }
.sym-name { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 13px; font-weight: 650; opacity: 0.75; }
.sym-tile.unknown .sym-s:empty::before { content: "?"; opacity: 0.3; }

/* ═════════════════ Build an Atom game ═════════════════ */
.ag-levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 30px; }
.ag-level { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 20px 18px 18px; text-align: left; border-radius: 24px; transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.ag-level:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ag-lv-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.ag-lv-ic .ic { width: 24px; height: 24px; }
.ag-lv-n { font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ag-level b { font-size: 18px; letter-spacing: -0.02em; }
.ag-lv-d { flex: 1; font-size: 13px; line-height: 1.5; color: var(--text2); }
.ag-stars { display: flex; gap: 3px; margin-top: 6px; }
.ag-stars i { color: var(--line); } .ag-stars i.on { color: #f2b01e; }
.ag-stars .ic { width: 20px; height: 20px; fill: currentColor; }
.ag-stars.big { justify-content: center; margin: 10px 0 2px; } .ag-stars.big .ic { width: 40px; height: 40px; }
.ag-best { font-size: 12px; font-weight: 650; color: var(--muted); }
.ag-timer { max-width: 320px; margin: 18px auto 0; padding: 10px 18px; border-radius: 18px; }
.ag-q .card-h { margin-bottom: 4px; }
.ag-prompt { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--text2); }
.ag-body { display: flex; flex-direction: column; gap: 4px; }
.stp { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.stp + .stp { border-top: 1px solid var(--line); }
.stp-l { flex: 1; font-size: 13.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.stp.proton .stp-l::before, .stp.neutron .stp-l::before, .stp.electron .stp-l::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #fff 0 8%, var(--ball) 46%); }
.stp b { min-width: 34px; text-align: center; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ag-sym-edit, .ag-target { display: grid; place-items: center; padding: 4px 0 10px; }
.ag-choice { display: flex; gap: 8px; } .ag-choice .btn { flex: 1; justify-content: center; }
.ag-fb { min-height: 20px; margin: 12px 0 10px; font-size: 13.5px; font-weight: 650; }
.ag-fb.good { color: var(--good); } .ag-fb.bad { color: var(--bad); } .ag-fb.warn { color: var(--warn); }
.ag-fb.shake { animation: shake 0.45s; }
.ag-dots { display: flex; gap: 5px; margin: 4px 0 12px; }
.ag-dots i { flex: 1; height: 5px; border-radius: 9px; background: var(--line); }
.ag-dots i.ok { background: var(--good); } .ag-dots i.no { background: var(--bad); } .ag-dots i.cur { background: var(--accent); }
.ag-score .btn.wide { margin-top: 12px; }
.ag-center { position: fixed; z-index: 5; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ag-center .sym-tile { width: 240px; } .ag-center .sym-s { font-size: 104px; } .ag-center .sym-a, .ag-center .sym-z, .ag-center .sym-q { font-size: 34px; }
.ag-center .sym-z { bottom: 20px; }
.ag-result { display: grid; place-items: center; min-height: 100%; }
.ag-res { max-width: 440px; width: 100%; padding: 30px 28px; text-align: center; border-radius: 28px; }
.ag-res h2 { margin: 6px 0; font-size: 44px; font-weight: 800; letter-spacing: -0.03em; }
.ag-res p { color: var(--text2); }
.ag-res-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
@media (max-width: 900px) { .ag-levels { grid-template-columns: 1fr 1fr; } .ag-center { inset: 60px 0 auto; height: 40vh; } .ag-center .sym-tile { width: 170px; } .ag-center .sym-s { font-size: 72px; } }
/* progress: Build an Atom section */
.pa-sec .sec-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.pa-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 14px; }
.pa-table { margin-top: 4px; }
.pa-table .pt-el:not(.found) { opacity: 0.32; }
.pa-table .pt-el.found::after { display: none; }
.pa-lv { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13.5px; font-weight: 650; }
.pa-lv + .pa-lv { border-top: 1px solid var(--line); }
.pa-lv span:first-child { flex: 1; }
.pa-lv .ag-stars { margin: 0; } .pa-lv .ag-stars .ic { width: 16px; height: 16px; }
.pa-lv b { min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.pa-grid .btn.wide { margin-top: 12px; }
@media (max-width: 900px) { .pa-grid { grid-template-columns: 1fr; } }
.a-full { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 5px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 650; color: var(--text2); background: var(--chip); }
.a-full:hover { background: var(--chip-hover); color: var(--text); }
.a-full .ic { width: 15px; height: 15px; }
.modal.pt-wide { width: min(1100px, 100%); }
.pt-modal h2 { margin: 4px 0 16px; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.ptable.full { gap: 4px; grid-template-rows: repeat(7, auto) 12px repeat(2, auto); }
.ptable.full .pt-el { border-radius: 8px; font-size: clamp(9px, 1.35vw, 17px); }
.ptable.full .pt-el .pt-z { display: block; position: absolute; top: 3px; left: 4px; font-size: 0.5em; opacity: 0.55; font-weight: 600; }
.ptable.full .pt-el.off { opacity: 0.55; cursor: pointer; }
.ptable.full .pt-el:hover { transform: scale(1.12); }
.ptable.full .pt-el.on { transform: scale(1.12); }
.pt-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: 12px; font-weight: 600; color: var(--text2); }
.pt-leg { display: inline-flex; align-items: center; gap: 6px; }
.pt-leg i { width: 12px; height: 12px; border-radius: 4px; background: var(--cbg); border: 1px solid rgba(0, 0, 0, 0.06); }
.pt-info { min-height: 22px; margin: 12px 0 0; font-size: 13.5px; color: var(--text2); }
.ag-center[hidden] { display: none; }

/* atom screens: plain-language read-outs, shell tags, nucleus spread */
.a-explain { max-width: min(560px, 46vw); margin: 2px 0 0; text-align: center; font-size: 13.5px; line-height: 1.5; color: var(--text2); }
.a-explain b { color: var(--text); font-weight: 700; }
.a-sum { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text2); }
.a-sum b { color: var(--text); }
.mlabel.shell-tag { padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--text2); background: var(--glass-strong); border: 1px solid var(--edge); }
.mlabel.shell-tag.full { color: var(--good); }
.ag-spread { margin: -4px 0 10px; }
.a-full.on, .ag-spread.on { background: var(--accent-soft); color: var(--accent); }
.ptable.compact .pt-el b { margin-top: 8px; }
.a-el-hint:empty { display: none; }
.a-el-hint { margin: -4px 0 10px; }

/* ═════════════════ Balancing Chemical Equations ═════════════════ */
.bw { max-width: 1500px; display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; gap: 14px; align-items: start; padding: 78px 14px 96px; }
.bw-side { display: flex; flex-direction: column; gap: 12px; }
.bw-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bw-main.wide { grid-column: 1 / -1; max-width: 980px; width: 100%; margin: 0 auto; }
/* equation with coefficient pickers */
.bw-eq { padding: 18px 16px 14px; transition: box-shadow 0.3s, border-color 0.3s; }
.bw-eq.ok { border-color: color-mix(in srgb, var(--good) 45%, transparent); box-shadow: 0 0 0 3px var(--good-soft); }
.eq-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; }
.eq-sp { display: flex; align-items: center; gap: 4px; }
.eq-f { font-family: Baskerville, "Iowan Old Style", Georgia, "Songti SC", serif; font-size: 27px; font-weight: 700; letter-spacing: 0.01em; }
.eq-f sub { font-size: 0.62em; }
.eq-plus { font-size: 24px; font-weight: 600; color: var(--muted); }
.eq-arrow { display: grid; place-items: center; width: 44px; color: var(--text2); }
.eq-arrow .ic { width: 30px; height: 30px; }
.cf { display: flex; flex-direction: column; align-items: center; border-radius: 14px; background: var(--chip); padding: 2px; }
.cf-b { width: 36px; height: 22px; display: grid; place-items: center; border-radius: 10px; color: var(--text2); transition: background 0.15s, color 0.15s; }
.cf-b .ic { width: 16px; height: 16px; }
.cf-b:hover:not(:disabled) { background: var(--chip-hover); color: var(--text); }
.cf-b:disabled { opacity: 0.25; cursor: default; }
.cf-n { font-size: 24px; font-weight: 800; line-height: 1.05; min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; color: var(--accent); }
.cf-n.zero { color: var(--muted); }
.b-status { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 22px; margin-top: 12px; font-size: 13.5px; font-weight: 650; color: var(--text2); text-align: center; }
.b-status .ic { width: 18px; height: 18px; }
.b-status.yes { color: var(--good); } .b-status.notSimple, .b-status.zero { color: var(--warn); } .b-status.bad { color: var(--bad); }
.b-status.shake { animation: shake 0.45s; }
/* molecule boxes (PhET's before / after) */
.bw-boxes { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 10px; }
.bw-boxes[hidden] { display: none; }
.bx { display: flex; flex-direction: column; border-radius: 22px; background: var(--glass); border: 1px solid var(--edge); box-shadow: var(--shadow); padding: 10px 12px 12px; min-height: 270px; transition: border-color 0.3s, box-shadow 0.3s; }
.bw-boxes.ok .bx { border-color: color-mix(in srgb, var(--good) 40%, transparent); box-shadow: 0 0 0 3px var(--good-soft); }
.bx-h { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); text-align: center; margin-bottom: 6px; }
.bx-in { flex: 1; display: flex; justify-content: space-around; gap: 6px; min-height: 230px; }
.bx-col { flex: 1; display: flex; flex-direction: column-reverse; flex-wrap: wrap-reverse; align-content: center; justify-content: flex-start; align-items: center; gap: 3px; max-height: 240px; }
.bx-m { display: block; line-height: 0; }
.bx-m.new { animation: molIn 0.45s var(--ease) both; }
@keyframes molIn { from { opacity: 0; transform: translateY(-14px) scale(0.7); } }
.bx-arrow { display: grid; place-items: center; color: var(--muted); } .bx-arrow .ic { width: 26px; height: 26px; }
.mol { display: block; overflow: visible; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12)); }
/* balance scales */
.bw-tool { padding: 14px; }
.bw-tool[hidden] { display: none; }
.scales { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }
.scale { margin: 0; width: 150px; display: flex; flex-direction: column; align-items: center; }
.scale > svg { width: 150px; height: auto; overflow: visible; }
.scale figcaption { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 750; margin-top: -2px; }
.sc-base { fill: var(--text2); opacity: 0.55; } .sc-beam { fill: var(--text2); transition: fill 0.3s; } .sc-pin { fill: var(--text); }
.scale > svg g { transition: transform 0.45s var(--ease); }
.sc-n { font-size: 10px; font-weight: 800; text-anchor: middle; fill: var(--text); }
.scale.ok .sc-beam { fill: var(--good); }
.scale.ok figcaption b { color: var(--good); }
/* bar charts */
.bars { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: end; }
.bars-side { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bars-h { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.bars-row { display: flex; gap: 12px; align-items: flex-end; height: 160px; }
.bar-g { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar-g > span { display: flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 750; }
.bar-c { flex: 1; width: 30px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.bar-c b { font-size: 12px; font-variant-numeric: tabular-nums; }
.bar-c i { width: 100%; min-height: 2px; border-radius: 7px 7px 2px 2px; background: var(--c); border: 1px solid rgba(0, 0, 0, 0.12); transition: height 0.4s var(--ease); }
.bar-g.ok .bar-c b { color: var(--good); }
.bars-eq { width: 1px; align-self: stretch; background: var(--line); }
/* side cards */
.b-intro-list { display: flex; flex-direction: column; gap: 8px; }
.b-item { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 14px; text-align: left; background: var(--chip); transition: background 0.15s; }
.b-item:hover { background: var(--chip-hover); }
.b-item.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.b-item b { display: block; font-size: 13.5px; }
.b-item small { display: block; font-size: 12px; color: var(--text2); margin-top: 1px; }
.b-item small sub { font-size: 0.75em; }
.b-item.big { padding: 12px; }
.b-art { display: flex; align-items: center; gap: 2px; min-width: 70px; }
.b-done { position: absolute; top: 8px; right: 8px; color: var(--good); } .b-done .ic { width: 15px; height: 15px; }
.b-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 360px; overflow-y: auto; scrollbar-width: thin; }
.b-custom { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.b-custom[hidden] { display: none; }
.b-input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--edge); background: var(--chip); color: var(--text); font: 600 13.5px ui-monospace, Menlo, monospace; }
.b-input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.b-err { flex-basis: 100%; margin: 0; min-height: 0; font-size: 12.5px; color: var(--bad); }
.b-err:empty { display: none; }
.b-custom .explain { flex-basis: 100%; margin: 0; }
.b-type-row { margin: 2px 0 6px; } .b-type-row .pill { font-size: 12.5px; padding: 3px 11px; }
.atab { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.atab th { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); text-align: center; padding: 0 0 6px; }
.atab td { text-align: center; padding: 6px 0; border-top: 1px solid var(--line); font-weight: 700; }
.atab td:first-child { text-align: left; display: flex; align-items: center; gap: 6px; }
.atab tr.ok td:last-child { color: var(--good); } .atab tr.no td:last-child { color: var(--bad); }
.atab .ic { width: 16px; height: 16px; }
.mass-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.mass-row span { display: block; font-size: 11.5px; font-weight: 650; color: var(--muted); }
.mass-row b { font-size: 16px; font-variant-numeric: tabular-nums; }
.mass-row > i { font-style: normal; font-size: 22px; font-weight: 800; color: var(--bad); } .mass-row > i.ok { color: var(--good); }
.b-hint b { color: var(--text); }
.b-hint sub { font-size: 0.75em; }
.b-hint-btns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
/* game */
.bg-play .bw-main { gap: 14px; }
.bg-top { display: flex; align-items: center; gap: 14px; }
.bg-top .ag-dots { flex: 1; margin: 0; }
.bg-score { font-size: 13px; font-weight: 650; color: var(--text2); white-space: nowrap; }
.bg-prompt { margin: 0 0 12px; text-align: center; font-size: 14px; color: var(--text2); }
.bg-btns { display: flex; justify-content: center; margin-top: 12px; }
.bg-btns .btn { min-width: 160px; justify-content: center; }
.ag-levels.three { grid-template-columns: repeat(3, 1fr); max-width: 900px; margin-left: auto; margin-right: auto; }
.bg-review { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 4px; text-align: left; }
.bg-review div { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 12px; background: var(--chip); font-family: Baskerville, Georgia, serif; font-size: 15px; font-weight: 700; }
.bg-review .ic { width: 15px; height: 15px; flex: none; }
.bg-review .ok { color: var(--text); } .bg-review .ok .ic { color: var(--good); } .bg-review .no { color: var(--text2); }
.bg-review sub { font-size: 0.7em; }
/* home: three tools */
.home { max-width: 1240px; }
.home-tools { grid-template-columns: repeat(3, 1fr); }
.ht-eq { display: flex; align-items: center; gap: 6px; transform: scale(1.05); }
.ht-eq i { font-style: normal; font-weight: 700; color: var(--muted); } .ht-eq i.arr { font-size: 20px; margin: 0 2px; }
.ha-m { display: flex; align-items: center; gap: 2px; } .ha-m b { font-size: 18px; color: var(--accent); }
@media (max-width: 1100px) { .bw { grid-template-columns: 1fr; } .bw-main { order: -1; } .bw-side { display: grid; grid-template-columns: 1fr 1fr; } .home-tools { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .bw-side { grid-template-columns: 1fr; } .eq-f { font-size: 21px; } .cf-n { font-size: 20px; } .bw-boxes { grid-template-columns: 1fr; } .bx-arrow { transform: rotate(90deg); } .ag-levels.three { grid-template-columns: 1fr; } }
.b-item { padding-right: 28px; }

/* Zperiod lab: consistent typography, quieter panels, clear control hierarchy. */
.embedded-lab .nav { top: 10px; box-shadow: none; }
.embedded-lab .nav .wordmark { display: none; }
.embedded-lab .brand { min-width: 36px; }
.embedded-lab .brand .logo { width: 28px; height: 28px; }
.embedded-lab .card { border-radius: 16px; }
body[data-tool="atom"] { --accent: #796994; --accent2: #796994; --accent-soft: #79699412; }
body[data-tool="balance"] { --accent: #46758c; --accent2: #46758c; --accent-soft: #46758c12; }
[data-theme="dark"] body[data-tool="atom"] { --accent: #b9a8d9; --accent2: #b9a8d9; --accent-soft: #b9a8d918; }
[data-theme="dark"] body[data-tool="balance"] { --accent: #8ebbd3; --accent2: #8ebbd3; --accent-soft: #8ebbd318; }
.atom-panels .col { width: 278px; top: 78px; bottom: 26px; gap: 12px; }
.atom-panels .card { padding: 18px; }
.atom-panels .card-h { font-size: 11px; margin-bottom: 14px; color: var(--text2); }
.atom-panels details { pointer-events: auto; flex: none; }
.atom-panels summary { font-size: 12px; font-weight: 600; cursor: pointer; list-style-position: outside; margin-left: 12px; color: var(--text2); }
.atom-panels details[open] summary { margin-bottom: 16px; }
.a-identity { display: flex; align-items: center; gap: 15px; margin: 0 0 12px; }
.a-identity > div:last-child { display: flex; flex-direction: column; gap: 4px; }
.a-identity .a-el-name { font-size: 24px; letter-spacing: -.04em; }
.a-identity .a-el-cat { font-size: 10px; color: var(--text2); }
.a-identity .a-iso { font-size: 10px; color: var(--muted); }
.a-identity .a-sym { min-width: 67px; font-size: 42px; }
.a-sym-note { font-size: 10px; line-height: 1.7; }
.a-prop-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; font-weight: 600; margin-top: 12px; }
.a-property-card .a-mass { margin-top: 7px; }
.a-property-card .a-mass b { font-size: 31px; }
.a-property-card .a-sum { font-size: 11px; }
.a-property-card .a-abund { font-size: 10px; margin-bottom: 0; }
.a-isotope-list { display: flex; flex-direction: column; gap: 7px; }
.isotope-chip { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; padding: 10px; background: var(--chip); border: 1px solid transparent; border-radius: 10px; text-align: left; }
.isotope-chip b { font-size: 12px; }
.isotope-chip span { font-size: 10px; grid-column: 1; color: var(--text2); }
.isotope-chip small { grid-row: 1/3; grid-column: 2; align-self: center; font-size: 10px; color: var(--text2); }
.isotope-chip.active { background: var(--accent-soft); border-color: var(--accent); }
.atom-panels .a-config { font-size: 14px; margin-top: 16px; }
.atom-panels .a-boxes { gap: 8px; }
.atom-panels .pb-row { gap: 8px; }
.atom-panels .pb-name { flex: 1; font-size: 12px; }
.atom-panels .pb-btn { width: 31px; height: 31px; border-radius: 9px; }
.atom-panels .pb-n { width: 20px; font-size: 17px; }
.particle-source { border: 0; padding: 4px; background: transparent; touch-action: none; cursor: grab; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; }
.particle-source:hover { background: var(--chip); }
.particle-source .pb-ball { display: block; width: 20px; height: 20px; pointer-events: none; }
.atom-drag-note { font-size: 10px; line-height: 1.65; padding-top: 5px; }
.atom-panels .pb-actions { gap: 5px; margin-top: 13px; }
.atom-panels .pb-actions .chip { font-size: 10px; padding: 6px 8px; }
.particle-ghost { position: fixed; z-index: 300; width: 26px; height: 26px; border-radius: 50%; transform: translate(-50%,-50%); pointer-events: none; box-shadow: 0 4px 10px #0002; }
.particle-ghost.proton { background: radial-gradient(circle at 30% 25%,#ffa3a3,#ff2222 55%,#a12c2c); }
.particle-ghost.neutron { background: radial-gradient(circle at 30% 25%,#eee,#999 55%,#666); }
.particle-ghost.electron { background: radial-gradient(circle at 30% 25%,#b8caff,#5574de 55%,#172586); width: 18px; height: 18px; }
.atom-drop-target { position: absolute; left: 306px; right: 306px; top: 190px; bottom: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; pointer-events: none; border: 1px dashed var(--edge); border-radius: 50%; max-width: 470px; margin: auto; color: var(--text2); }
.atom-drop-target span .ic { width: 65px; height: 65px; stroke-width: .8; opacity: .3; }
.atom-drop-target b { font-size: 13px; max-width: 210px; text-align: center; line-height: 1.7; font-weight: 500; }
.atom-drop-target small { display: none; }
.atom-drop-target.has-atom { border-color: transparent; }
.atom-drop-target.has-atom > * { visibility: hidden; }
.particle-dragging .atom-drop-target { border-color: var(--accent); background: var(--accent-soft); }
.particle-dragging .atom-drop-target > * { visibility: hidden; }
.particle-dragging .atom-drop-target small { visibility: visible; display: block; font-size: 12px; background: var(--glass); border-radius: 10px; padding: 10px 16px; margin-top: auto; }
body[data-tool="atom"] .a-top { left: 306px; right: 306px; top: 87px; }
body[data-tool="atom"] .a-top .a-name { font-size: 26px; letter-spacing: -.04em; font-weight: 550; }
body[data-tool="atom"] .a-explain { font-size: 10px; max-width: 450px; margin: 10px auto 0; }
.mission-step { font-size: 9px; letter-spacing: .09em; color: var(--accent); text-transform: uppercase; }
.mission-content h4 { font-size: 17px; margin: 11px 0 8px; letter-spacing: -.035em; font-weight: 600; }
.mission-content p { font-size: 11px; line-height: 1.8; color: var(--text2); margin: 0; }
.mission-pips { display: flex; gap: 5px; margin-top: 16px; }
.mission-pips i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.mission-pips i.current { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mission-pips i.done { background: var(--good); }
.mission-success { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--good); margin-top: 14px; }
.mission-success .ic { width: 14px; height: 14px; }
.mission-next { margin-top: 12px; font-size: 11px; }
#atom-fallback { position: fixed; width: 320px; height: 320px; left: 50%; top: 50%; transform: translate(-50%,-50%); pointer-events: none; }
#atom-fallback[hidden] { display: none; }
.cf input.cf-n { width: 38px; min-width: 0; border: 0; padding: 3px 0; background: transparent; font-family: inherit; -moz-appearance: textfield; }
.cf input.cf-n::-webkit-inner-spin-button, .cf input.cf-n::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cf-b { height: 28px; }
.coef-guidance { font-size: 10px; color: var(--text2); text-align: center; margin: 0 0 14px; line-height: 1.6; }
.reaction-actions { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.reaction-actions .btn { font-size: 11px; }
.reaction-disclaimer { font-size: 9px; margin-bottom: 0; line-height: 1.6; color: var(--muted); }
.reaction-help { font-size: 10px; margin: 10px 0; }
.reaction-help:empty { display: none; }
.reaction-stage { width: 100%; height: auto; margin-top: 14px; background: var(--chip); border-radius: 12px; }
.reaction-caption { text-align: center; font-size: 11px; color: var(--accent); margin: 8px 0; }
.bw { grid-template-columns: 240px minmax(0,1fr) 248px; gap: 18px; padding-left: 24px; padding-right: 24px; }
.bw-side .card { padding: 18px; }
.b-item { border-radius: 10px; }
.b-item b { font-size: 12px; }.b-item small { font-size: 10px; }.b-list { max-height: 350px; }
.bw .card-h { font-size: 11px; }
.bw .b-type-x { font-size: 11px; line-height: 1.8; }
.bx { min-height: 180px; border-radius: 16px; }
.bx-h { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.mole-page { max-width: 1080px; padding-top: 98px; }
.mole-page .hub-head { text-align: left; margin-bottom: 32px; }
.mole-page h1 { font-size: clamp(26px,3.5vw,40px); font-weight: 550; letter-spacing: -.045em; }
.mole-page .hub-head p { font-size: 13px; }
.mole-layout { display: grid; grid-template-columns: 320px minmax(0,1fr); gap: 22px; }
.mole-layout aside,.mole-layout main { display: flex; flex-direction: column; gap: 16px; }
.mole-layout .card { padding: 24px; }
.mole-select { width: 100%; border: 1px solid var(--edge); background: var(--chip); color: var(--text); padding: 10px; border-radius: 9px; font: inherit; font-size: 12px; }
.mole-equation { font-size: 20px; font-family: Georgia,serif; line-height: 1.8; margin: 18px 0 8px; }
.mole-input-row { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.mole-input-row > span { font-weight: 600; font-size: 20px; min-width: 65px; }
.mole-input-row input { width: 100%; min-width: 0; border: 1px solid var(--edge); background: var(--chip); color: var(--text); border-radius: 9px; padding: 10px; font: inherit; }
.mole-input-row small { color: var(--text2); font-size: 11px; }
.mole-output h2 { font-size: 32px; font-weight: 550; color: var(--accent); letter-spacing: -.035em; margin: 12px 0 25px; }
.mole-bar-row { margin: 20px 0; }
.mole-bar-row > div:first-child { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.mole-bar-row b { font-size: 17px; }.mole-bar-row span,.mole-bar-row small { font-size: 11px; color: var(--text2); }
.mole-track { margin: 10px 0 6px; height: 9px; border-radius: 10px; overflow: hidden; background: var(--line); }
.mole-track i { display: block; height: 100%; background: var(--accent); border-radius: 10px; transition: width .25s; }
.mole-products { display: grid; grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); gap: 14px; }
.mole-products > div { background: var(--chip); padding: 16px; border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.mole-products span { display: flex; align-items: center; gap: 10px; }.mole-products b { font-size: 15px; }.mole-products strong { font-size: 24px; font-weight: 500; }.mole-products small { font-size: 11px; color: var(--text2); }
.mole-predict > p { font-size: 12px; color: var(--text2); }.mole-choices { display: flex; gap: 8px; flex-wrap: wrap; }.mole-choices .btn { font-size: 12px; }
.mole-feedback:empty { display: none; }
@media (max-width:1100px) and (min-width:901px) { .atom-panels .col { width: 245px; }.atom-panels .card { padding: 15px; }.atom-drop-target,body[data-tool="atom"] .a-top { left: 268px; right: 268px; }.bw { grid-template-columns: 210px minmax(0,1fr) 225px; gap: 12px; padding-left: 12px; padding-right: 12px; }.eq-f { font-size: 24px; } }
@media (max-width:900px) { .atom-panels { max-height: 49dvh; }.atom-panels .col { width: auto; }.atom-panels .col.right { order: 0; }.atom-panels .col.left { order: 1; }.atom-drop-target { left: 15%; right: 15%; top: 150px; bottom: 51dvh; width: auto; max-width: 350px; }.atom-drop-target b { font-size: 11px; }.atom-drop-target span .ic { width: 36px; height: 36px; }body[data-tool="atom"] .a-top { left: 20px; right: 20px; top: 77px; }body[data-tool="atom"] .a-top .a-explain { display: none; }.atom-panels .atom-mission { order: 1; }.atom-panels .a-build { order: 0; }.atom-panels .pb-row { max-width: 430px; margin: 0 auto 8px; }.bw { grid-template-columns: 1fr; padding: 80px 14px 90px; }.bw > .bw-main { grid-row: 1; }.bw-side:first-child { grid-row: 2; }.bw-side:last-child { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }.mole-layout { grid-template-columns: 1fr; }.mole-page .hub-head { margin-bottom: 24px; }#atom-fallback { width: 220px; height: 220px; top: 30%; } }
@media (max-width:500px) { .nav { gap: 3px; }.tabs { min-width: 0; overflow-x: auto; scrollbar-width: none; }.tabs button { padding-left: 8px; padding-right: 8px; font-size: 10px; }.nav-actions { gap: 0; }.nav-actions .icon-btn { width: 30px; }.embedded-lab #btn-help { display: none; }.bw-side:last-child { grid-template-columns: 1fr; }.mole-layout .card { padding: 18px; } }
.a-identity .sym-tile, .a-identity .sym-tile.big { width: 80px; border-radius: 13px; }
.a-identity .sym-s { font-size: 34px; }
.a-identity .sym-a, .a-identity .sym-z, .a-identity .sym-q { font-size: 12px; }
.a-identity .sym-name { font-size: 7px; }
.particle-removing .a-build { box-shadow: 0 0 0 3px var(--accent-soft); border: 1px dashed var(--accent); }
.a-identity .sym-a { top: 8px; left: 9px; }
.a-identity .sym-z { bottom: 19px; left: 9px; }
.a-identity .sym-q { top: 8px; right: 8px; }
.a-identity .sym-name { bottom: 6px; }
body[data-tool="atom"] .a-top { transform: none; text-align: center; }
@media (max-width:900px) { body[data-tool="atom"] .a-top { right: 70px; }.atom-drop-target { right: 20%; }.atom-panels .col { pointer-events: auto; } }

/* Embedded labs use the shared Zperiod record for backups. */
.embedded-lab .data-btns[hidden] { display:none; }
