/* 타임스탬프 카메라
 * 레이아웃: 위는 뷰파인더(사진 비율 그대로), 아래는 조작 도크. 가로 화면에서는 도크가 오른쪽으로 갑니다.
 * 화면 모드: 다크(기본)·라이트·자동. 라이트에서는 카메라 화면 바탕과 위 버튼도 밝게 바뀌고, 사진 보기와 토스트는 늘 어둡게 둡니다.
 *
 * 색 토큰
 *   --stamp       사진 속 도장 색 (설정의 '도장 색', js/stamp.js 가 읽음)
 *   --accent      버튼·스위치 강조색
 *   --accent-ink  강조색 글자 (라이트 화면에서 읽히도록 진하게)
 */
:root {
  --bg: #0d1015;
  --surface: #161a21;
  --surface-2: #1f242c;
  --line: #2c323c;
  --fg: #f4efe6;
  --muted: #9da3ad;
  --stamp: #ff9e86;         /* 도장 색 (사진 속 날짜 색과 동일, 기본 코랄) */
  --accent: var(--stamp);
  --accent-ink: var(--accent);
  --danger-ink: #ff8a80;
  --ok: #3ddc84;
  --warn: #e2c28c;
  --err: #ff6257;
  --kakao: #fee500;
  --kakao-fg: #191600;

  --font-ui: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --radius: 0.875rem;
  --gutter-l: max(1rem, env(safe-area-inset-left, 0px));
  --gutter-r: max(1rem, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}

/* 라이트 화면: 바탕은 순백, 칸 구분은 옅은 회색 */
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --line: #e5e7eb;
  --fg: #1a1c21;
  --muted: #6c707a;
  --accent-ink: color-mix(in srgb, var(--accent) 58%, #000);
  --danger-ink: #d93a30;
  color-scheme: light;
}
/* 라이트: 고른 항목은 흰 카드처럼 떠 보이게 */
:root[data-theme="light"] .segmented { background: var(--surface-2); border-color: transparent; }
:root[data-theme="light"] .segmented input:checked + span { background: var(--surface); box-shadow: 0 1px 0.1875rem rgba(0,0,0,.12); }

/* 늘 어두운 곳: 카메라 위 버튼, 카메라 안내, 사진 보기, 토스트 */
.topbar, .cam-state, .busy, .viewer, .toast {
  --bg: #0d1015; --surface: #161a21; --surface-2: #1f242c; --line: #2c323c;
  --fg: #f4efe6; --muted: #9da3ad;
  --accent: var(--stamp); --accent-ink: var(--stamp); --danger-ink: #ff8a80;
  color: var(--fg);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; width: 100%; max-width: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 0.9375rem/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation; /* 셔터를 빠르게 두 번 눌러도 화면이 확대되지 않게 */
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 1.375rem; height: 1.375rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.fill { fill: currentColor; stroke: none; }
:focus-visible { outline: 0.125rem solid var(--accent); outline-offset: 0.125rem; }

.app {
  height: 100%;
  width: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);   /* 내용이 길어도 화면 폭을 넘지 않게 */
}
.stage, .dock { min-width: 0; }

/* ---------- 뷰파인더 ---------- */
.stage {
  position: relative;
  min-height: 0;
  background: #000;
  overflow: hidden;
}
#video, #result {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}
#video.mirror { transform: scaleX(-1); }
#overlay { position: absolute; pointer-events: none; }
body[data-mode="review"] #video,
body[data-mode="review"] #overlay { visibility: hidden; }
body[data-mode="capture"] #result { display: none; }

.topbar {
  position: absolute; inset: 0 0 auto;
  display: flex; align-items: center; gap: 0.625rem;
  padding: calc(0.625rem + env(safe-area-inset-top, 0px)) var(--gutter-r) 0.625rem var(--gutter-l);
  background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0));
  z-index: 3;
}
.pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-width: 0; max-width: 100%;
  margin-right: auto;
  padding: 0.5rem 0.875rem 0.5rem 0.75rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 62.4375rem;
  background: rgba(22,25,24,.72);
  backdrop-filter: blur(0.625rem); -webkit-backdrop-filter: blur(0.625rem);
  font-size: 0.875rem; font-weight: 500;
}
.pill__dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted); flex: none; }
.pill[data-state="ok"] .pill__dot { background: var(--ok); box-shadow: 0 0 0 0.1875rem rgba(61,220,132,.2); }
.pill[data-state="wait"] .pill__dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.pill[data-state="err"] .pill__dot { background: var(--err); }
.pill__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes pulse { 50% { opacity: .35; } }

.icon-btn {
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem; flex: none;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  background: rgba(22,25,24,.72);
  backdrop-filter: blur(0.625rem); -webkit-backdrop-filter: blur(0.625rem);
}
.icon-btn--flat { background: var(--surface-2); border-color: transparent; backdrop-filter: none; }
/* 찍기 화면: 위치 상태 · 메모 · 설정 / 찍은 뒤: 다시 찍기만 */
#retakeBtn { display: none; }
body[data-mode="review"] #retakeBtn { display: inline-flex; }
body[data-mode="review"] #gpsPill,
body[data-mode="review"] #memoChip,
body[data-mode="review"] #settingsBtn { display: none; }
.pill svg { width: 1.0625rem; height: 1.0625rem; }
.pill--close { gap: 0.375rem; padding-left: 0.75rem; }
.pill--memo { margin-right: 0; flex: 0 1 auto; max-width: 46%; color: var(--muted); }
.pill--memo.has-memo { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
#gpsPill { flex: 0 0 auto; }

/* 라이트: 사진 위아래 빈 곳도 흰 바탕, 위 버튼은 흰 알약 */
:root[data-theme="light"] .stage { background: var(--bg); }
:root[data-theme="light"] .topbar {
  --fg: #1a1c21; --muted: #6c707a;
  --accent-ink: color-mix(in srgb, var(--accent) 58%, #000);
  background: none;
}
:root[data-theme="light"] .topbar .pill,
:root[data-theme="light"] .topbar .icon-btn {
  background: rgba(255,255,255,.9);
  border-color: rgba(0,0,0,.08);
  box-shadow: 0 1px 0.25rem rgba(0,0,0,.08);
}
:root[data-theme="light"] .topbar .pill--memo.has-memo { color: var(--accent-ink); }

.cam-state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.625rem;
  padding: 1.5rem var(--gutter-r) 1.5rem var(--gutter-l);
  text-align: center;
  background: radial-gradient(circle at 50% 40%, #1a1e1c, #000 70%);
  z-index: 2;
}
.cam-state__icon { width: 2.75rem; height: 2.75rem; stroke-width: 1.4; color: var(--muted); }
.cam-state strong { font-size: 1.125rem; font-weight: 700; text-wrap: balance; }
.cam-state p { margin: 0; max-width: 30ch; color: var(--muted); text-wrap: balance; }
.cam-state__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 0.5rem; }

.btn { border-radius: 0.75rem; padding: 0.6875rem 1rem; font-weight: 600; border: 1px solid transparent; }
.btn--light { background: var(--fg); color: var(--bg); }
.btn--ghost { background: transparent; border-color: var(--line); }

.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 4; transition: opacity .3s ease-out; }
.flash.on { opacity: .85; transition: none; }

.busy {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.75rem 1.125rem; border-radius: 62.4375rem;
  background: rgba(22,25,24,.9); font-size: 0.875rem; z-index: 5;
}
.spinner { width: 1.125rem; height: 1.125rem; border-radius: 50%; border: 0.125rem solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 도크 ---------- */
.dock {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 0.75rem var(--gutter-r) calc(0.875rem + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
}
.dock__capture, .dock__review { display: flex; flex-direction: column; gap: 0.875rem; max-width: 35rem; margin-inline: auto; }
body[data-mode="capture"] .dock__review,
body[data-mode="review"] .dock__capture { display: none; }

.memo {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0 0.375rem 0 0.875rem; height: 3rem;
  border: 1px solid var(--line); border-radius: 0.75rem;
  background: var(--bg);
  color: var(--muted);
}
.memo:focus-within { border-color: var(--accent); color: var(--accent-ink); }
.memo input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--fg); font-size: 1rem; }
.memo input::placeholder { color: var(--muted); }
.memo__clear { display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.memo__clear svg { width: 1rem; height: 1rem; }

.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.controls > :first-child { justify-self: start; }
.controls > :last-child { justify-self: end; }
.round-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  width: 4.5rem; padding: 0.5rem 0;
  border: 0; border-radius: 0.75rem; background: none;
  color: var(--fg); font-size: 0.8125rem; cursor: pointer;
}
.round-btn svg { width: 1.75rem; height: 1.75rem; }
.round-btn:active { background: var(--surface-2); }
.round-btn[disabled] { visibility: hidden; }
.album-thumb {
  display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem;
  border-radius: 0.625rem;
  background: var(--surface-2) center / cover no-repeat;
}
.album-thumb.has-photo { border: 2px solid var(--fg); }
.album-thumb.has-photo svg { display: none; }
.round-btn:has(.album-thumb) { gap: 0.3125rem; }

/* 촬영 버튼: 설정의 도장 색으로 밝은 쪽 → 진한 쪽 그라데이션 (테두리와 안쪽 원 모두) */
.shutter {
  --shutter-grad: linear-gradient(135deg,
    color-mix(in srgb, var(--stamp) 45%, #fff) 0%,
    var(--stamp) 50%,
    color-mix(in srgb, var(--stamp) 68%, #000) 100%);
  width: 5rem; height: 5rem; padding: 0.3125rem;
  border: 0.25rem solid var(--stamp); border-radius: 50%;
  border-color: transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--shutter-grad) border-box;
}
.shutter span {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  background: var(--stamp); background: var(--shutter-grad);
  box-shadow: inset 0 0.125rem 0.25rem rgba(255,255,255,.35), inset 0 -0.1875rem 0.375rem rgba(0,0,0,.18);
  transition: transform .1s, filter .1s;
}
.shutter:active span { transform: scale(.86); filter: brightness(.9); }

/* 찍은 뒤: 저장과 카카오톡 공유를 같은 크기로 나란히 (버리기는 왼쪽 위) */
.dock__review { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; }
.dock__review .action { min-height: 3.75rem; }
.action {
  min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3.25rem; padding: 0.75rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 1rem; font-weight: 600;
  white-space: nowrap;
}
.action svg { width: 1.375rem; height: 1.375rem; }
.action:active { filter: brightness(1.15); }
.action[disabled] { opacity: .6; }
.viewer__actions .action--kakao { grid-column: 1 / -1; order: -1; }
.action--kakao {
  min-height: 3.75rem;
  background: var(--kakao); border-color: var(--kakao); color: var(--kakao-fg);
  font-size: 1.0625rem; font-weight: 700;
}
.action--kakao svg { width: 1.5rem; height: 1.5rem; }

/* ---------- 설정 시트 ---------- */
.sheet {
  width: 100%; max-width: 35rem;
  margin: auto auto 0; padding: 0;
  border: 0; border-radius: 1.25rem 1.25rem 0 0;
  background: var(--surface); color: var(--fg);
  max-height: 85vh;
}
.sheet::backdrop { background: rgba(0,0,0,.55); }
.sheet[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(2.5rem); opacity: 0; } }
.sheet__inner { display: flex; flex-direction: column; gap: 1.25rem; padding: 0.5rem var(--gutter-r) calc(1.25rem + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.sheet__grip { width: 2.5rem; height: 0.25rem; border-radius: 0.125rem; background: var(--line); margin: 0 auto; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; }
.sheet__head h2 { margin: 0; font-size: 1.125rem; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 0.125rem; }
.field h3 { margin: 0 0 0.375rem; font-size: 0.75rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.sheet__hint { margin: -0.5rem 0 0; color: var(--muted); font-size: 0.875rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  max-width: 100%; padding: 0.5rem 0.875rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip:active { background: var(--surface-2); }
.sheet__foot { margin: 0; display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.75rem; color: var(--muted); }
#appVersion { flex: none; font-variant-numeric: tabular-nums; }

.switch { display: flex; align-items: center; justify-content: space-between; min-height: 3rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: relative; width: 2.875rem; height: 1.75rem; border-radius: 62.4375rem; background: var(--surface-2); border: 1px solid var(--line); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 0.1875rem; left: 0.1875rem; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.switch input:checked + i::after { transform: translateX(1.125rem); background: var(--bg); }
.switch input:focus-visible + i { outline: 0.125rem solid var(--accent); outline-offset: 0.125rem; }

.segmented { display: flex; gap: 0.25rem; padding: 0.25rem; border-radius: 0.75rem; background: var(--bg); border: 1px solid var(--line); }
.segmented label { flex: 1; cursor: pointer; }
.segmented--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* 도장 위치: 화면 모서리 배치 그대로 2×2 */
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 0.5625rem 0.25rem; border-radius: 0.5625rem; text-align: center; font-size: 0.875rem; color: var(--muted); }
.segmented input:checked + span { background: var(--surface-2); color: var(--fg); font-weight: 600; box-shadow: 0 1px 0.125rem rgba(0,0,0,.4); }
.segmented input:focus-visible + span { outline: 0.125rem solid var(--accent); }

/* 도장 색 고르기 */
.swatches { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.25rem; }
.swatches label { display: flex; flex-direction: column; align-items: center; gap: 0.375rem; padding: 0.375rem 0; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches i { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 0.1875rem var(--surface), 0 0 0 0.25rem transparent; transition: box-shadow .15s, transform .15s; }
.swatches span { font-size: 0.75rem; color: var(--muted); }
.swatches i::after { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.swatches input:checked + i { box-shadow: 0 0 0 0.1875rem var(--surface), 0 0 0 0.3125rem var(--c); transform: scale(1.04); }
.swatches input:checked ~ span { color: var(--fg); font-weight: 600; }
.swatches input:focus-visible + i { outline: 0.125rem solid var(--fg); outline-offset: 0.375rem; }

/* ---------- 사진첩 ---------- */
.gallery, .viewer {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.gallery__bar, .viewer__bar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: calc(0.625rem + env(safe-area-inset-top, 0px)) var(--gutter-r) 0.625rem var(--gutter-l);
}
.gallery__bar { border-bottom: 1px solid var(--line); }
.gallery__bar h2 { margin: 0; font-size: 1.125rem; font-weight: 700; }
.text-btn { border: 0; background: none; padding: 0.5rem 0.25rem; color: var(--accent-ink); font-size: 0.9375rem; font-weight: 600; flex: none; }
.text-btn:disabled { color: var(--muted); }
.gallery__bar--select, .gallery__footer { display: none; }
.gallery.is-selecting .gallery__bar:not(.gallery__bar--select) { display: none; }
.gallery.is-selecting .gallery__bar--select { display: flex; }
.gallery.is-selecting .gallery__footer { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.gallery__bar--select h2 { flex: 1; font-variant-numeric: tabular-nums; }
.gallery__footer {
  padding: 0.75rem var(--gutter-r) calc(0.875rem + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  background: var(--surface); border-top: 1px solid var(--line);
}
.gallery__footer .action { width: 100%; padding-inline: 0.5rem; }
.gallery__footer .action:disabled { opacity: .4; }
.gallery__check {
  position: absolute; top: 0.375rem; right: 0.375rem;
  display: none; place-items: center;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,.3);
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.gallery__check svg { width: 0.9375rem; height: 0.9375rem; stroke-width: 3; color: var(--bg); opacity: 0; }
.gallery.is-selecting .gallery__check { display: grid; }
.gallery__item.is-selected .gallery__check { background: var(--accent); border-color: var(--accent); }
.gallery__item.is-selected .gallery__check svg { opacity: 1; }
.gallery__item.is-selected img { transform: scale(.88); border-radius: 0.375rem; }
.gallery__item img { transition: transform .12s; }
.gallery__item { -webkit-touch-callout: none; user-select: none; }
.gallery__count { margin-left: auto; font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.gallery__scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 var(--gutter-r) calc(1.5rem + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
}
.gallery__note { margin: 0.75rem 0 0; padding: 0.75rem 0.875rem; border-radius: 0.75rem; background: var(--surface-2); color: var(--muted); font-size: 0.8125rem; }
.gallery__day {
  position: sticky; top: 0; z-index: 1;
  margin: 0; padding: 1rem 0 0.5rem;
  background: var(--bg);
  font-size: 0.875rem; font-weight: 600; color: var(--muted); letter-spacing: .02em;
}
.gallery__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.25rem; }
@media (min-width: 600px) { .gallery__grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.gallery__item {
  position: relative; display: block; padding: 0; border: 0;
  aspect-ratio: 3 / 4; max-width: 100%;
  border-radius: 0.375rem; overflow: hidden; background: var(--surface-2);
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery__item:active { opacity: .8; }
.gallery__empty {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 4rem 1rem; text-align: center; color: var(--muted);
}
.gallery__empty svg { width: 2.75rem; height: 2.75rem; stroke-width: 1.4; }
.gallery__empty strong { color: var(--fg); font-size: 1.0625rem; }
.gallery__empty p { margin: 0; max-width: 28ch; text-wrap: balance; }

.viewer { z-index: 30; background: #000; }
.viewer__bar { position: absolute; inset: 0 0 auto; z-index: 1; background: linear-gradient(rgba(0,0,0,.65), rgba(0,0,0,0)); }
.viewer__title { display: flex; flex-direction: column; min-width: 0; }
.viewer__title strong { font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.viewer__title span { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer__img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.viewer__actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem;
  padding: 0.75rem var(--gutter-r) calc(0.875rem + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  background: var(--surface); border-top: 1px solid var(--line);
}
.action--danger { color: var(--danger-ink); }
.action--save .saved-icon { display: none; }
.action--save.is-saved { opacity: 1; color: var(--ok); border-color: rgba(61,220,132,.4); }
.action--save.is-saved .save-icon { display: none; }
.action--save.is-saved .saved-icon { display: block; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(10rem + env(safe-area-inset-bottom, 0px));
  max-width: calc(100% - 2rem);
  padding: 0.6875rem 1rem; border-radius: 0.75rem;
  background: rgba(31,35,33,.96); border: 1px solid var(--line);
  font-size: 0.875rem; text-align: center; z-index: 40;
  animation: fade .2s ease-out;
}
.toast--action { display: flex; align-items: center; gap: 1rem; text-align: left; padding-right: 0.5rem; white-space: nowrap; }
.gallery.is-selecting ~ .toast, .gallery:not([hidden]) ~ .toast { bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); }
.toast__action {
  flex: none; padding: 0.5rem 0.75rem; border: 0; border-radius: 0.5rem;
  background: transparent; color: var(--accent); font-weight: 700;
}
.toast__action:active { background: var(--surface-2); }
@keyframes fade { from { opacity: 0; transform: translate(-50%, 0.5rem); } }

/* ---------- 가로 화면 ---------- */
@media (orientation: landscape) and (max-height: 540px) {
  .app { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto; }
  .dock {
    border-top: 0; border-left: 1px solid var(--line);
    width: 16.25rem;
    padding: calc(0.75rem + env(safe-area-inset-top, 0px)) var(--gutter-r) calc(0.75rem + env(safe-area-inset-bottom, 0px)) 1rem;
    display: flex; align-items: center;
  }
  .dock__capture, .dock__review { width: 100%; }
  .dock__review { grid-template-columns: 1fr; }
  .action--kakao { min-height: 3.25rem; }
  .viewer__actions { grid-template-columns: repeat(3, 1fr); }
  .viewer__actions .action--kakao { grid-column: auto; order: 0; }
  .toast { bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 촬영자 이름 (설정 > 표시할 내용) */
.author {
  display: flex; align-items: center; gap: 0.75rem;
  margin-top: 0.5rem; padding: 0 0.875rem; height: 3rem;
  border: 1px solid var(--line); border-radius: 0.75rem;
  background: var(--bg);
}
.author:focus-within { border-color: var(--accent); }
.author span { flex: none; color: var(--fg); font-size: 0.9375rem; }
.author input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--fg); font-size: 1rem; text-align: right; }
.author input::placeholder { color: var(--muted); }
.author.is-off { opacity: .45; }
.author__hint { margin: 0.375rem 0 0; color: var(--muted); font-size: 0.8125rem; }
