/* 타투 도안 상담 — 화면 꾸밈
 *  - 바탕은 눈썹 시안(brow.moonsiljang.com)과 같은 중립 회색 — 도안 색을 바탕 색 기운 없이 보게.
 *  - 강조색은 «인주 빨강» — 도장·먹 그림의 낙관 색. 고른 것(♥·★)에만 쓴다.
 *  - 도안이 주인공 — 도안 칸은 흰 종이, 나머지는 조용하게.
 */
:root {
  --bg: #18191b;
  --surface: #202124;
  --raise: #2a2b2f;
  --line: #36373c;
  --ink: #f2f2f0;
  --muted: #9d9fa6;
  --accent: #ff6f61;
  --accent-ink: #2a0d0a;
  --accent-soft: rgba(255, 111, 97, .14);
  --paper: #fbfaf7;
  --r-s: 8px; --r-m: 12px; --r-l: 18px;
  font-family: -apple-system, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, .btn, input, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ac { color: var(--accent); }
.muted { color: var(--muted); }

/* ---------- 머리 줄 ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tag { font-size: 11px; font-weight: 600; color: var(--accent); border: 1px solid currentColor; padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.top-actions { display: flex; gap: 6px; flex: none; }

/* ---------- 버튼·칩 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: var(--r-m);
  border: 1px solid var(--line); background: var(--raise); color: var(--ink);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: default; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; white-space: nowrap; font-size: 14px;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.chip small { color: var(--muted); font-size: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }

/* ---------- 단계 ---------- */
.steps { display: flex; gap: 4px; padding: 8px 14px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.steps button {
  flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 10px; border-radius: var(--r-m); border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.steps b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: var(--raise); font-size: 12px; }
.steps button.on { color: var(--ink); background: var(--surface); }
.steps button.on b { background: var(--accent); color: var(--accent-ink); }
.steps button.done b { background: var(--line); color: var(--ink); }

/* ---------- 본문 ---------- */
main { overflow-y: auto; overscroll-behavior: contain; }
.panel { max-width: 1180px; margin: 0 auto; padding: 18px 16px 28px; }
.lead h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.01em; }
.lead p { margin: 0 0 16px; color: var(--muted); line-height: 1.55; font-size: 15px; }
.lead p b { color: var(--ink); }

/* 1. 스타일 카드 */
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.style-card {
  position: relative; display: flex; flex-direction: column; border-radius: var(--r-l); overflow: hidden;
  background: var(--surface); border: 2px solid transparent; transition: border-color .15s, opacity .15s;
}
.style-card.like { border-color: var(--accent); }
.style-card.nope { opacity: .42; }
.style-card .shots { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; aspect-ratio: 3 / 2; background: var(--line); cursor: pointer; border: 0; padding: 0; }
.style-card .shots span { overflow: hidden; background: var(--paper); }
.style-card .shots span:first-child { grid-row: 1 / 3; }
.style-card .shots img { width: 100%; height: 100%; object-fit: cover; display: block; }
.style-card .info { padding: 10px 12px 4px; flex: 1; }
.style-card .name { font-weight: 700; font-size: 16px; }
.style-card .en { color: var(--muted); font-size: 12px; margin-left: 6px; font-weight: 500; }
.style-card .desc { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 4px; }
.style-card .acts { display: flex; gap: 6px; padding: 10px 12px 12px; }
.style-card .acts .btn { flex: 1; min-height: 38px; }
.style-card .acts .btn.like-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.style-card .acts .btn.nope-on { background: var(--line); }
.style-card .acts .btn svg { fill: none; }
.style-card .acts .btn.like-on svg { fill: currentColor; }

/* 2. 도안 */
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.filters.sub .chip { min-height: 30px; font-size: 13px; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.group-title { margin: 18px 0 8px; font-size: 15px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.group-title small { color: var(--muted); font-weight: 500; font-size: 12px; }
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.design {
  position: relative; border-radius: var(--r-m); overflow: hidden; background: var(--paper);
  aspect-ratio: 1; border: 2px solid transparent; cursor: pointer; padding: 0;
}
.design.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.design img { width: 100%; height: 100%; object-fit: cover; display: block; }
.design .zoomwrap { width: 100%; height: 100%; overflow: hidden; }
.design .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.62)); color: #fff; font-size: 12px; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.design .heart {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 999px; border: 0;
  display: grid; place-items: center; background: rgba(24,25,27,.55); color: #fff; cursor: pointer;
}
.design .heart svg { width: 20px; height: 20px; fill: none; }
.design.on .heart { background: var(--accent); color: var(--accent-ink); }
.design.on .heart svg { fill: currentColor; }
.design .badge { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(24,25,27,.7); color: #fff; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; line-height: 1.6; }

/* 3. 자리·크기·색 */
.detail { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 24px; align-items: start; }
.body-box { background: var(--surface); border-radius: var(--r-l); padding: 12px; position: sticky; top: 0; }
.seg { display: flex; background: var(--bg); border-radius: var(--r-m); padding: 3px; margin-bottom: 8px; }
.seg button { flex: 1; min-height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--raise); color: var(--ink); font-weight: 600; }
.body { width: 100%; max-height: 56dvh; display: block; }
.body-base { fill: #3a3b40; }
.body-hair { fill: #2b2c30; }
.region { fill: #55575e; stroke: var(--surface); stroke-width: 1.2; cursor: pointer; transition: fill .12s; outline: none; }
.region:hover, .region:focus-visible { fill: #6f7179; }
.region.on { fill: var(--accent); }
.body-side { fill: var(--muted); font-size: 10px; }
.picked-places { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 34px; }
.picked-places .none { color: var(--muted); font-size: 13px; align-self: center; }
.opts { display: grid; gap: 18px; }
.opt h3 { margin: 0 0 8px; font-size: 15px; display: flex; align-items: baseline; gap: 8px; }
.opt h3 small { color: var(--muted); font-weight: 500; font-size: 12px; }
.opt .val { color: var(--accent); font-weight: 700; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.opt input[type="range"] { width: 100%; margin-top: 10px; accent-color: var(--accent); }
.text {
  width: 100%; padding: 10px 12px; border-radius: var(--r-m); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); resize: vertical; font-size: 16px; /* 16px 미만이면 아이폰이 입력할 때 화면을 확대한다 */
}
.text::placeholder { color: #6c6e75; }

/* 4. 상담 카드 */
.summary { display: grid; gap: 14px; }
.sum-box { background: var(--surface); border-radius: var(--r-l); padding: 14px 16px; }
.sum-box h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.sum-rows { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 15px; }
.sum-rows dt { color: var(--muted); }
.sum-rows dd { margin: 0; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick { position: relative; background: var(--paper); border-radius: var(--r-m); overflow: hidden; border: 2px solid transparent; }
.pick.top { border-color: var(--accent); }
.pick button.face { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer; }
.pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick .rank { position: absolute; top: 6px; left: 6px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: rgba(24,25,27,.75); color: #fff; }
.pick.top .rank { background: var(--accent); color: var(--accent-ink); }
.pick .row { display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--surface); }
.pick .row .t { flex: 1; font-size: 12px; color: var(--muted); padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick .row button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.pick .row button:disabled { opacity: .3; cursor: default; }
.pick .row svg { width: 16px; height: 16px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }
.next-hint { margin-top: 18px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r-m); color: var(--muted); font-size: 13px; line-height: 1.5; }
.next-hint b { color: var(--ink); }

/* ---------- 아래 줄 ---------- */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg);
}
.bar-status { flex: 1; text-align: center; color: var(--muted); font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-status b { color: var(--accent); }

/* ---------- 크게 보기 ---------- */
dialog { color: var(--ink); }
.viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(12, 12, 13, .96); display: none;
}
.viewer[open] { display: grid; grid-template-rows: auto 1fr auto; }
.viewer::backdrop { background: rgba(0,0,0,.6); }
.viewer-top { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 18px; }
.viewer-title { flex: 1; font-weight: 700; font-size: 16px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-title small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.viewer-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 56px; touch-action: pan-y; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-m); background: var(--paper); user-select: none; -webkit-user-drag: none; }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 999px; border: 0; background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.viewer .nav.prev { left: 8px; }
.viewer .nav.next { right: 8px; }
.viewer-bottom { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
.viewer-bottom #viewerCount { margin-right: auto; font-size: 14px; }
.viewer #viewerLike svg { fill: none; }
.viewer #viewerLike.on svg { fill: currentColor; }
.viewer #viewerLike:not(.on) { background: var(--raise); color: var(--ink); border-color: var(--line); }
.viewer.present .viewer-bottom #viewerLike, .viewer.present .viewer-bottom #viewerDelete { display: none; }

/* ---------- 확인 창·알림 ---------- */
.confirm { border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); padding: 20px; max-width: 360px; width: calc(100vw - 40px); }
.confirm::backdrop { background: rgba(0,0,0,.55); }
.confirm p { margin: 0 0 16px; line-height: 1.55; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #f2f2f0; color: #18191b; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(0,0,0,.35); z-index: 10; max-width: calc(100vw - 32px); text-align: center;
}

/* ---------- 좁은 화면(휴대폰) ---------- */
@media (max-width: 720px) {
  .lead h1 { font-size: 19px; }
  .lead p { font-size: 14px; }
  .style-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .style-card .desc { display: none; }
  .style-card .info { padding: 8px 10px 2px; }
  .style-card .en { display: block; margin: 0; }
  .style-card .acts { padding: 8px; gap: 4px; }
  .style-card .acts .btn { padding: 0 6px; font-size: 13px; }
  .design-grid, .picks { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .design .cap { display: none; }
  .pick .row .t { display: none; }
  .pick .row { justify-content: space-between; }
  .design .heart { width: 30px; height: 30px; top: 4px; right: 4px; }
  .detail { grid-template-columns: 1fr; }
  .body-box { position: static; }
  .body { max-height: 46dvh; }
  .steps button span { font-size: 13px; }
  .steps button:not(.on) span { display: none; }
  .viewer-stage { padding: 0 8px; }
  .viewer .nav { display: none; }
}
