/* Unit 1 lesson page. Scoped to .u1 so the rest of the site is untouched. */
.u1 {
  --u-ink: #0E1B2A;
  --u-text: #3A4855;
  --u-muted: #66737F;
  --u-line: rgba(14, 27, 42, 0.08);
  --u-soft: #F4F7F6;
  --u-card: #FFFFFF;
  --u-accent: #0B6E5A;
  --u-yellow: #FFD23F;
  --c-blue: #2a78d6;
  --c-orange: #eb6834;
  --c-aqua: #1baf7a;
  --c-proton: #e34948;
  --c-neutron: #A7B1BA;
  --shadow-sm: 0 1px 2px rgba(14, 27, 42, 0.04), 0 4px 14px rgba(14, 27, 42, 0.05);
  --shadow-lg: 0 2px 4px rgba(14, 27, 42, 0.04), 0 24px 60px -12px rgba(14, 27, 42, 0.14);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  background: #FFFFFF;
  color: var(--u-ink);
}
.u1 p { color: var(--u-text); }
.u1 strong { color: var(--u-ink); }

/* Scroll reveal: only hidden when JS is running */
.js .u1 .rv { opacity: 0; transform: translateY(28px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js .u1 .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .u1 .rv { opacity: 1; transform: none; transition: none; }
  .u1 *, .u1 *::before, .u1 *::after { animation: none !important; }
}

/* Hero */
.u1-hero { position: relative; overflow: hidden; padding: 72px 0 40px; background: radial-gradient(1100px 520px at 85% 10%, #E6F3EF 0%, rgba(230, 243, 239, 0) 60%), radial-gradient(700px 400px at 0% 100%, #FFF6D6 0%, rgba(255, 246, 214, 0) 70%), #FFFFFF; }
.u1-hero .wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 40px; align-items: center; }
.u1-kicker { font-family: var(--mono); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--u-accent); display: inline-flex; align-items: center; gap: 10px; }
.u1-kicker .pill-free { background: var(--u-yellow); color: var(--u-ink); border-radius: 999px; padding: 3px 10px; letter-spacing: 0.06em; }
.u1-hero h1 { font-size: clamp(44px, 7vw, 88px); line-height: 0.98; letter-spacing: -0.035em; margin: 18px 0 22px; }
.u1-hero h1 span:not(.katex, .katex *, :has(> .katex)) { color: var(--u-accent); }
.u1-hero .lede { font-size: clamp(18px, 2vw, 22px); line-height: 1.5; max-width: 34ch; color: var(--u-text); }
.u1-hero .actions { margin-top: 30px; }
.u1-stats { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 40px; }
.u1-stats div { display: flex; flex-direction: column; }
.u1-stats b { font-family: var(--display); font-size: 34px; line-height: 1; }
.u1-stats span:not(.katex, .katex *, :has(> .katex)) { font-size: 14px; color: var(--u-muted); margin-top: 6px; }
.hero-atom { width: 100%; max-width: 520px; justify-self: center; filter: drop-shadow(0 30px 50px rgba(11, 110, 90, 0.18)); }
.spin { transform-box: view-box; transform-origin: 50% 50%; animation: u1spin linear infinite; }
@keyframes u1spin { to { transform: rotate(360deg); } }

/* Chapter nav */
.u1-nav { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, 0.86); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--u-line); }
.u1-nav .wrap { display: flex; gap: 6px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; scrollbar-width: none; }
.u1-nav .wrap::-webkit-scrollbar { display: none; }
.u1-nav a { flex: none; font-size: 14px; font-weight: 500; color: var(--u-muted); text-decoration: none; padding: 8px 14px; border-radius: 999px; transition: background 0.2s, color 0.2s; }
.u1-nav a span:not(.katex, .katex *, :has(> .katex)) { font-family: var(--mono); font-size: 12px; margin-right: 6px; opacity: 0.7; }
.u1-nav a:hover { color: var(--u-ink); background: var(--u-soft); }
.u1-nav a.active { background: var(--u-ink); color: #FFFFFF; }
.u1-progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--u-accent); transform-origin: 0 50%; transform: scaleX(0); }

/* Chapters */
.chapter { padding: 110px 0 40px; scroll-margin-top: 56px; }
.chapter + .chapter { border-top: 1px solid var(--u-line); }
.chapter.alt { background: linear-gradient(180deg, #F7FAF9 0%, #FFFFFF 100%); }
.ch-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 28px; align-items: end; margin-bottom: 56px; }
.ch-num { font-family: var(--display); font-weight: 700; font-size: clamp(72px, 11vw, 140px); line-height: 0.8; letter-spacing: -0.05em; color: transparent; -webkit-text-stroke: 1.5px rgba(11, 110, 90, 0.35); grid-row: span 2; }
.ch-tag { font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--u-accent); }
.ch-head h2 { font-size: clamp(34px, 5vw, 58px); line-height: 1.02; letter-spacing: -0.03em; }

/* A lesson beat: short text + one visual */
.beat { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: center; margin: 0 0 88px; }
.beat.flip > :first-child { order: 2; }
.beat.wide { grid-template-columns: minmax(0, 1fr); gap: 28px; }
.beat-text h3 { font-size: clamp(26px, 3vw, 34px); line-height: 1.12; letter-spacing: -0.02em; margin-bottom: 14px; }
.beat-text p { font-size: 19px; line-height: 1.6; max-width: 42ch; }
.beat-text p + p { margin-top: 12px; }
.beat-text .note { font-size: 15px; color: var(--u-muted); margin-top: 14px; }
.big-eq { display: inline-block; margin-top: 20px; font-family: var(--mono); font-size: clamp(16px, 2vw, 20px); padding: 14px 20px; border-radius: 14px; background: var(--u-ink); color: var(--u-yellow); }
.visual { background: var(--u-card); border-radius: 28px; box-shadow: var(--shadow-lg); border: 1px solid var(--u-line); padding: 28px; }
.visual.plain { background: transparent; box-shadow: none; border: 0; padding: 0; }
.visual svg { display: block; width: 100%; height: auto; }
.cap { font-size: 14px; color: var(--u-muted); margin-top: 14px; text-align: center; }

/* Particle cards */
.particles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.particle { background: var(--u-card); border: 1px solid var(--u-line); border-radius: 22px; padding: 22px 18px; text-align: center; box-shadow: var(--shadow-sm); }
.particle .ball { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--mono); font-size: 20px; font-weight: 500; }
.ball.p { background: radial-gradient(circle at 35% 30%, #ff8a7a, #c9302c); }
.ball.n { background: radial-gradient(circle at 35% 30%, #eef1f4, #8995a0); color: #33404c; }
.ball.e { width: 30px; height: 30px; margin-top: 12px; margin-bottom: 26px; font-size: 14px; background: radial-gradient(circle at 35% 30%, #8cc4ff, #1f5fae); }
.particle b { display: block; font-family: var(--display); font-size: 20px; }
.particle span:not(.katex, .katex *, :has(> .katex)) { font-size: 14px; color: var(--u-muted); }

/* Simulation shell */
.sim { background: var(--u-card); border-radius: 32px; box-shadow: var(--shadow-lg); border: 1px solid var(--u-line); overflow: hidden; margin: 0 0 88px; }
/* Wide inner content (the 18-column table) scrolls in its own box, never the page */
.u1 { overflow-x: clip; }
.sim-panel > *, .sim-stage > * { min-width: 0; max-width: 100%; }
.sim-panel > .u-btn { align-self: flex-start; }
.sim-stage svg { -webkit-user-select: none; user-select: none; }
.ptable-wrap { width: 100%; }

/* site.css has its own .sim / .sim-stage for the Unit 4 page: reset them here */
.u1 .sim { display: block; gap: 0; }
.u1 .sim-stage { flex: none; border: 0; border-radius: 0; }
.sim-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 22px 28px; border-bottom: 1px solid var(--u-line); }
.sim-title { display: flex; align-items: center; gap: 12px; }
.sim-title h3 { font-size: 22px; letter-spacing: -0.01em; }
.sim-badge { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--u-accent); background: #E3F0EC; padding: 5px 10px; border-radius: 999px; }
.sim-hint { font-size: 14px; color: var(--u-muted); }
.sim-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.sim-stage { position: relative; background-color: #F8FAFA; background-image: radial-gradient(rgba(14, 27, 42, 0.07) 1px, transparent 1px); background-size: 22px 22px; padding: 24px; display: flex; align-items: center; justify-content: center; min-width: 0; }
.sim-stage canvas, .sim-stage svg { display: block; width: 100%; height: auto; }
.sim-panel { padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; min-width: 0; border-left: 1px solid var(--u-line); }
.sim-foot { padding: 16px 28px; border-top: 1px solid var(--u-line); font-size: 14px; color: var(--u-muted); background: #FBFCFC; }
.sim.stack .sim-body { grid-template-columns: minmax(0, 1fr); }
.sim.stack .sim-panel { border-left: 0; border-top: 1px solid var(--u-line); }

/* Controls */
.u-btn { font: inherit; font-weight: 600; font-size: 15px; border: 0; border-radius: 999px; padding: 11px 20px; cursor: pointer; background: var(--u-ink); color: #fff; transition: transform 0.15s, background 0.2s, box-shadow 0.2s; display: inline-flex; align-items: center; gap: 8px; }
.u-btn:hover { background: #1F3449; }
.u-btn:active { transform: scale(0.97); }
.u-btn.accent { background: var(--u-accent); }
.u-btn.accent:hover { background: #084F41; }
.u-btn.ghost { background: transparent; color: var(--u-ink); box-shadow: inset 0 0 0 1.5px rgba(14, 27, 42, 0.18); }
.u-btn.ghost:hover { background: var(--u-soft); }
.u-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.u-btn.small { padding: 8px 14px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 14px; font-weight: 500; padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(14, 27, 42, 0.14); background: #fff; color: var(--u-ink); cursor: pointer; transition: all 0.2s; }
.chip:hover { border-color: var(--u-ink); }
.chip[aria-pressed="true"] { background: var(--u-ink); border-color: var(--u-ink); color: #fff; }
.label-sm { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--u-muted); margin-bottom: 8px; display: block; }
.u1 input[type=range] { height: 28px; accent-color: var(--u-accent); }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat-box { background: var(--u-soft); border-radius: 16px; padding: 12px 14px; }
.stat-box span:not(.katex, .katex *, :has(> .katex)) { display: block; font-size: 12px; color: var(--u-muted); }
.stat-box b { font-family: var(--display); font-size: 22px; font-variant-numeric: tabular-nums; }
.u-msg { border-radius: 14px; padding: 12px 16px; font-size: 15px; background: var(--u-soft); color: var(--u-text); }
.u-msg.ok { background: #E3F4EC; color: #0B5A40; }
.u-msg.bad { background: #FDECEA; color: #A12622; }

/* Build an atom */
.el-card { display: grid; grid-template-columns: auto 1fr; gap: 4px 18px; align-items: center; background: linear-gradient(135deg, #0E1B2A, #1D3550); color: #fff; border-radius: 22px; padding: 18px 22px; }
.el-sym { font-family: var(--display); font-weight: 700; font-size: 58px; line-height: 1; grid-row: span 2; min-width: 1.4em; color: var(--u-yellow); }
.el-name { font-family: var(--display); font-size: 22px; font-weight: 700; }
.el-sub { font-size: 14px; color: #B9C6D2; }
.counter { display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 10px; }
.counter .dot { width: 14px; height: 14px; border-radius: 50%; }
.counter .name { font-weight: 600; }
.counter output { font-family: var(--display); font-size: 22px; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.round { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(14, 27, 42, 0.15); background: #fff; font-size: 20px; line-height: 1; cursor: pointer; color: var(--u-ink); transition: all 0.15s; }
.round:hover { background: var(--u-ink); color: #fff; border-color: var(--u-ink); }
.nucleon { transform-box: fill-box; transform-origin: center; animation: pop 0.45s var(--ease) both; }
@keyframes pop { from { transform: scale(0); opacity: 0; } }
.badge-stable { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #E3F4EC; color: #0B5A40; align-self: flex-start; }
.badge-stable.no { background: #FDECEA; color: #A12622; }

/* Isotope twins */
.twins { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.twin { text-align: center; }
.twin svg { max-width: 220px; margin: 0 auto; }
.twin b { font-family: var(--display); font-size: 22px; display: block; margin-top: 8px; }
.twin span:not(.katex, .katex *, :has(> .katex)) { font-size: 14px; color: var(--u-muted); }

/* Spectrum / chart text */
.u1 .axis text, .u1 .tick { font-family: var(--body); font-size: 12px; fill: var(--u-muted); }
.u1 .chart-label { font-family: var(--body); font-size: 12px; fill: var(--u-text); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--u-text); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.iso-slider { display: grid; grid-template-columns: 70px 1fr 56px; align-items: center; gap: 10px; font-size: 14px; }
.iso-slider b { font-family: var(--mono); font-weight: 500; }
.iso-slider output { text-align: right; font-variant-numeric: tabular-nums; color: var(--u-muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* Stepper (worked example, one step at a time) */
.stepper { background: var(--u-card); border-radius: 28px; box-shadow: var(--shadow-sm); border: 1px solid var(--u-line); padding: 30px; display: flex; flex-direction: column; gap: 18px; }
.stepper .kick { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-orange); }
.stepper .q { font-family: var(--display); font-size: clamp(19px, 2.2vw, 23px); line-height: 1.35; font-weight: 700; }
.stepper ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: st; }
.stepper li { counter-increment: st; display: block; position: relative; font-size: 17px; color: var(--u-text); background: var(--u-soft); border-radius: 16px; padding: 12px 16px 12px 58px; min-height: 52px; }
.stepper li::before { content: counter(st); position: absolute; left: 12px; top: 12px; width: 28px; height: 28px; border-radius: 50%; background: var(--u-ink); color: #fff; font-family: var(--mono); font-size: 13px; display: flex; align-items: center; justify-content: center; }
.stepper li.hidden { display: none; }
.stepper li.show { animation: stepIn 0.5s var(--ease) both; }
@keyframes stepIn { from { opacity: 0; transform: translateY(10px); } }
.stepper .dots { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.stepper .dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(14, 27, 42, 0.15); transition: background 0.3s; }
.stepper .dots i.on { background: var(--u-accent); }
.stepper .bar { display: flex; align-items: center; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 88px; }

/* Quick check flip */
.check { background: linear-gradient(135deg, #FFF8DE, #FFFDF4); border: 1px solid #F1DE97; border-radius: 24px; padding: 24px 26px; }
.check summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.check summary::-webkit-details-marker { display: none; }
.check summary .qmark { width: 34px; height: 34px; border-radius: 50%; background: var(--u-yellow); font-family: var(--display); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.check summary .qtext { font-weight: 600; font-size: 17px; line-height: 1.45; }
.check summary .qtext small { display: block; font-weight: 500; font-size: 13px; color: #8A6D00; margin-top: 6px; }
.check[open] summary .qtext small { display: none; }
.check .ans { margin: 14px 0 0 48px; font-size: 16px; animation: stepIn 0.4s var(--ease) both; }

/* Tip line */
.tipline { display: flex; gap: 14px; align-items: flex-start; border-left: 3px solid var(--u-yellow); padding: 4px 0 4px 18px; margin: -40px 0 88px; max-width: 760px; }
.tipline b { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: #8A6D00; flex: none; padding-top: 3px; }
.tipline p { font-size: 16px; margin: 0; }

/* Estimation cards */
.est { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.est > div { background: var(--u-ink); color: #DCE5EC; border-radius: 22px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.est svg { width: 100%; height: auto; }
.est b { color: var(--u-yellow); font-family: var(--display); font-size: 26px; }
.est p { color: #B9C6D2; font-size: 15px; margin: 0; }

/* Matter map */
.matter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.mcard { background: var(--u-card); border-radius: 24px; border: 1px solid var(--u-line); box-shadow: var(--shadow-sm); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.matter.rules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.swipe-hint { display: none; }
.mcard .art { height: 120px; display: flex; align-items: center; justify-content: center; background: var(--u-soft); border-radius: 16px; margin-bottom: 6px; }
.mcard .art svg { height: 100px; width: auto; }
.mcard .grp { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--u-accent); }
.mcard b { font-family: var(--display); font-size: 20px; }
.mcard p { font-size: 14px; margin: 0; }
.mcard small { font-family: var(--mono); font-size: 12px; color: var(--u-muted); }

/* Separation scenes */
.scene-tabs { padding: 18px 28px 0; }
.sep-scene { display: none; }
.sep-scene.on { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; }
.sep-scene .sim-panel p { font-size: 16px; }
.drip { animation: drip 1.6s ease-in infinite; }
@keyframes drip { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(70px); opacity: 0; } }
.steam { animation: steam 3s ease-out infinite; }
@keyframes steam { 0% { transform: translateY(0) scale(0.8); opacity: 0; } 30% { opacity: 0.8; } 100% { transform: translateY(-60px) scale(1.4); opacity: 0; } }
.flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flick 0.18s ease-in-out infinite alternate; }
@keyframes flick { to { transform: scaleY(1.08) scaleX(0.95); } }

/* Mole map */
.molemap { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; max-width: 900px; }
.molemap .mm-node { width: 100%; max-width: 180px; justify-self: center; }
.mm-node { aspect-ratio: 1; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: var(--u-card); box-shadow: var(--shadow-lg); border: 1px solid var(--u-line); padding: 10px; }
.mm-node b { font-family: var(--display); font-size: clamp(18px, 2.4vw, 26px); }
.mm-node span:not(.katex, .katex *, :has(> .katex)) { font-size: 13px; color: var(--u-muted); }
.mm-node.mid { background: radial-gradient(circle at 30% 25%, #1D3550, #0E1B2A); }
.mm-node.mid b { color: var(--u-yellow); }
.mm-node.mid span:not(.katex, .katex *, :has(> .katex)) { color: #B9C6D2; }
.mm-ops { display: flex; flex-direction: column; gap: 8px; font-family: var(--mono); font-size: 13px; text-align: center; }
.mm-ops span:not(.katex, .katex *, :has(> .katex)) { padding: 6px 10px; border-radius: 999px; background: var(--u-soft); white-space: nowrap; }
.mm-ops .f::after { content: " →"; color: var(--u-accent); }
.mm-ops .b::before { content: "← "; color: var(--c-orange); }
.calc-out { font-family: var(--mono); font-size: 14px; color: var(--u-muted); overflow-wrap: anywhere; min-height: 1.4em; }
.u1 .field input { font-size: 18px; border-radius: 14px; border-color: rgba(14, 27, 42, 0.2); }

/* Labs */
.lab-steps { display: flex; flex-direction: column; gap: 8px; }
.lab-step { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: center; font-size: 15px; color: var(--u-muted); }
.lab-step i { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid rgba(14, 27, 42, 0.2); display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 12px; font-family: var(--mono); }
.lab-step.now { color: var(--u-ink); font-weight: 600; }
.lab-step.now i { border-color: var(--u-accent); background: var(--u-accent); color: #fff; }
.lab-step.done i { background: #E3F0EC; border-color: #E3F0EC; color: var(--u-accent); }
.lab-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.lab-table td { padding: 8px 0; border-bottom: 1px solid var(--u-line); }
.lab-table td:last-child { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mover { transition: transform 1s var(--ease); }
.u-fade { transition: opacity 0.8s ease; }

/* Orbital filler */
.ladder { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 520px; position: relative; padding-left: 34px; }
.ladder::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--u-ink), rgba(14, 27, 42, 0.1)); }
.ladder::after { content: "ENERGY"; position: absolute; left: -30px; top: 50%; transform: rotate(-90deg); font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--u-muted); }
.lrow { display: flex; align-items: center; gap: 8px; }
.lrow .lbl { font-family: var(--mono); font-size: 15px; width: 34px; color: var(--u-ink); }
.lrow.d { margin-left: 120px; }
.obox { width: 46px; height: 46px; border-radius: 12px; border: 1.5px solid rgba(14, 27, 42, 0.22); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 22px; line-height: 1; transition: all 0.2s; padding: 0; }
.obox:hover { border-color: var(--u-accent); box-shadow: 0 0 0 4px rgba(11, 110, 90, 0.1); }
.obox .up { color: var(--c-blue); } .obox .dn { color: var(--c-orange); }
.obox.flash { animation: boxflash 0.35s var(--ease); }
@keyframes boxflash { 50% { transform: scale(1.12); } }
.config-big { font-family: var(--mono); font-size: 20px; color: var(--u-ink); min-height: 1.5em; overflow-wrap: anywhere; }

/* Hotel of shells */
.hotel { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.floor { display: flex; align-items: center; gap: 3px; flex-wrap: nowrap; }
.floor span:not(.katex, .katex *, :has(> .katex)) { font-family: var(--mono); font-size: 12px; color: var(--u-muted); width: 46px; flex: none; }
.floor i { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.floor em { width: 8px; flex: none; }
.floor i.s { background: #2a78d6; } .floor i.p { background: #eb6834; } .floor i.d { background: #1baf7a; } .floor i.f { background: #9aa6b0; }
.hotel .legend { margin-top: 8px; }

/* PES element picker */
.pes-table { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; max-width: 380px; }
.pes-table .chip { padding: 7px 0; text-align: center; font-family: var(--mono); font-size: 13px; border-radius: 10px; }

/* Periodic table heatmap */
.ptable-wrap { overflow-x: auto; padding-bottom: 6px; }
.pgrid { display: grid; grid-template-columns: repeat(18, minmax(30px, 1fr)); gap: 4px; min-width: 600px; }
.pcell { aspect-ratio: 1; border: 0; border-radius: 8px; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 0; transition: transform 0.15s, box-shadow 0.15s; }
.pcell b { font-family: var(--display); font-size: 14px; }
.pcell small { font-size: 9px; opacity: 0.85; margin-top: 2px; font-variant-numeric: tabular-nums; }
.pcell:hover { transform: scale(1.1); z-index: 1; box-shadow: 0 6px 18px rgba(14, 27, 42, 0.25); }
.pcell[aria-pressed="true"] { box-shadow: 0 0 0 2.5px #fff, 0 0 0 5px var(--u-ink); z-index: 2; }
.pcell.na { background: repeating-linear-gradient(45deg, #EEF1F3 0 4px, #F8F9FA 4px 8px); color: var(--u-muted); }
.ramp { height: 10px; border-radius: 999px; background: linear-gradient(90deg, #cde2fb, #86b6ef, #3987e5, #1c5cab, #0d366b); }
.ramp-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--u-muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.tt { position: absolute; pointer-events: none; background: var(--u-ink); color: #fff; font-size: 13px; padding: 7px 10px; border-radius: 10px; white-space: nowrap; transform: translate(-50%, -120%); opacity: 0; transition: opacity 0.12s; z-index: 5; }
.tt.on { opacity: 1; }
.chart-box { position: relative; }

/* Ion builder */
.ion-build { display: flex; flex-direction: column; gap: 14px; align-items: center; padding: 10px 0; }
.ion-line { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.ion-tile { height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 18px; color: #fff; animation: pop 0.4s var(--ease) both; }
.ion-tile.cat { background: linear-gradient(135deg, #f08a60, #d4521f); }
.ion-tile.an { background: linear-gradient(135deg, #5b9ce6, #1f5fae); }
.formula-big { font-family: var(--display); font-weight: 700; font-size: clamp(44px, 6vw, 64px); letter-spacing: -0.02em; }

/* ---- Unit 2 pieces ---- */
.bm-sym, .vs-sym, .lw-sym { font-family: var(--display); font-weight: 700; font-size: 20px; fill: var(--u-ink); }
.vs-sym { font-size: 15px; } .vs-sym.light { fill: #fff; font-size: 17px; }
.cb-sym { font-family: var(--display); font-weight: 700; font-size: 18px; fill: #fff; }
.bm-delta { font-family: var(--mono); font-size: 18px; fill: var(--c-orange); }
.bm-sea { animation: sea 3.6s ease-in-out infinite alternate; }
@keyframes sea { to { transform: translate(18px, -10px); } }
.bm-flow { animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -22; } }
.bm-scale { display: flex; flex-direction: column; gap: 6px; }
.bm-bar { position: relative; height: 12px; border-radius: 999px; background: linear-gradient(90deg, #E3F0EC 0%, #86b6ef 25%, #2a78d6 55%, #eb6834 100%); }
.bm-marker { position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--u-ink); transform: translate(-50%, -50%); transition: left 0.6s var(--ease); }
.bm-zones { display: flex; justify-content: space-between; font-size: 12px; color: var(--u-muted); }
.sl-q { font-family: var(--mono); font-size: 16px; font-weight: 500; fill: #fff; }
.sl-c { font-family: var(--mono); font-size: 9px; fill: #fff; }
.sl-rep { font-size: 22px; fill: var(--error, #A12622); animation: stepIn 0.3s both; }
.cb-bars { display: flex; flex-direction: column; gap: 6px; }
.cb-row { display: grid; grid-template-columns: 58px 1fr 74px; gap: 10px; align-items: center; font: inherit; font-size: 14px; background: none; border: 0; padding: 4px 6px; border-radius: 10px; cursor: pointer; text-align: left; color: var(--u-ink); }
.cb-row:hover, .cb-row.on { background: var(--u-soft); }
.cb-row b { font-family: var(--display); }
.cb-row em { font-style: normal; color: var(--u-muted); text-align: right; font-variant-numeric: tabular-nums; }
.cb-track { height: 12px; border-radius: 0 4px 4px 0; background: transparent; }
.cb-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--c-blue); }
.cb-row.on .cb-track i { background: var(--c-orange); }
.bond-table td { font-size: 17px; padding: 14px 6px; }
.bond-table td:first-child { font-family: var(--body); text-align: left; }
.lw-line { stroke: var(--u-ink); stroke-width: 3; stroke-linecap: round; }
.lw-bond { cursor: pointer; outline: none; }
.lw-bond:hover .lw-line, .lw-bond:focus-visible .lw-line { stroke: var(--u-accent); }
.lw-atom { fill: #fff; stroke: rgba(14, 27, 42, 0.25); stroke-width: 1.5; }
.lw-atom.bad { stroke: var(--c-proton); stroke-width: 2.5; stroke-dasharray: 4 3; }
.lw-dot { fill: var(--c-blue); }
.lw-fc { stroke: #fff; stroke-width: 2; } .lw-fc.pos { fill: var(--c-orange); } .lw-fc.neg { fill: var(--c-blue); }
.lw-fct { font-family: var(--mono); font-size: 11px; font-weight: 500; fill: #fff; }
.lw-charge { font-family: var(--mono); font-size: 13px; fill: var(--u-muted); }
.axis-line { stroke: rgba(14, 27, 42, 0.25); stroke-width: 1.5; stroke-dasharray: 6 5; }
.orb { fill: rgba(42, 120, 214, 0.18); stroke: #2a78d6; stroke-width: 1.5; }
.orb.p { fill: rgba(27, 175, 122, 0.16); stroke: #1baf7a; }
.ovl { fill: rgba(235, 104, 52, 0.55); animation: ovl 3.2s ease-in-out infinite; }
.orb-l { animation: orbL 3.2s ease-in-out infinite; }
.orb-r { animation: orbR 3.2s ease-in-out infinite; }
@keyframes orbL { 0%, 15% { transform: translateX(-34px); } 55%, 100% { transform: none; } }
@keyframes orbR { 0%, 15% { transform: translateX(34px); } 55%, 100% { transform: none; } }
@keyframes ovl { 0%, 45% { opacity: 0; } 65%, 100% { opacity: 1; } }

/* ---- Unit 3 pieces ---- */
.imf-d { font-family: var(--mono); font-size: 15px; font-weight: 500; }
.imf-d.pos { fill: var(--c-orange); } .imf-d.neg { fill: var(--c-blue); }
.imf-f { font-family: var(--display); font-weight: 700; font-size: 16px; fill: var(--u-ink); }
.imf-flick .imf-d { animation: flick2 2.8s ease-in-out infinite; }
@keyframes flick2 { 0%, 100% { opacity: 0; } 35%, 65% { opacity: 1; } }
.imf-ldf { stroke: #9aa6b0; stroke-width: 2; stroke-dasharray: 3 5; animation: flick2 2.8s ease-in-out infinite; }
.imf-dd { stroke: #86b6ef; stroke-width: 3; stroke-dasharray: 5 5; }
.imf-hb { stroke: #2a78d6; stroke-width: 4; stroke-dasharray: 7 5; animation: dash 1.2s linear infinite; }
.imf-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.imf-badges span:not(.katex, .katex *, :has(> .katex)) { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--u-soft); color: var(--u-muted); font-size: 14px; font-weight: 600; }
.imf-badges span i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #fff; font-size: 12px; }
.imf-badges span.on:not(.katex, .katex *, :has(> .katex)) { background: #E3F0EC; color: var(--u-accent); }
.imf-badges span.on i { background: var(--u-accent); color: #fff; }
.em-scale { display: flex; flex-direction: column; gap: 6px; }
.em-bar { position: relative; height: 14px; border-radius: 999px; background: linear-gradient(90deg, #3a2f80 0%, #6250d6 30%, #8a4bf0 45.6%, #2a78d6 46.4%, #1baf7a 47.1%, #eda100 47.6%, #e34948 48.2%, #b8682f 52%, #8995a0 100%); }
.em-marker { position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--u-ink); transform: translate(-50%, -50%); }
.em-zones { display: grid; grid-template-columns: 30fr 16fr 3fr 31fr 20fr; white-space: nowrap; font-size: 12px; color: var(--u-muted); }
.em-swatch { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(14, 27, 42, 0.15); }
.rf-out { display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.rf-out div { display: flex; align-items: center; gap: 8px; }
.rf-out i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.rf-out b { margin-left: auto; font-family: var(--mono); font-weight: 500; }

/* ---- Unit 4 pieces ---- */
.ra-lab { font-family: var(--display); font-weight: 700; font-size: 14px; fill: var(--u-ink); pointer-events: none; }
.ra-lab.small { font-size: 9px; }
.ra-op { font-family: var(--display); font-size: 28px; fill: var(--u-muted); }
.ra-txt { font-size: 13px; fill: var(--u-muted); }
.ra-tag { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.ra-tag.a { fill: var(--c-orange); } .ra-tag.b { fill: var(--c-blue); }
.sort-item { font-family: var(--display); font-weight: 700; font-size: clamp(24px, 3.4vw, 36px); line-height: 1.2; max-width: 640px; padding: 28px 32px; border-radius: 24px; background: var(--u-soft); transition: transform 0.4s var(--ease), background 0.3s; }
.sort-item.flip { transform: scale(0.97); background: #EEF6F3; }
.ni-eq { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ni-tile { font: inherit; font-family: var(--display); font-weight: 700; font-size: 16px; padding: 7px 11px; border-radius: 10px; border: 1.5px solid rgba(14, 27, 42, 0.18); background: #fff; color: var(--u-ink); cursor: pointer; position: relative; transition: all 0.2s; }
.ni-tile em { font-style: normal; color: var(--c-orange); }
.ni-tile small { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--u-muted); margin-left: 2px; }
.ni-tile.solid { background: #FFF6D6; border-color: #E6CF7A; }
.ni-tile:hover { border-color: var(--u-ink); }
.ni-tile.x { opacity: 0.45; text-decoration: line-through; text-decoration-thickness: 2.5px; text-decoration-color: var(--c-proton); }
.ni-op { font-family: var(--display); font-size: 18px; color: var(--u-muted); }
.ni-op.arrow { font-size: 22px; color: var(--u-ink); margin: 0 4px; }
.eq-big { font-family: var(--display); font-weight: 700; font-size: clamp(18px, 2.2vw, 22px); color: var(--u-ink); line-height: 1.4; }
.ni-steps td:first-child { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--u-muted); width: 120px; text-align: left; }
.ni-steps td:last-child { font-family: var(--body); font-size: 16px; text-align: left; }
.ni-steps s { color: var(--c-proton); }
.bridge-form, .ox-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.bridge-form .field:first-child { grid-column: 1 / -1; }
.u1 select { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(14, 27, 42, 0.2); font: inherit; background: #fff; }
.bridge { display: grid; grid-template-columns: repeat(7, auto); align-items: center; gap: 8px; justify-content: start; overflow-x: auto; padding: 6px 0 4px; }
.br-node { background: var(--u-soft); border-radius: 18px; padding: 14px 16px; min-width: 112px; text-align: center; }
.br-node span:not(.katex, .katex *, :has(> .katex)) { display: block; font-size: 12px; color: var(--u-muted); }
.br-node b { font-family: var(--display); font-size: 20px; white-space: nowrap; }
.br-node.mid { background: var(--u-ink); } .br-node.mid span:not(.katex, .katex *, :has(> .katex)) { color: #B9C6D2; } .br-node.mid b { color: var(--u-yellow); }
.br-node.end { background: #E3F0EC; } .br-node.end b { color: var(--u-accent); }
.br-arrow { font-family: var(--mono); font-size: 12px; color: var(--u-muted); text-align: center; max-width: 130px; }
.br-arrow i { font-style: normal; display: block; }
.br-arrow::after { content: "→"; display: block; font-size: 22px; color: var(--u-ink); }
.br-arrow.ratio i { color: var(--c-orange); font-weight: 500; }
.ox-form { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); max-width: 420px; }
.ox-table td { font-family: var(--body); font-size: 15px; text-align: left; }
.ox-table td:nth-child(2) { font-family: var(--mono); text-align: center; width: 60px; }
.ox-table td:last-child { color: var(--u-muted); }
.half-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--u-soft); }
.half-row b { font-family: var(--mono); min-width: 32px; text-align: center; }
.half-tag { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; width: 90px; }
.half-row.ox .half-tag { color: var(--c-orange); } .half-row.red .half-tag { color: var(--c-blue); }
.half-eq { font-family: var(--display); font-weight: 700; font-size: 18px; flex: 1 1 220px; }
.half-row em { font-style: normal; font-size: 13px; color: var(--u-muted); }
@media (max-width: 640px) {
  .bridge { grid-template-columns: 1fr; justify-items: stretch; }
  .br-arrow { max-width: none; }
  .br-arrow::after { content: "↓"; }
}

/* ---- Unit 5 pieces ---- */
.u1 .lab-table th { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--u-muted); font-weight: 500; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--u-line); }
.tg-table td, .rl-table td { font-size: 14px; padding: 8px 6px; text-align: left; }
.rl-pick { font-family: var(--display); font-weight: 700; font-size: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.rl-pick select { width: auto; min-height: 36px; padding: 2px 6px; font-size: 15px; font-family: var(--mono); border-radius: 8px; vertical-align: super; margin-right: 6px; }
.rl-how { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--u-text); }
.rl-how:empty { display: none; }
.il-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.il-plot { border: 1.5px solid var(--u-line); border-radius: 18px; padding: 12px; transition: border-color 0.3s, box-shadow 0.3s; }
.il-plot.lin { border-color: var(--u-accent); box-shadow: 0 0 0 4px rgba(11, 110, 90, 0.1); }
.il-r2 { display: block; font-size: 13px; color: var(--u-muted); min-height: 1.2em; }
.il-plot.lin .il-r2 { color: var(--u-accent); font-weight: 600; }
.mech-steps { display: flex; flex-direction: column; gap: 8px; }
.mech-step { font: inherit; text-align: left; display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 16px; border: 1.5px solid rgba(14, 27, 42, 0.14); background: #fff; cursor: pointer; color: var(--u-ink); }
.mech-step:disabled { cursor: default; background: var(--u-soft); }
.mech-step em { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--u-muted); }
.mech-step b { font-family: var(--display); font-size: 19px; }
.mech-step small { font-size: 12px; color: var(--u-muted); }
.mech-step.slow { border-color: var(--c-orange); background: #FFF3EE; }
.mech-step.slow small { color: var(--c-orange); font-weight: 700; }
.mech-step span.int:not(.katex, .katex *, :has(> .katex)) { color: var(--c-orange); } .mech-step span.cat:not(.katex, .katex *, :has(> .katex)) { color: var(--c-aqua); }
@media (max-width: 960px) { .il-row { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .mech-step { grid-template-columns: 1fr; gap: 4px; } }

/* ---- Unit 6 pieces ---- */
.heat-out { animation: heatOut 2s ease-out infinite; }
.heat-in { animation: heatIn 2s ease-in infinite; }
@keyframes heatOut { 0% { transform: translateY(0); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-26px); opacity: 0; } }
@keyframes heatIn { 0% { transform: translateY(-26px); opacity: 0; } 60% { opacity: 1; } 100% { transform: translateY(0); opacity: 0; } }
.thermo { flex: none; width: 26px; height: 220px; border-radius: 13px; border: 3px solid #5D6B77; background: #fff; position: relative; overflow: hidden; }
.thermo-fill { position: absolute; left: 0; right: 0; bottom: 0; transition: height 0.9s var(--ease), background 0.4s; }
.hf-table th { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--u-muted); text-align: left; padding-top: 14px; }
.hf-table td { font-family: var(--body); font-size: 15px; }
.hf-table td:first-child { text-align: left; }
.hess-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 16px; background: var(--u-soft); }
.hess-row .h-eq { font-family: var(--display); font-weight: 700; font-size: 18px; }
.hess-row .h-dh { font-family: var(--mono); font-size: 14px; color: var(--u-text); }
.hess-row .h-ctl { display: flex; align-items: center; gap: 8px; }
.hess-row .h-ctl b { font-family: var(--mono); min-width: 36px; text-align: center; }
.hess-row.sum { background: var(--u-ink); color: #fff; }
.hess-row.sum .h-dh { color: var(--u-yellow); }
@media (max-width: 640px) { .hess-row { grid-template-columns: 1fr; } }

/* ---- Unit 7 pieces ---- */
.qk-gauge { position: relative; height: 46px; border-radius: 999px; background: linear-gradient(90deg, #E3F0EC 0%, #F4F7F6 50%, #FFF3EE 100%); margin: 6px 0; }
.qk-gauge::before { content: "← shifts toward products"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--u-muted); }
.qk-gauge::after { content: "toward reactants →"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--u-muted); }
.qk-k, .qk-q { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; color: #fff; transition: left 0.4s var(--ease); z-index: 1; }
.qk-k { background: var(--u-ink); } .qk-q { background: var(--c-orange); width: 30px; height: 30px; }
.ice-table td, .ice-table th { text-align: center; font-family: var(--mono); font-size: 14px; }
.ice-table td:first-child { font-weight: 600; color: var(--u-accent); }

/* ---- Unit 8 pieces ---- */
.ph-scale { display: flex; flex-direction: column; gap: 6px; }
.ph-bar { position: relative; height: 14px; border-radius: 999px; background: linear-gradient(90deg, #e34948 0%, #eb6834 20%, #eda100 35%, #1baf7a 50%, #2a78d6 70%, #6250d6 100%); }
.ph-marker { position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--u-ink); transform: translate(-50%, -50%); transition: left 0.5s var(--ease); }
.salt-box { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 18px; background: var(--u-soft); }
.salt-box span:not(.katex, .katex *, :has(> .katex)) { font-family: var(--display); font-weight: 700; font-size: 22px; }
.salt-res { font-family: var(--display); font-size: 20px; padding: 6px 14px; border-radius: 999px; background: #fff; }
.salt-res.n { color: var(--u-accent); } .salt-res.a { color: #c9302c; } .salt-res.b { color: var(--c-blue); }

/* ---- Math (KaTeX) ---- */
.u1 .katex { font-size: 1.08em; line-height: 1.2; text-transform: none; letter-spacing: normal; font-weight: normal; }
.u1 .grid-2 > *, .u1 .beat > *, .u1 .sim-panel > *, .u1 .matter > * { min-width: 0; }
.u1 .katex.katex-wide { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; padding-bottom: 2px; }
.u1 .katex-display { margin: 0.4em 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.u1 .big-eq .katex { font-size: 1em; }
.u1 .calc-out .katex, .u1 code .katex { font-size: 1.05em; }
.u1 .chip .katex, .u1 .u-btn .katex { font-size: 1em; }
.u1 .label-sm .katex { font-size: 1.3em; color: var(--u-ink); }

/* card grids built in the Studio */
.matter.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.matter.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.matter.cols-fit { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
@media (max-width: 640px) { .matter.cols-2, .matter.cols-3 { grid-template-columns: minmax(0, 1fr); } }

/* ---- Unit 9 pieces ---- */
.slider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.rx-line { font-family: var(--mono); font-size: 15px; padding: 12px 14px; border-radius: 14px; background: var(--u-soft); overflow-wrap: anywhere; }
.half-rx { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.half-rx li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: baseline; font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
.half-rx li > span { font-family: var(--body); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--u-muted); }
.half-rx li.ox > span { color: #c9302c; } .half-rx li.red > span { color: var(--c-blue); }
.plate-stage { position: relative; width: 100%; max-width: 340px; margin: 0 auto; height: 220px; border: 3px solid #5D6B77; border-top: 0; border-radius: 18px; background: linear-gradient(180deg, #fff 0 30%, rgba(158, 197, 244, 0.35) 30%); display: flex; align-items: flex-start; justify-content: center; padding-top: 20px; }
.cathode { position: relative; width: 26px; height: 170px; border-radius: 4px; background: #5D6B77; display: flex; justify-content: center; }
.plate { position: absolute; bottom: 0; height: 110px; border-radius: 6px; background: #c97b3b; opacity: 0.9; transition: width 0.4s var(--ease); }
.plate-stage .tick-lbl { position: absolute; left: 14px; bottom: 12px; font-size: 13px; color: var(--u-muted); }
.faraday-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 15px; overflow-wrap: anywhere; }

/* Equation sheet + practice */
.sheet { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.sheet div { background: var(--u-card); border: 1px solid var(--u-line); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow-sm); }
.sheet code { font-family: var(--mono); font-size: 16px; color: var(--u-ink); display: block; margin-bottom: 4px; }
.sheet span:not(.katex, .katex *, :has(> .katex)) { font-size: 14px; color: var(--u-muted); }
.mistakes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 28px; }
.mistakes div { border-radius: 18px; padding: 18px 20px; background: #FDF1EF; color: #7A231F; font-size: 15px; }
.mistakes b { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.finale { margin: 80px 0 0; border-radius: 36px; padding: clamp(32px, 6vw, 64px); background: radial-gradient(600px 300px at 90% 0%, #1F4D44 0%, rgba(31, 77, 68, 0) 70%), #0E1B2A; color: #fff; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.finale h2 { color: #fff; font-size: clamp(32px, 4.5vw, 52px); letter-spacing: -0.03em; }
.finale p { color: #B9C6D2; margin-top: 10px; font-size: 18px; }

@media (max-width: 960px) {
  .u1-hero .wrap { grid-template-columns: 1fr; }
  .hero-atom { max-width: 360px; order: -1; }
  .beat, .beat.flip { grid-template-columns: 1fr; gap: 28px; }
  .beat.flip > :first-child { order: 0; }
  .sim-body, .sep-scene.on { grid-template-columns: 1fr; }
  .sim-panel { border-left: 0; border-top: 1px solid var(--u-line); }
  .matter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .est { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .finale { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .chapter { padding-top: 72px; }
  .ch-head { grid-template-columns: 1fr; margin-bottom: 36px; }
  .ch-num { font-size: 72px; grid-row: auto; }
  .beat { margin-bottom: 60px; }
  .sim, .grid-2 { margin-bottom: 60px; }
  .sim-head, .sim-panel { padding-left: 18px; padding-right: 18px; }
  .sim-stage { padding: 14px; }
  .particles { grid-template-columns: 1fr; }
  .particle { display: grid; grid-template-columns: 60px 1fr; text-align: left; align-items: center; gap: 4px 14px; }
  .particle .ball { grid-row: span 2; margin: 0; }
  .particle .ball.e { margin: 0 12px; }
  .matter { grid-template-columns: 1fr; }
  .molemap { grid-template-columns: 1fr; justify-items: center; }
  .mm-node { width: 150px; }
  .mm-ops { flex-direction: row; }
  .mm-ops .f::after { content: " ↓"; }
  .mm-ops .b::before { content: "↑ "; }
  .lrow.d { margin-left: 0; }
  .obox { width: 38px; height: 38px; font-size: 18px; }
  .ladder { padding-left: 26px; }
  .matter.rules { grid-template-columns: 1fr; }
  .swipe-hint { display: block; }
  .stepper { padding: 22px; }
  .stepper li { font-size: 16px; }
  .tipline { margin-top: -28px; margin-bottom: 60px; }
  .twins { grid-template-columns: 1fr 1fr; gap: 10px; }
  .floor i { width: 12px; height: 12px; border-radius: 3px; }
  .floor em { width: 5px; }
  .floor span:not(.katex, .katex *, :has(> .katex)) { width: 40px; }
}
