/* apps/sweeper/style.css — 지뢰찾기: 레이더 화면 (짙은 청록 밤 + 격자 + 주황 경고색·민트 안전색).
 * 모바일 한 줄(--app-width 480px). 글꼴은 언어 파일 fonts → :root 변수(--font-display 등, 생성기가 이 파일 뒤에 둔다).
 * 클래스 앞머리는 tf-(공통 컴포넌트의 mg- 와 겹치지 않게). 공통 타이틀 바(G.topBar)·끝 화면(data-mg-end)은 --mg-* 변수로만 색을 맞춘다.
 * 판은 DOM 격자(.tf-board > .tf-cell 버튼) — 칸 크기는 sweeper.js 가 --cell 변수로 정한다.
 */
:root {
  --bg-0: #05131a;
  --bg-1: #0a2230;
  --bg-2: #123a4a;
  --pink: #ff7a3c;
  --cyan: #3de0c0;
  --yellow: #ffd84a;
  --lime: #8bff7a;
  --orange: #ff8a3d;
  --violet: #6fa8dc;
  --danger: #ff4d6d;
  --ink: #f4f0ff;
  --ink-dim: rgba(244, 240, 255, 0.8);
  --ink-faint: rgba(244, 240, 255, 0.56);
  --dark: #04141b;
  --card: rgba(255, 255, 255, 0.06);
  --line: rgba(61, 224, 192, 0.45);

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

  /* 공통 타이틀 바 · 언어 선택 */
  --mg-top-fg: var(--ink);
  --mg-top-badge-bg: var(--pink);
  --mg-top-badge-fg: var(--dark);
  --lang-bg: rgba(244, 240, 255, 0.08);
  --lang-fg: var(--ink);
  --lang-border: rgba(61, 224, 192, 0.5);
  /* 공통 끝 화면 (짙은 바탕 위에서 읽히게 밝은 글자·옅은 테두리) */
  --mg-star-on: var(--yellow);
  --mg-star-off: rgba(244, 240, 255, 0.22);
  --mg-heart-bg: rgba(255, 122, 60, 0.12);
  --mg-heart-border: rgba(255, 122, 60, 0.5);
  --mg-heart-fg: #ffb98f;
  --mg-heart-on: var(--pink);
  --mg-share-bg: rgba(244, 240, 255, 0.07);
  --mg-share-border: rgba(244, 240, 255, 0.18);
  --mg-share-primary-bg: var(--cyan);
  --mg-share-primary-fg: var(--dark);
  --mg-x: var(--ink);
  --mg-tiktok: var(--ink);
  --mg-faq-bg: rgba(244, 240, 255, 0.05);
  --mg-faq-border: rgba(61, 224, 192, 0.3);
  --mg-end-retry-bg: var(--pink);
  --mg-end-retry-fg: var(--dark);
  --toast-bg: rgba(18, 58, 74, 0.97);
}

html { background: var(--bg-0); }
body.tf-body {
  min-height: 100vh;
  background:
    linear-gradient(rgba(111, 168, 220, 0.07) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, rgba(111, 168, 220, 0.07) 1px, transparent 1px) 0 0 / 28px 100%,
    radial-gradient(ellipse 120% 60% at 50% -10%, var(--bg-2), var(--bg-1) 50%, var(--bg-0) 85%) fixed;
  background-color: var(--bg-0);
  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) 규칙보다 뒤에서 다시 지정 */
.tf-h1, .tf-kicker, .tf-h1-main, .tf-h1-main em, .tf-badge, .tf-btn, .tf-how-txt,
.tf-hud-label, .tf-pause, .tf-mode, .tf-diff-name,
.tf-eyebrow, .tf-tier, .tf-points, .tf-newbest, .tf-stat dt, .tf-doc h1 {
  font-family: var(--font-display);
}
/* 숫자는 본문 글꼴 굵게 (Audiowide 의 0 은 Ø 처럼 보인다) */
.tf-hud-val, .tf-score-big, .tf-stat-num, .tf-top, .tf-best { font-family: var(--font-sans); font-weight: 800; }

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

.tf-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 58px;
  padding: 12px 18px;
  border: 2px solid #fff; border-radius: 14px;
  font-size: 19px; font-weight: var(--display-weight);
  line-height: 1.25; letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tf-btn-primary {
  background: var(--pink); color: var(--dark);
  box-shadow: 0 0 0 3px rgba(255, 122, 60, 0.35), 0 0 24px rgba(255, 122, 60, 0.6), 0 5px 0 #a8470f;
  
}
.tf-btn-primary:active { transform: translateY(4px); box-shadow: 0 0 0 3px rgba(255, 122, 60, 0.35), 0 0 14px rgba(255, 122, 60, 0.5), 0 1px 0 #a8470f; }
.tf-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

/* ---------------- 시작 화면 (티징 + 짧은 방법) ---------------- */
.tf-start { text-align: center; padding-top: 14px; }
.tf-badge {
  display: inline-block; margin: 0 0 10px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(61, 224, 192, 0.1); color: var(--cyan);
  border: 1.5px solid rgba(61, 224, 192, 0.55);
  box-shadow: 0 0 12px rgba(61, 224, 192, 0.25);
  font-size: 13px; line-height: 1.35;
}
.tf-hero {
  position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
  width: 216px; margin: 0 auto 6px; padding: 10px; border-radius: 14px;
  border: 2px solid rgba(111, 168, 220, 0.55);
  background: linear-gradient(180deg, rgba(18, 58, 74, 0.9), rgba(5, 19, 26, 0.95));
  box-shadow: 0 0 22px rgba(61, 224, 192, 0.25), inset 0 0 24px rgba(0, 0, 0, 0.5);
}
.tf-hc {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 4px;
  font-size: 15px; line-height: 1; font-weight: 800; font-family: var(--font-sans);
  background: linear-gradient(160deg, #3b6577, #234657); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}
.tf-hc-o { background: rgba(4, 20, 27, 0.85); box-shadow: inset 0 0 0 1px rgba(111, 168, 220, 0.2); }
.tf-hc-1 { color: #6cb4ff; } .tf-hc-2 { color: #6fe07a; } .tf-hc-3 { color: #ff7d7d; }
.tf-hc-f { animation: tf-pop 2.4s ease-in-out infinite; font-size: 14px; }
@keyframes tf-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.tf-h1 { margin: 12px 0 10px; line-height: 1.15; font-weight: var(--display-weight); }
.tf-kicker {
  display: inline-block; max-width: 100%; margin-bottom: 10px; padding: 3px 12px;
  background: var(--yellow); color: var(--dark); border-radius: 6px;
  font-size: 15px; line-height: 1.35; letter-spacing: 0.02em; transform: rotate(-1.5deg);
  box-shadow: 0 0 14px rgba(255, 216, 74, 0.5);
}
.tf-h1-main {
  display: block; font-size: 30px; color: var(--ink); overflow-wrap: break-word;
  text-shadow: 0 0 10px rgba(111, 168, 220, 0.8), 0 3px 0 rgba(0, 0, 0, 0.5);
}
.tf-h1-main em { font-style: normal; color: var(--pink); text-shadow: 0 0 12px rgba(255, 122, 60, 0.9), 0 3px 0 rgba(0, 0, 0, 0.5); }
.tf-hook { margin: 0 auto 16px; max-width: 390px; font-size: 16px; color: var(--ink-dim); }
.tf-how {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 0 0 18px; padding: 0; list-style: none;
}
.tf-how li {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
  padding: 10px 6px; border-radius: 12px;
  background: var(--card); border: 1.5px solid rgba(111, 168, 220, 0.35);
}
.tf-how-ico { font-size: 24px; line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.tf-how-txt { font-size: 12.5px; line-height: 1.3; color: var(--ink); overflow-wrap: break-word; max-width: 100%; }
.tf-diffs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.tf-diff-legend { grid-column: 1 / -1; padding: 0; margin: 0 0 2px; font-size: 13px; color: var(--ink-faint); text-align: center; }
.tf-diff {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 62px;
  padding: 8px 4px; border-radius: 12px; cursor: pointer; color: var(--ink);
  background: var(--card); border: 2px solid rgba(111, 168, 220, 0.35);
  -webkit-tap-highlight-color: transparent;
}
.tf-diff[aria-checked="true"] { border-color: var(--cyan); background: rgba(61, 224, 192, 0.14); box-shadow: 0 0 14px rgba(61, 224, 192, 0.35); }
.tf-diff:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.tf-diff-name { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 14px; line-height: 1.25; overflow-wrap: break-word; max-width: 100%; }
.tf-diff-size { font-family: var(--font-sans); font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tf-facts { margin: 14px 0 0; font-size: 13px; color: var(--ink-faint); letter-spacing: 0.02em; }

/* ---------------- 게임 화면 ---------------- */
.tf-play { padding-top: 4px; }
.tf-hud { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 8px; margin: 0 auto 8px; max-width: 448px; }
.tf-hud-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0;
  padding: 4px 8px 5px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1.5px solid rgba(111, 168, 220, 0.4);
}
.tf-hud-label { font-size: 11px; line-height: 1.2; letter-spacing: 0.06em; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tf-hud-val { font-size: 22px; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tf-hud-mines .tf-hud-val { color: var(--pink); text-shadow: 0 0 10px rgba(255, 122, 60, 0.6); }
.tf-hud-time .tf-hud-val { color: var(--cyan); text-shadow: 0 0 10px rgba(61, 224, 192, 0.6); }
.tf-mode {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 52px; padding: 4px 8px;
  border-radius: 10px; cursor: pointer; color: var(--ink); font-family: var(--font-display); font-weight: var(--display-weight); font-size: 15px; line-height: 1.2;
  background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(111, 168, 220, 0.5); -webkit-tap-highlight-color: transparent;
}
.tf-mode[aria-pressed="true"] { background: var(--pink); color: var(--dark); border-color: #fff; box-shadow: 0 0 14px rgba(255, 122, 60, 0.6); }
.tf-mode:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.tf-mode-ico { font-size: 20px; line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.tf-mode-txt { min-width: 0; overflow-wrap: break-word; }

.tf-field {
  position: relative; margin: 0 auto; width: fit-content; max-width: 100%;
  padding: 6px; border-radius: 14px;
  border: 2px solid rgba(61, 224, 192, 0.55);
  box-shadow: 0 0 0 1px rgba(111, 168, 220, 0.5), 0 0 26px rgba(61, 224, 192, 0.2), 0 14px 34px rgba(0, 0, 0, 0.5);
  background: var(--dark);
}
.tf-board { --cell: 32px; display: grid; gap: 2px; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tf-cell {
  width: var(--cell); height: var(--cell); padding: 0; margin: 0; border: 0; border-radius: 4px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-family: var(--font-sans); font-weight: 800; font-size: calc(var(--cell) * 0.56); line-height: 1; color: var(--ink);
  background: linear-gradient(160deg, #3f6b7e, #234a5b); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.35);
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.tf-cell:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; z-index: 1; }
.tf-cell.is-open { background: rgba(10, 34, 48, 0.95); box-shadow: inset 0 0 0 1px rgba(111, 168, 220, 0.18); cursor: default; }
.tf-cell.is-flag { font-size: calc(var(--cell) * 0.5); }
.tf-cell.is-mine { background: rgba(10, 34, 48, 0.95); font-size: calc(var(--cell) * 0.5); }
.tf-cell.is-boom { background: #b3261e; }
.tf-cell.is-wrong { background: rgba(10, 34, 48, 0.95); color: var(--danger); text-decoration: line-through; }
.tf-cell.n1 { color: #6cb4ff; } .tf-cell.n2 { color: #6fe07a; } .tf-cell.n3 { color: #ff7d7d; } .tf-cell.n4 { color: #c39bff; }
.tf-cell.n5 { color: #ffb15c; } .tf-cell.n6 { color: #4fe6e0; } .tf-cell.n7 { color: #f4f0ff; } .tf-cell.n8 { color: #aab6c0; }
.tf-pause {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 16px; margin: 0;
  width: 100%; border: 0; border-radius: 12px; cursor: pointer; color: #fff; text-align: center;
  background: rgba(4, 20, 27, 0.97); font-family: var(--font-display); font-weight: var(--display-weight); font-size: 20px; line-height: 1.35;
}
.tf-pause:focus-visible { outline: 3px solid var(--yellow); outline-offset: -4px; }

/* ---------------- 끝 화면: 점수·등급 카드 ---------------- */
.tf-end { padding-top: 10px; }
.tf-result {
  position: relative; margin: 0 0 22px; padding: 20px 16px 18px; text-align: center;
  border-radius: 20px; border: 2px solid var(--line);
  background: linear-gradient(170deg, rgba(18, 58, 74, 0.95), rgba(5, 19, 26, 0.97));
  box-shadow: 0 0 24px rgba(61, 224, 192, 0.2), 0 14px 34px rgba(0, 0, 0, 0.4);
}
.tf-eyebrow {
  display: inline-block; max-width: 100%; margin: 0 0 8px; padding: 4px 14px; border-radius: 999px;
  background: var(--pink); color: var(--dark); font-size: 15px; line-height: 1.35;
  box-shadow: 0 0 14px rgba(255, 122, 60, 0.55);
}
.tf-tier-line { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 0; line-height: 1.2; }
.tf-tier-emoji { font-size: 40px; line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.tf-tier { min-width: 0; font-size: 23px; line-height: 1.25; color: var(--yellow); overflow-wrap: break-word; text-shadow: 0 0 12px rgba(255, 216, 74, 0.55); }
.tf-score-line { margin: 10px 0 0; line-height: 1; }
.tf-score-big { font-size: 60px; line-height: 1.05; color: var(--cyan); font-variant-numeric: tabular-nums; text-shadow: 0 0 18px rgba(61, 224, 192, 0.7); }
.tf-points { font-size: 18px; color: var(--ink-dim); }
.tf-newbest {
  display: inline-block; margin: 10px 0 0; padding: 3px 12px; border-radius: 8px;
  background: var(--lime); color: var(--dark); font-size: 15px; line-height: 1.35; transform: rotate(-2deg);
}
.tf-best { margin: 8px 0 0; font-size: 15px; color: var(--ink-dim); }
.tf-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 0; }
.tf-stat { min-width: 0; padding: 10px 6px; border-radius: 12px; background: var(--card); border: 1.5px solid rgba(111, 168, 220, 0.35); }
.tf-stat dt { font-size: 12.5px; line-height: 1.3; color: var(--ink-faint); overflow-wrap: break-word; }
.tf-stat dd { margin: 6px 0 0; }
.tf-stat-num { font-size: 28px; line-height: 1.4; color: var(--ink); font-variant-numeric: tabular-nums; }
.tf-rank { margin: 14px 0 0; padding: 12px 10px; border-radius: 12px; background: rgba(61, 224, 192, 0.07); border: 1.5px dashed rgba(61, 224, 192, 0.45); }
.tf-comparing { margin: 0; font-size: 14px; color: var(--ink-faint); }
.tf-top { margin: 0; font-size: 28px; line-height: 1.2; color: var(--cyan); }
.tf-beat { margin: 4px 0 0; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.tf-others { margin: 2px 0 0; font-size: 13px; line-height: 1.4; color: var(--ink-faint); }

/* ---------------- 언어별 ---------------- */
html:lang(th) .tf-h1-main, html:lang(th) .tf-kicker, html:lang(th) .tf-how-txt, html:lang(th) .tf-btn, html:lang(th) .tf-hook, html:lang(th) .tf-pause, html:lang(th) .tf-mode, html:lang(th) .tf-diff-name, html:lang(th) .tf-tier { line-height: 1.55; letter-spacing: 0; }
html:lang(th) .tf-hud-label, html:lang(th) .tf-stat dt { line-height: 1.5; letter-spacing: 0; }
html:lang(vi) .tf-h1-main, html:lang(vi) .tf-kicker, html:lang(vi) .tf-tier { line-height: 1.3; }
html:lang(ja) .tf-h1-main, html:lang(zh) .tf-h1-main, html:lang(ko) .tf-h1-main { font-size: 32px; line-height: 1.25; }
html:lang(ja) .tf-how-txt, html:lang(zh) .tf-how-txt, html:lang(ko) .tf-how-txt { font-size: 13px; }
html:lang(ko) .tf-h1-main, html:lang(ko) .tf-btn, html:lang(ko) .tf-tier, html:lang(ko) .tf-kicker { letter-spacing: 0.01em; }
html:lang(ru) .tf-hud-label { letter-spacing: 0.02em; }

/* ---------------- 개인정보처리방침 ---------------- */
.tf-doc { padding: 16px 0 8px; }
.tf-doc h1 { font-size: 26px; line-height: 1.25; margin: 8px 0 14px; }
.tf-doc h2 { font-size: 17px; margin: 22px 0 6px; color: var(--cyan); }
.tf-doc p { color: var(--ink-dim); font-size: 15px; }
.tf-doc a, .site-footer a { color: var(--cyan); }

/* ---------------- 움직임 줄이기 ---------------- */
@media (prefers-reduced-motion: reduce) {
  .tf-hc-f { animation: none; }
  .tf-btn { transition: none; }
}
@media (max-width: 359px) {
  .tf-h1-main { font-size: 26px; }
  .tf-hud-val { font-size: 19px; }
}
