/* ============================================================
   style.css — 상품배너 550 A 누끼형 자동 배치 워크스페이스
   Bannerly 토큰: accent #4E4CDB / hover #3831a6 / Pretendard
   전부 .ap550 스코프
   ============================================================ */
:root {
  --ap-accent: #4E4CDB;
  --ap-accent-2: #3831a6;
  --ap-accent-soft: #eef2ff;
  --ap-ink: #1c1c22;
  --ap-text: #3a3a42;
  --ap-muted: #8a8a93;
  --ap-faint: #b6b6bd;
  --ap-line: #e8e8ec;
  --ap-line-2: #f0f0f2;
  --ap-bg: #f6f6f8;
  --ap-panel: #fff;
  --ap-green: #0E9F6E;
  --ap-score: #7c5cff;
  --ap-ai: #2f7ff0;
  --ap-rule: #0E9F6E;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: "Pretendard Variable", "Pretendard", system-ui, sans-serif; background: var(--ap-bg); color: var(--ap-text); -webkit-font-smoothing: antialiased; }

.ap550 { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ---- 에디터 헤더 (좌: 배너이름+유형 드롭박스 / 우: 저장하기) — 3개 에디터 공용 ---- */
.ap-editor-header { display: flex; align-items: center; gap: 14px; flex-shrink: 0; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--ap-line); }
.ap-eh-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ap-eh-title { font-size: 16px; font-weight: 800; letter-spacing: -.02em; color: var(--ap-ink); white-space: nowrap; }
.ap-eh-type { padding: 7px 30px 7px 12px; border-radius: 8px; border: 1px solid #e4e4ea; background: #fff; font: inherit; font-size: 13px; font-weight: 600; color: #43434e; cursor: pointer; transition: border-color .12s, background .12s; }
.ap-eh-type:hover { border-color: #cfcfd8; background: #fafafb; }
.ap-eh-info { padding-left: 12px; margin-left: 2px; border-left: 1px solid #e6e6ec; font-size: 12.5px; color: #8a8a96; white-space: nowrap; }
.ap-eh-info b { color: #43434e; font-weight: 700; }
.ap-eh-save { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 9px 20px; border-radius: 8px; border: none; background: #4E4CDB; color: #fff; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: background .12s; }
.ap-eh-save:hover { background: #3831a6; }
/* 저장하기(외곽선형) — 흰 배경 + 액센트 글자. 호버 시 연한 액센트 배경. */
.ap-eh-save.ghost { background: #fff; color: #4E4CDB; border: 1px solid #d7d4f7; }
.ap-eh-save.ghost:hover { background: #eef2ff; border-color: #4E4CDB; }

/* ---- 상단 앱바 ---- */
.ap-bar { display: flex; align-items: center; gap: 14px; height: 54px; flex-shrink: 0;
  padding: 0 18px; background: #fff; border-bottom: 1px solid var(--ap-line); user-select: none; }
.ap-brand { display: inline-flex; align-items: center; gap: 9px; }
.ap-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #4E4CDB, #7c6df0);
  color: #fff; font-weight: 800; font-size: 16px; display: grid; place-items: center; letter-spacing: -.02em; }
.ap-brand-name { font-size: 15px; font-weight: 700; letter-spacing: -.02em; color: var(--ap-ink); }
.ap-bar-title { display: inline-flex; align-items: center; gap: 7px; margin-left: 6px; padding-left: 16px; border-left: 1px solid var(--ap-line); }
.ap-cat { font-size: 13px; color: var(--ap-muted); font-weight: 600; }
.ap-bar-sep { color: var(--ap-faint); }
.ap-guide { font-size: 13.5px; font-weight: 700; color: var(--ap-ink); letter-spacing: -.01em; }
.ap-bar-spacer { flex: 1; }
.ap-stage-badge { font-size: 11.5px; font-weight: 700; color: var(--ap-accent); background: var(--ap-accent-soft);
  padding: 5px 10px; border-radius: 999px; letter-spacing: -.01em; }
.ap-acct { display: inline-flex; align-items: center; gap: 8px; }
.ap-acct-av { width: 28px; height: 28px; border-radius: 999px; background: #1E9E6A; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.ap-acct-nm { font-size: 12.5px; font-weight: 600; color: var(--ap-text); }

/* ---- 본문 ---- */
.ap-body { flex: 1; display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 0; }

/* ---- 좌측 컨트롤 ---- */
.ap-controls { background: #fff; border-right: 1px solid var(--ap-line); overflow-y: auto; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 18px; }
.ap-sec { display: flex; flex-direction: column; gap: 11px; }
.ap-sec-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--ap-ink); letter-spacing: -.01em; }
.ap-sec-head.sm { font-size: 12.5px; color: var(--ap-muted); }
.ap-step { width: 19px; height: 19px; border-radius: 6px; background: var(--ap-ink); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.ap-req { font-size: 10.5px; font-weight: 700; color: var(--ap-accent); background: var(--ap-accent-soft); padding: 2px 7px; border-radius: 5px; }
.ap-opt { font-size: 10.5px; font-weight: 700; color: var(--ap-muted); background: var(--ap-bg); padding: 2px 7px; border-radius: 5px; }
.ap-step.alt { background: #fff; color: var(--ap-muted); border: 1.5px solid var(--ap-line); }
.ap-model-add { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed #d3d3da; border-radius: 10px; background: #fff; color: var(--ap-text); font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 12px; cursor: pointer; transition: border-color .12s, color .12s, background .12s; }
.ap-model-add:hover { border-color: var(--ap-accent); color: var(--ap-accent); background: var(--ap-accent-soft); }
.ap-model-row { display: flex; align-items: center; gap: 11px; }
.ap-model-thumb { position: relative; width: 54px; height: 64px; border-radius: 9px; overflow: hidden; background: var(--ap-bg); border: 1px solid var(--ap-line); flex-shrink: 0; }
.ap-model-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ap-model-meta { display: flex; flex-direction: column; gap: 2px; }
.ap-model-meta b { font-size: 12.5px; font-weight: 700; color: var(--ap-ink); }
.ap-model-meta span { font-size: 11.5px; color: var(--ap-muted); line-height: 1.4; }
.ap-count { margin-left: auto; font-size: 12px; color: var(--ap-muted); font-weight: 600; }

.ap-drop { border: 1.5px dashed #d3d3da; border-radius: 12px; padding: 22px 14px; text-align: center; cursor: pointer; transition: border-color .14s, background .14s; }
.ap-drop:hover, .ap-drop.over { border-color: var(--ap-accent); background: var(--ap-accent-soft); }
.ap-drop-ic { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 12px; background: var(--ap-bg); color: var(--ap-accent); display: grid; place-items: center; }
.ap-drop-t { font-size: 13px; font-weight: 700; color: var(--ap-ink); }
.ap-drop-h { font-size: 11.5px; color: var(--ap-muted); margin-top: 3px; }
.ap-sample-btn { margin-top: 13px; border: 1px solid var(--ap-line); background: #fff; color: var(--ap-text); font-family: inherit; font-size: 12px; font-weight: 600; padding: 7px 13px; border-radius: 7px; cursor: pointer; transition: background .12s, border-color .12s; }
.ap-sample-btn:hover { background: var(--ap-bg); border-color: #d3d3da; }

.ap-thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.ap-thumb { position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden; background: var(--ap-bg); border: 1px solid var(--ap-line); }
.ap-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ap-thumb-x { position: absolute; top: 4px; right: 4px; width: 16px; height: 16px; border: 0; border-radius: 5px; background: rgba(28,28,34,.78); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.ap-thumb-x svg { display: block; width: 9px; height: 9px; }
.ap-thumb-x:hover { background: #000; }
.ap-upload-thumb { aspect-ratio: auto; overflow: visible; display: flex; flex-direction: column; gap: 3px; padding: 3px; }
.ap-upload-thumb .ap-thumb-media { position: relative; aspect-ratio: 1; min-height: 0; border-radius: 7px; overflow: hidden; background: var(--ap-bg); }
.ap-thumb-actions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
.ap-thumb-actions.single { grid-template-columns: 1fr; }
.ap-thumb-action { width: 100%; height: 18px; border: 0; border-radius: 5px; background: #f2f2f7; color: #4b4b57; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.ap-thumb-action:hover { background: #e8e7ff; color: var(--ap-accent); }
.ap-thumb-action:disabled { opacity: .34; cursor: default; background: #f4f4f7; color: #8f8f99; }
.ap-thumb-action.danger:hover { background: #fff1f1; color: #c62828; }
.ap-drophint { font-size: 11px; color: var(--ap-faint); text-align: center; margin-top: 2px; }
.ap-thumbs.over { outline: 2px dashed var(--ap-accent); outline-offset: 5px; border-radius: 10px; background: var(--ap-accent-soft); }
.ap-thumb-add { aspect-ratio: 1; border: 1.5px dashed #d3d3da; border-radius: 9px; background: #fff; color: var(--ap-muted); display: grid; place-items: center; cursor: pointer; transition: border-color .12s, color .12s; }
.ap-thumb-add:hover { border-color: var(--ap-accent); color: var(--ap-accent); background: var(--ap-accent-soft); }
.drop-over { outline: 2px dashed var(--accent, #4E4CDB) !important; outline-offset: 2px; background: var(--ap-accent-soft) !important; }
.ap-add-dash { transition: border-color .14s, color .14s, background .14s; }
.ap-add-dash:hover { border-color: var(--accent, #4E4CDB) !important; color: var(--accent, #4E4CDB) !important; background: var(--ap-accent-soft) !important; }
.ap-clear-tile:hover { border-color: #4E4CDB !important; color: #4E4CDB !important; background: #eef2ff !important; }
.ap-mini-range { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; background: #e9e9ef; outline: none; cursor: pointer; }
.ap-mini-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid #6d5ef0; box-shadow: 0 1px 3px rgba(0,0,0,.22); cursor: pointer; }
.ap-mini-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid #6d5ef0; box-shadow: 0 1px 3px rgba(0,0,0,.22); cursor: pointer; }
.ap-sub-actions { display: flex; justify-content: space-between; }
.ap-link { border: 0; background: transparent; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--ap-muted); cursor: pointer; padding: 2px 0; }
.ap-link:hover { color: var(--ap-accent); }
.ap-link.danger:hover { color: #D64545; }

/* 배경 옵션 */
.ap-bgopts { display: flex; flex-direction: column; gap: 7px; }
.ap-bgopt { display: flex; align-items: center; gap: 11px; text-align: left; padding: 11px 12px; border: 1px solid var(--ap-line); border-radius: 9px; background: #fff; cursor: pointer; font-family: inherit; transition: border-color .12s, background .12s; }
.ap-bgopt:hover { border-color: #d3d3da; }
.ap-bgopt.on { border-color: var(--ap-accent); background: var(--ap-accent-soft); }
.ap-bgopt-radio { width: 16px; height: 16px; border-radius: 999px; border: 2px solid #cfcfd6; flex-shrink: 0; transition: border-color .12s; position: relative; }
.ap-bgopt.on .ap-bgopt-radio { border-color: var(--ap-accent); }
.ap-bgopt.on .ap-bgopt-radio::after { content: ""; position: absolute; inset: 3px; border-radius: 999px; background: var(--ap-accent); }
.ap-bgopt-txt { display: flex; flex-direction: column; gap: 1px; }
.ap-bgopt-txt b { font-size: 13px; font-weight: 700; color: var(--ap-ink); }
.ap-bgopt-txt span { font-size: 11.5px; color: var(--ap-muted); }
.ap-warn { display: flex; align-items: flex-start; gap: 7px; font-size: 11.5px; line-height: 1.5; color: #9a6400; background: #fff7e6; border: 1px solid #ffe2a8; border-radius: 8px; padding: 9px 11px; }
.ap-warn svg { flex-shrink: 0; margin-top: 1px; color: #D98324; }

/* 가이드 정보 */
.ap-guide-info { background: var(--ap-bg); border-radius: 11px; padding: 14px; gap: 7px; }
.ap-gi-row { display: flex; justify-content: space-between; font-size: 12.5px; }
.ap-gi-row span { color: var(--ap-muted); }
.ap-gi-row b { color: var(--ap-ink); font-weight: 700; }
.ap-gi-note { font-size: 11.5px; line-height: 1.55; color: var(--ap-muted); margin: 4px 0 0; }
.ap-gi-note b { color: var(--ap-text); font-weight: 700; }

/* ---- 우측 메인 ---- */
.ap-main { overflow-y: auto; padding: 22px 26px 36px; position: relative; }
.ap-main-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.ap-main-title { font-size: 19px; font-weight: 800; color: var(--ap-ink); letter-spacing: -.02em; margin: 0; }
.ap-main-sub { font-size: 12.5px; color: var(--ap-muted); margin: 5px 0 0; line-height: 1.5; max-width: 560px; }
.ap-main-sub b { color: var(--ap-text); font-weight: 700; }
.ap-rec-summary { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; background: var(--ap-accent-soft); border: 1px solid #d7d4f7; border-radius: 10px; padding: 9px 14px; }
.ap-rec-key { font-size: 13px; font-weight: 800; color: var(--ap-accent-2); letter-spacing: -.01em; }
.ap-rec-reason { font-size: 11.5px; color: var(--ap-accent); font-weight: 600; }

/* 빈 상태 */
.ap-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 60vh; color: var(--ap-muted); text-align: center; }
.ap-empty.droppable { cursor: pointer; border: 2px dashed var(--ap-line); border-radius: 16px; background: #fafaff; margin: 18px; transition: border-color .15s, background .15s; }
.ap-empty.droppable:hover, .ap-empty.droppable.over { border-color: var(--accent, #4E4CDB); background: #eef0fd; }
.ap-empty-ic { width: 66px; height: 66px; border-radius: 18px; background: #fff; border: 1px solid var(--ap-line); color: var(--ap-faint); display: grid; place-items: center; margin-bottom: 8px; }
.ap-empty-t { font-size: 15px; font-weight: 700; color: var(--ap-ink); margin: 0; }
.ap-empty-s { font-size: 12.5px; margin: 0 0 6px; }

/* A/B 변형 그리드 */
.ap-variants { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; position: relative; }
.ap-busy-overlay { position: absolute; inset: 0; z-index: 30; background: rgba(255,255,255,.6); backdrop-filter: blur(1px); display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ap-text); border-radius: 14px; }

.ap-card { background: #fff; border: 1px solid var(--ap-line); border-radius: 14px; padding: 14px; transition: border-color .14s, box-shadow .14s; }
.ap-card.active { border-color: var(--ap-accent); box-shadow: 0 0 0 3px rgba(78,76,219,.12); }
.ap-card.rec { }
.ap-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ap-key-btn { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; cursor: pointer; padding: 0; font-family: inherit; flex: 1; min-width: 0; text-align: left; }
.ap-key { width: 30px; height: 30px; border-radius: 8px; background: var(--ap-ink); color: #fff; font-size: 15px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.ap-card.active .ap-key { background: var(--ap-accent); }
.ap-card-titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ap-card-name { font-size: 14px; font-weight: 700; color: var(--ap-ink); letter-spacing: -.01em; }
.ap-card-desc { font-size: 11.5px; color: var(--ap-muted); }
.ap-rec-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 800; color: #fff; background: var(--ap-accent); padding: 4px 10px; border-radius: 999px; flex-shrink: 0; }

/* 캔버스 스테이지 */
.ap-stage-wrap { position: relative; margin: 0 auto !important; border-radius: 4px; overflow: hidden; border: 1.5px solid #cccccc !important; }
.ap-stage { position: relative; transform-origin: top left; }
.ap-canvas-bg { position: absolute; inset: 0; background: #fff; }
.ap-safe { position: absolute; border: 1.5px dashed rgba(78,76,219,.5); border-radius: 2px; pointer-events: none; }
.ap-safe-tag { position: absolute; top: 4px; left: 6px; font-size: 11px; font-weight: 700; color: var(--ap-accent); background: rgba(255,255,255,.8); padding: 1px 6px; border-radius: 4px; letter-spacing: .02em; }
.ap-shadow { position: absolute; background: radial-gradient(ellipse at center, rgba(0,0,0,.16), rgba(0,0,0,0) 70%); pointer-events: none; }
.ap-item { position: absolute; }
.ap-item img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; -webkit-user-drag: none; }
.ap-item.edit { cursor: grab; }
.ap-item.edit:active { cursor: grabbing; }
.ap-item.sel { outline: 1.5px solid var(--ap-accent); outline-offset: 0; }
.ap-handle { position: absolute; width: 8px; height: 8px; background: #fff; border: 1.5px solid var(--ap-accent); border-radius: 1px; padding: 0; pointer-events: auto; z-index: 6; }
.ap-handle.nw { top: -4px; left: -4px; cursor: nwse-resize; }
.ap-handle.ne { top: -4px; right: -4px; cursor: nesw-resize; }
.ap-handle.sw { bottom: -4px; left: -4px; cursor: nesw-resize; }
.ap-handle.se { bottom: -4px; right: -4px; cursor: nwse-resize; }
.ap-ctx { position: absolute; z-index: 50; min-width: 152px; background: #fff; border: 1px solid var(--ap-line); border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.16); padding: 5px; }
.ap-ctx-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent; font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--ap-text); padding: 8px 10px; border-radius: 6px; cursor: pointer; text-align: left; }
.ap-ctx-item:hover { background: var(--ap-accent-soft); color: var(--ap-accent-2); }
.ap-ctx-item svg { color: var(--ap-muted); flex-shrink: 0; }
.ap-ctx-item:hover svg { color: var(--ap-accent); }

/* 인식 등급 라인 */
.ap-recline { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 13px; font-weight: 700; letter-spacing: -.01em; }
.ap-dot { width: 8px; height: 8px; border-radius: 999px; }
.ap-recline-sub { font-size: 11px; font-weight: 500; color: var(--ap-faint); margin-left: auto; }

/* 메트릭 */
.ap-metrics { margin-top: 10px; border-top: 1px solid var(--ap-line-2); padding-top: 4px; }
.ap-mrow { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--ap-line-2); font-size: 12.5px; }
.ap-mrow:last-child { border-bottom: 0; }
.ap-mk { color: var(--ap-muted); }
.ap-mv { font-weight: 700; color: var(--ap-ink); font-variant-numeric: tabular-nums; }
.ap-mv.t-good { color: var(--ap-green); }
.ap-mv.t-ok { color: #3A7BD5; }
.ap-mv.t-warn { color: #D98324; }
.ap-mv.t-bad { color: #D64545; }

.ap-card-actions { display: flex; gap: 8px; margin-top: 12px; position: relative; z-index: 20; }
.ap-btn { border: 1px solid var(--ap-line); background: #fff; color: var(--ap-text); font-family: inherit; font-size: 12.5px; font-weight: 700; padding: 9px 12px; border-radius: 7px; cursor: pointer; transition: background .12s, border-color .12s, opacity .12s; }
.ap-btn:hover { background: var(--ap-bg); }
.ap-btn:disabled { opacity: .4; cursor: default; }
.ap-btn.ghost.block { width: 100%; }
.ap-card-actions .ap-btn.icon { flex: 0 0 auto; width: 40px; padding: 9px 0; display: flex; align-items: center; justify-content: center; }
.ap-card-actions .ap-btn.icon:disabled { opacity: .35; cursor: default; }
.ap-card-actions .ap-btn.ghost { flex: 1; }
.ap-card-actions .ap-btn.primary { flex: 1.4; }
.ap-btn.primary { background: var(--ap-accent); border-color: var(--ap-accent); color: #fff; }
.ap-btn.primary:hover { background: var(--ap-accent-2); border-color: var(--ap-accent-2); }

.ap-hint { font-size: 12px; color: var(--ap-muted); margin: 18px 0 0; line-height: 1.55; text-align: center; }

/* 스피너 / 토스트 */
.ap-spin { display: inline-block; border: 2.5px solid rgba(78,76,219,.22); border-top-color: var(--ap-accent); border-radius: 999px; animation: apspin .7s linear infinite; }
@keyframes apspin { to { transform: rotate(360deg); } }
.ap-toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; background: var(--ap-ink); color: #fff; font-size: 13px; font-weight: 600; padding: 11px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.22); z-index: 100; }

@media (max-width: 1240px) {
  .ap-results { grid-template-columns: 1fr; }
}

/* 좁은 데스크톱 패널에서도 1E/앱푸시 전체 캔버스와 편집 핸들이 잘리지 않게 한다. */
@media (max-width: 1220px) {
  .ap550 .ap-body { grid-template-columns: 300px minmax(0, 1fr) 300px !important; }
  .ap550 .ap-main { padding-left: 16px; padding-right: 16px; }
  .ap550 .ap-preview-area { zoom: .9; }
}

@media (max-width: 1100px) {
  .ap550 .ap-body { grid-template-columns: 280px minmax(0, 1fr) 280px !important; }
  .ap550 .ap-main { padding-left: 12px; padding-right: 12px; }
  .ap550 .ap-preview-area { zoom: .74; }
  .ap550 .ap-results { zoom: .9; }
}

/* ---- 파이프라인 바 ---- */
.ap-pipe { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--ap-line); border-radius: 12px; padding: 10px 14px; margin-bottom: 20px; flex-wrap: wrap; }
.ap-pipe-node { display: flex; align-items: center; gap: 9px; padding: 4px 6px; }
.ap-pipe-num { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0; }
.ap-pipe-node.t-ai .ap-pipe-num { background: var(--ap-ai); }
.ap-pipe-node.t-rule .ap-pipe-num { background: var(--ap-rule); }
.ap-pipe-node.t-score .ap-pipe-num { background: var(--ap-score); }
.ap-pipe-txt { display: flex; flex-direction: column; line-height: 1.25; }
.ap-pipe-txt b { font-size: 12.5px; font-weight: 700; color: var(--ap-ink); letter-spacing: -.01em; }
.ap-pipe-txt span { font-size: 10.5px; color: var(--ap-muted); }
.ap-pipe-node.t-score .ap-pipe-txt span { color: var(--ap-score); font-weight: 700; }
.ap-pipe-arrow { color: var(--ap-faint); flex-shrink: 0; }

/* ---- 결과 2분할 ---- */
/* 2순위 제거 후 단일 렌더러 → 중앙 배치(카드는 미리보기 콘텐츠 폭). */
.ap-results { display: flex; justify-content: center; align-items: start; position: relative; margin-bottom: 22px; }

/* ---- 랭크 배지 ---- */
.ap-rank { font-size: 11.5px; font-weight: 800; padding: 4px 9px; border-radius: 7px; flex-shrink: 0; letter-spacing: -.01em; }
.ap-rank.r1 { background: var(--ap-accent); color: #fff; }
.ap-rank.r2 { background: var(--ap-accent-soft); color: var(--ap-accent-2); }
.ap-rank:not(.r1):not(.r2) { background: var(--ap-bg); color: var(--ap-muted); }
.ap-mrow.strong .ap-mv { font-size: 13.5px; }

/* ---- 스코어러 패널 ---- */
.ap-step.score { background: var(--ap-score); }
.ap-scorer { background: linear-gradient(180deg, #f6f4ff, #fbfbfe); border: 1px solid #e4ddff; border-radius: 12px; padding: 14px; }
.ap-scorer-note { font-size: 11.5px; line-height: 1.55; color: var(--ap-text); margin: 0 0 4px; }
.ap-scorer-note b { color: var(--ap-score); font-weight: 800; }
.ap-scorer-note span { color: var(--ap-muted); }
.ap-slider { display: flex; flex-direction: column; gap: 6px; }
.ap-slider-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ap-text); }
.ap-slider-top b { color: var(--ap-ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.ap-slider input[type=range] { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; outline: none; cursor: pointer; }
.ap-slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 17px; height: 17px; border-radius: 999px; background: #fff; border: 3px solid var(--ap-score); cursor: grab; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.ap-slider input[type=range]::-moz-range-thumb { width: 17px; height: 17px; border-radius: 999px; background: #fff; border: 3px solid var(--ap-score); cursor: grab; }
.ap-slider-hint { font-size: 10.5px; color: var(--ap-muted); }

/* ---- 후보 랭킹 스트립 ---- */
.ap-rankstrip { background: #fff; border: 1px solid var(--ap-line); border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; }
.ap-rankstrip-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.ap-rankstrip-head b { font-size: 13.5px; font-weight: 800; color: var(--ap-ink); }
.ap-rankstrip-head span { font-size: 11.5px; color: var(--ap-muted); }
.ap-rankstrip-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.ap-mini { position: relative; flex-shrink: 0; width: 112px; border: 1px solid var(--ap-line); border-radius: 10px; background: #fff; padding: 5px; transition: border-color .12s, box-shadow .12s, transform .08s; }
.ap-mini:hover { border-color: #c9c9d2; transform: translateY(-1px); }
.ap-mini.top2 { border-color: #d7d4f7; }
.ap-mini.active { border-color: var(--ap-accent); box-shadow: 0 0 0 2px rgba(78,76,219,.16); }
.ap-mini-btn { display: block; width: 100%; border: 0; background: transparent; padding: 0; cursor: pointer; font-family: inherit; }
.ap-mini-hide { position: absolute; top: -7px; right: -7px; z-index: 3; width: 19px; height: 19px; border-radius: 999px; border: 0; background: #1c1c22; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity .12s; }
.ap-mini:hover .ap-mini-hide { opacity: 1; }
.ap-mini-hide:hover { background: #D64545; }
.ap-mini-hide svg { width: 13px; height: 13px; }
.ap-mini-canvas { width: 100px; height: 100px; border-radius: 4px; overflow: hidden; background: #fff; margin-bottom: 5px; }
.ap-mini-meta { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; margin-bottom: 5px; }
.ap-mini-rank { width: 18px; height: 18px; border-radius: 5px; background: var(--ap-bg); color: var(--ap-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.ap-mini.top2 .ap-mini-rank { background: var(--ap-accent); color: #fff; }
.ap-mini-score { font-size: 11.5px; font-weight: 700; color: var(--ap-muted); font-variant-numeric: tabular-nums; }
.ap-mini-bar { height: 4px; border-radius: 999px; background: #eee; overflow: hidden; }
.ap-mini-bar i { display: block; height: 100%; background: var(--ap-score); border-radius: 999px; }
.ap-safe.faint { display: none; }
.ap-mini-canvas .ap-shadow { display: none; }

/* ---- 배치 우선순위 A/B 토글 ---- */
.ap-modeseg-wrap { margin: 4px 0 14px; }
.ap-modeseg-label { font-size: 11.5px; font-weight: 700; color: var(--ap-muted); margin-bottom: 7px; letter-spacing: -.01em; }
.ap-modeseg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--ap-bg); padding: 4px; border-radius: 11px; }
.ap-modeseg-btn { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 8px 9px; cursor: pointer; font-family: inherit; transition: background .12s, border-color .12s, box-shadow .12s; }
.ap-modeseg-btn b { font-size: 12.5px; font-weight: 800; color: var(--ap-text); letter-spacing: -.01em; }
.ap-modeseg-btn span { font-size: 10.5px; color: var(--ap-muted); line-height: 1.25; }
.ap-modeseg-btn:hover { background: #fff; }
.ap-modeseg-btn.on { background: #fff; border-color: var(--ap-accent); box-shadow: 0 0 0 2px rgba(78,76,219,.14); }
.ap-modeseg-btn.on b { color: var(--ap-accent); }
.ap-modeseg-desc { font-size: 11px; color: var(--ap-muted); line-height: 1.45; margin: 9px 2px 0; }

/* 메인 헤더 모드 칩 */
.ap-mode-chip { display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: -.01em; vertical-align: middle; }
.ap-mode-chip.m-A { background: var(--ap-accent-soft); color: var(--ap-accent); }
.ap-mode-chip.m-B { background: #e8f6ef; color: var(--ap-green); }

/* ── 배치 패턴 버튼 (step 3) ── */
.ap-pattern-btns { display: flex; flex-direction: column; gap: 7px; }
.ap-pattern-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 40px; padding: 9px 13px;
  border: 1px solid #e7e7ee; border-radius: 10px;
  background: #fff; color: #1c1c22;
  font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; text-align: left;
  transition: border-color .12s, background .12s, color .12s;
}
.ap-pattern-btn:hover { border-color: #c0bfef; background: #f7f7fd; }
.ap-pattern-btn.on {
  border: 1.5px solid #4E4CDB; background: #eef2ff; color: #4E4CDB;
}
.ap-pattern-btn:disabled { opacity: .45; cursor: not-allowed; }
.ap-pattern-btn svg { flex-shrink: 0; }
.ap-pattern-hint { font-size: 11.5px; color: var(--ap-muted); margin-top: 2px; line-height: 1.4; }
