:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --line: #ebe7e1;
  --text: #191919;
  --muted: #6f6a63;
  --accent: #3b4cca;
  --accent-soft: #eef0fd;
  --radius: 14px;
  font-family: "Pretendard Variable", Pretendard, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
button, input, select { font: inherit; color: inherit; }

/* 상단 바 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px;
  background: rgb(250 248 245 / .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgb(0 0 0 / .04);
}
.top-actions { display: flex; gap: 6px; flex: none; }
.top-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px;
  border: 0; border-radius: 999px; background: none; color: var(--muted);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.top-btn:hover { background: rgb(0 0 0 / .05); color: var(--text); }
.top-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 800; letter-spacing: -.03em; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 8px; flex: none; }
.brand b { color: var(--accent); }
.search {
  flex: 1; max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--surface); box-shadow: 0 2px 12px rgb(0 0 0 / .06);
  border: 1px solid transparent; transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input { flex: 1; border: 0; outline: 0; background: none; min-width: 0; font-size: 15px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.list-head .chips { flex: 1; min-width: 0; padding-bottom: 0; }
/* 옆으로 넘길 카테고리가 더 있다는 표시 */
.list-head .chips { mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); padding-right: 24px; }
.list-tools { display: flex; align-items: center; gap: 10px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sort { display: flex; padding: 3px; border-radius: 999px; background: #efece6; flex: none; }
.sort button {
  border: 0; background: none; border-radius: 999px; padding: 5px 12px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.sort button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / .08); }

/* 본문 */
.page { padding: 8px 24px 48px; }
h1 { margin: 12px 0 4px; font-size: 26px; }
.count { margin: 0; color: var(--muted); font-size: 13px; white-space: nowrap; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 16px; scrollbar-width: none; }
.chips button {
  flex: none; border: 0; border-radius: 999px; padding: 7px 14px;
  background: none; color: var(--muted); cursor: pointer; font-size: 14px;
}
.chips button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* 메이슨리 그리드 */
.grid { display: flex; gap: 12px; align-items: flex-start; }
.grid .col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card {
  margin: 0; display: block; width: 100%;
  border: 0; padding: 0; background: var(--surface); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; text-align: left; position: relative;
}
.card img { display: block; width: 100%; height: auto; transition: transform .3s; }
.card:hover img { transform: scale(1.03); }
.card .cap {
  position: absolute; inset: auto 0 0 0; padding: 28px 12px 12px;
  color: #fff; font-size: 14px; font-weight: 600; line-height: 1.35;
  background: linear-gradient(transparent, rgb(0 0 0 / .6));
  opacity: 0; transition: opacity .2s;
}
.card:hover .cap, .card:focus-visible .cap { opacity: 1; }
.card .badge {
  position: absolute; top: 10px; left: 10px; padding: 3px 8px; border-radius: 6px;
  background: rgb(255 255 255 / .9); font-size: 12px; font-weight: 600;
}
.card .badge.new { background: var(--accent); color: #fff; }

/* 좋아요 */
.card-wrap { position: relative; }
.like, .like-lg {
  display: inline-flex; align-items: center; gap: 4px; border: 0; cursor: pointer;
  font-weight: 700; font-variant-numeric: tabular-nums; transition: transform .12s;
}
.like svg, .like-lg svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; transition: fill .15s; }
.like[aria-pressed="true"] svg, .like-lg[aria-pressed="true"] svg { fill: currentColor; }
.like[aria-pressed="true"], .like-lg[aria-pressed="true"] { color: #e5484d; }
.like:active, .like-lg:active { transform: scale(.9); }
.like {
  position: absolute; right: 8px; bottom: 8px; z-index: 1; height: 30px; padding: 0 9px;
  border-radius: 999px; background: rgb(255 255 255 / .92); color: #45403a; font-size: 12px;
  box-shadow: 0 1px 4px rgb(0 0 0 / .12);
}
.like svg { width: 16px; height: 16px; }
.like span:empty { display: none; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.title-row h2 { margin-right: auto; }
.like-lg {
  flex: none; height: 36px; padding: 0 12px; margin-top: 2px; border-radius: 999px;
  background: var(--surface); color: var(--muted); font-size: 13px; box-shadow: inset 0 0 0 1px var(--line);
}
.like-lg svg { width: 18px; height: 18px; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }

/* 상세 모달 */
.detail {
  width: min(1100px, calc(100% - 32px)); max-height: calc(100% - 48px);
  border: 0; border-radius: 20px; padding: 28px; background: var(--surface);
}
.detail::backdrop { background: rgb(0 0 0 / .45); }
.close { position: absolute; top: 14px; right: 18px; border: 0; background: none; font-size: 28px; cursor: pointer; }
.detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.detail-media { margin: 0; background: #f2efea; border-radius: var(--radius); display: grid; place-items: center; }
.detail-media img { max-width: 100%; max-height: 70vh; border-radius: var(--radius); }
.meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--accent); font-weight: 600; }
.meta span + span::before { content: "·"; margin-right: 6px; color: var(--muted); }
.detail h2 { margin: 8px 0; font-size: 22px; line-height: 1.35; }
.desc { margin: 0 0 12px; color: var(--muted); line-height: 1.6; }
.spec { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.spec div { background: #f5f3ef; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.spec dt { display: inline; color: var(--muted); }
.spec dd { display: inline; margin: 0 0 0 4px; font-weight: 600; }

.args { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.args-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.args h3 { margin: 0; font-size: 16px; }
.args p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.ghost { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.fields { display: grid; gap: 8px; }
.field { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; font-size: 13px; }
.field span { color: var(--muted); }
.field input { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0; }
.field input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.raw { border-top: 1px solid var(--line); padding: 12px 0; }
.raw summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.raw summary span { float: right; color: var(--muted); font-weight: 400; }
.raw pre {
  white-space: pre-wrap; word-break: keep-all; font: 13px/1.7 inherit; font-family: inherit;
  background: #f7f5f1; border-radius: 10px; padding: 14px; max-height: 320px; overflow: auto;
}
.raw mark { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 2px; }

.primary {
  width: 100%; border: 0; border-radius: 12px; padding: 14px; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
}
.primary:disabled, .secondary:disabled { opacity: .55; cursor: not-allowed; }
.secondary {
  width: 100%; border: 1px solid var(--accent); border-radius: 12px; padding: 12px; cursor: pointer;
  background: var(--surface); color: var(--accent); font-weight: 700; font-size: 15px;
}

/* 상세: 이렇게 쓰세요 */
.guide { background: var(--accent-soft); border-radius: var(--radius); padding: 16px; margin: 4px 0 12px; }
.guide h3 { margin: 0 0 10px; font-size: 16px; }
.steps { margin: 0 0 14px; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 8px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 24px 1fr; gap: 8px; font-size: 14px; line-height: 1.5; }
.steps li::before {
  content: counter(s); width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-top: 1px;
}
.ai-links { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.ai-links a { color: var(--accent); font-weight: 600; text-decoration: none; }
.tips { margin: 6px 0 0; padding: 10px 12px 10px 28px; background: var(--surface); border-radius: 10px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.tips:empty { display: none; }

/* 상단 사용법 버튼 */
.howto-btn { border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: var(--surface); cursor: pointer; font-size: 14px; white-space: nowrap; }

/* HOW TO 화면 */
.howto {
  width: min(760px, calc(100% - 32px)); max-height: calc(100% - 48px);
  border: 0; border-radius: 20px; padding: 32px; background: var(--surface);
}
.howto::backdrop { background: rgb(0 0 0 / .45); }
.howto-kicker { margin: 0; font-size: 12px; letter-spacing: .12em; color: var(--accent); font-weight: 700; }
.howto h2 { margin: 6px 0 8px; font-size: 26px; }
.howto-lead { margin: 0 0 24px; color: var(--muted); line-height: 1.6; }
.howto-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.howto-steps li { display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.howto-text b { display: block; font-size: 16px; margin-bottom: 4px; }
.howto-text span { color: var(--muted); font-size: 14px; line-height: 1.6; }
.howto-text q { display: inline-block; margin-top: 6px; padding: 4px 10px; background: #f5f3ef; border-radius: 8px; color: var(--text); quotes: "“" "”"; }
.howto-note { margin: 20px 0 16px; font-size: 13px; color: var(--muted); line-height: 1.6; }

.mock { background: #f7f5f1; border-radius: 12px; padding: 12px; font-size: 13px; }
.mock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mock-grid img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; opacity: .55; }
.mock-grid img.picked { opacity: 1; outline: 3px solid var(--accent); outline-offset: 1px; }
.mock-field { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; }
.mock-field span { grid-row: span 2; color: var(--muted); }
.mock-field s { color: var(--muted); }
.mock-field em { font-style: normal; background: var(--surface); border: 1px solid var(--accent); border-radius: 8px; padding: 6px 10px; color: var(--accent); font-weight: 600; }
.mock-copy { display: grid; gap: 6px; justify-items: center; }
.mock-copy span { width: 100%; text-align: center; background: var(--accent); color: #fff; border-radius: 10px; padding: 10px; font-weight: 700; }
.mock-copy small { color: var(--accent); }
.mock-chat { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 40px 10px 12px; }
.mock-chat .chip { display: inline-block; background: #f2efea; border-radius: 6px; padding: 3px 8px; font-size: 12px; margin-bottom: 6px; }
.mock-chat p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 12px; }
.mock-chat .send { position: absolute; right: 10px; bottom: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--text); color: #fff; display: grid; place-items: center; font-size: 13px; }
.mock-result { padding: 0; overflow: hidden; }
.mock-result img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

@media (max-width: 760px) {
  .howto { padding: 24px 16px; }
  .howto h2 { font-size: 22px; }
  .howto-steps li { grid-template-columns: 1fr; gap: 12px; }
  .howto-btn { padding: 6px 12px; font-size: 13px; }
}
.ghost.wide { width: 100%; padding: 11px; font-size: 14px; border-radius: 12px; margin-top: 8px; }


.detail-media { position: relative; }
.tabs { position: absolute; top: 12px; left: 12px; display: flex; gap: 4px; padding: 4px; background: rgb(255 255 255 / .9); border-radius: 999px; z-index: 1; }
.tabs button { border: 0; background: none; border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.toast { min-height: 1.2em; font-size: 13px; color: var(--accent); text-align: center; }

.similar { margin-top: 28px; }
.similar h3 { font-size: 16px; }
.similar-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.similar-row .card img { aspect-ratio: 1; object-fit: cover; }
.similar-row .cap { opacity: 1; font-size: 12px; }

/* 휴대폰: 상세 창 아래에 항상 보이는 복사 버튼 */
.cta-bar { display: none; }

@media (max-width: 760px) {
  .cta-bar {
    display: block; position: sticky; bottom: 0; z-index: 2;
    margin: 16px -16px -20px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgb(255 255 255 / .94); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  }
  .cta-bar .primary.done { background: #1f8a4c; }
  .topbar { padding: 10px 16px; gap: 8px 10px; flex-wrap: wrap; }
  .top-actions { margin-left: auto; gap: 2px; }
  .top-btn { height: 36px; padding: 0 10px; font-size: 13px; gap: 4px; }
  .top-btn svg { width: 17px; height: 17px; }
  .search { order: 3; flex-basis: 100%; height: 42px; }
  .page { padding: 4px 16px 32px; }
  .list-head .count { display: none; } /* 좁은 화면은 카테고리 칸을 넓게 쓴다 */
  .grid, .grid .col { gap: 8px; }
  .detail { padding: 20px 16px; max-height: calc(100% - 24px); }
  .detail-body { grid-template-columns: 1fr; gap: 16px; }
  .field { grid-template-columns: 1fr; gap: 4px; }
}

/* 푸터 */
.site-footer { border-top: 1px solid var(--line); margin-top: 56px; padding: 32px 24px 40px; color: var(--muted); font-size: 14px; }
.site-footer .foot-inner, .site-footer .foot-note { max-width: 1280px; margin: 0 auto; }
.foot-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.03em; color: var(--text); font-size: 16px; }
.foot-brand img { border-radius: 6px; }
.foot-inner p { margin: 6px 0 0; }
.foot-links { display: flex; gap: 20px; align-items: flex-start; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--text); text-decoration: underline; }
.foot-links b { color: var(--text); }
.foot-note { margin-top: 14px; font-size: 13px; line-height: 1.6; }

/* 정책 문서 */
.doc { max-width: 760px; margin: 0 auto; padding: 40px 24px 24px; line-height: 1.75; }
.doc h1 { font-size: 28px; margin: 0 0 6px; }
.doc .doc-meta { color: var(--muted); font-size: 14px; margin: 0 0 32px; }
.doc h2 { font-size: 18px; margin: 32px 0 8px; }
.doc p, .doc li { font-size: 15px; color: #333; }
.doc ul, .doc ol { padding-left: 22px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: #f3f1ed; }
.doc-back { display: inline-block; margin-bottom: 24px; color: var(--accent); text-decoration: none; font-size: 14px; }

/* 템플릿별 정적 페이지(t/<id>.html) */
.t-page .doc-back { color: var(--muted); }
.t-page .doc-back a { color: var(--accent); text-decoration: none; }
.t-fig { margin: 0 0 16px; }
.t-fig img { display: block; width: 100%; height: auto; border-radius: var(--radius); background: #f2efea; }
.t-fig figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.t-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.t-cta { display: block; text-align: center; text-decoration: none; margin: 8px 0 8px; }
.t-page h2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.t-prompt { white-space: pre-wrap; word-break: keep-all; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; font-family: inherit; font-size: 14px; line-height: 1.7; margin: 0; }
.t-hint { font-size: 13px !important; color: var(--muted) !important; }
.t-related { columns: 2; gap: 24px; }
.t-related a { color: var(--text); }
@media (max-width: 760px) { .t-pair, .t-related { grid-template-columns: 1fr; columns: 1; } }

/* 예시 이미지 복사·공유 */
.media-actions { display: flex; gap: 8px; justify-content: center; padding: 12px 0 4px; }
.media-actions .ghost { background: var(--surface); font-size: 13px; padding: 8px 14px; }
.media-actions .ghost:hover { border-color: var(--accent); color: var(--accent); }
.detail-media .toast { padding: 0 12px 10px; }
.media-note { margin: 10px 12px 0; padding: 10px 12px; border-radius: 10px; background: var(--surface); font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.media-note b { color: #9a3412; font-weight: 600; }
.real-badge { position: absolute; left: 8px; bottom: 8px; z-index: 1; padding: 3px 8px; border-radius: 999px; background: rgb(17 17 17 / .72); color: #fff; font-size: 11px; font-weight: 600; }
.site-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #191919; color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* 톤앤매너만 가져가기 */
.style-box { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.style-h { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--text); }
.style-h span { display: block; font-weight: 400; font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 3px; }
.swatches { display: flex; gap: 6px; margin-bottom: 10px; }
.swatches i { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }
.style-box .secondary { width: 100%; }

/* 카테고리 모음 페이지(/c/) */
.c-list { list-style: none; padding: 0; margin: 20px 0 8px; display: grid; gap: 8px; }
.c-list a { display: flex; gap: 14px; align-items: center; padding: 8px; border-radius: 12px; color: var(--text); text-decoration: none; }
.c-list a:hover { background: var(--surface); }
.c-list img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; background: #efece6; }
.c-list b { display: block; font-size: 15px; }
.c-list small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); line-height: 1.5; }

/* 맞춤 설정 실시간 미리보기 (디자인 예시를 입력값으로 다시 그린 것) */
.live-box { position: relative; width: min(100%, calc(70vh * var(--ar, 1))); margin: 0 auto; overflow: hidden; border-radius: var(--radius); background: #fff; }
.live-box[hidden] { display: none; }
.foot-cats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 13px; }
.foot-cats a { color: var(--muted); text-decoration: none; }
.foot-cats a:hover { color: var(--text); text-decoration: underline; }
/* 사용자 의견: 결과 평가(상세·템플릿 페이지)와 템플릿 요청(목록 맨 아래) */
.fb-box { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.fb-q { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.fb-btns { display: flex; gap: 8px; }
.fb-btns .ghost { flex: 1; font-size: 14px; padding: 9px 12px; background: var(--surface); }
.fb-btns .ghost:disabled { opacity: .5; cursor: default; }
.fb-msg { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.ask-row { display: flex; gap: 8px; margin-top: 8px; }
.ask-row input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; background: var(--surface); }
.ask-row .primary, .ask-row .secondary { width: auto; flex: none; padding: 10px 16px; font-size: 14px; }
.ask { max-width: 640px; margin: 40px auto 8px; padding: 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.ask label { font-size: 14px; line-height: 1.55; color: var(--muted); }
.ask label b { color: var(--text); margin-right: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
