@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/playfair-display-700.woff2') format('woff2');
}

@font-face {
  font-family: 'Pretendard';
  font-style: normal;
  font-weight: 45 920;
  font-display: swap;
  src: url('/fonts/PretendardVariable.woff2') format('woff2-variations');
}

:root {
  --bg: #0a0a0a;
  --bg-soft: #161616;
  --paper: #ffffff;
  --paper-dark: #e9e9e9;
  --ink: #0a0a0a;
  --accent: #ffffff;
  --accent-ink: #0a0a0a;
  --accent-dark: #cfcfcf;
  --muted: #8f8f8f;
  --line: rgba(255,255,255,0.12);
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--paper);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* 데스크톱처럼 넓은 화면에서는 모바일 폭(480px)으로 앱을 가운데 고정한다.
   body에 transform을 주면 position:fixed인 모든 자식(.view, 모달, 토스트, FAB 등)이
   뷰포트가 아니라 이 480px 칼럼을 기준으로 다시 배치돼서, 다른 CSS는 손댈 필요가 없다. */
body {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  transform: translateZ(0);
}
@media (min-width: 481px) {
  body { box-shadow: 0 0 0 1px var(--line); }
}

button { font-family: inherit; }
button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.hidden { display: none !important; }

.icon-sprite { display: none; }
.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: -3px;
  flex-shrink: 0;
}
.fab .icon { width: 24px; height: 24px; vertical-align: -4px; }

.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.offscreen { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; top: -9999px; }

/* ---------- 스플래시 스크린 ---------- */
.splash {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.4s ease;
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash-logo {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: 0.5px;
  color: #fff;
}

/* ---------- 온보딩 ---------- */
.onboarding-track {
  flex: 1;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.onboarding-track::-webkit-scrollbar { display: none; }
.onboarding-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px 36px;
  text-align: center;
}
.onboarding-slide h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: 0.2px; }
.onboarding-slide p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; max-width: 300px; white-space: pre-line; }
.onboarding-canvas {
  width: 120px;
  height: 120px;
  image-rendering: pixelated;
  border-radius: 50%;
  box-shadow: var(--shadow);
}
.onboarding-logo { font-size: 30px; margin: 0; }
.receipt-photo .onboarding-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
  box-shadow: none;
}
/* 온보딩용 인화 장면: 실제 캡처 화면과 같은 프린터 UI를 재사용하되, 영수증 내용을 제목+사진만으로
   짧게 줄여서 프린터 창(paper-track) 높이도 그만큼만 필요하게 만든다 */
.onboarding-printer-mini .paper-track { height: 190px; }
.onboarding-stack-mini { width: 150px; cursor: default; }
.onboarding-stack-mini:active { transform: none; }
.onboarding-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 22px max(22px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}

/* ---------- 로그인 화면 ---------- */
.login-view { align-items: center; justify-content: center; }
.login-content {
  width: 100%;
  max-width: 300px;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  text-align: center;
}
.login-tagline { margin: 0; color: var(--muted); font-size: 13px; }
.login-buttons { width: 100%; display: flex; flex-direction: column; gap: 9px; }
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--paper);
  font-size: 13px;
  cursor: pointer;
}
.login-btn:active { background: rgba(255,255,255,0.1); }
.login-btn-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}
.login-btn-guest { border-style: dashed; color: var(--muted); margin-top: 4px; }

/* ---------- 상단바 ---------- */
.topbar {
  padding: max(18px, env(safe-area-inset-top)) 20px 12px;
  flex-shrink: 0;
}
.topbar h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: 0.5px; font-weight: 800; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }

.home-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  /* Feed 화면엔 오른쪽 아이콘 버튼(38px)이 없어서, 이 줄이 없으면 텍스트 높이만큼만 차지해
     My Album 화면보다 살짝 낮아지고, 그 아래 카드/리스트 위치가 화면마다 미묘하게 달라 보였다. */
  min-height: 38px;
}
.home-topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.daily-question-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 20px 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02));
}
/* 카드 전체가 아니라, 왼쪽 텍스트 영역만 눌러도 카메라로 바로 들어간다 (오른쪽 아이콘들과 별개 버튼) */
.daily-question-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  flex: 1;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.daily-question-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* 이 카드가 곧 "눌러서 사진으로 답하기" 버튼이라는 걸 알려주는 카메라 아이콘 —
   앱 전체에서 카메라 아이콘 = 촬영이라는 규칙을 그대로 재사용한다 */
.daily-question-icon,
.daily-question-gallery-btn {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  padding: 0;
  cursor: pointer;
}
.daily-question-icon .icon,
.daily-question-gallery-btn .icon { width: 18px; height: 18px; }
.daily-question-gallery-btn { opacity: 0.75; }
.daily-question-gallery-btn:active,
.daily-question-icon:active { background: rgba(255,255,255,0.16); }
/* 오늘 이미 Feed에 공유한 상태 — 카메라 대신 초록 체크로 "이미 했다"는 걸 알려준다 */
.daily-question-icon.posted {
  background: rgba(52,199,89,0.16);
  border-color: rgba(52,199,89,0.4);
  color: #34c759;
}
.daily-question-label-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.daily-question-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted);
  font-family: 'Courier New', ui-monospace, monospace;
  text-transform: uppercase;
}
.daily-question-date {
  font-size: 11px;
  color: var(--muted);
  font-family: 'Courier New', ui-monospace, monospace;
  letter-spacing: 0.2px;
}
.daily-question-text {
  font-size: 15.5px;
  color: var(--accent);
  line-height: 1.4;
}
.logo-word {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.3px;
}
.home-stats {
  margin: 8px 0 0;
  font-family: 'Courier New', ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.book-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--line);
}
.book-title-wrap { flex: 1; display: flex; align-items: center; gap: 8px; justify-content: center; min-width: 0; }
.book-title-col { min-width: 0; text-align: center; }
#bookTitle { margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.3px; }
.book-desc {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:active { background: rgba(255,255,255,0.12); }

.badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e53935;
  border: 1.5px solid var(--bg, #000);
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  margin: 12px 0;
}
.notification-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}
.notification-item .notification-time {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.6;
}
.notifications-empty {
  text-align: center;
  opacity: 0.6;
  font-size: 13px;
  padding: 24px 0;
}

.blocked-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
}
.blocked-user-item button {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  font-size: 12px;
  cursor: pointer;
}

.report-reason-list,
.sheet-option-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.report-other-form textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 12px;
  padding: 10px;
  font: inherit;
  resize: vertical;
  background: var(--bg-soft);
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* ---------- 홈: 북 그리드 (포토앨범 스택 카드) ---------- */
.book-grid {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px 100px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px 16px;
  align-content: start;
}

.book-card {
  position: relative;
  padding-top: 12px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.book-card:active { transform: scale(0.96); }

.stack-layer {
  position: absolute;
  left: 8px; right: 8px;
  top: 12px; bottom: 4px;
  background: #dcdcdc;
  border-radius: 5px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.45);
}
.stack-layer.layer-2 { transform: rotate(-8deg); background: #cfcfcf; z-index: 1; }
.stack-layer.layer-1 { transform: rotate(5deg); background: #e4e4e4; z-index: 2; }

.polaroid {
  position: relative;
  z-index: 3;
  background: var(--paper);
  border-radius: 5px;
  padding: 8px 8px 12px;
  box-shadow: 0 10px 22px rgba(0,0,0,0.55);
  transform: rotate(-1.4deg);
}
.polaroid-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.polaroid-photo canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.polaroid-photo .cover-emoji {
  color: #555;
}
.polaroid-photo .cover-emoji .icon {
  width: 34px;
  height: 34px;
}
.polaroid-caption {
  text-align: center;
  padding-top: 8px;
}
.polaroid-caption .cover-title {
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.polaroid-caption .cover-meta {
  color: #6b6b6b;
  font-size: 10.5px;
  margin: 0;
  letter-spacing: 0.2px;
}

.empty-hint {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 14px;
  line-height: 1.6;
}

.fab {
  position: fixed;
  right: 22px;
  bottom: max(26px, env(safe-area-inset-bottom));
  width: 58px; height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 26px;
  box-shadow: 0 8px 24px rgba(255,255,255,0.18);
  cursor: pointer;
  z-index: 20;
}
.fab:active { transform: scale(0.92); }
.camera-fab { font-size: 24px; }

/* ---------- 북 뷰: 페이지 스테이지 ---------- */
.book-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 4px;
  min-height: 0;
}

.page-nav {
  width: 40px; height: 60px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  font-size: 22px;
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.page-nav:disabled { opacity: 0.2; }

.book-viewport {
  position: relative;
  width: min(88vw, 420px);
  height: min(88vw, 420px);
  overflow: hidden;
  border-radius: 14px;
}

.page-sheet {
  position: absolute;
  inset: 0;
  background: var(--paper);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 3%;
  padding: 5%;
  transition: transform 0.5s cubic-bezier(.3,.7,.2,1), opacity 0.5s ease;
}

.slot {
  position: relative;
  background: var(--paper-dark);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.slot::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 6px;
  background: repeating-linear-gradient(45deg, rgba(0,0,0,0.02) 0 2px, transparent 2px 4px);
}
.slot canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.slot.filled {
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(0,0,0,0.1);
}
.slot.empty { cursor: pointer; }
.slot-add {
  position: relative;
  font-size: 28px;
  line-height: 1;
  color: rgba(0,0,0,0.35);
  font-weight: 300;
}
.slot.empty:active .slot-add { color: rgba(0,0,0,0.6); }
.slot.pop-in canvas {
  animation: popIn 0.4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn {
  0% { transform: scale(0.3) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.08) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

.page-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 max(18px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.page-dots .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}
.page-dots .dot.active { background: var(--accent); width: 18px; border-radius: 4px; }

/* ---------- 모달 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-card {
  background: var(--bg-soft);
  border-radius: 20px;
  padding: 22px;
  width: 100%;
  max-width: 360px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.modal-card h3 { margin: 0 0 16px; font-size: 17px; }

/* ---------- 바텀시트 모달 (설정 등, 아래에서 위로 올라옴) ---------- */
.sheet-modal {
  align-items: flex-end;
  padding: 0;
  transition: background 0.3s ease;
}
.sheet-card {
  width: 100%;
  max-width: none;
  max-height: 85vh;
  background: var(--bg-soft);
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--line);
  border-bottom: none;
  padding: 10px 22px max(22px, env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
}
.sheet-modal.open .sheet-card { transform: translateY(0); }
.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 3px;
  background: var(--line);
  margin: 6px auto 16px;
}
.sheet-card h3 { text-align: center; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.settings-row-block { align-items: flex-start; }
.settings-value {
  font-family: 'Courier New', ui-monospace, monospace;
  color: var(--muted);
  font-size: 12.5px;
  text-align: right;
  white-space: pre-line;
  line-height: 1.6;
}
.lang-picker { display: flex; gap: 8px; }
.lang-choice {
  padding: 7px 12px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.06);
  color: var(--paper);
  font-size: 12.5px;
  cursor: pointer;
}
.lang-choice.selected { border-color: var(--accent); background: rgba(255,255,255,0.16); }
.modal-card input[type="text"],
.modal-card textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--paper);
  font-size: 15px;
  margin-bottom: 6px;
  font-family: inherit;
  resize: none;
}
.modal-card textarea { font-size: 13px; line-height: 1.5; }
.modal-card input[type="text"]::placeholder,
.modal-card textarea::placeholder { color: var(--muted); }
.modal-card input[type="text"]:focus,
.modal-card textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.08);
}

.field-label {
  margin: 4px 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.grid-size-picker { display: flex; gap: 8px; margin-bottom: 14px; }
.grid-size-choice {
  flex: 1;
  padding: 10px 0;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.05);
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.grid-size-choice.selected { border-color: var(--accent); background: rgba(255,255,255,0.14); }

.menu-action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.menu-action:active { background: rgba(255,255,255,0.12); }
.about-row { margin-top: 6px; }
.danger-action {
  justify-content: center;
  color: var(--paper);
  text-decoration: underline;
  background: transparent;
}

.about-card { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
.about-body {
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--paper);
  white-space: pre-line;
  padding: 4px 2px 10px;
}

.cover-picker-card { max-width: 380px; }
.cover-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 2px;
}
.cover-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  border: 2px solid transparent;
  background: #1a1a1a;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
}
.cover-thumb canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.cover-thumb.selected { border-color: var(--accent); }
.cover-thumb.selected::after {
  content: '✓';
  position: absolute;
  top: 2px; right: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover-picker-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 30px 10px;
  white-space: pre-line;
  line-height: 1.6;
}

.emoji-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.emoji-choice {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.05);
  font-size: 19px;
  cursor: pointer;
  filter: grayscale(1) contrast(1.15) brightness(0.9);
}
.emoji-choice.selected { border-color: var(--accent); background: rgba(255,255,255,0.14); }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn {
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:active { background: var(--accent-dark); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--line);
  margin-right: auto;
  text-decoration: underline;
}

/* ---------- 사진 콜렉트 모달 ---------- */
.capture-card { max-width: 340px; }

/* ---------- 사진 크롭 단계 ---------- */
.crop-step { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.crop-hint { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.crop-viewport {
  width: 240px;
  height: 240px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: #000;
  touch-action: none;
  cursor: grab;
}
.crop-viewport:active { cursor: grabbing; }
.crop-viewport img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.crop-zoom {
  width: 240px;
  accent-color: var(--accent);
}

/* ---------- 한마디 남기기 단계 ---------- */
.caption-step { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.caption-hint { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.caption-question {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
}
#captionInput {
  width: 100%;
  max-width: 320px;
  resize: none;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: var(--accent);
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  font-family: inherit;
}
#captionInput:focus { outline: none; border-color: rgba(255,255,255,0.4); }
.caption-counter {
  margin: 0;
  width: 100%;
  max-width: 320px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  font-family: 'Courier New', ui-monospace, monospace;
}

/* ---------- 사진 수정하기 (바텀시트) ---------- */
.edit-field { width: 100%; margin-top: 14px; }
.edit-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}
.edit-field textarea {
  width: 100%;
  resize: none;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: var(--accent);
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  font-family: inherit;
  box-sizing: border-box;
}
.edit-field textarea:focus { outline: none; border-color: rgba(255,255,255,0.4); }
.edit-field input[type="datetime-local"] {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: var(--accent);
  font-size: 14px;
  padding: 9px 12px;
  font-family: inherit;
  box-sizing: border-box;
  color-scheme: dark;
}
.edit-field .caption-counter { max-width: none; margin-top: 4px; }

/* ---------- 검색 (바텀시트) ---------- */
.search-card { max-height: 80vh; display: flex; flex-direction: column; }

.calendar { margin-top: 14px; }
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.calendar-label { font-size: 14px; font-weight: 600; }
.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.calendar-grid { gap: 3px 2px; }
.calendar-weekdays {
  margin-bottom: 4px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}
.calendar-day,
.calendar-day-empty {
  display: block;
  box-sizing: border-box;
  height: 60px;
  font-size: 13px;
  line-height: 60px;
}
.calendar-day {
  position: relative;
  border: none;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  color: var(--accent);
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
}
.calendar-day canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  object-fit: cover;
}
.calendar-day-num {
  position: relative;
  z-index: 1;
  display: block;
  line-height: 60px;
}
/* 그날의 "오늘의 질문" 사진이 있으면, 날짜 숫자는 사진 위에 작은 배지로만 남는다 —
   빈 칸(사진 없음)이 눈에 확 띄어서 "채워야겠다"는 마음이 들게 하려는 의도. */
.calendar-day.has-thumb .calendar-day-num {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(0,0,0,0.55);
  color: #fff;
}
.calendar-day:active { background: rgba(255,255,255,0.08); }
.calendar-day.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar-day.selected:not(.has-thumb) { background: var(--accent); color: var(--accent-ink); }
.calendar-day.has-data::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.search-results {
  margin-top: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.search-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  color: inherit;
  font-family: inherit;
}
.search-result-row:last-child { border-bottom: none; }
.search-result-thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.search-result-thumb canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.search-result-info { min-width: 0; flex: 1; }
.search-result-caption {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.search-empty { text-align: center; color: var(--muted); font-size: 13px; margin: 24px 0; }

/* ---------- 콜렉팅 리포트 (바텀시트) ---------- */
.summary-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0 16px;
}
.summary-tab {
  flex: 1;
  padding: 9px 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
}
.summary-tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.summary-receipt-card { margin: 0 auto; }

/* ---------- 영수증 프린터 애니메이션 ---------- */
.printer-rig {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.printer-body {
  width: 190px;
  height: 46px;
  background: linear-gradient(180deg, #2c2c2c, #101010);
  border-radius: 10px 10px 4px 4px;
  position: relative;
  box-shadow: 0 6px 14px rgba(0,0,0,0.5);
  z-index: 2;
  border: 1px solid rgba(255,255,255,0.08);
}
.printer-slot {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  width: 150px;
  height: 8px;
  background: #000;
  border-radius: 4px;
}
.paper-track {
  width: 150px;
  height: 340px;
  overflow: hidden;
  margin-top: -6px;
  border-radius: 0 0 4px 4px;
  position: relative;
}
.paper-strip {
  width: 150px;
  background: var(--paper);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.4);
  transform: translateY(-100%);
  transition: transform 1.7s cubic-bezier(.2,.7,.2,1);
}
.paper-strip canvas {
  display: block;
  width: 100%;
  image-rendering: pixelated;
}
.paper-strip.feeding { transform: translateY(0%); }
.paper-strip.shredding { visibility: hidden; }
.printer-label {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- 영수증 카드: 제목 → 사진 → 정보 (인화 애니메이션 + 라이트박스 공용) ---------- */
.receipt-title {
  margin: 0;
  padding: 11px 0 7px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  font-family: 'Courier New', ui-monospace, monospace;
  color: var(--ink);
  background: var(--paper);
}
.receipt-photo {
  position: relative;
  background: var(--paper);
}
.receipt-photo canvas {
  display: block;
  width: 100%;
  image-rendering: pixelated;
}
.receipt-body {
  background: var(--paper);
  color: var(--ink);
  padding: 10px 14px 14px;
  font-family: 'Courier New', ui-monospace, monospace;
}
.receipt-dash {
  border-top: 1px dashed rgba(0,0,0,0.35);
  margin: 7px 0;
}
.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  letter-spacing: 0.2px;
  line-height: 1.6;
}
.receipt-row span:first-child { color: rgba(0,0,0,0.55); flex-shrink: 0; }
.receipt-row span:last-child {
  font-weight: 700;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.receipt-question {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(0,0,0,0.55);
  word-break: break-word;
}
.receipt-memo {
  margin: 8px 0 0;
  font-size: 11px;
  font-style: italic;
  line-height: 1.5;
  color: rgba(0,0,0,0.85);
  word-break: break-word;
}
.receipt-barcode {
  display: flex;
  align-items: stretch;
  height: 26px;
  margin-top: 8px;
  gap: 1px;
}
.receipt-barcode span { display: block; }

/* ---------- 파쇄 애니메이션 ---------- */
.shred-layer {
  position: fixed;
  pointer-events: none;
  z-index: 200;
}
.shred-strip {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  will-change: transform, opacity;
}
.shred-strip > * {
  position: absolute;
  top: 0;
  left: 0;
}

.receipt-card {
  width: min(88vw, 420px);
  background: var(--paper);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ---------- 슬롯으로 날아가는 애니메이션 ---------- */
.fly-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}
.fly-item {
  position: absolute;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,0.5);
  transition: all 0.7s cubic-bezier(.3,.1,.2,1);
}
.fly-item canvas { width: 100%; height: 100%; image-rendering: pixelated; }

/* 채워진 슬롯은 클릭해서 크게 볼 수 있음 */
.slot.filled { cursor: pointer; }

/* ---------- 라이트박스 (스티커 크게 보기) ---------- */
.lightbox-modal { background: rgba(0,0,0,0.92); padding: 0; }
.lightbox-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.lightbox-top {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}
.lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.lightbox-stage .receipt-card { width: auto; flex: 0 1 380px; min-width: 0; }
.lightbox-stage .page-nav { width: 32px; height: 52px; flex-shrink: 0; }
.lightbox-menu-wrap { position: relative; }
.lightbox-dropdown {
  position: absolute;
  top: 46px;
  right: 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 168px;
  z-index: 3;
}
.lightbox-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--paper);
  font-size: 14px;
  cursor: pointer;
}
.lightbox-dropdown button:active { background: rgba(255,255,255,0.1); }
.lightbox-dropdown button.danger-text { color: #fff; border-top: 1px solid var(--line); text-decoration: underline; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15,15,15,0.94);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 13px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  z-index: 80;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 380px) {
  .book-viewport { width: 92vw; height: 92vw; }
}

/* ---------- 하단 탭 바 (Feed / My Album) ---------- */
.tab-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  border-top: 1px solid var(--line);
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 15;
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.tab-btn.active { color: var(--paper); }
.tab-btn .icon { width: 21px; height: 21px; }

/* My Album 그리드에서 탭 바/FAB에 콘텐츠가 가리지 않도록 여유를 더 준다 */
.book-grid { padding-bottom: 150px; }
#btnNewBook { bottom: calc(66px + max(10px, env(safe-area-inset-bottom))); }

/* ---------- Feed / Saved 리스트 ---------- */
.feed-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 10px 16px 150px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- 당겨서 새로고침 (도트 3개 순차 깜빡임) ---------- */
.pull-refresh-indicator {
  flex-shrink: 0;
  height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}
.pull-refresh-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  opacity: 0.5;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}
.pull-refresh-indicator.ready .pull-refresh-dot {
  background: var(--paper);
  opacity: 0.8;
}
.pull-refresh-indicator.spinning .pull-refresh-dot {
  background: var(--paper);
  animation: pull-refresh-dot-blink 1s ease-in-out infinite;
}
.pull-refresh-indicator.spinning .pull-refresh-dot:nth-child(1) { animation-delay: 0s; }
.pull-refresh-indicator.spinning .pull-refresh-dot:nth-child(2) { animation-delay: 0.15s; }
.pull-refresh-indicator.spinning .pull-refresh-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes pull-refresh-dot-blink {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.15); }
}
.feed-empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 14px;
  line-height: 1.6;
}
.feed-group-header {
  margin: 6px 2px 0;
  font-size: 12.5px;
  color: var(--muted);
  font-family: 'Courier New', ui-monospace, monospace;
}
.feed-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.feed-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.feed-card-head-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.feed-menu-wrap { position: relative; }
.feed-menu-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.feed-menu-btn:active { background: rgba(255,255,255,0.12); }
.feed-dropdown {
  position: absolute;
  top: 30px;
  right: 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 168px;
  z-index: 3;
}
.feed-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--paper);
  font-size: 14px;
  cursor: pointer;
}
.feed-dropdown button:active { background: rgba(255,255,255,0.1); }
.feed-card-author {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-card-time {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  font-family: 'Courier New', ui-monospace, monospace;
}
.feed-card-question {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.feed-card-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
}
.feed-card-photo canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.feed-card-caption {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--paper);
  line-height: 1.5;
}
.feed-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.feed-action {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.feed-action .icon { width: 16px; height: 16px; }
.feed-action.active { color: var(--paper); border-color: var(--paper); }
.feed-action.like.active { color: #ff5c7a; border-color: #ff5c7a; }
.feed-reactions { display: flex; gap: 4px; margin-left: auto; }
.reaction-btn {
  padding: 5px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
}
.reaction-btn .reaction-count { font-size: 10.5px; color: var(--muted); }
.reaction-btn.mine { border-color: var(--accent); background: rgba(255,255,255,0.1); }

/* ---------- Saved 정렬 세그먼트 (콜렉팅 리포트의 탭과 같은 스타일 재사용) ---------- */
.saved-sort { margin: 12px 16px 0; }

/* ---------- My Album의 "Saved" 고정 카드 ---------- */
.saved-card .polaroid-photo { background: #16161a; }
.saved-card .polaroid-photo .cover-emoji .icon { color: var(--muted); }

/* ---------- 공개/비공개 스위치 (오늘의 질문 캡션 단계) ---------- */
.visibility-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 4px 0;
  font-size: 13px;
  color: var(--paper);
}
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 24px;
  transition: background 0.15s ease;
  cursor: pointer;
}
.switch-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform 0.15s ease;
}
.switch input:checked + .switch-slider { background: var(--accent-dark); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); background: var(--accent-ink); }

.visibility-warning {
  width: 100%;
  margin: 8px 0 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(255, 184, 0, 0.1);
  border: 1px solid rgba(255, 184, 0, 0.3);
  color: #ffcf4d;
  font-size: 12px;
  line-height: 1.5;
}
