:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6b6560;
  --line: #e7e2db;
  --accent: #e0562b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe6de;
  --radius: 16px;
  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

main, .hero, .footer { max-width: 960px; margin: 0 auto; padding: 0 16px; }

.hero { padding-top: 56px; padding-bottom: 24px; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: .2em; color: var(--accent); font-weight: 700; }
.hero h1 { margin: 8px 0 12px; font-size: clamp(28px, 6vw, 44px); line-height: 1.25; }
/* 管理画面の textarea で入れた改行をそのまま反映する */
.lead { margin: 0; color: var(--muted); max-width: 40em; white-space: pre-line; }

.stats {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin: 8px 0 40px;
}
.stats-label { margin: 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.stats-total {
  margin: 4px 0 16px;
  font-size: clamp(36px, 10vw, 60px);
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.progress-bar { height: 10px; background: var(--accent-soft); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .8s ease; }
.progress-text { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.stats-backers { margin: 12px 0 0; font-size: 15px; }
.stats-backers strong { font-size: 20px; font-variant-numeric: tabular-nums; }

.notice {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 12px 16px;
  margin: -24px 0 32px;
  font-size: 14px;
}

.section-title { font-size: 20px; margin: 0 0 16px; }

.rewards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 600px) {
  .rewards { gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
.reward {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.reward:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.06); border-color: var(--accent); }
.reward:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.reward-image { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: var(--line); }
.reward-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.reward-price { margin: 0; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.reward-name { margin: 2px 0 6px; font-size: 16px; }
.reward-desc { margin: 0 0 12px; font-size: 14px; color: var(--muted); white-space: pre-line; }
.reward-cta { margin-top: auto; font-size: 14px; font-weight: 700; color: var(--accent); }
.reward-skeleton { height: 280px; border-radius: var(--radius); background: linear-gradient(90deg, var(--line), #f1ede8, var(--line)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
/* スマホは 2 列なのでカード内を詰める */
@media (max-width: 599px) {
  .reward-body { padding: 12px 12px 14px; }
  .reward-price { font-size: clamp(15px, 5vw, 19px); }
  .reward-name { font-size: 14px; line-height: 1.5; }
  .reward-desc { font-size: 12px; margin-bottom: 10px; }
  .reward-cta { font-size: 12px; }
  .reward-cta-prefix { display: none; }
  .reward-skeleton { height: 220px; }
}
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { color: var(--muted); }

.footer { padding-top: 48px; padding-bottom: 40px; font-size: 12px; color: var(--muted); }

.cta {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  padding: 14px 20px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.cta:disabled { opacity: .6; cursor: default; }

/* 数量選択シート: スマホは下から、PC は中央 */
.sheet {
  border: 0;
  padding: 0;
  width: 100%;
  max-width: 480px;
  max-height: 92dvh;
  border-radius: 20px 20px 0 0;
  margin: auto auto 0;
  background: var(--surface);
  color: var(--text);
}
.sheet::backdrop { background: rgba(20, 16, 12, .5); }
.sheet[open] { animation: slide-up .2s ease-out; }
@keyframes slide-up { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 640px) {
  .sheet { border-radius: 20px; margin: auto; }
}
.sheet-inner { position: relative; padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--bg); font-size: 20px; cursor: pointer; color: var(--text); }
.sheet-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; margin-bottom: 12px; }
.sheet h3 { margin: 0 44px 4px 0; font-size: 18px; }
.sheet-desc { margin: 0 0 8px; font-size: 14px; color: var(--muted); white-space: pre-line; }
.sheet-price { margin: 0 0 16px; font-size: 22px; font-weight: 800; }
.sheet-price small { font-size: 13px; font-weight: 400; color: var(--muted); }

.qty { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 8px 0 16px; }
.qty-btn { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 22px; cursor: pointer; color: var(--text); }
.qty-btn:disabled { opacity: .35; cursor: default; }
.qty-value { min-width: 2ch; text-align: center; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sheet-subtotal { text-align: center; margin: 0 0 16px; color: var(--muted); }
.sheet-subtotal strong { color: var(--text); font-size: 20px; }
.sheet-error { color: #b42318; font-size: 14px; margin: 12px 0 0; text-align: center; }

.thanks { text-align: center; padding-top: 96px; max-width: 480px; }
.thanks-mark { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 32px; line-height: 64px; }
.thanks h1 { font-size: 24px; }
.thanks p { color: var(--muted); margin-bottom: 32px; }

.reward-desc, .sheet-desc, .reward-name, .sheet h3 { overflow-wrap: anywhere; }
.reward-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* CMS で編集するメイン画像と本文 */
.hero-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); margin-bottom: 24px; background: var(--line); }
.project-body-section { margin: 0 0 48px; }
.prose { font-size: 16px; line-height: 1.9; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 22px; margin: 40px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--accent-soft); }
.prose h3 { font-size: 18px; margin: 28px 0 8px; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 0 0 16px; }
.prose img { display: block; max-width: 100%; height: auto; border-radius: 12px; margin: 8px 0; }
.prose a { color: var(--accent); }
.prose blockquote { border-left: 4px solid var(--line); padding-left: 16px; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.prose .video-embed { margin: 8px auto 20px; }
.prose .video-embed iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 12px; background: #000; }
.prose .video-embed.is-horizontal { aspect-ratio: 16 / 9; }
.prose .video-embed.is-vertical { width: min(100%, 340px); aspect-ratio: 9 / 16; }
/* Instagram はプレーヤーの上下にアカウント名・キャプションが付くので縦に余白を足す */
.prose .video-embed.is-instagram { aspect-ratio: auto; height: 640px; }
.prose .video-embed.is-instagram iframe { background: #fff; border: 1px solid var(--line); }

/* スマホ: リターン一覧が見えていない間だけ下部に出す */
.sticky-cta {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 10; display: block; padding: 14px 20px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; text-align: center; text-decoration: none;
  box-shadow: 0 8px 24px rgba(224, 86, 43, .35);
  transition: opacity .2s ease, transform .2s ease;
}
.sticky-cta.is-hidden { opacity: 0; transform: translateY(12px); pointer-events: none; }
@media (min-width: 720px) { .sticky-cta { display: none; } }
.footer { padding-bottom: 96px; }
html { scroll-behavior: smooth; }

/* 応援メッセージのタイムライン */
.messages-section { margin: 56px 0 0; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 19px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline-item { position: relative; display: flex; gap: 14px; padding: 0 0 20px; }
.timeline-avatar {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
  font-weight: 800; border: 3px solid var(--bg);
}
.timeline-body { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 4px var(--radius) var(--radius) var(--radius); padding: 12px 16px; }
.timeline-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0; }
.timeline-head strong { overflow-wrap: anywhere; }
.timeline-head time { flex: none; font-size: 12px; color: var(--muted); }
.timeline-reward { margin: 2px 0 0; font-size: 12px; color: var(--accent); font-weight: 700; }
.timeline-comment { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.timeline-empty { color: var(--muted); font-size: 14px; }
.more-btn { display: block; margin: 0 auto; padding: 10px 24px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-weight: 700; color: var(--text); cursor: pointer; }

/* 完了ページの応援メッセージ */
.thanks .cta { margin-bottom: 12px; }
.cta-outline { background: var(--surface); color: var(--accent); border: 2px solid var(--accent); }
.message-sent { color: var(--accent) !important; font-weight: 700; margin: 0 0 16px !important; }
.message-form { text-align: left; }
.message-emoji { font-size: 32px; margin: 0; text-align: center; }
.message-title { margin: 4px 0 4px; font-size: 20px; text-align: center; }
.message-lead { margin: 0 0 20px; font-size: 13px; color: var(--muted); text-align: center; }
.message-field { display: grid; gap: 6px; margin-bottom: 16px; font-size: 13px; font-weight: 700; }
.message-field small { font-weight: 400; color: var(--muted); }
.message-field input, .message-field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font: inherit; font-size: 16px; font-weight: 400; color: var(--text);
}
.message-field textarea { resize: vertical; line-height: 1.7; }
.message-field input:focus, .message-field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.message-count { justify-self: end; }
.message-skip { display: block; width: 100%; margin-top: 8px; padding: 12px; border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; }

/* 特定商取引法に基づく表記 */
.footer a { color: var(--muted); }
.footer-center { text-align: center; padding-bottom: 40px; }
.legal-header { max-width: 800px; margin: 0 auto; padding: 20px 16px 0; }
.legal-back { color: var(--muted); text-decoration: none; font-size: 14px; }
.legal { max-width: 800px; margin: 0 auto; padding: 16px 16px 0; }
.legal h1 { font-size: clamp(22px, 5vw, 28px); margin: 8px 0 24px; }
.legal-list { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.legal-row { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 16px 18px; }
.legal-row + .legal-row { border-top: 1px solid var(--line); }
.legal-row dt { font-size: 13px; font-weight: 700; color: var(--muted); }
.legal-row dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 640px) {
  .legal-row { grid-template-columns: 200px 1fr; gap: 16px; }
}

/* コンビニ払い (入金待ち) の案内 */
.konbini-note { text-align: left; background: #fff4e5; border-radius: var(--radius); padding: 16px; margin: 0 0 20px; }
.konbini-note p { color: #7a4a00 !important; margin: 0 0 12px !important; font-size: 14px; }
.konbini-note .cta { margin: 0; }

/* 利用規約・プライバシーポリシー */
.legal-doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; font-size: 15px; }
.legal-doc h2 { font-size: 17px; margin: 32px 0 10px; }
.legal-doc ol, .legal-doc ul { padding-left: 1.4em; }
.legal-doc li + li { margin-top: 4px; }
.legal-footer { text-align: center; padding-bottom: 40px; }
.sheet-consent { margin: 12px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.sheet-consent a { color: var(--muted); }
@media (min-width: 640px) { .legal-doc { padding: 32px; } }

/* テストモードの帯 */
.test-banner { position: sticky; top: 0; z-index: 20; padding: 6px 16px; background: #fff4e5; color: #9a5b00; font-size: 12px; font-weight: 700; text-align: center; border-bottom: 1px solid #f5d9a8; }

/* 特商法ページ: 小さめ表示 (読める下限の 10px を維持) */
.legal--tiny h1 { font-size: 14px; margin: 4px 0 12px; }
.legal--tiny .legal-row { padding: 8px 12px; gap: 2px; }
.legal--tiny .legal-row dt,
.legal--tiny .legal-row dd { font-size: 10px; line-height: 1.5; }
@media (min-width: 640px) { .legal--tiny .legal-row { grid-template-columns: 140px 1fr; gap: 8px; } }
