/* apps/finger/style.css — 손가락 룰렛: 깊은 남색 밤 + 네온 손가락 원. 모바일 한 줄(--app-width 480px).
 * 판(#pad)은 touch-action:none · 선택/길게 누르기 메뉴 없음. 점(.fg-dot)마다 색(--c)과 빛나는 고리, 기다리는 동안 --p(0..1)만큼 고리가 찬다.
 * 뽑기: 나머지(.is-out)는 흐려지고 뽑힌 원(.is-win)은 커진다. 팀(.is-team)은 팀 색 + 번호. 움직임 줄이기면 애니메이션 없이 바로.
 * 제목·버튼은 언어 파일 fonts → :root 변수(--font-display 등, 생성기가 이 파일 뒤에 둔다).
 * 공통 타이틀 바(G.topBar)·끝 화면(data-mg-end)은 --mg-* 변수로만 색을 맞춘다.
 */
:root {
  --night: #14112b;
  --night-2: #1f1a40;
  --night-deep: #0c0a1c;
  --cream: #f7f4ff;
  --cream-2: #e9e4fb;
  --ink: #1b1636;
  --ink-dim: rgba(27, 22, 54, 0.78);
  --ink-faint: rgba(27, 22, 54, 0.58);
  --on-night: #f7f4ff;
  --on-night-dim: rgba(247, 244, 255, 0.78);
  --pink: #ff5d8f;
  --pink-2: #c93a69;
  --cyan: #4cc9f0;
  --lime: #b8f35d;
  --line: rgba(27, 22, 54, 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(--pink);
  --mg-top-badge-fg: #fff;
  --lang-bg: var(--night-deep);
  --lang-fg: var(--on-night);
  --lang-border: rgba(247, 244, 255, 0.28);
  --mg-star-on: #ffd23f;
  --mg-star-off: rgba(247, 244, 255, 0.28);
  --mg-heart-bg: var(--night-deep);
  --mg-heart-border: var(--pink);
  --mg-heart-fg: #ff9dbb;
  --mg-heart-on: var(--pink);
  --mg-share-bg: rgba(247, 244, 255, 0.1);
  --mg-share-border: rgba(247, 244, 255, 0.26);
  --mg-share-primary-bg: var(--pink);
  --mg-share-primary-fg: #fff;
  --mg-x: currentColor;
  --mg-tiktok: currentColor;
  --mg-faq-bg: rgba(247, 244, 255, 0.08);
  --mg-faq-border: rgba(247, 244, 255, 0.24);
  --mg-end-retry-bg: var(--pink);
  --mg-end-retry-fg: #fff;
  --toast-bg: var(--cream);
  --toast-fg: var(--ink);
}

html { background: var(--night); }
body.fg-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(ellipse at 50% -10%, rgba(255, 93, 143, 0.25), transparent 55%),
    radial-gradient(circle at 85% 65%, rgba(76, 201, 240, 0.14), transparent 42%);
  background-attachment: fixed;
}
[hidden] { display: none !important; }

/* base.css :lang(zh|th|vi) 가 모든 요소 글꼴을 덮으므로 제목 요소에 다시 지정 */
.fg-h1, .fg-kicker, .fg-h1-main, .fg-h1-main em, .fg-btn, .fg-h2, .fg-h3, .fg-seg-btn, .fg-label, .fg-step-value,
.fg-banner, .fg-status, .fg-res-kicker, .fg-team-name, .fg-hist-what, .fg-doc h1, .fg-mini {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
}

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

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

/* ---------------- 카드·설정 ---------------- */
.fg-card { background: var(--cream); color: var(--ink); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.fg-form { display: grid; gap: 10px; }
.fg-sub { display: grid; gap: 8px; }
.fg-label { display: block; margin: 0; font-size: 15px; color: var(--ink); line-height: 1.4; }
.fg-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--cream-2); }
.fg-seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fg-seg-btn {
  min-height: 44px; padding: 6px 4px; border: 0; border-radius: 11px; background: transparent; color: var(--ink-dim);
  font-size: 15px; line-height: 1.2; cursor: pointer; overflow-wrap: anywhere;
}
.fg-seg-btn[aria-checked="true"] { background: var(--night); color: var(--on-night); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.fg-stepper { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 4px; border-radius: 14px; background: var(--cream-2); }
.fg-step-btn { width: 48px; height: 44px; border: 0; border-radius: 11px; background: var(--night); color: var(--on-night); font-size: 24px; line-height: 1; cursor: pointer; }
.fg-step-btn:disabled { opacity: 0.35; cursor: default; }
.fg-step-value { min-width: 7em; text-align: center; font-size: 18px; color: var(--ink); }

/* ---------------- 버튼 ---------------- */
.fg-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;
}
.fg-btn-primary { margin-top: 14px; background: var(--pink); color: #fff; box-shadow: 0 5px 0 var(--pink-2); }
.fg-btn-primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--pink-2); }
.fg-btn-ghost { min-height: 44px; font-size: 15px; background: var(--cream-2); color: var(--ink); }
.fg-btn-go { min-height: 44px; font-size: 17px; background: var(--lime); color: var(--ink); box-shadow: 0 4px 0 #7fb52b; }
.fg-btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.fg-btn:focus-visible, .fg-seg-btn:focus-visible, .fg-mini:focus-visible, .fg-step-btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.fg-fair { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--on-night-dim); line-height: 1.5; }
.fg-mini { padding: 4px 12px; border: 0; border-radius: 999px; background: var(--cream-2); color: var(--ink-dim); font-size: 13px; cursor: pointer; white-space: nowrap; }

/* ---------------- 손가락 판 ---------------- */
.fg-bar { display: flex; align-items: center; gap: 8px; }
.fg-banner {
  flex: 1; min-width: 0; margin: 0; padding: 4px 12px; border-radius: 999px;
  background: var(--night-deep); color: var(--cyan); font-size: 14px; line-height: 1.4; text-align: center;
}
.fg-pad {
  --p: 0;
  position: relative; margin-top: 10px; height: max(340px, min(640px, calc(100svh - 200px))); border-radius: 26px; overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.06) 0 1px, transparent 1.5px) 0 0 / 22px 22px,
    linear-gradient(160deg, var(--night-2), var(--night-deep));
  box-shadow: inset 0 0 0 2px rgba(247, 244, 255, 0.12), inset 0 0 60px rgba(0, 0, 0, 0.45);
  touch-action: none; -ms-touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: contain; cursor: crosshair;
}
.fg-pad.is-hold { box-shadow: inset 0 0 0 2px rgba(184, 243, 93, calc(0.25 + var(--p) * 0.6)), inset 0 0 70px rgba(0, 0, 0, 0.45); }
.fg-dots { position: absolute; inset: 0; pointer-events: none; }
.fg-status-wrap { position: absolute; left: 12px; right: 12px; top: 50%; transform: translateY(-50%); text-align: center; pointer-events: none; }
.fg-pad:not(.is-empty) .fg-status-wrap { top: auto; bottom: 14px; transform: none; }
.fg-status { margin: 0; font-size: 20px; line-height: 1.35; color: var(--on-night); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); overflow-wrap: anywhere; }
.fg-pad.is-empty .fg-status { font-size: 22px; animation: fg-breathe 2.4s ease-in-out infinite; }
.fg-count { margin: 2px 0 0; font-size: 14px; color: var(--on-night-dim); }

.fg-dot {
  --c: var(--pink);
  --size: 88px;
  position: absolute; width: var(--size); height: var(--size); margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2); border-radius: 50%;
  background: radial-gradient(circle, #fff 0 14%, var(--c) 16% 100%);
  box-shadow: 0 0 22px 4px var(--c);
  animation: fg-pop 0.22s ease-out, fg-pulse 0.9s ease-in-out 0.22s infinite;
  transition: transform 0.5s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.45s ease, box-shadow 0.3s;
}
.fg-dot.is-click { --size: 64px; }
.fg-dot-ring {
  position: absolute; inset: -10px; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 360deg), rgba(255, 255, 255, 0.14) 0);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 62% 70%, transparent 72%); mask: radial-gradient(circle, transparent 60%, #000 62% 70%, transparent 72%);
}
.fg-pad.is-hold .fg-dot { animation-duration: 0.22s, 0.45s; }
.fg-pad.is-reveal .fg-dot { animation: none; }
.fg-pad.is-reveal .fg-dot-ring { display: none; }
.fg-dot.is-out { opacity: 0.12; transform: scale(0.6); box-shadow: none; }
.fg-dot.is-win { transform: scale(1.7); box-shadow: 0 0 40px 14px var(--c); z-index: 2; animation: fg-win 1.1s ease-in-out 0.5s infinite alternate !important; }
.fg-dot.is-team { transform: scale(1.15); background: var(--c); }
.fg-dot.is-team::after {
  content: attr(data-team); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--ink);
}

@keyframes fg-pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fg-pulse { 0%, 100% { box-shadow: 0 0 18px 2px var(--c); } 50% { box-shadow: 0 0 30px 9px var(--c); } }
@keyframes fg-win { from { box-shadow: 0 0 30px 10px var(--c); } to { box-shadow: 0 0 52px 22px var(--c); } }
@keyframes fg-breathe { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
@keyframes fg-in { from { transform: scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }

.fg-click-bar { margin-top: 10px; }
.fg-click-hint { margin: 0 0 8px; text-align: center; font-size: 13px; color: var(--on-night-dim); }
.fg-click-btns { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }

/* ---------------- 결과 ---------------- */
.fg-result { margin-top: 14px; min-width: 0; }
.fg-result > * + * { margin-top: 14px; }
.fg-res-card { text-align: center; padding: 18px 16px; border-top: 6px solid var(--pink); animation: fg-in 0.35s ease-out; }
.fg-res-kicker { margin: 0; font-size: 16px; color: var(--pink-2); }
.fg-h2 { margin: 0; color: var(--ink); }
.fg-res-title { font-size: 32px; line-height: 1.2; overflow-wrap: anywhere; }
.fg-res-sub { margin: 6px 0 0; font-size: 15px; color: var(--ink-dim); overflow-wrap: anywhere; }
.fg-res-teams { margin: 12px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; text-align: left; }
.fg-team { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: var(--cream-2); min-width: 0; }
.fg-swatch {
  --c: var(--pink);
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; box-shadow: 0 0 8px var(--c);
}
.fg-team-name { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.fg-h3 { margin: 0 0 4px; font-size: 16px; color: var(--ink); }
.fg-actions { display: grid; gap: 8px; margin-top: 14px; }
.fg-history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fg-history-head .fg-h3 { margin: 0; }
.fg-history-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.fg-hist-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 10px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.fg-hist-row:last-child { border-bottom: 0; }
.fg-hist-what { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.fg-hist-row.is-new .fg-hist-what { color: var(--pink-2); }
.fg-hist-meta { font-size: 12.5px; color: var(--ink-faint); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .fg-dot, .fg-pad.is-hold .fg-dot, .fg-dot.is-win, .fg-res-card, .fg-pad.is-empty .fg-status { animation: none !important; }
  .fg-dot { transition: none; }
}

/* ---------------- 개인정보·바닥글 ---------------- */
.fg-doc { padding: 18px 16px; margin-top: 12px; background: var(--cream); color: var(--ink); border-radius: 16px; box-shadow: var(--shadow); }
.fg-doc h1 { font-size: 24px; margin: 0 0 12px; }
.fg-doc h2 { font-size: 17px; margin: 18px 0 6px; }
.fg-doc p { font-size: 14.5px; color: var(--ink-dim); }
.fg-doc a { color: var(--pink-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) .fg-h1, html:lang(th) .fg-btn, html:lang(th) .fg-seg-btn, html:lang(th) .fg-res-title, html:lang(th) .fg-banner, html:lang(th) .fg-status { line-height: 1.5; letter-spacing: 0; }
html:lang(th) .fg-h1-main { line-height: 1.45; }
html:lang(th) body { word-break: normal; line-break: strict; }
html:lang(vi) .fg-h1-main, html:lang(vi) .fg-res-title { line-height: 1.35; }
html:lang(ja) body { word-break: auto-phrase; }
html:lang(de) .fg-label, html:lang(de) .fg-seg-btn, html:lang(de) .fg-btn, html:lang(de) .fg-status { hyphens: auto; -webkit-hyphens: auto; }

@media (max-width: 380px) {
  .fg-h1-main { font-size: 26px; }
  .fg-btn { font-size: 17px; }
  .fg-seg-btn { font-size: 14px; }
  .fg-status { font-size: 18px; }
  .fg-dot { --size: 76px; }
}
