/* 색은 묵상 카드 이미지에서 가져왔다: 카드 바탕 분홍, 기도 카드의 장미색, 본문 글씨의 벽돌색 */
:root {
  --blush: #f3e4e4;
  --rose: #d27479;
  --brick: #a8372a;
  --ink: #3b3334;
  --muted: #8b7778;
  --line: #dcc4c4;
  --field: #fffdfd;
  --display: "Gowun Batang", "AppleMyungjo", "Nanum Myeongjo", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--blush);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { margin: 0; font-family: var(--display); font-weight: 700; line-height: 1.3; }
:focus-visible { outline: 2px solid var(--brick); outline-offset: 2px; }

/* ---------- 날짜 페이지: 한 장씩 넘기는 덱 ----------
   스크롤은 문서 자체가 맡는다. 장 높이는 주소창이 접혔을 때 기준(lvh)으로 고정해서,
   스크롤 방향이 바뀌며 주소창이 나타나거나 사라져도 장 높이와 멈춤 위치가 변하지 않게 한다. */
html.day {
  height: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
html.day::-webkit-scrollbar { display: none; }
html.day.typing { scroll-snap-type: none; } /* 입력 중에는 키보드 때문에 화면이 튀지 않게 */
body.day { height: auto; }

.slide {
  height: 100vh;
  height: 100lvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: grid;
  place-items: center;
  background: var(--blush);
}
/* 장 높이는 고정이지만, 사진은 "지금 실제로 보이는 높이"의 가운데에 둔다.
   (주소창이 보일 때 사진이 아래로 처져 보이지 않게) */
.slide img {
  display: block;
  align-self: start;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  object-fit: contain;
  transition: height 0.2s ease-out;
}
.empty { margin: 0; font-family: var(--display); font-size: 22px; text-align: center; color: var(--brick); }

/* 넘기기 안내 */
.hint {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 16px;
  border: 0;
  background: none;
  color: var(--brick);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.25s, color 0.25s;
}
.hint svg { animation: nudge 1.6s ease-in-out infinite; }
.hint[hidden] { display: none; }
@keyframes nudge {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(6px); }
}

/* 몇 번째 장인지 */
.dots {
  position: fixed;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--brick);
  transition: color 0.25s;
}
.dots[hidden] { display: none; }
.dots li { width: 5px; height: 5px; border-radius: 3px; background: currentColor; opacity: 0.3; transition: height 0.25s, opacity 0.25s; }
.dots li.on { height: 16px; opacity: 1; }

/* 어두운 카드(기도 카드 등) 위에서는 흰색으로 */
body[data-tone="dark"] .hint, body[data-tone="dark"] .dots { color: #fff; }

/* ---------- 묵상 기록 (마지막 장) ---------- */
.slide.write {
  height: auto;
  min-height: 100vh;
  min-height: 100lvh;
  place-items: start stretch;
  scroll-snap-stop: normal;
}
.write-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100svh; /* 주소창이 보일 때도 저장 버튼까지 한 화면에 */
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 22px calc(18px + env(safe-area-inset-bottom));
}
form { display: flex; flex-direction: column; flex: 1; }
form[hidden] { display: none; }

.write h1 { font-size: 27px; color: var(--brick); }
.lead { margin: 6px 0 22px; color: var(--ink); font-size: 15px; }

fieldset { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
legend, .field > span { display: flex; justify-content: space-between; align-items: baseline; width: 100%; padding: 0; margin-bottom: 7px; font-size: 14px; font-weight: 600; }

.radios { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 2px 22px; }
.radio { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 16px; cursor: pointer; }
.radio input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid #b79c9c;
  border-radius: 50%;
  background: var(--field);
  cursor: pointer;
}
.radio input:checked { border: 6px solid var(--brick); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: block; margin-bottom: 18px; min-width: 0; }
.field.grow { display: flex; flex-direction: column; flex: 1; }

input[type="text"], textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit; /* 16px 미만이면 iOS 가 화면을 확대한다 */
  -webkit-appearance: none;
  appearance: none;
}
textarea { flex: 1; min-height: 132px; resize: none; line-height: 1.6; }
input[type="text"]:focus, textarea:focus { outline: 0; border-color: var(--brick); box-shadow: 0 0 0 1px var(--brick); }
::placeholder { color: #b3a2a2; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.error { margin: -6px 0 12px; color: var(--brick); font-size: 14px; font-weight: 600; }

button[type="submit"] {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  background: var(--brick);
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
button[type="submit"]:active { background: #8f2d22; }
button:disabled { opacity: 0.6; }
.foot { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 13px; }

.done { margin: auto 0; text-align: center; outline: 0; }
.done h2 { font-size: 25px; color: var(--brick); }
.done p { margin: 12px 0 28px; font-family: var(--display); font-size: 17px; line-height: 1.7; }
.done button { padding: 10px 14px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 15px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

/* ---------- 목록 ---------- */
body.list header, body.list main { max-width: 480px; margin: 0 auto; padding: 0 22px; }
body.list header { padding-top: calc(36px + env(safe-area-inset-top)); padding-bottom: 14px; }
body.list h1 { font-size: 30px; color: var(--brick); }
body.list .lead { margin: 4px 0 0; color: var(--muted); }
body.list .lead a { color: var(--brick); }
body.list main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

.days { list-style: none; margin: 0; padding: 0; }
.days a {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: baseline;
  min-height: 54px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.days b { font-family: var(--display); font-size: 20px; color: var(--brick); font-variant-numeric: tabular-nums; }
.days span { font-size: 16px; }
.days a.pending b, .days a.pending span { color: #b3a2a2; font-weight: 400; }

@media (prefers-reduced-motion: reduce) {
  .hint svg { animation: none; }
  .dots li, .hint, .slide img { transition: none; }
}
