/* =========================================================
   글자수 상자 (text.niceluckydays.com) – 공통 스타일
   크림 + 테라 계열, 딥 에메랄드/틸 포인트
   ========================================================= */

:root {
  --cream: #fbf5ec;
  --cream-2: #f5ecdf;
  --paper: #fffdf9;
  --ink: #2b2621;
  --ink-2: #4f4439;
  --muted: #85766a;
  --line: #eadfd1;
  --line-2: #f3e9dc;

  --terra: #c0603a;
  --terra-dark: #9e4b2b;
  --terra-soft: #f7e2d6;
  --teal: #0f6b5c;
  --teal-dark: #0a4e43;
  --teal-soft: #dcefe9;
  --butter: #f4e0ae;
  --butter-soft: #fbf1d8;
  --berry: #a44e63;

  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(74, 55, 40, .05), 0 14px 30px -18px rgba(74, 55, 40, .35);
  --shadow-soft: 0 1px 2px rgba(74, 55, 40, .05), 0 6px 18px -12px rgba(74, 55, 40, .3);

  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Malgun Gothic", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}

img { max-width: 100%; display: block; }
a { color: var(--terra-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.35; letter-spacing: -.02em; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 1200;
  background: var(--teal-dark); color: #fff; padding: 10px 16px;
  border-radius: 10px; font-weight: 700; font-size: 15px;
  transition: top .15s ease;
}
.skip-link:focus { top: 8px; text-decoration: none; }

/* ---------- 사이트 헤더 ---------- */
.site-header {
  position: sticky;
  top: 46px;
  z-index: 900;
  background: rgba(251, 245, 236, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--teal); color: #fff; font-size: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 3px 8px -4px rgba(10,78,67,.8);
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
}
.site-nav a:hover { background: var(--cream-2); text-decoration: none; color: var(--ink); }
.site-nav a.is-active {
  background: var(--teal-soft);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(15, 107, 92, .18);
}
.lbl-full, .lbl-short { display: inline; }
.lbl-short { display: none; }

/* ---------- 히어로 ---------- */
.hero { padding-top: 40px; padding-bottom: 8px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--butter-soft); border: 1px solid #efdca6;
  color: #7a5a12; font-size: 13.5px; font-weight: 800;
}
.hero h1 {
  margin: 14px 0 12px;
  font-size: clamp(28px, 4.6vw, 42px);
  font-weight: 800;
  letter-spacing: -.035em;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(transparent 62%, var(--butter) 62%);
  padding: 0 2px;
}
.hero p.lede {
  margin: 0;
  max-width: 720px;
  color: var(--ink-2);
  font-size: 17px;
}
.hero .badges {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 16px; padding: 0; list-style: none;
}
.hero .badges li {
  font-size: 13.5px; font-weight: 700; color: var(--teal-dark);
  background: #fff; border: 1px solid #cfe6df; border-radius: 999px;
  padding: 5px 12px;
}

/* ---------- 도구 카드 ---------- */
.tool { padding-top: 26px; }
.tool-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.tool-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.tool-head h2 { font-size: 18px; font-weight: 800; }
.tool-head .hint { font-size: 13.5px; color: var(--muted); }

textarea {
  width: 100%;
  min-height: 220px;
  padding: 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fffefb;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.75;
  resize: vertical;
}
textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 107, 92, .12);
}
textarea::placeholder { color: #b3a89c; }

.tool-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px;
}
.btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--cream-2); }
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--teal); border-color: var(--teal); color: #fff;
  box-shadow: 0 6px 14px -8px rgba(10, 78, 67, .9);
}
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-ghost { background: transparent; }
.save-state {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
}
.save-state .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #c8bcae;
}
.save-state.is-saved .dot { background: var(--teal); }

/* ---------- 통계 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
}
.stat .label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: -.01em;
}
.stat .value {
  display: block;
  margin-top: 2px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat .value small { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.stat.is-key { background: var(--teal-soft); border-color: #c3e2d9; }
.stat.is-key .value { color: var(--teal-dark); }

/* ---------- 목표 게이지 ---------- */
.goal {
  margin-top: 18px;
  padding: 16px;
  background: #fff;
  border: 1px dashed #d9cbb8;
  border-radius: var(--radius-sm);
}
.goal-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 700; color: var(--ink-2);
}
.goal-top label { font-weight: 800; }
.goal input[type="number"] {
  width: 110px;
  padding: 7px 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: #fffefb;
}
.goal input[type="number"]:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, .12);
}
.goal .goal-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.chip {
  appearance: none; cursor: pointer;
  padding: 6px 11px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff;
  font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.chip:hover { background: var(--cream-2); }
.chip.is-on { background: var(--teal); border-color: var(--teal); color: #fff; }

.gauge {
  margin-top: 10px;
  height: 14px;
  border-radius: 999px;
  background: var(--cream-2);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(74,55,40,.12);
}
.gauge-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #15806e, #0f6b5c);
  transition: width .18s ease;
}
.gauge-fill.is-over { background: linear-gradient(90deg, #d2694a, #b34a2e); }
.goal-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px;
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--muted);
}
.goal-bottom strong { color: var(--teal-dark); font-variant-numeric: tabular-nums; }
.goal-bottom .is-over { color: #b34a2e; }

/* ---------- 도구 링크 카드 ---------- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.tool-link {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tool-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.tool-link .ico { font-size: 26px; line-height: 1; }
.tool-link h3 { margin: 10px 0 5px; font-size: 17px; font-weight: 800; }
.tool-link p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.tool-link .more {
  display: inline-block; margin-top: 10px;
  font-size: 13.5px; font-weight: 800; color: var(--terra-dark);
}

/* ---------- 섹션 · 가이드 · FAQ ---------- */
.section { padding-top: 46px; }
.section-head { margin-bottom: 18px; }
.section-head h2 {
  font-size: clamp(22px, 3.4vw, 28px);
  font-weight: 800;
  letter-spacing: -.03em;
}
.section-head p { margin: 8px 0 0; color: var(--muted); font-size: 16px; }

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.guide-item {
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.guide-item h3 { font-size: 16.5px; font-weight: 800; margin-bottom: 6px; }
.guide-item p { margin: 0; font-size: 14.5px; color: var(--ink-2); }

.table-wrap { overflow-x: auto; margin-top: 14px; }
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 14.5px;
}
th, td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line-2);
  text-align: left;
  vertical-align: top;
}
th { background: var(--cream-2); font-weight: 800; color: var(--ink-2); white-space: nowrap; }
th:first-child, td:first-child { width: 34%; }
th:nth-child(2), td:nth-child(2) { width: 27%; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; color: var(--teal-dark); }

.faq { margin-top: 14px; }
.faq details {
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 9px;
}
.faq summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 15.5px;
  color: var(--ink);
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "Q. "; color: var(--terra); }
.faq details[open] summary { margin-bottom: 8px; }
.faq details p { margin: 0; font-size: 15px; color: var(--ink-2); }

.note {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 4px solid var(--butter);
  background: var(--butter-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14.5px;
  color: #6b5417;
}

/* ---------- 광고 슬롯 ---------- */
.ad-slot {
  margin: 26px 0 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot .ad-label {
  font-size: 10.5px;
  letter-spacing: .14em;
  color: #c3b7a9;
  text-align: center;
}

/* ---------- 변환 옵션 ---------- */
.opt-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.opt-group {
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.opt-group h3 {
  font-size: 13px; font-weight: 800; color: var(--muted);
  letter-spacing: .02em; margin-bottom: 8px;
}
.opt-group label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 600; color: var(--ink-2);
  padding: 5px 0; cursor: pointer;
}
.opt-group input[type="checkbox"], .opt-group input[type="radio"] {
  width: 17px; height: 17px; accent-color: var(--teal); flex: 0 0 auto;
}
.out-box {
  margin-top: 14px;
  min-height: 120px;
  padding: 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fffefb;
  font-size: 16px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ---------- 미리보기(인스타) ---------- */
.preview {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}
.preview-head {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13.5px; font-weight: 800; color: var(--ink-2);
}
.preview-body { padding: 14px; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.preview-body .blank-space {
  background: rgba(15, 107, 92, .10);
  border-radius: 3px;
}

/* ---------- 하단 ---------- */
.site-footer {
  margin-top: 56px;
  padding: 30px 0 40px;
  border-top: 1px solid var(--line);
  background: var(--cream-2);
  color: var(--muted);
  font-size: 14px;
}
.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px;
}
.site-footer a { color: var(--ink-2); font-weight: 700; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- 반응형 ---------- */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tools-grid, .guide-grid { grid-template-columns: 1fr; }
  .opt-groups { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  .hero h1 { font-size: clamp(24px, 7vw, 30px); }
  .container { padding: 0 14px; }
  .hero { padding-top: 26px; padding-bottom: 4px; }
  .hero p.lede { font-size: 15.5px; }
  .tool-card { padding: 16px; border-radius: 18px; }
  .tool-head h2 { font-size: 17px; }
  .tool-head .hint { font-size: 12.5px; }
  textarea { min-height: 190px; font-size: 16px; padding: 13px; }
  .stat { padding: 11px 12px; }
  .stat .value { font-size: 21px; }
  .goal { padding: 13px; }
  .goal .goal-presets { margin-left: 0; width: 100%; }
  .header-inner { min-height: 54px; gap: 8px; }
  .brand { font-size: 17px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 10px; font-size: 16px; }
  .site-nav a { padding: 7px 9px; font-size: 14px; }
  .btn { padding: 10px 13px; font-size: 14px; }
  .save-state { font-size: 11.5px; }
  .section { padding-top: 34px; }
}
@media (max-width: 520px) {
  .lbl-full { display: none; }
  .lbl-short { display: inline; }
}
@media (max-width: 430px) {
  .brand-name { display: none; }
  .header-inner { gap: 6px; justify-content: flex-start; }
  .site-nav { margin-left: -4px; }
}
@media (max-width: 400px) {
  .site-nav a { padding: 7px 8px; font-size: 13.5px; }
  .header-inner { gap: 4px; min-height: 52px; }
}
@media print {
  .site-header, .site-footer, .ad-slot, .tool-actions { display: none !important; }
}

/* ---------- 변환기·미리보기 부속 ---------- */
.preview-body .ph { color: var(--muted); font-size: 14.5px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag-list .tag {
  font-size: 12.5px; font-weight: 700; color: var(--teal-dark);
  background: var(--teal-soft); border-radius: 999px; padding: 3px 9px;
}
.stat .value.is-over, #igChar.is-over, #igTags.is-over { color: #b34a2e; }
#limitName:focus, #limitInput:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, .12);
}

/* ---------- 패밀리 사이트 이동 바 (계산기·운세·게임·이모지·글자수 공통) ---------- */
/* 화면 맨 위에 붙박이로 고정되는 컬러 띠. 5개 사이트 버튼을 한 줄에 두고,
   지금 보는 사이트는 노랑 알약으로 강조한다.
   .site-header 는 이 띠 높이(--family-bar-h)만큼 아래에 붙는다. */
:root {
  --family-bar-h: 46px;
}

.family-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background:
    radial-gradient(140% 200% at 0% 0%, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(93deg, #4338ca 0%, #6d28d9 38%, #c026d3 70%, #f43f5e 100%);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .30), 0 4px 14px rgba(76, 29, 149, .38);
  color: #fff;
}
.family-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--family-bar-h);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.family-bar-inner::-webkit-scrollbar { display: none; }
.family-bar a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .30), 0 1px 2px rgba(0, 0, 0, .12);
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.family-bar a:hover,
.family-bar a:focus-visible {
  background: rgba(255, 255, 255, .34);
  color: #fff;
  text-decoration: none;
}
.family-bar a:active { transform: scale(.97); }
.family-bar a.is-current {
  background: #fde047;
  border-color: #fef08a;
  color: #3b0764;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28), inset 0 1px 0 #fff;
}
.family-bar .fb-ico { font-size: 14px; line-height: 1; }

/* 스티키 사이트 헤더·검색바·결과 카드가 띠에 가리지 않게 오프셋을 띠 높이만큼 내린다 */
.site-header { top: var(--family-bar-h); }
.skip-link:focus { top: calc(var(--family-bar-h) + 8px); }
html { scroll-padding-top: calc(var(--family-bar-h) + 72px); }
#calc, #guide, #faq, .section { scroll-margin-top: calc(var(--family-bar-h) + 78px); }
#result, #form { scroll-margin-top: calc(var(--family-bar-h) + 74px); }
.result-card { top: calc(var(--family-bar-h) + 84px); }

/* 좁은 화면: 390px·360px 한 줄에 5개가 다 들어가게 */
@media (max-width: 560px) {
  :root { --family-bar-h: 44px; }
  .container.family-bar-inner { gap: 4px; padding-left: 8px; padding-right: 8px; }
  .family-bar a { gap: 3px; padding: 5px 8px; font-size: 12px; letter-spacing: -.03em; }
  .family-bar .fb-ico { font-size: 11.5px; }
}
@media (max-width: 350px) {
  .container.family-bar-inner { gap: 3px; padding-left: 6px; padding-right: 6px; }
  .family-bar a { padding: 5px 6px; font-size: 11px; }
  .family-bar .fb-ico { font-size: 10.5px; }
}
@media print {
  .family-bar { display: none !important; }
}