/* apps/ghost/style.css — 나만의 유령 만들기: 달빛 남보라 밤 + 라벤더·민트 유령빛.
 * 모바일 한 줄(--app-width 480px). 글꼴은 언어 파일 fonts → :root 변수(--font-display 등, 생성기가 이 파일 뒤에 둔다).
 * 공통 타이틀 바(G.topBar)·끝 화면(data-mg-end)은 --mg-* 변수로만 색을 맞춘다.
 * 유령 그림의 둥실둥실(.gh-float / .gh-shadow)은 큰 그림(시작·편집기·끝 화면)에만, prefers-reduced-motion 이면 멈춘다.
 */
:root {
  --night-0: #0c0920;
  --night-1: #1a1440;
  --night-2: #2f2466;
  --lav: #c9b8ff;
  --lav-2: #9f86ff;
  --mint: #9ff0d0;
  --moon: #fff3c4;
  --ink: #f5f1ff;
  --ink-dim: rgba(245, 241, 255, 0.76);
  --ink-faint: rgba(245, 241, 255, 0.46);
  --card: rgba(255, 255, 255, 0.07);
  --line: rgba(201, 184, 255, 0.32);
  --on-lav: #1a1238;

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

  /* 공통 타이틀 바 · 언어 선택 */
  --mg-top-fg: var(--ink);
  --mg-top-badge-bg: var(--lav);
  --mg-top-badge-fg: var(--on-lav);
  --lang-bg: rgba(245, 241, 255, 0.07);
  --lang-fg: var(--ink);
  --lang-border: rgba(201, 184, 255, 0.38);
  /* 공통 끝 화면 */
  --mg-star-on: #ffd98a;
  --mg-star-off: rgba(245, 241, 255, 0.2);
  --mg-heart-bg: rgba(255, 128, 170, 0.1);
  --mg-heart-border: rgba(255, 128, 170, 0.42);
  --mg-heart-fg: #ffa3c2;
  --mg-heart-on: #ff6f9c;
  --mg-share-bg: rgba(245, 241, 255, 0.06);
  --mg-share-border: rgba(245, 241, 255, 0.16);
  --mg-x: var(--ink);
  --mg-tiktok: var(--ink);
  --mg-faq-bg: rgba(245, 241, 255, 0.05);
  --mg-faq-border: rgba(201, 184, 255, 0.26);
  --mg-end-retry-bg: linear-gradient(135deg, var(--mint), var(--lav));
  --mg-end-retry-fg: var(--on-lav);
  --toast-bg: rgba(47, 36, 102, 0.96);
}

html { background: var(--night-0); }
body.gh-body {
  min-height: 100vh;
  background: radial-gradient(ellipse 130% 70% at 50% -10%, var(--night-2), var(--night-1) 45%, var(--night-0) 80%) fixed;
  color: var(--ink);
  line-height: 1.6;
  word-break: var(--wb);
  hyphens: var(--hyphens);
  -webkit-hyphens: var(--hyphens);
}
[hidden] { display: none !important; }

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

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

.gh-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 56px;
  padding: 12px 18px;
  border: 0; border-radius: 999px;
  font-size: 19px; font-weight: var(--display-weight);
  line-height: 1.25;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.gh-btn-primary {
  background: linear-gradient(135deg, var(--mint), var(--lav) 55%, var(--lav-2));
  color: var(--on-lav);
  box-shadow: 0 10px 28px -8px rgba(159, 134, 255, 0.7), inset 0 -4px 0 rgba(40, 20, 110, 0.22);
}
.gh-btn-soft {
  background: rgba(245, 241, 255, 0.08);
  color: var(--ink);
  border: 1.5px solid rgba(201, 184, 255, 0.42);
}
.gh-btn-sm { min-height: 50px; font-size: 16px; padding: 10px 12px; }
.gh-btn:active { transform: scale(0.97); }
.gh-btn:disabled { opacity: 0.6; cursor: progress; }
.gh-btn:focus-visible, .gh-opt:focus-visible, .gh-tab:focus-visible, .gh-preview:focus-visible {
  outline: 3px solid var(--moon); outline-offset: 3px;
}

/* ---------------- 유령 둥실둥실 (큰 그림만) ---------------- */
.gh-hero-art .gh-float, .gh-preview-art .gh-float, .gh-end-art .gh-float { animation: gh-float 3.2s ease-in-out infinite; }
.gh-hero-art .gh-shadow, .gh-preview-art .gh-shadow, .gh-end-art .gh-shadow { animation: gh-shadow 3.2s ease-in-out infinite; transform-origin: 200px 356px; }
@keyframes gh-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes gh-shadow { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.84); } }

/* ---------------- 시작 화면 (티징만) ---------------- */
.gh-start { text-align: center; padding-top: 18px; }
.gh-badge {
  display: inline-block; margin: 0 0 8px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(159, 134, 255, 0.16); border: 1px solid var(--line);
  color: var(--lav); font-size: 14px; font-weight: var(--display-weight); line-height: 1.3;
}
.gh-hero-art {
  width: 220px; height: 220px; margin: 0 auto;
  border-radius: 36px; overflow: hidden;
  box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(201, 184, 255, 0.22), 0 0 44px -10px rgba(159, 134, 255, 0.5);
}
.gh-hero-art svg { display: block; width: 100%; height: 100%; }
.gh-h1 { margin: 16px 0 10px; line-height: 1.15; font-weight: var(--display-weight); }
.gh-kicker { display: block; margin-bottom: 6px; font-size: 15px; letter-spacing: 0.03em; color: var(--mint); }
.gh-h1-main { display: block; font-size: 40px; color: var(--ink); text-shadow: 0 4px 0 rgba(12, 9, 32, 0.6); }
.gh-h1-main em { font-style: normal; color: var(--lav); text-shadow: 0 0 22px rgba(159, 134, 255, 0.6), 0 4px 0 rgba(12, 9, 32, 0.6); }
.gh-hook { margin: 0 auto 20px; max-width: 360px; font-size: 16px; color: var(--ink-dim); }

/* ---------------- 편집기 ---------------- */
.gh-edit-title { margin: 0 0 10px; font-size: 22px; line-height: 1.3; text-align: center; font-weight: var(--display-weight); color: var(--mint); }
.gh-preview {
  display: block; width: 100%; max-width: 340px; aspect-ratio: 1 / 1; margin: 0 auto;
  padding: 0; border: 0; border-radius: 30px; overflow: hidden;
  background: var(--night-1); cursor: pointer;
  box-shadow: 0 22px 44px -22px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(201, 184, 255, 0.22);
  -webkit-tap-highlight-color: transparent;
}
.gh-preview-art, .gh-preview-art svg { display: block; width: 100%; height: 100%; }
.gh-preview.is-bump .gh-preview-art { animation: gh-bump 0.32s ease; }
@keyframes gh-bump { 0% { transform: scale(1); } 40% { transform: scale(0.95) rotate(-1.5deg); } 100% { transform: scale(1); } }
.gh-hint { margin: 8px 0 12px; font-size: 13.5px; text-align: center; color: var(--ink-faint); }

/* 탭: 좁은 화면에서는 가로 스크롤 (페이지는 넘치지 않음) */
.gh-tabs {
  display: flex; gap: 8px; margin: 0 -16px 10px; padding: 2px 16px 6px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.gh-tabs::-webkit-scrollbar { display: none; }
.gh-tab {
  flex: 0 0 auto; min-height: 44px; padding: 8px 16px;
  border-radius: 999px; border: 1.5px solid rgba(245, 241, 255, 0.16);
  background: rgba(12, 9, 32, 0.45); color: var(--ink-dim);
  font-size: 15px; font-weight: var(--display-weight); line-height: 1.2; white-space: nowrap; cursor: pointer;
}
.gh-tab.is-on { background: linear-gradient(135deg, var(--mint), var(--lav)); border-color: transparent; color: var(--on-lav); }

.gh-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.gh-opt {
  position: relative; aspect-ratio: 1 / 1; min-width: 0; min-height: 64px;
  padding: 0; border-radius: 18px; overflow: hidden;
  border: 2px solid rgba(245, 241, 255, 0.12);
  background: rgba(12, 9, 32, 0.5); cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.gh-opt.is-face { padding: 5px; }
.gh-opt svg { display: block; width: 100%; height: 100%; }
.gh-opt[aria-pressed="true"] { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(159, 240, 208, 0.28), 0 0 18px rgba(159, 134, 255, 0.5); }
.gh-opt[aria-pressed="true"]::after {
  content: '✓'; position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--mint); color: var(--on-lav); font-size: 12px; font-weight: 900; line-height: 1;
}
.gh-opt:active { transform: scale(0.95); }

.gh-name { display: block; margin-bottom: 14px; }
.gh-name-label { display: block; margin: 0 0 6px 4px; font-size: 15px; font-weight: var(--display-weight); color: var(--lav); }
.gh-name-input {
  box-sizing: border-box; width: 100%; min-height: 52px; padding: 12px 16px;
  border-radius: 16px; border: 1.5px solid rgba(201, 184, 255, 0.38);
  background: rgba(12, 9, 32, 0.55); color: var(--ink);
  font: inherit; font-size: 17px;
}
.gh-name-input::placeholder { color: var(--ink-faint); }
.gh-name-input:focus { outline: none; border-color: var(--mint); box-shadow: 0 0 0 3px rgba(159, 240, 208, 0.25); }

.gh-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gh-actions .gh-btn { font-size: 17px; padding: 10px 12px; }
.gh-edit .mg-ad { margin-top: 20px; }

/* ---------------- 끝 화면 ---------------- */
.gh-card {
  margin-top: 6px; padding: 18px 16px 16px;
  border-radius: 28px; text-align: center;
  background: radial-gradient(120% 60% at 50% 0%, rgba(159, 240, 208, 0.18), transparent 70%), linear-gradient(180deg, rgba(47, 36, 102, 0.88), rgba(26, 20, 64, 0.94));
  border: 1.5px solid rgba(201, 184, 255, 0.42);
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.8);
}
.gh-eyebrow { margin: 0 0 10px; font-size: 16px; font-weight: var(--display-weight); line-height: 1.35; color: var(--mint); }
.gh-end-art {
  width: 100%; max-width: 320px; aspect-ratio: 1 / 1; margin: 0 auto;
  border-radius: 26px; overflow: hidden;
  box-shadow: 0 18px 36px -18px rgba(0, 0, 0, 0.8);
}
.gh-end-art svg { display: block; width: 100%; height: 100%; }
.gh-end-name { margin: 14px 0 12px; font-size: 30px; line-height: 1.2; font-weight: var(--display-weight); color: var(--ink); overflow-wrap: anywhere; text-shadow: 0 0 18px rgba(159, 134, 255, 0.55); }
.gh-end-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.gh-save-status { min-height: 1.4em; margin: 8px 0 0; font-size: 13.5px; color: var(--ink-dim); }
.gh-save-status.is-bad { color: #ffa3c2; }

/* ---------------- 개인정보 ---------------- */
.gh-doc { padding: 16px 0; font-size: 15px; line-height: 1.75; color: var(--ink-dim); }
.gh-doc h1 { font-size: 28px; color: var(--ink); margin: 8px 0 12px; line-height: 1.25; }
.gh-doc h2 { font-size: 17px; color: var(--lav); margin: 22px 0 6px; }
.gh-doc a { text-decoration: underline; }

.site-footer { color: var(--ink-faint); }

/* 언어별 조정 */
html:lang(th) .gh-body { line-height: 1.75; }
html:lang(th) :is(.gh-h1-main, .gh-end-name, .gh-edit-title, .gh-tab, .gh-btn) { line-height: 1.45; letter-spacing: 0; }
html:lang(th) .gh-kicker { letter-spacing: 0; }
html:lang(vi) :is(.gh-h1-main, .gh-end-name) { line-height: 1.3; }

@media (max-width: 374px) {
  .gh-h1-main { font-size: 34px; }
  .gh-end-name { font-size: 26px; }
  .gh-options { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .gh-float, .gh-shadow, .gh-preview.is-bump .gh-preview-art { animation: none !important; }
  .gh-btn, .gh-opt { transition: none; }
}
