/* ─────────────────────────────────────────────────────────────
   이안이 가족 앨범 — 따뜻한 크림빛, 할머니·할아버지도 편한 큰 글씨
   ───────────────────────────────────────────────────────────── */
:root {
  --cream: #FFF8F0;
  --cream-2: #FFFDF9;
  --peach: #F6C9B8;
  --peach-soft: #FBE3D7;
  --peach-deep: #E08C6D;
  --rose: #E58E96;
  --rose-soft: #F8DDE0;
  --sage: #AFC6A4;
  --sage-soft: #E7EFE1;
  --sage-deep: #7E9B73;
  --ink: #3F3129;
  --ink-soft: #6E5A4E;
  --ink-mute: #99867A;
  --line: #F0E2D6;
  --line-strong: #E4D0C0;
  --white: #ffffff;
  --shadow-sm: 0 2px 10px rgba(120, 80, 55, 0.07);
  --shadow-md: 0 12px 32px rgba(120, 80, 55, 0.14);
  --shadow-lg: 0 24px 60px rgba(80, 50, 35, 0.22);
  --radius: 20px;
  --header-h: 116px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Malgun Gothic", "맑은 고딕", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 8% -8%, #FFEADF 0%, rgba(255, 234, 223, 0) 62%),
    radial-gradient(760px 480px at 100% 4%, #F4F0E2 0%, rgba(244, 240, 226, 0) 58%),
    linear-gradient(180deg, #FFF8F0 0%, #FFF5EB 55%, #FFF9F2 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(224, 140, 109, 0.55);
  outline-offset: 2px;
}

img { display: block; max-width: 100%; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ─────────────── 로그인 ─────────────── */
.login {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(28px + var(--safe-top)) 20px calc(28px + var(--safe-bottom));
  overflow: hidden;
}

.login-deco {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}
.login-deco-a {
  width: 340px; height: 340px; top: -140px; right: -120px;
  background: radial-gradient(circle at 40% 40%, rgba(246, 201, 184, 0.75), rgba(246, 201, 184, 0) 68%);
}
.login-deco-b {
  width: 420px; height: 420px; bottom: -180px; left: -160px;
  background: radial-gradient(circle at 50% 50%, rgba(175, 198, 164, 0.55), rgba(175, 198, 164, 0) 68%);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 372px;
  padding: 34px 26px 26px;
  background: rgba(255, 253, 249, 0.9);
  border: 1px solid rgba(240, 226, 214, 0.9);
  border-radius: 30px;
  box-shadow: var(--shadow-md);
  text-align: center;
  backdrop-filter: blur(8px);
}

.login-mark {
  width: 68px;
  height: 68px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  background: #FFF1EA;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #F8DCCF;
}
.login-mark svg { width: 44px; height: 44px; }

.login-title {
  margin: 0 0 6px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.login-sub {
  margin: 0 0 22px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  min-height: 18px;
  margin: 4px 0 8px;
}
.pin-dots i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #F1E2D6;
  transition: transform 0.16s ease, background 0.16s ease;
}
.pin-dots i.on {
  background: var(--peach-deep);
  transform: scale(1.08);
}
.login.is-error .pin-dots { animation: shake 0.4s ease; }

.login-msg {
  min-height: 24px;
  margin: 2px 0 14px;
  font-size: 14px;
  color: var(--ink-mute);
}
.login.is-error .login-msg { color: #C0564E; font-weight: 600; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.keypad button {
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--white);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(120, 80, 55, 0.05);
  transition: transform 0.08s ease, background 0.15s ease;
}
.keypad button:active { transform: scale(0.95); background: var(--peach-soft); }
.keypad .key-blank { background: transparent; border: 0; box-shadow: none; pointer-events: none; }
.keypad .key-back { display: grid; place-items: center; color: var(--ink-soft); }

.login-ok {
  width: 100%;
  height: 50px;
  margin-top: 10px;
  border: 0;
  border-radius: 16px;
  background: var(--ink);
  color: var(--cream);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.login-ok:disabled { opacity: 0.45; }

.login-help {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.5;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ─────────────── 상단 바 ─────────────── */
.app { min-height: 100dvh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: var(--safe-top);
  background: rgba(255, 248, 240, 0.88);
  border-bottom: 1px solid rgba(240, 226, 214, 0.85);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 13px 16px 9px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #FFF1EA;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px #F8DCCF;
}
.brand-mark svg { width: 26px; height: 26px; }

.brand-text { min-width: 0; }

.brand-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.baby-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 1px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
}
.baby-sub { overflow: hidden; text-overflow: ellipsis; }

.dday-chip {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--peach-soft);
  color: #A95F42;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.top-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.icon-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.75); }
.icon-btn.danger { color: #B4544E; }

.logout-btn {
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink-soft);
  font-size: 13.5px;
  cursor: pointer;
}
.logout-btn:hover { background: var(--white); }

.tabs {
  display: flex;
  gap: 6px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 11px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 19px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.tab:hover { background: var(--white); }
.tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

/* ─────────────── 사진 목록 ─────────────── */
.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2px 14px calc(110px + var(--safe-bottom));
}

.group { margin-top: 20px; animation: rise 0.4s ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.group-head {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px 10px;
  background: linear-gradient(180deg, rgba(255, 248, 240, 0.97) 62%, rgba(255, 248, 240, 0));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.group-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.group-sub {
  margin: 1px 0 0;
  font-size: 13px;
  color: var(--ink-mute);
  font-weight: 500;
}

.group-count {
  flex: 0 0 auto;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 9px;
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 17px;
  overflow: hidden;
  background: linear-gradient(135deg, #F5E8DC, #EFE0D2);
  box-shadow: 0 1px 5px rgba(120, 80, 55, 0.08);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease;
}
.tile:hover { box-shadow: 0 8px 22px rgba(120, 80, 55, 0.16); }
.tile:active { transform: scale(0.985); }

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.5s ease;
}
.tile img.is-loaded { opacity: 1; }
.tile:hover img { transform: scale(1.035); }

.tile-date {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(42, 31, 25, 0.55);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
}

.tile-comments {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(80, 50, 35, 0.12);
}

.new-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 2px 0;
  padding: 11px 16px;
  border-radius: 15px;
  background: var(--sage-soft);
  border: 1px solid #D9E6D1;
  color: #4C6B45;
  font-size: 14.5px;
  font-weight: 600;
  animation: rise 0.4s ease both;
}

.empty {
  text-align: center;
  padding: 74px 20px 40px;
  animation: rise 0.5s ease both;
}
.empty-art { font-size: 54px; line-height: 1; margin-bottom: 16px; }
.empty-title { margin: 0 0 8px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.empty-text { margin: 0 0 22px; font-size: 15.5px; color: var(--ink-soft); line-height: 1.6; }
.empty .primary-btn { max-width: 240px; margin: 0 auto; }

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--ink-mute);
  font-size: 14.5px;
}
.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #F1E2D6;
  border-top-color: var(--peach-deep);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────── 떠 있는 올리기 버튼 ─────────────── */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(20px + var(--safe-bottom));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 56px;
  padding: 0 22px 0 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #EFA98B, #E58E96);
  color: #fff;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 12px 26px rgba(229, 142, 150, 0.4);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(229, 142, 150, 0.48); }
.fab:active { transform: scale(0.97); }
.fab-plus { font-size: 22px; font-weight: 500; margin-top: -2px; }

/* ─────────────── 사진 크게 보기 ─────────────── */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: #241E1A;
  color: #fff;
}

.viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(56px + var(--safe-top));
  padding: var(--safe-top) 12px 0;
  background: rgba(36, 30, 26, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.vbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.vbtn:hover { background: rgba(255, 255, 255, 0.18); }
.vbtn-download { background: rgba(255, 255, 255, 0.16); }

.viewer-date { font-size: 14px; color: rgba(255, 255, 255, 0.72); letter-spacing: 0.01em; }

.viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.viewer-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 32vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}

.stage-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 8px 6px;
}

#viewerImg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.25s ease;
  user-select: none;
  -webkit-user-drag: none;
}
#viewerImg.is-loaded { opacity: 1; }

.stage-spinner {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  pointer-events: none;
}
.stage-spinner[hidden] { display: none; }

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 42px;
  height: 62px;
  border: 0;
  border-radius: 14px;
  background: rgba(30, 24, 20, 0.45);
  color: rgba(255, 255, 255, 0.85);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.nav-btn:hover { background: rgba(30, 24, 20, 0.68); }
.nav-prev { left: 8px; }
.nav-next { right: 8px; }

.stage-count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(20, 15, 12, 0.55);
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* 오른쪽/아래 패널 */
.viewer-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  max-height: 52%;
  background: var(--cream);
  color: var(--ink);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px calc(12px + var(--safe-bottom));
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.panel-titles h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.panel-meta { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-mute); }

.text-btn {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
}
.text-btn.danger { color: #B4544E; border-color: #F0D6D2; background: #FFF7F6; }

.caption-display {
  margin: 10px 0 0;
  padding: 11px 14px;
  border-radius: 13px;
  background: #FFF3EA;
  border: 1px solid #F7E3D6;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.edit-block {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
.edit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.edit-row > span { flex: 0 0 48px; font-weight: 600; }
.edit-row input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--cream-2);
  font-size: 15px;
}
.edit-hint { margin: 0; font-size: 12px; color: var(--ink-mute); }

.comments-wrap { margin-top: 16px; }
.comments-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink-soft);
}
.comment-total {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--peach-soft);
  color: #A95F42;
  font-size: 11.5px;
  font-weight: 700;
}

.comments { display: grid; gap: 9px; }

.comment {
  padding: 10px 13px;
  border-radius: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  animation: rise 0.25s ease both;
}
.comment-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}
.comment-name {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  background: var(--sage-soft);
  color: #4F6B48;
}
.comment-name[data-kind="parent"] { background: var(--peach-soft); color: #A95F42; }
.comment-name[data-kind="grand"] { background: #EEF0FA; color: #5A648C; }
.comment-time { font-size: 11.5px; color: var(--ink-mute); }
.comment-del {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-mute);
  font-size: 16px;
  cursor: pointer;
}
.comment-del:hover { background: #FBE9E6; color: #B4544E; }
.comment-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.comments-empty {
  margin: 4px 0 0;
  padding: 14px;
  border-radius: 13px;
  background: #FFFDFA;
  border: 1px dashed var(--line-strong);
  color: var(--ink-mute);
  font-size: 13.5px;
  text-align: center;
  line-height: 1.5;
}

.comment-form {
  position: sticky;
  bottom: 0;
  margin-top: 16px;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(255, 248, 240, 0) 0%, var(--cream) 22%);
}

.nametag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.name-chip {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.name-chip:hover { border-color: var(--peach-deep); }
.name-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}
.nametag-row.needs-name .name-chip { border-color: #E7A79F; }

.custom-name-row {
  display: flex;
  gap: 7px;
  margin-bottom: 8px;
}
.custom-name-row input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--white);
  font-size: 16px;
}
.mini-btn {
  flex: 0 0 auto;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 11px;
  background: var(--peach-soft);
  color: #A95F42;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.comment-input-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}
.comment-input-row textarea {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  max-height: 110px;
  padding: 11px 13px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: var(--white);
  font-size: 16px;
  line-height: 1.45;
  resize: none;
}
.comment-input-row textarea:focus { border-color: var(--peach-deep); outline: none; }
.send-btn {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 17px;
  border: 0;
  border-radius: 13px;
  background: var(--ink);
  color: var(--cream);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.send-btn:disabled { opacity: 0.45; }

/* ─────────────── 올리기 시트 ─────────────── */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 40, 30, 0.45);
  backdrop-filter: blur(3px);
  animation: fade 0.2s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 90dvh;
  overflow-y: auto;
  padding: 10px 18px calc(20px + var(--safe-bottom));
  background: var(--cream);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheet-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-grabber {
  width: 42px;
  height: 4px;
  margin: 2px auto 8px;
  border-radius: 999px;
  background: var(--line-strong);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 24px 16px;
  border: 2px dashed #E8D2C1;
  border-radius: 18px;
  background: var(--cream-2);
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.dropzone:hover, .dropzone.is-drag {
  background: #FFF3EA;
  border-color: var(--peach-deep);
}
.dz-icon { font-size: 27px; }
.dz-title { font-size: 15.5px; font-weight: 700; }
.dz-sub { font-size: 12.5px; color: var(--ink-mute); }

.picked {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 7px;
  margin-top: 10px;
}
.picked-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 11px;
  overflow: hidden;
  background: #F2E5D9;
}
.picked-item img { width: 100%; height: 100%; object-fit: cover; }
.picked-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(30, 22, 18, 0.62);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.batch-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-soft);
}
.batch-date input {
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 6px 8px;
  background: var(--cream-2);
  font-size: 16px;
}

.hint {
  margin: 8px 2px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-mute);
}

/* ─────────────── 버튼 · 진행 ─────────────── */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, #EFA98B, #E58E96);
  color: #fff;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(229, 142, 150, 0.3);
  transition: opacity 0.15s ease, transform 0.12s ease;
}
.primary-btn:hover { transform: translateY(-1px); }
.primary-btn:disabled { opacity: 0.42; box-shadow: none; cursor: default; transform: none; }
.primary-btn.wide { width: 100%; }

.ghost-btn {
  height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.danger-btn {
  height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  background: #C0564E;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.progress { margin-top: 12px; display: flex; align-items: center; gap: 10px; }
.progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #F1E2D6;
  overflow: hidden;
}
.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #EFA98B, #E58E96);
  transition: width 0.2s ease;
}
.progress-text { font-size: 12.5px; color: var(--ink-mute); white-space: nowrap; }

/* ─────────────── 모달 ─────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(52, 36, 27, 0.5);
  backdrop-filter: blur(3px);
  animation: fade 0.18s ease both;
}
.modal-card {
  position: relative;
  width: min(430px, 100%);
  padding: 22px;
  border-radius: 22px;
  background: var(--cream);
  box-shadow: var(--shadow-lg);
  animation: pop 0.2s ease both;
}
@keyframes pop {
  from { transform: scale(0.96); opacity: 0.7; }
  to { transform: scale(1); opacity: 1; }
}
.modal-card h2 { margin: 0 0 6px; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.modal-text { margin: 0 0 14px; font-size: 14.5px; line-height: 1.55; color: var(--ink-soft); }
.modal-card input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--white);
  font-size: 14px;
  color: var(--ink-soft);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.modal-actions .primary-btn, .modal-actions .danger-btn { height: 46px; font-size: 15px; }

/* ─────────────── 토스트 ─────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-bottom));
  z-index: 200;
  transform: translateX(-50%) translateY(8px);
  max-width: calc(100vw - 40px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(58, 44, 35, 0.94);
  color: #FFF6ED;
  font-size: 14.5px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { background: rgba(176, 76, 68, 0.96); }

/* ─────────────── 알림 · 설치 안내 ─────────────── */
.bell-btn { position: relative; }
.bell-btn.is-on { background: var(--peach-soft); color: #A95F42; }
.bell-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sage-deep);
  box-shadow: 0 0 0 2px rgba(255, 248, 240, 0.95);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.bell-btn.is-on .bell-dot { opacity: 1; }

.install-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 2px 0;
  padding: 13px 16px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.45;
}
.install-hint small { color: var(--ink-mute); font-size: 12px; }
.install-hint button {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-mute);
  font-size: 14px;
  cursor: pointer;
}

.modal-sub {
  margin: -6px 0 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-mute);
}

/* ─────────────── 가입 · 회원 관리 · 3단계 역할 ─────────────── */
.login-signup {
  margin: 12px 0 0;
  font-size: 13.5px;
  color: var(--ink-mute);
}
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--peach-deep);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.login-card.signup-card { max-width: 404px; text-align: left; }
.back-link {
  display: inline-block;
  margin-bottom: 4px;
  padding: 4px 6px;
  border: 0;
  background: none;
  color: var(--ink-mute);
  font-size: 13px;
  cursor: pointer;
}
.signup-title {
  margin: 2px 0 6px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
}
.signup-sub {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
  text-align: center;
}
.signup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}
.signup-tags .name-chip { height: 33px; padding: 0 11px; font-size: 13px; }

.field { display: block; margin-bottom: 12px; }
.field > span {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}
.field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 13px;
  background: var(--white);
  font-size: 17px;
}
.field input:focus { border-color: var(--peach-deep); outline: none; }

.signup-note {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--sage-soft);
  color: #4F6B48;
  font-size: 12.5px;
}
.signup-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #FDF0EE;
  color: #B4544E;
  font-size: 13.5px;
  line-height: 1.45;
}
.signup-foot {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--ink-mute);
  text-align: center;
}
.signup-done { text-align: center; }
.done-mark { margin-bottom: 8px; font-size: 46px; }

.me-chip {
  max-width: 90px;
  padding: 4px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.members-btn { position: relative; }
.pending-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  box-shadow: 0 0 0 2px rgba(255, 248, 240, 0.9);
}

.members-card { max-height: 88dvh; }
.members-sub { margin: 0 0 12px; font-size: 13.5px; color: var(--ink-soft); }
.members-list { display: grid; gap: 8px; }
.member-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
}
.member-row[data-status="pending"] { border-color: #F6D9C7; background: #FFF6EF; }
.member-avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--peach-soft);
  color: #A95F42;
  font-size: 16px;
  font-weight: 800;
}
.member-avatar[data-role="admin"] { background: var(--ink); color: var(--cream); }
.member-avatar[data-role="manager"] { background: #E9D9CB; color: #6E5A4E; }
.member-info { flex: 1 1 120px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.member-name-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.member-name-line strong { font-size: 15px; }
.role-chip {
  padding: 1px 7px;
  border-radius: 999px;
  background: #F7EFE7;
  color: var(--ink-mute);
  font-size: 10.5px;
  font-weight: 700;
}
.member-meta { font-size: 11.5px; color: var(--ink-mute); }
.status-chip { padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status-approved { background: var(--sage-soft); color: #4F6B48; }
.status-pending { background: #FDE7D6; color: #A95F42; }
.status-blocked { background: #FBE3E0; color: #B4544E; }
.member-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; width: 100%; }
.member-btn {
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.member-btn.primary { border-color: var(--ink); background: var(--ink); color: var(--cream); }
.member-btn.danger { border-color: #F0D6D2; background: #FFF7F6; color: #B4544E; }
.members-note { margin: 14px 2px 0; font-size: 12px; line-height: 1.5; color: var(--ink-mute); }
.members-loading { padding: 26px 0; text-align: center; color: var(--ink-mute); font-size: 14px; }
.comment-as { margin: 0 0 7px; font-size: 13px; font-weight: 600; color: var(--ink-mute); }

@media (max-width: 560px) {
  .me-chip { display: none; }
}

/* ─────────────── 큰 화면 ─────────────── */
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 11px; }
  .main { padding-left: 22px; padding-right: 22px; }
  .topbar-inner, .tabs { padding-left: 22px; padding-right: 22px; }
  .sheet { align-items: center; }
  .sheet-card { border-radius: 26px; max-height: 86dvh; padding-bottom: 24px; }
}

@media (min-width: 900px) {
  .viewer-body { flex-direction: row; }
  .viewer-stage { flex: 1 1 auto; }
  .viewer-panel {
    flex: 0 0 420px;
    max-height: none;
    height: 100%;
    border-radius: 0;
    box-shadow: -12px 0 30px rgba(0, 0, 0, 0.18);
    padding: 20px 20px 18px;
  }
  .viewer-top { padding-right: 20px; }
  .nav-prev { left: 16px; }
  .nav-next { right: 16px; }
}

@media (min-width: 1200px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
}

/* 아주 작은 화면 */
@media (max-height: 700px) {
  .login-card { padding: 24px 20px 18px; }
  .login-mark { width: 54px; height: 54px; margin-bottom: 8px; }
  .login-mark svg { width: 34px; height: 34px; }
  .login-sub { margin-bottom: 14px; }
  .keypad button { height: 48px; }
  .login-help { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
