/* 부품 분해 보기 — 밝은 스튜디오 + 강조색 하나(teardown 원칙 5) · 거의 흰 바탕 · 가독성 */
@font-face { font-family: 'SUIT'; src: url('/public/edu3d/fonts/SUIT-Medium.otf') format('opentype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'SUIT'; src: url('/public/edu3d/fonts/SUIT-ExtraBold.otf') format('opentype'); font-weight: 800; font-display: swap; }
:root {
  --bg: #F4F5F7; --ink: #1E2126; --sub: #5B616B; --faint: #8A9099; --line: #DDE0E5; --card: rgba(255, 255, 255, 0.94);
  --accent: #D9480F; --accent-soft: #FCEDE5; --shadow: 0 10px 40px rgba(30, 33, 38, 0.10);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: radial-gradient(120% 90% at 40% 45%, #FFFFFF 0%, var(--bg) 60%, #E9EBEF 100%); color: var(--ink);
  font-family: 'SUIT', -apple-system, 'Apple SD Gothic Neo', sans-serif; font-weight: 500; overflow: hidden; }
button { font: inherit; cursor: pointer; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.head { position: fixed; left: 28px; top: 22px; pointer-events: none; }
.head .over { margin: 0; font-size: 13px; color: var(--sub); letter-spacing: 0.02em; }
.head h1 { margin: 2px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.head .hint { margin: 6px 0 0; font-size: 12.5px; color: var(--faint); }

/* 둘러보기 이름표(작은 판) */
.cap { position: fixed; left: 22px; bottom: 84px; width: 404px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px 12px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.cap .cgrp { margin: 0; font-size: 12.5px; color: var(--accent); font-weight: 800; }
.cap .cname { margin: 2px 0 2px; font-size: 21px; font-weight: 800; }
.cap .crole { margin: 0; font-size: 14px; line-height: 1.6; color: var(--sub); word-break: keep-all; }
.cbtn { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin-top: 12px; }   /* 11-15 위 줄 = 둘러보기 · 프롭 회전, 아래 줄 = 자세히 · 이전 · 다음 · 전체 · 배선도 */
.cbtn button.play { grid-column: span 5; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 800; }
.cbtn button.play:hover { filter: brightness(1.06); }
.cbtn button.play.on { background: var(--ink); border-color: var(--ink); }
.cbtn button.more { font-weight: 800; }
.cbtn #more, .cbtn #prev, .cbtn #next, .cbtn #all, .cbtn #wiring { grid-column: span 2; white-space: nowrap; }
.cbtn button.spin { grid-column: span 5; color: var(--accent); border-color: var(--accent); font-weight: 800; }   /* 11-15 프롭 회전 */
.cbtn button.spin.on { background: var(--accent); color: #fff; }
.cbtn button { font-size: 13px; padding: 8px 0; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.cbtn button.pri { background: var(--ink); color: #fff; border-color: var(--ink); }
.cbtn button:hover { border-color: var(--accent); }

/* 설명 모달(오른쪽 판 · 휴대폰은 아래 판) */
.modal { position: fixed; right: 22px; top: 22px; bottom: 22px; width: 460px; display: flex; flex-direction: column; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.modal[hidden] { display: none; }
.mhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 10px; }
.mgrp { margin: 0; font-size: 13px; color: var(--accent); font-weight: 800; letter-spacing: 0.02em; }
.mhead h2 { margin: 4px 0 2px; font-size: 26px; font-weight: 800; line-height: 1.2; }
.mstep { margin: 0; font-size: 12px; color: var(--faint); }
.close { flex: none; font-size: 13px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--sub); }
.close:hover { border-color: var(--accent); color: var(--ink); }
.mbtn { display: flex; gap: 6px; flex: none; }
/* 접힌 설명 판(11-15) — 오른쪽 위 작은 단추 */
.unfold { position: fixed; right: 22px; top: 22px; font-size: 12.5px; font-weight: 800; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--sub); box-shadow: var(--shadow); }
.unfold:hover { border-color: var(--accent); color: var(--accent); }
.unfold[hidden] { display: none; }
.tabs[hidden] { display: none; }
.tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { flex: none; font-size: 14px; padding: 10px 10px 9px; border: 0; background: none; color: var(--sub); border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 800; border-bottom-color: var(--accent); }
.mbody { flex: 1; overflow: auto; padding: 16px 22px 20px; }
.mbody h3 { margin: 18px 0 8px; font-size: 13px; color: var(--sub); font-weight: 800; letter-spacing: 0.02em; }
.mbody h3:first-child { margin-top: 2px; }
.mbody p { margin: 0 0 8px; font-size: 15px; line-height: 1.75; word-break: keep-all; }
.mbody .lead { font-size: 17px; font-weight: 800; line-height: 1.55; }
.mbody .quote { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; font-size: 14.5px; line-height: 1.75; }
.mbody .src { margin: 6px 0 0; font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.mbody ul { margin: 0; padding: 0 0 0 18px; font-size: 14.5px; line-height: 1.7; }
.mbody li { margin: 0 0 3px; word-break: keep-all; }
.mbody table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mbody th, .mbody td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; word-break: keep-all; }
.mbody th { color: var(--sub); font-weight: 800; white-space: nowrap; }
.mbody td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mbody table.kv th { white-space: normal; width: 36%; color: var(--ink); }
.mbody table.kv td { color: var(--sub); }
.mbody table.pages th { white-space: normal; color: var(--ink); font-weight: 600; }
.els { display: flex; flex-wrap: wrap; gap: 6px; }
.els button, .links button { font-size: 13px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.els button:hover, .els button.on, .links button:hover { border-color: var(--accent); background: var(--accent-soft); }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links button small { color: var(--faint); margin-left: 5px; font-size: 11.5px; }
.note { font-size: 12.5px; color: var(--sub); background: var(--bg); border-radius: 10px; padding: 10px 12px; line-height: 1.6; }
.mfoot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.mfoot button { font-size: 14px; padding: 10px 0; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.mfoot button:hover { border-color: var(--accent); }

.foot { position: fixed; left: 22px; right: 22px; bottom: 18px; display: flex; align-items: center; gap: 16px; }
.ex { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; white-space: nowrap; }
.ex input { width: 150px; accent-color: var(--accent); }
.ex output { width: 34px; font-variant-numeric: tabular-nums; color: var(--ink); }
.ex .exb { flex: none; font-size: 12px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.ex .exb:hover { border-color: var(--accent); color: var(--accent); }
.ex .exl { order: 0; } .ex #ex0 { order: 1; } .ex input { order: 2; } .ex #ex1 { order: 3; } .ex output { order: 4; }   /* 휴대폰 한 줄: 분해 · 합체 · 막대 · 최대 · 값 */
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 2px; font-size: 12.5px; font-weight: 800; color: var(--sub); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 18px; height: 4px; border-radius: 2px; }
.chips { flex: 1; display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px; scrollbar-width: thin; }
.chips .g { display: flex; gap: 4px; align-items: center; padding: 0 8px 0 0; margin-right: 4px; border-right: 1px solid var(--line); }
.chips .g:last-child { border-right: 0; }
.chips .gl { font-size: 11.5px; color: var(--faint); margin-right: 2px; white-space: nowrap; }
.chips button { font-size: 13px; white-space: nowrap; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips button:hover { border-color: var(--accent); }
.tip, .tag { position: fixed; pointer-events: none; font-size: 13px; padding: 4px 9px; border-radius: 7px; white-space: nowrap; transform: translate(-50%, -140%); }
.tip { background: var(--ink); color: #fff; }
.tag { background: #fff; color: var(--accent); border: 1px solid var(--accent); font-weight: 800; }
.tag.end { color: var(--ink); border-color: var(--ink); }
.tag.w { background: var(--accent); color: #fff; font-weight: 800; transform: translate(-50%, 40%); }
/* 배선도(11-15) — 굵은 선 전원 · 가는 선 신호 · 점선 동축 · 강조색은 고른 연결선 하나 */
.sch { display: block; width: 100%; height: auto; margin: 0 0 2px; font-family: inherit; }
.sch .nt { font-size: 12.5px; font-weight: 800; }
.sch .lb { font-size: 11px; font-weight: 800; }
.sch .hit, .sch g.n { cursor: pointer; }
.sch g.e:hover .ln { stroke-opacity: 1; }
.sch g.e:hover .dot { fill-opacity: 1; }
.sch g.n:hover rect { stroke: var(--accent); }
.chips .g.w .gl { color: var(--accent); font-weight: 800; }
/* 시뮬레이션 속도(11-15) — 둘러보기 · 프롭 회전에 함께 */
.speed { display: flex; align-items: center; gap: 4px; margin-top: 9px; font-size: 12px; color: var(--sub); }
.speed span { margin-right: 4px; font-weight: 800; }
.speed button { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-variant-numeric: tabular-nums; }
.speed button:hover { border-color: var(--accent); }
.speed button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.speed.mini { display: none; }
/* 묶음 이름 단추(11-15) — 글씨처럼 보이되 누르면 그 묶음 전체 */
.chips button.gl { border: 0; background: none; padding: 2px 0; border-radius: 0; font-size: 11.5px; color: var(--faint); cursor: pointer; }
.chips button.gl:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.chips button.gl.on { background: none; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
/* 연결점(11-15) — 선이 부품에 닿는 자리 · 확대와 상관없이 같은 크기 */
.jdot { position: fixed; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 2.5px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(217, 72, 15, 0.16); transform: translate(-50%, -50%); pointer-events: none; }
.sch.pins .pn { font-size: 12px; font-weight: 800; }
.load { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; font-size: 15px; color: var(--sub); }
/* 11-15 주인님 지시(하단부에 있는 부품 목록 카테고리를 화면 좌측으로) — 넓은 화면은 왼쪽 세로 판 · 묶음마다 이름 줄 + 단추 줄바꿈 */
@media (min-width: 821px) {
  .side { position: fixed; left: 22px; top: 118px; bottom: 18px; width: 268px; display: flex; flex-direction: column; gap: 10px; }   /* 11-15 목록 + 이름표 판 한 열 */
  .side .foldrow { display: flex; gap: 6px; flex: none; align-self: flex-start; }
  .side .mini { display: none; } body.side-off .side .mini { display: inline-block; }
  body.side-off .side .speed.mini { display: flex; margin: 0; padding: 2px 6px 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); box-shadow: var(--shadow); }
  .side .mini.on { background: var(--ink); border-color: var(--ink); color: #fff; }
  .side .fold { align-self: flex-start; flex: none; font-size: 12.5px; font-weight: 800; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--card); color: var(--sub); box-shadow: var(--shadow); }
  .side .fold:hover { border-color: var(--accent); color: var(--accent); }
  body.side-off .side { bottom: auto; width: auto; }
  body.side-off .side .foot, body.side-off .side .cap { display: none; }
  .side .foot { position: static; flex: 1 1 auto; min-height: 120px; width: auto; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(6px); padding: 4px 0; }
  .ex { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "l l o" "a s b"; row-gap: 6px; column-gap: 6px; align-items: center;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 10px 14px 11px 16px; }
  .ex .exl { grid-area: l; } .ex output { grid-area: o; text-align: right; }
  .ex #ex0 { grid-area: a; } .ex #ex1 { grid-area: b; }
  .ex input { grid-area: s; width: auto; min-width: 0; }
  .chips { flex: 1; flex-direction: column; gap: 0; overflow-x: hidden; overflow-y: auto; padding: 0 10px 6px 16px; }
  .chips .g { flex-wrap: wrap; gap: 5px; padding: 10px 0 10px; margin: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .chips .g:last-child { border-bottom: 0; }
  .chips .gl { flex: 0 0 100%; margin: 0 0 1px; font-weight: 800; color: var(--sub); text-align: left; }
  .chips button.gl { color: var(--sub); }
  .chips button { font-size: 12.5px; padding: 5px 10px; background: #fff; }
  .side .cap { position: static; width: auto; flex: none; padding: 12px 14px 12px; }
  .side .cap .cname { font-size: 19px; } .side .cap .crole { font-size: 13px; line-height: 1.55; }
  .side .cbtn button { font-size: 12.5px; padding: 7px 0; }
}
@media (max-width: 820px) {
  .side { display: contents; } .side .fold, .side .foldrow { display: none; }
  .head { left: 16px; top: 14px; } .head h1 { font-size: 21px; } .head .hint { display: none; }
  .cap { left: 12px; right: 12px; width: auto; bottom: 112px; }
  .modal { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 72vh; border-radius: 16px 16px 0 0; }
  body.open .foot { right: 12px; } body.open .cap { display: none; }
  .foot { left: 12px; right: 12px; bottom: 12px; flex-direction: column; align-items: stretch; gap: 8px; }
  .ex input { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }

/* 교육 콘텐츠(/contents) — build_edu3d.py 덧붙임 · 그리는 쪽은 site.js */
.kbx { padding-left: 18px; } .kbx li { margin: 0 0 6px; } .kbx a, .mbody p > a { color: var(--accent); font-weight: 800; }
.kbx small { color: var(--sub); }
/* 계산기(셈 = calc-spec.js) */
.kcalc { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.mbody .kcalc-d { margin: 0 0 10px; font-size: 12.5px; color: var(--sub); line-height: 1.6; }
.kcalc-f { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.kcalc-f label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--sub); }
.kcalc-in { display: flex; align-items: center; gap: 6px; }
.kcalc-in input { width: 100%; min-width: 0; font: inherit; font-size: 15px; color: var(--ink); padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-variant-numeric: tabular-nums; }
.kcalc-in input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.kcalc-in small { flex: none; font-size: 12px; color: var(--faint); }
.kcalc-o { margin-top: 12px; }
.kcalc-v { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.kcalc-v b { display: block; font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mbody .kcalc-v p { margin: 2px 0 0; font-size: 14px; line-height: 1.6; }
.kcalc-v.bad { background: var(--accent-soft); } .kcalc-v.bad b { color: var(--accent); }
.mbody .kcalc-s { margin: 8px 0 0; font-size: 12.5px; color: var(--sub); line-height: 1.7; font-variant-numeric: tabular-nums; }
/* 회원 전용 안내(사이트 게이트와 같은 말) */
.gate { margin: 14px 0 4px; border: 1px solid var(--accent); border-radius: 10px; padding: 14px 16px; background: var(--accent-soft); }
.mbody .gate-e, .wall .gate-e { margin: 0; font-size: 12.5px; font-weight: 800; color: var(--accent); }
.mbody .gate-t, .wall .gate-t { margin: 4px 0 12px; font-size: 15px; line-height: 1.6; }
.gate-a { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gate-a a { text-align: center; font-size: 14px; font-weight: 800; padding: 10px 0; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; }
.gate-a a:hover { border-color: var(--accent); }
.gate-a a.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.mbody .gate-n, .wall .gate-n { margin: 10px 0 0; font-size: 12.5px; color: var(--sub); line-height: 1.6; }
/* 책 띠 — 설명 판 아래에 떠 있는 작은 판(누르면 리브레토 새 창) */
.book { flex: none; display: flex; align-items: center; gap: 12px; margin: 0 16px 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.book:hover { border-color: var(--accent); }
.book img { flex: none; display: block; width: 46px; height: auto; }
.book .bk { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 12px; line-height: 1.5; color: var(--sub); }
.book .bk b { font-size: 14px; font-weight: 800; color: var(--ink); }
/* 묶음 판 — 맨 위 부품 단추와 그 아래 역할 글 사이(h3 위 여백과 같은 값). p.lead 로 좁힌다 — 배선도 판의 .links 뒤 문단은 그대로(감수 11-16) */
.mbody .links + p.lead { margin-top: 18px; }
@media (max-width: 820px) { .book { margin: 0 12px 8px; padding: 6px 10px 6px 6px; gap: 10px; } .book img { width: 32px; } .book .by { display: none; }
  /* 휴대폰: 설명 판(아래 판)이 열린 동안 분해 띠 · 칩 줄을 감춘다 — 엔진 그대로는 그 띠가 판 아래(이전 · 다음 · 책 띠)를 덮었다(11-15 캡처). 닫으면 돌아온다 */
  body.open .foot { display: none; }
  /* 휴대폰에서도 «목록 접기»(11-16 주인님 «이 부분도 접히도록 — 부품 분해 보기가 화면에 잘 보이게») — 엔진은 넓은 화면에만 두었다.
     제목 아래 왼쪽(넓은 화면과 같은 자리). 접으면 조작 판 · 분해 띠 · 칩 줄이 걷히고 «목록 펼치기 · 둘러보기/멈춤 · 속도»만 남는다(값은 엔진 것 그대로) */
  .side .foldrow { display: flex; flex-wrap: wrap; gap: 6px; position: fixed; left: 12px; right: 12px; top: 66px; pointer-events: none; }
  .side .foldrow > * { pointer-events: auto; }
  .side .fold { display: inline-block; font-size: 12.5px; font-weight: 800; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--card); color: var(--sub); box-shadow: var(--shadow); }
  .side .mini { display: none; } body.side-off .side .mini { display: inline-block; }
  body.side-off .side .speed.mini { display: flex; margin: 0; padding: 2px 6px 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); box-shadow: var(--shadow); }
  .side .mini.on { background: var(--ink); border-color: var(--ink); color: #fff; }
  body.side-off .foot, body.side-off .cap { display: none; }
  body.open .side .foldrow { display: none; }
  body.walled .side > * { filter: blur(10px); } }
/* 로그아웃 안내 창 — 3D 를 몇 번 만지면 뒤 화면이 흐려지고 가운데에 뜬다(그리는 쪽 = site.js guestWall · 글 = 회원 안내와 같은 것 · 세 번째 조작에 뜨고 닫히지 않는다) */
body.walled > :not(.wall) { filter: blur(10px); }
.wall { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.wall::before { content: ''; position: absolute; inset: 0; background: var(--bg); opacity: 0.6; }
.wall-b { position: relative; width: 100%; max-width: 460px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 20px 22px; }
.wall .gate { margin: 0; padding: 0; border: 0; background: none; }
.wall p { word-break: keep-all; } .wall-b:focus { outline: none; }
/* 설명 판 글 — 끌어 고르기 막기(복사 · 오른쪽 단추는 site.js protect). 숫자 칸은 그대로 */
.modal .mhead, .modal .mbody { -webkit-user-select: none; user-select: none; }
.modal input { -webkit-user-select: text; user-select: text; }
