/* apps/attach/style.css — 애착 유형 테스트: 복숭아빛 점무늬 종이 + 자두색 잉크 + 산호색 포인트, 다가가는 두 동그라미 그림(tools/art.js).
 * 결과 페이지는 그 결과 색(--c-main 강조 · --c-deep 글자 · --c-ink 옅은 바탕)으로 물든다.
 * 모바일 한 줄(--app-width 480px). 글꼴은 언어 파일 fonts → :root 변수(--font-display 등, 생성기가 이 파일 뒤에 둔다).
 * 공통 타이틀 바(G.topBar)·끝 화면(data-mg-end)은 --mg-* 변수로만 색을 맞춘다.
 */
:root {
  --paper: #fff4ee;
  --paper-2: #fffaf7;
  --navy: #3d2c4e;
  --navy-2: #5a4570;
  --mustard: #ff8a72;
  --mustard-deep: #d9573f;
  --ink: #3d2c4e;
  --ink-dim: #5e4f6b;
  --ink-faint: #8a7d95;
  --card: #ffffff;
  --line: rgba(61, 44, 78, 0.16);
  --grid: rgba(61, 44, 78, 0.12);
  /* 결과 색 (결과 페이지 body 의 style 이 덮어쓴다) */
  --c-main: #ff8a72;
  --c-deep: #3d2c4e;
  --c-ink: #fff1ec;

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

  /* 공통 타이틀 바 · 언어 선택 */
  --mg-top-fg: var(--navy);
  --mg-top-badge-bg: var(--navy);
  --mg-top-badge-fg: #fff;
  --lang-bg: #fff;
  --lang-fg: var(--navy);
  --lang-border: rgba(61, 44, 78, 0.25);
  /* 공통 끝 화면 */
  --mg-star-on: var(--mustard);
  --mg-star-off: rgba(61, 44, 78, 0.18);
  --mg-heart-bg: #fff0f3;
  --mg-heart-border: #f6b2c2;
  --mg-heart-fg: #d94a6e;
  --mg-heart-on: #e8506f;
  --mg-share-bg: #fff;
  --mg-share-border: rgba(61, 44, 78, 0.16);
  --mg-x: var(--navy);
  --mg-tiktok: var(--navy);
  --mg-faq-bg: #fff;
  --mg-faq-border: rgba(61, 44, 78, 0.14);
  --mg-end-retry-bg: var(--navy);
  --mg-end-retry-fg: #fff;
  --toast-bg: rgba(61, 44, 78, 0.95);
}

html { background: var(--paper); }
body.at-body {
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(var(--grid) 1.6px, transparent 1.8px);
  background-size: 22px 22px;
  color: var(--ink);
  line-height: 1.6;
  word-break: var(--wb);
  hyphens: var(--hyphens);
  -webkit-hyphens: var(--hyphens);
}
body.at-result-page {
  background-image:
    radial-gradient(ellipse 120% 40% at 50% -8%, color-mix(in srgb, var(--c-main) 26%, transparent), transparent 70%),
    radial-gradient(var(--grid) 1.6px, transparent 1.8px);
  background-size: auto, 22px 22px;
}
[hidden] { display: none !important; }
a { color: inherit; }

/* 제목·버튼 글꼴: base.css 의 :lang(zh|th|vi) 규칙보다 뒤에서 다시 지정 */
.at-h1, .at-kicker, .at-h1-main, .at-h1-main em, .at-badge, .at-btn, .at-q-text, .at-q-num, .at-result-name, .at-eyebrow, .at-vibe, .at-sub,
.at-loading-text, .at-cta strong, .at-doc h1, .at-progress-num, .at-meta span, .at-lean-label, .at-lean-end,
.at-keys li, .at-result-nick, .at-match-label, .at-match-who {
  font-family: var(--font-display);
}

/* ---------------- 배경: 천천히 떠다니는 작은 도구들 (고정, 가로 넘침 없음) ---------------- */
.at-sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.at-float {
  position: absolute; font-size: 26px; line-height: 1; opacity: 0.22;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  animation: at-drift 9s ease-in-out infinite alternate;
}
.at-float-1 { top: 14%; left: calc(50% - 240px - 54px); }
.at-float-2 { top: 38%; right: calc(50% - 240px - 50px); animation-delay: -3s; }
.at-float-3 { top: 70%; left: calc(50% - 240px - 46px); animation-delay: -6s; }
.at-float-4 { top: 84%; right: calc(50% - 240px - 56px); animation-delay: -1.5s; }
@keyframes at-drift { from { transform: translateY(10px) rotate(-8deg); } to { transform: translateY(-12px) rotate(8deg); } }

.mg-top, .at-shell { position: relative; z-index: 1; }

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

.at-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 58px;
  padding: 12px 20px;
  border: 0; border-radius: 16px;
  font-size: 21px; font-weight: var(--display-weight);
  line-height: 1.25;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.at-btn-primary {
  background: var(--mustard);
  color: var(--navy);
  border: 3px solid var(--navy);
  box-shadow: 0 5px 0 var(--navy);
}
.at-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--navy); }
.at-btn:focus-visible, .at-choice:focus-visible, .at-back:focus-visible { outline: 3px dashed var(--navy); outline-offset: 4px; }

/* ---------------- 그림: 다가가는 두 동그라미 + 이모지 ---------------- */
.at-hero { position: relative; display: grid; place-items: center; width: 188px; height: 188px; margin: 10px auto 0; }
.at-art {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  filter: drop-shadow(0 10px 18px color-mix(in srgb, var(--h-main) 30%, transparent));
}
.at-pair-l { animation: at-near-l 3.6s ease-in-out infinite; }
.at-pair-r { animation: at-near-r 3.6s ease-in-out infinite; }
@keyframes at-near-l { 0%, 100% { transform: translateX(-4px); } 50% { transform: translateX(3px); } }
@keyframes at-near-r { 0%, 100% { transform: translateX(4px); } 50% { transform: translateX(-3px); } }
.at-emo {
  position: relative; top: -8px; font-size: 40px; line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  animation: at-bob 2.8s ease-in-out infinite;
}
.at-q {
  position: absolute; right: -2px; top: -2px; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mustard); color: var(--navy); border: 3px solid var(--navy);
  font: 900 28px/1 'Nunito', sans-serif;
  box-shadow: 0 4px 0 var(--navy);
  animation: at-bob 2.2s ease-in-out infinite reverse;
}
@keyframes at-bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-4px) rotate(4deg); } }
.at-hero-loading { width: 170px; height: 170px; margin-bottom: 14px; }
.at-hero-loading .at-emo { top: -7px; font-size: 36px; animation-duration: 0.9s; }
.at-hero-result { width: 176px; height: 176px; margin: 0 auto; }
.at-hero-result .at-emo { font-size: 38px; top: -7px; }

/* ---------------- 시작 화면 (티징만) ---------------- */
.at-start { text-align: center; padding-top: 16px; }
.at-badge {
  display: inline-block; margin: 0 0 4px;
  padding: 5px 14px; border-radius: 999px;
  background: #fff; border: 2px solid var(--navy);
  color: var(--navy); font-size: 15px; font-weight: var(--display-weight); line-height: 1.3;
}
.at-h1 { margin: 12px 0 10px; line-height: 1.15; font-weight: var(--display-weight); }
.at-kicker { display: block; margin-bottom: 8px; font-size: 17px; color: var(--mustard-deep); letter-spacing: 0.02em; }
.at-h1-main { display: block; font-size: 35px; line-height: 1.22; color: var(--navy); }
.at-h1-main em {
  font-style: normal;
  background: linear-gradient(transparent 58%, rgba(255, 138, 114, 0.55) 58%);
  padding: 0 2px;
}
.at-hook { margin: 0 auto 14px; max-width: 390px; font-size: 16px; color: var(--ink-dim); }
.at-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; font-size: 15px; color: var(--ink-dim); }
.at-meta span { padding: 4px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }

/* ---------------- 질문 ---------------- */
.at-progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.at-back {
  flex: 0 0 auto; width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 2px solid var(--navy); border-radius: 50%;
  background: #fff; color: var(--navy); cursor: pointer;
}
.at-progress { flex: 1; height: 12px; border-radius: 999px; background: rgba(61, 44, 78, 0.1); overflow: hidden; }
.at-progress-fill { height: 100%; width: 0; border-radius: inherit; background: var(--mustard); transition: width 0.3s ease; }
.at-progress-num { flex: 0 0 auto; font-size: 16px; color: var(--ink-dim); min-width: 3.4em; text-align: right; }

.at-q-card {
  position: relative;
  padding: 20px 16px 16px;
  border-radius: 20px;
  background: var(--card);
  border: 2.5px solid var(--navy);
  box-shadow: 0 6px 0 var(--navy);
  animation: at-in 0.28s ease;
}
@keyframes at-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.at-q-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.at-q-emoji { font-size: 28px; line-height: 1; }
.at-q-num { font-size: 17px; color: var(--mustard-deep); font-weight: var(--display-weight); }
.at-q-text { margin: 0 0 16px; font-size: 21px; line-height: 1.4; font-weight: var(--display-weight); color: var(--navy); }
.at-choices { display: flex; flex-direction: column; gap: 10px; }
.at-choice {
  width: 100%; min-height: 54px;
  padding: 12px 16px;
  text-align: left;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 16px; line-height: 1.4; font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
@media (hover: hover) { .at-choice:hover { border-color: var(--navy); background: #ffe7df; } }
.at-choice:active { transform: scale(0.985); }
.at-choice.is-picked { border-color: var(--navy); background: var(--mustard); box-shadow: 0 3px 0 var(--navy); }
.at-quiz .mg-ad { margin-top: 20px; }

/* ---------------- 답 정리하는 중 ---------------- */
.at-loading { text-align: center; padding: 40px 0; }
.at-loading-text { margin: 0 0 4px; font-size: 23px; font-weight: var(--display-weight); color: var(--navy); }
.at-loading-sub { margin: 0; font-size: 14px; color: var(--mustard-deep); font-weight: 700; }

/* ---------------- 결과 ---------------- */
.at-cta {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 0 14px; padding: 12px 16px;
  border-radius: 16px; border: 2px solid var(--navy);
  background: #ffe7df; color: var(--navy); text-decoration: none;
  box-shadow: 0 4px 0 var(--navy);
}
.at-cta-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.at-cta-text strong { font-size: 17px; font-weight: var(--display-weight); }
.at-cta-text span { font-size: 14px; color: var(--ink-dim); }
.at-cta-arrow { font-size: 22px; }

.at-card {
  position: relative;
  margin-top: 14px; padding: 18px 18px 20px;
  text-align: center;
  background: var(--card);
  border: 2.5px solid var(--navy);
  border-radius: 22px;
  box-shadow: 0 7px 0 var(--navy);
}
.at-eyebrow { margin: 8px 0 0; font-size: 16px; font-weight: var(--display-weight); color: var(--ink-dim); }
.at-result-title { margin: 6px 0 0; line-height: 1.2; }
.at-result-nick { display: block; margin-top: 4px; font-size: 18px; font-weight: var(--display-weight); line-height: 1.3; color: var(--ink-dim); }
.at-result-name { display: block; font-size: 32px; font-weight: var(--display-weight); line-height: 1.2; color: var(--c-deep); overflow-wrap: break-word; }
.at-vibe { margin: 10px 0 0; font-size: 18px; line-height: 1.45; font-weight: var(--display-weight); color: var(--navy); }
.at-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.at-keys li {
  padding: 4px 12px; border-radius: 999px;
  background: var(--c-ink); border: 1.5px solid var(--c-main);
  color: var(--c-deep); font-size: 14px; font-weight: var(--display-weight); line-height: 1.35;
}

/* 내 답이 기운 쪽 (방금 푼 사람만, 점 위치는 result.js 가 채움) */
.at-lean { margin: 14px 0 0; padding: 12px 14px; border-radius: 16px; background: var(--paper-2); border: 1.5px solid var(--line); text-align: left; }
.at-lean-label { display: block; font-size: 14px; font-weight: var(--display-weight); color: var(--ink-dim); margin-bottom: 6px; }
.at-lean-row { display: grid; grid-template-columns: minmax(0, 1fr) 24% minmax(0, 1fr); align-items: center; gap: 10px; margin: 8px 0 0; font-size: 12.5px; line-height: 1.25; }
.at-lean-end { font-weight: 800; color: var(--navy); overflow-wrap: anywhere; }
.at-lean-end-r { text-align: right; }
.at-lean-track { position: relative; display: block; height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--c-main), rgba(61, 44, 78, 0.1) 50%, var(--navy-2)); opacity: 0.9; }
.at-lean-dot { position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: #fff; border: 4px solid var(--navy); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: left 0.8s ease; }

.at-same {
  display: inline-block; margin: 12px 0 0; padding: 4px 14px; border-radius: 999px;
  background: var(--c-ink); border: 1.5px dashed var(--c-main);
  color: var(--c-deep); font-size: 13.5px; font-weight: 800;
}
.at-desc { margin: 14px 0 4px; font-size: 15.5px; line-height: 1.75; color: var(--ink-dim); text-align: left; }
.at-sub { margin: 18px 0 8px; font-size: 18px; font-weight: var(--display-weight); color: var(--c-deep); text-align: left; line-height: 1.3; }

.at-strengths { margin: 0; padding: 0; list-style: none; text-align: left; }
.at-strengths li { position: relative; margin: 0 0 6px; padding: 0 0 0 26px; font-size: 15px; line-height: 1.55; color: var(--ink-dim); }
.at-strengths li::before { content: '✓'; position: absolute; left: 4px; top: 0; font-weight: 900; color: var(--c-deep); }
.at-note { margin-top: 14px; padding: 2px 14px 12px; border-radius: 14px; background: var(--c-ink); border: 1.5px dashed var(--c-main); text-align: left; }
.at-note .at-sub { margin: 10px 0 4px; font-size: 16px; }
.at-note .at-tips { margin-top: 4px; }

.at-tips { margin: 0; padding: 0 0 0 22px; text-align: left; }
.at-tips li { margin: 0 0 8px; font-size: 15px; line-height: 1.6; color: var(--ink-dim); }
.at-tips li::marker { font-weight: 900; color: var(--c-deep); }

/* 편안한 짝: 보여주기만 (링크·hover·pointer 없음 — 누를 수 있어 보이지 않게) */
.at-match {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-top: 16px; padding: 12px 14px 14px; border-radius: 16px;
  background: var(--paper-2); border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
  cursor: default; user-select: none;
}
.at-match-label { font-size: 13.5px; font-weight: var(--display-weight); line-height: 1.3; color: var(--ink-dim); }
.at-match-who { display: inline-flex; align-items: center; gap: 6px; font-size: 18px; font-weight: var(--display-weight); line-height: 1.3; color: var(--navy); }
.at-match-emo { font-size: 26px; line-height: 1.1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.at-match-why { margin: 2px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--ink-dim); }

/* 재미용 안내 */
.at-disclaimer { margin: 14px 0 0; padding: 8px 12px; border-radius: 12px; background: #fff; border: 1.5px dashed rgba(61, 44, 78, 0.3); font-size: 13px; line-height: 1.5; color: var(--ink-dim); text-align: center; }

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

.site-footer { position: relative; z-index: 1; color: var(--ink-faint); }

/* 언어별 조정 */
html:lang(th) .at-body { line-height: 1.75; }
html:lang(th) :is(.at-h1-main, .at-result-name, .at-q-text, .at-vibe) { line-height: 1.5; letter-spacing: 0; }
html:lang(th) :is(.at-kicker, .at-badge, .at-lean-label) { letter-spacing: 0; }
html:lang(vi) :is(.at-h1-main, .at-result-name, .at-q-text) { line-height: 1.4; }
html:lang(ru) .at-doc h1 { line-height: 1.25; }
html:lang(de) :is(.at-match-label, .at-lean-end, .at-result-name, .at-result-nick) { hyphens: auto; -webkit-hyphens: auto; }
html:lang(ja) :is(.at-h1-main, .at-result-name, .at-q-text, .at-vibe) { word-break: auto-phrase; }
html:lang(ko) :is(.at-h1-main, .at-result-name, .at-q-text, .at-vibe, .at-hook, .at-desc, .at-tips li, .at-match-why, .at-strengths li, .at-result-nick) { word-break: keep-all; }

@media (max-width: 374px) {
  .at-h1-main { font-size: 30px; }
  .at-result-name { font-size: 28px; }
  .at-q-text { font-size: 19px; }
  .at-hero-result { width: 160px; height: 160px; }
  .at-hero-result .at-emo { font-size: 34px; top: -6px; }
}

@media (prefers-reduced-motion: reduce) {
  .at-float, .at-pair-l, .at-pair-r, .at-emo, .at-q, .at-q-card { animation: none !important; }
  .at-progress-fill, .at-btn, .at-choice, .at-lean-dot { transition: none; }
}
