/* Re:Mall 편집기 모양. 소개 페이지(public/index.html)와 같은 원칙:
   흰 바탕 + 먹색 글자 + 포인트 색 하나(오렌지). 장식 대신 여백과 글자 크기로 위계를 만든다.
   클래스 이름은 editor.js가 그리는 화면과 맞물려 있으니 바꿀 때는 두 파일을 같이 본다. */

:root {
  /* geekstudio 디자인 토큰 (Geekshop·소개 페이지와 동일) */
  --ink: #0B1020;
  --ink-soft: #3A4256;
  --muted: #5B6478;
  --line: #E3E7F0;
  --line-strong: #D5DBE8;
  --surface: #F7F6F2;
  --canvas: #EFECE4;
  --white: #FFFFFF;
  --accent: #2F5BEA;
  --accent-deep: #244BC8;
  --accent-soft: rgba(47, 91, 234, 0.08);
  --ok: #12A16B;
  --ok-soft: rgba(63, 224, 181, 0.16);
  --info: #7C5CF0;
  --info-soft: rgba(124, 92, 240, 0.1);
  --warn: #E5532D;
  --warn-soft: rgba(229, 83, 45, 0.1);
  --card-shadow: 0 14px 38px rgba(13, 22, 49, 0.14);
  --font: "Noto Sans KR", Pretendard, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── 버튼·작은 표시 ── */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border: 0; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.button-main { background: var(--accent); color: var(--white); border-radius: 999px; }
.button-main:hover { background: var(--accent-deep); }
.button-outline { background: var(--white); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.button-outline:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.button-compact { height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13px; }
.button-small {
  height: 30px; padding: 0 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: var(--white); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.button-small:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--ink); }
/* 작은 크기의 주 버튼(예: "이걸로 적용"): .button-small의 흰 배경이 덮어쓰지 않게 */
.button-main.button-small { background: var(--accent); color: var(--white); box-shadow: none; }
.button-main.button-small:hover:not(:disabled) { background: var(--accent-deep); box-shadow: none; }
.button:disabled { opacity: .35; cursor: not-allowed; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface); color: var(--muted); border: 0;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.review { background: var(--info-soft); color: var(--info); }
.pill.reject, .pill.off { background: var(--warn-soft); color: var(--warn); }
.usage-pill { cursor: pointer; font-family: var(--mono); font-weight: 500; }
.usage-pill::before { display: none; }

/* ── 위쪽 막대 ── */
.top-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--white);
}
.logo { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 900; letter-spacing: -0.05em; color: var(--ink); text-decoration: none; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--white); display: grid; place-items: center; font-size: 13px; font-weight: 900; }

.address-form {
  flex: 1; min-width: 280px; max-width: 560px;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 5px 5px 16px; border-radius: 12px; background: var(--surface);
  transition: box-shadow .15s ease, background .15s ease;
}
.address-form:focus-within { background: var(--white); box-shadow: inset 0 0 0 1.5px var(--accent); }
.address-form input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px; }
.address-form input::placeholder { color: var(--muted); }
.address-form input:focus-visible { outline: none; }

.top-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface); }
.segmented button {
  height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(14, 15, 18, .12); }

/* ── 작업 영역 ── */
.workspace { --panel-width: 380px; flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr var(--panel-width); transition: grid-template-columns .2s ease; }
@media (max-width: 960px) { .workspace { grid-template-columns: 1fr; } }

.stage { min-width: 0; min-height: 520px; padding: 24px; background: var(--canvas); display: flex; justify-content: center; overflow: auto; }

.empty-state { align-self: center; max-width: 440px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.empty-eyebrow { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.empty-state h1 { margin: 0; font-size: 32px; font-weight: 900; letter-spacing: -0.05em; }
.empty-state p { margin: 0; color: var(--muted); font-size: 15px; }
.empty-state .button { margin-top: 12px; }

.frame-wrap {
  position: relative; /* 수정 팝업의 기준 */
  width: 100%; display: flex; flex-direction: column;
  border-radius: 16px; overflow: hidden; background: var(--white);
  box-shadow: var(--card-shadow);
  transition: max-width .2s ease;
}
.frame-wrap.mobile { max-width: 390px; }
.frame-bar { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.frame-dots { display: flex; gap: 6px; }
.frame-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.frame-address { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame-loading { color: var(--accent); font-weight: 600; }
iframe { flex: 1; width: 100%; min-height: 640px; border: 0; background: var(--white); }

/* ── 오른쪽 패널 ── */
.panel { min-height: 0; overflow: auto; border-left: 1px solid var(--line); background: var(--white); }
.panel-section { display: grid; gap: 12px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.label { margin: 0; font-size: 15px; font-weight: 900; letter-spacing: -0.03em; color: var(--ink); }
.label .count { color: var(--muted); font-weight: 600; }
.label-small { padding: 0; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.hint { margin: 0; font-size: 12px; color: var(--muted); }

/* 결과 */
.result-section { background: var(--surface); }
.result-top { display: grid; gap: 8px; font-weight: 600; font-size: 14px; line-height: 1.5; }
.result-top .pill { justify-self: start; }
.result-box-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-soft); display: grid; gap: 2px; }
.result-section .hint { font-size: 13px; color: var(--ink-soft); }
.check-line { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--ok-soft); font-size: 13px; }
.check-line strong { display: block; margin-bottom: 2px; color: var(--ok); }
.check-line.is-revised { background: var(--info-soft); }
.check-line.is-revised strong { color: var(--info); }
.check-line.is-disabled { background: var(--warn-soft); }
.check-line + .check-line { margin-top: 6px; }
.check-line .button { margin-top: 6px; }
/* 모바일 너비 확인용 화면: 화면 밖에 두고 보이지 않게(배치 계산은 그대로 된다) */
#mobile-probe { position: fixed; left: -10000px; top: 0; width: 390px; height: 844px; border: 0; visibility: hidden; pointer-events: none; }
.check-line.is-disabled strong { color: var(--warn); }

/* AI가 일하는 동안 */
.thinking { display: grid; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid rgba(11, 16, 32, 0.06); }
.thinking-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.thinking-head strong { font-size: 14px; font-weight: 600; color: var(--ink); }
.thinking-time { font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.loading { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-large { width: 24px; height: 24px; border-width: 2.5px; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
/* 단계 목록: 동그라미를 가는 세로선으로 잇는다. 끝난 단계는 체크, 지금 단계는 파란 원 안에서 작은 회전 표시 */
.thinking-steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; font-size: 13px; color: #8A92A4; }
.thinking-steps li { position: relative; min-height: 28px; padding: 4px 0 0 28px; line-height: 20px; }
.thinking-steps li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 14px; height: 14px; box-sizing: border-box;
  border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--white); }
.thinking-steps li:not(:last-child)::after { content: ""; position: absolute; left: 9.5px; top: 23px; bottom: -5px; width: 1px; background: var(--line-strong); }
.thinking-steps li.done { color: var(--muted); }
.thinking-steps li.done::before { border-color: var(--ink-soft); background: var(--ink-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2l2 2 4-4.4' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat; }
.thinking-steps li.just-done::before { animation: step-done .2s cubic-bezier(.2, .7, .2, 1); }
.thinking-steps li.done::after { background: var(--ink-soft); }
.thinking-steps li.now { color: var(--ink); font-weight: 500; }
.thinking-steps li.now::before { border-color: rgba(47, 91, 234, 0.2); border-top-color: var(--accent); border-width: 2px; animation: spin .8s linear infinite; }
@keyframes step-done { from { transform: scale(.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .thinking-steps li::before { animation: none !important; } }

/* AI 사용량 (테스트 환경에서만) */
.usage-block { display: grid; gap: 8px; }
.usage-block summary { cursor: pointer; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.usage-block[open] summary { margin-bottom: 4px; }
.usage-heading { font-size: 11px; color: var(--muted); }
.usage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.usage-row { display: grid; gap: 1px; font-size: 12px; }
.usage-title { color: var(--muted); }
.usage-title strong { color: var(--ink); font-weight: 600; }
.usage-numbers { font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.usage-sum { font-size: 12px; text-align: right; }

/* 수정 내역 */
.edit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.edit-item { display: grid; gap: 6px; padding: 14px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.edit-item.is-off { opacity: .5; }
.edit-item-top { display: flex; align-items: flex-start; gap: 10px; }
.edit-item-top label { display: flex; align-items: flex-start; gap: 8px; flex: 1; font-size: 13px; font-weight: 600; line-height: 1.45; cursor: pointer; }
.edit-item-top input { margin-top: 2px; accent-color: var(--accent); }
.edit-item .summary { font-size: 12px; color: var(--muted); }
.edit-item .meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: var(--white); font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.result-meta { font-size: 11px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* 수정 내역: 다시 수정 버튼과 지금 고치는 항목 표시 */
.edit-item-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.edit-item-actions .edit-delete { margin-left: auto; }
.edit-item-actions .button-small.is-pressed { background: var(--ink); color: var(--white); box-shadow: none; }
.edit-item.is-revising { box-shadow: inset 0 0 0 1.5px var(--accent); background: var(--accent-soft); }
.edit-item .history { font-size: 11px; color: var(--muted); }

/* 몰 화면 위 사용법 안내 (왼쪽 클릭은 평소처럼, 오른쪽 클릭이 수정) */
.frame-guide {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 28px; padding: 0 12px 0 9px; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 600; white-space: nowrap; box-shadow: 0 2px 8px rgba(47, 91, 234, .35);
}
.frame-guide b { font-weight: 800; }
.frame-guide-sub { opacity: .8; font-weight: 500; }
@media (max-width: 1100px) { .frame-guide-sub { display: none; } }
.mouse-icon { width: 16px; height: 16px; flex: none; }

/* 처음 안내 카드: 몰 화면 아래쪽 가운데에 뜬다 */
.coach {
  position: absolute; z-index: 6; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px)); display: flex; align-items: center; gap: 14px; padding: 16px 16px 16px 18px;
  border-radius: 16px; background: var(--ink); color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .15), 0 20px 50px rgba(13, 22, 49, .4);
  animation: coach-in .35s ease-out;
}
.coach[hidden] { display: none; }
@keyframes coach-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.coach-icon { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, .1); color: #8FB0FF; }
.mouse-icon-large { width: 30px; height: 30px; animation: mouse-click 1.6s ease-in-out infinite; }
@keyframes mouse-click { 0%, 60%, 100% { transform: scale(1); } 70% { transform: scale(.88); } }
.coach-text { flex: 1; display: grid; gap: 3px; }
.coach-text strong { font-size: 15px; font-weight: 700; }
.coach-text em { font-style: normal; color: #8FB0FF; }
.coach-text span { font-size: 12.5px; color: rgba(255, 255, 255, .72); line-height: 1.5; }
.coach .button { flex: none; }

/* ── 수정 팝업 ─────────────────────────────────────────
   몰 화면에서 고른 요소 옆에 뜬다(위치는 editor.js의 positionPopup).
   머리줄(요소·영역 키우기/줄이기/닫기, 끌어서 옮기기) → 본문(안내·범위·요청) → 아래줄(페이지 범위·버튼) → 결과.
   큰 화면(24·27인치)에서는 아래 미디어 쿼리가 폭과 글자를 키운다. */
.edit-popup {
  --popup-width: 400px;
  --popup-font: 13px;
  position: absolute; z-index: 5;
  width: var(--popup-width); max-width: calc(100% - 16px); max-height: calc(100% - 54px);
  display: flex; flex-direction: column;
  border-radius: 16px; background: var(--white); overflow: hidden;
  font-size: var(--popup-font);
  /* 몰 배경이 어두워도 밝아도 팝업 가장자리가 보이게: 안쪽 흰 테두리 + 바깥 파란 테두리 + 그림자 */
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .95),
    0 0 0 3px rgba(47, 91, 234, .55),
    0 24px 60px rgba(13, 22, 49, .32),
    0 2px 8px rgba(13, 22, 49, .12);
  animation: popup-in .14s ease-out;
}
@keyframes popup-in { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.edit-popup.is-dragging { box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--accent), 0 30px 80px rgba(13, 22, 49, .4); user-select: none; }

/* 머리줄 */
/* 머리줄은 밝은 색: 어두운 몰 배경에서도 팝업과 섞이지 않게 한다 */
.popup-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px;
  background: linear-gradient(#F5F7FC, #EEF2FB); color: var(--ink);
  border-bottom: 1px solid var(--line); cursor: grab; touch-action: none;
}
.edit-popup.is-dragging .popup-head { cursor: grabbing; }
.popup-target { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.popup-target strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.04em; font-weight: 600; }
.popup-tools { flex: none; display: flex; gap: 4px; }
.icon-button {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 8px; border: 0; border-radius: 8px;
  background: var(--white); color: var(--ink-soft); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.icon-button span { font-weight: 600; }
.icon-button:hover:not(:disabled) { color: var(--accent-deep); box-shadow: inset 0 0 0 1px var(--accent); }
.icon-button:disabled { opacity: .35; cursor: default; }
.icon-button.icon-only { width: 28px; justify-content: center; padding: 0; font-size: 13px; }
.ui-icon { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 본문: 안내(위) · 대화와 결과(가운데, 이 칸만 스크롤) · 입력칸(아래, 늘 보임) */
.popup-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 12px; overflow: hidden; }
.popup-context { flex: none; display: grid; gap: 8px; }
.popup-context:not(:has(> :not([hidden]):not(:empty))) { display: none; }
.popup-conversation { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 12px; align-content: start; }
.popup-conversation:not(:has(> :not([hidden]))) { display: none; }
.popup-conversation:has(> :not([hidden])) + .composer { padding-top: 12px; border-top: 1px solid var(--line); }
/* 칸 안 내용(예시 문구 줄 등)이 길어도 팝업 폭을 넘지 않고 그 안에서 스크롤되게 한다 */
.popup-body > *, .edit-popup form > *, .request-field { min-width: 0; }
.popup-notes:empty { display: none; }
.popup-notes { display: grid; gap: 6px; }
.note { display: block; padding: 7px 10px; border-radius: 8px; background: var(--surface); font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.note.warning { background: var(--warn-soft); color: #9A3A1F; }
.revising-note { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--info-soft); font-size: 12px; color: var(--ink-soft); }
.revising-note strong { color: var(--info); }
.revising-note { display: grid; gap: 4px; }
.revising-note[hidden] { display: none; }
.revising-summary { color: var(--ink); }
.revising-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--muted); }
.revising-note .link-button { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--info); text-decoration: underline; cursor: pointer; }

/* 범위: 같은 요소가 여럿일 때만 */
.same-elements-note { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; row-gap: 4px; }
.same-elements-note[hidden] { display: none; }
.field-label { font-size: 12px; font-weight: 700; color: var(--muted); }
#scope-help { display: none; }
.scope-buttons { display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface); }
.scope-buttons button {
  flex: 1; height: 28px; padding: 0 8px; border: 0; border-radius: 8px; white-space: nowrap;
  background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.scope-buttons button:hover { color: var(--ink); }
.scope-buttons button[aria-pressed="true"] { background: var(--white); color: var(--accent-deep); box-shadow: 0 1px 3px rgba(13, 22, 49, .14); }

/* 요청 입력 */
.edit-popup form { display: grid; gap: 8px; }
.composer { flex: none; }
.request-field {
  border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow .15s ease, background .15s ease;
}
.request-field:focus-within { background: var(--white); box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--accent-soft); }
.request-field textarea {
  display: block; width: 100%; min-height: 52px; max-height: 160px; resize: none; padding: 12px 12px 4px;
  border: 0; outline: none; background: transparent; font: inherit; font-size: 1.04em; line-height: 1.55; color: var(--ink);
}
.request-field textarea::placeholder { color: var(--muted); }
.chips {
  display: flex; gap: 6px; padding: 6px 10px 10px; overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity; scroll-padding-inline: 10px; overscroll-behavior-x: contain; cursor: grab;
  --fade-left: 0px; --fade-right: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent 100%);
}
.chips.has-more-left { --fade-left: 28px; }
.chips.has-more-right { --fade-right: 28px; }
.chips.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.chips.is-dragging .chip { pointer-events: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 26px; padding: 0 10px; border: 0; border-radius: 999px; cursor: pointer; white-space: nowrap; scroll-snap-align: start;
  background: var(--white); box-shadow: inset 0 0 0 1px var(--line-strong); font: inherit; font-size: 11.5px; color: var(--ink-soft);
}
.chip:hover { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent-deep); }

/* 아래줄: 적용 페이지 · 디자인 추천받기 · 보내기 */
.composer-row { display: flex; align-items: center; gap: 8px; }
.composer-row #request-button { margin-left: auto; gap: 6px; }
.composer-row kbd { padding: 1px 4px; border-radius: 4px; background: rgba(255, 255, 255, .2); font: 600 10px var(--mono); }
.composer-row .button-outline kbd { background: var(--surface); color: var(--muted); }
.text-button {
  height: 28px; padding: 0 4px; border: 0; background: none; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-soft);
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px;
}
.text-button:hover:not(:disabled) { color: var(--accent-deep); text-decoration-color: currentColor; }
.text-button:disabled { opacity: .35; cursor: not-allowed; }
.page-scope { display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface); }
.page-scope label { position: relative; cursor: pointer; }
.page-scope input { position: absolute; opacity: 0; pointer-events: none; }
.page-scope span { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.page-scope input:checked + span { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(13, 22, 49, .14); }
.page-scope input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 결과(진행 중·미리보기·완료·추천): 대화 흐름 안에 카드로 들어간다 */
.edit-popup .result-section { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface); }
/* 미리보기: 몰 화면에 그리는 파란 테두리를 카드 왼쪽 선으로 잇는다 */
.edit-popup .result-section.is-draft { background: var(--white); box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px var(--line); }
.result-label { font-size: 12px; font-weight: 600; color: var(--accent-deep); }
.edit-popup .result-section[hidden] { display: none; }

/* 추천받기: 3가지 안 카드. 누르면 몰 화면에 미리 적용된다 */
.suggest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.suggest-card {
  display: grid; gap: 3px; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  background: var(--white); box-shadow: inset 0 0 0 1px var(--line-strong); transition: box-shadow .12s ease;
}
.suggest-card:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.suggest-card.is-previewing { background: #fff; box-shadow: inset 0 0 0 2px var(--accent), 0 6px 16px rgba(47, 91, 234, .12); cursor: default; }
.suggest-title { font-size: 1em; font-weight: 600; }
.suggest-title b { color: var(--accent); margin-right: 4px; }
.suggest-desc { font-size: .92em; color: var(--ink-soft); line-height: 1.5; }
.suggest-meta { font-size: 11px; color: var(--muted); }
.suggest-card .button { justify-self: start; margin-top: 4px; }
.suggest-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest-actions .button-small { white-space: nowrap; }

/* ── 큰 화면: 24인치(1920) · 27인치(2560) ───────────── */
@media (min-width: 1680px) {
  .workspace { --panel-width: 420px; }
  .edit-popup { --popup-width: 440px; --popup-font: 14px; }
  .request-field textarea { min-height: 60px; }
}
@media (min-width: 2200px) {
  body { font-size: 15px; }
  .workspace { --panel-width: 480px; }
  .edit-popup { --popup-width: 500px; --popup-font: 15px; border-radius: 18px; }
  .popup-head { padding: 12px 12px 12px 16px; }
  .popup-body { padding: 16px; gap: 14px; }
  .icon-button { height: 32px; font-size: 12px; }
  .icon-button.icon-only { width: 32px; }
  .scope-buttons button { height: 32px; font-size: 13px; }
  .page-scope span { height: 30px; font-size: 12.5px; }
  .chip { height: 30px; font-size: 12.5px; }
  .request-field textarea { min-height: 100px; }
}

/* ── 수정 내역 패널 접기 ────────────────────────────────
   접으면 52px 띠(펼치기 버튼)만 남는다. 좁은 화면(960px 이하)에서는 패널이 아래로 내려가므로 띠 대신 한 줄 버튼이 된다. */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-collapse {
  height: 28px; padding: 0 10px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 700;
}
.panel-collapse:hover { color: var(--ink); }
.panel-rail { display: none; }
.workspace.is-panel-collapsed { --panel-width: 52px; }
.workspace.is-panel-collapsed .panel { overflow: hidden; }
.workspace.is-panel-collapsed .panel-content { display: none; }
.workspace.is-panel-collapsed .panel-rail {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 100%; height: 100%; padding: 18px 0; border: 0; background: var(--white); cursor: pointer;
  color: var(--ink-soft); font: inherit;
}
.panel-rail:hover { background: var(--surface); }
.panel-rail-arrow { font-size: 18px; line-height: 1; color: var(--muted); }
.panel-rail-label { writing-mode: vertical-rl; font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.panel-rail-count:empty { display: none; }
.panel-rail-count { min-width: 22px; padding: 2px 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
@media (max-width: 960px) {
  .workspace.is-panel-collapsed .panel-rail { flex-direction: row; justify-content: center; height: auto; padding: 12px; }
  .workspace.is-panel-collapsed .panel-rail-label { writing-mode: horizontal-tb; }
}

/* 원래 모습 비교 버튼: 누르고 있는 동안 원래 화면 */
.compare-button { touch-action: none; user-select: none; }
.compare-button:active { background: var(--ink); color: #fff; box-shadow: none; }

/* ── 몰 화면 불러오는 중 ───────────────────────────────
   몰 화면(iframe) 위를 덮는다. 가운데 로딩 카드 + 뒤에 흐린 페이지 뼈대(곧 화면이 뜬다는 느낌). */
.frame-overlay {
  position: absolute; z-index: 4; left: 0; right: 0; top: 38px; bottom: 0;
  display: grid; place-items: center; background: var(--white); overflow: hidden;
}
.frame-overlay[hidden] { display: none; }
.loader {
  position: relative; z-index: 1; width: min(360px, calc(100% - 40px)); display: grid; gap: 8px; justify-items: center;
  padding: 26px 24px; border-radius: 18px; background: rgba(255, 255, 255, .94); text-align: center;
  box-shadow: 0 18px 50px rgba(13, 22, 49, .12), 0 0 0 1px var(--line);
}
.loader strong { font-size: 15px; }
.loader span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.loader-bar { width: 100%; height: 6px; margin-bottom: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.loader-bar span { display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--accent); animation: loader-slide 1.2s ease-in-out infinite; }
@keyframes loader-slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.loader-skeleton { position: absolute; inset: 0; display: grid; align-content: start; gap: 18px; padding: 24px; opacity: .7; }
.loader-skeleton i, .sk-row i { display: block; border-radius: 10px; background: linear-gradient(90deg, #F1F2F6 25%, #E7E9F0 50%, #F1F2F6 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk-head { height: 44px; }
.sk-banner { height: 260px; }
.sk-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.sk-row i { height: 180px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── 게시(실제 몰에 적용) ── */
.publish-box { display: grid; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface); }
.publish-box[hidden] { display: none; }
.publish-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.publish-text { display: grid; gap: 1px; min-width: 0; }
.publish-text strong { font-size: 13px; }
.publish-text span { font-size: 12px; color: var(--muted); }
.publish-text span.has-changes { color: var(--warn); font-weight: 600; }
/* 설치 안내: 설치가 확인되지 않으면 파란 테두리 카드로 펼쳐 두고, 확인되면 한 줄로 줄인다 */
.install[hidden] { display: none; }
.install.is-needed { display: grid; gap: 12px; padding: 16px; border-radius: 12px; background: var(--white); box-shadow: inset 0 0 0 1.5px var(--accent); }
.install-head { display: grid; gap: 4px; }
.install-head strong { font-size: 14px; font-weight: 600; color: var(--ink); }
.install-head span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: step; }
.install-steps li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; font-size: 12px; line-height: 20px; color: var(--ink-soft); counter-increment: step; }
.install-steps li::before { content: counter(step); width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep);
  font: 500 11px/20px var(--mono); text-align: center; }
.install-steps b { color: var(--ink); font-weight: 600; }
.install-code { display: flex; align-items: stretch; gap: 8px; }
.install-code code {
  flex: 1; min-width: 0; padding: 8px 12px; border-radius: 8px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong);
  font: 12px/1.5 var(--mono); color: var(--ink); overflow-wrap: anywhere; user-select: all;
}
.install-code .button { flex: none; align-self: center; min-width: 56px; }
.install-check { display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.install-check span { font-size: 12px; color: var(--muted); }
.install.is-installed summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 12px; color: var(--ink-soft); }
.install.is-installed summary::-webkit-details-marker { display: none; }
.install.is-installed .install-more { margin-left: auto; color: var(--accent-deep); }
.install.is-installed details[open] .install-code { margin-top: 8px; }
.install-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* 게시할 때 설치 코드가 없으면 뜨는 팝업 */
.install-dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; background: var(--white); color: var(--ink); box-shadow: var(--card-shadow); }
.install-dialog::backdrop { background: rgba(11, 16, 32, 0.32); }
.install-dialog-body { display: grid; gap: 16px; margin: 0; padding: 24px; }
.install-dialog h2 { margin: 0; font-size: 18px; font-weight: 600; }
.install-dialog-lead { margin: -8px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.install-dialog #install-dialog-guide { display: grid; gap: 12px; }
.install-dialog-result { margin: 0; font-size: 12px; line-height: 1.6; color: var(--warn); }
.install-dialog-result:empty { display: none; }
.install-dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 4px; }
.install-dialog-actions .button-quiet { margin-right: auto; box-shadow: none; background: none; color: var(--muted); }

.publish-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.publish-history:empty { display: none; }
.publish-history li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.publish-history li b { color: var(--ink); font-weight: 600; }
.publish-history .live { color: var(--ok); font-weight: 700; }
.publish-history button { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }

/* 문의 남기기: 자동으로 못 하는 요청일 때 결과칸 안에서 연다 */
.inquiry { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.inquiry-request { display: grid; gap: 4px; margin: 0; font-size: 13px; color: var(--ink-soft); }
.inquiry-field { display: grid; gap: 4px; }
.inquiry-field input, .inquiry-field textarea {
  width: 100%; padding: 8px 12px; border: 0; border-radius: 8px; resize: none; outline: none;
  background: var(--white); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 13px; line-height: 1.5;
}
.inquiry-field input:focus, .inquiry-field textarea:focus { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--accent-soft); }
.inquiry .button-send { background: var(--accent); color: var(--white); box-shadow: none; }
.inquiry .button-send:hover:not(:disabled) { background: var(--accent-deep); box-shadow: none; }
.inquiry-error { color: var(--warn); }
.inquiry-done { color: var(--ink-soft); }

/* ── 대화 ──────────────────────────────────────────────
   팝업 안에서 AI와 주고받은 말. 운영자 말은 오른쪽(강조색 옅게), AI 말은 왼쪽(회색) */
.chat-thread { display: grid; gap: 8px; }
.chat-thread[hidden] { display: none; }
.chat-message { display: grid; gap: 6px; max-width: 88%; }
.chat-message p { margin: 0; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.chat-message.user { justify-self: end; }
.chat-message.user p { background: var(--accent-soft); color: var(--ink); border-bottom-right-radius: 4px; }
.chat-message.assistant { justify-self: start; }
.chat-message.assistant p { background: var(--line-soft, #F1F2F5); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-message.is-error p { background: var(--warn-soft); }
.chat-message.is-thinking p { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.chat-choices { display: flex; flex-wrap: wrap; gap: 6px; }
/* 정리(만들 내용): 항목마다 한 줄 */
.chat-spec { padding: 8px 12px; border-radius: 12px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 13px; line-height: 1.6; white-space: pre-line; color: var(--ink); }
