/* apps/truth/style.css — 진실 게임: 짙은 남보라 파티 밤 + 금빛 색종이, 크림색 카드. 진실 = 청록, 도전 = 산호색.
 * 모바일 한 줄(--app-width 480px). 카드는 납작해졌다 펴지는 뒤집기(.td-flip.is-flipped), 움직임 줄이기면 바로 바뀜.
 * 제목·버튼·이름은 언어 파일 fonts → :root 변수(--font-display 등, 생성기가 이 파일 뒤에 둔다).
 * 공통 타이틀 바(G.topBar)·끝 화면(data-mg-end)은 --mg-* 변수로만 색을 맞춘다.
 */
:root {
  --night: #1f1638;
  --night-2: #2a1f4a;
  --night-deep: #150f27;
  --cream: #fff8ee;
  --cream-2: #f2e8da;
  --ink: #221a33;
  --ink-dim: rgba(34, 26, 51, 0.78);
  --ink-faint: rgba(34, 26, 51, 0.58);
  --on-night: #fff8ee;
  --on-night-dim: rgba(255, 248, 238, 0.78);
  --gold: #ffc94a;
  --gold-2: #d99a12;
  --truth: #17a6a0;
  --truth-2: #0d7a75;
  --dare: #ff6b57;
  --dare-2: #cf4535;
  --random: #8f6bff;
  --random-2: #6a46db;
  --line: rgba(34, 26, 51, 0.14);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 14px 28px -16px rgba(0, 0, 0, 0.7);

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

  --mg-top-fg: var(--on-night);
  --mg-top-badge-bg: var(--gold);
  --mg-top-badge-fg: var(--ink);
  --lang-bg: var(--night-deep);
  --lang-fg: var(--on-night);
  --lang-border: rgba(255, 248, 238, 0.28);
  --mg-star-on: var(--gold);
  --mg-star-off: rgba(255, 248, 238, 0.28);
  --mg-heart-bg: var(--night-deep);
  --mg-heart-border: var(--dare);
  --mg-heart-fg: #ff9a8c;
  --mg-heart-on: var(--dare);
  --mg-share-bg: rgba(255, 248, 238, 0.1);
  --mg-share-border: rgba(255, 248, 238, 0.26);
  --mg-share-primary-bg: var(--gold);
  --mg-share-primary-fg: var(--ink);
  --mg-x: currentColor;
  --mg-tiktok: currentColor;
  --mg-faq-bg: rgba(255, 248, 238, 0.08);
  --mg-faq-border: rgba(255, 248, 238, 0.24);
  --mg-end-retry-bg: var(--gold);
  --mg-end-retry-fg: var(--ink);
  --toast-bg: var(--cream);
  --toast-fg: var(--ink);
}

html { background: var(--night); }
body.td-body {
  min-height: 100vh;
  color: var(--on-night);
  line-height: 1.6;
  word-break: var(--wb);
  hyphens: var(--hyphens);
  -webkit-hyphens: var(--hyphens);
  background-color: var(--night);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 201, 74, 0.55) 0 3px, transparent 4px),
    radial-gradient(circle at 86% 10%, rgba(23, 166, 160, 0.6) 0 3px, transparent 4px),
    radial-gradient(circle at 72% 46%, rgba(255, 107, 87, 0.5) 0 3px, transparent 4px),
    radial-gradient(circle at 20% 64%, rgba(143, 107, 255, 0.55) 0 3px, transparent 4px),
    radial-gradient(ellipse at 50% -10%, rgba(143, 107, 255, 0.35), transparent 60%);
  background-attachment: fixed;
}
[hidden] { display: none !important; }

/* base.css :lang(zh|th|vi) 가 모든 요소 글꼴을 덮으므로 제목 요소에 다시 지정 */
.td-h1, .td-kicker, .td-h1-main, .td-h1-main em, .td-btn, .td-h2, .td-seg-btn, .td-pack-name, .td-label, .td-round, .td-chip, .td-mini,
.td-turn-kicker, .td-turn-name, .td-choose-label, .td-pick, .td-front-mark, .td-card-type, .td-card-text, .td-sum-kicker, .td-stat dd, .td-doc h1 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
}

.td-shell { max-width: var(--app-width); margin: 0 auto; padding: 8px 16px 0; overflow-x: clip; }
.td-screen { padding-top: 10px; }

/* ---------------- 제목 ---------------- */
.td-h1 { margin: 4px 0 6px; text-align: center; line-height: 1.15; }
.td-kicker {
  display: inline-block; margin-bottom: 10px; padding: 2px 14px; border-radius: 999px;
  background: var(--gold); color: var(--ink); font-size: 15px; line-height: 1.6; box-shadow: 0 3px 0 var(--gold-2);
}
.td-h1-main { display: block; font-size: 30px; color: var(--on-night); overflow-wrap: break-word; }
.td-h1-main em { font-style: normal; color: var(--gold); }
.td-hook { margin: 6px auto 14px; max-width: 30em; text-align: center; font-size: 15px; color: var(--on-night-dim); }

/* ---------------- 카드·설정 ---------------- */
.td-card { background: var(--cream); color: var(--ink); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.td-form { display: grid; gap: 10px; }
.td-label { display: block; margin: 0; font-size: 15px; color: var(--ink); line-height: 1.4; }
.td-label-sm { font-size: 14px; color: var(--ink-dim); }
.td-hint { margin: 0; font-size: 12.5px; color: var(--ink-faint); line-height: 1.5; }
.td-free { padding: 8px 10px; border-radius: 12px; background: var(--cream-2); font-size: 13.5px; color: var(--ink-dim); }
.td-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--cream-2); }
.td-seg-btn {
  min-height: 44px; padding: 6px; border: 0; border-radius: 11px; background: transparent; color: var(--ink-dim);
  font-size: 15px; line-height: 1.2; cursor: pointer; overflow-wrap: anywhere;
}
.td-seg-btn[aria-checked="true"] { background: var(--night); color: var(--on-night); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.td-names { display: grid; gap: 6px; }
.td-textarea {
  width: 100%; min-height: 120px; padding: 10px 12px; border: 2px solid transparent; border-radius: 12px; resize: vertical;
  background: #fff; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.45;
}
.td-textarea::placeholder { color: var(--ink-faint); }
.td-textarea:focus { outline: none; border-color: var(--gold); }
.td-textarea[aria-invalid="true"] { border-color: var(--dare); }
.td-count { font-weight: 700; color: var(--ink-dim); white-space: nowrap; }
.td-count.is-bad { color: var(--dare-2); }
.td-packs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.td-pack {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; min-height: 84px; padding: 10px 10px 9px;
  border: 2px solid transparent; border-radius: 14px; background: var(--cream-2); color: var(--ink); text-align: left; cursor: pointer;
}
.td-pack[aria-checked="true"] { border-color: var(--night); background: #fff; box-shadow: 0 3px 0 var(--night); }
.td-pack-emoji { font-size: 22px; line-height: 1.1; }
.td-pack-name { font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; }
.td-pack-desc { font-size: 12px; line-height: 1.35; color: var(--ink-faint); overflow-wrap: anywhere; }
.td-error { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: #ffe2dc; color: #8c1d14; font-size: 14px; font-weight: 700; }

/* ---------------- 버튼 ---------------- */
.td-btn {
  display: block; width: 100%; min-height: 52px; padding: 10px 16px; border: 0; border-radius: 16px; cursor: pointer;
  font-size: 19px; line-height: 1.25; text-align: center; overflow-wrap: anywhere;
}
.td-btn-primary { margin-top: 14px; background: var(--gold); color: var(--ink); box-shadow: 0 5px 0 var(--gold-2); }
.td-btn-primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--gold-2); }
.td-btn-ghost { min-height: 46px; font-size: 16px; background: rgba(255, 248, 238, 0.12); color: var(--on-night); box-shadow: inset 0 0 0 2px rgba(255, 248, 238, 0.28); }
.td-card .td-btn-ghost { margin-top: 14px; background: var(--cream-2); color: var(--ink); box-shadow: none; }
.td-btn:focus-visible, .td-seg-btn:focus-visible, .td-pack:focus-visible, .td-mini:focus-visible, .td-pick:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.td-fair { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--on-night-dim); line-height: 1.5; }
.td-mini { flex: none; padding: 5px 14px; border: 0; border-radius: 999px; background: var(--cream); color: var(--ink); font-size: 14px; cursor: pointer; white-space: nowrap; }

/* ---------------- 진행 화면 ---------------- */
.td-bar { display: flex; align-items: center; gap: 8px; }
.td-round { margin: 0; flex: none; font-size: 15px; color: var(--gold); white-space: nowrap; }
.td-chip { flex: 1; min-width: 0; padding: 2px 10px; border-radius: 999px; background: rgba(255, 248, 238, 0.1); font-size: 13px; color: var(--on-night-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.td-turn { margin-top: 14px; text-align: center; }
.td-turn-kicker { margin: 0; font-size: 15px; color: var(--on-night-dim); }
.td-turn-name { margin: 0; font-size: 34px; line-height: 1.2; color: var(--on-night); overflow-wrap: anywhere; }
.td-turn-name.is-pop { animation: td-pop 0.35s ease-out; }
.td-turn-sub { margin: 2px 0 0; font-size: 14px; color: var(--on-night-dim); }
.td-choose { margin-top: 12px; text-align: center; }
.td-choose-label { margin: 0 0 8px; font-size: 18px; color: var(--gold); }
.td-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.td-pick {
  min-height: 56px; padding: 8px 4px; border: 0; border-radius: 16px; color: #fff; font-size: 18px; line-height: 1.2; cursor: pointer; overflow-wrap: anywhere;
}
.td-pick-truth { background: var(--truth); box-shadow: 0 5px 0 var(--truth-2); }
.td-pick-dare { background: var(--dare); box-shadow: 0 5px 0 var(--dare-2); }
.td-pick-random { background: var(--random); box-shadow: 0 5px 0 var(--random-2); }
.td-pick:active { transform: translateY(3px); box-shadow: none; }
.td-pick:disabled { opacity: 0.5; cursor: default; }

.td-card-wrap { margin-top: 18px; }
/* 카드 뒤집기: 옆으로 납작해졌다가(앞면) 다시 펴지며(뒷면) 보인다. 3D backface 에 기대지 않는다. */
.td-flip { position: relative; display: grid; min-height: 230px; }
.td-flip.is-flipped { animation: td-turn 0.5s ease-in-out; }
.td-face {
  grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 230px; padding: 22px 18px; border-radius: 22px; box-shadow: var(--shadow);
}
.td-back { visibility: hidden; }
.td-flip.is-flipped .td-front { visibility: hidden; animation: td-off 0.5s linear; }
.td-flip.is-flipped .td-back { visibility: visible; animation: td-on 0.5s linear; }
.td-front {
  background: repeating-linear-gradient(45deg, var(--night-2) 0 14px, var(--night-deep) 14px 28px);
  border: 3px solid var(--gold);
}
.td-front-mark { font-size: 86px; line-height: 1; color: var(--gold); text-shadow: 0 6px 0 rgba(0, 0, 0, 0.35); }
.td-back { background: var(--cream); color: var(--ink); text-align: center; border-top: 10px solid var(--truth); }
.td-flip.is-dare .td-back { border-top-color: var(--dare); }
.td-card-type { margin: 0; padding: 2px 14px; border-radius: 999px; background: var(--truth); color: #fff; font-size: 15px; line-height: 1.6; }
.td-flip.is-dare .td-card-type { background: var(--dare); }
.td-card-text { margin: 0; font-size: 22px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.td-random-note { margin: 0; font-size: 12.5px; color: var(--ink-faint); }
.td-card-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; margin-top: 14px; align-items: end; }
.td-card-actions .td-btn-primary { margin-top: 0; }
.td-pass { margin: 12px auto 0; max-width: 26em; text-align: center; font-size: 12.5px; color: var(--on-night-dim); line-height: 1.5; }

/* ---------------- 끝 화면 ---------------- */
.td-end > * + * { margin-top: 14px; }
.td-sum { text-align: center; padding: 18px 16px; border-top: 6px solid var(--gold); animation: td-in 0.35s ease-out; }
.td-sum-kicker { margin: 0; font-size: 15px; color: var(--gold-2); }
.td-h2 { margin: 0; font-size: 30px; line-height: 1.2; color: var(--ink); }
.td-sum-sub { margin: 6px 0 0; font-size: 14.5px; color: var(--ink-dim); }
.td-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.td-stat { margin: 0; padding: 10px 6px; border-radius: 14px; background: var(--cream-2); display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; min-width: 0; }
.td-stat dt { font-size: 12.5px; line-height: 1.3; color: var(--ink-dim); overflow-wrap: anywhere; }
.td-stat dd { margin: 0; font-size: 30px; line-height: 1.1; color: var(--ink); }
.td-stat-big { grid-column: 1 / -1; background: var(--night); }
.td-stat-big dt { color: var(--on-night-dim); }
.td-stat-big dd { font-size: 44px; color: var(--gold); }
.td-stat-truth dd { color: var(--truth-2); }
.td-stat-dare dd { color: var(--dare-2); }

@keyframes td-pop { from { transform: scale(0.7); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } to { transform: none; } }
@keyframes td-turn { 0% { transform: scaleX(1); } 50% { transform: scaleX(0.02); } 100% { transform: scaleX(1); } }
@keyframes td-off { 0%, 49% { visibility: visible; } 50%, 100% { visibility: hidden; } }
@keyframes td-on { 0%, 49% { visibility: hidden; } 50%, 100% { visibility: visible; } }
@keyframes td-in { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .td-flip.is-flipped, .td-flip.is-flipped .td-front, .td-flip.is-flipped .td-back { animation: none; }
  .td-turn-name.is-pop, .td-sum { animation: none; }
}

/* ---------------- 개인정보·바닥글 ---------------- */
.td-doc { padding: 18px 16px; margin-top: 12px; background: var(--cream); color: var(--ink); border-radius: 16px; box-shadow: var(--shadow); }
.td-doc h1 { font-size: 24px; margin: 0 0 12px; }
.td-doc h2 { font-size: 17px; margin: 18px 0 6px; }
.td-doc p { font-size: 14.5px; color: var(--ink-dim); }
.td-doc a { color: var(--dare-2); }
.site-footer { margin-top: 36px; padding: 18px 0 30px; text-align: center; font-size: 12.5px; color: var(--on-night-dim); }
.site-footer a { color: var(--on-night); }

/* ---------------- 언어별 ---------------- */
html:lang(th) .td-h1, html:lang(th) .td-btn, html:lang(th) .td-seg-btn, html:lang(th) .td-pick, html:lang(th) .td-turn-name, html:lang(th) .td-card-text, html:lang(th) .td-pack-name, html:lang(th) .td-h2 { line-height: 1.5; letter-spacing: 0; }
html:lang(th) .td-h1-main { line-height: 1.45; }
html:lang(th) body { word-break: normal; line-break: strict; }
html:lang(vi) .td-h1-main, html:lang(vi) .td-turn-name, html:lang(vi) .td-card-text { line-height: 1.4; }
html:lang(ja) body { word-break: auto-phrase; }
html:lang(de) .td-label, html:lang(de) .td-seg-btn, html:lang(de) .td-btn, html:lang(de) .td-hint, html:lang(de) .td-pack-desc, html:lang(de) .td-pick, html:lang(de) .td-stat dt { hyphens: auto; -webkit-hyphens: auto; }

@media (max-width: 380px) {
  .td-h1-main { font-size: 26px; }
  .td-btn { font-size: 17px; }
  .td-pick { font-size: 16px; }
  .td-turn-name { font-size: 30px; }
  .td-card-text { font-size: 20px; }
}
