:root {
  --bg: #141414; --bg2: #1b1b1b; --bg3: #222; --bg4: #2a2a2a;
  --line: #2c2c2c; --line2: #3a3a3a;
  --text: #e8e8e8; --dim: #8a8a8a; --accent: #e89234; --ok: #3f9f63; --err: #d24c4c;
  --key: #262626; --r: 8px;
  --uifont: "Segoe UI Variable Text", "Segoe UI", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 "Segoe UI Variable Text", "Segoe UI", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
input, textarea, select { -webkit-user-select: text; user-select: text; font: inherit; color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg.i { display: block; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
#app { height: 100%; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.boot { margin: auto; color: var(--dim); }
.dim { color: var(--dim); font-weight: 400; }
.offline { background: #3a1f1f; color: #f0b4b4; font-size: 12.5px; padding: 6px 14px; flex-shrink: 0; }

/* ---------- 위 막대 ---------- */
.top { display: flex; align-items: center; gap: 6px; height: 46px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.top .sp { flex: 1; }
.chip { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 6px; font-size: 13px; color: var(--text); white-space: nowrap; }
.chip:hover { background: var(--bg3); }
.chip .i { width: 14px; height: 14px; color: var(--dim); }
.chip.strong { font-weight: 600; }
.sel { height: 32px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 6px; padding: 0 28px 0 10px; font-size: 13px; outline: none;
  appearance: none; -webkit-appearance: none;
  background: var(--bg2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E") no-repeat right 7px center / 14px; }
.tool { width: 34px; height: 32px; display: grid; place-items: center; color: var(--dim); border-radius: 6px; flex-shrink: 0; }
.tool:hover { background: var(--bg3); color: var(--text); }
.tool.on { color: var(--accent); }
.tool svg { width: 18px; height: 18px; }
.top.sub { height: auto; padding: 6px 8px; gap: 4px; }
.top.sub .sel { flex: 1 1 0; min-width: 0; text-overflow: ellipsis; }
/* 버튼판 아래 페이지 표시: 점을 누르면 그 페이지로 */
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; flex-shrink: 0; padding: 0 12px 10px; min-height: 40px; }
.pager[hidden] { display: none; }
.dots { display: flex; align-items: center; }
.dots button { width: 24px; height: 32px; display: grid; place-items: center; }
.dots.dense button { width: 18px; }
.dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--line2); transition: width .15s; }
.dots button.on i { width: 18px; background: var(--text); }
.dots.dense button.on i { width: 12px; }
.pgnum { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; min-width: 34px; }
.crumb { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 버튼판 ---------- */
.deck { flex: 1; overflow: hidden; position: relative; padding: 12px; display: flex; flex-direction: column; min-height: 0; }
.grid.ghost { pointer-events: none; }
.grid { will-change: transform; }
.grid { display: grid; gap: var(--gap, 8px); grid-template-columns: repeat(var(--cols), var(--tile)); grid-auto-rows: var(--tile);
  margin: auto; position: relative; }
.grid.bgimg { background-size: cover; background-position: center; border-radius: 10px; }
.bgfix { position: absolute; pointer-events: none; background-size: cover; background-position: center; border-radius: 10px; }
.key { position: relative; width: var(--tile); height: var(--tile); border-radius: var(--r); background: var(--fxbg, linear-gradient(transparent, transparent)), var(--cbg, var(--c, var(--key))); color: var(--fg, #f0f0f0);
  box-shadow: var(--bs, none); opacity: var(--ko, 1);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6%; padding: 6%; overflow: hidden; touch-action: none; }
.key.clear { background: var(--fxbg, linear-gradient(transparent, transparent)), transparent; }
.key .fill { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.15); pointer-events: none; }
.key .ico, .key .lbl { position: relative; }
.key .ico { --s: 38%; width: calc(var(--s) * var(--is, 1)); height: calc(var(--s) * var(--is, 1)); display: grid; place-items: center; color: var(--ic, var(--fg)); }
.key.nolabel .ico, .key[class*="lp-"] .ico { --s: 50%; }
.key .ico svg, .key .ico img { width: 100%; height: 100%; object-fit: contain; }
.key .ico img { opacity: var(--io, 1); }
.key.img .ico { --s: 48%; }
.key.img.nolabel .ico, .key.img[class*="lp-"] .ico { --s: 68%; }
.key.cover .ico { position: absolute; inset: 0; width: 100%; height: 100%; }
.key.cover .ico img { object-fit: cover; }
.key .lbl { font-size: calc(clamp(9px, calc(var(--tile, 90px) * .14), 16px) * var(--ls, 1)); font-weight: 500; text-align: center; line-height: 1.2; max-width: 100%;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: keep-all; color: var(--lc, var(--fg)); }
.key.b .lbl { font-weight: 700; } .key.it .lbl { font-style: italic; } .key.u .lbl { text-decoration: underline; }
.key[class*="lp-"] .lbl { position: absolute; left: 6%; right: 6%; }
.key.lp-top .lbl { top: 7%; } .key.lp-bottom .lbl { bottom: 7%; } .key.lp-middle .lbl { top: 50%; transform: translateY(-50%); }
.key::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
@media (hover: hover) { .key[data-pos]:not(.off):hover::after { background: rgba(255,255,255,.06); } }
.key.down::after { background: rgba(0,0,0,.3) !important; }
.key.busy { opacity: .7; }
.key.off { opacity: calc(var(--ko, 1) * .32); }
.key .run { position: absolute; top: 8%; right: 8%; width: 7px; height: 7px; border-radius: 50%; background: #3fbf6a; }
.key .ring { position: absolute; inset: 0; border-radius: inherit; border: 2px solid transparent; pointer-events: none; opacity: 0; }
.key.ok .ring { border-color: var(--ok); animation: ring .45s ease-out; }
.key.err .ring { border-color: var(--err); animation: ring .9s ease-out; }
@keyframes ring { from { opacity: 1; } to { opacity: 0; } }
.key.slot { background: var(--bg2); }
.key.slot.hidden { background: transparent; }
.key.back, .key.nav { background: #1f1f1f; }
.key.navdim { background: #161616; color: #4a4a4a; }
.key.pinned::before { content: ""; position: absolute; top: 5px; left: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--dim); z-index: 1; }
.flipL { animation: flipL .2s ease-out; } .flipR { animation: flipR .2s ease-out; }
/* 투명도는 건드리지 않음: 판이 반투명해지면 버튼 흐림(backdrop-filter)이 뒤 배경을 못 봐서 넘길 때 잠깐 이상해짐 */
@keyframes flipL { from { transform: translateX(-12%); } to { transform: none; } }
@keyframes flipR { from { transform: translateX(12%); } to { transform: none; } }

/* ---------- 편집 화면 (정품 배치) ---------- */
.ed { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
.ed .canvas { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; padding: 14px 16px 6px; }
.ed .canvas .grid { margin: 10px auto; }
.ed .insp { grid-column: 1; grid-row: 2; border-top: 1px solid var(--line); background: var(--bg2); max-height: 46vh; overflow-y: auto; }
.ed .lib { grid-column: 2; grid-row: 1 / span 2; border-left: 1px solid var(--line); background: var(--bg2); display: flex; flex-direction: column; min-height: 0; }
.ed .key[data-pos] { cursor: pointer; }
.ed .key.selk { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.ed .key.over { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.ed .key.dragging { opacity: .4; }
.ed .key.slot { border: 1px dashed transparent; }
.ed .key.slot:hover { border-color: var(--line2); }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13px; min-height: 24px; }
.crumbs .sp { flex: 1; }
.crumbs button { color: var(--dim); padding: 2px 6px; border-radius: 4px; }
.crumbs button:hover { background: var(--bg3); color: var(--text); }
.crumbs .cur { color: var(--text); padding: 2px 6px; }
.pagebar { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 8px 0 4px; flex-wrap: wrap; }
.pg { min-width: 30px; height: 26px; padding: 0 8px; border-radius: 5px; border: 1px solid var(--line2); font-size: 12.5px; color: var(--dim); }
.pg.on { background: var(--text); color: #111; border-color: var(--text); font-weight: 600; }
.pg:hover:not(.on) { color: var(--text); border-color: var(--dim); }
.pg.add, .pg.pin { border-style: dashed; }
.pg.pin.on { background: var(--accent); border-color: var(--accent); border-style: solid; color: #111; }
/* 좁은 화면(폰): 칸 → 페이지 바 → 속성 창을 위에서 아래로 쌓고 같이 스크롤 (겹치지 않게) */
.ed-narrow .ed { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ed-narrow .ed .canvas { overflow: hidden; min-height: auto; padding: 10px 12px 6px; }
.ed-narrow .ed .insp { max-height: none; overflow: visible; }
.ed-narrow .ed .lib { display: none; }

/* 동작 목록 */
.lib .search { padding: 10px; border-bottom: 1px solid var(--line); }
.lib .list { overflow-y: auto; flex: 1; padding: 4px 0 20px; }
.cat > button { width: 100%; display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 12px; font-weight: 600; color: var(--dim); text-align: left; }
.cat > button .i { width: 12px; height: 12px; transition: transform .15s; }
.cat.closed > button .i { transform: rotate(-90deg); }
.cat.closed .items { display: none; }
.item { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 16px; font-size: 13px; cursor: grab; border-radius: 0; }
.item:hover { background: var(--bg3); }
.item .ib { width: 28px; height: 28px; border-radius: 6px; background: var(--key); display: grid; place-items: center; flex-shrink: 0; }
.item .ib svg { width: 16px; height: 16px; }
.item .ib.c { border: 1px solid rgba(255,255,255,.1); }
.item small { display: block; color: var(--dim); font-size: 11px; }

/* 속성 창 */
.pane { padding: 14px 16px 18px; }
.pane h2 { margin: 0 0 12px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.pane h2 .sp { flex: 1; }
.pane h3 { margin: 16px 0 8px; font-size: 12px; font-weight: 600; color: var(--dim); }
.ihead { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: start; }
.ibox { position: relative; }
.ibox .key { --tile: 96px; cursor: pointer; }
.ibox .menu-btn { position: absolute; right: -6px; bottom: -6px; width: 24px; height: 24px; border-radius: 6px; background: var(--bg4); border: 1px solid var(--line2); display: grid; place-items: center; }
.ibox .menu-btn svg { width: 12px; height: 12px; }
.tabs2 { display: flex; gap: 4px; margin: 4px 0 10px; flex-wrap: wrap; }
.tabs2 button { padding: 5px 10px; font-size: 12.5px; border-radius: 5px; color: var(--dim); border: 1px solid var(--line2); }
.tabs2 button.on { color: #111; background: var(--text); border-color: var(--text); font-weight: 600; }
.row { margin-bottom: 10px; }
.lab { display: block; font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.inp { width: 100%; background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 7px 9px; outline: none; font-size: 13.5px; }
.inp:focus { border-color: var(--dim); }
textarea.inp { min-height: 64px; resize: vertical; }
select.inp { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E") no-repeat right 8px center / 16px; }
.inline { display: flex; gap: 6px; align-items: center; }
.inline .inp { flex: 1; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }
.hint { font-size: 12px; color: var(--dim); margin-top: 5px; line-height: 1.55; }
.hint code { background: var(--bg); border: 1px solid var(--line); padding: 0 4px; border-radius: 3px; color: var(--text); font-size: 11.5px; }
.btn { border: 1px solid var(--line2); background: var(--bg3); border-radius: 6px; padding: 6px 11px; font-size: 12.5px; white-space: nowrap; }
.btn:hover { border-color: var(--dim); }
.btn.primary { background: var(--text); color: #111; border-color: var(--text); font-weight: 600; }
.btn.danger { color: #f0a0a0; }
.btn.rec { border-color: var(--err); color: #f0a0a0; }
.btn.tog.on { background: var(--text); color: #111; border-color: var(--text); }
.btn:disabled { opacity: .4; cursor: default; }
.btn svg { width: 13px; height: 13px; }
.foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.foot .sp { flex: 1; }
.sep { border-top: 1px solid var(--line); margin: 14px 0; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 4px; max-height: 170px; overflow-y: auto;
  padding: 6px; background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; }
.picker button { aspect-ratio: 1; display: grid; place-items: center; border-radius: 5px; color: var(--dim); }
.picker button svg { width: 18px; height: 18px; }
.picker button:hover { background: var(--bg3); color: var(--text); }
.picker button.on { background: var(--text); color: #111; }
.picker .none { font-size: 11px; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sw { width: 22px; height: 22px; border-radius: 5px; border: 1px solid rgba(255,255,255,.12); }
.sw.on { outline: 2px solid var(--text); outline-offset: 2px; }
.sw.word { width: auto; padding: 0 7px; font-size: 11px; color: var(--dim); background: var(--bg); }
input[type=color] { width: 28px; height: 24px; border: 1px solid var(--line2); border-radius: 5px; background: var(--bg); padding: 2px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { border: 1px solid var(--line2); border-radius: 6px; padding: 10px; background: var(--bg); }
.step .head { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.step .head .num { font-size: 12px; color: var(--dim); width: 16px; }
.step .head select { flex: 1; }
.step .btn { padding: 4px 7px; }
.url { font: 600 14px ui-monospace, Consolas, monospace; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line2); border-radius: 6px;
  margin-bottom: 6px; -webkit-user-select: all; user-select: all; word-break: break-all; }
.pin-now { font: 700 20px ui-monospace, Consolas, monospace; letter-spacing: 4px; margin-bottom: 8px; }
.empty-note { color: var(--dim); font-size: 13px; line-height: 1.6; }

/* 시트(좁은 화면), 팝업 메뉴 */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet { background: var(--bg2); width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; border-top: 1px solid var(--line2); border-radius: 12px 12px 0 0;
  padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 10px; border: 1px solid var(--line2); } }
.sheet .lib { display: flex; flex-direction: column; max-height: 80vh; }
.ctx { position: fixed; z-index: 80; min-width: 170px; background: #202020; border: 1px solid var(--line2); border-radius: 8px; padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.ctx button { display: block; width: 100%; text-align: left; padding: 7px 12px; font-size: 13px; border-radius: 5px; }
.ctx button:hover:not(:disabled) { background: var(--bg4); }
.ctx button:disabled { color: #555; cursor: default; }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.pop { position: fixed; z-index: 70; width: 300px; max-width: 92vw; background: #202020; border: 1px solid var(--line2); border-radius: 10px; padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* 색 고르기 */
.cp-prev { height: 54px; border-radius: 8px; display: grid; place-items: center; font: 600 13px ui-monospace, Consolas, monospace; margin-bottom: 12px; }
.cp-bar { -webkit-appearance: none; appearance: none; height: 14px; border-radius: 7px; outline: none; }
.cp-hue { background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.cp-bar::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #111; }

/* ---------- 로그인 ---------- */
.login { margin: auto; width: 100%; max-width: 300px; padding: 24px; text-align: center; }
.login h1 { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.login p { color: var(--dim); font-size: 12.5px; margin: 0 0 22px; }
.pin-dots { display: flex; justify-content: center; gap: 12px; height: 14px; margin-bottom: 22px; }
.pin-dots i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--dim); }
.pin-dots i.f { background: var(--text); border-color: var(--text); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pad button { height: 58px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line); font-size: 20px; touch-action: manipulation; }
.pad button:active { background: var(--bg3); }
.login .msg { color: #f0a0a0; font-size: 12.5px; min-height: 18px; margin-top: 14px; }

#toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--line2); padding: 8px 14px; border-radius: 6px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .15s; max-width: min(92vw, 520px); z-index: 100; text-align: center; }
#toast.show { opacity: 1; }
#toast.err { border-color: var(--err); }

/* 내 버튼 서랍 (오른쪽 맨 위) */
.drawer { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); }
.lib { transition: background .15s; }
.lib.over { background: var(--bg3); outline: 2px dashed var(--accent); outline-offset: -6px; }
.drawer .make { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px; font-size: 13.5px; }
.drawer .make svg { width: 15px; height: 15px; }
.dhead { font-size: 12px; font-weight: 600; color: var(--dim); margin: 12px 2px 8px; }
.dhead small { display: block; font-weight: 400; font-size: 11px; margin-top: 2px; }
.dhead.sub { margin: 10px 12px 2px; }
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; }
.ditem { position: relative; cursor: grab; }
.ditem .key { --tile: 100%; width: 100%; aspect-ratio: 1; height: auto; pointer-events: none; }
.ditem .key .lbl { font-size: 10px; }
.ditem .dmore { position: absolute; right: 2px; top: 2px; width: 20px; height: 20px; border-radius: 5px; background: rgba(0,0,0,.55); display: grid; place-items: center; opacity: 0; }
.ditem .dmore svg { width: 11px; height: 11px; }
.ditem:hover .dmore, .ed-narrow .ditem .dmore, .sheet .ditem .dmore { opacity: 1; }
.ditem:hover .key { box-shadow: 0 0 0 2px var(--line2); }
.dempty { font-size: 12.5px; color: var(--dim); line-height: 1.55; padding: 4px 2px; }
.crumbs .placing { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; }
.crumbs .placing svg { width: 14px; height: 14px; }

/* 기능 만들기 창 */
.makersheet .sheet { max-width: 640px; }
.maker .mtop { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 0; font-size: 14px; }
.maker .mtop .dim { font-size: 12px; }
.maker .mfoot { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--bg2); }
.maker .mfoot .sp { flex: 1; }
.maker [data-mq] { margin-bottom: 6px; }
.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.mcard { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line2); border-radius: 8px; text-align: left; font-size: 13px; background: var(--bg3); }
.mcard:hover { border-color: var(--dim); }
.mcard .ib { width: 28px; height: 28px; border-radius: 6px; background: var(--key); display: grid; place-items: center; flex-shrink: 0; }
.mcard .ib svg, .mcard.blank > svg { width: 16px; height: 16px; }
.mcard.blank { border-style: dashed; margin-top: 8px; }
.mcard small { display: block; color: var(--dim); font-size: 11px; }

/* 설정 칸 1·2·3 단계 */
.pane h3.stp { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 12.5px; margin-top: 18px; }
.stepn { width: 18px; height: 18px; border-radius: 50%; background: var(--bg4); border: 1px solid var(--line2); display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--text); }
details.adv { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
details.adv summary { cursor: pointer; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; list-style: none; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary .dim { font-weight: 400; font-size: 11.5px; }
.linknote { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 8px; margin: -4px 0 10px; }
.linknote svg { width: 14px; height: 14px; flex-shrink: 0; }
.linknote span { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip2 { font-size: 11.5px; padding: 3px 8px; border-radius: 12px; border: 1px solid var(--line2); color: var(--dim); }
.chip2:hover { color: var(--text); border-color: var(--dim); }
.ibox.over .key { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.dim.small { font-size: 11.5px; }

/* 이미지 크기·위치 (설정 칸에서 조절) */
.key .ico img { transform: translate(var(--ix, 0%), var(--iy, 0%)) scale(var(--iz, 1)); }

/* 꾹 눌러서 옮기기 (아이폰 홈 화면처럼) */
/* 옮기기 중: 모든 버튼이 조금 작아지고, 커서가 올라간 버튼만 원래 크기 */
.grid.arrange .key[data-id] { scale: .9; transition: scale .15s ease-out, translate .22s ease-out; }
.grid.arrange .key[data-id]:hover { scale: 1; }
.grid.arrange .key.slot { border: 1px dashed var(--line2); }
.grid.arrange .key.over { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.key.lifting { opacity: 0; }

.ghostkey { position: fixed !important; z-index: 90; pointer-events: none; margin: 0; box-shadow: 0 10px 30px rgba(0,0,0,.6); transition: none; }
.top .acts { display: flex; align-items: center; gap: 4px; }
.top .acts .arrhint { font-size: 12.5px; margin-right: 6px; }
.tool.on { color: var(--accent); }

/* 편집 화면 오른쪽 설정 칸 (서랍과 같은 너비) */
.ed.wcfg { grid-template-columns: minmax(0, 1fr) 340px; }
/* 설정 칸의 '만들기' 분류 = 버튼 만들기·동작 목록 */
.cfgp .cfbody .lib { display: block; border: 0; background: none; margin: 0 -14px; }
.cfgp .cfbody .lib .list { overflow: visible; }
.cftabs button.hint svg { color: var(--accent); animation: toolpulse 1.6s ease-in-out 3; }
@keyframes toolpulse { 0%, 100% { transform: none; } 50% { transform: scale(1.3); } }
.ed .cfgp { grid-column: 2; grid-row: 1 / span 2; border-left: 1px solid var(--line); background: var(--bg2); overflow-y: auto; min-height: 0; }
.cfgp .cfgsec + .cfgsec { border-top: 1px solid var(--line); }
.cfgp [data-x] { display: none; }
.cfgp .three { grid-template-columns: 1fr 1fr; }

/* 전체 설정 '모든 버튼 글자' 글꼴 */
.key .lbl { font-family: var(--kfont, var(--uifont)); }

/* 밝기·명암 버튼 위 모니터 제품명 */
.key .mname { position: absolute; top: 4.5%; left: 6%; right: 6%; text-align: center; font-size: clamp(7px, calc(var(--tile, 90px) * .095), 12px);
  color: var(--lc, var(--fg)); opacity: .6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; line-height: 1.2; }

/* ---------- 설정: 분류 버튼 + 바로 저장 ---------- */
.cfgp, .cfgbox { position: relative; }
.cftabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); }
.cfgbox .cftabs { grid-template-columns: repeat(6, 1fr); padding-right: 44px; }
.cftabs button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 6px; border: 0; border-radius: 8px; background: transparent;
  color: var(--dim); font: inherit; font-size: 11px; cursor: pointer; transition: background .15s, color .15s, transform .12s; }
.cftabs button svg { width: 18px; height: 18px; transition: transform .2s; }
.cftabs button:hover { background: var(--bg3); color: var(--text); }
.cftabs button:active { transform: scale(.94); }
.cftabs button.on { background: var(--bg4); color: var(--text); }
.cftabs button.on svg { transform: translateY(-1px) scale(1.08); color: var(--accent); }
.cfx { position: absolute; top: 12px; right: 10px; }
.cfbody { padding: 6px 12px 16px; }
.cfbody.from-r { animation: cfin-r .22s ease-out; } .cfbody.from-l { animation: cfin-l .22s ease-out; }
@keyframes cfin-r { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes cfin-l { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.cf { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; }
.cf.wrap { align-items: flex-start; }
.cf.wrap .cfc { flex-wrap: wrap; }
.cfl { flex: 0 0 84px; font-size: 12.5px; color: var(--dim); }
.cfc { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: flex-end; }
/* 입력칸은 찌그러지지 않게: 자리가 모자라면 옆 버튼이 아랫줄로 */
.cfc .inp { flex: 1 1 96px; min-width: 0; }
.cfc .inp.pinin { font-weight: 700; font-size: 15px; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.cfc .inp.num { flex: 0 0 56px; text-align: center; }
.cfc .x { color: var(--dim); }
.cfc input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.cfc output { flex: 0 0 44px; text-align: right; font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.cfc .btn { white-space: nowrap; }
.cfc .url { display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 4px 6px; background: var(--bg3); color: var(--text); font: 12px/1.4 ui-monospace, monospace; cursor: copy; margin-bottom: 4px; }
.cfoot { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; padding: 6px 0; }
.chipbtn { font-size: 11.5px; padding: 3px 8px; }
.pinnow { font-variant-numeric: tabular-nums; letter-spacing: 1px; margin-right: 4px; }
/* 저장되면 그 줄이 잠깐 빛남, 틀리면 흔들림 */
.cf.ok, .cfoot .btn.ok, .url.ok { animation: cfok .9s ease-out; }
@keyframes cfok { 0% { background: rgba(63, 159, 99, .35); } 100% { background: transparent; } }
.cfoot .btn.ok { animation-name: cfokb; }
@keyframes cfokb { 0% { box-shadow: 0 0 0 2px var(--ok); } 100% { box-shadow: 0 0 0 2px transparent; } }
.cf.bad { animation: cfbad .35s; }
@keyframes cfbad { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
/* 켜기·끄기 스위치 */
.tgl { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 38px; cursor: pointer; }
.tgl input { position: absolute; opacity: 0; width: 0; height: 0; }
.tgl i { position: absolute; inset: 0; border-radius: 11px; background: var(--bg4); border: 1px solid var(--line2); transition: background .2s, border-color .2s; }
.tgl i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #bbb; transition: transform .2s cubic-bezier(.3, 1.4, .6, 1), background .2s; }
.tgl input:checked + i { background: var(--accent); border-color: var(--accent); }
.tgl input:checked + i::after { transform: translateX(16px); background: #fff; }
.cfgbox { max-height: 80vh; overflow-y: auto; }

/* Ctrl+Z / Ctrl+Y: 버튼판이 살짝 되감기듯 움직임, 더 없으면 흔들림 */
.grid.undo { animation: gundo .42s ease-out; } .grid.redo { animation: gredo .42s ease-out; }
@keyframes gundo { 0% { transform: translateX(-10px); opacity: .55; } 100% { transform: none; opacity: 1; } }
@keyframes gredo { 0% { transform: translateX(10px); opacity: .55; } 100% { transform: none; opacity: 1; } }
.grid.nope { animation: gnope .35s; }
@keyframes gnope { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* 편집 위쪽: 버튼판·프로필을 한 줄씩 나열 */
.prow { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.top.sub .prow { flex: 1; }
.prow::-webkit-scrollbar { display: none; }
.pchip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 15px;
  background: transparent; color: var(--dim); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .12s; }
.pchip:hover { background: var(--bg3); color: var(--text); }
.pchip:active { transform: scale(.94); }
.pchip.on { background: var(--accent); border-color: var(--accent); color: #fff; animation: pchipon .25s ease-out; }
@keyframes pchipon { 0% { transform: scale(.9); } 60% { transform: scale(1.05); } 100% { transform: none; } }
.pchip.add { padding: 0 8px; border-style: dashed; }
.pchip.add svg { width: 14px; height: 14px; }
.pchip .pdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

.drawer .dgrid { margin-top: 10px; }

/* 배경색: 버튼과 같은 모양의 네모 상자 */
.bsqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; margin-top: 10px; }
.bsq { position: relative; aspect-ratio: 1; border-radius: 22%; border: 1px solid rgba(255,255,255,.1); background: var(--c, transparent); cursor: pointer;
  transition: transform .12s, box-shadow .15s; }
.bsq:hover { transform: scale(1.08); }
.bsq:active { transform: scale(.92); }
.bsq.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); animation: bsqon .25s ease-out; }
@keyframes bsqon { 0% { transform: scale(.85); } 60% { transform: scale(1.1); } 100% { transform: none; } }
.bsq.none { background: repeating-conic-gradient(#3a3a3a 0 25%, #222 0 50%) 0 0 / 10px 10px; }
.bsq.auto { background: linear-gradient(135deg, var(--bg3) 50%, var(--bg4) 50%); }
.bsq.pick:not([style]) { background: conic-gradient(#f55, #fd4, #5e7, #4cf, #75f, #f5c, #f55); }
.bsq.pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
/* 이미지 미리보기에서 끌어 옮기기·휠로 크기 */
.ibox.pan .key { cursor: grab; touch-action: none; }
.ibox.pan.panning .key { cursor: grabbing; }
.ibox.pan .key .ico img { transition: none; }
.ibox.pan .key.panreset .ico img { transition: transform .25s ease-out, object-position .25s ease-out; }

/* 버튼 설정: 꾸미기 | 할 일 */
.seg { display: inline-flex; margin-left: 10px; padding: 2px; border-radius: 8px; background: var(--bg3); vertical-align: middle; }
.seg button { border: 0; background: transparent; color: var(--dim); font: inherit; font-size: 12.5px; font-weight: 500; padding: 4px 12px; border-radius: 6px; cursor: pointer; transition: background .15s, color .15s; }
.seg button.on { background: var(--bg4); color: var(--text); }
.insp.swap .pane > :not(h2) { animation: cfin-r .2s ease-out; }
/* 미리보기 글씨 끌기 */
.ibox .key .lbl { cursor: move; touch-action: none; }
.ibox .key.lbldrag .lbl { z-index: 3; opacity: .9; }
/* 글씨 자유 위치 (가운데 기준) */
.key.lp-free .lbl { left: var(--lx, 50%); top: var(--ly, 50%); right: auto; bottom: auto; width: max-content; max-width: 88%; transform: translate(-50%, -50%); }
/* 끌 때 달라붙으면 보이는 가이드 선 */
.lguide { position: absolute; pointer-events: none; z-index: 4; background: var(--accent); opacity: 0; transition: opacity .1s; }
.lguide.on { opacity: .9; }
.lguide.v { top: 0; bottom: 0; width: 1px; }
.lguide.h { left: 0; right: 0; height: 1px; }

/* 버튼 만들기 */
.maker .pane.mk { padding-bottom: 6px; }
.mkitems { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; padding: 6px; margin-bottom: 10px; border: 1px dashed var(--line2); border-radius: 10px; }
.mkitems.empty { background: repeating-linear-gradient(135deg, transparent 0 8px, rgba(255,255,255,.02) 8px 16px); }
.mkit { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 6px; border-radius: 8px; background: var(--bg4); font-size: 13px; }
.mkit img, .mkit .gi { width: 20px; height: 20px; }
.mkit .gi, .mkapp .gi { display: grid; place-items: center; color: var(--dim); }
.mkit .gi svg { width: 16px; height: 16px; }
.mkit .tool { width: 22px; height: 22px; }
.mkit .tool svg { width: 12px; height: 12px; }
.mkit.mkin { animation: mkpop .3s cubic-bezier(.3, 1.5, .6, 1); }
@keyframes mkpop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.mkit.out { transition: transform .15s, opacity .15s; transform: scale(.5); opacity: 0; }
.mkitems:not(.empty) .mkit + .mkit::before { content: ''; }
.mktabs { margin: 0 0 8px; }
.mktabs button { display: inline-flex; align-items: center; gap: 6px; }
.mktabs button svg { width: 14px; height: 14px; }
.mksite { display: flex; gap: 6px; }
.mksite .inp { flex: 1; }
.mksite .btn svg { width: 14px; height: 14px; }
.mkapps { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px; max-height: 46vh; overflow-y: auto; margin-top: 6px; padding: 2px; }
.mkapp { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text);
  font: inherit; font-size: 11.5px; cursor: pointer; transition: background .12s, transform .12s; }
.mkapp:hover { background: var(--bg3); }
.mkapp:active, .mkapp.picked { transform: scale(.9); }
.mkapp img, .mkapp .gi { width: 36px; height: 36px; }
.mkapp .gi svg { width: 24px; height: 24px; }
.mkapp span:last-child { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.mkapp.other { border: 1px dashed var(--line2); }
.mkload { padding: 20px; text-align: center; }
.ditem.newin { animation: mkpop .35s cubic-bezier(.3, 1.5, .6, 1); }

/* 설정 창 맨 위: 버튼 이름 */
.insp h2.kname { display: flex; align-items: center; gap: 6px; font-size: 16px; }
.insp h2.kname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp h2.kname .tool svg { width: 14px; height: 14px; }
/* 서랍 '내가 만든 버튼' 줄 */
.cat.mine .item { position: relative; }
.cat.mine .ib.img { background: transparent; overflow: hidden; }
.cat.mine .ib.img img { width: 100%; height: 100%; object-fit: contain; }
.cat.mine .dmore { position: static; margin-left: auto; opacity: 0; width: 24px; height: 24px; display: grid; place-items: center; border: 0; background: transparent; color: var(--dim); border-radius: 6px; }
.cat.mine .item:hover .dmore { opacity: 1; }
.cat.mine .dmore svg { width: 13px; height: 13px; }
.cat.mine .item.newin { animation: mkpop .35s cubic-bezier(.3, 1.5, .6, 1); }
.grid.bgover, .ed .grid.bgover { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 10px; }
.pagebar .pg.over { outline: 2px dashed var(--accent); outline-offset: 2px; }
/* 들고 옮기는 중: 끝에 대고 있으면 그쪽이 빛나고 잠시 뒤 넘어감 */
.grid.edgeL { box-shadow: inset 6px 0 0 -2px var(--accent); }
.grid.edgeR { box-shadow: inset -6px 0 0 -2px var(--accent); }
.grid.edgeL, .grid.edgeR { transition: box-shadow .15s; }
.key.dwell { outline: 2px solid var(--accent); outline-offset: 2px; animation: dwellpulse .6s ease-in-out infinite alternate; }
@keyframes dwellpulse { from { filter: brightness(1); } to { filter: brightness(1.5); } }

/* 고른 색 저장 칸 (+), 저장한 색 */
.bsq.keep::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; font-weight: 700; color: #fff; text-shadow: 0 0 3px #000, 0 0 6px #000; }
.bsq.saved::before { content: ''; position: absolute; right: 3px; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.7); box-shadow: 0 0 2px #000; }
/* 아이콘도 미리보기에서 끌어 옮기고 휠로 크기 */
.key .ico svg { transform: translate(var(--ix, 0%), var(--iy, 0%)) scale(var(--iz, 1)); }
.ibox.pan .key .ico svg { transition: none; }

/* 꾸미기 효과 */
.key.blur { backdrop-filter: blur(var(--bl)) saturate(1.5); -webkit-backdrop-filter: blur(var(--bl)) saturate(1.5); }
.fxs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding: 10px; border-radius: 10px;
  background: linear-gradient(135deg, #4a7a3a, #2d4f8a 50%, #8a3a6a); }
.fxsq { cursor: pointer; border-radius: 10px; padding: 3px; transition: transform .12s; }
.fxsq:hover { transform: scale(1.06); }
.fxsq.on { box-shadow: 0 0 0 2px var(--accent); animation: bsqon .25s ease-out; }
.fxsq .key { pointer-events: none; }
.fxgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px 12px; margin-top: 10px; }
.fxgrid input[type=range] { width: 100%; }

/* 전체 투명도: 바탕만 흐려지고 아이콘·글씨는 그대로 */
.key.ko { background: none; box-shadow: var(--bso, none); opacity: 1; backdrop-filter: none; -webkit-backdrop-filter: none; }
.key.ko.off { opacity: .32; }
.key.ko.busy { opacity: .7; }
.key .kbg { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: var(--ko, 1); box-shadow: var(--bsi, none);
  background: var(--fxbg, linear-gradient(transparent, transparent)), var(--cbg, var(--c, var(--key))); }
.key.clear .kbg { background: var(--fxbg, linear-gradient(transparent, transparent)), transparent; }
.key.ko.blur .kbg { backdrop-filter: blur(var(--bl)) saturate(1.5); -webkit-backdrop-filter: blur(var(--bl)) saturate(1.5); }
.ed .key.ko.selk { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

/* 효과 다듬기: 입자(노이즈), 그라데이션 테두리, 누를 때 움직임 */
:root { --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.key .kfx { position: absolute; inset: 0; border-radius: inherit; padding: var(--bw, 1px); background: var(--edge); pointer-events: none; opacity: var(--ko, 1);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.key[class*="fx-"] { transition: scale .08s ease-out, translate .08s ease-out; }
.key[class*="fx-"].down { scale: .97; }
.key.fx-bevel.down { translate: 0 1px; }
.key.fx-bevel.down::after { background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,.08)) !important; }
/* 폰·태블릿: PC 연결 표시 (초록 = 연결됨, 빨강 빗금 = 끊김). 바뀔 때 살짝 튐 */
.top .acts .conn { width: 26px; height: 32px; display: grid; place-items: center; color: var(--err); flex-shrink: 0; transition: color .3s; }
.top .acts .conn svg { width: 18px; height: 18px; }
.top .acts .conn .slash { transition: opacity .3s; }
.top .acts .conn.on { color: var(--ok); }
.top .acts .conn.on .slash { opacity: 0; }
.top .acts .conn:not(.on) svg { animation: connoff .5s ease-out; }
@keyframes connoff { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
.netok { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-size: 12.5px; }
.netok svg { width: 15px; height: 15px; }
/* 화면 설정의 아이콘·폰트 불투명도 (이미지는 --io에 곱해서 들어감) */
.key .ico > svg { opacity: var(--icop, 1); }
.key .lbl { opacity: var(--top, 1); }
/* 색 네모 하나 (지금 색 표시, 누르면 색 고르기). 버튼 색 고르기 네모와 같은 모양 */
.cbox { position: relative; display: inline-block; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 22%; border: 1px solid rgba(255,255,255,.12); background: var(--c, #262626); cursor: pointer; transition: transform .15s; }
.cbox.s { width: 22px; height: 22px; flex-basis: 22px; }
.cbox:hover { transform: scale(1.08); }
.cbox:active { transform: scale(.92); }
.cbox[hidden], .mkapp[hidden] { display: none; }
.cbox > input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* ===== 설정 세 곳 (버튼판 · 프로필 · 전체) ===== */
.cftabs { position: relative; grid-template-columns: repeat(var(--tn, 3), 1fr); gap: 0; padding: 0 8px; }
.cfgbox .cftabs { grid-template-columns: repeat(var(--tn, 3), 1fr); padding-right: 52px; }
.cftabs button { flex-direction: row; justify-content: center; gap: 6px; height: 44px; padding: 0; border-radius: 0; font-size: 14px; white-space: nowrap; }
.cftabs button:hover, .cftabs button.on { background: none; }
.cftabs button svg { width: 18px; height: 18px; }
.cftabs button.on { color: var(--text); font-weight: 600; }
.cftabs button.on svg { transform: none; }
/* 고른 분류 밑줄: 옆으로 미끄러짐 */
.cfind { position: absolute; bottom: -1px; left: 8px; width: calc((100% - 16px) / var(--tn, 3)); height: 2px; border-radius: 2px; background: var(--accent);
  transform: translateX(calc(var(--ti, 0) * 100%)); transition: transform .3s cubic-bezier(.3, 1.3, .5, 1); }
.cfgbox .cfind { width: calc((100% - 60px) / var(--tn, 3)); }
/* 위 막대 버튼으로 열면 그 분류가 톡 튐 */
.cfgp.hey .cftabs button.on svg { animation: cfhey .45s ease-out; }
@keyframes cfhey { 0% { transform: scale(1); } 40% { transform: scale(1.35); color: var(--accent); } 100% { transform: scale(1); } }
.cfbody { padding: 0 14px 14px; }
.cfsec + .cfsec { border-top: 1px solid var(--line); }
.cfsec h4 { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; margin: 8px 0 0; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.cfsec h4 > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfsec h4 .btn { font-weight: 400; color: var(--text); padding: 4px 10px; font-size: 12.5px; }
.cfsec h4 .btn.primary { color: #111; font-weight: 600; }   /* 하얀 바탕에 하얀 글자가 되지 않게 */
.cf { min-height: 35px; padding: 2px 8px; }
.cfl { flex: 0 0 108px; font-size: 13.5px; color: #cfcfcf; }
.cfc output { font-size: 13px; }
.cfoot { padding: 6px 0 2px; }
.cfoot .btn, .cfsec h4 .btn { display: inline-flex; align-items: center; gap: 5px; }
.cfoot .btn svg { width: 14px; height: 14px; }
/* 버튼 불투명도 네 개: 두 줄 두 칸 */
.opgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; padding: 6px 0 4px; }
.opc { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: #cfcfcf; min-width: 0; }
.opc span { display: flex; justify-content: space-between; }
.opc output { color: var(--text); font-variant-numeric: tabular-nums; }
.opc input[type=range] { width: 100%; accent-color: var(--accent); margin: 2px 0; }
/* 프로필 목록 */
.plist { display: flex; flex-direction: column; gap: 2px; padding: 10px 0 6px; }
.pitem { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 8px; text-align: left; font-size: 14px; color: var(--text);
  transition: background .15s, transform .12s; position: relative; }
.pitem:hover { background: var(--bg3); }
.pitem:active { transform: scale(.98); }
.pitem.on { background: var(--bg4); }
.pitem.on::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--accent); animation: pon .25s ease-out; }
@keyframes pon { from { transform: scaleY(0); } to { transform: none; } }
.pitem .pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitem .papp { font-size: 11.5px; color: var(--dim); background: var(--bg); border: 1px solid var(--line2); border-radius: 5px; padding: 1px 6px; }
.pitem .pdef { font-size: 11.5px; color: var(--accent); }
.pitem.add { color: var(--dim); }
.pitem.add svg { width: 16px; height: 16px; }
/* 프로필을 바꾸면 버튼판이 새 배치로 살짝 들어옴 (투명도는 안 건드림: 흐림 효과가 깨짐) */
.grid.pswap { animation: pswap .32s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes pswap { from { transform: translateY(10px) scale(.97); } to { transform: none; } }

/* ===== 글자 · 아이콘 크기 정리 (작고 흐린 글씨를 한 단계씩 키움) ===== */
.chip { font-size: 14px; }
.tool { width: 36px; height: 34px; }
.tool svg { width: 20px; height: 20px; }
.pchip { height: 32px; font-size: 13.5px; }
.btn { font-size: 13px; padding: 6px 12px; }
.inp { font-size: 14px; }
.item { font-size: 14px; }
.item small { font-size: 12px; }
.cat > button { font-size: 12.5px; }
.lab { font-size: 13px; }
.hint { font-size: 12.5px; }
.pane h2 { font-size: 15px; }
.pane h3 { font-size: 13px; }
.ctx button { font-size: 14px; padding: 8px 12px; }
.crumbs, .crumb { font-size: 14px; }
.check { font-size: 14px; }
.dhead { font-size: 12.5px; }

/* ===== 설명 대신 움직임 ===== */
/* 동작 목록: 끌 수 있다는 걸 손에 잡히는 느낌으로 */
.lib .item[draggable=true] { transition: transform .15s ease-out, background .15s; }
.lib .item[draggable=true]:hover { transform: translateX(-4px); }
.lib .item[draggable=true]:active { cursor: grabbing; transform: translateX(-4px) scale(.97); }
/* 빈 칸: 올리면 + 가 떠오름 (누르면 고르기, 끌어다 놓으면 넣기) */
.ed .key.slot::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 300; color: var(--dim);
  opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s cubic-bezier(.3, 1.5, .6, 1); pointer-events: none; }
.ed .key.slot:hover::after { opacity: .8; transform: none; }
/* 끄는 동안: 놓을 수 있는 빈 칸이 숨 쉬듯 빛나고, 손 밑 칸은 커짐 */
body.libdragging .ed .key.slot { border-color: var(--accent); animation: slotbreathe 1.2s ease-in-out infinite; }
body.libdragging .ed .key.slot::after { opacity: .9; transform: none; color: var(--accent); }
.ed .key.slot.over { transform: scale(1.06); background: rgba(232, 146, 52, .16); transition: transform .12s; }
@keyframes slotbreathe { 0%, 100% { background: var(--bg2); } 50% { background: rgba(232, 146, 52, .12); } }
/* 빈 페이지: 첫 칸이 깜빡이고 동작 목록이 그쪽으로 살짝 밀림 (세 번만) */
.ed .key.slot.hintslot { border: 1.5px dashed var(--accent); animation: hintslot 1.6s ease-in-out 3; }
.ed .key.slot.hintslot::after { opacity: .9; transform: none; color: var(--accent); }
@keyframes hintslot { 0%, 100% { transform: none; } 50% { transform: scale(1.07); background: rgba(232, 146, 52, .14); } }
.lib.hint .item[draggable=true]:nth-child(-n+2) { animation: libnudge 1.6s ease-in-out 3; }
@keyframes libnudge { 0%, 100% { transform: none; } 50% { transform: translateX(-10px); background: var(--bg3); } }
/* + 버튼: 올리면 돌아감 */
.pchip.add svg, .pitem.add svg { transition: transform .25s cubic-bezier(.3, 1.4, .6, 1); }
.pchip.add:hover svg, .pitem.add:hover svg { transform: rotate(90deg); }
.pg.add { transition: transform .25s cubic-bezier(.3, 1.4, .6, 1); }
.pg.add:hover { transform: rotate(90deg); }
/* 위 막대 도구: 누르면 눌림 */
.tool { transition: background .15s, color .15s, transform .1s; }
.tool:active { transform: scale(.9); }

/* ===== 새 효과 ===== */
/* 반짝임: 빛줄기가 4.5초마다 한 번 훑고 지나감 */
.key.fx-shine:not(.pinned)::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.28) 48%, rgba(255,255,255,.05) 55%, transparent 62%) no-repeat;
  background-size: 260% 100%; animation: kshine 4.5s ease-in-out infinite; }
@keyframes kshine { 0%, 55% { background-position: 130% 0; } 85%, 100% { background-position: -40% 0; } }
/* 네온: 아이콘도 빛남 */
.key.fx-neon .ico > svg { filter: drop-shadow(0 0 3px currentColor); }
/* 누를 때: 입체·부드러움·금속은 눌려 들어감 */
.key.fx-soft.down, .key.fx-metal.down, .key.fx-shine.down { translate: 0 1px; }
.key.fx-soft.down::after, .key.fx-metal.down::after { background: linear-gradient(180deg, rgba(0,0,0,.26), rgba(0,0,0,.06)) !important; }
/* 효과 고르기 칸이 아홉 개라 두 줄 */
.fxs { gap: 6px; }


/* 배경 그림: 불투명도를 따로 주려고 ::before 에 (넘길 때 위치는 grid 에서 물려받음) */
.grid.bgimg::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background-image: var(--bgimg); background-size: cover; background-position: inherit; background-repeat: inherit; opacity: var(--bgo, 1); }
.cfsec .opgrid { grid-template-columns: repeat(3, 1fr); gap: 2px 12px; padding: 0 8px 4px; }
.opcap { padding: 8px 8px 0; font-size: 13.5px; color: #cfcfcf; }
/* 리퀴드 글래스: 크롬 계열은 뒤 배경을 SVG 변위 지도로 굴절 (--lgf = 흐림 + 굴절 + 채도) */
.lgsvg .key.fx-liquid.blur:not(.ko), .lgsvg .key.fx-liquid.ko.blur .kbg { backdrop-filter: var(--lgf); -webkit-backdrop-filter: var(--lgf); }
.key.fx-liquid.down { scale: .96; filter: brightness(1.12); }

/* 미리보기: 끌 수 있는 글자·그림에 점선 상자 (그림은 원본 비율, 잘린 부분까지) */
.ibox .key .lbl { outline: 1px dashed rgba(255,255,255,.55); outline-offset: 1px; border-radius: 2px; box-shadow: 0 0 0 2px rgba(0,0,0,.25); transition: outline-color .15s; }
.ibox .key .lbl:hover, .ibox .key.lbldrag .lbl { outline: 1px solid var(--accent); }
.ifr { position: absolute; pointer-events: none; border: 1px dashed rgba(255,255,255,.4); border-radius: 2px; z-index: 2; transition: border-color .15s; }
.ibox.panning .ifr, .ibox.pan:hover .ifr { border-color: var(--accent); }
/* 크기 손잡이: 테두리 네 모서리 */
.ifh { position: absolute; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); border: 2px solid #111; pointer-events: auto; touch-action: none;
  opacity: .55; transition: opacity .15s, transform .15s; }
.ibox.pan:hover .ifh, .ibox.sizing .ifh { opacity: 1; }
.ifh:hover { transform: scale(1.25); }
.ifh.tl { left: -7px; top: -7px; cursor: nwse-resize; }
.ifh.br { right: -7px; bottom: -7px; cursor: nwse-resize; }
.ifh.tr { right: -7px; top: -7px; cursor: nesw-resize; }
.ifh.bl { left: -7px; bottom: -7px; cursor: nesw-resize; }
.ibox.sizing, .ibox.sizing .key { cursor: nwse-resize; }
/* 그림으로 꽉 찬 버튼: 효과의 빛은 그림 위에 (바탕색·그림자는 아래 그대로) */
.key.cover { box-shadow: var(--bso, none); }
.key.cover:not(.ko) { background: var(--cbg, var(--c, var(--key))); }
.key.cover.clear:not(.ko) { background: transparent; }
.key.cover .kbg { background: var(--cbg, var(--c, var(--key))); box-shadow: none; }
.key.cover.clear .kbg { background: transparent; }
.key .kup { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: var(--fxt, none); box-shadow: var(--bsi, none); opacity: var(--ko, 1); }
/* 꽉 채우기 그림: 칸(img)은 버튼 자리에 두고, 칸 안에서 그림을 옮김 (칸째 옮기면 브라우저가 칸 크기로 자른 끝이 보여서 빈 곳이 생김) */
.key.cover .ico img { transform: scale(var(--iz, 1));
  object-position: calc(50% + var(--ixn, 0) * var(--tile, 90px) / 100 / var(--iz, 1)) calc(50% + var(--iyn, 0) * var(--tile, 90px) / 100 / var(--iz, 1)); }
