/* 화면 공통 조각 — 확인 창, 바텀시트, 토스트.
   색·글자는 facegrid-result.css 토큰을 쓴다. 열고 닫을 때 모두 짧게 움직인다. */

/* ── 확인 창 (가운데) ───────────────────────────────────────────── */
.app-dialog { width: min(calc(100vw - 48px), 320px); padding: 24px 20px 16px; border: 0; border-radius: 14px; background: #fff; color: var(--body); box-shadow: 0 16px 48px rgb(0 0 0 / 16%); }
.app-dialog::backdrop { background: rgb(25 24 29 / 50%); }
.app-dialog h2 { margin: 0; color: var(--text); font-size: 17px; font-weight: 650; line-height: 24px; letter-spacing: -.03em; word-break: keep-all; }
.app-dialog p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 22px; letter-spacing: -.02em; word-break: keep-all; }
.app-dialog-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 20px; }
.app-button { min-height: 46px; padding: 0 12px; border: 0; border-radius: 8px; font-size: 14.5px; font-weight: 600; letter-spacing: -.02em; transition: background-color .15s, transform .15s; }
.app-button:active { transform: scale(.97); }
.app-button-quiet { border: 1px solid #dcd8de; background: #fff; color: var(--body); font-weight: 500; }
.app-button-primary { background: var(--accent); color: #fff; }
.app-button-danger { background: #b3263e; color: #fff; }

/* ── 바텀시트 ───────────────────────────────────────────────────── */
.app-sheet { position: fixed; inset: auto 0 0; width: 100%; max-width: 560px; max-height: min(78dvh, 640px); margin: 0 auto; padding: 0; border: 0; border-radius: 18px 18px 0 0; background: #fff; color: var(--body); box-shadow: 0 -8px 40px rgb(0 0 0 / 14%); overflow: hidden; overscroll-behavior: contain; }
.app-sheet[open] { display: flex; flex-direction: column; }
.app-sheet::backdrop { background: rgb(25 24 29 / 45%); }
.app-sheet-grip { display: grid; flex: 0 0 auto; place-items: center; height: 22px; cursor: grab; touch-action: none; }
.app-sheet-grip::before { content: ''; width: 36px; height: 4px; border-radius: 2px; background: #dcd8de; }
.app-sheet-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px 6px 20px; touch-action: none; }
.app-sheet-head h2 { margin: 0; color: var(--text); font-size: 18px; font-weight: 700; line-height: 26px; letter-spacing: -.035em; }
.app-sheet-head h2:focus { outline: none; }
.app-sheet-close { display: grid; flex: 0 0 44px; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.app-sheet-close svg { width: 20px; height: 20px; }
.app-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px max(20px, env(safe-area-inset-bottom)); }
@media (min-width: 600px) {
  .app-sheet { inset: 0; max-width: 440px; margin: auto; border-radius: 18px; max-height: min(80dvh, 640px); height: fit-content; }
  .app-sheet-grip { height: 14px; }
  .app-sheet-grip::before { display: none; }
}

/* 열고 닫는 움직임 — data-state 로 제어한다(스크립트가 닫힘 애니메이션이 끝난 뒤 close()). */
.app-dialog[open], .app-sheet[open] { animation: app-pop-in .22s cubic-bezier(.2, .9, .3, 1.1) both; }
.app-dialog[open]::backdrop, .app-sheet[open]::backdrop { animation: app-fade-in .2s ease both; }
.app-sheet[open] { animation-name: app-sheet-in; animation-duration: .34s; animation-timing-function: cubic-bezier(.2, .9, .25, 1); }
.app-dialog[data-state='closing'] { animation: app-pop-out .14s ease both; }
.app-sheet[data-state='closing'] { animation: app-sheet-out .22s cubic-bezier(.4, 0, 1, 1) both; }
.app-dialog[data-state='closing']::backdrop, .app-sheet[data-state='closing']::backdrop { animation: app-fade-out .2s ease both; }
.app-sheet[data-dragging] { animation: none; transition: none; }
@keyframes app-pop-in { from { opacity: 0; transform: scale(.94); } }
@keyframes app-pop-out { to { opacity: 0; transform: scale(.96); } }
@keyframes app-sheet-in { from { transform: translateY(100%); } }
@keyframes app-sheet-out { to { transform: translateY(100%); } }
@keyframes app-fade-in { from { opacity: 0; } }
@keyframes app-fade-out { to { opacity: 0; } }
@media (min-width: 600px) {
  .app-sheet[open] { animation-name: app-pop-in; animation-duration: .22s; }
  .app-sheet[data-state='closing'] { animation-name: app-pop-out; animation-duration: .14s; }
}

/* ── 토스트 — 헤더 바로 아래에 뜬다(위에서 내려왔다가 위로 사라진다). ──────── */
.app-toast { position: fixed; z-index: 40; left: 50%; width: max-content; white-space: nowrap; top: calc(var(--site-header-height, 56px) + 8px); display: flex; align-items: center; gap: 8px; max-width: min(calc(100vw - 32px), 420px); padding: 11px 16px; border-radius: 12px; background: #2b2730; color: #fff; font-size: 14px; font-weight: 500; line-height: 20px; letter-spacing: -.02em; box-shadow: 0 8px 28px rgb(0 0 0 / 18%); transform: translateX(-50%); animation: app-toast-in .3s cubic-bezier(.2, .9, .3, 1.15) both; pointer-events: none; }
.app-toast[data-state='closing'] { animation: app-toast-out .2s ease both; }
.app-toast svg { flex: 0 0 18px; width: 18px; height: 18px; color: #f1b7c8; }
@keyframes app-toast-in { from { opacity: 0; transform: translate(-50%, -12px) scale(.96); } }
@keyframes app-toast-out { to { opacity: 0; transform: translate(-50%, -8px); } }

@media (hover: hover) {
  .app-button-quiet:hover { background: var(--surface); }
  .app-button-primary:hover { background: #693548; }
  .app-button-danger:hover { background: #9c2034; }
  .app-sheet-close:hover { background: var(--surface); color: var(--text); }
}

/* ── 로그인 시트 — 가운데 정렬 문구 + 카카오·Apple 버튼 ─────────── */
.login-sheet .app-sheet-head { position: relative; justify-content: center; padding: 8px 52px 0; }
.login-sheet .app-sheet-head h2 { font-size: 19px; line-height: 27px; text-align: center; word-break: keep-all; }
.login-sheet .app-sheet-close { position: absolute; top: -8px; right: 8px; }
/* ── 앱 설치 유도 시트 — 앱 아이콘·제목·한 줄·설치 버튼, 가운데 정렬 ─────── */
.app-install-sheet .app-sheet-close { position: absolute; top: 12px; right: 8px; }
.app-install-icon { flex: 0 0 auto; align-self: center; width: 72px; height: 72px; margin-top: 10px; border: 1px solid #ece8ee; border-radius: 17px; }
.app-install-sheet .app-sheet-head { justify-content: center; padding: 16px 20px 0; }
.app-install-sheet .app-sheet-head h2 { font-size: 19px; line-height: 27px; text-align: center; word-break: keep-all; text-wrap: balance; }
.app-install-message { margin: 6px 0 0; white-space: pre-line; color: var(--muted); font-size: 14px; line-height: 22px; letter-spacing: -.02em; text-align: center; word-break: keep-all; }
/* 외부 AI 전송 동의(ai-consent.mjs) — 무엇을 누구에게 보내는지 한눈에. 항목 이름은 옅게, 내용은 본문색. */
.ai-consent-sheet .app-sheet-head h2 { word-break: keep-all; text-wrap: balance; }
/* 화면이 낮은 휴대폰에서도 동의 버튼이 스크롤 없이 보이게 — 기본 시트(78dvh)보다 높이를 더 준다. */
.ai-consent-sheet { max-height: min(92dvh, 640px); }
.ai-consent-sheet .app-sheet-head { padding-bottom: 0; }
.ai-consent-list { display: grid; gap: 14px; margin: 2px 0 0; padding: 16px; border-radius: 12px; background: var(--surface); }
.ai-consent-list div { display: grid; gap: 3px; }
.ai-consent-list dt { color: var(--body); font-size: 12.5px; font-weight: 600; letter-spacing: -.02em; }
.ai-consent-list dd { margin: 0; color: var(--text); font-size: 14.5px; line-height: 22px; letter-spacing: -.025em; word-break: keep-all; }
.ai-consent-list dd + dd { margin-top: 6px; }
.ai-consent-list dd strong { font-weight: 600; }
.ai-consent-note { margin: 12px 2px 0; color: var(--muted); font-size: 13px; line-height: 20px; letter-spacing: -.02em; word-break: keep-all; }
.ai-consent-note a { display: inline-block; margin: -10px 0; padding: 10px 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.ai-consent-actions .app-button:disabled { opacity: .45; }
.ai-consent-error { margin: 10px 2px 0; color: #b3263e; font-size: 13px; line-height: 20px; }
.ai-consent-error:empty { display: none; }
/* 버튼은 시트 아래에 붙어 있다 — 글이 길어 스크롤이 생겨도(작은 화면·큰 글씨) 동의·거절이 항상 보인다. */
.ai-consent-sheet .app-sheet-body { padding-bottom: 0; }
.ai-consent-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin: 8px -20px 0; padding: 12px 20px max(20px, env(safe-area-inset-bottom)); background: #fff; }
.ai-consent-actions .app-button { min-height: 52px; border-radius: 12px; font-size: 15.5px; }
.app-install-button { display: flex; align-items: center; justify-content: center; min-height: 52px; margin-top: 24px; border-radius: 12px; font-size: 15.5px; text-decoration: none; }

.login-view { padding-top: 2px; animation: app-fade-in .3s ease both; }
.login-providers { margin-top: 22px; }   /* 제목 바로 아래 버튼 */
.login-providers { display: flex; flex-direction: column; gap: 10px; }
/* 카카오 로그인 버튼 가이드: 배경 #FEE500, 심볼 #000, 레이블 #000 85%, 모서리 12px. 심볼은 왼쪽, 레이블은 가운데. */
.login-provider { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: 0 48px; border: 0; border-radius: 12px; font-size: 15.5px; font-weight: 600; letter-spacing: -.02em; transition: filter .15s, transform .15s; }
.login-provider:active { transform: scale(.98); }
.login-provider:disabled { opacity: 1; }
.login-provider:disabled:not([data-loading]) { opacity: .5; }
.login-kakao { background: #fee500; color: rgb(0 0 0 / 85%); }
.login-kakao-symbol { position: absolute; left: 20px; top: 50%; width: 18px; height: 18px; margin-top: -9px; }
.login-apple { background: #000; color: #fff; }
.login-apple-logo { position: absolute; left: 18px; top: 50%; width: 22px; height: 22px; margin-top: -12px; }
.login-provider[data-loading] > * { opacity: 0; }
.login-provider[data-loading]::after { content: ''; position: absolute; width: 20px; height: 20px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: loading-turn .8s linear infinite; }
.login-terms { margin: 16px 0 0; color: #77737c; font-size: 12px; line-height: 18px; letter-spacing: -.02em; text-align: center; word-break: keep-all; }
.login-terms a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.login-error { margin: 10px 0 0; color: #b3263e; font-size: 13px; text-align: center; }
@media (hover: hover) {
  .login-provider:hover:not(:disabled) { filter: brightness(.96); }
}
/* 로컬에서만 — 카카오 설정 없이 개발용 로그인(DEV_LOGIN=1). */
.login-dev { margin: 10px 0 0; text-align: center; font-size: 12.5px; }
.login-dev a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
/* 이메일 로그인(앱 심사용) — 소셜 버튼과 같은 크기, 흰 바탕 테두리. */
.login-email { border: 1px solid #dcd8de; background: #fff; color: var(--text); }
.login-email-icon { position: absolute; left: 19px; top: 50%; width: 21px; height: 21px; margin-top: -10.5px; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.login-email-form { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field span { color: var(--body); font-size: 13.5px; font-weight: 600; letter-spacing: -.02em; }
.login-field input { min-height: 50px; padding: 0 14px; border: 1px solid #dcd8de; border-radius: 12px; background: #fff; color: var(--text); font-size: 16px; letter-spacing: -.01em; }
.login-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(120 62 82 / 12%); }
.login-email-form .login-error { margin: 0; text-align: left; }
.login-submit { margin-top: 4px; background: var(--accent); color: #fff; }
.login-back { align-self: center; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--muted); font-size: 13.5px; text-decoration: underline; text-underline-offset: 2px; }
.login-signup { border: 1px solid #dcd8de; background: #fff; color: var(--text); text-decoration: none; }

/* Company footer (home) */
.site-footer { margin-top: 88px; padding: 28px 0 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; letter-spacing: -.01em; word-break: keep-all; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer-links { display: flex; gap: 16px; margin-bottom: 16px; }
.site-footer-links a { display: inline-flex; align-items: center; min-height: 32px; margin-block: -6px; color: var(--body, var(--text)); font-size: 12.5px; }
.site-footer-links strong { font-weight: 600; }
.site-footer-company { margin: 0 0 4px; }
.site-footer-company strong { color: var(--body, var(--text)); font-weight: 600; }
.site-footer-info { display: flex; flex-wrap: wrap; column-gap: 12px; margin: 0; }
.site-footer-info > div { display: flex; gap: 6px; }
.site-footer-info > div:nth-child(4) { flex-basis: 100%; }
.site-footer-info dt { flex: none; }
.site-footer-info dd { margin: 0; }
.home-page.has-app-nav .result-main:has(.site-footer) { padding-bottom: calc(var(--app-nav-height) + 84px + env(safe-area-inset-bottom, 0px)); }
