/* 작명구구단 */
:root {
  --bg: #fbf8f4;
  --surface: #ffffff;
  --surface-2: #f4efe7;
  --text: #1e2a2a;
  --muted: #5d6766;
  --line: #e9e2d6;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --brand-soft: #e2f3f0;
  --accent: #d9603b;
  --accent-soft: #fdeee6;
  --ok: #138a5a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 26, 51, .05), 0 8px 28px rgba(40, 70, 60, .08);
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", system-ui, -apple-system, sans-serif;
  --wrap: 1080px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111716;
    --surface: #18211f;
    --surface-2: #212c2a;
    --text: #ebf1ef;
    --muted: #9fb0ac;
    --line: #2e3b38;
    --brand: #5fd3c2;
    --brand-ink: #0c1312;
    --brand-soft: #1d3632;
    --accent: #f39a76;
    --accent-soft: #3a2a22;
    --ok: #4fd39b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.3; letter-spacing: -0.02em; }
h2 { font-size: 1.45rem; margin: 0 0 .5rem; }
h3 { font-size: 1.1rem; margin: 0 0 .4rem; }
p { margin: 0 0 1rem; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* 헤더 */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); font-size: .85rem; font-weight: 900; }
.brand small { font-weight: 600; color: var(--muted); font-size: .75rem; }
.nav { margin-left: auto; display: flex; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; color: var(--text); padding: 8px; border-radius: 10px; cursor: pointer; }
.nav-toggle svg { width: 24px; height: 24px; display: block; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 60px; flex-direction: column; padding: 8px 12px 14px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
}

/* 히어로 */
.hero { padding: 44px 0 20px; }
.hero h1 { font-size: clamp(1.8rem, 4.6vw, 2.7rem); margin: 0 0 .6rem; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero .lead { color: var(--muted); font-size: 1.08rem; max-width: 640px; margin-bottom: 0; }
.eyebrow { display: inline-block; font-size: .82rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }

main section { margin: 44px 0; }
.section-lead { color: var(--muted); margin-top: -.2rem; }

/* 생성기 카드 */
.gen-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 22px; margin-top: 24px; }
.gen { display: grid; gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.chips legend { font-weight: 700; font-size: .9rem; margin-bottom: 8px; padding: 0; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: .95rem; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chip input:hover + span { border-color: var(--brand); }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 18px; align-items: end; }
.field label, .field .label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.field input[type=text], .field select { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.field input[type=text]:focus, .field select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.field small { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
.range-row { display: flex; align-items: center; gap: 10px; max-width: 420px; }
.range-row input { flex: 1; accent-color: var(--brand); }
.range-row output { min-width: 3.2em; text-align: right; font-weight: 800; color: var(--brand); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.gen .only-en { display: none; }
.gen.is-en .only-en { display: block; }
.gen.is-en .only-ko { display: none; }
.gen-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gen-actions .hint { color: var(--muted); font-size: .9rem; }

.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 800; font-size: 1.02rem; padding: 13px 24px; border-radius: 14px; border: 0; background: var(--brand); color: var(--brand-ink); cursor: pointer; text-decoration: none; transition: transform .08s, filter .15s; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: .9rem; border-radius: 10px; }

/* 결과 */
.gen-results { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.gen-results.pop .nick { animation: pop .28s ease both; }
.gen-results.pop .nick:nth-child(2n) { animation-delay: .03s; }
.gen-results.pop .nick:nth-child(3n) { animation-delay: .06s; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .gen-results.pop .nick { animation: none; } html { scroll-behavior: auto; } }
.nick { display: flex; align-items: stretch; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.nick:hover { border-color: var(--brand); }
.nick-copy { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 12px 14px; font: inherit; color: var(--text); cursor: pointer; }
.nick-text { display: block; font-weight: 800; font-size: 1.08rem; overflow-wrap: anywhere; }
.nick-meta { display: block; font-size: .78rem; color: var(--muted); }
.icon-btn { flex: none; width: 44px; display: grid; place-items: center; background: none; border: 0; border-left: 1px solid var(--line); color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--brand); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.fav-btn[aria-pressed="true"] { color: var(--accent); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.empty { grid-column: 1 / -1; color: var(--muted); padding: 14px; text-align: center; background: var(--bg); border: 1px dashed var(--line); border-radius: 14px; }

/* 찜 목록 */
.fav { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.fav-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fav-head h2 { font-size: 1.05rem; margin: 0 auto 0 0; }
.fav-head .count { color: var(--accent); }
.fav .tools { display: none; gap: 6px; }
.fav.has-items .tools { display: flex; }
.fav .gen-results { margin-top: 10px; }

/* 카드 그리드 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--brand); transform: translateY(-2px); text-decoration: none; }
.card .emoji { font-size: 1.6rem; line-height: 1; display: block; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: .94rem; margin: 0; }
.card .go { display: inline-block; margin-top: 10px; color: var(--brand); font-weight: 700; font-size: .9rem; }

/* 추천 목록 */
.samples { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.samples li button { font: inherit; font-weight: 700; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.samples li button:hover { border-color: var(--brand); color: var(--brand); }
.sample-group { margin-bottom: 22px; }
.sample-group h3 { font-size: 1rem; color: var(--muted); }

/* 본문 */
.read { max-width: 760px; }
.read h2 { margin-top: 2rem; }
.read ul, .read ol { padding-left: 1.3rem; }
.read li { margin-bottom: .4rem; }
.tip { background: var(--brand-soft); border-radius: var(--radius); padding: 16px 18px; margin: 1rem 0; }
.tip strong { color: var(--brand); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 16px 18px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-weight: 800; font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 18px 14px; color: var(--muted); }

/* CTA, 광고, 푸터 */
.cta-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; background: linear-gradient(120deg, #0f766e, #2f8f6a); color: #fff; border-radius: 22px; padding: 26px 28px; }
.cta-band h2 { margin: 0 0 4px; }
.cta-band p { margin: 0; opacity: .9; }
.cta-band .btn { background: #fff; color: #0b5c55; }
.ad { margin: 36px 0; min-height: 90px; }
.site-footer { border-top: 1px solid var(--line); padding: 26px 0 36px; margin-top: 56px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer a { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-weight: 700; font-size: .95rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .hero { padding-top: 28px; }
  .gen-card { padding: 16px; border-radius: 18px; }
  .gen-results { grid-template-columns: 1fr 1fr; gap: 8px; }
  .nick { flex-wrap: wrap; }
  .nick-copy { flex-basis: 100%; padding: 10px 12px 4px; }
  .nick-text { font-size: 1rem; }
  .icon-btn { flex: 1; height: 38px; border-left: 0; border-top: 1px solid var(--line); }
  .icon-btn + .icon-btn { border-left: 1px solid var(--line); }
  .gen-actions .btn { flex: 1 1 100%; }
  .gen-actions .hint { flex-basis: 100%; text-align: center; }
  .cta-band { padding: 22px; }
}

/* 작명 결과 카드 */
.name-results { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.name-card .nick-text { font-size: 1.3rem; letter-spacing: .02em; }
.name-card .hanja { display: block; font-size: .95rem; font-weight: 700; color: var(--brand); margin-top: 2px; }
.name-card .mean { display: block; font-size: .85rem; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.name-card .sound { display: block; font-size: .78rem; color: var(--accent); margin-top: 2px; }
.field input[type=text].surname { font-size: 1.15rem; font-weight: 800; max-width: 160px; }
.name-table td:first-child { font-weight: 800; white-space: nowrap; }
.name-table td:nth-child(2) { color: var(--brand); white-space: nowrap; }
.note { font-size: .85rem; color: var(--muted); }
@media (max-width: 560px) { .name-results { grid-template-columns: 1fr; } .name-results .nick { flex-wrap: nowrap; } .name-results .nick-copy { flex-basis: auto; padding: 12px 14px; } .name-results .icon-btn { flex: none; width: 46px; height: auto; border-top: 0; border-left: 1px solid var(--line); } }
