/* 우리 아기 육아일기 — Toss 스타일 리디자인
   캔버스 #F2F4F6 · 화이트 카드 · 토스 블루(#3182F6) · Pretendard */

:root {
  /* surface */
  --bg: #F2F4F6;
  --card: #FFFFFF;
  --fill: #F2F4F6;
  --line: #E5E8EB;
  --line-soft: #F2F4F6;

  /* text */
  --text: #191F28;
  --text-strong: #333D4B;
  --text-sub: #6B7684;
  --text-ter: #8B95A1;

  /* brand */
  --blue: #3182F6;
  --blue-dark: #1B64DA;
  --blue-tint: #E8F3FF;
  --orange-tint: #FFF3E0;
  --orange-text: #B9713F;
  --green-tint: #E8F8F0;
  --green-text: #0B8A57;
  --red: #F04452;
  --red-tint: #FFEEEE;

  --radius: 22px;
  --radius-md: 16px;
  --radius-sm: 14px;

  --shadow-card: 0 1px 2px rgba(23, 31, 40, 0.04);
  --shadow-float: 0 6px 24px rgba(23, 31, 40, 0.12);

  /* 히어로 틴트 (4p 날짜 · 5p 아기 정보) — 테마마다 바뀝니다 */
  --hero-1: #E8F3FF;
  --hero-2: #F3F9FF;
  --hero-3: #FFFFFF;

  /* 빈 화면 점선 박스 */
  --empty-bg: #F7F8FA;
  --empty-line: #E1E5EA;

  --nav-h: 84px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "맑은 고딕",
          "Helvetica Neue", Arial, sans-serif;
}

/* ---------- 배경 테마 4종 ----------
   기본값(:root)이 곧 gray(토스 그레이)입니다.
   카드·포인트 색은 그대로 두고, 캔버스(.배경)와 입력창 필드, 히어로 틴트만 테마에 맞춰 바꿉니다. */
:root[data-theme="cream"] {
  --bg: #FBF7F0;
  --fill: #F6F1E6;
  --line: #EDE4D6;
  --line-soft: #F6F1E6;
  --hero-1: #FFF4E4;
  --hero-2: #FFF9F1;
  --hero-3: #FFFFFF;
  --empty-bg: #FAF4EA;
  --empty-line: #E9DFCC;
}
:root[data-theme="lavender"] {
  --bg: #F4F2FA;
  --fill: #EFECF8;
  --line: #E4DFF1;
  --line-soft: #EFECF8;
  --hero-1: #EDE8FA;
  --hero-2: #F5F2FD;
  --hero-3: #FFFFFF;
  --empty-bg: #F4F1FB;
  --empty-line: #E3DDF1;
}
:root[data-theme="mint"] {
  --bg: #EFF7F4;
  --fill: #E7F2ED;
  --line: #DAE9E2;
  --line-soft: #E7F2ED;
  --hero-1: #E2F4EE;
  --hero-2: #F0FAF6;
  --hero-3: #FFFFFF;
  --empty-bg: #EDF7F3;
  --empty-line: #D6E8E1;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

html { background: var(--bg); }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  transition: background-color .24s ease;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

.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;
}

/* ---------- 레이아웃 ---------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 20px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
}

.appbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 2px 18px;
}

.appbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.brand-mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  font-size: 23px;
  background: var(--card);
  border-radius: 15px;
  box-shadow: var(--shadow-card);
  flex: none;
}
.brand-title {
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.25;
  color: var(--text);
  min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub {
  font-size: 13.5px; font-weight: 500; color: var(--text-sub);
  margin-top: 7px;
  padding-left: 58px;
  line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 테마 전환 (헤더 색 버튼 4개) ---------- */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: none;
  padding: 3px;
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}
.theme-swatch {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.theme-swatch::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--swatch, #F2F4F6);
  box-shadow: inset 0 0 0 1px rgba(23, 31, 40, 0.10);
  transition: width .16s, height .16s, box-shadow .16s;
}
.theme-swatch:hover::before { box-shadow: inset 0 0 0 1px rgba(23, 31, 40, 0.22); }
.theme-swatch[aria-pressed="true"]::before {
  width: 24px; height: 24px;
  box-shadow: inset 0 0 0 1px rgba(23, 31, 40, 0.10),
              0 0 0 2px var(--card),
              0 0 0 4px var(--blue);
}
.theme-swatch:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.theme-swatch[data-theme-set="gray"] { --swatch: #E4E7EB; }
.theme-swatch[data-theme-set="cream"] { --swatch: #F5E7D2; }
.theme-swatch[data-theme-set="lavender"] { --swatch: #E3DCF7; }
.theme-swatch[data-theme-set="mint"] { --swatch: #D4EEE4; }

/* ---------- 테마 고르기 (1p 가족 카드) ---------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.theme-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--fill);
  color: var(--text-strong);
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: background .16s, box-shadow .16s;
  -webkit-tap-highlight-color: transparent;
}
.theme-opt:hover { box-shadow: inset 0 0 0 1.5px var(--line); }
.theme-opt[aria-pressed="true"] {
  background: var(--card);
  box-shadow: inset 0 0 0 1.8px var(--blue);
}
.theme-opt:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.theme-chip {
  width: 28px; height: 28px;
  flex: none;
  border-radius: 50%;
  background: var(--swatch, #F2F4F6);
  box-shadow: inset 0 0 0 1px rgba(23, 31, 40, 0.10);
}
.theme-opt[data-theme-set="gray"] { --swatch: #E4E7EB; }
.theme-opt[data-theme-set="cream"] { --swatch: #F5E7D2; }
.theme-opt[data-theme-set="lavender"] { --swatch: #E3DCF7; }
.theme-opt[data-theme-set="mint"] { --swatch: #D4EEE4; }
.theme-opt .theme-name {
  font-size: 14px; font-weight: 700; letter-spacing: -0.02em;
  min-width: 0; line-height: 1.3;
}
.theme-opt[aria-pressed="true"] .theme-name { color: var(--blue-dark); }

.tabs { display: none; gap: 4px; flex-wrap: wrap; }
.tab {
  border: 0;
  background: transparent;
  color: var(--text-sub);
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s, color .16s;
}
.tab:hover { background: rgba(255, 255, 255, 0.7); }
.tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-card); }

.main { display: block; }
.page { display: none; }
.page.active { display: block; animation: fade .24s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { margin: 2px 2px 16px; }
.page-title { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; }
.page-desc { font-size: 14px; color: var(--text-sub); margin-top: 6px; line-height: 1.5; }

.grid-2 { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); margin-bottom: 12px; }
.grid-3 { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; }

/* ---------- 카드 ---------- */
.card {
  background: var(--card);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 12px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-title { font-size: 18px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.35; }
.card-desc { font-size: 14px; color: var(--text-sub); line-height: 1.5; margin-bottom: 18px; }
.step {
  font-size: 12px; font-weight: 600; color: var(--text-ter);
  background: var(--fill); border-radius: 8px; padding: 4px 8px; flex: none;
}
.badge-soft {
  font-size: 12px; font-weight: 600; color: var(--blue-dark);
  background: var(--blue-tint); border-radius: 8px; padding: 5px 9px; flex: none;
  line-height: 1.25; text-align: right;
}

/* ---------- 폼 ---------- */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: block;
  font-size: 13.5px; font-weight: 600; color: var(--text-sub);
  letter-spacing: -0.01em;
}
.field-label .req { color: var(--blue); font-style: normal; font-size: 12px; font-weight: 700; }
.field-label .opt { color: var(--text-ter); font-style: normal; font-size: 12px; font-weight: 500; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
.field-wide { grid-column: 1 / -1; }

input[type="text"], input[type="date"], input[type="time"], input[type="number"], textarea, select {
  width: 100%;
  max-width: 100%;
  background: var(--fill);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  transition: background .16s, box-shadow .16s;
  box-shadow: inset 0 0 0 1.5px transparent;
}
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #9EA6B0; font-weight: 500; }
input:focus, textarea:focus, select:focus {
  outline: none;
  background: #fff;
  box-shadow: inset 0 0 0 1.8px var(--blue);
}
input[type="date"], input[type="time"] {
  min-height: 54px;
  appearance: none; -webkit-appearance: none;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 44px;
  min-height: 54px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238B95A1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--blue); flex: none; }

.hint { font-size: 13px; color: var(--text-sub); line-height: 1.55; margin-top: 8px; }
.hint.warn { color: var(--red); }
.hint strong { color: var(--text-strong); font-weight: 700; }

#dueHint { margin: 0 0 18px; }

.birth-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.birth-row input[type="date"] { flex: 1 1 170px; min-width: 0; }

.segment {
  display: inline-flex;
  background: var(--fill);
  border-radius: var(--radius-sm);
  padding: 4px;
  flex: none;
}
.segment-btn {
  border: 0; background: transparent; cursor: pointer;
  padding: 0 16px; min-height: 44px; border-radius: 11px;
  font-size: 14px; font-weight: 700; color: var(--text-sub);
  transition: background .16s, color .16s, box-shadow .16s;
}
.segment-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(23, 31, 40, 0.10); }

.check {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--text-sub);
  margin: -2px 0 10px; padding: 4px 0;
}
.input-unit { display: flex; gap: 8px; }
.input-unit input { flex: 1; min-width: 0; }
.input-unit select { width: 88px; flex: none; }

.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 20px; }
.form-actions-stack { flex-direction: column; align-items: stretch; }
.save-hint {
  font-size: 13px; color: var(--text-ter); font-weight: 500;
  text-align: center; width: 100%; min-height: 0;
}
.save-hint:empty { display: none; }

/* ---------- 버튼 ---------- */
.btn {
  border: 0;
  border-radius: var(--radius-md);
  min-height: 52px;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background .16s, transform .1s, opacity .16s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-soft { background: var(--blue-tint); color: var(--blue-dark); }
.btn-soft:hover { background: #DBEBFF; }
.btn-ghost { background: var(--fill); color: var(--text-strong); }
.btn-ghost:hover { background: var(--line); }
.btn-danger-ghost { background: var(--red-tint); color: var(--red); }
.btn-sm { min-height: 42px; padding: 0 14px; font-size: 14px; font-weight: 600; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- 온보딩 배너 ---------- */
.onboard {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--blue-tint);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 12px;
  color: #4E5968;
  font-size: 13.5px;
  line-height: 1.5;
}
.onboard-emoji { font-size: 22px; flex: none; line-height: 1.3; }
.onboard-body { flex: 1 1 180px; min-width: 0; }
.onboard-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: -0.02em; }
.onboard strong { color: var(--text); font-weight: 700; }
.onboard .btn { margin-left: auto; }

/* ---------- 사진 ---------- */
.photo-field { margin-bottom: 18px; }
.photo-drop {
  width: 100%;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--empty-bg);
  border: 1.5px dashed var(--empty-line);
  border-radius: 18px;
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .16s, background .16s;
  padding: 20px;
}
.photo-drop:hover { border-color: var(--blue); background: var(--blue-tint); }
.photo-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: var(--blue-tint);
  border-radius: 15px;
  font-size: 20px;
}
.photo-drop-tall { min-height: 210px; }
.photo-field-sm .photo-drop { min-height: 108px; }
.photo-field-sm .photo-icon { width: 38px; height: 38px; border-radius: 12px; font-size: 17px; }
.photo-preview {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: var(--fill);
}
.photo-preview img { width: 100%; max-height: 340px; object-fit: cover; border-radius: 18px; }
.photo-remove {
  position: absolute; right: 10px; bottom: 10px;
  border: 0; border-radius: 12px;
  background: rgba(25, 31, 40, 0.68);
  color: #fff; font-size: 13px; font-weight: 600;
  padding: 9px 13px; cursor: pointer;
  backdrop-filter: blur(6px);
}

/* ---------- 4p 날짜 히어로 ---------- */
.daybar {
  background: linear-gradient(160deg, var(--hero-1) 0%, var(--hero-2) 58%, var(--hero-3) 100%);
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.daybar-nav { display: flex; align-items: center; gap: 8px; }
.nav-arrow {
  width: 44px; height: 44px; flex: none;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: var(--text-strong);
  font-size: 22px; line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(23, 31, 40, 0.08);
  transition: background .16s, opacity .16s;
}
.nav-arrow:hover:not([disabled]) { background: #fff; color: var(--blue); }
.nav-arrow[disabled] { opacity: .35; cursor: not-allowed; }
.daybar-center { flex: 1; text-align: center; min-width: 0; padding: 0 2px; }
.daybar-date {
  font-size: 19px; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.35; color: var(--text);
}
.daybar-sub {
  display: block;
  text-align: center;
  font-size: 15px; color: var(--blue-dark); font-weight: 700;
  margin: 10px auto 0;
  line-height: 1.4;
  letter-spacing: -0.02em;
  max-width: 100%;
}
.daybar-row { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.daybar-row .btn { background: #fff; box-shadow: 0 1px 3px rgba(23, 31, 40, 0.06); }
.daypicker {
  flex: 1 1 140px; min-width: 0;
  position: relative;
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 40px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(23, 31, 40, 0.06);
}
.daypicker-face {
  flex: 1; font-size: 14px; font-weight: 600; color: var(--text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.daypicker::after { content: "🗓"; font-size: 14px; opacity: .7; flex: none; }
.daypicker input[type="date"] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; border: 0; padding: 0; margin: 0;
  cursor: pointer; background: transparent; box-shadow: none;
}
.day-count { font-size: 13px; color: var(--text-sub); font-weight: 600; flex: none; }

.diary-layout { display: flex; flex-direction: column; gap: 12px; }
.entry-form { margin-bottom: 0; }

.author-switch {
  display: flex; gap: 4px;
  background: var(--fill);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 18px;
}
.author-btn {
  flex: 1;
  border: 0; background: transparent; cursor: pointer;
  min-height: 46px; padding: 0 8px; border-radius: 11px;
  font-size: 15px; font-weight: 700; color: var(--text-sub);
  transition: background .16s, color .16s, box-shadow .16s;
}
.author-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(23, 31, 40, 0.10); }

.tag-block { margin-bottom: 4px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag {
  border: 0;
  background: var(--fill);
  color: #4E5968;
  border-radius: 999px;
  padding: 0 14px;
  min-height: 44px; padding: 0 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s, color .14s, box-shadow .14s;
  box-shadow: inset 0 0 0 1.5px transparent;
}
.tag.on {
  background: var(--blue-tint);
  color: var(--blue-dark);
  box-shadow: inset 0 0 0 1.5px var(--blue);
}

.entries { min-width: 0; }
.entries-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin: 6px 2px 10px;
}
.entries-title { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.share-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.entry-list { display: flex; flex-direction: column; gap: 10px; }
.entry {
  background: var(--card);
  border: 0;
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 18px;
  min-width: 0;
}
.entry-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.author-badge {
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 5px 11px;
}
.author-badge.mom { background: #FFF0F3; color: #D6436A; }
.author-badge.dad { background: var(--blue-tint); color: var(--blue-dark); }
.entry-time { font-size: 12.5px; color: var(--text-ter); font-weight: 600; }
.entry-tools { margin-left: auto; display: flex; gap: 2px; }
.entry-tools button {
  border: 0; background: transparent; color: var(--text-ter);
  font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 7px 9px; border-radius: 9px; min-height: 34px;
}
.entry-tools button:hover { background: var(--fill); color: var(--text-strong); }
.entry-text { font-size: 15.5px; line-height: 1.72; white-space: pre-wrap; color: var(--text-strong); }
.entry-photo {
  margin-top: 12px; width: 100%;
  border-radius: var(--radius-sm);
  object-fit: cover; max-height: 360px;
}
.entry-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-size: 12.5px; font-weight: 600; color: #4E5968;
  background: var(--fill); border-radius: 999px; padding: 6px 11px;
}
.chip.tag-chip { background: var(--green-tint); color: var(--green-text); }
.empty-state {
  background: var(--empty-bg);
  border: 1.5px dashed var(--empty-line);
  border-radius: 20px;
  padding: 36px 20px;
  text-align: center;
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.6;
}
.empty-state .empty-emoji { font-size: 30px; display: block; margin-bottom: 10px; }

/* ---------- 5p 아기 정보 ---------- */
.info-hero {
  background: linear-gradient(155deg, var(--hero-1) 0%, var(--hero-2) 55%, var(--hero-3) 100%);
  border-radius: 24px;
  padding: 26px 20px;
  text-align: center;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.info-hero-eyebrow {
  font-size: 13px; font-weight: 700; color: var(--blue);
  letter-spacing: 0; margin-bottom: 6px;
}
.info-hero-name { font-size: 30px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.25; }
.info-hero-birth { font-size: 14.5px; color: var(--text-sub); margin-top: 8px; }
.info-hero-lunar { font-size: 13px; color: var(--blue-dark); font-weight: 700; margin-top: 8px; line-height: 1.55; }
.info-hero-note {
  margin-top: 16px;
  font-size: 12.5px; font-weight: 600; line-height: 1.55;
  color: #4E5968;
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: left;
}

.dday-card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 14px 6px;
  text-align: center;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.dday-label { font-size: 11.5px; font-weight: 600; color: var(--text-sub); white-space: nowrap; }
.dday-value { font-size: 16px; font-weight: 800; margin: 6px 0 2px; letter-spacing: -0.04em; line-height: 1.25; white-space: nowrap; }
.dday-date { font-size: 10px; color: var(--text-ter); line-height: 1.4; }
.dday-state { display: inline-block; margin-top: 8px; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 3px 7px; line-height: 1.35; }
.dday-state.upcoming { background: var(--orange-tint); color: var(--orange-text); }
.dday-state.today { background: var(--blue); color: #fff; }
.dday-state.past { background: var(--fill); color: var(--text-ter); }

.info-card { margin-bottom: 0; }
.info-card .info-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.info-icon {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: var(--blue-tint);
  border-radius: 12px;
  font-size: 19px;
}
.info-main { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.info-sub { font-size: 13.5px; color: var(--text-sub); line-height: 1.55; margin-top: 4px; }
.info-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.info-pill {
  font-size: 12.5px; font-weight: 600;
  background: var(--fill); color: #4E5968;
  border-radius: 999px; padding: 6px 11px;
}
.info-pill.peach { background: var(--orange-tint); color: var(--orange-text); }
.info-pill.sky { background: var(--blue-tint); color: var(--blue-dark); }
.info-note { font-size: 12px; color: var(--text-ter); line-height: 1.65; margin: 6px 4px 4px; }
.stone-dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  box-shadow: inset 0 -5px 10px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .06);
  border: 3px solid #fff;
}
.flower-emoji { font-size: 20px; line-height: 1; width: 40px; text-align: center; }
.parent-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 0; border-top: 1px solid var(--line-soft);
  font-size: 14px;
}
.parent-line:first-of-type { border-top: 0; padding-top: 2px; }
.parent-line .p-name { font-weight: 700; color: var(--text); }
.parent-line .p-sub { font-size: 12px; color: var(--text-ter); font-weight: 500; }
.parent-line .p-dday { font-weight: 800; color: var(--blue); flex: none; font-size: 14px; }

/* ---------- 백업 카드 ---------- */
.backup-block { border-top: 1px solid var(--line-soft); padding-top: 16px; margin-top: 16px; }
.backup-block:first-of-type { border-top: 0; padding-top: 0; margin-top: 6px; }
.backup-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 700; margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.backup-step .num {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--blue-tint); color: var(--blue-dark);
  font-size: 12px; font-weight: 700;
}
.backup-block .hint { margin-top: 4px; }
.backup-block .form-actions { margin-top: 10px; }
.backup-block strong { color: var(--text-strong); font-weight: 700; }
.backup-block-danger .num { background: var(--red-tint); color: var(--red); }

/* ---------- 모달 (바텀시트) ---------- */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(25, 31, 40, 0.45);
  padding: 0;
  animation: dimIn .2s ease;
}
@keyframes dimIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%; max-width: 560px; max-height: 90vh; overflow: auto;
  background: var(--card);
  border: 0;
  border-radius: 26px 26px 0 0;
  padding: 8px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(23, 31, 40, 0.16);
  animation: sheetUp .28s cubic-bezier(.22, .61, .36, 1);
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-grip { width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: 4px auto 16px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-title { font-size: 19px; font-weight: 800; letter-spacing: -0.03em; }
.modal-close {
  border: 0; background: var(--fill); color: var(--text-sub);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  padding: 8px 12px; border-radius: 10px; min-height: 38px;
}
.modal-close:hover { background: var(--line); color: var(--text-strong); }
.modal-desc { font-size: 14px; color: var(--text-sub); line-height: 1.55; margin: 8px 0 16px; }
.modal-desc strong { color: var(--text-strong); font-weight: 700; }
#pasteArea {
  min-height: 150px;
  font-size: 13px; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
body.modal-open { overflow: hidden; }

@media (min-width: 620px) {
  .modal { align-items: center; padding: 20px; }
  .modal-card { border-radius: 26px; padding: 10px 24px 24px; }
  .modal-actions { flex-direction: row-reverse; }
  .modal-actions .btn { flex: 1; }
}

/* ---------- 플로팅 플레이어 ---------- */
.player {
  position: fixed;
  right: 18px;
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(12px);
  max-width: calc(100vw - 36px);
}
.player-btn {
  width: 40px; height: 40px; flex: none;
  border-radius: 50%; border: 0;
  background: var(--blue); color: #fff;
  font-size: 13px; cursor: pointer;
  display: grid; place-items: center;
  transition: background .16s, transform .12s;
}
.player-btn:hover { background: var(--blue-dark); }
.player-btn:active { transform: scale(.96); }
.player-btn-sm { width: 30px; height: 30px; background: var(--fill); color: var(--text-strong); font-size: 11px; }
.player-btn-sm:hover { background: var(--line); }
.player-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.player-title {
  font-size: 12px; font-weight: 600; color: var(--text-sub);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 112px;
}
.player-body input[type="range"] {
  width: 84px; height: 14px; padding: 0; border: 0; background: transparent;
  accent-color: var(--blue); box-shadow: none;
}
@media (max-width: 619px) {
  /* 멈춰 있을 때는 동그란 음악 버튼 하나로 접혀 있어요 */
  .player {
    width: 52px; height: 52px; padding: 0; gap: 0;
    justify-content: center; border-radius: 50%; overflow: hidden;
    transition: width .2s ease, border-radius .2s ease, padding .2s ease;
  }
  .player:not(.playing) .player-body,
  .player:not(.playing) #nextTrack { display: none; }
  .player:not(.playing) .player-btn { width: 52px; height: 52px; background: transparent; color: var(--blue); font-size: 18px; }
  .player.playing { width: auto; padding: 5px 10px 5px 5px; gap: 7px; border-radius: 999px; }
  .player-btn { width: 34px; height: 34px; font-size: 12px; }
  .player-btn-sm { width: 26px; height: 26px; font-size: 10px; }
  .player-title { max-width: 74px; font-size: 11px; }
  .player-body input[type="range"] { width: 66px; }
}

/* ---------- 하단 내비게이션 ---------- */
.bottomnav {
  position: fixed;
  left: 14px; right: 14px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  display: flex;
  justify-content: space-around;
  gap: 2px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 22px;
  padding: 8px 6px;
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(14px);
}
.bottom-item {
  flex: 1 1 0;
  min-width: 0;
  border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 2px;
  min-height: 54px;
  color: var(--text-ter);
  font-size: 11px;
  cursor: pointer;
  border-radius: 16px;
  transition: color .16s, background .16s;
}
.bottom-item span { font-size: 19px; line-height: 1.1; filter: grayscale(1); opacity: .5; transition: filter .16s, opacity .16s; }
.bottom-item em { font-style: normal; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.bottom-item.active { color: var(--blue); }
.bottom-item.active span { filter: none; opacity: 1; }
.bottom-item.active em { font-weight: 700; }
.bottom-item.active span { transform: translateY(-1px); }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--nav-h) + 76px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  background: rgba(25, 31, 40, 0.94);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 14px 18px;
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 60;
  max-width: calc(100vw - 40px);
  text-align: center;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(23, 31, 40, .18);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 공유 전용 화면 ---------- */
.share-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px 20px 40px;
  gap: 16px;
}
.share-root[hidden] { display: none; }
.letter {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: 26px;
  box-shadow: 0 10px 32px rgba(23, 31, 40, 0.10);
  padding: 30px 24px 26px;
  position: relative;
  overflow: hidden;
}
.letter::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, #3182F6, #6FA8FF);
}
.letter > * { position: relative; }
.letter-top { text-align: center; margin-bottom: 22px; }
.letter-orn { font-size: 14px; color: var(--blue); letter-spacing: 6px; }
.letter-baby { font-size: 13.5px; color: var(--text-sub); font-weight: 600; margin-top: 10px; }
.letter-baby strong { color: var(--text); font-weight: 800; }
.letter-date { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; margin-top: 8px; }
.letter-days { font-size: 13px; color: var(--blue-dark); font-weight: 700; margin-top: 6px; }
.letter-body { display: flex; flex-direction: column; gap: 18px; }
.letter-entry { border-top: 1px solid var(--line-soft); padding-top: 16px; }
.letter-entry:first-child { border-top: 0; padding-top: 0; }
.letter-author {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--blue-dark);
  background: var(--blue-tint); border-radius: 999px; padding: 5px 11px;
  margin-bottom: 8px;
}
.letter-text { font-size: 15.5px; line-height: 1.8; white-space: pre-wrap; color: var(--text-strong); }
.letter-mood { font-size: 13px; color: var(--text-sub); margin-top: 8px; }
.letter-foot { margin-top: 26px; text-align: center; }
.letter-foot p { font-size: 12.5px; color: var(--text-ter); line-height: 1.5; }
.share-open {
  display: inline-block;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--blue-dark);
  background: var(--blue-tint);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  min-height: 48px;
  cursor: pointer;
  text-decoration: none;
}
.share-note { font-size: 12.5px; color: var(--text-ter); text-align: center; max-width: 460px; line-height: 1.5; }

/* ---------- 6p 병원·약국 ---------- */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 6px 6px 2px;
  margin: -2px -2px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 0;
  cursor: pointer;
  padding: 9px 15px;
  min-height: 40px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-sub);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: background .16s, color .16s;
}
.chip:hover { background: var(--line); }
.chip.is-on { background: var(--blue-tint); color: var(--blue-dark); }
.chip.is-on:hover { background: #DBEBFF; }

.map-search { display: flex; gap: 8px; margin-bottom: 10px; }
.map-search input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  background: var(--fill);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  min-height: 52px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: background .16s, box-shadow .16s;
  -webkit-appearance: none;
  appearance: none;
}
.map-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.map-search input[type="search"]:focus {
  outline: none;
  background: #fff;
  box-shadow: inset 0 0 0 1.8px var(--blue);
}
.map-search-btn {
  flex: none;
  border: 0;
  cursor: pointer;
  min-height: 52px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: background .16s;
}
.map-search-btn:hover { background: var(--blue-dark); }

.map-locrow { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.map-locrow .btn { flex: none; }
.map-loc {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-ter);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#mapLocBtn.is-busy { opacity: .6; }

.map-frame {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--fill);
}
.kakao-map {
  position: relative;
  width: 100%;
  height: clamp(290px, 74vw, 320px);
  background: var(--fill);
}
.kakao-map.is-off { display: none; }
.map-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 26px 20px;
}
.map-fallback-icon { font-size: 26px; line-height: 1; }
.map-fallback-title { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.map-fallback-text { font-size: 13px; color: var(--text-sub); line-height: 1.55; max-width: 300px; }
.map-fallback .btn { margin-top: 4px; }

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}
.map-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  margin-top: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-count:empty { display: none; }
.map-reload {
  flex: none;
  margin-left: auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--blue-dark);
}
.map-reload:hover { background: var(--blue-tint); }

.map-note {
  font-size: 12px;
  color: var(--text-ter);
  line-height: 1.6;
  margin: 14px 4px 0;
}
.map-note strong { color: var(--text-sub); font-weight: 700; }

/* 결과 목록 — 토스 화이트 카드 */
.place-list { display: flex; flex-direction: column; gap: 10px; }
.place-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.place {
  background: var(--card);
  border-radius: 22px;
  padding: 16px 18px 18px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line-soft);
  transition: border-color .16s, box-shadow .16s;
}
.place.is-open { border-color: var(--blue); box-shadow: 0 6px 20px rgba(49, 130, 246, .14); }
.place-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.place-rank {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--blue-tint);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.place.is-open .place-rank { background: var(--blue); color: #fff; }
.place-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.place-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.place-meta { font-size: 12.5px; font-weight: 600; color: var(--text-sub); }
.place-addr {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.5;
  margin: 9px 0 0 35px;
  overflow-wrap: anywhere;
}
.place-actions { display: flex; gap: 8px; margin: 13px 0 0 35px; flex-wrap: wrap; }
.place-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  border: 0;
}
.place-act-call { background: var(--blue-tint); color: var(--blue-dark); }
.place-act-call:hover { background: #DBEBFF; }
.place-act-go { background: var(--fill); color: var(--text-strong); }
.place-act-go:hover { background: var(--line); }
.place-act.is-off { background: var(--fill); color: var(--text-ter); font-weight: 600; }

.place-empty {
  background: var(--card);
  border-radius: 22px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line-soft);
}
.place-empty p { font-size: 13.5px; color: var(--text-sub); line-height: 1.6; margin: 0 auto; max-width: 320px; }
.place-empty .btn { margin-top: 12px; }
.place-empty.is-busy p { color: var(--text-ter); }

/* 지도 핀 · 말풍선은 카카오맵 위에 얹히므로 자체 배경을 씁니다 */
.map-pin {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 999px 999px 999px 4px;
  transform: rotate(-45deg);
  background: var(--blue, #3182F6);
  box-shadow: 0 2px 6px rgba(23, 31, 40, .28), 0 0 0 2px #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .12s, background .16s;
}
.map-pin span {
  transform: rotate(45deg);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.map-pin:hover { transform: rotate(-45deg) scale(1.08); }
.map-pin:focus-visible { outline: 2px solid #1B64DA; outline-offset: 2px; }

.map-pop {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px 13px;
  min-width: 168px;
  max-width: 240px;
  box-shadow: 0 10px 26px rgba(23, 31, 40, .22);
  border: 1px solid #E5E8EB;
  font-family: var(--font);
}
.map-pop::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: #fff;
  border-right: 1px solid #E5E8EB;
  border-bottom: 1px solid #E5E8EB;
  transform: rotate(45deg);
}
.map-pop-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8B95A1;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.map-pop-close:hover { background: #F2F4F6; color: #333D4B; }
.map-pop-name {
  font-size: 14px;
  font-weight: 700;
  color: #191F28;
  letter-spacing: -0.02em;
  padding-right: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.map-pop-meta { font-size: 12px; font-weight: 600; color: #6B7684; margin-top: 3px; }
.map-pop-row { display: flex; gap: 6px; margin-top: 9px; }
.map-pop-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 10px;
  background: #E8F3FF;
  color: #1B64DA;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.map-pop-btn:last-child { background: #F2F4F6; color: #333D4B; }
.map-pop-btn.is-off { background: #F2F4F6; color: #8B95A1; font-weight: 600; }

@media (min-width: 620px) {
  .kakao-map { height: 320px; }
  .place-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 반응형 ---------- */
@media (min-width: 480px) {
  .field-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 620px) {
  .app { padding: 14px 24px calc(var(--nav-h) + 32px); }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-actions .btn-block { width: auto; flex: 0 0 auto; }
  .form-actions-stack { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .form-actions-stack .btn-block { width: auto; }
  .save-hint { width: auto; text-align: left; }
}

@media (min-width: 960px) {
  :root { --nav-h: 0px; }
  .app { max-width: 1120px; padding: 26px 32px 90px; }
  .appbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
    padding: 10px 2px 18px;
  }
  .appbar-top { flex: 1 1 auto; gap: 26px; }
  .brand-title { font-size: 24px; }
  .brand-sub { flex: 1 1 100%; order: 3; padding-left: 58px; margin-top: 0; }
  .tabs { order: 2; display: flex; }
  .bottomnav { display: none; }
  .daybar-nav, .daybar-row { max-width: 660px; margin-left: auto; margin-right: auto; }
  .player { bottom: 26px; right: 28px; }
  .toast { bottom: 40px; }
  .diary-layout {
    display: grid;
    grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
  }
  .entry-form { position: sticky; top: 20px; }
  .entries-head { margin-top: 0; }
  .daybar { padding: 22px 24px; }
  .daybar-date { font-size: 21px; }
  .info-hero { padding: 34px 24px; }
  .info-hero-name { font-size: 34px; }
  .dday-card { padding: 18px 12px; }
  .dday-label { font-size: 13px; }
  .dday-value { font-size: 22px; }
  .dday-date { font-size: 12px; }
  .dday-state { font-size: 11.5px; padding: 4px 10px; }
  .letter { padding: 38px 34px 30px; }
  .letter-date { font-size: 24px; }
  .letter-text { font-size: 16px; }
}

/* ---------- 아주 좁은 화면(320px) ---------- */
@media (max-width: 359px) {
  .app { padding-left: 16px; padding-right: 16px; }
  .brand { gap: 10px; }
  .brand-mark { width: 40px; height: 40px; font-size: 20px; border-radius: 13px; }
  .brand-title { font-size: 20px; }
  .brand-sub { padding-left: 50px; }
  .theme-switch { gap: 0; padding: 2px 3px; }
  .theme-swatch { width: 30px; height: 30px; }
  .theme-swatch::before { width: 20px; height: 20px; }
  .theme-swatch[aria-pressed="true"]::before { width: 21px; height: 21px; }
  .theme-opt { gap: 8px; padding: 8px 10px; min-height: 52px; }
  .theme-chip { width: 24px; height: 24px; }
  .theme-opt .theme-name { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 하단 탭 6개(병원·약국) — 좁은 화면에서도 가로 넘침 없이 ---------- */
@media (max-width: 619px) {
  .bottomnav { gap: 0; padding: 8px 4px; }
  .bottom-item { gap: 2px; padding: 6px 1px; font-size: 10.5px; letter-spacing: -0.03em; }
  .bottom-item span { font-size: 18px; }
}
@media (max-width: 359px) {
  .bottomnav { left: 8px; right: 8px; padding: 8px 2px; }
  .bottom-item { font-size: 9.5px; letter-spacing: -0.04em; }
  .bottom-item span { font-size: 17px; }
}

/* ---------- 하단 탭 7개(동화책) — 좁은 화면에서는 긴 이름을 짧게 ---------- */
.bottom-item em .lbl-long,
.bottom-item em .lbl-short { font-size: inherit; filter: none; opacity: 1; letter-spacing: inherit; }
.bottom-item em .lbl-short { display: none; }
@media (max-width: 619px) {
  .bottom-item em .lbl-long { display: none; }
  .bottom-item em .lbl-short { display: inline; }
}

/* ---------- 7p 동화책 ---------- */
.story-card { padding: 18px 18px 16px; }
.vocab-card { padding: 20px 18px; }

.story-picker {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: -2px -2px 14px; padding: 2px;
}
.story-picker::-webkit-scrollbar { display: none; }
.story-pick {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: var(--fill); color: var(--text-sub);
  border-radius: 999px; padding: 9px 13px; min-height: 40px;
  font: inherit; font-size: 13px; font-weight: 600; letter-spacing: -0.02em;
  cursor: pointer; transition: background .16s, color .16s;
}
.story-pick em { font-style: normal; white-space: nowrap; }
.story-pick .pk-emoji { font-size: 15px; line-height: 1; }
.story-pick.is-on { background: var(--blue-tint); color: var(--blue-dark); font-weight: 700; }

.story-lang {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px;
  background: var(--fill); border-radius: 14px; padding: 3px; margin-bottom: 14px;
}
.story-lang button {
  border: 0; background: transparent; color: var(--text-sub);
  font: inherit; font-size: 13.5px; font-weight: 600; letter-spacing: -0.02em;
  padding: 10px 4px; min-height: 42px; border-radius: 11px; cursor: pointer;
  transition: background .16s, color .16s, box-shadow .16s;
  white-space: nowrap;
}
.story-lang button.is-on {
  background: var(--card); color: var(--text); font-weight: 700;
  box-shadow: var(--shadow-card);
}

.story-stage {
  border-radius: var(--radius-md); overflow: hidden;
  background: linear-gradient(158deg, var(--hero-1) 0%, var(--hero-2) 52%, var(--hero-3) 100%);
  border: 1px solid var(--line-soft);
}
.story-art {
  position: relative; height: 146px;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
}
.story-art .art-main {
  font-size: 68px; line-height: 1; text-align: center;
  filter: drop-shadow(0 8px 12px rgba(23, 31, 40, .12));
}
.story-art.is-new .art-main { animation: storyPop .42s cubic-bezier(.22, .8, .3, 1); }
@keyframes storyPop {
  from { opacity: 0; transform: scale(.88) translateY(6px); }
  to { opacity: 1; transform: none; }
}
.story-art .art-side {
  position: absolute; font-size: 30px; line-height: 1;
  opacity: .92; filter: drop-shadow(0 4px 8px rgba(23, 31, 40, .10));
}
.story-art .art-side-a { left: 18px; bottom: 18px; }
.story-art .art-side-b { right: 20px; top: 20px; }

/* 세계 그림책 — 삽화가 있는 쪽은 그림을 크게, 없으면 위의 이모지 그림 */
.story-art.is-photo { height: auto; display: block; padding: 0; }
.story-art.is-photo .art-img {
  display: block; width: 100%; height: auto;
  max-height: min(46vh, 330px); object-fit: contain;
}
.story-art.is-photo.is-new .art-img { animation: storyPop .42s cubic-bezier(.22, .8, .3, 1); }

.story-text { padding: 2px 16px 18px; }
.story-ko {
  font-size: 15.5px; font-weight: 600; color: var(--text);
  line-height: 1.62; letter-spacing: -0.012em; word-break: keep-all;
}
.story-en {
  margin-top: 8px; font-size: 14.5px; color: var(--text-sub);
  line-height: 1.75; letter-spacing: 0.002em; word-break: normal;
}
.story-word {
  display: inline; border: 0; background: transparent; padding: 0; margin: 0;
  font: inherit; color: inherit; line-height: inherit; text-align: inherit;
  cursor: pointer; border-radius: 6px;
  text-decoration: underline dotted rgba(107, 118, 132, .48); text-underline-offset: 4px;
  -webkit-text-decoration: underline dotted rgba(107, 118, 132, .48); -webkit-text-underline-offset: 4px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  transition: background .14s, color .14s, box-shadow .14s;
}
.story-word:hover { background: var(--blue-tint); color: var(--blue-dark); }
.story-word:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.story-word.is-sel {
  background: var(--blue-tint); color: var(--blue-dark); font-weight: 700;
  box-shadow: 0 0 0 2px var(--blue-tint); text-decoration: none;
}

.story-actions {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  margin-top: 14px;
}
.sbtn {
  border: 0; background: var(--fill); color: var(--text-strong);
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: -0.02em;
  border-radius: 14px; min-height: 46px; padding: 8px 4px;
  cursor: pointer; white-space: nowrap;
  transition: background .16s, color .16s, transform .1s;
}
.sbtn:active { transform: scale(.985); }
.sbtn.is-on { background: var(--blue-tint); color: var(--blue-dark); }
.sbtn:disabled { opacity: .38; color: var(--text-ter); }
.sbtn-solid { background: var(--blue); color: #fff; }
.sbtn-solid.is-saved { background: var(--green-tint); color: var(--green-text); }

.story-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.story-dots { display: flex; align-items: center; gap: 5px; }
.story-dot {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px;
  background: var(--line); cursor: pointer; transition: width .18s, background .18s;
}
.story-dot.is-on { width: 20px; background: var(--blue); }
.story-count { font-size: 12px; font-weight: 700; color: var(--text-ter); letter-spacing: -0.01em; }
.story-hint { margin-top: 12px; font-size: 12.5px; color: var(--text-ter); line-height: 1.5; }

/* 세계 그림책 저작자 표시 (StoryWeaver · CC BY 4.0) */
.story-credit {
  margin-top: 10px; font-size: 11px; line-height: 1.6;
  color: var(--text-ter); letter-spacing: -0.005em; word-break: keep-all;
}
.story-credit[hidden] { display: none; }
.story-credit .credit-title { color: var(--text-sub); font-weight: 700; }
.story-credit a {
  color: inherit; text-decoration: underline;
  text-underline-offset: 2px; text-decoration-color: var(--line);
}

/* 동화 고르기 · 50권 책장 */
.story-bookbar {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: var(--fill); border-radius: 16px;
  padding: 10px 12px; min-height: 58px; margin-bottom: 12px;
  font: inherit; text-align: left; cursor: pointer;
}
.story-bookbar:active { transform: scale(.995); }
.bb-cover { flex: none; font-size: 26px; line-height: 1; }
.bb-now { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.bb-title {
  font-size: 14.5px; font-weight: 700; color: var(--text); letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bb-meta {
  font-size: 11.5px; font-weight: 600; color: var(--text-ter);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bb-open {
  flex: none; display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 700; color: var(--blue-dark);
  background: var(--blue-tint); border-radius: 999px; padding: 6px 10px; white-space: nowrap;
}

.story-status {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 9px 11px; border-radius: 12px;
  font-size: 12.5px; line-height: 1.5; color: var(--text-sub); background: var(--fill);
}
.story-status[hidden] { display: none; }
.story-status.is-warn { background: #FFF7E6; color: #8A5A00; }
.story-status.is-ok { background: var(--green-tint); color: var(--green-text); }
.story-retry {
  border: 0; background: var(--card); color: var(--blue-dark);
  font: inherit; font-size: 12px; font-weight: 700; border-radius: 9px;
  padding: 6px 10px; min-height: 32px; cursor: pointer; box-shadow: var(--shadow-card);
}
.story-retry[hidden] { display: none; }

.shelf { position: fixed; inset: 0; z-index: 72; display: flex; align-items: flex-end; justify-content: center; }
.shelf[hidden] { display: none; }
.shelf-dim { position: absolute; inset: 0; background: rgba(23, 31, 40, .44); animation: sheetFade .2s ease; }
.shelf-card {
  position: relative; width: 100%; max-width: 540px;
  background: var(--card); border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 34px rgba(23, 31, 40, .20);
  max-height: 86vh; display: flex; flex-direction: column;
  animation: sheetUp .26s cubic-bezier(.22, .8, .3, 1);
}
.shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; }
.shelf-title { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.shelf-search {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; flex: none;
  background: var(--fill); border-radius: 14px; padding: 0 12px; min-height: 44px;
}
.shelf-search span { font-size: 14px; line-height: 1; }
.shelf-search input {
  flex: 1; min-width: 0; border: 0; background: transparent; font: inherit;
  font-size: 14px; color: var(--text); padding: 10px 0; outline: none;
  -webkit-appearance: none; appearance: none;
}
.shelf-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.shelf-cats {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: 10px -2px 0; padding: 2px; flex: none;
}
.shelf-cats::-webkit-scrollbar { display: none; }
.shelf-cat {
  flex: 0 0 auto; border: 0; background: var(--fill); color: var(--text-sub);
  font: inherit; font-size: 12.5px; font-weight: 700; border-radius: 999px;
  padding: 8px 12px; min-height: 36px; cursor: pointer; white-space: nowrap;
  transition: background .16s, color .16s;
}
.shelf-cat.is-on { background: var(--blue); color: #fff; }
.shelf-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex: none; }
.shelf-count { font-size: 12px; font-weight: 700; color: var(--text-ter); letter-spacing: -0.01em; }
.shelf-total { font-size: 11.5px; color: var(--text-ter); }
.shelf-total b { color: var(--text-sub); font-weight: 700; }
.shelf-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
  margin-top: 8px; padding-bottom: 4px; flex: 1 1 auto; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.story-book {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  border: 1px solid var(--line-soft); background: var(--card); border-radius: 16px;
  padding: 10px 11px; min-height: 86px; font: inherit; text-align: left;
  cursor: pointer; transition: border-color .16s, background .16s;
}
.story-book.is-on { border-color: var(--blue); background: var(--blue-tint); }
.sb-cover { font-size: 24px; line-height: 1; }
.sb-title {
  font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: -0.02em;
  line-height: 1.32; word-break: keep-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.story-book.is-on .sb-title { color: var(--blue-dark); }
.sb-meta { font-size: 11px; font-weight: 600; color: var(--text-ter); }
.shelf-empty { padding: 26px 0; text-align: center; font-size: 13px; color: var(--text-ter); }
.shelf-empty[hidden] { display: none; }
.shelf-note { margin-top: 10px; font-size: 11.5px; color: var(--text-ter); line-height: 1.5; flex: none; }

/* 내 단어장 */
.vocab-count {
  font-size: 12px; font-weight: 700; color: var(--blue-dark);
  background: var(--blue-tint); border-radius: 8px; padding: 4px 8px; flex: none;
}
.vocab-card .card-desc { margin-bottom: 0; }
.vocab-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.vocab-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--fill); border-radius: 14px; padding: 10px 12px;
  min-width: 0;
}
.vocab-word { font-size: 14px; font-weight: 700; color: var(--text); flex: none; }
.vocab-ko {
  font-size: 13px; color: var(--text-sub); flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vocab-btn {
  flex: none; width: 34px; height: 34px; border: 0; border-radius: 10px;
  background: var(--card); color: var(--text-sub); font-size: 13px;
  cursor: pointer; box-shadow: var(--shadow-card);
}
.quiz { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.quiz[hidden] { display: none; }
.quiz-q { font-size: 14.5px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.quiz-q b { color: var(--blue-dark); }
.quiz-opts { display: grid; gap: 6px; margin-top: 10px; }
.quiz-opt {
  text-align: left; border: 1px solid var(--line); background: var(--card);
  color: var(--text-strong); font: inherit; font-size: 13.5px; font-weight: 600;
  border-radius: 13px; padding: 12px 14px; min-height: 46px; cursor: pointer;
  transition: border-color .16s, background .16s, color .16s;
  word-break: keep-all;
}
.quiz-opt:hover { background: var(--fill); }
.quiz-opt.is-right { border-color: var(--green-text); background: var(--green-tint); color: var(--green-text); }
.quiz-opt.is-wrong { border-color: var(--red); background: var(--red-tint); color: var(--red); }
.quiz-note { margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-sub); line-height: 1.5; }
.quiz-new { width: 100%; margin-top: 10px; }

/* 단어 카드 (바텀시트) */
.word-sheet { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.word-sheet[hidden] { display: none; }
.word-sheet-dim { position: absolute; inset: 0; background: rgba(23, 31, 40, .44); animation: sheetFade .2s ease; }
@keyframes sheetFade { from { opacity: 0; } to { opacity: 1; } }
.word-sheet-card {
  position: relative; width: 100%; max-width: 540px;
  background: var(--card); border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 34px rgba(23, 31, 40, .20);
  max-height: 88vh; overflow-y: auto;
  animation: sheetUp .26s cubic-bezier(.22, .8, .3, 1);
}
@keyframes sheetUp { from { transform: translateY(18px); opacity: .6; } to { transform: none; opacity: 1; } }
.word-sheet-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
.word-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.word-sheet-word {
  font-size: 24px; font-weight: 800; color: var(--text);
  letter-spacing: -0.02em; line-height: 1.25; word-break: break-word;
}
.word-sheet-close {
  flex: none; border: 0; background: var(--fill); color: var(--text-sub);
  font: inherit; font-size: 12.5px; font-weight: 700; border-radius: 10px;
  padding: 7px 11px; min-height: 34px; cursor: pointer;
}
.word-sheet-phon { margin-top: 6px; font-size: 14px; color: var(--text-ter); letter-spacing: 0.01em; }
.word-sheet-ko { margin-top: 10px; font-size: 17px; font-weight: 700; color: var(--blue-dark); line-height: 1.45; word-break: keep-all; }
.word-sheet-pos { margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-ter); }
.word-sheet-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.word-sheet-note { margin-top: 12px; font-size: 12.5px; color: var(--text-ter); line-height: 1.5; }
body.sheet-open { overflow: hidden; }

@media (min-width: 620px) {
  .story-art { height: 176px; }
  .story-art .art-main { font-size: 84px; }
  .story-art.is-photo .art-img { max-height: min(44vh, 360px); }
  .story-word { padding: 1px 2px; }
}
@media (min-width: 620px) {
  .shelf { align-items: center; padding: 24px; }
  .shelf-card { border-radius: 24px; max-width: 560px; }
  .shelf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .word-sheet { align-items: center; padding: 24px; }
  .word-sheet-card { border-radius: 24px; max-width: 440px; padding-bottom: 24px; }
}
@media (min-width: 960px) {
  #page-7 .story-card, #page-7 .vocab-card { max-width: 720px; }
}
@media (max-width: 359px) {
  .story-card { padding: 16px 14px 14px; }
  .story-text { padding: 2px 12px 16px; }
  .story-art { height: 132px; }
  .story-art .art-main { font-size: 60px; }
  .story-actions { gap: 5px; }
  .sbtn { font-size: 12px; min-height: 44px; }
  .story-lang button { font-size: 12.5px; }
}

@media (max-width: 359px) {
  .shelf-card { padding: 10px 14px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .shelf-grid { grid-template-columns: 1fr; }
  .story-book { flex-direction: row; align-items: center; gap: 8px; min-height: 0; }
  .sb-title { -webkit-line-clamp: 1; flex: 1; }
  .bb-open { padding: 6px 8px; }
}
