/* INCHAE — 한 가지 무채색 판 + 강조 한 색. 단추 높이 32, 모서리 8, 글자 4단계(11·13·15·22) */
:root {
  --bg: #0c0d0f;
  --s1: #141518;      /* 판 */
  --s2: #1b1c20;      /* 판 안 칸·누름 */
  --s3: #24262b;      /* 올림 */
  --line: #26282d;
  --line-2: #33353b;
  --t1: #ececee;
  --t2: #a2a5ad;
  --t3: #6c6f77;
  --accent: #e9b65c;  /* 고른 것 하나에만 */
  --r: 8px;
  --h: 32px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--t1); font: 13px/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, output, kbd { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--t2); outline-offset: 2px; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

#stage { position: fixed; inset: 0; }
#gl { width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
#gl:active { cursor: grabbing; }

/* 기본 단추 */
.icon-btn, .text-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h); padding: 0 10px; border-radius: var(--r);
  border: 1px solid transparent; background: transparent; color: var(--t2);
}
.icon-btn { width: var(--h); padding: 0; }
.icon-btn:hover, .text-btn:hover { background: var(--s3); color: var(--t1); }

/* 위 */
.top { position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 0 16px; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand-name { font-family: var(--font); font-weight: 900; font-size: 19px; line-height: 1; letter-spacing: -.01em; color: var(--t1); }
.search { position: relative; flex: 1; max-width: 440px; margin: 0 auto; display: flex; align-items: center; }
.search .ic { position: absolute; left: 11px; color: var(--t3); pointer-events: none; }
.search input { width: 100%; height: 36px; padding: 0 36px 0 34px; border-radius: var(--r); border: 1px solid var(--line); background: var(--s1); color: var(--t1); font-size: 13px; }
.search input::placeholder { color: var(--t3); }
.search input:focus { outline: none; border-color: var(--line-2); background: var(--s2); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { position: absolute; right: 9px; height: 20px; min-width: 20px; padding: 0 5px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 5px; color: var(--t3); font-size: 11px; pointer-events: none; }
#results { position: absolute; top: 42px; left: 0; right: 0; max-height: 60vh; overflow: auto; padding: 4px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 32px rgba(0,0,0,.45); }
#results button { display: flex; width: 100%; align-items: baseline; gap: 8px; padding: 7px 10px; border: 0; border-radius: 6px; background: none; text-align: left; font-size: 13px; color: var(--t1); }
#results button:hover, #results button.on { background: var(--s3); }
#results .en { color: var(--t3); font-size: 12px; }
#results .sys { margin-left: auto; color: var(--t3); font-size: 11px; flex: none; }
.top-nav { display: flex; gap: 4px; }
.only-phone { display: none; }

/* 판 */
.panel { position: fixed; z-index: 4; background: var(--s1); border: 1px solid var(--line); border-radius: 10px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
#left { top: 64px; left: 12px; width: 236px; max-height: calc(100vh - 140px); padding: 6px; }
.tabs { display: flex; gap: 2px; padding: 2px; margin-bottom: 6px; background: var(--s2); border-radius: var(--r); }
.tabs button { flex: 1; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--t3); font-size: 12px; font-weight: 600; }
.tabs [aria-selected="true"] { background: var(--s3); color: var(--t1); }
/* 몸(남성·여성): 탭과 구분되게 테두리만 */
.seg { display: flex; gap: 2px; padding: 2px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: var(--r); }
.seg button { flex: 1; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--t3); font-size: 12px; font-weight: 600; }
.seg button:hover { color: var(--t1); }
.seg [aria-pressed="true"] { background: var(--s3); color: var(--t1); }
.sec-title { margin: 8px 8px 4px; font-size: 11px; font-weight: 600; color: var(--t3); letter-spacing: .02em; }

/* 계통 줄: 점 · 이름 · 수 · 눈 / 켜지면 투명도 막대 */
#systems { list-style: none; margin: 0; padding: 0; }
.sys { border-radius: 6px; }
.sys:hover { background: var(--s2); }
.sys-row { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px 0 8px; cursor: pointer; }
.sys .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; opacity: .3; }
.sys .nm { flex: 1; font-size: 13px; color: var(--t3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys .n { font-size: 11px; color: var(--t3); font-variant-numeric: tabular-nums; }
.sys .eye { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--t3); }
.sys .eye:hover { background: var(--s3); color: var(--t1); }
.sys .eye .on { display: none; }
.sys.on .dot { opacity: 1; }
.sys.on .nm { color: var(--t1); }
.sys.on .eye { color: var(--t2); }
.sys.on .eye .on { display: block; } .sys.on .eye .off { display: none; }
/* 켜진 계통: 구조 수 대신 작은 투명도 막대 */
.sys .op { display: none; width: 58px; flex: none; cursor: ew-resize; }
.sys.on .op { display: block; }
.sys.on .n { display: none; }
.spin { width: 10px; height: 10px; border: 1.5px solid var(--t3); border-top-color: transparent; border-radius: 50%; display: inline-block; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

#steps { list-style: none; margin: 0; padding: 0; counter-reset: st; }
#steps button { display: flex; align-items: center; gap: 10px; width: 100%; height: 26px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--t2); font-size: 12.5px; text-align: left; }
#steps button::before { counter-increment: st; content: counter(st); width: 18px; height: 18px; border-radius: 5px; background: var(--s2); color: var(--t3); font-size: 10.5px; display: grid; place-items: center; flex: none; }
#steps button:hover { background: var(--s2); color: var(--t1); }
#steps button.on { color: var(--t1); }
#steps button.on::before { background: var(--t1); color: var(--bg); }

/* 슬라이더 하나로 통일 */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 16px; background: transparent; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: var(--line-2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; background: var(--t1); border: 0; }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line-2); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--t1); border: 0; }

/* 분류 나무 */
#tree { font-size: 12.5px; padding: 0 2px 6px; }
#tree details { margin-left: 10px; }
#tree > details { margin-left: 0; }
#tree summary { list-style: none; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; border-radius: 6px; color: var(--t2); cursor: pointer; }
#tree summary::-webkit-details-marker { display: none; }
#tree summary::before { content: ""; width: 5px; height: 5px; border-right: 1.5px solid var(--t3); border-bottom: 1.5px solid var(--t3); transform: rotate(-45deg); margin-right: 3px; transition: transform .15s; }
#tree details[open] > summary::before { transform: rotate(45deg); }
#tree summary:hover, #tree .leaf:hover { background: var(--s2); color: var(--t1); }
#tree summary b { font-weight: 600; color: var(--t1); }
#tree .leaf { display: block; width: 100%; min-height: 28px; padding: 5px 6px 5px 20px; border: 0; border-radius: 6px; background: none; text-align: left; color: var(--t1); font-size: 12.5px; }
#tree .leaf.on { background: var(--s3); }
#tree small { color: var(--t3); font-size: 11px; margin-left: auto; }

/* 정보 판 */
#info { top: 64px; right: 12px; width: 380px; max-height: calc(100vh - 140px); padding: 0 0 20px; }
#info .close { position: absolute; top: 12px; right: 12px; z-index: 2; }
#info-body { padding: 16px 20px 0; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0 36px 10px 0; font-size: 11.5px; color: var(--t3); }
.crumbs i { font-style: normal; opacity: .6; margin: 0 2px; }
.crumbs button { padding: 2px 4px; border: 0; border-radius: 4px; background: none; color: var(--t3); font-size: 11.5px; }
.crumbs button:hover { color: var(--t1); background: var(--s2); }
#info h1 { margin: 0; font-size: 22px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
#info .kh { margin-top: 2px; font-size: 13px; color: var(--t2); }
.terms { display: grid; grid-template-columns: 52px 1fr; gap: 3px 10px; margin: 12px 0 14px; font-size: 12.5px; }
.terms dt { color: var(--t3); }
.terms dd { margin: 0; color: var(--t2); }
.terms .la { font-style: italic; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.acts button { height: 28px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: none; color: var(--t2); font-size: 12px; }
.acts button:hover { background: var(--s3); color: var(--t1); }
/* 정보 판 탭 */
.itabs { position: sticky; top: 0; z-index: 1; display: flex; gap: 18px; margin: 14px -20px 14px; padding: 0 20px; background: var(--s1); border-bottom: 1px solid var(--line); }
.itabs button { height: 36px; padding: 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--t3); font-size: 12.5px; font-weight: 600; margin-bottom: -1px; }
.itabs button[aria-selected="true"] { color: var(--t1); border-bottom-color: var(--t1); }
.itabs .c { color: var(--t3); font-weight: 500; margin-left: 3px; }
#info h2 { margin: 20px 0 6px; font-size: 11.5px; font-weight: 600; color: var(--t3); letter-spacing: .02em; }
#info [data-ipane] > h2:first-child { margin-top: 0; }
#info p, #info li { font-size: 13.5px; line-height: 1.72; color: #d6d7db; }
#info p { margin: 0 0 10px; }
#info ul { padding-left: 18px; margin: 4px 0 10px; }
#info b { color: var(--t1); font-weight: 600; }
.facts { display: grid; grid-template-columns: 76px 1fr; gap: 0; margin: 10px 0 4px; font-size: 13px; line-height: 1.6; border-top: 1px solid var(--line); }
.facts dt, .facts dd { padding: 8px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--t3); }
.facts dd { margin: 0; color: #d6d7db; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pills button { height: 26px; padding: 0 9px; border: 1px solid var(--line-2); border-radius: 6px; background: none; color: var(--t2); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.pills button:hover { background: var(--s3); color: var(--t1); }
.pills button.o::before, .pills button.e::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.pills button.o::before { background: #e5534b; }
.pills button.e::before { background: #4f8cff; }
.legend { display: flex; gap: 14px; margin: 2px 0 8px; font-size: 11.5px; color: var(--t3); }
.legend i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.src { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.6; color: var(--t3); }
.src a { text-decoration: underline; text-underline-offset: 2px; }
.en-desc { font-size: 13px !important; color: var(--t2) !important; }
details.more summary { cursor: pointer; color: var(--t2); font-size: 12.5px; margin: 6px 0; }
.parent-h { padding-top: 14px; border-top: 1px solid var(--line); }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gallery .g { padding: 0; aspect-ratio: 1; border: 0; border-radius: 6px; overflow: hidden; background: #f2f1ee; }
.gallery img { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform .2s; }
.gallery .g:hover img { transform: scale(1.04); }
.empty { color: var(--t3); font-size: 12.5px; padding: 8px 0; }

/* 아래 도구 막대 */
.hud { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 4px; height: 48px; padding: 0 8px; background: var(--s1); border: 1px solid var(--line); border-radius: 10px; max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none; }
.hud::-webkit-scrollbar { display: none; }
.sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; flex: none; }
.lb { font-size: 11.5px; color: var(--t3); white-space: nowrap; }
.lb.lead { display: inline-flex; align-items: center; gap: 6px; margin: 0 4px 0 2px; }
.tool-group { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.tool-group button { height: 30px; min-width: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--t2); font-size: 12px; white-space: nowrap; }
.tool-group button:hover { background: var(--s3); color: var(--t1); }
.tool-group button[aria-pressed="true"] { background: var(--s3); color: var(--t1); }
.tool-slide { display: inline-flex; align-items: center; gap: 7px; padding: 0 6px; color: var(--t3); flex: none; }
.tool-slide input { width: 96px; }
.tool-slide output { min-width: 66px; font-size: 11.5px; color: var(--t2); white-space: nowrap; }
.clip-pos { width: 90px; flex: none; margin: 0 4px; }
.tool { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; border: 0; border-radius: 6px; background: none; color: var(--t2); font-size: 12px; white-space: nowrap; flex: none; }
.tool:hover { background: var(--s3); color: var(--t1); }
.tool[aria-pressed="true"] { background: var(--t1); color: var(--bg); }

/* 숨긴 것 막대 */
#hidden-bar { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 4px 0 12px; background: var(--s1); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; color: var(--t2); }
#hidden-bar button { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border: 0; border-radius: 6px; background: none; color: var(--t1); font-size: 12px; }
#hidden-bar button:hover { background: var(--s3); }

/* 오른쪽 클릭 메뉴 */
#ctx { position: fixed; z-index: 30; min-width: 180px; padding: 4px; background: var(--s1); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.5); }
#ctx .hd { padding: 6px 10px 6px; font-size: 12px; font-weight: 600; color: var(--t1); border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
#ctx button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 16px; height: 30px; padding: 0 10px; border: 0; border-radius: 5px; background: none; color: var(--t2); font-size: 12.5px; text-align: left; }
#ctx button:hover { background: var(--s3); color: var(--t1); }
#ctx kbd { font-size: 11px; color: var(--t3); }

/* 이름표·툴팁 */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#labels .lm { position: absolute; transform: translate(-4px, -50%); pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; color: #fff; white-space: nowrap; text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,.9); }
#labels .lm::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.6); flex: none; }
#labels .lm.on { color: var(--accent); }
#labels .lm.on::before { background: var(--accent); }
#tip { position: fixed; z-index: 6; pointer-events: none; padding: 5px 9px; border-radius: 6px; background: rgba(12, 13, 15, 0.92); border: 1px solid var(--line-2); border-left: 3px solid #7fe0ff; font-size: 12.5px; font-weight: 600; transform: translate(14px, 14px); max-width: 300px; }
#tip small { display: block; color: var(--t3); font-weight: 400; font-size: 11px; }

#hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: 76px; white-space: nowrap; z-index: 3; font-size: 11.5px; color: var(--t3); pointer-events: none; transition: opacity .6s; }
#hint.out { opacity: 0; }

#loading { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 9; display: grid; gap: 10px; justify-items: center; color: var(--t3); font-size: 12px; }
#loading .bar { width: 160px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
#loading .bar i { display: block; height: 100%; width: 0; background: var(--t1); transition: width .2s; }

/* 확대 그림 */
#lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(8, 9, 10, 0.94); display: grid; place-items: center; padding: 24px 64px; }
#lightbox figure { margin: 0; max-width: min(1200px, 100%); display: grid; gap: 12px; justify-items: center; }
#lightbox img { max-width: 100%; max-height: calc(100vh - 160px); background: #fff; border-radius: 6px; }
#lightbox figcaption { display: grid; gap: 3px; text-align: center; font-size: 13px; max-width: 880px; }
#lightbox figcaption .en { color: var(--t2); font-size: 12px; }
#lightbox figcaption .by { color: var(--t3); font-size: 11px; }
#lightbox figcaption a { text-decoration: underline; }
#lightbox .lb-prev, #lightbox .lb-next, #lightbox .lb-x { position: fixed; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--s1); color: var(--t1); font-size: 20px; }
#lightbox .lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
#lightbox .lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
#lightbox .lb-x { top: 12px; right: 12px; font-size: 14px; }
/* 참고 영상: 썸네일 + 제목 두 줄 + 채널 */
.vids { display: grid; gap: 2px; }
.vid { display: grid; grid-template-columns: 132px 1fr; gap: 10px; align-items: start; width: 100%; padding: 6px; margin: 0 -6px; border: 0; border-radius: 8px; background: none; color: var(--t1); text-align: left; }
.vid:hover { background: var(--s2); }
.vid .th { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--s2); }
.vid .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid .th i { position: absolute; right: 4px; bottom: 4px; padding: 0 4px; border-radius: 4px; background: rgba(0,0,0,.8); font: 600 10.5px/16px var(--font); font-style: normal; color: #fff; }
.vid .vt { display: grid; gap: 4px; min-width: 0; }
.vid b { font-size: 12.5px; font-weight: 500; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vid small { font-size: 11.5px; color: var(--t3); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.vid em { white-space: nowrap; font-style: normal; font-size: 10.5px; color: var(--t2); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; line-height: 15px; }
.vnote { margin-top: 12px; font-size: 11px; color: var(--t3); }
/* 영상 창 폭은 높이에서도 정한다 — 낮은 화면에서 16:9 가 깨지면 재생기 크롭(famytp)이 영상 위아래를 자른다 */
#lightbox .lb-vid { width: min(1100px, 100%, calc((100vh - 150px) * 16 / 9)); justify-items: stretch; }
#lightbox .lb-vid .frame { aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; }
#lightbox .lb-vid .frame > div { width: 100%; height: 100%; }
#lightbox .lb-n { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); color: var(--t3); font-size: 12px; }

#mbar, #hint-touch, .grab, .pop-h { display: none; }

/* 폰: 아래 도구 막대 9칸 한 줄(옆으로 밀 필요 없음), 방향·나누기·층·단면은 그 위 작은 판, 해설은 끌어 올리는 판 */
@media (max-width: 860px) {
  .top { gap: 8px; padding: 0 10px; height: 52px; background: linear-gradient(rgba(12, 13, 15, .94) 60%, rgba(12, 13, 15, 0)); }
  .search kbd { display: none; }
  .search input { font-size: 16px; height: 38px; } /* 16px 미만이면 아이폰이 누를 때 화면을 확대한다 */
  #results { position: fixed; top: 52px; left: 8px; right: 8px; max-height: calc(100dvh - 140px); }
  #results button { padding: 10px 12px; }
  .only-phone { display: inline-flex; }
  .icon-btn { width: 40px; height: 40px; }
  .text-btn { height: 40px; }
  .text-btn span { display: none; }

  #left { top: 56px; left: 8px; right: 8px; width: auto; max-height: calc(100dvh - 140px); display: none; z-index: 6; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
  body.left-open #left { display: block; }
  .seg button { height: 34px; font-size: 13px; }
  .tabs button { height: 36px; font-size: 13px; }
  .sys-row { height: 44px; }
  .sys .nm { font-size: 14.5px; }
  .sys .op { width: 84px; }
  .sys .eye { width: 36px; height: 36px; }
  #steps button { height: 38px; font-size: 14px; }
  #regions button { height: 44px; font-size: 14.5px; }
  #tree { font-size: 14px; }
  #tree summary { height: 40px; }
  #tree .leaf { min-height: 40px; font-size: 14px; }
  #tree .tv { display: inline-block; padding: 3px 8px; font-size: 12px; }
  .sec-title { font-size: 12px; margin: 12px 8px 6px; }
  .note { font-size: 12.5px; }

  /* 해설 판 = 아래에서 올라오는 판. 손잡이를 끌어 높이를 바꾸고, 누르면 반 ↔ 전체 */
  #info { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: none; height: var(--sheet, 52dvh); border-radius: 14px 14px 0 0; border-bottom: 0; z-index: 7; padding-bottom: calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 32px rgba(0, 0, 0, .45); transition: height .22s ease; }
  #info.drag { transition: none; }
  .grab { display: grid; place-items: center; position: sticky; top: 0; z-index: 3; height: 24px; margin-bottom: -8px; background: var(--s1); touch-action: none; cursor: grab; }
  .grab i { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); }
  #info .close { top: 14px; right: 10px; }
  #info-body { padding: 8px 18px 0; }
  .itabs { top: 16px; margin: 14px -18px 14px; padding: 0 18px; gap: 22px; }
  .itabs button { height: 44px; font-size: 14px; }
  #info h1 { font-size: 24px; }
  #info .kh { font-size: 14px; }
  #info h2 { font-size: 12.5px; }
  #info p, #info li { font-size: 15px; line-height: 1.75; }
  #info .key li { font-size: 14.5px; }
  .crumbs { font-size: 12.5px; margin-right: 44px; }
  .crumbs button { padding: 6px 4px; font-size: 12.5px; }
  .terms { font-size: 13.5px; grid-template-columns: 56px 1fr; }
  .facts { font-size: 14px; grid-template-columns: 84px 1fr; }
  .acts { gap: 8px; }
  .acts button { height: 38px; padding: 0 14px; font-size: 13.5px; }
  .pills { gap: 6px; }
  .pills button { height: 36px; padding: 0 12px; font-size: 13.5px; }
  .vid b { font-size: 13.5px; }
  .src, .vnote { font-size: 12px; }

  /* 아래 도구 막대 */
  .hud { display: none; }
  #mbar { display: flex; position: fixed; z-index: 5; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); height: 58px; padding: 0 2px; background: var(--s1); border: 1px solid var(--line); border-radius: 12px; }
  #mbar button { position: relative; flex: 1; min-width: 0; margin: 4px 1px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 8px; background: none; color: var(--t2); font-size: 10.5px; line-height: 1; white-space: nowrap; }
  #mbar .ic { width: 20px; height: 20px; }
  #mbar button.open { background: var(--s3); color: var(--t1); }
  #mbar button[aria-pressed="true"] { background: var(--t1); color: var(--bg); }
  #mbar button.set::after { content: ""; position: absolute; top: 6px; right: calc(50% - 16px); width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
  /* 작은 판: 고른 묶음만 보인다 */
  body[data-pop] .hud { display: flex; flex-wrap: wrap; left: 8px; right: 8px; bottom: calc(74px + env(safe-area-inset-bottom)); transform: none; max-width: none; height: auto; padding: 4px 10px 12px; gap: 8px; overflow: visible; border-radius: 12px; box-shadow: 0 -8px 28px rgba(0, 0, 0, .4); }
  body[data-pop] .hud > :not(.pop-h) { display: none; }
  body[data-pop="view"] .hud [data-grp="view"], body[data-pop="explode"] .hud [data-grp="explode"], body[data-pop="peel"] .hud [data-grp="peel"], body[data-pop="clip"] .hud [data-grp="clip"] { display: flex; }
  .pop-h { display: flex; width: 100%; align-items: center; justify-content: space-between; height: 40px; }
  .pop-h b { font-size: 13px; font-weight: 600; color: var(--t2); }
  .hud .tool-group { width: 100%; gap: 4px; }
  .hud .tool-group button { flex: 1; height: 40px; font-size: 14px; background: var(--s2); }
  .hud .tool-group button[aria-pressed="true"] { background: var(--t1); color: var(--bg); }
  .hud .lb.lead { display: none; }
  .hud .tool-slide { width: 100%; padding: 0 4px; gap: 12px; }
  .hud .tool-slide .ic, .hud .tool-slide .lb { display: none; }
  .hud .tool-slide input { flex: 1; width: auto; }
  .hud .tool-slide output { min-width: 92px; font-size: 13px; text-align: right; }
  .hud .clip-pos { width: 100%; margin: 4px 0 0; }

  #hint { display: none; }
  #hint-touch { display: block; position: fixed; left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 3; text-align: center; font-size: 12px; color: var(--t2); pointer-events: none; transition: opacity .6s; }
  #hint-touch.out { opacity: 0; }
  #hidden-bar { bottom: calc(76px + env(safe-area-inset-bottom)); height: 40px; max-width: calc(100vw - 16px); }
  #hidden-bar button { height: 34px; font-size: 13px; }
  body[data-pop] #hidden-bar { display: none; }
  #ctx { min-width: 220px; }
  #ctx .hd { font-size: 13.5px; padding: 10px 12px; }
  #ctx button { height: 44px; font-size: 14px; }
  #ctx kbd { display: none; }
  #labels .lm { font-size: 12px; padding: 4px 0; }
  #lightbox { padding: 60px 8px calc(16px + env(safe-area-inset-bottom)); }
  #lightbox .lb-prev, #lightbox .lb-next { width: 44px; height: 44px; top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); transform: none; }
  #lightbox img { max-height: calc(100dvh - 220px); }
}
/* 폰 가로: 해설 판을 오른쪽에 세워 모형을 가리지 않게 */
@media (max-width: 860px) and (orientation: landscape) and (max-height: 520px) {
  #info { top: 52px; left: auto; width: min(400px, 52vw); height: auto; border-radius: 14px 0 0 0; }
  .grab { display: none; }
  .itabs { top: 0; }
  #left { max-height: calc(100dvh - 130px); right: auto; width: min(340px, 48vw); }
  #mbar, body[data-pop] .hud { right: auto; width: min(460px, calc(48vw - 16px)); }
  #hidden-bar { left: 8px; transform: none; }
}
/* 태블릿·좁은 PC: 도구 막대 글자를 줄여 한 줄에 다 들어가게(이름은 단추 위 안내로) */
@media (min-width: 861px) and (max-width: 1240px) {
  .tool span, .tool-slide .lb, .hud .lb.lead { display: none; }
  .tool { padding: 0 8px; }
  .tool-slide input { width: 80px; }
  .tool-slide output { min-width: 0; }
  .sep { margin: 0 3px; }
}
/* 손가락 기기: 마우스 안내 대신 손가락 안내 */
@media (pointer: coarse) and (min-width: 861px) {
  #hint { display: none; }
  #hint-touch { display: block; position: fixed; left: 50%; transform: translateX(-50%); bottom: 76px; z-index: 3; white-space: nowrap; font-size: 12px; color: var(--t2); pointer-events: none; transition: opacity .6s; }
  #hint-touch.out { opacity: 0; }
}
/* 손가락: 막대 손잡이를 크게 */
@media (pointer: coarse) {
  input[type="range"] { height: 32px; }
  input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -9.5px; }
  input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
}

/* 찾기 결과: 이름 / 한자어·영어 / 분류 경로 */
#results button { display: grid; gap: 1px; padding: 8px 10px; }
#results .r1 { display: flex; align-items: center; gap: 8px; }
#results .r1 b { font-weight: 600; color: var(--t1); }
#results .r2 { font-size: 11.5px; color: var(--t2); }
#results .r3 { font-size: 11px; color: var(--t3); }
#results .tag { font-size: 10.5px; color: var(--t3); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; line-height: 16px; }
#results .none { padding: 14px 12px; color: var(--t3); font-size: 12.5px; }

/* 부위 목록 */
#regions { list-style: none; margin: 0; padding: 0; }
#regions button { display: flex; align-items: center; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--t2); font-size: 13px; text-align: left; }
#regions button:hover { background: var(--s2); color: var(--t1); }
#regions button.on { background: var(--s3); color: var(--t1); }
#regions .nm { flex: 1; }
#regions .n { font-size: 11px; color: var(--t3); font-variant-numeric: tabular-nums; }
.note { margin: 8px 8px 4px; font-size: 11.5px; color: var(--t3); line-height: 1.5; }
button.link { padding: 0; border: 0; background: none; color: var(--t2); font: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* 분류 나무: 이름 · 수 · 「보기」 */
#tree summary .tn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tree summary small { margin-left: 0; }
#tree .tv { display: none; font-size: 11px; color: var(--t2); padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 4px; }
#tree summary:hover .tv { display: inline-block; }
#tree .tv:hover { color: var(--t1); background: var(--s3); }

/* 찾기 칸을 비우고 누르면: 저장한 구조 · 최근 본 구조 */
#results .hd { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; color: var(--t3); }
/* 정보 판 단추: 저장(별) · 주소 복사 · 백과 */
.acts button.ico { display: inline-flex; align-items: center; gap: 5px; }
.acts button.ico .ic { width: 14px; height: 14px; }
.acts button.on { color: var(--accent); border-color: rgba(233, 182, 92, .45); }
.acts button.on .ic { fill: currentColor; }
.acts .btn-a { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; color: var(--t2); font-size: 12px; }
.acts .btn-a:hover { background: var(--s3); color: var(--t1); }
@media (max-width: 860px) { .acts .btn-a { height: 38px; padding: 0 14px; font-size: 13.5px; } }

/* 알림 */
#toast { position: fixed; left: 50%; top: 68px; z-index: 40; transform: translate(-50%, -8px); opacity: 0; pointer-events: none; padding: 8px 14px; border-radius: 8px; background: var(--s3); border: 1px solid var(--line-2); font-size: 12.5px; color: var(--t1); box-shadow: 0 8px 24px rgba(0,0,0,.4); transition: opacity .2s, transform .2s; white-space: nowrap; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 단축키 안내(? 키) */
#keys { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30; width: 360px; padding: 12px 16px 16px; background: var(--s1); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 16px 48px rgba(0,0,0,.55); }
#keys .hd { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 700; margin-bottom: 8px; }
#keys dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0; font-size: 12.5px; }
#keys dt { text-align: right; } #keys dd { margin: 0; color: var(--t2); }
#keys kbd, #hint kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line-2); border-radius: 5px; font-size: 11px; line-height: 18px; color: var(--t2); }

/* 3D 시험 판: PC = 오른쪽(해설 판 자리), 폰 = 아래 */
#quiz { top: 64px; right: 12px; width: 340px; max-height: calc(100vh - 140px); padding: 14px 16px 16px; z-index: 6; }
body.quiz #left, body.quiz #hidden-bar, body.quiz #info { display: none !important; }
.qz-h { display: flex; align-items: center; gap: 10px; margin: -4px -6px 8px 0; min-height: 32px; }
.qz-h b { font-size: 15px; }
.qz-h .icon-btn { margin-left: auto; }
.qz-c { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.qz-s { font-size: 12px; color: var(--t3); }
.qz-bar { height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 14px; }
.qz-bar i { display: block; height: 100%; background: var(--t2); transition: width .3s; }
.qz-l { margin: 12px 0 6px; font-size: 11px; font-weight: 600; color: var(--t3); }
.qz-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.qz-seg button { display: grid; gap: 2px; padding: 9px 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: none; text-align: left; color: var(--t2); }
.qz-seg button b { font-size: 13px; } .qz-seg button small { font-size: 11px; color: var(--t3); line-height: 1.35; }
.qz-seg button[aria-pressed="true"] { border-color: var(--t2); background: var(--s2); color: var(--t1); }
.qz-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.qz-chips button { height: 28px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 6px; background: none; color: var(--t2); font-size: 12px; }
.qz-chips button:hover { color: var(--t1); background: var(--s3); }
.qz-chips button[aria-pressed="true"] { background: var(--t1); border-color: var(--t1); color: var(--bg); }
.qz-n { margin: 14px 0 10px; font-size: 12px; color: var(--t3); }
.qz-go { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 36px; border: 0; border-radius: var(--r); background: var(--t1); color: var(--bg); font-size: 13px; font-weight: 700; }
.qz-go:hover { background: #fff; }
.qz-go:disabled { opacity: .35; cursor: default; }
.qz-go kbd { font-size: 10.5px; opacity: .55; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; line-height: 15px; }
.qz-t { margin: 0 0 10px; font-size: 13px; color: var(--t2); }
.qz-opts { display: grid; gap: 6px; }
.qz-opts button { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: none; color: var(--t1); font-size: 14px; text-align: left; }
.qz-opts button:hover:not(:disabled) { background: var(--s3); }
.qz-opts kbd { flex: none; width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 5px; color: var(--t3); font-size: 11px; }
.qz-opts button:disabled { opacity: .5; cursor: default; }
.qz-opts button.ok { opacity: 1; border-color: #4caf7a; box-shadow: inset 3px 0 0 #4caf7a; }
.qz-opts button.no { opacity: 1; border-color: #e5534b; box-shadow: inset 3px 0 0 #e5534b; }
.qz-name { font-size: 24px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.qz-sub { margin-top: 2px; font-size: 12.5px; color: var(--t2); }
.qz-acts { display: flex; gap: 6px; margin-top: 14px; }
.qz-acts.two > * { flex: 1; }
.qz-acts button:not(.qz-go) { height: 36px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r); background: none; color: var(--t2); font-size: 13px; }
.qz-acts button:not(.qz-go):hover { background: var(--s3); color: var(--t1); }
.qz-skip { margin-left: auto; }
.qz-fb { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 3px; font-size: 13px; color: var(--t2); }
.qz-fb > b { font-size: 14px; } .qz-fb.ok > b { color: #6fcf97; } .qz-fb.no > b { color: #f08a84; }
.qz-fb span b { color: var(--t1); }
.qz-fb small { font-size: 11.5px; color: var(--t3); }
.qz-score { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 6px; }
.qz-score b { font-size: 40px; line-height: 1; font-weight: 800; }
.qz-score span { font-size: 16px; color: var(--t2); }
.qz-score em { margin-left: auto; font-style: normal; font-size: 14px; color: var(--t3); }
#quiz .pills { margin-top: 2px; }
@media (max-width: 860px) {
  #quiz { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 58dvh; border-radius: 14px 14px 0 0; border-bottom: 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 32px rgba(0,0,0,.45); }
  body.quiz #mbar, body.quiz .hud { display: none !important; }
  .qz-opts { grid-template-columns: 1fr 1fr; }
  .qz-opts button { min-height: 48px; font-size: 14.5px; padding: 6px 10px; }
  .qz-opts kbd, .qz-go kbd { display: none; }
  .qz-chips button { height: 36px; padding: 0 12px; font-size: 13.5px; }
  .qz-go, .qz-acts button:not(.qz-go) { height: 44px; font-size: 14.5px; }
  .qz-seg button { padding: 10px; } .qz-seg button b { font-size: 14px; }
  .qz-name { font-size: 22px; }
  #toast { top: 60px; }
}
@media (max-width: 860px) and (orientation: landscape) and (max-height: 520px) {
  #quiz { top: 52px; left: auto; width: min(380px, 50vw); max-height: none; border-radius: 14px 0 0 0; }
}

/* 꼭 알아둘 점 */
.key { margin: 4px 0 12px; padding: 10px 12px; background: var(--s2); border-radius: 8px; border-left: 2px solid var(--t2); }
.key-h { font-size: 11px; font-weight: 600; color: var(--t3); margin-bottom: 4px; }
#info .key ul { margin: 0; padding-left: 16px; }
#info .key li { font-size: 13px; line-height: 1.6; }

/* 폰: 머리의 로고·분야 글자는 보이는 크기가 작다 — 누르는 자리만 넓힘 */
@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; }
}
