/* 納品ページ（お客様が見る画面）。写真が主役。文字とボタンは最小限 */

body[data-bg="black"] {
  --bg: #0d0d0e; --bg-subtle: #1a1b1d; --text: #ecedef; --muted: #a2a6ad; --border: #2c2e31; --navy: #f2f3f5;
  color-scheme: dark;
}

.loading, .message-page { min-height: 70svh; display: grid; place-items: center; padding: 24px 16px; text-align: center; color: var(--muted); }
.message-page h1 { margin: 0 0 12px; font-size: 22px; color: var(--navy); font-weight: 600; }
.message-page p { margin: 0; }

/* パスワード */
.lock { max-width: 360px; margin: 18svh auto 0; padding: 0 16px; text-align: center; }
.lock h1 { font-size: 20px; color: var(--navy); font-weight: 600; }
.lock input { width: 100%; min-height: 48px; margin: 12px 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); text-align: center; font-size: 18px; }
.lock .error { min-height: 1.5em; color: #d9534f; font-size: 14px; }

/* 見本のアルバムの帯 */
.sample-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 15; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); background: rgba(19, 32, 58, .88); color: #fff; font-size: 12px; backdrop-filter: blur(6px); }
.sample-bar a { color: #fff; white-space: nowrap; }
body:has(.sample-bar) .toolbar { top: 36px; }

/* 確かめ用の帯（撮影者にだけ出る） */
.preview-bar { padding: 8px 16px; background: #fdf3dc; color: #6b4600; font-size: 13px; text-align: center; }

/* 表紙 */
.cover { position: relative; height: 100svh; min-height: 480px; overflow: hidden; background: var(--bg-subtle); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0) 45%, rgba(0,0,0,.55)); }
.cover-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 32px 20px calc(36px + env(safe-area-inset-bottom)); color: #fff; text-align: center; }
.cover-text .client { margin: 0 0 6px; font-size: 14px; letter-spacing: .12em; opacity: .9; }
.cover-text h1 { margin: 0; font-size: clamp(24px, 6vw, 40px); font-weight: 600; letter-spacing: .08em; line-height: 1.4; }
.cover-text .meta { margin: 10px 0 0; font-size: 14px; letter-spacing: .08em; opacity: .9; }
.cover-text .go { display: inline-block; margin-top: 22px; padding: 10px 22px; border: 1px solid rgba(255,255,255,.7); border-radius: 999px; color: #fff; text-decoration: none; font-size: 14px; letter-spacing: .1em; }

.message { max-width: 34em; margin: 0 auto; padding: 48px 20px 8px; text-align: center; white-space: pre-line; color: var(--text); }

/* 保存の帯 */
.toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.toolbar .count { font-size: 14px; color: var(--muted); }
.toolbar { flex-wrap: nowrap; }
.toolbar .count { flex: none; }
.toolbar .controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.toolbar select { min-width: 0; min-height: 40px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); font-size: 14px; }
.toolbar .btn { flex: none; white-space: nowrap; }
body[data-bg="black"] .btn { background: #1d1e21; border-color: #3a3c40; color: #ecedef; }
body[data-bg="black"] .btn-primary { background: #f2f3f5; border-color: #f2f3f5; color: #111; }

/* 写真の並び：縦横が混ざっても崩れない（行ごとに幅をそろえる） */
/* 左右の端まで余白なし（間は3px。album.js の GAP と同じ） */
.grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; padding: 0; }
.grid .item { flex: none; margin: 0; padding: 0; border: 0; background: var(--bg-subtle); cursor: zoom-in; overflow: hidden; }
.grid .item img { width: 100%; height: 100%; object-fit: cover; }

/* 1枚を大きく：写真を画面いっぱいに。ボタンは写真の上に重ねる */
.viewer { position: fixed; inset: 0; z-index: 20; background: #000; color: #fff; }
.viewer[hidden] { display: none; }
.viewer-stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; touch-action: pan-y pinch-zoom; }
.viewer-stage img { width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viewer-top, .viewer-bottom {
  position: absolute; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px;
  transition: opacity .2s;
}
.viewer-top { top: 0; padding-top: calc(10px + env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0)); }
.viewer-bottom { bottom: 0; padding: 28px 12px calc(16px + env(safe-area-inset-bottom)); justify-content: center; background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.55)); }
.viewer.bare .viewer-top, .viewer.bare .viewer-bottom, .viewer.bare .nav { opacity: 0; pointer-events: none; }
.viewer .nav { position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); width: 48px; height: 64px; border: 0; background: transparent; color: #fff; font-size: 30px; cursor: pointer; opacity: .8; text-shadow: 0 1px 6px rgba(0,0,0,.5); transition: opacity .2s; }
.viewer .nav:hover { opacity: 1; }
.viewer .prev { left: 4px; }
.viewer .next { right: 4px; }
.viewer .icon-btn { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: #fff; font-size: 26px; cursor: pointer; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.viewer .btn { background: #fff; color: #111; border-color: #fff; }
.viewer .counter { font-size: 14px; opacity: .9; text-shadow: 0 1px 6px rgba(0,0,0,.5); }

/* まとめて保存（スマホ） */
.sheet { position: fixed; inset: 0; z-index: 30; display: grid; align-items: end; background: rgba(0,0,0,.45); }
.sheet[hidden] { display: none; }
.sheet-body { max-height: 80svh; overflow: auto; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; background: var(--bg); }
.sheet-body h2 { margin: 0 0 6px; font-size: 18px; color: var(--navy); }
.sheet-body p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.batches { display: grid; gap: 8px; margin: 12px 0; }
.batches .btn { width: 100%; justify-content: space-between; }
.batches .btn.done { opacity: .6; }

.footer { padding: 40px 16px calc(48px + env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: var(--muted); }
.footer p { margin: 4px 0; }
.footer a { color: var(--muted); text-decoration: none; letter-spacing: .1em; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 40; transform: translateX(-50%) translateY(20px);
  max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px; background: #13203a; color: #fff; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
