:root {
  --paper: #f7f4f1;
  --white: #ffffff;
  --ink: #1d1b20;
  --ink-2: #4a4650;  /* 본문 보조 (대비 약 8:1) */
  --ink-3: #6f6a74;  /* 라벨·힌트 (대비 약 5:1) */
  --line: #e4dde6;      /* 연보라빛 회색 선 */
  --field: #ffffff;     /* 입력칸은 흰색 */
  --tint: #fbf3f7;      /* 아주 옅은 분홍 면 */
  /* 연아가 좋아하는 분홍·하늘색: 채도를 낮춰 포인트로만 */
  --blush: #e9b8c6;
  --mist: #b5d3e6;
  /* 연아 시그니처 그라데이션: 얇은 선·작은 포인트에만 */
  --grad: linear-gradient(90deg, #e2a3b8, #9cc6e2);
  --grad-v: linear-gradient(180deg, #e2a3b8, #9cc6e2);
  --grad-focus: linear-gradient(120deg, #cf7a96, #6fa3c9);
  --error: #b3261e;
  --focus: #4d84b8;

  /* 관리자 화면 호환 토큰 */
  --surface: var(--white);
  --surface-strong: var(--white);
  --accent: var(--ink);
  --accent-soft: #f1ece8;
  --gradient: var(--ink);
  --radius: 14px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; } /* 시트 열 때 스크롤바가 사라져도 화면이 움찔하지 않게 */

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 20px calc(40px + env(safe-area-inset-bottom));
}
.card-page .page { padding: 0 0 calc(120px + env(safe-area-inset-bottom)); }
.card-page { background: linear-gradient(120deg, #f4dce5 0%, #ece3ee 50%, #d9e9f3 100%) fixed; }
.card-page .page { min-height: 100vh; background: var(--paper); }
@media (min-width: 560px) {
  .card-page .page { box-shadow: 0 0 60px rgba(120, 100, 150, .12); }
}

/* ---------- 공개 페이지 ---------- */

.hero { aspect-ratio: 4 / 5; background: linear-gradient(160deg, var(--blush), var(--mist)); overflow: hidden; } /* 사진이 뜨기 전 보이는 시그니처 색 */
.hero img { display: block; width: 100%; height: 100%; object-fit: cover; }

.block { padding: 40px 24px 0; }
.block + .block { margin-top: 8px; }

.label {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-meta { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.name {
  display: inline-block; /* 언더라인이 이름 전체 폭을 따라가도록 */
  margin: 0 0 22px;
  font-size: 44px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.name-en {
  margin-left: 4px;
  font-size: 22px; font-weight: 500; letter-spacing: .02em;
  color: var(--ink-3);
  vertical-align: 4px;
}
.name::after {
  content: ""; display: block;
  width: 100%; height: 3px; margin-top: 12px;
  border-radius: 2px; background: var(--grad);
}
.body-text { margin: 0; font-size: 17px; line-height: 1.75; color: var(--ink-2); }

.dream-text {
  position: relative;
  margin: 0;
  padding-left: 16px;
  font-size: 22px;
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.dream-text::before {
  content: ""; position: absolute; left: 0; top: .15em; bottom: .15em;
  width: 2px; border-radius: 1px; background: var(--grad-v);
}

.gallery { padding-left: 0; padding-right: 0; }
.gallery .label-row { padding: 0 24px; }
.gallery-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
}
.photo {
  display: block; width: 100%; aspect-ratio: 1;
  padding: 0; border: 0; border-radius: 0;
  background: var(--tint); cursor: zoom-in; overflow: hidden;
}
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.photo:active img { opacity: .8; }


/* 하단 고정 버튼 */
.cta-bar {
  position: fixed; left: 50%; bottom: 0; z-index: 10;
  width: 100%; max-width: 520px; transform: translateX(-50%); /* 본문 칼럼 폭에 맞춤 */
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 55%, rgba(247, 244, 241, 0));
}
.cta-bar .btn { max-width: 480px; margin: 0 auto; }

/* 버튼 */
.btn, .submit {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 56px;
  padding: 0 20px;
  border: 0; border-radius: 14px;
  background: var(--ink); color: #fff;
  font: inherit; font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform .12s var(--ease), opacity .2s;
}
.btn:active, .submit:active { transform: scale(.985); }
.btn[disabled], .submit[disabled] { opacity: .5; cursor: progress; }
.btn-ghost { background: var(--tint); color: var(--ink); }
/* 메시지 버튼(남기기·보내기): 잉크 바탕에 분홍 글자 (대비 약 10:1) */
.btn-send { color: #f4c6d4; }

.icon-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--ink);
  cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* 바텀시트 */
.sheet {
  width: 100%; max-width: 520px; max-height: 92dvh;
  margin: auto auto 0;
  padding: 10px 24px calc(20px + env(safe-area-inset-bottom));
  border: 0; border-radius: 24px 24px 0 0;
  background: var(--white); color: var(--ink);
  overflow-y: auto; overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(29, 27, 32, .4); }
.sheet-grip { width: 40px; height: 4px; margin: 0 auto 10px; border-radius: 2px; background: var(--grad); }
.sheet-head { position: relative; display: flex; align-items: center; justify-content: space-between; margin: 0 -10px 4px 0; }
.sheet-title { display: flex; align-items: center; gap: 2px; }
/* 원형 칩 ! 아이콘 (터치 영역 40px) */
.info-chip {
  display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0; margin: 0 0 0 -4px;
  border: 0; border-radius: 50%; background: none; color: var(--ink-3); cursor: pointer;
}
.info-chip svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.info-chip .dot { fill: currentColor; stroke: none; }
.info-chip[aria-expanded="true"] { color: var(--ink); }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }
.sheet-lead { margin: 0 0 22px; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
/* 안내 말풍선 레이어: 폼을 밀지 않고 위에 뜬다 */
.info-pop {
  position: absolute; z-index: 5;
  top: calc(100% + 4px); left: 0; right: 10px; /* 시트 내용 폭 전체 */
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--ink); color: #fff;
  box-shadow: 0 12px 32px rgba(29, 27, 32, .25);
}
.info-pop::before { /* 꼬리: [자세히]를 가리킴 */
  content: ""; position: absolute; top: -6px; left: var(--tail-x, 200px);
  width: 12px; height: 12px; background: var(--ink); transform: rotate(45deg); border-radius: 2px;
}
.info-pop dl { margin: 0; display: grid; gap: 12px; }
.info-pop dt { font-size: 13px; font-weight: 700; color: #fff; }
.info-pop dl > div:first-child dt { padding-right: 28px; } /* 닫기 버튼 자리는 첫 줄만 */
.info-pop dd { margin: 2px 0 0; font-size: 14px; line-height: 1.55; color: rgba(255, 255, 255, .82); }
.info-pop-close {
  position: absolute; top: 4px; right: 4px;
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; background: none; color: rgba(255, 255, 255, .8); cursor: pointer;
}
.info-pop-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (prefers-reduced-motion: no-preference) {
  .info-pop:not([hidden]) { animation: pop-in .16s var(--ease); }
  @keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
}
.sheet-note { margin: 14px 0 0; text-align: center; font-size: 13px; }
.sheet-note a { color: var(--ink-3); text-underline-offset: 3px; }

.sheet-done { padding: 28px 0 4px; text-align: center; }
.sheet-done:focus { outline: none; }
.done-icon { width: 56px; height: 56px; margin-bottom: 16px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.done-icon circle { stroke: url(#doneGrad); stroke-width: 2; }
.done-icon path { stroke: var(--ink); stroke-width: 1.8; }
.sheet-done h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.03em; }
.sheet-done p { margin: 0 0 28px; color: var(--ink-2); font-size: 15px; }

.sheet:focus { outline: none; }
.sheet.dragging { transition: none !important; }
.sheet-grip, .sheet-head { touch-action: none; } /* 아래로 끌어 닫기 */
.sheet-grip { cursor: grab; }

@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: sheet-up .42s cubic-bezier(.32, .72, 0, 1); }
  .sheet[open]::backdrop { animation: fade .3s ease-out; }
  .sheet.closing { animation: sheet-down .24s cubic-bezier(.4, 0, 1, 1) forwards; }
  .sheet.closing::backdrop { animation: fade-out .24s ease-in forwards; }
  @keyframes sheet-down { to { transform: translateY(100%); } }
  @keyframes fade-out { to { opacity: 0; } }
  .lightbox[open] { animation: fade .2s var(--ease); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  @keyframes fade { from { opacity: 0; } }
}

/* 사진 레이어 */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #100f12;
  color: #fff;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: transparent; }
.lightbox img { display: block; width: 100%; max-height: 78dvh; object-fit: contain; }
.lightbox-count {
  position: absolute; left: 0; right: 0; bottom: calc(28px + env(safe-area-inset-bottom));
  margin: 0; text-align: center;
  font-size: 14px; letter-spacing: .08em; color: rgba(255, 255, 255, .85);
  font-variant-numeric: tabular-nums;
}
.lb-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; color: #fff; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); color: rgba(255, 255, 255, .85); }
.lb-prev { left: 4px; }
.lb-next { right: 4px; }

/* ---------- 폼 ---------- */

.field { margin: 0 0 20px; padding: 0; border: 0; min-width: 0; }
.field > label, .field-label-row label, legend {
  display: block; margin-bottom: 8px; padding: 0;
  font-size: 15px; font-weight: 600; color: var(--ink);
}
.field-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.counter { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sub-label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 8px; }
.optional { font-weight: 400; font-size: 13px; color: var(--ink-3); margin-left: 4px; }

input[type="text"], input[type="tel"], input[type="password"], textarea {
  width: 100%; min-height: 52px;
  padding: 14px 16px;
  font: inherit; font-size: 16px; /* iOS 확대 방지 */
  color: var(--ink);
  background: var(--field);
  border: 1.5px solid var(--line); border-radius: 12px;
  -webkit-appearance: none; appearance: none;
  transition: border-color .15s, background-color .15s;
}
textarea { resize: none; min-height: 132px; line-height: 1.6; }
input:focus, textarea:focus {
  outline: none;
  border-color: transparent;
  background: linear-gradient(#fff, #fff) padding-box, var(--grad-focus) border-box;
  box-shadow: -3px 0 10px rgba(226, 163, 184, .25), 3px 0 10px rgba(156, 198, 226, .3);
}
::placeholder { color: #8a8590; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[aria-invalid="true"] { border-color: var(--error) !important; background: #fff !important; }

.hint { margin: 8px 0 0; font-size: 14px; color: var(--ink-3); }
.error { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: var(--error); }
.error:empty { display: none; }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); flex: none; }

.form-error {
  margin: 0 0 14px; padding: 12px 14px;
  border-radius: 12px; background: #fbeceb;
  color: var(--error); font-size: 14px;
}

[hidden] { display: none !important; }
