@font-face { font-family: Pretendard; font-weight: 400; font-display: swap; src: url(../vendor/pretendard/Pretendard-Regular.woff2) format('woff2'); }
@font-face { font-family: Pretendard; font-weight: 600; font-display: swap; src: url(../vendor/pretendard/Pretendard-SemiBold.woff2) format('woff2'); }
@font-face { font-family: Pretendard; font-weight: 700; font-display: swap; src: url(../vendor/pretendard/Pretendard-Bold.woff2) format('woff2'); }

:root {
  --bg: #EEF0F4; --surface: #FFFFFF; --line: #E1E4EA; --line2: #CDD2DA;
  --text: #1F2430; --sub: #626A77; --faint: #9AA1AC;
  --accent: #2F5BEA; --accent-soft: #E8EEFD; --dark: #1F2430;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13px/1.5 Pretendard, 'Malgun Gothic', system-ui, sans-serif;
  display: grid; grid-template: 'top top' auto 'panel stage' 1fr 'panel deck' auto / 300px 1fr;
  overflow: hidden;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 6px 11px; transition: background .12s, border-color .12s; }
button:hover { border-color: var(--line2); background: #F7F8FA; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.dark { background: var(--dark); border-color: var(--dark); color: #fff; font-weight: 600; }
button.icon { width: 32px; padding: 5px 0; font-size: 16px; line-height: 1; }
button:disabled { opacity: .4; cursor: default; }

/* 위 도구막대 */
.top { grid-area: top; display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 200px; }
.panel, .stage-wrap, .deck, .top { min-width: 0; }
.brand b { display: block; font-size: 14px; }
.brand small { color: var(--faint); font-size: 11px; }
.logo { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.group { display: flex; align-items: center; gap: 5px; }
.sw { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line2); }
.sw.on { box-shadow: 0 0 0 2px var(--text); }
.sw-custom { width: 24px; height: 24px; padding: 0; border: 1px solid var(--line2); border-radius: 50%; overflow: hidden; cursor: pointer; }
.sw-custom::-webkit-color-swatch-wrapper { padding: 0; } .sw-custom::-webkit-color-swatch { border: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--surface); }
.seg button { border: none; border-radius: 0; padding: 5px 10px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sel { display: flex; align-items: center; gap: 6px; color: var(--sub); }
.sel select { border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: var(--surface); }
.spacer { flex: 1; }

/* 왼쪽 패널 */
.panel { grid-area: panel; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 6px 16px 30px; }
.sec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: none; }
.sec h3 { margin: 0 0 10px; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.sec h3 .n { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); color: #fff; font-size: 11px; display: grid; place-items: center; }
.cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cats button, .vars button { padding: 8px 4px; font-size: 12.5px; }
.cats button.on, .vars button.on, .chips button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.vars { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.vars button { display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 6px; }
.vars svg { width: 100%; height: auto; border-radius: 4px; border: 1px solid var(--line); display: block; }
.row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.row > span:first-child { width: 64px; color: var(--sub); flex: none; }
.row input[type=range] { flex: 1; accent-color: var(--accent); }
.row output { width: 38px; text-align: right; color: var(--accent); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.row:has(> .chips) { flex-direction: column; align-items: stretch; gap: 6px; margin: 10px 0 12px; }
.chips button { padding: 4px 9px; font-size: 12px; }

/* 무대 */
.stage-wrap { grid-area: stage; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 92px 22px 22px; overflow: hidden; min-height: 0; }
.stage { position: relative; background: #fff; box-shadow: 0 2px 6px rgba(20,30,50,.08), 0 12px 32px rgba(20,30,50,.10); border-radius: 3px; }
.stage svg { display: block; width: 100%; height: 100%; }
.stage .hit { cursor: text; }
.stage .hit:hover { fill: rgba(47,91,234,.08); stroke: rgba(47,91,234,.55); stroke-width: 1; stroke-dasharray: 4 3; }
.hint { margin: 12px 0 0; color: var(--faint); font-size: 11.5px; text-align: center; }
.editor {
  position: absolute; z-index: 5; margin: 0; padding: 2px 4px; resize: none; overflow: hidden;
  border: 2px solid var(--accent); border-radius: 4px; background: #fff; color: var(--text);
  box-shadow: 0 4px 16px rgba(20,30,50,.18); line-height: 1.35; font-family: Pretendard, 'Malgun Gothic', sans-serif;
}

/* 아래 덱 */
.deck { grid-area: deck; display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--line); min-width: 0; }
.deck-head { flex: none; display: flex; align-items: center; gap: 6px; }
.pill { background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 0 8px; font-size: 11.5px; font-weight: 600; }
.deck-list { flex: 1; display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; min-width: 0; }
.thumb { flex: none; width: 112px; padding: 0; border: 2px solid transparent; border-radius: 5px; background: none; position: relative; }
.thumb svg { display: block; width: 100%; height: auto; border-radius: 3px; box-shadow: 0 0 0 1px var(--line); }
.thumb.on { border-color: var(--accent); }
.thumb i { position: absolute; left: 4px; top: 3px; font-style: normal; font-size: 10px; font-weight: 700; color: var(--sub); background: rgba(255,255,255,.9); border-radius: 3px; padding: 0 4px; }
.deck-actions { flex: none; display: flex; gap: 6px; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(10px); background: var(--dark); color: #fff; padding: 9px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* 좁은 화면: 패널을 위로 */
@media (max-width: 860px) {
  body { grid-template: 'top' auto 'stage' minmax(240px, 42vh) 'deck' auto 'panel' 1fr / minmax(0, 1fr); overflow-x: hidden; overflow-y: auto; height: auto; }
  .top { gap: 8px 10px; }
  .group { flex-wrap: wrap; }
  .stage-wrap { padding: 16px; }
  .panel { border-right: none; border-top: 1px solid var(--line); overflow: visible; }
  .brand { min-width: 0; }
  .deck { flex-wrap: wrap; }
  .deck-list { order: 3; flex-basis: 100%; }
}
.cats button { white-space: normal; line-height: 1.25; min-height: 36px; }
textarea.data { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 7px; padding: 8px; font: 12px/1.5 ui-monospace, Consolas, 'Malgun Gothic', monospace; color: var(--text); tab-size: 12; }
.note { margin: 6px 0 0; color: var(--faint); font-size: 11.5px; }

/* 접는 옵션 묶음 */
.groups { padding-top: 6px; }
.grp { border-bottom: 1px solid var(--line); }
.grp:last-child { border-bottom: none; }
.grp > summary { cursor: pointer; padding: 11px 0; font-weight: 600; font-size: 12.5px; list-style: none; display: flex; align-items: center; gap: 6px; }
.grp > summary::-webkit-details-marker { display: none; }
.grp > summary::before { content: '▸'; color: var(--faint); transition: transform .15s; }
.grp[open] > summary::before { transform: rotate(90deg); }
.grp > summary small { color: var(--accent); font-weight: 600; }
.grp-body { padding: 0 0 12px; }
.heads { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.heads button { display: flex; flex-direction: column; gap: 4px; padding: 5px; font-size: 11.5px; }
.heads svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 3px; }
.heads button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* 무대 선택 */
.stage .selbox { fill: rgba(47, 91, 234, .06); stroke: var(--accent); stroke-width: 2px; vector-effect: non-scaling-stroke; pointer-events: none; }
.stage .hit { cursor: pointer; touch-action: none; }
.selbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px; box-shadow: 0 2px 8px rgba(20,30,50,.08); width: max-content; max-width: calc(100% - 20px); }
.selbar[hidden] { display: none; }
.selbar > b { font-size: 12px; color: var(--accent); margin-right: 4px; }
.selbar button { padding: 4px 8px; font-size: 12px; }
.selbar .sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.selbar .cdot { width: 22px; height: 22px; padding: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }

/* 선택 도구막대 두 줄 + 손잡이·안내선·고무줄 */
.selbar { flex-direction: column; gap: 4px; }
.selrow { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; }
.selrow[hidden] { display: none; }
.selrow label { display: flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--sub); }
.selrow input[type=number] { width: 62px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.selbar button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.stage .shp { cursor: move; }
.stage .selg { pointer-events: none; }
.stage .hdl { pointer-events: all; fill: #fff; stroke: var(--accent); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.stage .hdl-nw, .stage .hdl-se { cursor: nwse-resize; } .stage .hdl-ne, .stage .hdl-sw { cursor: nesw-resize; }
.stage .hdl-n, .stage .hdl-s { cursor: ns-resize; } .stage .hdl-e, .stage .hdl-w { cursor: ew-resize; }
.stage .guide { stroke: #E5484D; stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
.stage .marq { fill: rgba(47, 91, 234, .08); stroke: var(--accent); stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-dasharray: 3 3; }

/* 대화상자 (아이콘·사진) */
.modal-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(15, 20, 30, .38); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 18px 20px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.modal h2 { margin: 0; font-size: 16px; }
.modal input[type=search] { width: 100%; padding: 8px 10px; border: 1px solid var(--line2); border-radius: 8px; font-size: 13px; }
.mrow { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.mrow.left { justify-content: flex-start; }
.mrow .sp { flex: 1; }
.icgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; max-height: 340px; overflow: auto; padding: 2px; }
.icgrid button { aspect-ratio: 1; padding: 10px; color: var(--text); }
.icgrid button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.icgrid svg { width: 100%; height: 100%; display: block; }
.ph-tabs { display: flex; gap: 4px; }
.ph-tabs button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px dashed var(--line2); border-radius: 10px; padding: 26px 12px; cursor: pointer; color: var(--sub); text-align: center; }
.drop b { color: var(--accent); }
.drop.over, .drop:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.phgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; }
.phgrid button { padding: 0; overflow: hidden; aspect-ratio: 4/3; }
.phgrid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-edit { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.ph-prev { width: 180px; max-height: 160px; object-fit: contain; border-radius: 6px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 14px 14px; border: 1px solid var(--line); }
.ph-ctl { flex: 1; min-width: 220px; }
.ph-ctl .row > span:first-child { width: 64px; }
.filebtn { display: inline-block; margin-top: 8px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 12px; background: var(--surface); }
.filebtn:hover { border-color: var(--accent); color: var(--accent); }
.filebtn:focus-within { outline: 2px solid var(--accent); }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--sub); }
.fld input { padding: 8px 10px; border: 1px solid var(--line2); border-radius: 8px; font-size: 13px; color: var(--text); }
.fset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.fset legend { font-size: 12.5px; font-weight: 600; padding: 0 4px; }
.fset .ok { color: #15803d; } .fset .no { color: var(--faint); }
.chk { font-size: 12px; color: var(--sub); display: flex; gap: 6px; align-items: center; }
.lnk { font-size: 12px; color: var(--sub); }
.modal code { background: var(--bg); padding: 0 4px; border-radius: 4px; font-size: 11.5px; }
.m-text { width: min(860px, 100%); }
.t2list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.t2item { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.t2item.off { opacity: .45; }
.t2prev svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 4px; }
.t2item select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; }
.m-packs { width: min(980px, 100%); }
.m-packs h2 small { font-weight: 400; margin-left: 6px; }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.pack { display: flex; flex-direction: column; gap: 6px; }
.pk-prev { padding: 0; overflow: hidden; border-radius: 6px; }
.pk-prev svg { width: 100%; height: auto; display: block; }
.pk-prev:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pk-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.pk-row button { margin-left: auto; padding: 2px 7px; font-size: 11px; }
.pack[hidden] { display: none; }
.pack.on .pk-prev { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pk-prev span { display: block; min-height: 60px; }
.pk-prev .pv-ex { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--line); }
.pk-prev .pv-ex[hidden], .pk-prev .pv-cur[hidden] { display: none; }
.pk-desc { margin: 0; font-size: 11.5px; line-height: 1.4; }
.pk-filter { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 0 0 12px; }
.pk-filter .chips { align-items: center; }
.pk-filter #pkReset { margin-left: auto; }

/* 개선요청·받기 전 안내·방문자 수 */
.visits { margin-left: 2px; }
.fbshots { border: 2px dashed var(--line2); border-radius: 8px; min-height: 64px; padding: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--faint); font-size: 12px; }
.fbshots:focus { border-color: var(--accent); outline: none; }
.fbshot { position: relative; }
.fbshot img { height: 70px; border-radius: 4px; border: 1px solid var(--line); display: block; }
.fbshot button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0; border-radius: 50%; font-size: 10px; }
.m-fb select { padding: 7px 8px; border: 1px solid var(--line2); border-radius: 8px; }
.m-fb input[type=email] { padding: 8px 10px; border: 1px solid var(--line2); border-radius: 8px; }
.gate { justify-content: flex-start; flex-wrap: wrap; }
.btnlike { display: inline-block; padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); text-decoration: none; font-size: 13px; }
.btnlike:hover { border-color: var(--accent); color: var(--accent); }

/* 사용법 투어 */
.tour { position: fixed; inset: 0; z-index: 60; }
.tour-ring { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15, 20, 30, .55); border: 2px solid #fff; transition: all .2s; pointer-events: none; }
.tour-card { position: fixed; background: var(--surface); border-radius: 12px; padding: 14px 16px; box-shadow: 0 16px 40px rgba(0,0,0,.3); }
.tour-card b { font-size: 14px; }
.tour-card p { margin: 6px 0 10px; color: var(--sub); line-height: 1.6; }
.tour-row { display: flex; gap: 6px; align-items: center; }
.tour-row span { margin-right: auto; color: var(--faint); font-size: 12px; }
/* Y축 칸 · 핵심 메시지 후보 */
.row.axis input { width: 64px; padding: 4px 6px; border: 1px solid var(--line2); border-radius: 6px; font: inherit; font-size: 12px; }
#btnHeadline { margin-top: 8px; width: 100%; }
.hl-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.hl-list .hl { text-align: left; white-space: normal; line-height: 1.35; padding: 6px 8px; font-size: 12px; }
