/* apps/hangul-name/style.css — 내 이름 한글로: 한지 바탕 + 먹색 잉크 + 단청(빨강·파랑·초록·노랑) 포인트.
 * 두툼한 둥근 카드 + 어긋난 그림자. 모바일 한 줄(--app-width 480px).
 * 글꼴은 언어 파일 fonts → :root 변수(--font-display 등, 생성기가 이 파일 뒤에 둔다). 카드 글꼴(한글)은 hangul-name.js 가 붙인다.
 * 공통 타이틀 바(G.topBar)·끝 화면(data-mg-end)은 --mg-* 변수로만 색을 맞춘다.
 */
:root {
  --paper: #f6efe0;
  --paper-2: #ece0c4;
  --ink: #1d1a17;
  --ink-dim: rgba(29, 26, 23, 0.8);
  --ink-faint: rgba(29, 26, 23, 0.6);
  --red: #c8102e;
  --red-2: #a10d25;
  --blue: #1f4e9c;
  --green: #1b8a5a;
  --gold: #f2b705;
  --line: #1d1a17;
  --shadow: 4px 4px 0 var(--ink);
  --font-hangul: 'Black Han Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;

  --font-display: 'Nunito', var(--font-sans);
  --display-weight: 900;
  --wb: normal;
  --hyphens: manual;

  /* 공통 타이틀 바 · 언어 선택 */
  --mg-top-fg: var(--ink);
  --mg-top-badge-bg: var(--red);
  --mg-top-badge-fg: #fff;
  --lang-bg: #fffaf0;
  --lang-fg: var(--ink);
  --lang-border: var(--ink);
  /* 공통 끝 화면 */
  --mg-star-on: #e0a100;
  --mg-star-off: rgba(29, 26, 23, 0.18);
  --mg-heart-bg: #fffaf0;
  --mg-heart-border: var(--red);
  --mg-heart-fg: var(--red);
  --mg-heart-on: var(--red);
  --mg-share-bg: #fffaf0;
  --mg-share-border: rgba(29, 26, 23, 0.22);
  --mg-x: var(--ink);
  --mg-tiktok: var(--ink);
  --mg-faq-bg: #fffaf0;
  --mg-faq-border: rgba(29, 26, 23, 0.18);
  --mg-end-retry-bg: var(--ink);
  --mg-end-retry-fg: #fff;
  --toast-bg: var(--ink);
  --toast-fg: #fff;
}

html { background: var(--paper); }
body.hn-body {
  min-height: 100vh;
  color: var(--ink);
  line-height: 1.6;
  word-break: var(--wb);
  hyphens: var(--hyphens);
  -webkit-hyphens: var(--hyphens);
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, rgba(29, 26, 23, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(29, 26, 23, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
}
[hidden] { display: none !important; }

/* 제목·버튼 글꼴: base.css 의 :lang(zh|th|vi) 규칙보다 뒤에서 다시 지정 */
.hn-h1, .hn-kicker, .hn-h1-main, .hn-h1-main em, .hn-badge, .hn-btn, .hn-h3, .hn-label, .hn-facts,
.hn-doc h1, .hn-eyebrow, .hn-chip-name, .hn-word-src, .hn-status {
  font-family: var(--font-display);
}

/* ---------------- 공통 레이아웃 ---------------- */
.hn-shell { max-width: var(--app-width); margin: 0 auto; padding: 8px 16px 0; }
.hn-screen { padding-top: 12px; }

.hn-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 56px; margin: 14px 0 0;
  padding: 12px 18px;
  border: 3px solid var(--line); border-radius: 16px;
  font-size: 18px; font-weight: var(--display-weight);
  line-height: 1.25; text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.2s;
}
.hn-btn-primary { background: var(--red); color: #fff; box-shadow: var(--shadow); }
.hn-btn-ghost { background: #fffaf0; color: var(--ink); box-shadow: var(--shadow); }
.hn-btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.hn-btn:disabled { opacity: 0.5; cursor: default; }
.hn-btn:focus-visible, .hn-chip:focus-visible, .hn-input:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 2px;
}

/* ---------------- 시작 화면 (티징 + 이름 입력) ---------------- */
.hn-start { text-align: center; padding-top: 16px; }
.hn-badge {
  display: inline-block; margin: 0 0 10px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--ink); color: var(--gold);
  font-size: 13px; font-weight: var(--display-weight); line-height: 1.35;
}
.hn-hero { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px auto 6px; }
.hn-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 50px; height: 50px; border: 3px solid var(--line); border-radius: 12px; background: #fffaf0; box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--font-hangul); font-size: 28px; line-height: 1; color: var(--ink);
  animation: hn-pop 2.8s ease-in-out infinite;
}
.hn-tile-a { background: #ffd9de; animation-delay: 0s; }
.hn-tile-b { background: #d7e4fb; animation-delay: 0.2s; }
.hn-tile-c { background: #d6f0e2; animation-delay: 0.4s; }
.hn-tile-big { width: 76px; height: 76px; font-size: 46px; background: var(--gold); border-radius: 16px; animation-delay: 0.8s; }
.hn-op { font-family: var(--font-display); font-weight: 900; font-size: 20px; color: var(--ink-faint); }
@keyframes hn-pop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-6px); } }
.hn-h1 { margin: 16px 0 10px; line-height: 1.15; font-weight: var(--display-weight); }
.hn-kicker {
  display: inline-block; margin-bottom: 10px; padding: 3px 10px;
  background: var(--blue); color: #fff; border-radius: 8px;
  font-size: 15px; transform: rotate(-2deg);
}
.hn-h1-main { display: block; font-size: 31px; color: var(--ink); overflow-wrap: break-word; }
.hn-h1-main em {
  font-style: normal; color: var(--red);
  background: linear-gradient(transparent 62%, rgba(242, 183, 5, 0.55) 62%, rgba(242, 183, 5, 0.55) 92%, transparent 92%);
  padding: 0 2px;
}
.hn-hook { margin: 0 auto 6px; max-width: 380px; font-size: 16px; color: var(--ink-dim); }
.hn-form {
  margin: 16px 0 0; padding: 16px; text-align: left;
  background: #fffaf0; border: 3px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.hn-label { display: block; margin: 0 0 6px; font-size: 15px; font-weight: var(--display-weight); line-height: 1.35; }
.hn-input {
  display: block; width: 100%; min-height: 54px; padding: 10px 14px;
  border: 2.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  font-family: var(--font-sans); font-size: 20px; font-weight: 700; line-height: 1.3;
}
.hn-input::placeholder { color: var(--ink-faint); font-weight: 600; }
.hn-error { margin: 10px 0 0; font-size: 14px; font-weight: 700; line-height: 1.45; color: var(--red-2); }
.hn-form .hn-btn { margin-top: 14px; }
.hn-facts { margin: 14px 0 0; font-size: 12.5px; font-weight: 700; color: var(--ink-faint); }

/* ---------------- 결과 화면 ---------------- */
.hn-eyebrow { margin: 4px 0 12px; text-align: center; font-size: 20px; font-weight: var(--display-weight); line-height: 1.3; }
.hn-card-wrap { border: 3px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.hn-card { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; }
.hn-h3 { margin: 18px 0 8px; font-size: 16px; font-weight: var(--display-weight); line-height: 1.3; }
.hn-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.hn-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
  padding: 8px 4px 6px; border: 2.5px solid var(--line); border-radius: 14px; background: #fffaf0; color: var(--ink);
  cursor: pointer;
}
.hn-chip.is-on { background: var(--gold); box-shadow: 3px 3px 0 var(--ink); }
.hn-chip-glyph { font-size: 26px; line-height: 1.15; }
.hn-chip-brush .hn-chip-glyph { font-family: 'Nanum Brush Script', var(--font-hangul); font-size: 30px; }
.hn-chip-cute .hn-chip-glyph { font-family: 'Gaegu', var(--font-hangul); font-weight: 700; color: #d6336c; }
.hn-chip-bold .hn-chip-glyph { font-family: 'Black Han Sans', var(--font-hangul); color: var(--blue); }
.hn-chip-classic .hn-chip-glyph { font-family: 'Nanum Myeongjo', serif; font-weight: 800; }
.hn-chip-name { max-width: 100%; font-size: 12.5px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; text-align: center; }
.hn-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hn-actions .hn-btn { margin-top: 16px; min-height: 52px; padding: 10px 8px; font-size: 16px; }
.hn-status { min-height: 1.5em; margin: 10px 0 0; text-align: center; font-size: 14px; font-weight: 800; color: var(--green); }
.hn-status.is-bad { color: var(--red-2); }
.hn-breakdown { display: grid; gap: 10px; }
.hn-word { padding: 12px 14px; background: #fffaf0; border: 2.5px solid var(--line); border-radius: 14px; }
.hn-word-src { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0 0 8px; font-size: 15px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.hn-word-src b { font-family: var(--font-hangul); font-weight: 400; font-size: 20px; color: var(--red); }
.hn-word-latin { font-size: 12.5px; font-weight: 700; color: var(--ink-faint); }
.hn-arrow { color: var(--ink-faint); }
.hn-blocks { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.hn-blocks li {
  display: flex; flex-direction: column; align-items: center; min-width: 52px;
  padding: 6px 8px 4px; border-radius: 10px; background: #fff; border: 2px solid var(--paper-2);
}
.hn-bh { font-family: var(--font-hangul); font-size: 28px; line-height: 1.2; color: var(--ink); }
.hn-br { font-family: var(--font-sans); font-size: 13px; font-weight: 700; line-height: 1.3; color: var(--blue); }
.hn-note { margin: 14px 0 0; padding: 10px 12px; border: 2px dashed var(--blue); border-radius: 12px; background: #fffaf0; font-size: 13.5px; line-height: 1.5; color: var(--ink-dim); }

/* ---------------- 개인정보처리방침 ---------------- */
.hn-doc { padding: 28px 0 36px; line-height: 1.8; font-size: 14.5px; color: var(--ink-dim); }
.hn-doc h1 { font-size: 24px; font-weight: var(--display-weight); color: var(--ink); margin-bottom: 20px; }
.hn-doc h2 { font-size: 16px; font-weight: 800; color: var(--ink); margin: 26px 0 8px; }
.hn-doc a { color: var(--red); text-decoration: underline; }

.site-footer { margin-top: 28px; }

/* 언어별 */
html:lang(th) .hn-h1-main, html:lang(th) .hn-eyebrow, html:lang(th) .hn-btn { line-height: 1.5; letter-spacing: 0; }
html:lang(th) .hn-label, html:lang(th) .hn-chip-name, html:lang(th) .hn-word-src { line-height: 1.5; }
html:lang(vi) .hn-h1-main { line-height: 1.35; }
html:lang(ja) .hn-h1-main, html:lang(ja) .hn-hook { word-break: auto-phrase; }

@media (max-width: 374px) {
  .hn-h1-main { font-size: 27px; }
  .hn-tile { width: 44px; height: 44px; font-size: 24px; }
  .hn-tile-big { width: 66px; height: 66px; font-size: 40px; }
  .hn-actions .hn-btn { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .hn-tile { animation: none; }
  .hn-btn { transition: none; }
}
