/* 샷 캔버스 — 레이아웃: 좌측 프로젝트·보관함 / 가운데 무한 캔버스 / 우측 인스펙터 (피그마식 3단) */
:root {
  --bg: #111214;
  --dot: #2a2c31;
  --panel: #16171a;
  --panel2: #1d1f23;
  --panel3: #26292e;
  --sunk: #0d0e10;
  --line: #2a2d32;
  --line2: #3a3e45;
  --fg: #ecebe7;
  --fg2: #aaa8a2;
  --fg3: #74726d;
  --accent: #e9a23b;       /* 텅스텐 앰버 */
  --accent2: #f6c578;
  --accent-ink: #1c1405;
  --danger: #e8634f;
  --ok: #71c493;
  --warn: #e7c35f;
  --t-upload: #79aed6;
  --t-text: #c3bcae;
  --t-director: #e9a23b;
  --t-imagegen: #b99be6;
  --t-video: #ec8467;
  --t-plan: #79c8a4;
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 13px/1.45 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::selection { background: rgba(233, 162, 59, .35); }

#app { display: grid; grid-template-columns: 248px minmax(0, 1fr) 368px; height: 100dvh; }

/* ---------- 좌측 ---------- */
#side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; }
.brand b { font-size: 14px; letter-spacing: .02em; }
.brand small { display: block; color: var(--fg3); font-size: 11px; }
.side-scroll { flex: 1; overflow: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 18px; }
.side-h { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 6px; font-size: 11px; letter-spacing: .08em; color: var(--fg3); text-transform: uppercase; }
.side-h button { border: 0; background: none; color: var(--fg2); font-size: 12px; padding: 2px 6px; border-radius: 6px; letter-spacing: 0; text-transform: none; }
.side-h button:hover { background: var(--panel3); color: var(--fg); }
.plist, .llist { display: flex; flex-direction: column; gap: 2px; }
.pitem { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 8px; color: var(--fg2); cursor: pointer; }
.pitem:hover { background: var(--panel2); color: var(--fg); }
.pitem.on { background: var(--panel3); color: var(--fg); }
.pitem .pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitem .pc { font-size: 11px; color: var(--fg3); font-variant-numeric: tabular-nums; }
.pitem .pact { display: none; gap: 2px; }
.pitem:hover .pact, .pitem.on .pact { display: flex; }
.icon-btn { width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--fg3); }
.icon-btn:hover { background: var(--line2); color: var(--fg); }
.icon-btn svg { width: 14px; height: 14px; }
.litem { padding: 8px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.litem .lt { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.litem .lt span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.litem .ls { color: var(--fg3); font-size: 11.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.litem .la { display: flex; gap: 4px; }
.empty-note { color: var(--fg3); font-size: 12px; padding: 4px 6px; line-height: 1.5; }
.side-foot { border-top: 1px solid var(--line); padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* ---------- 버튼·입력 ---------- */
.btn { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel3); color: var(--fg); display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.btn:hover { border-color: var(--fg3); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.pri:hover { background: var(--accent2); }
.btn.ghost { background: none; }
.btn.danger { color: var(--danger); }
.btn svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .45; cursor: default; }
input[type=text], input[type=number], select, textarea { width: 100%; background: var(--sunk); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 9px; color: var(--fg); }
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg3) 50%), linear-gradient(135deg, var(--fg3) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* ---------- 캔버스 ---------- */
#main { position: relative; min-width: 0; overflow: hidden; }
#vp { position: absolute; inset: 0; overflow: hidden; background-color: var(--bg); background-image: radial-gradient(var(--dot) 1.1px, transparent 1.5px); touch-action: none; cursor: default; }
#vp.panning, #vp.hand { cursor: grab; }
#vp.panning:active { cursor: grabbing; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
#edges path { fill: none; }
#edges .e { stroke: #5b6068; stroke-width: 1.8; }
#edges .e.sel { stroke: var(--accent); stroke-width: 2.4; }
#edges .e.flow { stroke-dasharray: 6 5; stroke: var(--accent); }
#edges .hit { stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
#groups, #nodes { position: absolute; left: 0; top: 0; }
.edge-x { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: var(--panel3); border: 1px solid var(--accent); color: var(--fg); display: grid; place-items: center; font-size: 13px; line-height: 1; z-index: 5; }
.marquee { position: absolute; border: 1px solid var(--accent); background: rgba(233, 162, 59, .08); pointer-events: none; z-index: 30; }

.group { position: absolute; border: 1px dashed var(--line2); border-radius: 16px; background: rgba(255, 255, 255, .015); }
.group.sel { border-color: var(--accent); }
.group-label { position: absolute; left: 0; top: -28px; height: 24px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line2); color: var(--fg2); font-size: 12px; cursor: grab; white-space: nowrap; }
.group-label:hover { color: var(--fg); }

/* 노드 */
.node { position: absolute; width: 264px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 10px 28px rgba(0, 0, 0, .35); user-select: none; -webkit-user-select: none; --tc: var(--fg3); }
.node.t-upload { --tc: var(--t-upload); } .node.t-text { --tc: var(--t-text); } .node.t-director { --tc: var(--t-director); }
.node.t-imagegen { --tc: var(--t-imagegen); } .node.t-video { --tc: var(--t-video); } .node.t-plan { --tc: var(--t-plan); }
.node.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 12px 32px rgba(0, 0, 0, .45); }
.node.drop-ok { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.node.drop-bad { opacity: .45; }
.nh { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border-bottom: 1px solid var(--line); cursor: grab; }
.nh:active { cursor: grabbing; }
.ti { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--tc) 18%, transparent); color: var(--tc); }
.ti svg, .ic svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nt { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nk { font-size: 11px; color: var(--fg3); white-space: nowrap; }
.nb { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.port { position: absolute; top: 13px; width: 18px; height: 18px; border-radius: 50%; background: var(--panel2); border: 1.5px solid var(--fg3); z-index: 2; }
.port.in { left: -10px; }
.port.out { right: -10px; cursor: crosshair; display: grid; place-items: center; }
.port.out::after { content: '+'; font-size: 12px; line-height: 1; color: var(--fg3); }
.port.out:hover { border-color: var(--accent); background: var(--accent); }
.port.out:hover::after { color: var(--accent-ink); }
.thumb { border-radius: 8px; overflow: hidden; background: var(--sunk); border: 1px solid var(--line); display: grid; place-items: center; }
.thumb img, .thumb video { display: block; width: 100%; max-height: 220px; object-fit: contain; background: #000; }
.drop { min-height: 96px; color: var(--fg3); font-size: 12px; text-align: center; padding: 12px; line-height: 1.5; border-style: dashed; }
.mini { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--fg2); background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.txt { color: var(--fg2); font-size: 12.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--panel3); color: var(--fg2); border: 1px solid var(--line); white-space: nowrap; }
.tag.c { color: var(--tc); border-color: color-mix(in srgb, var(--tc) 40%, transparent); }
.nfoot { display: flex; align-items: center; gap: 6px; }
.status { flex: 1; min-width: 0; font-size: 11.5px; display: flex; align-items: center; gap: 6px; color: var(--fg3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--fg3); flex: none; }
.status.s-ok::before { background: var(--ok); }
.status.s-warn::before { background: var(--warn); }
.status.s-ready::before { background: var(--accent); }

/* 노드 툴바 (선택한 이미지 위) */
#ntools { position: absolute; z-index: 20; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); transform: translate(-50%, -100%); white-space: nowrap; }
#ntools button { height: 30px; padding: 0 9px; border: 0; border-radius: 7px; background: none; color: var(--fg2); display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
#ntools button:hover { background: var(--panel3); color: var(--fg); }
#ntools .sep { width: 1px; height: 18px; background: var(--line2); margin: 0 3px; }

/* 상단 바·도크 */
.topbar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; pointer-events: none; z-index: 15; }
.topbar > * { pointer-events: auto; }
.tb-box { display: flex; align-items: center; gap: 4px; padding: 4px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; }
#pname { width: 220px; max-width: 36vw; background: none; border: 1px solid transparent; font-weight: 600; padding: 4px 8px; }
#pname:hover { border-color: var(--line2); }
#pname:focus { border-color: var(--accent); }
.save-st { font-size: 11.5px; color: var(--fg3); padding: 0 8px; white-space: nowrap; }
.spacer { flex: 1; }
.dock { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 5px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 10px 28px rgba(0, 0, 0, .4); z-index: 15; }
.dock button { width: 36px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--fg2); display: grid; place-items: center; }
.dock button:hover { background: var(--panel3); color: var(--fg); }
.dock button.on { background: var(--panel3); color: var(--fg); }
.dock button.add { background: var(--fg); color: var(--bg); }
.dock button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dock .sep { width: 1px; height: 20px; background: var(--line2); margin: 0 4px; }
.zoombox { position: absolute; left: 12px; bottom: 16px; z-index: 15; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; }
.zoombox button { width: 28px; height: 28px; border: 0; background: none; border-radius: 7px; color: var(--fg2); }
.zoombox button:hover { background: var(--panel3); color: var(--fg); }
#zoomPct { min-width: 46px; text-align: center; font-size: 12px; color: var(--fg2); font-variant-numeric: tabular-nums; background: none; border: 0; }
.hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--fg3); font-size: 13px; pointer-events: none; text-align: center; line-height: 1.7; }
.hint b { color: var(--fg2); }

/* 메뉴 */
.menu { position: fixed; z-index: 60; width: 244px; max-height: 70vh; overflow: auto; background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); padding: 6px; }
.menu .mh { font-size: 11px; color: var(--fg3); padding: 6px 8px 4px; letter-spacing: .04em; }
.menu input { margin: 2px 0 6px; }
.menu button.mi { width: 100%; display: flex; align-items: center; gap: 9px; padding: 7px 8px; border: 0; background: none; border-radius: 7px; text-align: left; color: var(--fg); font-size: 12.5px; }
.menu button.mi:hover, .menu button.mi.hl { background: var(--panel3); }
.menu button.mi small { margin-left: auto; color: var(--fg3); font-size: 11px; }
.menu .ic { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; color: var(--c, var(--fg2)); background: color-mix(in srgb, var(--c, var(--fg3)) 16%, transparent); flex: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

/* 모달 */
.modal-bg { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .55); display: grid; place-items: center; padding: 20px; }
.modal { width: min(920px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); overflow: hidden; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-h b { font-size: 14px; }
.modal-h .spacer { flex: 1; }
.modal-b { padding: 16px 18px; overflow: auto; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.feat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; }
.feat-h { grid-column: 1 / -1; font-size: 11.5px; color: var(--fg3); margin: 12px 0 4px; }
.feat-h:first-child { margin-top: 0; }
.feat { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; border: 0; background: none; text-align: left; color: var(--fg); }
.feat:hover { background: var(--panel3); }
.feat .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--c, var(--fg2)); background: var(--panel3); flex: none; }
.feat b { display: block; font-weight: 500; font-size: 12.5px; }
.feat span { display: block; color: var(--fg3); font-size: 11px; }
.keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.keys h5 { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 600; }
.krow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 12px; color: var(--fg2); }
kbd { font: 11px var(--mono); background: var(--panel3); border: 1px solid var(--line2); border-radius: 5px; padding: 2px 6px; color: var(--fg); white-space: nowrap; }

/* 그리드 분할기 */
.split-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: start; }
.split-stage { position: relative; background: var(--sunk); border-radius: 10px; overflow: hidden; }
.split-stage img { display: block; width: 100%; height: auto; }
.split-grid { position: absolute; inset: 0; display: grid; }
.split-cell { border: 1px solid rgba(255, 255, 255, .25); background: transparent; color: #fff; font: 600 12px var(--mono); display: grid; place-items: center; text-shadow: 0 1px 3px #000; }
.split-cell:hover { background: rgba(233, 162, 59, .12); }
.split-cell.on { border: 2px solid var(--accent); background: rgba(233, 162, 59, .22); }
.split-side { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 인스펙터 ---------- */
#insp { background: var(--panel); border-left: 1px solid var(--line); overflow: auto; min-height: 0; }
.ins-h { position: sticky; top: 0; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; gap: 8px; --tc: var(--fg3); }
.ins-h input { font-weight: 600; background: none; border-color: transparent; padding: 5px 6px; }
.ins-h input:hover { border-color: var(--line2); }
.sec { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.sec h4 { margin: 0; font-size: 11px; letter-spacing: .08em; color: var(--fg3); font-weight: 600; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.sec h4 .r { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 400; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld > label, .lab { font-size: 12px; color: var(--fg2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { border: 1px solid var(--line2); background: var(--panel2); color: var(--fg2); border-radius: 999px; padding: 4px 10px; font-size: 12px; position: relative; }
.chip:hover { color: var(--fg); border-color: var(--fg3); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip .ord { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--accent-ink); color: var(--accent); font-size: 10px; margin-right: 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { flex: 1 1 auto; border: 1px solid var(--line2); background: var(--panel2); color: var(--fg2); border-radius: 7px; padding: 6px 8px; font-size: 12px; }
.seg button.on { background: var(--panel3); color: var(--fg); border-color: var(--accent); }
.swatch-chip { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-flex; height: 12px; border-radius: 3px; overflow: hidden; }
.sw i { width: 7px; height: 12px; }
.pgroup { font-size: 11px; color: var(--fg3); margin-top: 4px; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.pbtn { text-align: left; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--fg); }
.pbtn b { display: block; font-size: 12.5px; font-weight: 600; }
.pbtn span { display: block; font-size: 11px; color: var(--fg3); line-height: 1.35; margin-top: 2px; }
.pbtn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel2)); }
.out { font-family: var(--mono); font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 300px; overflow: auto; user-select: text; -webkit-user-select: text; color: var(--fg); }
.warns { display: flex; flex-direction: column; gap: 4px; }
.warn { font-size: 12px; color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: 8px; padding: 7px 9px; line-height: 1.45; }
.note { font-size: 11.5px; color: var(--fg3); line-height: 1.5; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; }
.inlist { display: flex; flex-direction: column; gap: 4px; }
.inrow { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); }
.inrow .num { font: 600 11px var(--mono); color: var(--accent); width: 46px; flex: none; }
.inrow img, .inrow video { width: 34px; height: 34px; object-fit: cover; border-radius: 5px; flex: none; background: #000; }
.inrow .nm { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot { border: 1px dashed var(--line2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.slot .thumb img, .slot .thumb video { max-height: 260px; }
.angle-wrap { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; }
.angle-dial { width: 120px; height: 120px; }
.angle-dial circle.ring { fill: none; stroke: var(--line2); }
.angle-dial .pt { fill: var(--panel3); stroke: var(--line2); cursor: pointer; }
.angle-dial .pt.on { fill: var(--accent); stroke: var(--accent); }
.angle-dial .subj { fill: var(--fg3); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--fg2); cursor: pointer; }
.toggle input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--line2); position: relative; flex: none; cursor: pointer; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--fg); transition: transform .15s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(14px); background: var(--accent-ink); }
.checks { display: flex; flex-wrap: wrap; gap: 5px; }
.ins-empty { padding: 22px 18px; display: flex; flex-direction: column; gap: 14px; color: var(--fg2); }
.ins-empty h3 { margin: 0; font-size: 15px; color: var(--fg); }
.ins-empty ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; line-height: 1.55; }
.colorrow { display: flex; align-items: center; gap: 8px; }
.colorrow input[type=color] { width: 36px; height: 30px; border: 1px solid var(--line2); border-radius: 7px; background: var(--sunk); padding: 2px; }

.toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 90; background: var(--fg); color: var(--bg); padding: 9px 14px; border-radius: 9px; font-weight: 600; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.banner { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 16; background: color-mix(in srgb, var(--danger) 18%, var(--panel2)); border: 1px solid var(--danger); color: var(--fg); border-radius: 9px; padding: 8px 12px; font-size: 12.5px; }
.mob-only { display: none !important; }

.sheet-grip { display: none; }
#sideBg { display: none; }

/* ---------- 좁은 화면 (휴대폰·태블릿) ---------- */
@media (max-width: 1020px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  #side { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: 10px 0 40px rgba(0, 0, 0, .5); padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  #side.open { transform: none; }
  #side.open ~ #sideBg, #sideBg.on { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .45); }
  #insp { position: fixed; left: 0; right: 0; bottom: 0; max-height: 52dvh; z-index: 40; border-left: 0; border-top: 1px solid var(--line2); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); padding-bottom: env(safe-area-inset-bottom, 0px); transition: max-height .2s; overscroll-behavior: contain; }
  #insp.full { max-height: 90dvh; }
  #insp.empty { display: none; }
  .sheet-grip { display: flex; justify-content: center; align-items: center; position: sticky; top: 0; z-index: 3; height: 22px; background: var(--panel); border: 0; width: 100%; padding: 0; }
  .sheet-grip::before { content: ''; width: 40px; height: 4px; border-radius: 2px; background: var(--line2); }
  .ins-h { top: 22px; }
  .mob-only { display: inline-flex !important; }
  .topbar { top: calc(10px + env(safe-area-inset-top, 0px)); left: max(10px, env(safe-area-inset-left, 0px)); right: max(10px, env(safe-area-inset-right, 0px)); }
  .dock { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .zoombox { display: none; }
  #ntools { max-width: calc(100vw - 20px); overflow-x: auto; scrollbar-width: none; }
  #ntools::-webkit-scrollbar { display: none; }
  .feat-grid { grid-template-columns: 1fr 1fr; }
  .keys { grid-template-columns: 1fr 1fr; }
  .split-wrap { grid-template-columns: 1fr; }
  .modal-bg { padding: 8px; align-items: end; }
  .modal { max-height: 92dvh; border-radius: 16px 16px 12px 12px; }
  .menu { width: min(300px, calc(100vw - 16px)); max-height: 60dvh; }
  .toast { bottom: auto; top: calc(72px + env(safe-area-inset-top, 0px)); max-width: calc(100vw - 32px); text-align: center; z-index: 95; }
}
@media (max-width: 560px) {
  .feat-grid, .keys { grid-template-columns: 1fr; }
  #pname { width: 130px; }
  .save-st { display: none; }
  .dock .desk-only, .dock .sep { display: none; }
  .row3 { grid-template-columns: 1fr 1fr; }
}
/* 손가락 조작: 연결 점·버튼을 크게, iOS 입력 확대 방지 */
@media (pointer: coarse) {
  .port { width: 28px; height: 28px; top: 8px; }
  .port.in { left: -15px; }
  .port.out { right: -15px; }
  .port.out::after { font-size: 15px; }
  input[type=text], input[type=number], select, textarea, .menu input { font-size: 16px; }
  .chip { padding: 7px 12px; }
  .seg button { padding: 9px 8px; }
  .icon-btn { width: 32px; height: 32px; }
  .split-cell { font-size: 14px; }
  #ntools button { height: 36px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
