/* ══════════════════════════════════════════════════════════════════════════
   editor.css — 편집기 화면 전용 스타일
   색상 토큰은 design-system.css 참조
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 에디터 전체 레이아웃 ─────────────────────────────────────────────────── */
#screen-editor { display: none; flex-direction: column; height: 100vh; overflow: hidden; }
#screen-editor.active { display: flex; }

/* ── 상단 바 ──────────────────────────────────────────────────────────────── */
.editor-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid rgba(64,72,93,0.4);
  flex-shrink: 0;
  z-index: 50;
}
.editor-topbar-logo {
  font-size: 15px;
  font-weight: 800;
  font-family: 'Manrope', sans-serif;
  letter-spacing: -0.3px;
  background: var(--ai-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.editor-topbar-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.editor-topbar-info { font-size: 11px; color: var(--text-muted); }

/* ── 에디터 상단 그룹 드롭다운 ────────────────────────────────────────────── */
.editor-group-wrap {
  position: relative;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  min-width: 0;
}
.editor-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  max-width: 280px;
  transition: background var(--transition);
}
.editor-group-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.editor-group-btn span[id="editor-group-label"] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-group-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: #1e2535;
  border: 1px solid #3a4460;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.7);
  z-index: 999;
  padding: 4px 0;
}
.editor-group-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  font-family: inherit;
  text-align: left;
}
.editor-group-dropdown-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.editor-group-dropdown-item.current { color: var(--primary); }
.editor-group-dropdown-item .material-symbols-outlined { font-size: 16px; }

/* ── 에디터 상단 타이틀 ────────────────────────────────────────────────────── */
.editor-title-wrap {
  display: flex;
  align-items: center;
  padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,0.08);
  margin-left: 4px;
  min-width: 0;
  max-width: 240px;
}
.editor-title-display {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: background 0.15s, color 0.15s;
}
.editor-title-display:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.editor-title-input {
  font-size: 13px;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  outline: none;
  width: 100%;
  font-family: inherit;
}

/* 상단 우측 버튼 그룹 */
.editor-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  padding: 0;
}
.topbar-icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.topbar-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(64,72,93,0.5);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  font-family: 'Manrope', sans-serif;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all var(--transition);
}
.topbar-dl-btn .material-symbols-outlined { font-size: 15px; }
.topbar-dl-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(186,158,255,0.4); color: var(--primary); }
.topbar-dl-jpg-wrap { position: relative; }
.jpg-dl-panel {
  display: none;
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 220px;
  background: #1e2535; border: 1px solid #3a4460;
  border-radius: var(--radius); padding: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.7);
  z-index: 999;
  flex-direction: column; gap: 10px;
  overflow: hidden;
}
.jpg-dl-panel.open { display: flex; }
.jpg-dl-row {
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
.jpg-dl-label {
  font-size: 10px; color: var(--text-muted); width: 42px; flex-shrink: 0;
}
.jpg-dl-row input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 0; height: 3px;
  background: rgba(255,255,255,0.2); border-radius: 2px; outline: none; cursor: pointer;
}
.jpg-dl-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 11px; height: 11px;
  border-radius: 50%; background: var(--primary); cursor: pointer;
}
.jpg-dl-row input[type="number"] {
  flex: 1; min-width: 0; padding: 3px 6px;
  background: rgba(255,255,255,0.06); border: 1px solid #3a4460;
  border-radius: var(--radius-sm); color: var(--text); font-size: 10px; outline: none;
}
.jpg-dl-row input[type="number"]:focus { border-color: var(--primary); }
.jpg-dl-row span {
  font-size: 10px; color: var(--text-muted); width: 30px; flex-shrink: 0; text-align: right;
}
.jpg-dl-confirm {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-top: 2px; padding: 5px;
  background: var(--primary); border: none; border-radius: var(--radius-sm);
  color: #fff; font-size: 11px; font-weight: 700; cursor: pointer;
}
.jpg-dl-confirm .material-symbols-outlined { font-size: 14px; }
.jpg-dl-confirm:hover { filter: brightness(1.15); }
.topbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

/* ── 에디터 바디 ──────────────────────────────────────────────────────────── */
.editor-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  position: relative;
}

/* ═══════════════════════════════════════════════════════════════════════════
   좌측 통합 패널
   ═══════════════════════════════════════════════════════════════════════════ */
.left-panel {
  width: 256px;
  flex-shrink: 0;
  min-height: 0;
  background: var(--bg2);
  border-right: 1px solid rgba(64,72,93,0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 상단 절반: 배너 목록 */
.left-panel-top {
  flex: 1 1 0;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(64,72,93,0.4);
  overflow: hidden;
}
.left-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid rgba(64,72,93,0.4);
  flex-shrink: 0;
  font-family: 'Manrope', sans-serif;
}
.banner-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 하단 절반: 탭 */
.left-panel-bottom {
  flex: 1 1 0;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.left-tab-bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(64,72,93,0.4);
  flex-shrink: 0;
  padding: 0 2px;
}
.left-tab {
  flex: 1;
  padding: 9px 4px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Manrope', sans-serif;
  margin-bottom: -1px;
}
.left-tab:hover { color: var(--text); }
.left-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.left-tab-action {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  margin-right: 4px;
}
.left-tab-action:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.left-tab-action .material-symbols-outlined { font-size: 16px; }
.left-tab-content {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.banner-thumb-card {
  cursor: pointer;
  width: 100%;
  opacity: 0.6;
  transition: opacity var(--transition);
}
.banner-thumb-card:hover  { opacity: 1; }
.banner-thumb-card.active { opacity: 1; }
.banner-thumb-card.generating { opacity: 0.4; cursor: default; }

/* 이미지 래퍼 */
.banner-thumb-img-wrap {
  display: inline-block;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--bg2);
  transition: border-color var(--transition), box-shadow var(--transition);
  margin-bottom: 6px;
}
.banner-thumb-card:hover .banner-thumb-img-wrap {
  border-color: rgba(64,72,93,0.7);
}
.banner-thumb-card.active .banner-thumb-img-wrap {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(186,158,255,0.25), 0 4px 16px rgba(186,158,255,0.12);
}
.banner-thumb-img {
  width: 100%;
  max-height: 140px;
  display: block;
  object-fit: contain;
}
.banner-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  gap: 5px;
}

/* 라벨 — 가운데, 선택 시 primary + bold */
.banner-thumb-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  padding: 0 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.banner-thumb-card.active .banner-thumb-label {
  color: var(--primary);
  font-weight: 700;
}
.spinner-sm {
  width: 13px;
  height: 13px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ds-spin 0.8s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   에셋 / PSD 공통 스크롤 영역
   ═══════════════════════════════════════════════════════════════════════════ */
.asset-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 7px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.asset-panel-scroll::-webkit-scrollbar { display: none; }
.asset-empty {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 6px;
  line-height: 1.7;
  opacity: 0.6;
}

/* ── 패널 리스트 아이템 (에셋 / PSD) ─────────────────────────────────────── */
.panel-list-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 10px;
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
}
.panel-list-item:hover {
  background: rgba(255,255,255,0.04);
  border-left-color: rgba(186,158,255,0.35);
}
.panel-list-item.active {
  background: rgba(186,158,255,0.1);
  border-left-color: var(--primary);
}
.panel-list-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--bg2);
  border: 1px solid rgba(64,72,93,0.35);
  overflow: hidden;
  flex-shrink: 0;
}
.panel-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.panel-list-thumb.psd-thumb img {
  background: repeating-conic-gradient(rgba(255,255,255,0.04) 0% 25%, rgba(0,0,0,0.2) 0% 50%) 0 0 / 8px 8px;
}
.panel-list-info {
  flex: 1;
  min-width: 0;
}
.panel-list-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-list-type {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}
.panel-list-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}
.panel-list-item:hover .panel-list-actions { opacity: 1; }
.panel-list-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.panel-list-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.panel-list-action-btn .material-symbols-outlined { font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════════════════
   중앙: 캔버스
   ═══════════════════════════════════════════════════════════════════════════ */
.editor-center {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.editor-center .canvas-area { flex: 1; min-height: 0; overflow: hidden; }

.canvas-area {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #141f38 0%, #060e20 100%);
  overflow: hidden;
  position: relative;
}
.canvas-wrap {
  position: relative; margin: auto;
  background-color: #606060;
  background-image:
    linear-gradient(45deg, #4a4a4a 25%, transparent 25%),
    linear-gradient(-45deg, #4a4a4a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #4a4a4a 75%),
    linear-gradient(-45deg, transparent 75%, #4a4a4a 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}
.canvas-wrap canvas { display: block; background: transparent; }

/* 캔버스 드롭 존 */
.canvas-area.drag-over { outline: 2px dashed var(--primary); outline-offset: -4px; }

/* ── 줌 / Undo 컨트롤 ────────────────────────────────────────────────────── */
.canvas-controls {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 2px;
}
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 1px;
  background: rgba(9,19,40,0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(64,72,93,0.5);
  border-radius: var(--radius-md);
  padding: 3px 4px;
  box-shadow: var(--shadow);
}
.snap-btn {
  display: flex;
  align-items: center;
  padding: 4px 9px;
  margin-left: 4px;
  background: rgba(9,19,40,0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(64,72,93,0.5);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.snap-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.snap-btn.active {
  background: rgba(186,158,255,0.18);
  border-color: var(--primary);
  color: var(--primary);
}
.zoom-btn {
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  font-family: inherit;
  padding: 0;
}
.zoom-btn:hover { background: rgba(255,255,255,0.1); }
.zoom-btn:disabled { opacity: 0.3; cursor: default; }
.zoom-label {
  min-width: 42px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  padding: 0 3px;
  border-radius: var(--radius-xs);
  transition: background var(--transition);
}
.zoom-label:hover { background: rgba(255,255,255,0.1); }
.zoom-sep { width: 1px; height: 14px; background: var(--border); margin: 0 3px; }

/* ── 생성 중 오버레이 ─────────────────────────────────────────────────────── */
.generating-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(6,14,32,0.88);
  backdrop-filter: blur(4px);
  z-index: 10;
  gap: 14px;
}
.generating-overlay .spinner { width: 36px; height: 36px; border-width: 3px; }
.generating-msg { font-size: 13px; color: var(--text); }
.generating-sub  { font-size: 11px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   우측: 툴 패널
   ═══════════════════════════════════════════════════════════════════════════ */
.tool-panel {
  width: 320px;
  flex-shrink: 0;
  min-height: 0;
  background: var(--bg2);
  border-left: 1px solid rgba(64,72,93,0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tool-panel-header {
  padding: 10px 12px 8px;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid rgba(64,72,93,0.4);
  flex-shrink: 0;
  font-family: 'Manrope', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
}
.history-open-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 800;
  font-family: 'Manrope', sans-serif;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.history-open-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.history-open-btn .material-symbols-outlined { font-size: 13px; }

/* ── 히스토리 플로팅 패널 ──────────────────────────────────────────────────── */
.history-panel {
  position: absolute;
  top: 52px;
  right: 0;
  width: 280px;
  max-height: calc(100vh - 52px - 20px);
  background: var(--bg2);
  border: 1px solid rgba(64,72,93,0.6);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: -4px 8px 24px rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 800;
  font-family: 'Manrope', sans-serif;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(64,72,93,0.4);
  flex-shrink: 0;
}
.history-panel-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: var(--radius-sm);
}
.history-panel-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.history-panel-close .material-symbols-outlined { font-size: 16px; }
.history-panel-list {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.history-item:hover { background: rgba(255,255,255,0.05); }
.history-item-index {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  font-family: 'Manrope', sans-serif;
  min-width: 28px;
}
.history-item-time {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.history-panel-loading,
.history-panel-empty {
  padding: 24px 14px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.tool-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-panel-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.7;
  opacity: 0.7;
}

/* ── 도구 버튼 ────────────────────────────────────────────────────────────── */
.tool-btn-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.tool-btn-row .tool-btn {
  margin-bottom: 0;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px 8px;
  font-size: 9px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 700;
}
.tool-btn-row .tool-btn .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}
.tool-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  margin-bottom: 3px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(64,72,93,0.4);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  gap: 6px;
}
.tool-btn:hover { background: rgba(255,255,255,0.06); border-color: var(--border-2); color: var(--text); }
.tool-btn:active { transform: scale(0.97); }
.tool-btn.active {
  background: rgba(186,158,255,0.15);
  border-color: var(--primary);
  color: var(--primary);
}
.tool-btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.tool-btn-danger {
  justify-content: center;
  color: rgba(255,110,132,0.8) !important;
  border-color: rgba(255,110,132,0.2) !important;
}
.tool-btn-danger .material-symbols-outlined { font-size: 15px; }
.tool-btn-danger:hover {
  background: rgba(255,110,132,0.1) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.panel-section-title {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 14px 0 8px;
  font-family: 'Manrope', sans-serif;
  opacity: 0.8;
}

/* ── 텍스트 속성 ──────────────────────────────────────────────────────────── */
.prop-section {
  padding: 12px 0;
  border-bottom: 1px solid rgba(64,72,93,0.3);
}
.prop-title {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 8px;
  font-family: 'Manrope', sans-serif;
}
.prop-title-row { display: flex; align-items: center; justify-content: space-between; }

/* ── 토글 스위치 ──────────────────────────────────────────────────────────── */
.toggle-switch {
  position: relative;
  width: 28px;
  height: 16px;
  flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(64,72,93,0.5);
  border: 1px solid rgba(64,72,93,0.6);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(163,170,196,0.6);
  transition: transform var(--transition), background var(--transition);
}
.toggle-switch input:checked + .toggle-track {
  background: rgba(186,158,255,0.25);
  border-color: rgba(186,158,255,0.5);
}
.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(12px);
  background: var(--primary);
}
.prop-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.color-pair { display: flex; align-items: center; gap: 3px; }
.hex-text-input {
  width: 58px;
  font-size: 11px;
  font-family: 'Roboto Mono', monospace;
  padding: 4px 5px;
  background: rgba(25,37,64,0.5);
  border: 1px solid rgba(64,72,93,0.35);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-transform: uppercase;
}
.hex-text-input:focus { outline: none; border-color: rgba(186,158,255,0.5); }
.prop-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prop-cell { display: flex; flex-direction: column; gap: 4px; }
.prop-label { font-size: 9px; color: var(--text-muted); white-space: nowrap; line-height: 1.2; }
.prop-full { width: 100% !important; box-sizing: border-box; }
.prop-sel-hint { font-size: 10px; color: var(--primary); margin: 3px 0 0; letter-spacing: 0.2px; }

input[type="range"] { accent-color: var(--primary); height: 3px; cursor: pointer; }
input[type="color"] {
  width: 24px; height: 24px;
  padding: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
}

/* 텍스트 서식 */
.text-format-row {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.form-select {
  flex: 1;
  background: rgba(25,37,64,0.5);
  border: 1px solid rgba(64,72,93,0.35);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 11px;
  padding: 7px 10px;
  min-width: 0;
  font-family: inherit;
  outline: none;
  appearance: none;
  transition: border-color var(--transition);
}
.form-select:focus { border-color: rgba(186,158,255,0.5); }
.form-select option { background: #0d1b35; }
.form-input-sm {
  width: 50px;
  background: rgba(25,37,64,0.5);
  border: 1px solid rgba(64,72,93,0.35);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 11px;
  padding: 7px 8px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.form-input-sm:focus { border-color: rgba(186,158,255,0.5); }
.fmt-btn {
  padding: 4px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.fmt-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.fmt-btn.active {
  background: rgba(186,158,255,0.2);
  color: var(--primary);
}

/* 그룹 버튼 컨테이너 (I/U/S, 정렬) */
.fmt-group {
  display: flex;
  background: rgba(25,37,64,0.4);
  border: 1px solid rgba(64,72,93,0.3);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 1px;
}
.fmt-group .fmt-btn {
  flex: 1;
  height: 28px;
  padding: 0 4px;
  border-radius: 4px;
}
.fmt-group .fmt-btn .material-symbols-outlined { font-size: 15px; }

/* 숫자 input 화살표 제거 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* PX suffix input 래퍼 */
.input-px-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-px-wrap .form-input-sm { padding-right: 26px; text-align: center; }
.input-px-suffix {
  position: absolute;
  right: 13px;
  font-size: 8px;
  font-weight: 800;
  color: var(--text-muted);
  opacity: 0.55;
  pointer-events: none;
  font-family: 'Manrope', sans-serif;
  letter-spacing: 0.3px;
  line-height: 1;
}

/* 아이콘 내장 input 래퍼 (자간/행간) */
.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon-wrap .material-symbols-outlined {
  position: absolute;
  left: 7px;
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0.6;
  pointer-events: none;
}
.input-icon-wrap .form-input-sm {
  width: 100%;
  padding-left: 24px;
}

/* ── 레이어 카드 ──────────────────────────────────────────────────────────── */
.layer-list { display: flex; flex-direction: column; gap: 4px; }
.layer-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(64,72,93,0.4);
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: all var(--transition);
}
.layer-card:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(64,72,93,0.7);
}
.layer-card.active {
  border-color: rgba(186,158,255,0.5);
  background: rgba(186,158,255,0.1);
}
.layer-card-thumb {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(64,72,93,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  overflow: hidden;
}
.layer-card.active .layer-card-thumb {
  border-color: rgba(186,158,255,0.4);
  color: var(--primary);
}
.layer-card-info {
  flex: 1;
  min-width: 0;
}
.layer-name {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}
.layer-card.active .layer-name { color: var(--primary); }
.layer-rename-input {
  flex: 1; min-width: 0; max-width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--primary);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 11px;
  padding: 1px 4px;
  outline: none;
  font-family: inherit;
}
.layer-actions {
  opacity: 0;
  transition: opacity var(--transition);
}
.layer-card:hover .layer-actions { opacity: 1; }
.layer-icon-btn {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: none; border: none;
  border-radius: 4px;
  cursor: pointer;
  color: rgba(163,170,196,0.5);
  transition: all var(--transition);
}
.layer-icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.layer-icon-btn.eye-off    { color: rgba(163,170,196,0.2); }
.layer-icon-btn.eye-locked { color: #e0a052; }
.layer-btn-del {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: none;
  border: none;
  border-radius: 4px;
  color: rgba(255,110,132,0.5);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  transition: all var(--transition);
}
.layer-btn-del:hover { background: rgba(255,110,132,0.15); color: var(--danger); }
.layer-drag-handle {
  font-size: 11px;
  color: var(--text-muted);
  cursor: grab;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition);
}
.layer-card:hover .layer-drag-handle { opacity: 0.6; }
.layer-card.dragging  { opacity: 0.3; }
.layer-card.drag-over {
  border-color: var(--primary) !important;
  background: rgba(186,158,255,0.15) !important;
}

/* ── 변환 패널 ────────────────────────────────────────────────────────────── */
#transform-panel {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(64,72,93,0.4);
  border-radius: var(--radius-sm);
  padding: 7px;
  margin-bottom: 7px;
}
.transform-row { display: flex; gap: 6px; margin-bottom: 7px; }
.transform-row:last-child { margin-bottom: 0; }
.transform-field { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
.transform-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  width: 11px;
  flex-shrink: 0;
  text-transform: uppercase;
  font-family: 'Manrope', sans-serif;
}
.transform-input {
  flex: 1; min-width: 0;
  background: rgba(25,37,64,0.5);
  border: 1px solid rgba(64,72,93,0.35);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 11px;
  padding: 7px 6px;
  text-align: right;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.transform-input:focus { border-color: rgba(186,158,255,0.5); }

/* ── 그리드/자석 ──────────────────────────────────────────────────────────── */
.tool-check-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-muted);
  cursor: pointer; padding: 3px 2px; user-select: none;
  transition: color var(--transition);
}
.tool-check-label:hover { color: var(--text); }
.tool-check-label input[type="checkbox"] { cursor: pointer; accent-color: var(--primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   AI 보정 바
   ═══════════════════════════════════════════════════════════════════════════ */
.ai-correct-bar {
  flex-shrink: 0;
  border-top: 1px solid rgba(64,72,93,0.4);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  position: relative;
}
.ai-bar-close-btn {
  position: absolute;
  top: -34px;
  right: 12px;
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: rgba(9,19,40,0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(64,72,93,0.5);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  font-family: inherit; white-space: nowrap;
}
.ai-bar-close-btn:hover { background: rgba(186,158,255,0.15); border-color: var(--primary); color: var(--primary); }
.ai-bar-float-btn {
  position: absolute;
  bottom: 10px; right: 12px;
  z-index: 20;
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  background: rgba(9,19,40,0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(64,72,93,0.5);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  font-family: inherit;
}
.ai-bar-float-btn:hover { background: rgba(186,158,255,0.15); border-color: var(--primary); color: var(--primary); }
.btn-annot-pick {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 7px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(64,72,93,0.4);
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  font-family: inherit; text-align: left;
}
.btn-annot-pick:hover { background: rgba(255,255,255,0.06); border-color: var(--border-2); color: var(--text); }
.btn-annot-pick:active { transform: scale(0.98); }
.btn-annot-pick.active {
  background: rgba(186,158,255,0.12);
  border-color: var(--primary);
  color: var(--primary);
}
.ai-bar-content {
  display: flex; align-items: stretch; gap: 0;
  padding: 10px 12px; min-height: 0;
}
.ai-bar-left {
  flex: 0 0 55%; min-width: 0;
  display: flex; flex-direction: column; gap: 5px;
  padding-right: 10px;
}
.ai-bar-left-top { display: flex; flex-direction: column; gap: 4px; }
.ai-bar-annot-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 120px; overflow-y: auto;
}
.ai-bar-annot-item { display: flex; align-items: center; gap: 6px; font-size: 11px; padding: 2px 0; }
.ai-bar-annot-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%; font-size: 9px; font-weight: 700; color: #fff;
  flex-shrink: 0; line-height: 1;
}
.ai-bar-annot-text { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-bar-annot-input {
  flex: 1; min-width: 0;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(64,72,93,0.5);
  border-radius: var(--radius-xs);
  color: var(--text); font-size: 11px; padding: 2px 5px;
  outline: none; font-family: inherit;
}
.ai-bar-annot-input:focus { border-color: var(--primary); }
.ai-bar-sep { width: 1px; background: rgba(64,72,93,0.4); flex-shrink: 0; margin: 0 10px 0 0; }
.ai-bar-right { flex: 1; min-width: 0; display: flex; gap: 7px; align-items: stretch; }
.ai-bar-textarea {
  flex: 1;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(64,72,93,0.5);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 11px;
  padding: 7px 9px; resize: none;
  font-family: inherit; line-height: 1.5; min-height: 58px;
  outline: none;
}
.ai-bar-textarea:focus { border-color: rgba(186,158,255,0.4); }
.ai-bar-textarea::placeholder { color: var(--text-muted); opacity: 0.6; }

/* ── 편집 잠금 오버레이 ───────────────────────────────────────────────────── */
.editor-lock-overlay {
  position: absolute; inset: 0; z-index: 200;
  background: rgba(6,14,32,0.6);
  backdrop-filter: blur(2px);
  cursor: not-allowed;
}
.editor-lock-msg {
  position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(9,19,40,0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 16px;
  font-size: 12px; color: var(--text); white-space: nowrap;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

/* ── 에셋 뷰어 모달 ───────────────────────────────────────────────────────── */
.asset-viewer {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(6,14,32,0.85);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}
.asset-viewer-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  width: min(700px, 90vw);
  max-height: 88vh;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7), 0 0 40px rgba(186,158,255,0.08);
}
.asset-viewer-header {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(64,72,93,0.4);
  flex-shrink: 0;
}
.asset-viewer-title {
  font-size: 12px; font-weight: 600; color: var(--text);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.asset-viewer-counter { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.asset-viewer-close {
  width: 24px; height: 24px;
  background: transparent; border: 1px solid rgba(64,72,93,0.5);
  border-radius: var(--radius-xs); color: var(--text-muted); font-size: 13px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--transition);
}
.asset-viewer-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.asset-viewer-stage {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle, #141f38 0%, #060e20 100%);
  min-height: 280px;
}
.asset-viewer-img {
  max-width: 100%; max-height: 58vh;
  object-fit: contain; display: block;
  user-select: none; transition: opacity 0.15s;
}
.asset-viewer-img.fading { opacity: 0; }
.asset-viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 52px;
  background: rgba(9,19,40,0.8);
  border: 1px solid rgba(64,72,93,0.5);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 24px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 2; transition: all var(--transition);
}
.asset-viewer-nav:hover { background: rgba(186,158,255,0.2); border-color: var(--primary); }
.asset-viewer-nav:disabled { opacity: 0.2; cursor: default; }
.asset-viewer-prev { left: 10px; }
.asset-viewer-next { right: 10px; }
.asset-viewer-footer {
  display: flex; gap: 8px; justify-content: center;
  padding: 12px 14px;
  border-top: 1px solid rgba(64,72,93,0.4);
  flex-shrink: 0;
}
