/* =============================================================
   IconKit — 전용 스타일 (파스텔 라이트 테마)
   ============================================================= */
:root {
  --bg: #f7f4fc;
  --bg-2: #fdfbff;
  --surface: #ffffff;
  --surface-2: #f8f4fd;
  --border: #ece4f6;
  --border-strong: #ddcef0;
  --text: #443c54;
  --text-2: #6a6280;
  --muted: #9b93ab;
  --faint: #c5bdd6;
  --live: #a78bfa;
  --radius: 16px;
}
body {
  background: var(--bg);
  color: var(--text);
  background-image:
    radial-gradient(900px 520px at 85% -10%, rgba(167, 139, 250, 0.12), transparent 60%),
    radial-gradient(720px 520px at -10% 8%, rgba(244, 168, 212, 0.12), transparent 60%);
}
::selection { background: rgba(167, 139, 250, 0.28); color: #2b2440; }
/* hidden 속성이 display:flex 클래스에 가려지지 않도록 */
[hidden] { display: none !important; }

.ik-main {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 20px calc(80px + env(safe-area-inset-bottom, 0px));
}
.ik-hero { padding: 22px 0 6px; }
.ik-hero__title {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 10px;
}
.ik-hero__lead { color: var(--text-2); max-width: 56ch; margin: 0; }

.ik-card {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
}

/* 업로드 스테이지 */
.ik-stage {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 28px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ik-stage:hover, .ik-stage.drag { border-color: var(--live); background: rgba(167, 139, 250, 0.06); }
.ik-stage.has-img { padding: 18px; }
.ik-stage__icon { font-size: 1.8rem; }
.ik-stage__t { font-weight: 600; margin: 8px 0 4px; }
.ik-stage__d { color: var(--muted); font-size: 0.85rem; }
.ik-preview-wrap { display: none; justify-content: center; gap: 16px; align-items: center; }
.ik-stage.has-img .ik-preview-wrap { display: flex; }
.ik-stage.has-img .ik-stage__prompt { display: none; }
.ik-preview {
  width: 96px; height: 96px;
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(110, 90, 160, 0.18);
  /* 투명 영역을 보여주는 체커보드 (배경 채우기 토글 효과가 눈에 보이게) */
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e6e0f0 25%, transparent 25%),
    linear-gradient(-45deg, #e6e0f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e6e0f0 75%),
    linear-gradient(-45deg, transparent 75%, #e6e0f0 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}
.ik-meta { color: var(--muted); font-size: 0.82rem; margin-top: 12px; text-align: center; }

/* 편집기 (확대·이동) */
.ik-editor { margin-top: 4px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ik-edit {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(110, 90, 160, 0.18);
  touch-action: none;            /* 팬/핀치는 직접 처리 */
  cursor: grab;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e6e0f0 25%, transparent 25%),
    linear-gradient(-45deg, #e6e0f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e6e0f0 75%),
    linear-gradient(-45deg, transparent 75%, #e6e0f0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.ik-edit:active { cursor: grabbing; }
.ik-editor.drag { outline: 2px dashed var(--live); outline-offset: 6px; border-radius: 14px; }
.ik-edit__hint { color: var(--muted); font-size: 0.78rem; text-align: center; margin: 0; }
.ik-edit__ctrl { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 320px; }
.ik-zoom { flex: 1; accent-color: var(--live); min-width: 0; }
.ik-minibtn {
  flex: none;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.ik-minibtn:hover { color: var(--text); border-color: var(--live); }

/* 옵션 */
.ik-opts { margin-top: 16px; display: flex; flex-direction: column; gap: 11px; }
.ik-opts__title { font-weight: 700; font-size: 0.95rem; margin: 0 0 2px; }
.ik-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.ik-chk { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.92rem; flex-wrap: wrap; }
.ik-chk input { width: 18px; height: 18px; accent-color: var(--live); }
.ik-sub { color: var(--muted); font-size: 0.75rem; }
.ik-sub--warn { color: #c0823a; }
.ik-bgrow { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.ik-color {
  width: 38px; height: 30px; padding: 0; border: 1px solid var(--border-strong);
  border-radius: 8px; background: none; cursor: pointer;
}
.ik-color:disabled { opacity: 0.4; }

.ik-go {
  margin-top: 18px; width: 100%;
  background: var(--live); border: none; color: #fff;
  border-radius: var(--radius); padding: 14px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
}
.ik-go:hover:not(:disabled) { filter: brightness(1.05); }
.ik-go:disabled { opacity: 0.45; cursor: default; }

.ik-note { color: var(--muted); font-size: 0.8rem; margin-top: 14px; line-height: 1.6; }
.ik-note code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 0.92em; }

.ik-appfoot {
  text-align: center;
  padding: 28px 20px calc(36px + env(safe-area-inset-bottom, 0px));
  color: var(--faint);
}
.ik-appfoot .mono { letter-spacing: 0.08em; }

@media (max-width: 560px) {
  .ik-main { padding: calc(8px + env(safe-area-inset-top, 0px)) 12px calc(56px + env(safe-area-inset-bottom, 0px)); }
  .ik-card { padding: 15px; }
}
