/* ═══════════════════════════════════════════════════════════
   라이프에세이 · 보강 화면 요소
   ① 홈 "자주 찾는 계산"  ② 최근 사용한 도구 · 게임
   ③ 도구 보강 글(계산 예시 · 자주 묻는 질문)  ④ 게임 목록 안내
   ═══════════════════════════════════════════════════════════ */

/* ① 홈: 자주 찾는 계산 (검색창 아래 질문형 바로가기) */
.quick-asks { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; max-width: 760px; margin: -6px auto 22px; }
.quick-label { flex-basis: 100%; margin-bottom: 2px; color: var(--subtle); font-size: 12.5px; font-weight: 700; letter-spacing: .02em; }
.quick-ask {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px 9px 12px; border-radius: 99px; white-space: nowrap;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line-strong); color: var(--text);
  font-size: 14px; font-weight: 650; box-shadow: var(--sh-xs); backdrop-filter: blur(6px);
  transition: border-color .15s, transform .15s var(--ease), box-shadow .15s, color .15s;
}
.quick-ask span { font-size: 16px; line-height: 1; }
.quick-ask:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); color: var(--link); transform: translateY(-1px); box-shadow: var(--sh-sm); }
@media (max-width: 640px) {
  .quick-asks { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin: -4px -18px 20px; padding: 2px 18px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .quick-asks::-webkit-scrollbar { display: none; }
  .quick-label { display: none; }
  .quick-ask { flex: none; scroll-snap-align: start; font-size: 13.5px; padding: 8px 13px 8px 11px; }
}

/* ② 최근 사용한 도구 · 게임 */
.recent-strip { margin: 26px 0 8px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--soft) 70%, var(--surface))); box-shadow: var(--sh-xs); }
.recent-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.recent-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: 15px; letter-spacing: -.03em; }
.recent-title .ic { width: 17px; height: 17px; color: var(--link); }
.recent-clear { border: 0; background: none; padding: 4px 6px; border-radius: 8px; color: var(--subtle); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.recent-clear:hover { color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); }
.recent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.recent-item { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--text); transition: border-color .15s, transform .15s var(--ease); }
.recent-item:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); transform: translateY(-1px); }
.recent-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--soft); font-size: 20px; }
.recent-text { display: grid; min-width: 0; line-height: 1.35; }
.recent-text b { font-size: 14.5px; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-text small { color: var(--subtle); font-size: 12px; font-weight: 600; }
@media (max-width: 640px) {
  .recent-strip { padding: 14px; margin-top: 18px; }
  .recent-list { display: flex; overflow-x: auto; margin: 0 -14px; padding: 0 14px 4px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .recent-list::-webkit-scrollbar { display: none; }
  .recent-item { flex: 0 0 auto; width: min(220px, 70vw); scroll-snap-align: start; }
}
.tool-card-recent { align-self: flex-start; margin: -2px 0 2px; padding: 2px 9px; border-radius: 99px; background: color-mix(in srgb, var(--sun) 26%, var(--surface)); color: color-mix(in srgb, var(--sun) 30%, #5b3d00); font-size: 11.5px; font-weight: 750; }
:root[data-theme="dark"] .tool-card-recent { background: color-mix(in srgb, var(--sun) 22%, var(--surface)); color: var(--sun); }

/* ③ 도구 보강 글: 계산 예시 */
.tool-guide h3 { margin-top: 1.6em; }
.tool-guide th, .tool-guide td:first-child, .tool-guide td.n { white-space: nowrap; }
.tool-guide td.n { font-variant-numeric: tabular-nums; }
.tool-guide td:nth-child(2):not(:last-child) { min-width: 8.5em; }
.calc-steps { display: grid; gap: 0; margin: 1em 0 1.3em; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.calc-steps > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 15.5px; line-height: 1.6; }
.calc-steps > div:last-child { border-bottom: 0; }
.calc-steps span { color: var(--muted); font-weight: 600; font-size: 14px; }
.calc-steps b { font-variant-numeric: tabular-nums; text-align: right; }
.calc-steps .total { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 9%, var(--surface)), color-mix(in srgb, var(--sky) 7%, var(--surface))); }
.calc-steps .total b { color: var(--link); font-size: 16.5px; }
.prose .hint { color: var(--muted); font-size: 14px; line-height: 1.7; }
.faq-list { display: grid; gap: 10px; }
.faq-list details.toggle { margin: 0; }
.faq-list details.toggle > div > :last-child { margin-bottom: 0; }
@media (max-width: 640px) {
  .prose.tool-guide table { font-size: 14px; }
  .prose.tool-guide th, .prose.tool-guide td { padding: 10px 11px; }
  .calc-steps > div { display: grid; gap: 2px; padding: 11px 14px; font-size: 15px; }
  .calc-steps b { text-align: left; }
}

/* ④ 게임 목록 안내 */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; margin: 1em 0 1.6em; }
.pick { display: grid; gap: 6px; padding: 16px 18px; border-radius: var(--r-md); border: 1px solid var(--line); background: linear-gradient(160deg, var(--surface), color-mix(in srgb, var(--soft-accent) 70%, var(--surface))); }
.pick b { font-size: 15.5px; letter-spacing: -.02em; }
.pick span { color: var(--muted); font-size: 14.5px; line-height: 1.65; }

/* ⑤ 도구 카드 설명: 글자 중간에서 잘리지 않고 2줄(큰 카드 3줄)까지 깔끔하게 */
.tool-card-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.tool-card.large .tool-card-desc { -webkit-line-clamp: 3; line-clamp: 3; }

/* ⑥ 휴대폰 화면 좌우 흔들림 방지
   body 의 overflow-x: clip 만으로는 안드로이드 크롬 · 삼성 인터넷에서 화면 바깥으로 넘친 광고 등이
   화면 폭을 넓혀 페이지 전체가 옆으로 밀립니다. 최상위(html)에서 가로 넘침을 막아 화면 폭을 고정합니다.
   (세로 스크롤 · 상단 고정 헤더 · 표 안의 가로 스크롤은 그대로 동작) */
html { overflow-x: hidden; overscroll-behavior-x: none; }
body { max-width: 100%; }
video { max-width: 100%; }

/* ⑦ 게임 전체 화면 (모든 게임 공통)
   · 진짜 전체 화면(:fullscreen)과, 지원하지 않는 브라우저(아이폰 사파리 등)용 "화면 꽉 채우기"를 같은 모습으로
   · 노치 · 홈 막대(안전 영역)를 피하고, 화면을 돌려도 게임판이 화면 안에 맞게 줄어듦 */
.game-shell.is-fs {
  --fs-pad: clamp(12px, 2.6vw, 24px);
  --fs-reserve: 150px;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 0;
  width: 100%; max-width: none; height: 100%; margin: 0; overflow: auto; overscroll-behavior: contain;
  padding: max(var(--fs-pad), env(safe-area-inset-top)) max(var(--fs-pad), env(safe-area-inset-right)) max(var(--fs-pad), env(safe-area-inset-bottom)) max(var(--fs-pad), env(safe-area-inset-left));
  border: 0; border-radius: 0; box-shadow: none;
  background:
    radial-gradient(900px 480px at 100% -10%, color-mix(in srgb, var(--sky) 10%, transparent), transparent 70%),
    radial-gradient(800px 460px at -10% 110%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 70%),
    var(--bg);
}
.game-shell.is-pseudo-fs { position: fixed; inset: 0; z-index: 1000; height: 100vh; height: 100dvh; animation: lf-fs-in .22s var(--ease); }
@keyframes lf-fs-in { from { opacity: 0; transform: scale(.985); } }
html.lf-fs-on, html.lf-fs-on body { overflow: hidden; }
.game-shell.is-fs > * { width: 100%; max-width: 1100px; margin-inline: auto; flex: none; }
.game-shell.is-fs > :first-child { margin-top: auto; }
.game-shell.is-fs > :last-child { margin-bottom: auto; }
.game-shell.is-fs .game-bar { margin-bottom: 14px; }
.game-shell.is-fs .game-stage {
  width: min(100%, calc((100vh - var(--fs-reserve)) * var(--game-ratio, 1)));
  width: min(100%, calc((100dvh - var(--fs-reserve) - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * var(--game-ratio, 1)));
  max-width: none; margin-inline: auto;
}
@media (pointer: coarse) { .game-shell.is-fs { --fs-reserve: 290px; } }
@media (pointer: coarse) and (orientation: landscape) { .game-shell.is-fs { --fs-reserve: 120px; } .game-shell.is-fs .game-pad { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: auto; margin: 0; z-index: 2; opacity: .92; } }
.game-shell.is-fs .game-help { display: none; }

/* 전체 화면 버튼: 다른 게임 버튼과 같은 모양 + 켜졌을 때 강조 */
.game-fs-btn { flex: none; }
.game-fs-btn[aria-pressed="true"] { color: #fff; border-color: transparent; background: linear-gradient(140deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--primary) 70%, transparent); }
.game-fs-btn[aria-pressed="true"]:hover { color: #fff; filter: brightness(1.06); }
