:root{
  --bg:#f5f4f0; --surface:#fbfbf9; --panel:#ffffff; --panel-soft:#f7f6f2;
  --ink:#1c1c1a; --ink-hover:#3a3935; --ink-2:#55534d; --sub:#7a776f; --muted:#8a877f;
  --line:#e3e1db; --line-2:#dcdad3; --line-3:#efeee9; --hover:#efeee9; --soft:#f3f2ee; --track:#ebe9e3;
  --accent:#6c4dff; --accent-hover:#5638e6; --accent-soft:#efebff; --on-accent:#fff;
  --code-bg:#1b1a17; --code-ink:#e9e4d8; --code-line:#2e2c27;
  --warn:#b45309; --warn-soft:#fff4e5; --err:#b91c1c; --ok:#15803d;
  --checker-a:#ffffff; --checker-b:#efeee9;
  --font:"IBM Plex Sans KR",sans-serif; --mono:"JetBrains Mono",monospace;
}
*{box-sizing:border-box}
[hidden]{display:none !important}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--font);-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
.mono-label{font-family:var(--mono);font-size:11px;letter-spacing:.12em;color:var(--muted)}
.mono{font-family:var(--mono)}
.app{min-height:100vh;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 28px;border-bottom:1px solid var(--line);background:var(--surface);flex-wrap:wrap}
.brand{display:flex;align-items:baseline;gap:14px;min-width:0;flex-wrap:wrap}
.brand-title{font-size:17px;font-weight:700;letter-spacing:-.01em}
.actions{display:flex;gap:8px;flex-wrap:wrap}
.btn{height:36px;padding:0 14px;background:transparent;border:1px solid var(--line-2);border-radius:999px;font-size:13px;cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center;gap:6px}
.btn:hover{background:var(--hover)}
.btn:disabled{opacity:.45;cursor:default;background:transparent}
.btn--solid{background:var(--ink);color:#fff;border:none;font-weight:500}
.btn--solid:hover{background:var(--ink-hover)}
.btn--solid:disabled{background:var(--ink)}
.btn--tiny{height:28px;padding:0 11px;font-size:12px}
.btn--accent{background:var(--accent);border-color:var(--accent);color:var(--on-accent);font-weight:500}
.btn--accent:hover{background:var(--accent-hover)}
.btn--accent:disabled{background:var(--accent)}
.text-input,.sel{height:34px;width:100%;padding:0 10px;background:var(--surface);border:1px solid var(--line-2);border-radius:8px;font-size:13px;color:var(--ink)}
.sel{width:auto;padding:0 6px}
.text-input:focus,.sel:focus{outline:none;border-color:var(--accent)}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
input[type=range]{width:100%;accent-color:var(--accent)}
input[type=checkbox],input[type=radio]{accent-color:var(--accent)}
input[type=color]{width:34px;height:34px;padding:0;border:1px solid var(--line-2);border-radius:9px;background:none;cursor:pointer;flex:0 0 auto}
input[type=color]::-webkit-color-swatch-wrapper{padding:3px}
input[type=color]::-webkit-color-swatch{border:none;border-radius:6px}
.card{background:var(--panel);border:1px solid var(--line);border-radius:16px;padding:18px}
.sec-title{margin:0;font-size:15px;font-weight:700}
.seg{display:flex;background:var(--soft);border-radius:999px;padding:3px;gap:2px;flex-wrap:wrap}
.seg-btn{height:30px;padding:0 12px;border:none;background:transparent;border-radius:999px;font-size:12.5px;color:var(--sub);cursor:pointer;white-space:nowrap}
.seg-btn.is-active{background:#fff;color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.12);font-weight:500}
.field{display:flex;flex-direction:column;gap:6px;font-size:12.5px;color:var(--ink-2);min-width:0}
.field-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.check{display:inline-flex;align-items:center;gap:7px;font-size:12.5px;cursor:pointer;color:var(--ink-2)}
.check input{margin:0;width:15px;height:15px}
.note{margin:0;font-size:12px;line-height:1.6;color:var(--muted)}
.privacy{margin:0;font-size:12.5px;color:var(--sub);display:flex;align-items:center;gap:8px}
.dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent);flex:0 0 auto}
.checker{background-color:var(--checker-a);background-image:linear-gradient(45deg,var(--checker-b) 25%,transparent 25%),linear-gradient(-45deg,var(--checker-b) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--checker-b) 75%),linear-gradient(-45deg,transparent 75%,var(--checker-b) 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0}
.code{display:block;width:100%;height:220px;margin:0;padding:14px 16px;border:none;border-radius:0 0 14px 14px;resize:vertical;background:var(--code-bg);color:var(--code-ink);font-family:var(--mono);font-variant-ligatures:none;font-size:12px;line-height:1.6;white-space:pre-wrap;word-break:break-all;overflow:auto}
.code:focus{outline:none;box-shadow:inset 0 0 0 2px var(--accent)}
.code-card{display:flex;flex-direction:column;background:var(--code-bg);border-radius:14px;overflow:hidden;min-width:0}
.code-head{display:flex;align-items:center;gap:8px;padding:8px 10px 8px 16px;border-bottom:1px solid var(--code-line);flex-wrap:wrap}
.code-head .mono-label{color:#b4ab95;margin-right:auto}
.code-head .btn{border-color:#45413a;color:#e9e4d8}
.code-head .btn:hover{background:#2e2c27}
.code-head .btn--accent{border-color:var(--accent);color:var(--on-accent)}
.code-head .btn--accent:hover{background:var(--accent-hover)}
.drop{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;min-height:220px;padding:28px 20px;border:2px dashed var(--line-2);border-radius:16px;background:var(--panel);text-align:center;cursor:pointer;transition:border-color .15s,background .15s}
.drop:hover,.drop.is-over{border-color:var(--accent);background:var(--accent-soft)}
.drop-icon{font-size:34px;line-height:1}
.drop-title{margin:0;font-size:15px;font-weight:700}
.drop-sub{margin:0;font-size:12.5px;color:var(--sub);line-height:1.6}
.busy{display:inline-flex;align-items:center;gap:8px;font-size:12.5px;color:var(--sub)}
.spin{width:14px;height:14px;border-radius:50%;border:2px solid var(--line-2);border-top-color:var(--accent);animation:spin .8s linear infinite;flex:0 0 auto}
@keyframes spin{to{transform:rotate(360deg)}}
.toast{position:fixed;left:50%;bottom:28px;transform:translate(-50%,20px);background:var(--ink);color:#fff;padding:10px 18px;border-radius:999px;font-size:13px;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:100;max-width:calc(100vw - 32px);text-align:center}
.toast.is-show{opacity:1;transform:translate(-50%,0)}
@media (max-width:640px){
  .topbar{padding:14px 16px}
  .actions{width:100%}
  .actions .btn{flex:1}
  .card{padding:14px}
}
@media (prefers-reduced-motion:reduce){
  *{animation:none !important;transition:none !important}
}
@media screen{
  :root[data-theme="dark"]{
    color-scheme:dark;
    --bg:#141311; --surface:#191816; --panel:#1e1d1a; --panel-soft:#23221f;
    --ink:#ecebe6; --ink-hover:#ffffff; --ink-2:#c9c6be; --sub:#a29f96; --muted:#8c8980;
    --line:#2f2d29; --line-2:#3a3833; --line-3:#272622; --hover:#2a2925; --soft:#272622; --track:#35332e;
    --accent:#a594ff; --accent-hover:#bdb0ff; --accent-soft:rgba(165,148,255,.16); --on-accent:#141311;
    --code-bg:#11100e; --warn:#fbbf24; --warn-soft:rgba(245,158,11,.14); --err:#f87171; --ok:#4ade80;
    --checker-a:#2a2925; --checker-b:#211f1c;
  }
  :root[data-theme="dark"] .btn--solid,:root[data-theme="dark"] .toast{color:var(--bg)}
  :root[data-theme="dark"] .btn--solid{background:var(--accent)}
  :root[data-theme="dark"] .btn--solid:hover{background:var(--accent-hover)}
  :root[data-theme="dark"] .seg-btn.is-active{background:var(--line-2);box-shadow:0 1px 3px rgba(0,0,0,.4)}
  :root[data-theme="dark"] .code-card{border:1px solid var(--line-2)}
  :root[data-theme="dark"] .sel,:root[data-theme="dark"] .text-input{background:var(--surface)}
}

/* ================= SVG 아이콘 만들기 ================= */
.sim{width:100%;max-width:1240px;margin:0 auto;padding:20px 28px 40px;display:flex;flex-direction:column;gap:14px}
.toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;padding:8px;background:var(--panel);border:1px solid var(--line);border-radius:14px;position:sticky;top:8px;z-index:5}
.tgroup{display:flex;flex-wrap:wrap;align-items:center;gap:4px}
.tgroup + .tgroup{padding-left:12px;border-left:1px solid var(--line-3)}
.tgroup--opts{gap:10px;margin-left:auto}
.tool{height:38px;padding:0 10px;display:inline-flex;align-items:center;gap:6px;border:1px solid transparent;border-radius:10px;background:transparent;cursor:pointer;font-size:12.5px;color:var(--ink-2)}
.tool svg,.ibtn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:0 0 auto}
.tool:hover,.ibtn:hover{background:var(--hover)}
.tool.is-active{background:var(--accent-soft);border-color:var(--accent);color:var(--ink);font-weight:500}
.ibtn{width:38px;height:38px;display:inline-grid;place-items:center;border:none;border-radius:10px;background:transparent;cursor:pointer;color:var(--ink-2)}
.ibtn:disabled{opacity:.35;cursor:default;background:transparent}
.mini{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;color:var(--ink-2)}
.mini .sel{height:30px}

.body{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:14px;align-items:start}
.stage{display:flex;flex-direction:column;gap:10px;align-items:center;min-width:0}
.cv-wrap{width:100%;max-width:600px}
#cv{display:block;width:100%;height:auto;aspect-ratio:1/1;touch-action:none;user-select:none;-webkit-user-select:none;border-radius:12px;background:var(--panel-soft);overflow:hidden;cursor:crosshair}
#cv.is-select{cursor:default}
.art-bg{fill:#fff}
.grid path{fill:none;vector-effect:non-scaling-stroke;stroke-width:1px}
.grid .g-minor{stroke:#e9e7e1}
.grid .g-major{stroke:#d6d3cb}
.grid .g-edge{stroke:#bdb9ae}
.grid.is-off .g-minor,.grid.is-off .g-major{display:none}
.ov *{vector-effect:non-scaling-stroke}
.ov .sel-box{fill:none;stroke:var(--accent);stroke-width:1.5px;stroke-dasharray:4 3;pointer-events:none}
.ov .hd{fill:#fff;stroke:var(--accent);stroke-width:1.5px;cursor:pointer}
.ov .hd[data-h=nw],.ov .hd[data-h=se]{cursor:nwse-resize}
.ov .hd[data-h=ne],.ov .hd[data-h=sw]{cursor:nesw-resize}
.ov .hd[data-h=n],.ov .hd[data-h=s]{cursor:ns-resize}
.ov .hd[data-h=e],.ov .hd[data-h=w]{cursor:ew-resize}
.ov .pt{fill:var(--accent);stroke:#fff;stroke-width:1.5px;cursor:move}
.ov .pen-pre{fill:none;stroke:var(--accent);stroke-width:1.5px;stroke-dasharray:3 3;pointer-events:none}
.ov .pen-first{fill:#fff;stroke:var(--accent);stroke-width:2px}
#hitLayer .hit{fill:transparent;stroke:transparent;vector-effect:non-scaling-stroke;stroke-width:14px;cursor:move}
#hitLayer .hit--open{fill:none;pointer-events:stroke}
.hint{margin:0;font-size:12px;color:var(--muted);text-align:center;line-height:1.6}

.side{display:flex;flex-direction:column;gap:14px;min-width:0}
.props,.layers{display:flex;flex-direction:column;gap:12px;padding:16px}
.props-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
.geom{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.geom:empty{display:none}
.gf{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--muted);min-width:0}
.gf span{width:22px;flex:0 0 auto;font-family:var(--mono);text-align:right}
.gf input{height:30px;width:100%;min-width:0;padding:0 6px;border:1px solid var(--line-2);border-radius:7px;background:var(--surface);font-family:var(--mono);font-size:12.5px;color:var(--ink)}
.gf input:focus{outline:none;border-color:var(--accent)}
.pgroup{display:flex;flex-direction:column;gap:10px}
.color-line{display:flex;align-items:center;gap:10px}
.cl-label{font-size:12.5px;color:var(--ink-2);min-width:44px}
.cl-label small{color:var(--muted);font-size:11px;margin-left:4px}
.row2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.row2 .sel,.props .field .sel{width:100%;height:32px}
.props .seg{flex-wrap:nowrap}
.props .seg-btn{flex:1;padding:0 6px}
.btn-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.trace-box{display:flex;flex-direction:column;gap:9px;padding:12px;border-radius:12px;background:var(--panel-soft);border:1px solid var(--line-3)}
.trace-box b{font-size:13px}
.trace-box .btn{align-self:flex-start}
.swatches{display:flex;flex-wrap:wrap;gap:6px}
.swatches input[type=color]{width:30px;height:30px}
.is-disabled{opacity:.4;pointer-events:none}

.layer-list{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:2px;max-height:300px;overflow:auto}
.layer-list:empty::after{content:attr(data-empty);font-size:12px;color:var(--muted);padding:6px 2px}
.ly{display:flex;align-items:center;gap:8px;padding:5px 6px;border-radius:8px;cursor:pointer;font-size:12.5px;min-width:0}
.ly:hover{background:var(--hover)}
.ly.is-sel{background:var(--accent-soft)}
.ly-ic{width:26px;height:26px;flex:0 0 auto;border-radius:6px;border:1px solid var(--line-3);background:#fff;display:grid;place-items:center;overflow:hidden}
.ly-ic svg{width:20px;height:20px}
.ly-nm{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ly-bt{width:26px;height:26px;border:none;background:transparent;border-radius:6px;cursor:pointer;font-size:13px;opacity:.45;flex:0 0 auto}
.ly-bt:hover{background:var(--line-3)}
.ly-bt.is-on{opacity:1}
.ly.is-hidden .ly-nm{opacity:.45;text-decoration:line-through}

.export{display:grid;grid-template-columns:auto 280px minmax(0,1fr);gap:16px;align-items:start}
.ex-preview{display:grid;grid-template-columns:repeat(2,auto);gap:8px}
.pv-tile{display:flex;flex-direction:column;align-items:center;gap:4px;font-family:var(--mono);font-size:10.5px;color:var(--muted)}
.pv-box{width:72px;height:72px;border-radius:12px;border:1px solid var(--line);background:#fff;color:#1c1c1a;display:grid;place-items:center}
.pv-box svg{display:block}
.pv-tile--dark .pv-box{background:#1c1c1a;border-color:#1c1c1a;color:#f4f2ec}
.ex-ctrl{display:flex;flex-direction:column;gap:12px}
.ex-ctrl small{color:var(--muted);font-size:11px;display:block;margin-top:2px}
.ex-ctrl .check{align-items:flex-start}
.ex-ctrl .check input{margin-top:2px}
.ex-code .code{height:190px}

@media (max-width:1020px){
  .export{grid-template-columns:auto minmax(0,1fr)}
  .ex-code{grid-column:1 / -1}
}
@media (max-width:860px){
  .body{grid-template-columns:minmax(0,1fr)}
  .toolbar{position:static}
  .tgroup--opts{margin-left:0}
}
@media (max-width:640px){
  .sim{padding:14px 12px 32px}
  .tool span{display:none}
  .tool{width:40px;padding:0;justify-content:center}
  .tgroup + .tgroup{padding-left:8px}
  .export{grid-template-columns:minmax(0,1fr)}
  .ex-preview{grid-template-columns:repeat(4,auto);justify-content:start}
  .pv-box{width:60px;height:60px}
  .stage{padding:8px}
}
@media screen{
  :root[data-theme="dark"] #cv{background:#111}
  :root[data-theme="dark"] .tool.is-active{background:var(--accent-soft)}
  :root[data-theme="dark"] .ly-ic{border-color:var(--line-2)}
}

/* 툴 한계 안내 (안심 문구 아래) */
.limit-note{margin-top:6px}
.limit-note svg{color:#d08a1e}
.limit-note a{color:inherit;text-decoration:underline}
