: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: 17px; font-weight: 900; letter-spacing: 0; line-height: 1.05; }
.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; }
/* 처음 안내 — 3D 화면 왼쪽 위 카드 */
.guide { position: absolute; left: 12px; top: 56px; z-index: 6; width: min(360px, calc(100% - 24px)); background: #0b1118f2; border: 1px solid #1b6a96; border-radius: 12px; padding: 14px 16px; box-shadow: 0 12px 32px #0008; backdrop-filter: blur(8px); animation: up .2s ease-out; }
.guide[hidden] { display: none; }
.guide > b { font-size: 15px; }
.guide ol { list-style: none; margin: 10px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.guide li { display: flex; gap: 10px; align-items: flex-start; }
.guide li > span:first-child { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--acc-bg); color: var(--acc); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.guide li b { display: block; font-size: 13px; }
.guide li small { color: var(--mut); font-size: 12px; line-height: 1.5; }
.guide .gbtn { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.guide .gbtn .lnk { margin-left: auto; color: var(--mut); }

.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); }
.dt td:not(:nth-child(2)) { white-space: nowrap; } /* 폰에서 「고/체」「수/용/액」 한 글자씩 꺾이던 것 */
.dt td:nth-child(2) { min-width: 9em; }

.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; }
.step .hd > span:last-child { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ── 지식백과 (view/kb.js) — 왼쪽 목차 · 오른쪽 항목 ── */
.kb { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: 100%; min-height: 0; }
#tab-kb.on { display: block; }
.kb-nav { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.kb-navhead { padding: 10px 10px 6px; display: flex; flex-direction: column; gap: 7px; border-bottom: 1px solid var(--line); }
.kb-navhead .search kbd { font-size: 10px; }
.kb-lvf button { padding: 4px 0; font-size: 12px; }
.kb-lv { display: inline-block; font-family: Pretendard, 'Noto Sans KR', system-ui, sans-serif; letter-spacing: 0; font-size: 10.5px; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: 4px; font-style: normal; white-space: nowrap; }
.kb-lv.l1 { background: #12301f; color: #6ee7a0; }
.kb-lv.l2 { background: #10283d; color: #6cc6ff; }
.kb-lv.l3 { background: #33213f; color: #d6a6ff; }
.kb-ok { color: var(--ok); margin-right: 5px; font-weight: 700; }
.kb-nv { display: inline-flex; align-items: center; gap: 2px; }
.kb-list { flex: 1; overflow: auto; padding: 0 6px 14px; min-height: 0; }
.kb-list button { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 6px 8px; cursor: pointer; color: var(--text); }
.kb-list button b { font-weight: 500; font-size: 13px; }
.kb-list button small { grid-column: 1; color: var(--dim); font-size: 11px; }
.kb-list button i { grid-row: 1 / 3; grid-column: 2; display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.kb-list button i svg { width: 11px; height: 11px; fill: currentColor; }
.kb-list button:hover { background: var(--panel2); }
.kb-list button.on { background: var(--acc-bg); }
.kb-list button.on b { color: var(--acc); }
.kb-list .kb-home { display: flex; justify-content: space-between; margin: 2px 0 4px; font-weight: 600; font-size: 13px; }
.kb-list .kb-home em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--dim); font-weight: 400; }
.kb-list .empty { padding: 14px 8px; font-size: 12.5px; }
.kb-main { overflow: auto; min-height: 0; }
.kb-art { max-width: 920px; margin: 0 auto; padding: 22px 28px 60px; line-height: 1.75; }
.kb-back { display: none; }
.kb-crumb .lnk { font-size: 12px; color: var(--dim); }
.kb-art h3 { scroll-margin-top: 12px; }
.kb-vids { scroll-margin-top: 12px; }
.kb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -2px 0 12px; font-size: 12px; color: var(--mut); }
.kb-link { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; background: none; border: 1px solid var(--line2); border-radius: 6px; padding: 4px 10px; color: var(--mut); cursor: pointer; font-size: 12px; }
.kb-link:hover { color: var(--acc); border-color: var(--acc); }
.kb-link svg { width: 13px; height: 13px; }
.kb-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kb-toc:empty { display: none; }
.kb-toc button { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 12px; color: var(--mut); cursor: pointer; }
.kb-toc button:hover { color: var(--acc); border-color: var(--acc); }
.kb-quiz { display: flex; flex-direction: column; gap: 12px; }
.kb-q { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kb-q > p { margin: 0 0 8px; }
.kb-opts { display: flex; flex-direction: column; gap: 6px; }
.kb-opts button { text-align: left; background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 12px; color: var(--text); cursor: pointer; font-size: 13.5px; line-height: 1.5; }
.kb-opts button:hover { border-color: var(--acc); }
.kb-ok-k { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 9px; border-radius: 50%; background: var(--panel3); color: var(--mut); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.kb-opts button.ok .kb-ok-k { background: var(--ok); color: #06200f; }
.kb-opts button.no .kb-ok-k { background: var(--bad); color: #2a0608; }
.kb-opts button.ok { border-color: var(--ok); background: #0f2a1b; }
.kb-opts button.no { border-color: var(--bad); background: #2e1416; }
.kb-exp { margin: 10px 0 0; font-size: 13px; color: #cfd8e3; }
.kb-exp b.ok { color: var(--ok); } .kb-exp b.no { color: var(--bad); }
.kb-rel { display: flex; flex-wrap: wrap; gap: 8px; }
.kb-rel button { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 12px; color: var(--text); cursor: pointer; }
.kb-rel button:hover { border-color: var(--acc); }
.kb-rel b { font-weight: 500; font-size: 13px; }
.kb-rel small { color: var(--dim); font-size: 11px; }
.kb-vcap span { display: block; }
.kb-yt { display: inline-block; margin-top: 4px; font-size: 12px; color: var(--mut); }
.kb-yt:hover { color: var(--acc); }
.kb-paths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.kb-paths button { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; text-align: left; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 13px 14px; color: var(--text); cursor: pointer; }
.kb-paths button:hover { border-color: var(--acc); }
.kb-paths b { font-size: 14.5px; }
.kb-paths small { color: var(--mut); font-size: 12.5px; line-height: 1.55; }
.kb-paths em { font-style: normal; color: var(--acc); font-size: 12px; margin-top: auto; }
.kb-prog { position: relative; height: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 0 0 6px; }
.kb-prog span { position: absolute; inset: 0 auto 0 0; background: var(--acc-bg); }
.kb-prog b { position: relative; display: block; text-align: center; font-size: 12px; line-height: 24px; font-weight: 500; }
.kb-ct { display: flex; align-items: center; gap: 8px; padding: 10px 14px 0; }
.kb-ct small { color: var(--dim); font-size: 11px; }
.kb-card .kb-ct + b { margin-top: 5px; }
.kb-cth s { position: absolute; left: 8px; bottom: 8px; background: #0f2a1bdd; color: var(--ok); border-radius: 5px; padding: 2px 7px; font-size: 11px; text-decoration: none; font-weight: 600; }
.kb-const td:nth-child(2) { font-family: var(--mono); white-space: nowrap; }
.kb-const td:nth-child(3) { font-family: var(--mono); font-size: 12.5px; }
.kb-const td:nth-child(4) { color: var(--dim); font-size: 12px; }
.kb-note { color: var(--dim); font-size: 12px; margin-top: 4px; }
.kb-crumb { margin: 0 0 4px; color: var(--dim); font-size: 12px; }
.kb-art h1 { margin: 0 0 10px; font-size: 26px; line-height: 1.3; letter-spacing: -.01em; }
.kb-art h1 small { display: block; font-size: 13px; color: var(--mut); font-weight: 400; letter-spacing: 0; margin-top: 2px; }
.kb-art h2 { font-size: 17px; margin: 30px 0 10px; }
.kb-art h3 { font-size: 15px; margin: 24px 0 6px; color: var(--acc); }
.kb-lede { font-size: 15px; color: var(--text); margin: 0 0 18px; }
.kb-body p, .kb-body li { color: #cfd8e3; }
.kb-body li { margin-bottom: 4px; }
.kb-art .eq { font-family: var(--mono); font-size: 13.5px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--acc); border-radius: 6px; padding: 9px 14px; margin: 10px 0; overflow-x: auto; color: var(--text); }
.kb-art .ex { background: #0f1d16; border: 1px solid #1d3a2a; border-radius: 8px; padding: 10px 14px; margin: 12px 0; font-size: 13.5px; }
.kb-art .ex b:first-child { color: var(--ok); }
.kt { border-collapse: collapse; width: 100%; margin: 8px 0 12px; font-size: 13px; }
.kt th { text-align: left; color: var(--mut); font-weight: 500; font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--line2); background: var(--panel); }
.kt td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kb-myth li { color: #e9d6b0; }
.kb-myth li::marker { color: var(--warn); }
.kb-tries { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.kb-try { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 12px; cursor: pointer; color: var(--text); }
.kb-try:hover { border-color: var(--acc); }
.kb-try svg { width: 18px; height: 18px; color: var(--acc); flex: none; }
.kb-try b { display: block; font-weight: 500; font-size: 13px; line-height: 1.4; }
.kb-try small { color: var(--dim); font-size: 11px; }
.kb-refs { padding-left: 22px; font-size: 13px; }
.kb-refs li { margin-bottom: 6px; color: #cfd8e3; }
.kb-refs a { color: var(--acc); text-underline-offset: 2px; }
.kb-refs small { display: block; color: var(--dim); font-size: 11.5px; }
.kb-pn { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--line); }
.kb-pn button { background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 14px; cursor: pointer; color: var(--text); text-align: left; font-size: 13px; }
.kb-pn button:last-child { text-align: right; }
.kb-pn button:hover { border-color: var(--acc); }
.kb-pn small { display: block; color: var(--dim); font-size: 11px; }
.kb-foot { margin-top: 24px; color: var(--dim); font-size: 11.5px; }
/* 처음 화면 */
.kb-trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 8px; }
.kb-trust div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6; }
.kb-trust b { display: block; color: var(--acc); font-size: 13px; margin-bottom: 4px; }
.kb-trust span { color: var(--mut); }
.kb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.kb-card { display: flex; flex-direction: column; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0 0 12px; cursor: pointer; color: var(--text); overflow: hidden; }
.kb-card:hover { border-color: var(--acc); }
.kb-card > b, .kb-card > small, .kb-clede { padding: 0 14px; }
.kb-card > b { font-size: 14.5px; margin-top: 6px; }
.kb-card > small { color: var(--dim); font-size: 11.5px; }
.kb-clede { color: var(--mut); font-size: 12.5px; line-height: 1.55; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kb-cth { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.kb-cth img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .85; transition: opacity .2s, transform .3s; }
.kb-card:hover .kb-cth img { opacity: 1; transform: scale(1.03); }
.kb-cth i { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 3px; background: #000b; color: #fff; border-radius: 5px; padding: 2px 7px; font-style: normal; font-family: var(--mono); font-size: 11px; }
.kb-cth i svg { width: 11px; height: 11px; fill: #fff; }
/* 참고 영상 — 큰 재생 칸(famytp) + 목록 */
.kb-vids { margin: 0 0 22px; }
.kb-vbox { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.kb-vbox > .famytp { position: absolute; inset: 0; }
.kb-vcover { position: absolute; inset: 0; padding: 0; border: 0; background: #000; cursor: pointer; }
.kb-vcover img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .88; transition: opacity .2s; }
.kb-vcover:hover img { opacity: 1; }
.kb-vplay { position: absolute; left: 50%; top: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; border-radius: 50%; background: rgba(0, 0, 0, .55); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); transition: transform .15s, background .15s; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.kb-vplay svg { width: 36px; height: 36px; fill: #fff; margin-left: 3px; }
.kb-vcover:hover .kb-vplay { transform: scale(1.06); background: var(--acc); }
.kb-vcap { margin: 9px 2px 0; font-size: 13px; line-height: 1.5; }
.kb-vcap b { display: block; font-size: 14px; }
.kb-vcap span { color: var(--mut); font-size: 12px; }
.kb-vlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-top: 12px; }
.kb-vlist button { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px; cursor: pointer; color: var(--text); }
.kb-vlist button:hover { border-color: var(--line2); }
.kb-vlist button.on { border-color: var(--acc); background: var(--acc-bg); }
.kb-vth { position: relative; flex: none; width: 112px; aspect-ratio: 16 / 9; border-radius: 5px; overflow: hidden; background: #000; }
.kb-vth img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kb-vth em { position: absolute; right: 3px; bottom: 3px; background: #000c; color: #fff; font-style: normal; font-family: var(--mono); font-size: 10px; padding: 0 4px; border-radius: 3px; }
.kb-vtx { min-width: 0; }
.kb-vtx b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.kb-vtx small { color: var(--dim); font-size: 11px; }

/* ── 도구 탭 ── */
.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; }
  /* 폰: 칸 너비 ≈19px — 여백을 줄이고 기호를 칸에 맞춤 (Mn·Mo 가 옆 칸 밑으로 넘쳐 「Mr」「Mc」로 보이던 것) */
  .el { padding: 2px 1px; }
  .el .z { line-height: 1.1; }
  /* 폰 분자 구조: 세로 목록이 화면을 다 차지해 고른 분자가 안 보이던 것 → 가로로 넘기는 한 줄 */
  .mols .mlist { flex-direction: row; max-height: none; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; }
  .mols .mlist button { white-space: nowrap; flex: none; border: 1px solid var(--line); min-height: 36px; }
  .el .s { font-size: clamp(9px, 2.6vw, 17px); letter-spacing: -.04em; }
  .pt-info { border-left: 0; border-top: 1px solid var(--line); }
  .data-bar .search { width: 100%; }
  .tool { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .tool-in, .tool-out { min-width: 0; }
  .tool-in select { width: 100%; min-width: 0; text-overflow: ellipsis; }
  .tool-out .eq, .tool-out .mono { overflow-wrap: anywhere; }
  .shelf-head .search kbd { display: none; }
  .tool-in { position: static; }
  .calc { grid-template-columns: 1fr; }
  .keys dl { grid-template-columns: 1fr; gap: 2px; }
  .keys dd { margin-bottom: 8px; }

  /* 폰: 위 메뉴 대신 아래 메뉴, 머리 고정 */
  .top { position: sticky; top: 0; z-index: 30; padding-top: env(safe-area-inset-top); height: calc(var(--top) + env(safe-area-inset-top)); }
  .nav { display: none; }
  .brand span { display: block; }
  .brand small { color: var(--acc); font-size: 11.5px; }
  .cmdk { margin-left: auto; min-width: 0; border: 0; background: none; padding: 8px; }
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); height: auto; }
  .mnav { display: flex; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }

  /* 실험대 3칸 */
  .mpane { display: flex; position: sticky; top: calc(var(--top) + env(safe-area-inset-top)); z-index: 20; margin: 0; border-radius: 0; border-width: 0 0 1px; padding: 6px 8px; background: var(--bg); }
  .mpane button { flex: 1; padding: 9px 4px; font-size: 13px; }
  #tab-lab .shelf, #tab-lab .stage, #tab-lab .result { display: none; }
  #tab-lab[data-mp=stage] .stage { display: block; }
  #tab-lab[data-mp=shelf] .shelf { display: flex; max-height: none; border-top: 0; }
  #tab-lab[data-mp=result] .result { display: block; border-top: 0; }
  .shelf-list { overflow: visible; padding-bottom: 16px; }
  .shelf .seg.full { margin: 8px 10px 0; }
  .shelf-head { position: sticky; top: calc(var(--top) + 52px + env(safe-area-inset-top)); z-index: 5; background: var(--panel); }
  .gh { position: static; }
  .rg { padding: 9px 6px; }
  .rg .add { font-size: 20px; width: 24px; }
  .pr { padding: 10px 8px; }
  .chips button { padding: 5px 11px; font-size: 12.5px; }
  .view { height: 48vh; min-height: 300px; }
  .timeline { gap: 6px; padding: 8px 10px; }
  .timeline .tl { font-size: 11px; white-space: nowrap; }
  .timeline input[type=range] { min-width: 0; }
  #rtabs { position: sticky; top: calc(var(--top) + 52px + env(safe-area-inset-top)); z-index: 5; margin: 0; border-radius: 0; padding: 6px 8px; background: var(--bg); border-width: 0 0 1px; }
  #rtabs button { padding: 10px 4px; }
  .lnk { display: inline-flex; align-items: center; min-height: 36px; padding: 0 6px; }
  /* 누르기 영역 ≥ 34px */
  .seg button { min-height: 34px; }
  .chips button { min-height: 34px; padding: 5px 12px; }
  #play { min-height: 38px; }
  #addRg { min-height: 34px; padding: 4px 12px; }
  .vt .x { min-width: 36px; min-height: 36px; }
  .mbtn, .btn.sm { min-height: 34px; padding: 4px 10px; }
  .ibtn { width: 38px; height: 38px; }
  input[type=number], input[type=search], select { font-size: 16px; }   /* iOS 확대 막기 */

  /* 지식백과: 목차 / 항목 두 칸 전환 */
  .kb { display: block; height: auto; }
  .kb-nav { border-right: 0; }
  .kb[data-v=art] .kb-nav { display: none; }
  /* 처음 = 찾기 칸 + 카드(목록은 찾을 때만), 찾으면 목록만 */
  .kb[data-v=list]:not([data-q]) .kb-list, .kb[data-v=list][data-q] .kb-main { display: none; }
  .kb-list { overflow: visible; }
  .kb-list button { padding: 10px 8px; }
  .kb-navhead { position: sticky; top: calc(var(--top) + env(safe-area-inset-top)); z-index: 6; background: var(--panel); padding: 8px 12px; }
  .kb-navhead .search kbd { display: none; }
  .kb-navhead .search input { min-height: 38px; }
  .kb-lvf button { min-height: 34px; }
  .kb-main { overflow: visible; }
  .kb-art { padding: 10px 16px 40px; }
  .kb-back { display: inline-flex; align-items: center; min-height: 40px; margin: 0 0 2px -4px; padding: 0 6px; background: none; border: 0; color: var(--acc); font-size: 14px; cursor: pointer; }
  .kb-art h3, .kb-vids { scroll-margin-top: calc(var(--top) + 12px); }
  .kb-toc { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 16px; padding: 8px 16px; }
  .kb-toc::-webkit-scrollbar { display: none; }
  .kb-toc button { flex: none; min-height: 34px; }
  .kb-paths { grid-template-columns: 1fr; }
  .kb-opts button { min-height: 44px; }
  .kb-rel button { min-height: 44px; }
  .kb-link { min-height: 34px; }
  .kb-const { white-space: normal; }
  .guide { top: 50px; }
  .guide .gbtn .btn, .guide .gbtn .lnk { min-height: 38px; }
  .kb-art h1 { font-size: 22px; }
  .kb-trust { grid-template-columns: 1fr; }
  .kb-cards, .kb-vlist, .kb-tries { grid-template-columns: 1fr; }
  .kb-vbox { margin: 0 -16px; border-radius: 0; border-width: 1px 0; }
  .kb-vplay { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
  .kt { display: block; overflow-x: auto; white-space: nowrap; }
  .kt td { white-space: normal; min-width: 90px; }
  .kb-pn button { min-height: 44px; }
}

/* 폰 아래 메뉴 · 시트 (넓은 화면에선 숨김) */
.mpane, .mnav { display: none; }
@media (max-width: 900px) { .mpane, .mnav { display: flex; } }
.mnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #0c1016f2; backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 4px 4px env(safe-area-inset-bottom); }
.mnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; padding: 7px 0 6px; color: var(--dim); font-size: 11px; cursor: pointer; }
.mnav button svg { width: 21px; height: 21px; }
.mnav button.on { color: var(--acc); }
.msheet-back { position: fixed; inset: 0; z-index: 50; background: #000a; display: flex; align-items: flex-end; }
.msheet-back[hidden] { display: none; }
.msheet { width: 100%; background: var(--panel); border-top: 1px solid var(--line2); border-radius: 16px 16px 0 0; padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.msheet h3 { margin: 4px 6px 8px; font-size: 13px; color: var(--mut); font-weight: 600; }
.msheet h3::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--line2); margin: 0 auto 12px; }
.msheet button { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 12px 10px; color: var(--text); cursor: pointer; }
.msheet button svg { width: 22px; height: 22px; color: var(--acc); }
.msheet button b { display: block; font-size: 15px; font-weight: 600; }
.msheet button small { display: block; color: var(--mut); font-size: 12px; margin-top: 2px; }
.msheet button.on { background: var(--acc-bg); }

/* 폰: 머리의 로고·분야 글자는 보이는 크기가 작다 — 누르는 자리만 넓힘 */
@media (pointer: coarse) {
  .fsb-logo, .fsb-field { position: relative; }
  .fsb-logo::after { content: ''; position: absolute; inset: -8px -8px -3px; }
  .fsb-field::after { content: ''; position: absolute; inset: -3px -8px -8px; }
}
@media (max-width: 900px) {
  /* 16px 미만 입력 칸은 아이폰이 눌렀을 때 화면을 확대함 — 전체 규칙을 이기는 칸들 */
  .cond input[type=number] { width: 58px; font-size: 16px; }
  .vt .amt input, .tool input[type=number] { font-size: 16px; }
  .msheet { touch-action: pan-y; }
}
