:root {
  --ink: #1f2328;
  --paper: #ffffff;
  --bg: #f5f4f1;
  --line: #e3e1dc;
  --mute: #6b6f76;
  --soft: #f3f2ef;
  --accent: #e5484d;       /* 母：カーネーションの赤 */
  --accent-soft: #fdecec;
  --ok: #1f9d61;
  --ok-soft: #e6f6ee;
  --line-green: #06c755;
  --danger: #c62828;
}
body[data-to="father"] { --accent: #2f6fde; --accent-soft: #e8f0fd; }
body[data-to="both"] { --accent: #d9730d; --accent-soft: #fdf0e1; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
body.modal-open { overflow: hidden; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
[hidden] { display: none !important; }

/* 上部バー */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .04em;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
}
.topbar-link {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(110px + env(safe-area-inset-bottom));
  display: grid;
  gap: 16px;
}
.loading { padding: 60px 0; text-align: center; color: var(--mute); }

.card, .project, .intro {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}
.card { display: grid; gap: 14px; }
.card h2, .modal-sheet h2 { font-size: 17px; line-height: 1.4; }
.card h2 small { margin-left: 6px; color: var(--mute); font-size: 13px; font-weight: 500; }
.muted { color: var(--mute); font-size: 13px; }
.hint { color: var(--mute); font-size: 12px; line-height: 1.6; }
.footnote { padding: 0 4px; color: var(--mute); font-size: 12px; line-height: 1.6; }

/* ホーム */
.intro { display: grid; gap: 12px; }
.intro h1 { font-size: 24px; line-height: 1.4; letter-spacing: .01em; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.steps { display: grid; gap: 8px; margin-top: 4px; font-size: 14px; }
.steps li { display: flex; align-items: center; gap: 10px; }
.steps b {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
}
.recent { display: grid; gap: 4px; }
.recent a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

/* フォーム */
form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-label { font-size: 13px; font-weight: 700; }
input, textarea, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #cfccc5;
  border-radius: 10px;
  background: var(--paper);
  font-size: 16px;
}
textarea { min-height: 0; line-height: 1.6; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 2px 20px; scrollbar-width: none; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ボタン */
.btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}
.btn--primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn--line { border-color: var(--line-green); background: var(--line-green); color: #fff; }
.btn:active { filter: brightness(.95); }
.link {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link--danger { color: var(--mute); }

/* プロジェクト */
.project { display: grid; gap: 14px; padding: 0 20px 20px; overflow: hidden; }
.hero {
  position: relative;
  display: grid;
  place-items: center;
  height: 190px;
  margin: 0 -20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .7), transparent 45%),
    linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent) 28%, #fff));
}
.hero-icon { font-size: 92px; line-height: 1; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .12)); }
.tag {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}
.ribbon {
  position: absolute;
  top: 22px;
  right: -44px;
  width: 170px;
  padding: 4px 0;
  background: var(--ok);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  text-align: center;
  transform: rotate(35deg);
}
.project h1 { font-size: 22px; line-height: 1.4; overflow-wrap: anywhere; }
.byline { color: var(--mute); font-size: 12px; }

.stats { display: grid; gap: 10px; }
.stats-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.stats-total span { color: var(--mute); font-size: 13px; }
.stats-total strong { font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bar { height: 12px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; min-width: 4px; border-radius: 999px; background: var(--accent); transition: width .6s ease; }
.bar--done i { background: var(--ok); }
.stats-row { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 8px; }
.stats-row dt { color: var(--mute); font-size: 11px; }
.stats-row dd { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats-row small { margin-left: 1px; font-size: 12px; font-weight: 700; }

.nudge {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 14px;
  line-height: 1.7;
}
.nudge--ok { background: var(--ok-soft); }
.story { font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* 写真 */
.photo { display: block; width: 100%; padding: 0; border: 0; background: none; }
.photo img { display: block; width: 100%; border-radius: 12px; }
.hero--photo { display: block; height: auto; }
.hero--photo .photo img { aspect-ratio: 4 / 3; object-fit: cover; border-radius: 0; }
.photo-pick {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 84px;
  padding: 10px;
  border: 1.5px dashed #cfccc5;
  border-radius: 12px;
  background: var(--soft);
  color: var(--mute);
  font-size: 13px;
  font-weight: 700;
}
.photo-pick img { display: block; max-width: 100%; max-height: 220px; border-radius: 8px; }
.zoom { display: block; width: 100%; max-height: 80dvh; margin-top: 28px; border-radius: 12px; object-fit: contain; }
.reports .photo { margin: 6px 0; }
.reports .link { justify-self: start; }
.delivered { border-color: var(--ok); }
.delivered .eyebrow { color: var(--ok); }
.delivered .reports li { padding-left: 0; border-left: 0; }

/* ネクストゴール */
.next { display: grid; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--line); }
.next-head { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.next-head span { padding: 1px 8px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .08em; white-space: nowrap; }
.next-head b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.next-head em { font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }
.next .bar { height: 8px; }
.stats-row dd.soon { color: var(--accent); }

/* 寄贈プレート（真ちゅうの銘板ふう） */
.plate {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 16px 28px;
  border: 1px solid #8a6a1c;
  border-radius: 6px;
  background: linear-gradient(135deg, #f1dc9a, #c9a348 45%, #ecd68f 70%, #b48a2c);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25), 0 2px 6px rgba(0, 0, 0, .15);
  color: #3a2a05;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  text-align: center;
  line-height: 1.5;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.plate::before, .plate::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3c4, #7a5c14);
}
.plate::before { left: 9px; }
.plate::after { right: 9px; }
.plate span { font-size: 12px; letter-spacing: .3em; }
.plate b { font-size: 19px; overflow-wrap: anywhere; }
.plate em { font-size: 14px; font-style: normal; overflow-wrap: anywhere; }
.plate small { font-size: 11px; }

/* お披露目ページの枠の一覧 */
.tiers { display: grid; }
.tiers li { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.tiers b { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.tiers small { color: var(--mute); font-size: 11px; font-weight: 500; }
.tiers span { color: var(--mute); }
.tiers em { color: var(--accent); font-size: 12px; font-style: normal; font-weight: 700; }
.showcase { padding: 12px; border-radius: 12px; background: var(--accent-soft); }
.backer-message, .backer-thanks { font-size: 14px; overflow-wrap: anywhere; }
.backer-message i, .backer-thanks i {
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--soft);
  color: var(--mute);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}
.backer-thanks { padding: 8px 10px; border-radius: 10px; background: var(--ok-soft); }
.backer-thanks i { background: var(--ok); color: #fff; }

/* お披露目ページ（親に見せるページ） */
.preview-note { padding: 10px 14px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 12px; line-height: 1.6; }
.preview-note a { color: #fff; font-weight: 700; margin-left: 4px; }
.oya { text-align: center; }
.oya .hero--photo { margin: 0 -20px; }
.oya-photo { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.oya-to { color: var(--accent); font-size: 15px; font-weight: 800; letter-spacing: .08em; }
.oya-from { color: var(--mute); font-size: 14px; }
.oya-item h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.oya-message { font-size: 16px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.oya-item--top { border: 2px solid #d9b040; }
.oya-item--top h2 { font-size: 21px; }
.oya-item--top .oya-message { font-size: 18px; }

/* 印刷用カード */
.print-sheet { display: grid; gap: 28px; justify-items: center; padding: 24px 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.gift-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 90mm;
  max-width: 100%;
  padding: 8mm 6mm;
  border: 1px dashed #999;
  text-align: center;
}
.gift-card h1 { font-size: 18px; line-height: 1.5; overflow-wrap: anywhere; }
.gift-card p { font-size: 12px; line-height: 1.6; }
.qr { width: 42mm; height: 42mm; }
.print-sheet .plate { width: 90mm; max-width: 100%; }

@media print {
  body, html { background: #fff; }
  .topbar, .no-print, .toast, .cta-bar, .modal { display: none !important; }
  .page { max-width: none; padding: 0; }
  .print-sheet { border: 0; padding: 10mm 0; }
}

/* リターン */
.rewards { display: grid; gap: 10px; }
.reward {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  text-align: left;
}
.reward:hover { border-color: var(--accent); }
.reward-amount { font-size: 22px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.reward-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; }
.reward-name em {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
}
.reward-text { color: var(--mute); font-size: 13px; line-height: 1.6; }
.reward-text i { margin-right: 6px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; font-style: normal; }

/* 支援者 */
.backers { display: grid; }
.backer { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.backer:first-child { padding-top: 0; border-top: 0; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--soft);
  font-weight: 800;
}
.backer--mine .avatar { background: var(--accent-soft); color: var(--accent); }
.backer-body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.backer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; overflow-wrap: anywhere; }
.backer-amount { display: flex; align-items: baseline; gap: 10px; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.backer-amount .muted { font-size: 11px; font-weight: 400; }
.backer-comment { font-size: 14px; overflow-wrap: anywhere; }
.backer-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--mute);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge--top { background: #fff4d6; color: #8a5a00; }
.badge--cheer { background: var(--ink); color: #fff; }
.badge--paid { background: var(--ok-soft); color: var(--ok); }

.reports { display: grid; gap: 12px; }
.reports li { padding-left: 12px; border-left: 3px solid var(--accent-soft); }
.reports time { color: var(--mute); font-size: 11px; }
.reports p { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

.owner { border-color: var(--accent); }
.owner p { font-size: 14px; }
.owner-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.empty { text-align: center; }
.empty h1 { font-size: 19px; }

/* 下部の支援バー */
.cta-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.cta-bar > div { display: grid; flex: none; line-height: 1.3; }
.cta-bar b { font-size: 20px; font-variant-numeric: tabular-nums; }
.cta-bar span { color: var(--mute); font-size: 11px; white-space: nowrap; }
.cta-bar .btn { max-width: 380px; }

/* モーダル */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background: rgba(0, 0, 0, .5);
}
.modal-sheet {
  position: relative;
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--paper);
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  font-size: 18px;
  line-height: 1;
}
.thanks { display: grid; gap: 12px; text-align: center; }
.thanks-icon { font-size: 56px; line-height: 1.2; }
.thanks p { font-size: 14px; }

@media (min-width: 600px) {
  .modal { align-items: center; padding: 20px; }
  .modal-sheet { border-radius: 20px; }
}

/* 達成時の紙吹雪 */
.confetti { position: fixed; inset: 0; z-index: 20; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(105vh) rotate(720deg); }
}
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  .bar i { transition: none; }
}

/* トースト */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
