:root {
  --bg: #0a0d12; --panel: #10151c; --panel2: #151c25; --panel3: #1a2330; --line: #1f2a37; --line2: #2a3848;
  --text: #e4eaf1; --mut: #8b9aad; --dim: #5b6a7d;
  --acc: #4cc3ff; --acc-bg: #0e2a3d; --acc2: #7c9cff; --hot: #ff7a45; --cold: #5ab0ff; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
  --mono: 'JetBrains Mono', 'Consolas', ui-monospace, monospace;
  --r: 8px; --top: 52px; --foot: 26px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: Pretendard, 'Noto Sans KR', system-ui, sans-serif; font-size: 13.5px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
input[type=number] { font-variant-numeric: tabular-nums; }
svg:not([viewBox]) { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); font-size: 12px; }
.mut { color: var(--mut); }
.grow { flex: 1; }
h4 { margin: 0 0 8px; font-size: 12px; color: var(--mut); font-weight: 600; letter-spacing: .02em; }
sub, sup { font-size: 70%; line-height: 0; }
kbd { font-family: var(--mono); font-size: 10.5px; color: var(--mut); background: var(--panel3); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; line-height: 16px; display: inline-block; }
em { font-style: normal; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #243140; border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #33465a; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }

/* ── 상단 ── */
.top { height: var(--top); display: flex; align-items: center; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--line); background: #0c1016; }
.brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; text-decoration: none; color: inherit; padding-right: 6px; }
.brand .logo { width: 26px; height: 26px; }
.brand b { display: block; font-size: 14.5px; letter-spacing: .01em; }
.brand small { display: block; color: var(--dim); font-size: 11px; margin-top: -1px; }
.nav { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; }
.grp { display: flex; align-items: center; gap: 2px; padding: 0 8px; border-left: 1px solid var(--line); }
.grp:first-child { border-left: 0; padding-left: 0; }
.gl { font-size: 10.5px; color: var(--dim); letter-spacing: .08em; margin-right: 4px; font-weight: 600; }
.nav button { display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 7px 10px; border-radius: 7px; color: var(--mut); cursor: pointer; white-space: nowrap; flex: none; font-size: 13px; }
.nav button svg { width: 15px; height: 15px; opacity: .8; }
.nav button:hover { background: var(--panel2); color: var(--text); }
.nav button.on { background: var(--acc-bg); color: var(--acc); }
.nav button.on svg { opacity: 1; }
.cmdk { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 8px 6px 10px; color: var(--dim); cursor: pointer; min-width: 250px; }
.cmdk span { flex: 1; text-align: left; font-size: 12.5px; }
.cmdk:hover { border-color: var(--acc); color: var(--mut); }
.ibtn { display: inline-grid; place-items: center; width: 30px; height: 30px; background: none; border: 1px solid transparent; border-radius: 7px; color: var(--mut); cursor: pointer; flex: none; }
.ibtn:hover { background: var(--panel2); border-color: var(--line2); color: var(--text); }
.ibtn:disabled { opacity: .3; cursor: default; background: none; border-color: transparent; }

main { height: calc(100% - var(--top) - var(--foot)); }
.tab { display: none; height: 100%; }
.tab.on { display: grid; }

.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 7px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn svg { width: 14px; height: 14px; }
.btn:hover { border-color: var(--acc); }
.btn.primary { background: #0f3a55; border-color: #1b6a96; color: #d7f1ff; font-weight: 600; min-width: 92px; justify-content: center; }
.btn.primary:hover { background: #134868; }
.btn.sm { padding: 3px 9px; font-size: 12px; }

/* 분절 단추 */
.seg { display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; background: none; border: 0; padding: 5px 11px; border-radius: 6px; color: var(--mut); cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.seg button svg { width: 14px; height: 14px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel3); color: var(--acc); box-shadow: 0 1px 0 #0006; }
.seg button em { font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.seg button.on em { color: var(--acc); opacity: .75; }
.seg button em.w { color: var(--bad); opacity: 1; }
.seg.full { display: flex; margin: 10px 10px 0; }
.seg.full button { flex: 1; }

.search { display: flex; align-items: center; gap: 7px; background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 0 8px; }
.search:focus-within { border-color: var(--acc); }
.search svg { color: var(--dim); width: 15px; height: 15px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 7px 0; }

/* ── 실험대 ── */
#tab-lab { grid-template-columns: 300px minmax(0, 1fr) 460px; }
.shelf { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.shelf-head { padding: 10px; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chips button { background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; font-size: 11.5px; cursor: pointer; color: var(--mut); }
.chips button:hover { color: var(--text); }
.chips button.on { border-color: var(--acc); color: var(--acc); background: var(--acc-bg); }
.shelf-list { flex: 1; overflow: auto; padding: 0 6px 8px; min-height: 0; }
.shelf-list[hidden] { display: none; }
.gh { position: sticky; top: 0; z-index: 1; background: var(--panel); display: flex; justify-content: space-between; padding: 9px 6px 4px; font-size: 11px; color: var(--dim); font-weight: 600; letter-spacing: .04em; border-bottom: 1px solid var(--line); margin-bottom: 3px; }
.gh em { font-family: var(--mono); font-weight: 400; }
.rg { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: 7px; cursor: pointer; }
.rg:hover { background: var(--panel2); }
.rg:hover .add { color: var(--acc); }
.rg .sw { width: 18px; height: 24px; border-radius: 2px 2px 5px 5px; border: 1px solid #ffffff30; flex: none; position: relative; overflow: hidden; background: #ffffff0d; }
.rg .sw i { position: absolute; left: 0; right: 0; bottom: 0; height: 62%; opacity: .6; }
.rg .sw.solid i { opacity: .9; }
.rg .sw.solid { border-radius: 50%; height: 18px; } .rg .sw.solid i { height: 100%; }
.rg .sw.gas { border-radius: 4px; border-style: dashed; } .rg .sw.gas i { height: 100%; opacity: .5; }
.rg .nm { flex: 1; min-width: 0; }
.rg .nm b { display: block; font-weight: 500; font-size: 12.8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg .nm span { font-family: var(--mono); font-size: 11px; color: var(--mut); }
.rg .hz { width: 7px; height: 7px; transform: rotate(45deg); background: var(--bad); flex: none; border-radius: 1px; opacity: .85; }
.rg .add { color: var(--dim); font-size: 16px; width: 14px; text-align: center; }
.rg.in .add { color: var(--ok); }
.pr { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 7px; cursor: pointer; color: var(--text); }
.pr:hover { background: var(--panel2); }
.pr.on { background: var(--acc-bg); }
.pr b { display: block; font-weight: 500; font-size: 12.8px; }
.pr small { display: block; color: var(--mut); font-size: 11px; font-family: var(--mono); margin-top: 1px; }
.shelf-foot { border-top: 1px solid var(--line); padding: 7px 12px; font-size: 11px; }
.shelf-foot b { color: var(--text); font-weight: 500; }

.stage { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; min-height: 0; min-width: 0; }
.view { position: relative; min-height: 0; background: radial-gradient(ellipse at 50% 30%, #17212c, #07090d 75%); }
#c3d { width: 100%; height: 100%; display: block; }
.view-tabs { position: absolute; top: 10px; left: 10px; background: #0a0d12d9; backdrop-filter: blur(6px); }
.hud { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; pointer-events: none; }
.hud .pill { background: #0a0d12d9; border: 1px solid var(--line); border-radius: 7px; padding: 4px 10px; font-family: var(--mono); font-size: 11.5px; color: var(--mut); backdrop-filter: blur(6px); }
.hud .pill b { color: var(--acc); font-weight: 600; margin-left: 4px; }
.hud .pill.hot b { color: var(--hot); }
.hud .pill.cold b { color: var(--cold); }
.obs { position: absolute; left: 10px; bottom: 10px; max-width: 62%; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.obs div { background: #0a0d12e6; border-left: 3px solid var(--acc); padding: 5px 10px; border-radius: 0 6px 6px 0; font-size: 12px; animation: fade .5s; }
.obs div.w { border-color: var(--bad); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.mol-cap { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: #0a0d12e6; border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px; font-size: 12.5px; display: none; text-align: center; max-width: 92%; }
.mol-cap .sel { display: flex; gap: 4px; justify-content: center; margin-top: 6px; flex-wrap: wrap; pointer-events: auto; }
.mol-cap .sel button { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 11.5px; cursor: pointer; color: var(--mut); }
.mol-cap .sel button.on { border-color: var(--acc); color: var(--acc); }
.mol-cap small { color: var(--dim); display: block; margin-top: 4px; }

.timeline { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.timeline input[type=range] { flex: 1; accent-color: var(--acc); }
.timeline .tl { min-width: 92px; text-align: right; color: var(--mut); }

.flask { border-top: 1px solid var(--line); background: var(--panel); padding: 8px 12px 10px; max-height: 260px; overflow: auto; }
.ph { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ph h4 { margin: 0; flex: 1; }
.ph h4 em { font-family: var(--mono); color: var(--dim); font-weight: 400; margin-left: 4px; }
.cond { display: flex; gap: 6px; align-items: center; color: var(--mut); font-size: 12px; }
.cond label { display: flex; align-items: center; gap: 5px; background: var(--bg); border: 1px solid var(--line2); border-radius: 7px; padding: 0 8px 0 9px; height: 28px; }
.cond label:focus-within { border-color: var(--acc); }
.cond input[type=number] { width: 52px; background: none; border: 0; outline: 0; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--text); }
.cond i { font-style: normal; color: var(--dim); font-size: 11.5px; }
.cond .sw { cursor: pointer; }
.cond .sw input { accent-color: var(--hot); margin: 0; }
.cond .sw svg { width: 14px; height: 14px; color: var(--hot); }
.cond .sw:has(input:checked) { border-color: #ff7a4580; color: var(--hot); background: #2a140b; }
.acts { display: flex; gap: 2px; }
.contents { margin-top: 8px; }
.empty { color: var(--dim); margin: 0; }
.empty.big { padding: 40px 24px; text-align: center; line-height: 1.7; }
.empty.drop { border: 1px dashed var(--line2); border-radius: 8px; padding: 14px; text-align: center; font-size: 12.5px; line-height: 1.6; }
table.vt { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.vt th { text-align: left; font-weight: 500; color: var(--dim); font-size: 11px; padding: 3px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.vt th.r, .vt td.r { text-align: right; }
.vt td { padding: 4px 6px; border-bottom: 1px solid #18212c; vertical-align: middle; }
.vt tr:hover td { background: #ffffff05; }
.vt .nm b { font-weight: 500; }
.vt .nm span { display: block; font-family: var(--mono); font-size: 11px; color: var(--mut); }
.vt .fm { font-size: 10.5px; color: var(--mut); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.vt .amt { display: flex; gap: 4px; align-items: center; color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.vt .amt input { width: 66px; background: var(--bg); border: 1px solid var(--line2); border-radius: 5px; padding: 3px 6px; text-align: right; font-family: var(--mono); font-size: 12px; outline: 0; }
.vt .amt input:focus { border-color: var(--acc); }
.vt .amt input.over { border-color: var(--warn); color: var(--warn); }
.vt td.n { font-family: var(--mono); font-size: 11.5px; color: var(--mut); white-space: nowrap; }
.vt .x { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 4px; }
.vt .x:hover { color: var(--bad); background: #f871711a; }
.vt tr.tot td { border-bottom: 0; color: var(--dim); font-size: 11.5px; padding-top: 6px; }

/* 결과 */
.result { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.rbody { flex: 1; overflow: auto; padding: 12px 14px 20px; }
.sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.sum div { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; }
.sum div small { display: block; color: var(--mut); font-size: 10.5px; }
.sum div b { font-family: var(--mono); font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sum .hot b { color: var(--hot); } .sum .cold b { color: var(--cold); }
.sec { margin: 16px 0 7px; font-size: 11.5px; color: var(--mut); font-weight: 600; display: flex; justify-content: space-between; align-items: center; letter-spacing: .02em; gap: 8px; }
.sec:first-child { margin-top: 0; }
.ovl { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ov { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 8px; align-items: center; padding: 7px 10px; background: var(--bg); border-top: 1px solid var(--line); cursor: pointer; text-align: left; border-left: 0; border-right: 0; border-bottom: 0; }
.ov:first-child { border-top: 0; }
.ov:hover { background: var(--panel2); }
.ov.sel { background: var(--acc-bg); }
.ov .i { font-family: var(--mono); color: var(--dim); font-size: 11px; }
.ov .eq { font-size: 12px; }
.ov .k { grid-column: 2 / -1; display: flex; gap: 12px; font-family: var(--mono); font-size: 11px; color: var(--mut); flex-wrap: wrap; }
.ov .k b { color: var(--text); font-weight: 500; }
.step { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; }
.step.sel { border-color: #4cc3ff99; }
.step .hd { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.step .hd .i { font-family: var(--mono); color: var(--dim); font-size: 11px; margin-right: 6px; }
.tag { font-size: 10.5px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line2); color: var(--mut); white-space: nowrap; }
.tag.acidbase { color: #a5b4fc; border-color: #4f46e566; } .tag.precip { color: #fde68a; border-color: #ca8a0466; }
.tag.redox { color: #fca5a5; border-color: #dc262666; } .tag.complex { color: #93c5fd; border-color: #2563eb66; }
.tag.combust, .tag.thermite { color: #fdba74; border-color: #ea580c66; } .tag.degas { color: #99f6e4; border-color: #0d948866; }
.tag.dissolve, .tag.hydration, .tag.absorb, .tag.acidsol { color: #cbd5e1; } .tag.ester, .tag.sn2, .tag.da { color: #f0abfc; border-color: #c026d366; }
.eq { font-family: var(--mono); font-size: 12px; line-height: 1.6; word-break: break-word; }
.eq.net { color: #e8f4ff; }
.eq.mol { color: var(--mut); font-size: 11px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 10px; margin-top: 7px; font-family: var(--mono); font-size: 11px; }
.kv span { color: var(--mut); white-space: nowrap; }
.kv span b { color: var(--text); font-weight: 500; }
.step .ob { margin-top: 6px; font-size: 12px; color: #c7e6ff; }
.step .nt { margin-top: 5px; font-size: 11.5px; color: var(--mut); line-height: 1.55; }
.step .src { margin-top: 5px; font-size: 10.5px; color: var(--dim); font-family: var(--mono); }
.step .mbtn { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; background: none; border: 1px solid var(--line2); border-radius: 6px; color: var(--acc); cursor: pointer; padding: 2px 7px; }
.step .mbtn svg { width: 12px; height: 12px; }
.note { font-size: 12px; color: var(--mut); background: var(--bg); border: 1px dashed var(--line2); border-radius: 7px; padding: 7px 10px; margin-bottom: 6px; line-height: 1.55; }
.note.w { border: 1px solid #f8717166; color: #fecaca; background: #220d10; }
.note.b { border-style: solid; }
.note.i { border: 1px solid #4cc3ff40; background: #0b1c28; color: #bfe3f7; }
table.comp { width: 100%; border-collapse: collapse; font-size: 12px; }
table.comp th { text-align: left; color: var(--mut); font-weight: 500; border-bottom: 1px solid var(--line); padding: 4px 6px; font-size: 11px; }
table.comp th.r { text-align: right; }
table.comp td { padding: 3px 6px; border-bottom: 1px solid #18212c; font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; }
table.comp td:first-child { font-family: inherit; }
table.comp td.r { text-align: right; }
table.comp tr.grp td { color: var(--dim); font-family: inherit; font-size: 10.5px; padding-top: 8px; letter-spacing: .04em; }
.ediag { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); }
.haz li { font-size: 12px; color: #fecaca; margin-bottom: 3px; }
.haz { padding-left: 18px; margin: 4px 0; }
.hzr { display: grid; grid-template-columns: 1fr; gap: 5px; }
.hzr div { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; }
.hzr b { font-weight: 500; font-size: 12.5px; }
.hzr span { display: inline-block; font-size: 11px; color: #fecaca; border: 1px solid #f8717155; background: #220d10; border-radius: 4px; padding: 0 6px; margin: 4px 4px 0 0; }
.asm { margin: 0; padding-left: 18px; color: var(--mut); font-size: 12px; line-height: 1.65; }
.asm li { margin-bottom: 3px; }
.dl { display: flex; gap: 4px; }
.lnk { background: none; border: 0; color: var(--acc); cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }

/* ── 상태 표시줄 ── */
.status { height: var(--foot); display: flex; align-items: center; gap: 0; border-top: 1px solid var(--line); background: #0c1016; font-size: 11px; color: var(--dim); padding: 0 10px; overflow: hidden; white-space: nowrap; }
.status span { padding: 0 10px; border-left: 1px solid var(--line); display: inline-flex; align-items: center; gap: 5px; }
.status span:first-child { border-left: 0; padding-left: 2px; }
.status b { color: var(--mut); font-weight: 500; font-family: var(--mono); }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; }
.status .dot.w { background: var(--warn); }
.status .r { margin-left: auto; }

/* ── 통합 검색 ── */
.pal-back { position: fixed; inset: 0; background: #03050899; backdrop-filter: blur(2px); z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding-top: 10vh; }
.pal-back[hidden] { display: none; }
.pal { width: min(680px, calc(100% - 32px)); background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 24px 80px #000c; overflow: hidden; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.pal-in svg { width: 18px; height: 18px; color: var(--dim); }
.pal-in input { flex: 1; background: none; border: 0; outline: 0; padding: 15px 0; font-size: 15px; }
.pal-list { max-height: 56vh; overflow: auto; padding: 6px; }
.pal-list .gh { background: var(--panel); }
.pi { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.pi.on { background: var(--acc-bg); }
.pi .ty { font-size: 10.5px; color: var(--dim); border: 1px solid var(--line2); border-radius: 4px; padding: 0 6px; min-width: 58px; text-align: center; flex: none; }
.pi.on .ty { color: var(--acc); border-color: #4cc3ff55; }
.pi .tx { flex: 1; min-width: 0; }
.pi .tx b { font-weight: 500; }
.pi .tx span { color: var(--mut); font-size: 11.5px; margin-left: 8px; font-family: var(--mono); }
.pi .go { color: var(--dim); font-size: 11px; }
.pal-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--dim); }
.pal-foot kbd { margin-right: 2px; }
.keys { padding: 18px 22px; }
.keys h3 { margin: 0 0 12px; font-size: 15px; }
.keys dl { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; margin: 0 0 14px; font-size: 12.5px; }
.keys dt { display: flex; gap: 3px; align-items: center; }
.keys dd { margin: 0; color: var(--mut); }
.keys p { font-size: 12px; margin: 0; line-height: 1.6; }
.toast { position: fixed; left: 50%; bottom: 42px; transform: translate(-50%, 20px); background: var(--panel3); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 16px; font-size: 12.5px; opacity: 0; transition: .2s; pointer-events: none; z-index: 60; box-shadow: 0 8px 30px #0008; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── 주기율표 ── */
#tab-pt { grid-template-rows: auto minmax(0, 1fr); }
.pt-bar { padding: 8px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 18px; align-items: center; flex-wrap: wrap; color: var(--mut); background: var(--panel); }
.pt-bar select { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 4px 8px; margin-left: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.legend .grad { width: 160px; height: 10px; border-radius: 3px; display: inline-block; vertical-align: middle; margin: 0 6px; }
.pt-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 390px; min-height: 0; }
.pt-grid { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(7, auto) 12px repeat(2, auto); gap: 3px; padding: 16px; overflow: auto; align-content: start; }
.el { aspect-ratio: 1 / 1.08; border-radius: 5px; padding: 3px 4px; cursor: pointer; position: relative; border: 1px solid #ffffff14; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; transition: transform .1s; color: #0b0f14; }
.el:hover { transform: scale(1.12); z-index: 2; box-shadow: 0 4px 18px #0009; }
.el.on { outline: 2px solid #fff; z-index: 3; }
.el .z { font-size: 9.5px; opacity: .75; font-family: var(--mono); }
.el .s { font-size: clamp(11px, 1.35vw, 19px); font-weight: 700; line-height: 1; text-align: center; }
.el .k { font-size: clamp(7px, .62vw, 10px); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.el.dark { color: #eef3f8; }
.el.dim { opacity: .35; }
.pt-gap { grid-column: 1 / -1; }
.pt-info { border-left: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 16px; }
.pt-info .big { display: flex; gap: 14px; align-items: center; }
.pt-info .sym { width: 74px; height: 74px; border-radius: 12px; display: grid; place-items: center; font-size: 34px; font-weight: 800; color: #0b0f14; }
.pt-info h2 { margin: 0; font-size: 22px; }
.pt-info h2 small { font-size: 13px; color: var(--mut); font-weight: 400; margin-left: 6px; }
.pt-info canvas { width: 100%; height: 300px; display: block; border-radius: var(--r); background: radial-gradient(#0e141c, #030405); cursor: grab; }
.atom-slot { position: relative; margin: 12px 0; }
.atom-cap { position: absolute; left: 10px; right: 10px; top: 8px; display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: #8b9bb0; pointer-events: none; }
.atom-cap .lg { display: flex; gap: 8px; align-items: center; }
.atom-cap .lg i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: -4px; }
.atom-cap .lg em { font-style: normal; color: #5f6f84; }
.atom-z { position: absolute; left: 10px; bottom: 8px; font-size: 10.5px; color: #6c7c92; pointer-events: none; }
.props { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.props div { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; }
.props small { display: block; color: var(--mut); font-size: 11px; }
.props b { font-family: var(--mono); font-weight: 500; font-size: 12.5px; }
.props .w2 { grid-column: 1 / -1; }
.pt-info .rgs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pt-info .rgs button { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 8px; font-size: 12px; cursor: pointer; }
.pt-info .rgs button:hover { border-color: var(--acc); color: var(--acc); }

/* ── 열역학 표 ── */
#tab-data { grid-template-rows: auto minmax(0, 1fr); }
.data-bar { padding: 8px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--panel); font-size: 12px; }
.data-bar .search { width: 260px; }
.data-wrap { overflow: auto; padding: 0 16px 18px; }
.dt { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.dt th { position: sticky; top: 0; background: var(--bg); text-align: right; padding: 8px; border-bottom: 1px solid var(--line2); color: var(--mut); font-weight: 500; cursor: pointer; white-space: nowrap; font-size: 11.5px; }
.dt th:hover { color: var(--text); }
.dt th:nth-child(-n+3) { text-align: left; }
.dt td { padding: 5px 8px; border-bottom: 1px solid #18212c; font-family: var(--mono); font-size: 11.5px; text-align: right; font-variant-numeric: tabular-nums; }
.dt td:nth-child(-n+3) { text-align: left; font-family: inherit; font-size: 12.5px; }
.dt tr:hover td { background: var(--panel); }

.method { max-width: 900px; margin: 0 auto; padding: 24px 24px 60px; line-height: 1.75; }
#tab-method { overflow: auto; display: none; }
#tab-method.on { display: block; }
.method h2 { font-size: 20px; margin: 26px 0 8px; }
.method h3 { font-size: 15px; margin: 18px 0 6px; color: var(--acc); }
.method code, .method .f { font-family: var(--mono); background: var(--panel2); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.method li { margin-bottom: 4px; }

/* ── 도구 탭 ── */
.tool-tab.on { display: block; overflow: auto; }
.tool { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 22px; padding: 18px 22px 40px; max-width: 1400px; }
.tool-in { display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; align-self: start; position: sticky; top: 14px; }
.tool-in h3, .card h3 { margin: 0; font-size: 15px; }
.tool-in label, .card label { display: flex; flex-direction: column; gap: 4px; color: var(--mut); font-size: 12px; }
.tool-in .row, .card .row { display: flex; gap: 10px; flex-wrap: wrap; }
.tool-in .row label, .card .row label { flex-direction: row; align-items: center; gap: 6px; }
.tool select, .tool input { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 8px; color: var(--text); outline: 0; }
.tool select:focus, .tool input:focus { border-color: var(--acc); }
.tool input[type=number] { font-family: var(--mono); font-size: 12px; }
.tool .row input { width: 90px; }
.presetrow { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.presetrow button { background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; color: var(--text); }
.presetrow button:hover { border-color: var(--acc); }
.tool-out { min-width: 0; max-width: 900px; }
.tool-out h4 { color: var(--text); font-size: 13.5px; }
.chart { width: 100%; max-width: 760px; display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin: 8px 0; }
.mols .mlist { display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow: auto; }
.mols .mlist button { text-align: left; background: none; border: 0; padding: 5px 8px; border-radius: 6px; cursor: pointer; color: var(--text); }
.mols .mlist button:hover, .mols .mlist button.on { background: var(--panel2); color: var(--acc); }
.calc { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card input[id] { width: 100%; }
.card .row input { width: 90px; }
.big.mono { font-size: 17px; color: var(--acc); }

@media (max-width: 1560px) {
  .gl { display: none; }
  .cmdk { min-width: 0; }
  .cmdk span { display: none; }
}
@media (max-width: 1280px) {
  #tab-lab { grid-template-columns: 260px minmax(0, 1fr) 400px; }
  .brand span { display: none; }
  .nav button { padding: 7px 8px; }
  .nav button svg { display: none; }
}
@media (max-width: 900px) {
  :root { --top: 48px; }
  .top { gap: 8px; padding: 0 8px; }
  .nav { overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .grp { padding: 0 4px; }
  .cmdk kbd, #helpBtn { display: none; }
  main { height: auto; }
  .status { display: none; }
  .tab.on { display: block; }
  #tab-lab.on { display: flex; flex-direction: column; }
  .stage { order: 0; } .shelf { order: 1; border-top: 1px solid var(--line); } .result { order: 2; }
  .shelf { border-right: 0; max-height: 60vh; }
  .shelf-foot { display: none; }
  .stage { display: block; }
  .view { height: 56vh; }
  .flask { max-height: none; }
  .ph h4 { flex-basis: 100%; }
  .vt th:nth-child(2), .vt td:nth-child(2) { display: none; }
  .vt .amt input { width: 50px; }
  .vt td { padding: 4px 3px; }
  .result { border-left: 0; border-top: 1px solid var(--line); }
  .rbody { overflow: visible; }
  .sum { grid-template-columns: repeat(2, 1fr); }
  .pt-wrap { display: block; }
  .pt-grid { gap: 2px; padding: 8px; }
  .el .k { display: none; }
  .el .z { font-size: 7px; }
  .pt-info { border-left: 0; border-top: 1px solid var(--line); }
  .data-bar .search { width: 100%; }
  .tool { grid-template-columns: 1fr; padding: 14px 16px; }
  .tool-in { position: static; }
  .calc { grid-template-columns: 1fr; }
  .keys dl { grid-template-columns: 1fr; gap: 2px; }
  .keys dd { margin-bottom: 8px; }
}
