/* Crystal XR 웹 화면 — 밝은 작업 화면 (VESTA·Origin 같은 과학 소프트웨어의 문법).
   UI는 흑백 단계로만 구분하고, 색은 데이터에만 쓴다: 원자(VESTA 색), 선택한 Miller 면·XRD 피크·측정(마젠타).
   글꼴: 한글·UI = Pretendard, 화학식·공간군·Miller 지수·물리량 기호 = STIX Two Text (학술지 조판 글꼴).
   VR 패널은 Meta Horizon 다크 테마 그대로 (ui-vr.js). 자세한 규칙: docs/design.md */
@import url('vendor/pretendard/pretendardvariable-dynamic-subset.css');
@import url('vendor/stix/stix.css');
:root {
  color-scheme: light;
  --bg: #ffffff; --s1: #f8f9fa; --s2: #f1f3f5; --s3: #e9ecef; --s4: #dee2e6;
  --line: #e6e8eb; --line2: #d5d9de;
  --t1: #15181d; --t2: #4b525c; --t3: #868e99;
  --ink: #15181d; --acc: #d6336c;
  --ok: #2b8a3e; --bad: #c92a2a;
  --font: 'Pretendard Variable', Pretendard, -apple-system, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --sci: 'STIX Two Text', 'Times New Roman', serif;
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--t1); font: 13px/1.5 var(--font); overflow: hidden;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: left; }
button:disabled { cursor: default; opacity: .38; }
:focus-visible { outline: 2px solid #3b6fd8; outline-offset: 1px; }
svg.i { flex: none; display: block; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.spacer { flex: 1; }
/* 과학 표기: STIX Two. 숫자는 Pretendard 고정폭 숫자 */
.f, .sg { font-family: var(--sci); font-size: 1.12em; letter-spacing: 0; font-variant-numeric: lining-nums; }
.sg i, i.f, .f i { font-style: italic; }
sub { font-size: .7em; line-height: 0; vertical-align: -.28em; }
.ob { text-decoration: overline; text-decoration-thickness: .06em; text-underline-offset: 0; }
.readout, #status, .kv dd, .big { font-variant-numeric: tabular-nums; }

/* ---------- 큰 틀 ---------- */
#app { position: fixed; inset: 0; display: grid; grid-template-columns: 248px minmax(0, 1fr) 352px; grid-template-rows: 46px minmax(0, 1fr);
  grid-template-areas: 'top top top' 'left view right'; }
#top { grid-area: top; display: flex; align-items: center; gap: 14px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--line); background: var(--bg); z-index: 5; }
#left { grid-area: left; border-right: 1px solid var(--line); }
#right { grid-area: right; border-left: 1px solid var(--line); }
#viewport { grid-area: view; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
#stage { position: relative; flex: 1; min-height: 0; touch-action: none; }
#stage canvas { display: block; position: absolute; inset: 0; }
.side { display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--s4) transparent; }
.pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#sheetTabs { display: none; }

/* ---------- 상단 ---------- */
.brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.brand b { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.logo { width: 26px; height: 26px; display: block; }
.seg { display: inline-flex; background: var(--s3); border-radius: 7px; padding: 2px; }
.seg button { white-space: nowrap; height: 26px; padding: 0 14px; border-radius: 5px; color: var(--t2); font-weight: 600; font-size: 12.5px; }
.seg button:hover { color: var(--t1); }
.seg button.on { background: #fff; color: var(--t1); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.srv { display: inline-flex; align-items: center; gap: 6px; color: var(--t3); font-size: 12px; white-space: nowrap; }
.srv .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--s4); }
.srv.on .dot { background: #37b24d; } .srv.off .dot { background: #f59f00; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 6px; font-weight: 600; font-size: 12.5px; white-space: nowrap;
  border: 1px solid var(--line2); background: #fff; color: var(--t1); }
.btn:hover:not(:disabled) { background: var(--s2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #2c3038; }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.ib { width: 30px; height: 30px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--t2); flex: none; }
.ib.sm { width: 26px; height: 26px; }
.ib:hover:not(:disabled) { background: var(--s2); color: var(--t1); }
.ib.on { color: var(--t1); background: var(--s3); }

/* ---------- 탭 ---------- */
.tabs { display: flex; align-items: center; gap: 18px; padding: 0 8px 0 14px; height: 40px; border-bottom: 1px solid var(--line); flex: none; }
.tabs > button:not(.ib) { height: 40px; color: var(--t3); font-weight: 600; font-size: 12.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs > button:not(.ib):hover { color: var(--t1); }
.tabs > button.on:not(.ib) { color: var(--t1); border-bottom-color: var(--ink); }
.tabs .ib + .ib { margin-left: -14px; }

/* ---------- 왼쪽: 구조 목록 ---------- */
.phead { display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--line); flex: none; }
.phead h2 { font-size: 12.5px; font-weight: 700; }
.grp { padding-bottom: 6px; }
/* 물질 찾기 */
.sbox { position: relative; flex: none; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.sbox .ic { position: absolute; left: 19px; top: 50%; transform: translateY(-50%); color: var(--t3); display: inline-flex; pointer-events: none; }
.sbox input { width: 100%; height: 30px; padding: 0 30px 0 29px; border: 1px solid var(--line2); border-radius: 6px; background: var(--s1, #fff); font: inherit; font-size: 12.5px; color: var(--t1); }
.sbox input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(21,24,29,.08); }
.sbox input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.sbox .clr { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 4px; display: none; align-items: center; justify-content: center; color: var(--t3); }
.sbox .clr:hover { background: var(--s2); color: var(--t1); }
.sbox input:not(:placeholder-shown) ~ .clr { display: inline-flex; }
.sbox kbd { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font: 11px/1 inherit; color: var(--t3); border: 1px solid var(--line2); border-radius: 4px; padding: 2px 5px; pointer-events: none; }
.sbox input:focus ~ kbd, .sbox input:not(:placeholder-shown) ~ kbd { display: none; }
.grp.find .sec b { color: var(--t1); font-weight: 600; }
.li.fr .nm { color: var(--t2); }
.li.fr .st { color: #2b8a3e; }
.li.fr .meta { color: var(--t3); }
.li.fr.busy { opacity: .6; }
.find-note { padding: 6px 14px 10px; color: var(--t3); font-size: 11.5px; line-height: 1.5; }
.find-note.err { color: var(--bad); }
.find-wait { display: flex; align-items: center; gap: 6px; padding: 6px 14px; color: var(--t3); font-size: 12px; }
@media (pointer: coarse) { .sbox kbd { display: none; } .sbox input { height: 36px; font-size: 15px; } }
.sec { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px 4px; color: var(--t3); font-size: 11.5px; font-weight: 600; list-style: none; }
.sec span { font-weight: 400; }
summary.sec { cursor: pointer; } summary.sec::-webkit-details-marker { display: none; }
summary.sec::after { content: '＋'; font-weight: 400; } details[open] > summary.sec::after { content: '−'; }
.li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; column-gap: 8px; width: 100%; padding: 4px 14px; min-height: 30px; border-left: 2px solid transparent; }
.li:hover { background: var(--s2); }
.li.on { background: var(--s3); border-left-color: var(--ink); }
.li b { font-weight: 500; font-size: 13px; white-space: nowrap; }
.li b .f { font-size: 14.5px; }
.li .nm { color: var(--t3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .r { color: var(--t3); font-size: 12px; white-space: nowrap; }
.li small { grid-column: 1 / -1; color: var(--t2); font-size: 12px; line-height: 1.45; padding: 1px 0 3px; }
.li.on b { font-weight: 600; }
.li .n { display: inline-block; width: 16px; color: var(--t3); font-weight: 400; }
.ask-link { display: flex; gap: 6px; align-items: center; width: 100%; padding: 0 14px 8px 32px; color: var(--t2); font-size: 12px; background: var(--s3); border-left: 2px solid var(--ink); }
.ask-link:hover { color: var(--t1); text-decoration: underline; }
.empty { color: var(--t3); font-size: 12px; padding: 2px 14px 4px; line-height: 1.5; }

/* ---------- 속성 (구조 보고서) ---------- */
.ih { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.ih h2 { font-weight: 500; line-height: 1.2; }
.ih h2 .f { font-size: 24px; }
.ih p { color: var(--t2); font-size: 12.5px; margin-top: 3px; }
.ih .meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; margin-top: 8px; color: var(--t2); }
.ih .meta .sg { font-size: 14.5px; color: var(--t1); }
.ih .meta a { color: var(--t3); text-decoration: none; } .ih .meta a:hover { color: var(--t1); text-decoration: underline; }
.dim { color: var(--t3); font-weight: 400; }
.is { padding: 14px 16px 2px; }
.is + .is { border-top: 1px solid var(--line); margin-top: 12px; }
.is h3 { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--t1); }
.is h3 span { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 400; color: var(--t3); }
.is details > summary { list-style: none; cursor: pointer; } .is details > summary::-webkit-details-marker { display: none; }
.is details[open] h3 svg { transform: rotate(180deg); }
.kv { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 3px 12px; margin: 0; font-size: 12.5px; align-items: baseline; }
.kv dt { color: var(--t3); }
.kv dd { margin: 0; }
.kv dd .sg, .kv dd .f { font-size: 14px; }
/* 격자 상수 표: 머리는 기호, 값은 고정폭 숫자 오른쪽 정렬 */
.lat { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; table-layout: fixed; }
.lat th { padding: 0 0 1px; text-align: right; font-weight: 400; color: var(--t3); font-size: 11.5px; }
.lat th .f { font-size: 13.5px; color: var(--t2); }
.lat td { padding: 0 0 8px; text-align: right; font-size: 14px; }
.stats { display: flex; gap: 0; margin: 2px 0 0; border: 1px solid var(--line); border-radius: 6px; }
.stats div { flex: 1; padding: 6px 10px; } .stats div + div { border-left: 1px solid var(--line); }
.stats dt { color: var(--t3); font-size: 11.5px; } .stats dt .f { font-size: 13.5px; }
.stats dd { margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 조성 막대 */
.cbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.cbar i { display: block; } .cbar i + i { border-left: 1px solid #fff; }
.clist { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; }
.clist li { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.clist li > i { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.clist b { font-weight: 600; }
/* 원자 위치 표 */
.pos { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pos th { text-align: right; font-weight: 400; color: var(--t3); padding: 0 0 3px; border-bottom: 1px solid var(--line); }
.pos th .f { font-size: 13.5px; }
.pos td { text-align: right; padding: 2px 0; color: var(--t2); }
.pos td:first-child { text-align: left; color: var(--t1); } .pos td:first-child sub { color: var(--t3); margin-left: 1px; }
.pos tr.hl td { color: #b35c00; font-weight: 600; }
.foot { margin: 8px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--t3); }
.note { margin: 12px 16px 0; padding: 8px 10px; font-size: 12px; line-height: 1.5; color: #7a4f00; background: #fff8e6; border-radius: 6px; }
.note.dim { color: var(--t3); background: none; padding: 0; }
.desc { color: var(--t2); font-size: 12.5px; line-height: 1.65; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.tags span { padding: 1px 8px; border: 1px solid var(--line2); border-radius: 10px; font-size: 11.5px; color: var(--t2); }
#pg-info { padding-bottom: 20px; }

/* ---------- 가운데: 제목·도구 / 상태줄 ---------- */
#vbar { flex: none; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); }
#title { flex: 1; display: flex; align-items: baseline; gap: 10px; white-space: nowrap; overflow: hidden; }
#title h1 { font-weight: 600; } #title h1 .f { font-size: 17px; }
#title .sg { color: var(--t2); font-size: 14.5px; }
#title .meta { color: var(--t3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
#tools { display: flex; align-items: center; gap: 2px; }
.tb { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border-radius: 6px; color: var(--t2); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.tb:hover:not(:disabled) { background: var(--s2); color: var(--t1); }
.tb.on { background: var(--s3); color: var(--t1); }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 32px; z-index: 20; min-width: 168px; padding: 4px; background: #fff; border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 8px 24px rgba(15,20,30,.12); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.mi { display: flex; align-items: center; gap: 8px; width: 100%; height: 28px; padding: 0 8px; border-radius: 5px; font-size: 12.5px; }
.mi:hover:not(:disabled) { background: var(--s2); }
.menu.exp { min-width: 260px; }
.menu .mh { padding: 6px 8px 4px; font-size: 12px; font-weight: 600; color: var(--t1); display: flex; justify-content: space-between; }
.menu.exp .mi { height: auto; padding: 6px 8px; align-items: flex-start; }
.menu.exp .mi > svg { margin-top: 2px; flex: none; }
.menu.exp .mi small { display: block; color: var(--t3); font-size: 11px; margin-top: 1px; }
.menu .mf { margin: 4px 8px 4px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.45; color: var(--t3); }
.ask-link.rm { color: var(--t3); }
.ask-link.rm.sure { color: #c92a2a; font-weight: 600; }
.mi .box { width: 15px; height: 15px; border: 1px solid var(--line2); border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
.mi[aria-checked=true] .box { background: var(--ink); border-color: var(--ink); color: #fff; }
#legend { position: absolute; left: 14px; top: 10px; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 4px 12px; max-width: 60%; pointer-events: none; font-size: 12px; color: var(--t2); }
#legend span { display: inline-flex; align-items: center; gap: 5px; }
#legend i { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
#status { flex: none; display: flex; gap: 14px; align-items: center; height: 26px; padding: 0 16px; border-top: 1px solid var(--line); color: var(--t2); font-size: 12px; white-space: nowrap; overflow: hidden; }
#status .hint { color: var(--t3); }
#status b { color: var(--t1); font-weight: 600; }
#status .m { color: var(--acc); font-weight: 600; }
#status .lnk { color: var(--t3); text-decoration: underline; font-size: 12px; }
#status .r { margin-left: auto; display: flex; align-items: center; gap: 6px; }
#status .busy { display: inline-flex; align-items: center; gap: 5px; color: var(--t2); }
.tb.sm { height: 22px; padding: 0 7px; font-size: 12px; }
@keyframes spin { to { transform: rotate(360deg); } } svg.spin { animation: spin 1s linear infinite; }
/* 원자 편집 창: 상태줄 바로 위 오른쪽에 붙는 작은 창 */
#editPop { position: absolute; right: 12px; bottom: 10px; z-index: 7; width: min(440px, calc(100% - 24px)); padding: 10px 12px 10px; background: #fff;
  border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 8px 28px rgba(15,20,30,.14); font-size: 12.5px; }
#editPop .ep-h { display: flex; align-items: baseline; gap: 10px; padding-right: 22px; margin-bottom: 6px; }
#editPop .ep-h b { font-weight: 600; font-size: 13px; } #editPop .ep-h b .f { font-size: 15px; }
#editPop .ep-h .dim { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#editPop .close { position: absolute; right: 6px; top: 6px; }
.ep-row { display: flex; align-items: center; gap: 8px; min-height: 34px; flex-wrap: wrap; }
.ep-row + .ep-row { border-top: 1px solid var(--line); }
.ep-l { width: 48px; flex: none; color: var(--t3); font-size: 12px; }
.ep-row .dim { font-size: 11.5px; }
.seg { display: inline-flex; padding: 2px; background: var(--s2); border-radius: 6px; }
.seg button { height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; color: var(--t2); }
.seg button.on { background: #fff; color: var(--t1); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips button { min-width: 30px; height: 26px; padding: 0 6px; border: 1px solid var(--line2); border-radius: 5px; text-align: center; font-size: 14px; }
.chips button:hover { border-color: var(--ink); background: var(--s1); }
#epEl { width: 52px; height: 26px; padding: 0 6px; border: 1px solid var(--line2); border-radius: 5px; font-size: 14px; text-align: center; }
#epEl:focus { outline: none; border-color: var(--ink); } #epEl.bad { border-color: var(--bad); background: #fff5f5; }
.kbd { padding: 0 4px; border: 1px solid var(--line2); border-radius: 3px; font-size: 10.5px !important; }
.ep-foot { margin-top: 4px; color: var(--t3); font-size: 11.5px; }
#dropHint { position: absolute; inset: 10px; border: 1.5px dashed var(--t3); border-radius: 8px; display: none; align-items: center; justify-content: center; color: var(--t2); background: rgba(255,255,255,.85); z-index: 4; }
body.dragging #dropHint { display: flex; }
#toast { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 6; max-width: min(90%, 520px); padding: 8px 12px; border-radius: 6px; background: #fff5f5; border: 1px solid #ffc9c9; color: var(--bad); font-size: 12.5px; display: none; }
#toast.show { display: block; }
#toast.ok { background: #fff; border-color: var(--line2); color: var(--t1); box-shadow: 0 4px 14px rgba(15,20,30,.08); }
#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--t3); }

/* ---------- 가운데 아래: XRD·Miller 면·꼬임각 ---------- */
#drawer { flex: none; position: relative; border-top: 1px solid var(--line); padding: 4px 12px 2px 16px; }
.dh { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 36px; padding-right: 30px; }
.dh h3 { font-size: 12.5px; font-weight: 700; }
.dh .sub { color: var(--t3); font-size: 12px; margin-left: -10px; }
#drawer .close { position: absolute; right: 8px; top: 9px; }
.hklf { display: inline-flex; align-items: baseline; gap: 0; color: var(--t3); }
.hklf input { width: 58px; height: 26px; border: 1px solid var(--line2); border-radius: 5px; text-align: center; color: var(--t1); background: #fff; outline: none; font-size: 15px; }
.hklf input:focus { border-color: var(--t2); } .hklf input.bad { border-color: var(--bad); }
.readout { display: flex; gap: 16px; font-size: 12.5px; color: var(--t2); flex-wrap: wrap; align-items: baseline; }
.readout b { color: var(--t1); font-weight: 600; }
.readout .ext { color: var(--bad); font-weight: 600; }
.readout .ok { color: var(--ok); }
#xrd { display: block; width: 100%; user-select: none; }
#xrd .pk { cursor: pointer; }
#xrd .pk:hover line.stick { stroke: var(--acc); }
#xrd text { font-family: var(--font); }
#drawer input[type=range] { flex: 1; min-width: 140px; accent-color: var(--ink); height: 24px; }
.big { font-size: 18px; font-weight: 600; min-width: 64px; }
.presets { display: inline-flex; gap: 4px; }
.presets button { height: 24px; padding: 0 8px; border-radius: 5px; border: 1px solid var(--line2); background: #fff; font-size: 12px; color: var(--t2); white-space: nowrap; }
.presets button:hover { color: var(--t1); background: var(--s2); }
.presets button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- 오른쪽: AI 조교 ---------- */
.thread { padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 12px; }
.msg-q { align-self: flex-end; max-width: 88%; padding: 6px 10px; border-radius: 8px; background: var(--s3); font-size: 13px; }
.msg-a { font-size: 13.5px; line-height: 1.72; white-space: pre-wrap; }
.intro { color: var(--t2); font-size: 13px; line-height: 1.65; }
.busy-line { display: flex; align-items: center; gap: 8px; color: var(--t2); font-size: 12.5px; }
.spin { animation: rot 1s linear infinite; } @keyframes rot { to { transform: rotate(360deg); } }
.err { color: var(--bad); font-size: 12.5px; line-height: 1.5; }
.qlist { display: flex; flex-direction: column; gap: 4px; padding: 4px 16px 14px; }
.qlist button { align-self: flex-start; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--line2); font-size: 12.5px; line-height: 1.4; color: var(--t1); }
.qlist button:hover:not(:disabled) { background: var(--s2); }
.ask { flex: none; display: flex; gap: 2px; align-items: center; margin: 8px 10px 10px; border: 1px solid var(--line2); border-radius: 8px; padding: 3px 3px 3px 10px; background: #fff; }
.ask:focus-within { border-color: var(--t2); }
.ask input { flex: 1; border: 0; background: none; outline: none; height: 30px; font-size: 13px; }
.ask input::placeholder { color: var(--t3); }
#send { background: var(--ink); color: #fff; }
#send:hover:not(:disabled) { background: #2c3038; }
#mic { touch-action: none; user-select: none; -webkit-user-select: none; }
#mic.rec { background: var(--bad); color: #fff; animation: blink 1.2s infinite; }
.ask.rec { border-color: var(--bad); }
@keyframes blink { 50% { opacity: .55; } }

/* ---------- 태블릿·작은 노트북: 3D + 오른쪽 시트 ---------- */
@media (max-width: 1180px) {
  #app { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: 'top top' 'view sheet'; }
  #left, #right { grid-area: sheet; border-left: 1px solid var(--line); border-right: 0; padding-top: 40px; }
  #sheetTabs { display: flex; grid-area: sheet; align-self: start; z-index: 3; border-left: 1px solid var(--line); background: var(--bg); }
  body[data-sheet=lib] #right, body:not([data-sheet=lib]) #left { display: none; }
  #rightTabs { display: none; }
}
/* ---------- 휴대폰: 위 3D, 아래 시트 ---------- */
@media (max-width: 760px) {
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 46px 46% minmax(0, 1fr); grid-template-areas: 'top' 'view' 'sheet'; }
  #top { gap: 10px; }
  #srv .txt, #bar .txt { display: none; }
  #top .btn:disabled { display: none; }
  #left, #right, #sheetTabs { border-left: 0; }
  #left, #right { border-top: 1px solid var(--line); }
  #vbar { padding: 0 4px 0 12px; gap: 6px; }
  #title .meta { display: none; }
  .tb span { display: none; } .tb { padding: 0 7px; }
  #status .hint { display: none; }
  .tabs { gap: 16px; overflow-x: auto; scrollbar-width: none; }
  html, body { font-size: 14px; }
  .li { min-height: 36px; }
}
#drawer.in-sheet { border-top: 0; padding: 8px 14px; }
#drawer.in-sheet .close { display: none; }
.f .ko { font-family: var(--font); font-size: .86em; }

/* ---------- ④ 팀 기능 이식: 비교·역격자·측정·오비탈·공정 ---------- */
.lr { position: relative; }
.lr .cmpb { position: absolute; right: 10px; top: 5px; z-index: 1; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11px; font-weight: 600; color: var(--t2); background: #fff; border: 1px solid var(--line2); opacity: 0; transition: opacity .12s; }
.lr:hover .cmpb, .lr .cmpb:focus-visible, .lr .cmpb.on { opacity: 1; }
.lr .cmpb.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.lr .cmpb:hover { color: var(--t1); border-color: var(--t3); }
#sidecap { position: absolute; left: 0; right: 0; top: 10px; display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; padding: 0 12px; pointer-events: none; font-size: 12.5px; color: var(--t2); }
#sidecap[hidden] { display: none; }
#sidecap > span { text-align: center; }
#sidecap b { color: var(--t1); margin-right: 3px; }
#sidecap .f { font-size: 14px; color: var(--t1); }
#sidecap .dim { color: var(--t3); font-size: 11.5px; margin-left: 4px; }
#sidecap button { pointer-events: auto; }
.menu .mrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 8px; font-size: 12.5px; }
#legend .ob i { border-radius: 2px; }
.mtabs button { padding: 0 10px; }
.zones .f { font-size: 13px; }
.readout.dim { color: var(--t3); font-size: 12px; }
.msvg { width: 100%; overflow: hidden; }
.msvg svg { display: block; width: 100%; }
.msvg g[data-act] { cursor: pointer; }
.mcap { margin: 0 0 4px; font-size: 11.5px; color: var(--t3); line-height: 1.4; }
.mnote { display: flex; align-items: center; gap: 8px; min-height: 64px; margin: 0; font-size: 12.5px; color: var(--t2); }
.mnote.bad { color: var(--bad); }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--ink); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.mo-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 34%); gap: 12px; align-items: center; }
svg.mo { display: block; width: 100%; max-width: 560px; }
svg.mo .lv { cursor: pointer; }
svg.mo .lv:hover line { stroke-width: 3.5; }
.steps { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.steps span { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px 0 4px; border-radius: 12px; background: var(--s2); color: var(--t3); font-size: 12px; transition: background .2s, color .2s; }
.steps span b { width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; background: #fff; color: var(--t3); }
.steps span.on { background: var(--ink); color: #fff; }
.steps span.on b { color: var(--ink); }
.pnow { margin: 2px 0 2px; font-size: 13px; color: var(--t1); line-height: 1.5; min-height: 20px; }
#title .btn.ghost { margin-left: 10px; }
@media (max-width: 760px) {
  .mo-wrap { grid-template-columns: 1fr; }
  #sidecap { font-size: 11.5px; top: 6px; }
  #sidecap .dim { display: none; }
}
#sidecap .nb { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 10.5px; font-weight: 700; margin-right: 6px; vertical-align: 1px; }

/* ---------- 도구 막대: VR과 같은 묶음 | 대칭 | 면, 측정 | 더 보기 ---------- */
.vsep { width: 1px; height: 16px; background: var(--line2); margin: 0 2px; flex: none; }
.tb.pl { box-shadow: 0 0 0 2px var(--acc); }   /* AI가 방금 바꾼 도구 */
.phead[hidden], #status[hidden] { display: none; }
/* AI 답 아래: 화면에서 바뀐 것 */
.rcpt { list-style: none; margin: 8px 0 14px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--s1, #fafbfc); display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--t2); }
.rcpt li { display: flex; align-items: center; gap: 6px; }
.rcpt .i { color: var(--ok); flex: none; }
/* 3D 화면 오른쪽 아래 안내 한 줄 (상태줄 대신) */
#vhint { position: absolute; right: 14px; bottom: 10px; font-size: 12px; color: var(--t3); pointer-events: none; }
#vhint[hidden] { display: none; }
/* 서랍의 면 지수: 글처럼 보이고, 눌러야 입력칸 */
.hklf input { width: 40px; padding: 0; border-color: transparent; background: transparent; font-weight: 600; }
.hklf:hover input { border-color: var(--line2); }
.hklf input:focus { background: #fff; }
.readout { font-size: 13px; }
#xrd .ghost:hover line { stroke: var(--acc); }
#legend .lp { color: var(--acc); font-weight: 600; } #legend .lp i { background: var(--acc); box-shadow: none; }

/* 속성: 고른 면, 원자 자리 */
.is.sel h3 .hk { color: var(--acc); font-size: 13px; font-weight: 700; } .is.sel h3 .hk .f { font-size: 15px; color: var(--acc); }
.ih .meta span, .ih .meta .src { color: var(--t3); font-size: 12.5px; } .ih .meta .src { margin-left: auto; }
.ws { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ws td { padding: 3px 0; } .ws td:first-child { width: 64px; } .ws td.w { width: 56px; color: var(--t2); }
.ws td:first-child i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.ws .f { font-size: 14px; }
.is details.all summary { list-style: none; cursor: pointer; margin: 8px 0 4px; font-size: 12px; color: var(--t3); display: inline-flex; align-items: center; gap: 3px; }
.is details.all summary::-webkit-details-marker { display: none; }
.is details.all[open] summary svg { transform: rotate(180deg); }
#title .meta .gap { display: inline-block; width: 10px; }

/* AI 답 수준 (입력칸 위) */
.lvl { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 6px 12px 0; font-size: 12px; color: var(--t3); flex: none; }

/* ---------- 계산 탭: 카드 넷, 하나만 펼침 ---------- */
#pg-calc { padding: 6px 0 24px; }
.calc-empty { margin: 18px 16px; font-size: 12.5px; color: var(--t3); }
.ct { border-bottom: 1px solid var(--line); }
.ct-h { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; text-align: left; }
.ct-h span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ct-h b { font-size: 13px; font-weight: 600; color: var(--t1); }
.ct-h small { font-size: 11.5px; color: var(--t3); }
.ct-h svg { flex: none; color: var(--t3); transition: transform .15s; }
.ct-h:hover:not(:disabled) { background: var(--s1); }
.ct.open .ct-h svg { transform: rotate(180deg); }
.ct.off .ct-h { cursor: default; } .ct.off .ct-h b { color: var(--t3); }
.ct-b { padding: 0 16px 14px; }
.ct-b .lead { font-size: 12px; color: var(--t2); margin: 0 0 10px; line-height: 1.5; }
.ct-sub { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 0 4px; font-size: 12px; font-weight: 600; color: var(--t1); }
.ct-sub span { font-size: 11px; font-weight: 400; color: var(--t3); }
.r-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 6px 0; font-size: 12px; }
.r-row .rl { color: var(--t3); min-width: 20px; flex: none; font-size: 11.5px; }
.r-row .grow { flex: 1; margin: 0; min-width: 0; }
.r-kv { margin: 8px 0; grid-template-columns: 96px minmax(0, 1fr); }
.seg.wrap { flex-wrap: wrap; }
.sm-seg button { height: 20px; padding: 0 6px; font-size: 11px; }
.sent { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--t2); margin: 2px 0 4px; }
.sent .w { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.cs { height: 28px; max-width: 100%; padding: 0 22px 0 8px; border: 1px solid var(--line2); border-radius: 6px; background: #fff; color: var(--t1); font-size: 13px; }
.cs:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.btn.xs { height: 22px; padding: 0 8px; font-size: 11.5px; }
.rtbl { width: 100%; border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
.rtbl th { text-align: left; font-weight: 500; color: var(--t3); padding: 3px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rtbl td { padding: 4px; border-bottom: 1px solid var(--s2); color: var(--t1); }
.rtbl td:last-child, .rtbl th:last-child { text-align: right; }
.rtbl small { color: var(--t3); font-size: 10.5px; }
.rtbl.pick tbody tr { cursor: pointer; }
.rtbl.pick tbody tr:hover td { background: var(--s1); }
.rtbl tbody tr.on td { background: #e6fcf5; }
.okc { color: var(--ok); } .badc { color: var(--bad); }
.mini-svg { display: block; width: 100%; height: auto; margin: 4px 0 2px; background: var(--s1); border-radius: 6px; }
.ph-amp { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--t2); margin-left: auto; }
.ph-amp input { width: 72px; accent-color: var(--ink); }
.ph-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; max-height: 180px; overflow-y: auto; margin-top: 6px; }
.ph-m { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; padding: 5px 8px; border: 1px solid var(--line2); border-radius: 6px; font-size: 11.5px; background: #fff; font-variant-numeric: tabular-nums; }
.ph-m:hover { background: var(--s1); }
.ph-m.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.ph-m.on .dim { color: rgba(255,255,255,.7); }
.ph-m.imag b { color: var(--bad); } .ph-m.imag.on b { color: #ffc9c9; }
