/* /var/www/html/assets/css/pixel-art.css
   픽셀아트(도트) 에디터 전용 스타일. style.css 뒤에 로드된다. */

.px-tool {
  margin-top: 8px;
}

/* 공용 버튼 (도구별 CSS는 self-contained) */
.btn.is-active { background: var(--text); color: #111; border-color: var(--text); }
/* 에디터 창: 대형 작업 화면 (고정). 도구 패널은 내부에서 이동, 전체화면 지원 */
.px-editor {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  height: min(90vh, 1040px);
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* 페이지 내 전체화면 */
.px-editor.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  height: 100vh;
  margin: 0;
  border-radius: 0;
}
/* 브라우저 네이티브 전체화면(F11식) */
.px-editor:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

/* 상단 바 */
.px-editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}
.px-editor-title { font-weight: 800; font-size: 0.95rem; white-space: nowrap; }
.px-editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* 상단 저장 배수 컨트롤 */
.px-export-inline { display: inline-flex; align-items: center; gap: 6px; }
.px-export-inline label { font-size: 0.82rem; color: var(--muted); }
.px-export-inline select {
  height: 40px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #111; color: var(--text);
}

/* 문서(이미지) 탭 스트립 */
.px-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  overflow-x: auto;
}
.px-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.px-tab:hover { background: rgba(255, 255, 255, 0.1); }
.px-tab.is-active { background: var(--text); color: #111; border-color: var(--text); }
.px-tab-name { overflow: hidden; text-overflow: ellipsis; }
.px-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.7;
}
.px-tab-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.2); }
.px-tab-add { padding: 6px 10px; font-size: 1rem; }

/* 본문: 캔버스가 가득 채우고, 좌측 도크 + 플로팅 카드가 그 위에 뜬다 */
.px-editor-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

/* 좌측 도크: 카드 켜고 끄기 */
.px-dock {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 18, 18, 0.92);
  box-shadow: var(--shadow);
}
.px-dock-btn {
  width: 40px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.px-dock-btn:hover { background: rgba(255, 255, 255, 0.12); }
.px-dock-btn.is-active { background: var(--text); color: #111; border-color: var(--text); }

/* 플로팅 카드 (드래그 + 크기조절: 내부 UI까지 균일 스케일) */
.px-card {
  position: absolute;
  z-index: 30;
  display: none;
  flex-direction: column;
  width: 210px;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 18, 18, 0.95);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: scale(var(--k, 1));
  transform-origin: top left;
}
.px-card.is-open { display: flex; }
.px-card-head {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid var(--line);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: move;
  user-select: none;
  touch-action: none;
}
.px-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.px-card-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 50%, var(--muted) 50%, var(--muted) 62%, transparent 62%, transparent 74%, var(--muted) 74%, var(--muted) 86%, transparent 86%);
  touch-action: none;
}
/* 카드 내부 소제목 */
.px-sub {
  margin: 2px 0 0;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* 세그먼트 버튼(브러시/대칭/변형) */
.px-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.px-seg-btn {
  flex: 1 1 auto;
  min-width: 34px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.px-seg-btn:hover { background: rgba(255, 255, 255, 0.12); }
.px-seg-btn.is-active { background: var(--text); color: #111; border-color: var(--text); }

/* 편집 카드 버튼 그룹 */
.px-editbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.px-editbtns .px-iconbtn { flex: 1 1 auto; }

/* 도구 버튼 그리드 */
.px-tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.px-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.px-tool-btn:hover { background: rgba(255, 255, 255, 0.12); }
.px-tool-btn.is-active {
  background: var(--text);
  color: #111;
  border-color: var(--text);
}
.px-tool-btn .ico { display: inline-flex; line-height: 1; }
/* 흑백 톤 아이콘: 버튼 글자색(currentColor)을 그대로 따른다 */
.ico svg { width: 18px; height: 18px; display: block; }
.px-iconbtn .ico svg { width: 17px; height: 17px; }
.px-iconbtn .ico { display: inline-flex; vertical-align: -3px; }

/* 색상 */
.px-color-row { display: flex; align-items: center; gap: 10px; }
.px-color-row input[type="color"] {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: none;
  cursor: pointer;
}
.px-color-row label { font-size: 0.86rem; color: var(--muted); }

/* 팔레트 5열(=5×2 두 줄), 최근 색 5열(=5×1 한 줄) */
.px-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.px-swatch {
  width: 100%;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.px-swatch:hover { transform: scale(1.12); }
.px-recent:empty::after {
  content: '아직 없음';
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: var(--muted);
}

/* 캔버스 영역: 본문 전체를 채운다 */
.px-canvas-side {
  position: absolute;
  inset: 0;
  display: flex;
  padding: 12px;
  min-width: 0;
}

/* 캔버스 위에 떠 있는 오버레이 툴바 */
.px-canvas-toolbar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: calc(100% - 20px);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 18, 18, 0.9);
  box-shadow: var(--shadow);
}
.px-coord {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 56px;
  text-align: center;
  padding: 0 6px;
}
.px-iconbtn {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.px-iconbtn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.px-iconbtn:disabled { opacity: 0.4; cursor: not-allowed; }
.px-iconbtn.is-active { background: var(--text); color: #111; border-color: var(--text); }

/* 캔버스 스테이지: 투명 체크무늬 배경 + 그림 + 격자 */
.px-stage-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: safe center;
  align-items: safe center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
  overflow: auto;
}

/* 이미지 드롭 힌트 오버레이 */
.px-drop-hint {
  position: absolute;
  inset: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--text);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
  pointer-events: none;
  z-index: 5;
}
.px-stage-wrap.is-dragover .px-drop-hint { display: flex; }
.px-stage-wrap.is-panning { cursor: grabbing; }
.px-stage-wrap.is-panning canvas { cursor: grabbing; }
.px-stage {
  --px-checker-color: #d8d8d8; /* 체크무늬 진하기: JS 슬라이더가 조절 */
  position: relative;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, var(--px-checker-color) 25%, transparent 25%),
    linear-gradient(-45deg, var(--px-checker-color) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--px-checker-color) 75%),
    linear-gradient(-45deg, transparent 75%, var(--px-checker-color) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  touch-action: none;
}
.px-stage canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  image-rendering: pixelated;
}
#px-board { cursor: crosshair; }
#px-grid { pointer-events: none; }

.px-export-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.px-export-row label { font-size: 0.86rem; color: var(--muted); }
.px-export-row select,
.px-size-select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111;
  color: var(--text);
}
.px-custom-wrap { display: flex; gap: 6px; align-items: center; }
.px-custom-wrap input {
  width: 74px;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111;
  color: var(--text);
}
.px-custom-wrap[hidden] { display: none; }

/* 배경 격자 진하기 슬라이더 */
.px-range-row { display: flex; align-items: center; gap: 10px; }
.px-range-row input[type="range"] {
  flex: 1 1 auto;
  height: 4px;
  accent-color: var(--text);
  cursor: pointer;
}
.px-range-row .px-range-val {
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--muted);
}

/* 레이어 목록 */
#px-layers-body { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.px-layers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.px-layer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.px-layer.is-active { border-color: var(--text); background: rgba(255, 255, 255, 0.12); }
.px-layer-eye,
.px-layer-del {
  border: none;
  background: none;
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 2px;
}
.px-layer-del { color: var(--muted); }
.px-layer-del:hover { color: var(--text); }
.px-layer-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

/* 상태 메시지: 캔버스 하단 오버레이 */
.px-note {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 15;
  margin: 0;
  max-width: calc(100% - 20px);
  padding: 4px 12px;
  border-radius: var(--radius);
  background: rgba(18, 18, 18, 0.85);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  pointer-events: none;
}
.px-note:empty { display: none; }

/* 가이드 섹션 */
.px-guide { margin-top: 34px; }
.px-guide h2 { font-size: 1.3rem; margin: 0 0 12px; }
.px-guide h3 { font-size: 1.02rem; margin: 18px 0 6px; }
.px-guide p, .px-guide li { color: rgba(245, 245, 242, 0.72); line-height: 1.6; }
.px-guide ol, .px-guide ul { padding-left: 20px; margin: 0; }
.px-guide li { margin: 4px 0; }

/* 모바일 */
@media (max-width: 720px) {
  .px-editor { height: min(86vh, 760px); min-height: 520px; }
  .px-editor.is-fullscreen { height: 100vh; }
  .px-card { width: 190px; }
  .px-tools { grid-template-columns: repeat(2, 1fr); }
  .px-canvas-side { padding: 8px; }
}
