/* K-Booth 다운로드 페이지(/v/<id>). 부스(booth.css)와 같은 밝은 스튜디오 색·글꼴을 쓰지만,
 * 부스는 한 화면 고정(overflow hidden)이라 그대로 싣지 않고 토큰만 옮겨 온다. 폭 360px 에서도 깨지지 않게.
 * 다크 모드: 삼성 인터넷은 "늘 밝게" 표시를 무시하고 페이지 색을 억지로 뒤집는다(흰 바탕이 검게, 민트가 탁하게).
 * 그래서 우리가 만든 어두운 색을 따로 둔다(prefers-color-scheme: dark) — 브라우저가 뒤집지 않고 이 색을 쓴다 */
:root {
  color-scheme: light dark;
  --bg: #ececee; --surface: #ffffff; --surface-2: #f5f5f6;
  --line: #e2e2e6; --line-strong: #c9c9cf;
  --ink: #141416; --ink-2: #4c4c53; --muted: #6b6b73;
  --accent: #d92d4a; --accent-soft: #fbe6ea;
  /* 테마가 바꾸는 색(assets/booth-theme.js). 이 :root 값 = classic(먹색 주 버튼 + 빨강 포인트). 기본 테마는 민트(아래 블록) */
  --primary: var(--ink); --primary-ink: #ffffff; --primary-hover: #2a2a2e;
  --accent-hover: #c22641; --accent-dis: #e7a3ae; --accent-dis-ink: #c98593; --accent-dis-line: #ebc2ca;
  /* 경고·안내 상자(앱 안 브라우저 등): 테마와 상관없이 따뜻한 색. classic 은 포인트와 같은 값 */
  --warn-soft: var(--accent-soft);
  --accent-ink: #ffffff; --toast-bg: #141416; --page: #ececee;
  --f-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic",
    "Hiragino Sans", "Microsoft YaHei", system-ui, sans-serif;
  --tap: 56px; --radius: 18px; --ease: cubic-bezier(.25, 1, .5, 1);
}
/* 민트 테마(?theme=mint, 부스와 같은 선택을 기억한다). 값과 우선순위는 booth.css 의 같은 블록과 같다 */
:root[data-theme="mint"] {
  --primary: #00796b; --primary-ink: #ffffff; --primary-hover: #00695c;
  --accent: #00695c; --accent-soft: #e0f5f2;
  --accent-hover: #005b50; --accent-dis: #8fcdc5; --accent-dis-ink: #5f9e96; --accent-dis-line: #bfe3de;
  --warn-soft: #ffece9;   /* 경고 상자는 민트가 아니라 따뜻한 코랄 */
}
/* 어두운 화면: 같은 민트 브랜드를 어두운 바탕에 맞춘 밝은 민트로(흰 글자 대신 짙은 글자로 대비를 지킨다) */
@media (prefers-color-scheme: dark) {
  :root {
    --page: #121416; --bg: #121416; --surface: #1d2023; --surface-2: #262a2e;
    --line: #30353a; --line-strong: #4a5057;
    --ink: #f1f3f4; --ink-2: #c4c9cd; --muted: #9ba2a8;
    --primary: #f1f3f4; --primary-ink: #141416; --primary-hover: #dfe3e6;
    --accent: #ff5c74; --accent-soft: rgba(255, 92, 116, .14); --accent-hover: #ff7a8e; --accent-ink: #1a0a0d;
    --accent-dis: #6b3a43; --accent-dis-ink: #8c5d66; --accent-dis-line: #4d3238;
    --toast-bg: #2c3136;
  }
  :root[data-theme="mint"] {
    --primary: #4fd1c1; --primary-ink: #002420; --primary-hover: #6edbcd;
    --accent: #4fd1c1; --accent-soft: rgba(79, 209, 193, .14); --accent-hover: #6edbcd; --accent-ink: #002420;
    --accent-dis: #2c5c56; --accent-dis-ink: #5f8f89; --accent-dis-line: #2f4a47;
    --warn-soft: rgba(255, 138, 112, .16);
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--page); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font-family: var(--f-sans); font-size: 16px; line-height: 1.5; font-weight: 500;
  -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: anywhere; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
.dl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.dl {
  max-width: 1040px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  padding: 0 16px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column;
}
/* 맨 위: 여우 + K-BOOTH (부스 머리와 같은 그림). 누르면 부스로 */
.dl-top { display: flex; align-items: center; justify-content: center; min-height: 72px; padding-top: env(safe-area-inset-top); }
.dl-brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; color: var(--ink); text-decoration: none;
  font-weight: 900; letter-spacing: .16em; font-size: 22px; line-height: 1; padding: 6px 10px; border-radius: 14px; }
.dl-brand img { width: 40px; height: 40px; border-radius: 10px; }   /* 여우 그림은 흰 바탕이라 어두운 화면에서 모서리를 둥글게 */
.dl-brand:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* 국기 언어 메뉴(#dlLang·#alLang, 모양은 assets/langmenu.css): 넓은 화면은 로고를 가운데 두고 오른쪽 끝에,
   폰(<600px)은 로고 왼쪽 · 메뉴 오른쪽으로 나눠 겹치지 않게.
   600px 이상은 칸 3개(빈 칸 · 로고 · 메뉴) — 긴 언어 이름(Bahasa Indonesia)이 로고와 겹치지 않고 메뉴 칸 안에서 줄임표로 */
.dl-top { position: relative; gap: 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.dl-top .dl-brand { grid-column: 2; }
.dl-top .lm { grid-column: 3; justify-self: end; max-width: 100%; }
.dl-top .lm .lm-btn { max-width: 100%; }
/* 오른쪽→왼쪽(ar·he): 칸 순서는 저절로 뒤집힌다(메뉴가 왼쪽 끝). 로고는 그림처럼 왼→오, 이메일 칸 안내 글만 오른쪽→왼쪽 */
[dir="rtl"] .dl-brand { direction: ltr; }
[dir="rtl"] .kba-input[type="email"]:placeholder-shown { direction: rtl; }
@media (max-width: 599px) {
  .dl-top { display: flex; justify-content: space-between; }
  .dl-top .lm { position: static; transform: none; min-width: 0; max-width: 46%; }
  .dl-brand { padding-inline: 0; }
}
.dl-main { flex: 1; display: flex; flex-direction: column; gap: 16px; }

/* 앱 안 브라우저 안내 */
.dl-inapp {
  background: var(--warn-soft); border-radius: 14px; padding: 12px 14px; font-size: 15px; color: var(--ink);
  display: grid; gap: 8px;
}
.dl-inapp p { margin: 0; }
.dl-inapp-sub { color: var(--ink-2); font-size: 14px; }
.dl-inapp .dl-btn { justify-self: start; min-height: 44px; }

/* 처음 불러오는 동안 */
.dl-loading { display: none; flex: 1; place-items: center; min-height: 50vh; }
body[data-state="loading"] .dl-loading { display: grid; }
.dl-spin {
  display: block; width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: dl-spin .9s linear infinite;
}
@keyframes dl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dl-spin { animation-duration: 2.4s; } }

/* 받을 수 있음: 사진이 주인공 */
.dl-ready { display: grid; gap: 20px; justify-items: center; }
.dl-photo {
  margin: 0; padding: 12px; background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--line), 0 16px 40px rgba(20, 20, 22, .10);
  max-width: 100%; display: grid; place-items: center; min-width: 120px; min-height: 160px;
}
.dl-photo img {
  display: block; max-width: 100%; height: auto; max-height: 48vh; max-height: 48dvh;
  -webkit-touch-callout: default; user-select: auto;
}
.dl-side { width: 100%; max-width: 440px; display: grid; gap: 10px; text-align: center; }
.dl-h { margin: 0; font-size: clamp(22px, 5.6vw, 30px); line-height: 1.25; font-weight: 800; letter-spacing: -.01em; }
.dl-sub { margin: 0; color: var(--ink-2); }
.dl-left {
  margin: 2px auto 4px; justify-self: center; padding: 4px 12px; border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font-size: 14px; font-weight: 700;
  font-feature-settings: "tnum" 1;
}
.dl-left:empty { display: none; }
/* 단추 2×2: 왼쪽 저장, 오른쪽 공유. 영상이 없으면(사진만) 아래 줄이 빠진다 */
.dl-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.dl-actions .dl-btn {
  display: grid; grid-template-columns: auto minmax(0, auto); column-gap: 8px; justify-content: center; align-content: center;
  padding: 10px 12px; font-size: 16px; text-align: start; min-width: 0;
}
.dl-actions .dl-ico { grid-row: 1 / span 2; align-self: center; }
.dl-actions .dl-btn span { grid-column: 2; }
.dl-actions .dl-btn-accent { background: var(--accent); color: var(--accent-ink); }
.dl-btn small { grid-column: 2; line-height: 1.2; white-space: nowrap; }   /* 파일 크기(2.3 MB)는 한 줄로 */

.dl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 20px; text-align: center; line-height: 1.3;
  border-radius: 14px; border: 0; cursor: pointer; text-decoration: none; font-weight: 700; font-size: 17px;
  transition: transform .15s var(--ease), background-color .15s var(--ease);
}
.dl-btn:active { transform: scale(.98); }
.dl-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.dl-btn-main { background: var(--primary); color: var(--primary-ink); }
.dl-btn-main:hover { background: var(--primary-hover); }
.dl-btn-line { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.dl-btn-line:hover { background: var(--surface-2); }
.dl-btn-accent { background: var(--accent); color: var(--accent-ink); }
.dl-btn-accent:hover { background: var(--accent-hover); }
.dl-btn-share-line { background: var(--surface); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.dl-btn-share-line:hover { background: var(--accent-soft); }
/* [사진 공유]: [사진 저장](채운 주 버튼) 옆의 보조 행동 → 두 테마 모두 흰 바탕 + 포인트 색 테두리(민트에서 주 버튼과 구별되게, 글자 대비 4.5:1 이상) */
.dl-btn-share { background: var(--surface); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.dl-btn-share:hover { background: var(--accent-soft); }
/* 파일을 미리 받는 중: 「준비 중…」, 누를 수 없음 */
.dl-btn:disabled, .dl-btn[aria-busy="true"] { cursor: progress; transform: none; }
.dl-btn-share:disabled { background: var(--surface); color: var(--accent-dis-ink); box-shadow: inset 0 0 0 1.5px var(--accent-dis-line); }
.dl-btn-share-line:disabled { color: var(--accent-dis-ink); box-shadow: inset 0 0 0 1.5px var(--accent-dis-line); }
.dl-btn small { font-weight: 600; font-size: 13px; opacity: .7; font-feature-settings: "tnum" 1; }
.dl-btn small:empty { display: none; }
.dl-ico { width: 22px; height: 22px; flex: none; }

.dl-note { margin: 0; color: var(--ink-2); font-size: 14px; }
.dl-fine { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

/* 영상 공유가 안 될 때: SNS에 올리기(바로가기 + 문구 복사). 로고 없이 글자 칩 */
.dl-sns {
  display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line); text-align: start;
}
.vs-h { margin: 0; font-weight: 800; font-size: 15px; }
.vs-guide { margin: 0; color: var(--ink-2); font-size: 14px; }
.vs-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vs-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 6px 10px;
  border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px;
}
.vs-link:hover { background: var(--bg); }
.vs-ext { width: 14px; height: 14px; flex: none; opacity: .6; }
.vs-copy {
  justify-self: start; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 15px;
}
.vs-link:focus-visible, .vs-copy:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 짧은 알림(문구 복사 등). 아래쪽에 떴다가 4초 뒤 사라진다 */
.dl-toast {
  position: fixed; z-index: 10; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 10px 16px; border-radius: 12px;
  background: var(--toast-bg); color: #fff; font-size: 14px; font-weight: 600; text-align: center;
  box-shadow: 0 12px 32px rgba(20, 20, 22, .22);
}

/* 준비 중·만료·없음 */
.dl-state {
  display: grid; align-content: center; justify-items: center; gap: 12px; text-align: center;
  max-width: 440px; width: 100%; margin: 0 auto; padding: 8vh 0 8px;
}
.dl-state .dl-btn { margin-top: 8px; width: 100%; }
.dl-state-ico { width: 48px; height: 48px; color: var(--muted); }
.dl-slow { display: grid; gap: 8px; width: 100%; }

/* 나도 찍어 보기: 모든 상태에서 맨 아래(처음 불러오는 동안만 숨김). 만료·없음에서는 이게 주된 길 */
.dl-cta {
  width: 100%; max-width: 440px; margin: 12px auto 0; padding: 18px; border-radius: var(--radius);
  background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 10px 28px rgba(20, 20, 22, .07);
  display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center;
}
body[data-state="loading"] .dl-cta { display: none; }
.dl-cta-fox { width: 64px; height: 64px; }
.dl-cta-txt { display: grid; gap: 2px; min-width: 0; }
.dl-cta-h { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 800; }
.dl-cta-sub { margin: 0; color: var(--ink-2); font-size: 14px; }
.dl-cta-go { grid-column: 1 / -1; width: 100%; }
.dl-cta-login {
  grid-column: 1 / -1; justify-self: center; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  color: var(--ink-2); font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; border-radius: 10px;
}
.dl-cta-login:hover { color: var(--ink); }
.dl-cta-login:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 넓은 화면: 사진 왼쪽, 단추 오른쪽 */
@media (min-width: 760px) {
  .dl { padding: 0 32px 32px; }
  .dl-top { min-height: 84px; }
  .dl-cta { max-width: 880px; grid-template-columns: auto 1fr minmax(200px, 260px); padding: 18px 22px; }
  .dl-cta-fox, .dl-cta-txt { grid-row: 1 / span 2; }
  .dl-cta-go { grid-column: 3; grid-row: 1; }
  .dl-cta-login { grid-column: 3; grid-row: 2; margin-top: -8px; }
  .dl-ready { grid-template-columns: auto minmax(300px, 400px); align-items: center; justify-content: center; gap: 48px; flex: 1; padding-bottom: 32px; }
  .dl-photo { padding: 14px; }
  .dl-photo img { max-height: calc(100vh - 170px); max-height: calc(100dvh - 170px); }
  .dl-side { text-align: start; }
  .dl-left { justify-self: start; margin-inline-start: 0; }
}
/* 내 앨범에 저장 · 30일 보관(assets/booth-album.js): 사진·영상 단추 아래 한 줄 + 상태 글 + [내 앨범 보기].
 * 색은 모두 토큰이라 어두운 화면에서도 그대로 맞는다 */
.kba { display: grid; gap: 6px; }
.kba-btn { width: 100%; }
.kba-btn:disabled { color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); cursor: not-allowed; transform: none; }
.kba-btn[aria-busy="true"] { opacity: .7; }
.kba-msg { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.kba-msg[data-st="saved"], .kba-msg[data-st="already"] { color: var(--accent); font-weight: 700; }
.kba-msg[data-st="error"], .kba-msg[data-st="expired"] { color: var(--ink); font-weight: 700; }
.kba-go { display: inline-flex; align-items: center; min-height: 32px; padding: 0 .2em; white-space: nowrap; border-radius: 6px;
  color: var(--accent); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.kba-go:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 이메일 시트(가운데 판, 폰에서는 아래에서 올라온다). 고객 문의 단추(z 900) 위 */
.dl-sheet {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 12, 14, .5); animation: dl-in .2s var(--ease);
}
@keyframes dl-in { from { opacity: 0; } }
.dl-sheet-box {
  position: relative; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain;
  display: grid; gap: 14px; padding: 12px 20px 20px; border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(0, 0, 0, .25);
}
.dl-sheet-x {
  position: absolute; top: 12px; inset-inline-end: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--surface-2); color: var(--ink); font-size: 24px; line-height: 1;
}
.dl-sheet-x:hover { background: var(--line); }
.dl-sheet-x:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.dl-sheet-h { margin: 0; padding: 0 44px; min-height: 44px; display: grid; place-items: center; text-align: center; font-size: 20px; line-height: 1.3; font-weight: 800; }
.kba-ask, .kba-sent { display: grid; gap: 12px; }
.kba-d { margin: 0; color: var(--ink-2); text-align: center; font-size: 15px; }
.kba-form { display: grid; gap: 8px; margin: 0; }
.kba-label { font-weight: 700; font-size: 15px; }
.kba-input {
  width: 100%; min-height: 52px; padding: 0 14px; border-radius: 12px; border: 0; box-shadow: inset 0 0 0 1.5px var(--line-strong);
  background: var(--surface-2); color: var(--ink); font: inherit; font-size: 16px;
}
.kba-input::placeholder { color: var(--muted); }
.kba-input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.kba-input[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--ink); }
.kba-err { margin: 0; color: var(--ink); font-size: 14px; font-weight: 700; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); }
.kba-send { width: 100%; }
.kba-fine { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.kba-sent-t { margin: 0; text-align: center; font-weight: 800; font-size: 18px; }
.kba-to { margin: 0; text-align: center; font-weight: 700; overflow-wrap: anywhere; }
.kba-to:empty { display: none; }
@media (max-width: 599px) {
  .dl-sheet { place-items: end center; padding: 8px 0 0; }
  .dl-sheet-box { max-height: calc(100dvh - 8px); border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .dl-sheet { animation: none; } }
