/* =========================================================
   이모지 상자 – 도구 화면 스타일 (공통 styles.css 위에 얹음)
   ========================================================= */

:root {
  --accent: #a44e63;
  --accent-dark: #85394c;
  --accent-soft: #f7e3e8;
  --accent-line: #eccdd5;
  --header-h: 68px;
}

.brand-mark { background: var(--accent); color: #fff; }

.site-header { background: rgba(251, 245, 236, .96); }

.site-nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.header-jump { background: var(--terra); }
.header-jump:hover { background: var(--terra-dark); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  padding: 12px 16px; background: #fff; color: var(--ink);
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- 검색 + 분류 칩 ---------- */
.tool {
  position: sticky;
  top: var(--header-h);
  z-index: 45;
  padding-top: 8px;
  padding-bottom: 10px;
  background: var(--cream);
  border-bottom: 1px solid rgba(234, 223, 209, .0);
}

.search-row { position: relative; }

.search-input {
  width: 100%;
  height: 56px;
  padding: 0 48px 0 18px;
  font-family: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  -webkit-appearance: none;
  appearance: none;
}
.search-input::placeholder { color: #a89a8c; }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }

.search-clear {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  background: var(--cream-2);
  color: var(--ink-2);
  font-size: 15px;
  cursor: pointer;
}

.chips {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- 이모지 카드 ---------- */
.grid-emoji {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 10px;
}

.grid-text {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 10px;
}

.ec {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 86px;
  padding: 10px 6px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s ease, border-color .1s ease, background .1s ease;
  -webkit-tap-highlight-color: transparent;
}
.ec:hover { border-color: var(--accent); transform: translateY(-1px); }
.ec:active { transform: scale(.97); }
.ec.is-copied { background: var(--accent-soft); border-color: var(--accent); }
.ec:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.ec-g {
  font-size: 33px;
  line-height: 1.12;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
}

.ec-n {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--muted);
  text-align: center;
  word-break: keep-all;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ec.is-text {
  min-height: 92px;
  justify-content: flex-start;
  padding-top: 12px;
}
.ec.is-text .ec-g {
  font-size: 15px;
  line-height: 1.45;
  font-family: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  white-space: pre-wrap;
  word-break: break-all;
  text-align: center;
  max-height: 4.4em;
  overflow: hidden;
}
.ec.is-text .ec-n {
  font-size: 11px;
  color: #9a8a7d;
  -webkit-line-clamp: 1;
}

.ec.is-copied::after {
  content: "✓";
  position: absolute;
  top: 4px; right: 6px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 800;
}

.grid-foot {
  margin: 14px 0 0;
  font-size: 15px;
  color: var(--muted);
  text-align: right;
}

/* ---------- 홈: 분류 카드 ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.cat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}
.cat-card:hover { border-color: var(--accent); text-decoration: none; }
.cat-icon { font-size: 24px; line-height: 1.2; }
.cat-card h3 { font-size: 17px; font-weight: 800; }
.cat-card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.cat-card.c-heart .cat-icon { color: #c8536c; }
.cat-card.c-png .cat-icon { color: var(--terra); }

/* ---------- 단계/본문 ---------- */
.step-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.step-list li {
  position: relative;
  padding: 16px 20px 16px 60px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16.5px;
  color: var(--ink-2);
}
.step-list li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 18px; top: 15px;
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
}
.step-list strong { color: var(--ink); }

.note {
  margin: 14px 0 0;
  font-size: 14.5px;
  color: var(--muted);
}

.prose { max-width: 780px; }
.prose h2 { font-size: clamp(22px, 3vw, 26px); margin-bottom: 12px; }
.prose h3 { font-size: 19px; font-weight: 800; margin: 22px 0 8px; color: var(--ink); }
.prose p { margin: 0 0 12px; color: var(--ink-2); font-size: 17px; }
.prose-block + .prose-block { margin-top: 26px; }
.prose strong { color: var(--ink); }

.count {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 6px;
}

/* ---------- 관련 링크 ---------- */
.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.related-links a {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
}
.related-links a:hover { border-color: var(--accent); text-decoration: none; }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: 8px; max-width: 820px; }
.faq-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 18px;
}
.faq-item summary {
  cursor: pointer;
  padding: 16px 26px 16px 0;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
  position: relative;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
}
.faq-item[open] summary::after { content: "−"; }
.faq-a { padding: 0 0 16px; border-top: 1px solid var(--line-2); }
.faq-a p { margin: 12px 0 0; color: var(--ink-2); font-size: 16px; }
.faq-a p:first-child { margin-top: 14px; }

/* ---------- 검색 결과 ---------- */
.results { padding-top: 4px; }
.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.results-head h2 { font-size: 22px; font-weight: 800; }
.results-head p { margin: 0; font-size: 15px; color: var(--muted); }
.results-empty {
  padding: 34px 20px;
  text-align: center;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 16px;
}
.results-sub { margin: 22px 0 10px; font-size: 18px; font-weight: 800; }

/* ---------- 조합함(하단 고정) ---------- */
.tray {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 70;
  background: var(--paper);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px -18px rgba(60, 40, 30, .45);
  transform: translateY(110%);
  transition: transform .18s ease;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tray.is-open { transform: translateY(0); }

.tray-inner { padding-top: 10px; padding-bottom: 10px; }
.tray-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.tray-title { margin: 0; font-size: 15px; color: var(--ink-2); }
.tray-title strong { font-size: 16px; color: var(--ink); margin-right: 4px; }
.tray-title span { color: var(--muted); font-size: 14px; }
.tray-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 14.5px; border-radius: 10px; }
.tray-clear {
  border: 0; background: none;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 6px;
}

.tray-chips {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.tray-chips::-webkit-scrollbar { display: none; }
.tray-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 10px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
}
.tray-chip span.g { font-size: 19px; line-height: 1; }
.tray-chip .x {
  border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 13px; padding: 0 2px;
}
.tray-chip .x:hover { color: var(--accent); }

body.has-tray { padding-bottom: 150px; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translate(-50%, 12px);
  z-index: 80;
  max-width: 88vw;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(50, 42, 36, .94);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- PNG 스튜디오 ---------- */
.studio {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.studio-preview {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 18px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.studio-canvas-wrap {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background:
    linear-gradient(45deg, #e9e1d6 25%, transparent 25%, transparent 75%, #e9e1d6 75%),
    linear-gradient(45deg, #e9e1d6 25%, #fff 25%, #fff 75%, #e9e1d6 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  border: 1px solid var(--line);
}
#pngCanvas { width: 100%; height: auto; display: block; }
.studio-name { margin: 0; font-size: 16px; font-weight: 700; text-align: center; }
.studio-sizes { display: flex; gap: 6px; }
.size-btn {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.size-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.studio-preview .btn { width: 100%; }
.studio-note { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.5; }
.studio-picker { min-width: 0; }
.studio-picker .grid-emoji { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.studio-picker .ec { min-height: 76px; }
.studio-picker .ec-g { font-size: 29px; }
.studio-count { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.studio-picker .ec.is-selected { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- 문서 페이지 ---------- */
.doc { padding-top: 26px; padding-bottom: 10px; max-width: 860px; }
.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.doc h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 800; margin-bottom: 8px; }
.doc-meta { margin: 0 0 20px; font-size: 14px; color: var(--muted); }
.doc h2 { font-size: 21px; font-weight: 800; margin: 30px 0 10px; }
.doc p, .doc li { font-size: 16.5px; color: var(--ink-2); }
.doc ul { padding-left: 20px; }
.doc li { margin-bottom: 6px; }
.doc-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  font-size: 15px;
}
.doc-table th, .doc-table td {
  padding: 11px 13px;
  text-align: left;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}
.doc-table th { background: var(--cream-2); font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.contact-list { list-style: none; padding: 0; }

/* ---------- 반응형 ---------- */
@media (max-width: 900px) {
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio { grid-template-columns: 1fr; }
  .studio-preview { position: static; }
  .studio-canvas-wrap { max-width: 200px; }
}

@media (max-width: 640px) {
  .site-header { position: static; }
  .tool { top: 0; box-shadow: 0 6px 16px -14px rgba(74, 55, 40, .5); }
  .hero { padding: 14px 0 2px; }
  .hero-inner { gap: 10px; }
  .hero h1 { font-size: 27px; letter-spacing: -.03em; }
  .hero p { font-size: 16.5px; line-height: 1.6; }
  .hero-tags { gap: 6px; margin-top: 0; }
  .hero-tags span { padding: 6px 11px; font-size: 14.5px; }
  .hero-tags span:nth-child(n+3) { display: none; }
  .section-head h2 { font-size: 21px; }
  .results-head h2 { font-size: 19px; }
  .site-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { flex: 0 0 auto; }
  .grid-emoji { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
  .grid-text { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ec { min-height: 80px; }
  .ec-g { font-size: 30px; }
  .ec-n { font-size: 11px; }
  .tool { padding-bottom: 8px; }
  .search-input { height: 52px; font-size: 16px; }
  .chip { font-size: 14px; padding: 7px 12px; }
  .tray-title { font-size: 14px; }
  .btn-sm { min-height: 36px; padding: 5px 11px; font-size: 14px; }
  body.has-tray { padding-bottom: 165px; }
}
