:root {
  --bg: #f7efe6;
  --surface: #fffaf4;
  --ink: #3b2f28;
  --ink-soft: #7a6a5f;
  --line: #e6d8c9;
  --accent: #d9774b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3d4;
  --sub: #6b9a8b;
  --sub-soft: #dcebe5;
  --danger: #c2453a;
  --shadow: 0 6px 24px rgba(91, 60, 35, 0.08);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #211b17;
    --surface: #2c2520;
    --ink: #f3e9df;
    --ink-soft: #bba99a;
    --line: #463a31;
    --accent: #ee8d5f;
    --accent-ink: #231812;
    --accent-soft: #4a3023;
    --sub: #86bba9;
    --sub-soft: #29403a;
    --danger: #f08378;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }

.site-header {
  padding: 14px 16px;
  max-width: 560px; width: 100%; margin: 0 auto;
}
.logo {
  position: relative; display: inline-block; padding-bottom: 4px;
  color: var(--ink); text-decoration: none; font-size: 19px; font-weight: 800; letter-spacing: .08em; line-height: 1.4;
  animation: logoIn .7s cubic-bezier(.2, .7, .2, 1) .05s both;
}
/* オレンジの線：左から引かれるように出る */
.logo::after {
  /* 最後の字のあとの字間ぶん（.08em）を引いて、線を文字の幅にそろえる */
  content: ""; position: absolute; left: 0; right: .08em; bottom: 0; height: 3px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, transparent));
  transform-origin: left center;
  animation: drawLine .9s cubic-bezier(.65, 0, .35, 1) .45s both;
}
@keyframes logoIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes drawLine { from { transform: scaleX(0); } to { transform: scaleX(1); } }
main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px 32px; }
.site-footer {
  text-align: center; font-size: 12px; color: var(--ink-soft);
  padding: 16px; border-top: 1px solid var(--line);
}
.site-footer p { margin: 0; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 24px;
  border-radius: 999px; border: 2px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .1s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible, .chip input:focus-visible + span, .unit-switch button:focus-visible {
  outline: 3px solid var(--sub); outline-offset: 2px;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 rgba(0,0,0,.08); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-large { min-height: 56px; font-size: 18px; padding: 14px 32px; }
.btn-block { display: flex; width: 100%; margin-top: 12px; }

/* ---------- トップ ---------- */
.hero { text-align: center; padding: 24px 0 16px; }
/* イラストの切り替え（フェードで重ねて入れ替える） */
.hero-slides {
  position: relative; width: min(78vw, 300px); aspect-ratio: 1 / 1; margin: -4px auto 8px;
  /* 画像の四角い縁を背景になじませる */
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 72%, transparent 100%);
}
.hero-slide {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.04);
  /* 消えるほう：先にすっと消える */
  transition: opacity .55s ease-in, transform 2.4s ease-out;
  will-change: opacity, transform;
}
/* 現れるほう：前の絵がほぼ消えてから、ふわっと出る */
.hero-slide.is-active { opacity: 1; transform: scale(1); transition: opacity .8s ease-out .4s, transform 2.4s ease-out .4s; }
.hero-title { font-size: 22px; line-height: 1.6; margin: 0 0 16px; letter-spacing: .02em; }
.hero-lead { color: var(--ink-soft); font-size: 15px; margin: 0 0 28px; word-break: keep-all; overflow-wrap: anywhere; }
.note { font-size: 13px; color: var(--ink-soft); margin-top: 14px; }

/* ---------- 入力 ---------- */
.page-title { font-size: 20px; margin: 8px 0 16px; }
.q {
  border: 0; margin: 0 0 16px; padding: 18px 16px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 0;
}
.q legend {
  float: left; width: 100%; padding: 0; margin-bottom: 12px;
  font-weight: 700; display: flex; align-items: center; gap: 10px;
}
.q legend + * { clear: both; }
.q-num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}
.chips { display: grid; gap: 8px; }
.chips-4 { grid-template-columns: repeat(4, 1fr); }
.chips-3 { grid-template-columns: repeat(3, 1fr); }
.chip { position: relative; display: block; }
.chip-wide { grid-column: 1 / -1; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 46px; padding: 6px 4px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--bg);
  font-size: 15px; font-weight: 700; line-height: 1.3; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.chip input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

.age-row, .custom-row { display: flex; align-items: center; gap: 8px; }
.custom-row { margin-top: 10px; flex-wrap: wrap; }
input[type=number], select {
  font: inherit; font-size: 18px; color: var(--ink);
  background: var(--bg); border: 2px solid var(--line); border-radius: 12px;
  min-height: 48px; padding: 6px 12px;
}
.custom-row input[type=number] { width: 88px; }
input[type=number]:focus, select:focus { outline: none; border-color: var(--accent); }
.unit { font-weight: 700; }
.error { color: var(--danger); font-size: 14px; margin: 8px 0 0; font-weight: 700; }

/* ---------- 結果 ---------- */
.result-context { text-align: center; color: var(--ink-soft); margin: 4px 0 12px; font-size: 15px; }
.result-context strong { color: var(--ink); }
.result-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 16px; text-align: center; margin-bottom: 20px;
  border-top: 6px solid var(--accent);
}
.result-heading { font-size: 18px; margin: 0 0 8px; line-height: 1.5; }
.result-total {
  margin: 4px 0 16px; font-size: 40px; font-weight: 800; color: var(--accent);
  line-height: 1.3; word-break: break-all; font-variant-numeric: tabular-nums;
}
.result-total .small { font-size: 18px; color: var(--ink); font-weight: 700; }
.unit-switch {
  display: inline-flex; background: var(--bg); border-radius: 999px; padding: 4px; gap: 4px;
  border: 1px solid var(--line);
}
.unit-switch button {
  font: inherit; font-weight: 700; border: 0; background: transparent; color: var(--ink-soft);
  min-height: 40px; min-width: 64px; border-radius: 999px; cursor: pointer;
}
.unit-switch button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
.result-formula { color: var(--ink-soft); font-size: 14px; margin: 14px 0 0; }

.compare-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 16px; margin-bottom: 8px;
}
.compare-title { font-size: 18px; margin: 0 0 4px; }
.compare-lead { color: var(--ink-soft); font-size: 14px; margin: 0 0 16px; }
.compare-block { margin-bottom: 16px; }
.compare-sub { font-size: 15px; margin: 0 0 8px; }

.compare-result {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 14px; padding: 14px 10px; text-align: center;
}
.cmp-label { margin: 0; font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.cmp-value { margin: 2px 0; font-size: 20px; font-weight: 800; line-height: 1.3; word-break: break-all; font-variant-numeric: tabular-nums; }
.cmp-new .cmp-value { color: var(--accent); }
.cmp-sub { margin: 0; font-size: 12px; color: var(--ink-soft); line-height: 1.4; }
.cmp-arrow { color: var(--ink-soft); font-size: 18px; }

.bars { margin: 14px 0 4px; display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.bar-track { background: var(--bg); border-radius: 999px; height: 14px; overflow: hidden; }
.bar { height: 100%; border-radius: 999px; transition: width .35s ease; }
.bar-base { background: var(--sub); }
.bar-new { background: var(--accent); }

.cmp-diff { text-align: center; font-weight: 800; font-size: 17px; margin: 12px 0 0; min-height: 1.7em; }
.cmp-diff.up { color: var(--accent); }
.cmp-diff.down { color: var(--sub); }

.share-btn { margin-top: 8px; text-decoration: underline; text-underline-offset: 3px; }
.share-note { margin: 6px 0 0; text-align: center; font-size: 12px; color: var(--ink-soft); }
.section-title {
  font-size: 16px; margin: 24px 0 10px; padding-left: 10px;
  border-left: 4px solid var(--accent); line-height: 1.4;
}
.section-title:first-child { margin-top: 0; }
.optional {
  margin-left: 4px; font-size: 12px; font-weight: 700; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 8px;
}

/* ---------- 平均余命をもとにした目安 ---------- */
.span-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 16px 18px; margin-bottom: 20px; border-top: 6px solid var(--sub);
}
.span-card .result-heading { text-align: center; }
.span-list { margin: 12px 0 0; }
.span-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.span-row dt { color: var(--ink-soft); font-size: 15px; }
.span-row dd { margin: 0; font-size: 24px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.span-total-label { margin: 16px 0 2px; text-align: center; font-weight: 700; }
.span-total {
  margin: 0; text-align: center; font-size: 26px; font-weight: 800; color: var(--accent);
  font-variant-numeric: tabular-nums; line-height: 1.4;
}
.span-total .u { font-size: 15px; color: var(--ink); margin: 0 2px; }
.span-formula { margin: 6px 0 0; text-align: center; font-size: 13px; color: var(--ink-soft); }
.span-cat { border: 0; margin: 16px 0 0; padding: 0; min-width: 0; }
.span-cat legend { font-size: 14px; font-weight: 700; padding: 0; margin-bottom: 8px; }
.span-cat-note { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); }
.span-note, .span-source { margin: 12px 0 0; font-size: 12px; color: var(--ink-soft); line-height: 1.6; }
.span-source { margin-top: 6px; }
.span-source a { color: var(--accent); }
.stat-block-first { border-top: 0; padding-top: 0; margin-top: 0; }
/* 息子・娘：卒業まで */
.milestone { border: 0; margin: 12px 0 0; padding: 0; min-width: 0; }
.milestone legend { padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 700; text-align: center; width: 100%; }
.milestone .chip span { font-size: 14px; min-height: 44px; }
.span-child-note {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--sub-soft);
  font-size: 13px; line-height: 1.6; font-weight: 700;
}
.after-title { font-size: 16px; margin: 0 0 4px; }
.after-lead { margin: 0 0 12px; font-size: 13px; color: var(--ink-soft); line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
.stages, .after-grad { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.stage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.stage-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.stage-name { font-size: 14px; font-weight: 700; }
.stage-name small { font-size: 12px; font-weight: 400; color: var(--ink-soft); margin-left: 2px; }
.stage-val { font-size: 15px; font-weight: 800; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stage-track { height: 10px; border-radius: 999px; background: var(--bg); overflow: hidden; }
@keyframes growBar { from { width: 0; } to { width: var(--w); } }
.stage-bar { height: 100%; width: var(--w); border-radius: 999px; background: linear-gradient(90deg, var(--sub), var(--accent)); animation: growBar 1s cubic-bezier(.2, .7, .2, 1) both; }
.stage:nth-child(2) .stage-bar { animation-delay: .12s; }
.stage:nth-child(3) .stage-bar { animation-delay: .24s; }
.stage:nth-child(4) .stage-bar { animation-delay: .36s; }
.after-grad .compare-sub { margin-top: 12px; }
.after-wait { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: 13px; color: var(--ink-soft); text-align: center; }
.after-wait:empty { display: none; }
.after-result { margin-top: 12px; animation: portraitIn .5s ease both; }
.after-total { margin: 0; text-align: center; font-size: 22px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.after-sum { margin: 8px 0 0; text-align: center; font-size: 13px; color: var(--ink-soft); }
.after-sum strong { color: var(--ink); font-size: 15px; white-space: nowrap; }

.span-basis-note { margin: 10px 0 0; font-size: 12px; color: var(--ink-soft); text-align: center; line-height: 1.6; }
.span-need-cat {
  border: 1.5px dashed var(--accent); border-radius: 16px; margin: 14px 0 4px; padding: 12px 14px; min-width: 0;
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent); animation: portraitIn .5s ease both;
}
.span-need-cat legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-size: 14px; font-weight: 800; line-height: 1.5; text-align: center; }
.span-need-cat legend + * { clear: both; }
.span-cond {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--bg); border-radius: 12px; padding: 6px 6px 6px 12px; margin-top: 12px;
}
.span-cond-text { margin: 0; font-size: 13px; font-weight: 700; }
.span-cond-btn { min-height: 40px; padding: 6px 12px; font-size: 13px; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.span-cond-panel { margin-top: 12px; }
.span-cond-panel .compare-sub { margin-top: 12px; }
.span-disclaimer { margin: 16px 0 0; font-size: 13px; line-height: 1.7; }
.closing-message {
  margin: 4px 8px 16px; text-align: center; font-size: 19px; font-weight: 800; line-height: 1.6;
  text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere;
}
.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;
}
.reveal { transition: opacity .45s ease, transform .45s ease; }
.reveal.is-waiting { opacity: 0; transform: translateY(8px); }


/* ---------- 統計 ---------- */
.stats-card { margin: 20px 0 0; }
.stats-panel {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 16px; margin-top: 12px;
}
.stats-lead {
  margin: 0 0 16px; padding: 10px 12px; border-radius: 12px;
  background: var(--sub-soft); font-size: 14px; line-height: 1.6;
}
.stats-hint { margin: 0 0 10px; font-size: 13px; color: var(--ink-soft); }
.stat-block { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.stat-title { font-size: 16px; margin: 0 0 6px; }
.stat-desc { font-size: 13px; color: var(--ink-soft); margin: 0 0 12px; line-height: 1.6; }
.stat-desc strong { color: var(--ink); }
.stat-figure { background: var(--bg); border-radius: 14px; padding: 12px 14px; }
.fig-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin: 0 0 6px; font-size: 14px;
}
.fig-label { color: var(--ink-soft); }
.fig-val { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fig-main { margin: 10px 0 0; text-align: center; font-size: 14px; line-height: 1.6; }
.fig-main strong { display: block; font-size: 26px; color: var(--accent); font-variant-numeric: tabular-nums; word-break: break-all; }
.fig-reached { margin: 10px 0 0; text-align: center; font-size: 14px; font-weight: 700; }
.fig-note { margin: 6px 0 0; text-align: center; font-size: 12px; color: var(--ink-soft); }
.stat-source { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 13px; }
.stat-source summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; gap: 6px; list-style: none; }
.stat-source summary::-webkit-details-marker { display: none; }
.stat-source summary::before { content: "▸"; color: var(--accent); transition: transform .15s; }
.stat-source[open] summary::before { transform: rotate(90deg); }
.stat-source dl { margin: 8px 0 0; }
.stat-source dt { font-weight: 700; margin-top: 10px; }
.stat-source dd { margin: 2px 0 0; color: var(--ink-soft); line-height: 1.6; overflow-wrap: anywhere; }
.stat-source ul { margin: 0; padding-left: 1.2em; }
.stat-source a { color: var(--accent); }

/* ---------- 次に会うとき ---------- */
.next-card { margin: 0 0 20px; }
.next-panel {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 16px; margin-top: 12px; scroll-margin-top: 12px;
}
.next-q { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.next-title { font-size: 18px; font-weight: 700; padding: 0; margin-bottom: 12px; line-height: 1.5; text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; }
.chips-2 { grid-template-columns: repeat(2, 1fr); }
.next-ideas { margin-bottom: 16px; }
.ideas { display: grid; gap: 8px; }
.idea {
  position: relative; display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.idea input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.idea-check {
  flex: none; width: 22px; height: 22px; margin-top: 2px; border-radius: 6px;
  border: 2px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
}
.idea-text { font-size: 15px; line-height: 1.5; }
.idea:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.idea input:checked ~ .idea-check { background: var(--accent); border-color: var(--accent); }
.idea input:checked ~ .idea-check::after { content: "✓"; color: var(--accent-ink); font-size: 14px; font-weight: 800; }
.idea input:focus-visible ~ .idea-check { outline: 3px solid var(--sub); outline-offset: 2px; }

.memo {
  border: 2px dashed var(--accent); border-radius: 14px; padding: 16px; background: var(--bg);
}
.memo-title { margin: 0 0 4px; font-size: 17px; }
.memo-meta { margin: 0 0 8px; font-size: 13px; color: var(--ink-soft); }
.memo-list { margin: 0; padding-left: 1.2em; }
.memo-list li { margin: 4px 0; line-height: 1.5; }
.memo-status { margin: 8px 0 0; text-align: center; font-size: 13px; color: var(--sub); font-weight: 700; }
.memo-status:empty { display: none; }

@media (min-width: 600px) {
  .hero-title { font-size: 28px; }
  .result-total { font-size: 52px; }
}
/* ---------- 入力画面 ---------- */
.view-input { position: relative; isolation: isolate; }
.page-bg { position: absolute; inset: -24px -16px auto; height: 460px; z-index: -1; overflow: hidden; pointer-events: none; }
.input-hero { text-align: center; padding: 4px 0 6px; }
.input-hero-img {
  /* 家族の絵：白枠なし。ふちを背景になじませて、ふわふわ浮かせる */
  width: min(94%, 380px); aspect-ratio: 4 / 3; margin: 0 auto 10px; overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse 72% 70% at 50% 48%, #000 62%, transparent 100%);
          mask-image: radial-gradient(ellipse 72% 70% at 50% 48%, #000 62%, transparent 100%);
}
.input-hero-img.enter { animation: fadeUp .8s cubic-bezier(.2, .7, .2, 1) .1s both, floaty 6s ease-in-out 1.2s infinite; }
.input-hero-img img { width: 100%; height: 100%; object-fit: cover; animation: slowZoom 14s ease-in-out infinite alternate; }
@keyframes slowZoom { from { transform: scale(1); } to { transform: scale(1.06); } }
.view-input .page-title { text-align: center; font-size: 21px; margin: 4px 0 4px; letter-spacing: .03em; }
.page-lead { margin: 0 0 8px; text-align: center; font-size: 13px; color: var(--ink-soft); word-break: keep-all; overflow-wrap: anywhere; }

/* 質問カード：入力中は縁が色づき、答えると番号がチェックに変わる */
.q { border: 1.5px solid transparent; transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease; }
.q:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 10px 28px rgba(217, 119, 75, .12); }
.q-num { position: relative; transition: background .3s ease; }
.q.is-answered .q-num { background: var(--sub); color: transparent; }
.q.is-answered .q-num::after {
  content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 800; animation: pop .3s ease;
}

/* 選択肢：選ぶと右上に小さなチェック */
.chip span { position: relative; }
.chip input:checked + span { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); box-shadow: 0 4px 12px rgba(217, 119, 75, .15); }
.chip input:checked + span::after {
  content: "✓"; position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12); animation: pop .3s ease;
}
.chip-tile span { flex-direction: column; gap: 2px; min-height: 66px; padding: 8px 2px; }
.chip-tile b { font-size: 18px; line-height: 1.2; }
.chip-tile small { font-size: 10.5px; font-weight: 700; color: var(--ink-soft); letter-spacing: -.02em; white-space: nowrap; }

/* 年齢：大きな数字と − ＋ ボタン */
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 10px; }
.step-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--bg);
  color: var(--accent); font: inherit; font-size: 24px; font-weight: 800; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; touch-action: manipulation;
  transition: transform .1s ease, background .2s ease, border-color .2s ease;
}
.step-btn:active { transform: scale(.92); background: var(--accent-soft); border-color: var(--accent); }
.step-btn:focus-visible { outline: 3px solid var(--sub); outline-offset: 2px; }
.step-field {
  display: flex; align-items: baseline; justify-content: center; gap: 4px;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 16px; padding: 6px 12px;
  transition: border-color .2s ease;
}
.step-field:focus-within { border-color: var(--accent); }
.step-field input[type=number] {
  width: 3.2ch; min-width: 0; border: 0; background: transparent; padding: 0; min-height: 44px;
  font-size: 30px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.step-field input::-webkit-outer-spin-button, .step-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step-field input::placeholder { color: color-mix(in srgb, var(--ink-soft) 45%, transparent); }
.step-field .unit { flex: none; font-size: 15px; color: var(--ink-soft); }

/* 結果の年齢の横のイラスト */
.span-row dd { display: inline-flex; align-items: center; gap: 10px; }
.span-row { align-items: center !important; }
.row-avatar {
  flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: var(--surface);
  box-shadow: 0 0 0 3px var(--surface), 0 4px 12px rgba(91, 60, 35, .14);
}
.row-avatar img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.42) translateY(9%); }
@keyframes avatarIn { from { opacity: 0; transform: scale(.6) rotate(-8deg); } to { opacity: 1; transform: none; } }
.row-avatar.is-new { animation: avatarIn .5s cubic-bezier(.2, .9, .3, 1.3) both; }
/* 結果を開いたときは、行が出てくるのに合わせて絵がぽんと出る */
.span-row[data-step="1"] .row-avatar.is-new { animation-delay: .3s; }
.span-row[data-step="2"] .row-avatar.is-new { animation-delay: .8s; }

/* 年齢に合わせたイラスト */
@keyframes portraitIn {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to { opacity: 1; transform: none; }
}
.age-portrait {
  display: flex; align-items: center; gap: 16px; margin-top: 14px; padding: 12px 16px;
  border-radius: 20px; background: linear-gradient(120deg, var(--accent-soft), color-mix(in srgb, var(--sub-soft) 70%, transparent));
}
.age-portrait.is-in { animation: portraitIn .55s cubic-bezier(.2, .7, .2, 1) both; }
.portrait-frame {
  position: relative; flex: none; width: 84px; height: 84px; border-radius: 50%; overflow: hidden;
  background: var(--surface); box-shadow: 0 0 0 4px var(--surface), 0 8px 18px rgba(91, 60, 35, .14);
}
.portrait-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.5) translateY(9%); opacity: 0;
  transition: opacity .5s ease, transform .9s cubic-bezier(.2, .7, .2, 1);
}
.portrait-img.is-active { opacity: 1; transform: scale(1.42) translateY(9%); }
.portrait-caption { margin: 0; display: flex; flex-direction: column; line-height: 1.3; }
.portrait-age { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.portrait-who { font-size: 14px; font-weight: 700; color: var(--ink-soft); }

/* そろったら結果ボタンが一度ふくらむ */
@keyframes ready { 0%, 100% { transform: scale(1); } 35% { transform: scale(1.04); } 70% { transform: scale(.99); } }
.btn.is-ready { animation: ready .7s ease; box-shadow: 0 8px 22px rgba(217, 119, 75, .35); }

/* ---------- 結果画面 ---------- */
.view-result { position: relative; isolation: isolate; }

/* 一番上：ふたりの今の年ごろ */
.result-hero { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 0 4px; }
.rh-person { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.rh-avatar {
  width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 5px var(--surface), 0 10px 24px rgba(91, 60, 35, .16);
}
.rh-person:first-child .rh-avatar { animation: floaty 6s ease-in-out 1s infinite; }
.rh-person:last-child .rh-avatar { animation: floaty 6s ease-in-out 2.5s infinite; }
.rh-avatar img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.42) translateY(9%); }
.rh-initial { font-size: 15px; font-weight: 800; color: var(--accent); }
.rh-name { font-size: 12px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.rh-link { display: flex; gap: 6px; padding-bottom: 22px; }
.rh-link span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .25; animation: linkDot 1.8s ease-in-out infinite; }
.rh-link span:nth-child(2) { animation-delay: .3s; }
.rh-link span:nth-child(3) { animation-delay: .6s; }
@keyframes linkDot { 0%, 100% { opacity: .2; transform: scale(.8); } 40% { opacity: .9; transform: scale(1.15); } }
.view-result .result-context { margin: 6px 0 14px; font-size: 14px; }

/* 目安のカード */
.span-card {
  position: relative; border-top: 0; border-radius: 26px; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 55%, var(--surface)) 0, var(--surface) 160px);
  box-shadow: 0 16px 40px rgba(91, 60, 35, .12);
}
.span-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--sub), var(--accent), var(--sub));
  background-size: 200% 100%; animation: sheen 6s linear infinite;
}
@keyframes sheen { from { background-position: 0 0; } to { background-position: 200% 0; } }
.span-card .result-heading { font-size: 17px; letter-spacing: .04em; }

/* 一緒に過ごせる時間 */
#span-card .reveal[data-step="3"] {
  margin-top: 16px; padding: 16px 10px 14px; border-radius: 20px; text-align: center;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--sub-soft) 80%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.span-total-label {
  display: inline-block; margin: 0 0 6px; padding: 3px 12px; border-radius: 999px;
  background: var(--surface); font-size: 12px; font-weight: 800; color: var(--accent); letter-spacing: .04em;
}
.span-total { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 1px; font-size: clamp(21px, 6.8vw, 32px); line-height: 1.25; white-space: nowrap; }
.span-total .n {
  font-weight: 800; font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--sub)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.span-total .u { font-size: 13px; font-weight: 700; color: var(--ink); margin: 0 5px 0 1px; }
.span-total .u:last-child { margin-right: 0; }
.span-total .frac { font-size: .55em; opacity: .75; }
.live-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px 0 0; font-size: 11.5px; color: var(--ink-soft); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: livePulse 1.6s ease-out infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }

/* 締めのひとこと */
.closing-message { position: relative; padding: 18px 12px 6px; }
.closing-message::before, .closing-message::after {
  position: absolute; font-size: 44px; line-height: 1; color: var(--accent); opacity: .25; font-family: Georgia, serif;
}
.closing-message::before { content: "“"; left: 4px; top: 0; }
.closing-message::after { content: "”"; right: 4px; bottom: -14px; }

/* ほかのカード */
.view-result .result-card, .view-result .compare-card { border-radius: 24px; box-shadow: 0 10px 28px rgba(91, 60, 35, .09); }
.view-result .result-card { border-top: 0; position: relative; overflow: hidden; }
.view-result .result-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--accent), var(--sub)); }

/* ---------- ふたりでできることに置きかえると ---------- */
.acts { margin: 4px 0 24px; }
.acts-head { text-align: center; padding: 0 4px; }
.acts-kicker {
  display: inline-block; margin: 0 0 8px; padding: 4px 12px; border-radius: 999px;
  background: var(--surface); box-shadow: 0 4px 12px rgba(91, 60, 35, .08);
  font-size: 12px; font-weight: 800; color: var(--accent); letter-spacing: .06em;
}
.acts-title { margin: 0 0 6px; font-size: 20px; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere; }
.acts-lead { margin: 0 0 14px; font-size: 13px; color: var(--ink-soft); line-height: 1.7; }
.acts-lead strong { color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.acts-scroller {
  display: grid; grid-auto-flow: column; grid-auto-columns: 62%; gap: 12px;
  margin: 0 -16px; padding: 6px 16px 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  scroll-padding: 0 16px; -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior-x: contain;
}
.acts-scroller::-webkit-scrollbar { display: none; }
.acts-scroller:focus-visible { outline: 3px solid var(--sub); outline-offset: -3px; border-radius: 12px; }
@media (min-width: 600px) { .acts-scroller { grid-auto-columns: 40%; } }
.act {
  scroll-snap-align: start; border-radius: 22px; overflow: hidden; background: var(--surface);
  box-shadow: 0 10px 26px rgba(91, 60, 35, .12); display: flex; flex-direction: column;
}
.acts.sr .act { opacity: 0; transform: translateY(16px) scale(.98); }
.acts.sr.is-in .act { animation: fadeUp .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(min(var(--d), .45s) + .1s); opacity: 1; transform: none; }
.act-photo { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--accent-soft); }
.act-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease; }
.act:hover .act-photo img { transform: scale(1.05); }
.act-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(40, 25, 15, .35)); pointer-events: none; }
.act-body { padding: 12px 14px 12px; display: flex; flex-direction: column; gap: 0; flex: 1; }
.act-name { margin: 0; font-size: 15px; line-height: 1.4; }
.act-fit {
  position: absolute; left: 10px; top: 10px; z-index: 1; padding: 4px 10px; border-radius: 999px;
  background: rgba(107, 154, 139, .92); color: #fff; font-size: 11.5px; font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.act-time { margin: 4px 0 0; display: flex; align-items: baseline; gap: 6px; }
.act-time-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.act-time strong {
  font-size: 28px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--sub)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.act-add {
  margin-top: 10px; padding: 8px 10px; min-height: 40px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--accent); background: transparent; color: var(--accent);
  font: inherit; font-size: 12.5px; font-weight: 800; transition: background .2s ease, color .2s ease, transform .1s ease;
}
.act-add:active { transform: scale(.97); }
.act-add[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); animation: pop .3s ease; }
.act-add:focus-visible { outline: 3px solid var(--sub); outline-offset: 2px; }
.acts-filter { display: flex; gap: 8px; margin: 0 -16px 2px; padding: 2px 16px 6px; overflow-x: auto; scrollbar-width: none; }
.acts-filter::-webkit-scrollbar { display: none; }
.act-chip {
  flex: none; padding: 7px 14px; min-height: 36px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; transition: all .2s ease;
}
.act-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 12px rgba(217, 119, 75, .25); }
.act-chip:focus-visible { outline: 3px solid var(--sub); outline-offset: 2px; }
.act[hidden] { display: none; }
.acts-empty { margin: 8px 0; text-align: center; font-size: 13px; color: var(--ink-soft); }
.acts-lead #acts-usual { display: block; margin-top: 4px; font-weight: 700; color: var(--ink); }
.act-credit { margin: auto 0 0; padding-top: 6px; font-size: 10.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-credit a { color: inherit; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }
.acts-hint { margin: 0; text-align: right; font-size: 11px; color: var(--ink-soft); }
.acts-hint span::after { content: " →"; display: inline-block; animation: nudge 1.6s ease-in-out infinite; }
/* ①おすすめ ②質問 ③結果 の流れ */
.acts-picks { margin-bottom: 14px; }
.acts-sub, .acts-results-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; font-weight: 800;
}
.acts-sub::before, .acts-results-title::before {
  content: ""; width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(180deg, var(--accent), var(--sub));
}
.acts-results { margin-top: 4px; animation: portraitIn .45s ease both; }
.acts-all-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin: 12px 0 0;
  min-height: 46px; padding: 10px 14px; border-radius: 999px; cursor: pointer;
  border: 1.5px dashed var(--accent); background: transparent; color: var(--accent);
  font: inherit; font-size: 14px; font-weight: 800; transition: background .2s ease;
}
.acts-all-btn::after { content: "↓"; transition: transform .25s ease; }
.acts-all-btn[aria-expanded="true"]::after { transform: rotate(180deg); }
.acts-all-btn:active { background: var(--accent-soft); }
.acts-all-btn:focus-visible { outline: 3px solid var(--sub); outline-offset: 2px; }

/* お相手が好きそうなこと */
.acts-likes {
  border: 0; margin: 0 0 14px; padding: 14px 14px 12px; min-width: 0; border-radius: 20px;
  background: var(--surface); box-shadow: 0 8px 22px rgba(91, 60, 35, .08);
}
.acts-likes legend { float: left; width: 100%; padding: 0; margin: 0 0 2px; font-size: 15px; font-weight: 800; text-align: center; }
.acts-likes legend + * { clear: both; }
.acts-likes-hint { margin: 0 0 10px; font-size: 11.5px; color: var(--ink-soft); text-align: center; }
.like-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.like-groups { display: grid; gap: 12px; }
.like-group-title { margin: 0 0 6px; font-size: 12px; font-weight: 800; color: var(--accent); letter-spacing: .04em; text-align: left; }
.like-group .like-chips { justify-content: flex-start; }
.like-chip[hidden] { display: none; }
.like-more {
  display: block; width: 100%; margin: 12px 0 0; min-height: 40px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 800;
}
.like-more::after { content: " ↓"; }
.like-more[aria-expanded="true"]::after { content: " ↑"; }
.like-more:focus-visible { outline: 3px solid var(--sub); outline-offset: 2px; }
.like-chip {
  padding: 7px 12px; min-height: 36px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 700; transition: all .2s ease;
}
.like-chip[aria-pressed="true"] {
  border-color: var(--sub); background: var(--sub); color: #fff;
  box-shadow: 0 4px 12px rgba(107, 154, 139, .3); animation: pop .3s ease;
}
.like-chip[aria-pressed="true"]::before { content: "✓ "; }
.like-chip:focus-visible, .like-clear:focus-visible { outline: 3px solid var(--sub); outline-offset: 2px; }
.like-clear { display: block; margin: 10px auto 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.act-tags { margin: 3px 0 0; display: flex; flex-wrap: wrap; gap: 4px; }
.act-tags span { font-size: 10px; font-weight: 700; color: var(--ink-soft); background: var(--bg); padding: 1px 7px; border-radius: 999px; }
.act-tags span.is-match { background: var(--sub-soft); color: var(--ink); }

/* 表示切り替え・件数 */
.acts-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.acts-view { display: inline-flex; padding: 3px; gap: 3px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.act-view-btn {
  border: 0; background: transparent; color: var(--ink-soft); cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 800; padding: 6px 12px; min-height: 32px; border-radius: 999px;
  transition: background .2s ease, color .2s ease;
}
.act-view-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.act-view-btn:focus-visible { outline: 3px solid var(--sub); outline-offset: 2px; }
.acts-count { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.act-no { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; background: var(--bg); color: var(--ink-soft); font-weight: 800; }

/* 一覧で見る：2列のグリッド */
.acts.is-grid .acts-scroller {
  grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-columns: auto;
  margin: 0; padding: 4px 0 8px; overflow: visible; scroll-snap-type: none; gap: 10px;
}
@media (min-width: 600px) { .acts.is-grid .acts-scroller { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.acts.is-grid .act { border-radius: 18px; box-shadow: 0 6px 16px rgba(91, 60, 35, .1); }
.acts.is-grid .act-body { padding: 9px 10px 10px; }
.acts.is-grid .act-name { font-size: 13.5px; }
.acts.is-grid .act-time { margin-top: 2px; gap: 4px; }
.acts.is-grid .act-time-label { font-size: 10.5px; }
.acts.is-grid .act-time strong { font-size: 20px; }
.acts.is-grid .act-add { margin-top: 8px; min-height: 34px; padding: 6px 6px; font-size: 11.5px; }
.acts.is-grid .act-fit { left: 6px; top: 6px; padding: 3px 7px; font-size: 10px; }
.acts.is-grid .act-credit { font-size: 9.5px; }
.acts.is-grid .acts-hint { display: none; }

.acts-note { margin: 6px 0 0; font-size: 11px; color: var(--ink-soft); line-height: 1.6; }
.acts-note a { color: inherit; }

/* ---------- 動き ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes drift1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(18px, 14px) scale(1.08); } }
@keyframes drift2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-16px, 10px) scale(.94); } }
@keyframes drift3 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(10px, -16px); } }
@keyframes shine { 0%, 70% { transform: translateX(-120%) skewX(-20deg); } 100% { transform: translateX(220%) skewX(-20deg); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* 画面の切り替え */
.view:not([hidden]) { animation: viewIn .45s ease both; }

/* トップ：順番に浮かび上がる */
.enter { animation: fadeUp .8s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 110ms + 100ms); }
.hl { display: inline-block; }
.hero { position: relative; isolation: isolate; }
.hero-slides.enter { animation: fadeUp .9s cubic-bezier(.2, .7, .2, 1) .1s both, floaty 6s ease-in-out 1.2s infinite; }

/* トップ：背景でゆっくり動く丸 */
.hero-bg { position: absolute; inset: -24px -16px 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55; }
.b1 { width: 180px; height: 180px; left: -60px; top: 40px; background: var(--accent-soft); animation: drift1 14s ease-in-out infinite; }
.b2 { width: 120px; height: 120px; right: -40px; top: 160px; background: var(--sub-soft); animation: drift2 12s ease-in-out infinite; }
.b3 { width: 26px; height: 26px; right: 40px; top: 30px; background: var(--accent); opacity: .35; animation: drift3 9s ease-in-out infinite; }
.b4 { width: 150px; height: 150px; left: 20%; bottom: -60px; background: var(--sub-soft); opacity: .4; animation: drift2 16s ease-in-out infinite reverse; }

/* ボタン：ときどき光が流れる */
.btn-shine { position: relative; overflow: hidden; }
.btn-shine::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: shine 4.5s ease-in-out 2s infinite; pointer-events: none;
}
@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); }
  .btn-primary:hover { box-shadow: 0 6px 16px rgba(217, 119, 75, .3); }
  .chip span:hover { border-color: var(--accent); }
}

/* 選んだときに小さく弾む */
.chip input:checked + span, .idea input:checked ~ .idea-check { animation: pop .3s ease; }

/* スクロールで現れる（JS が .sr を付ける） */
.sr { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--sr-delay, 0s); }
.sr.is-in { opacity: 1; transform: none; }

/* 入力の進み具合 */
.progress {
  position: sticky; top: 0; z-index: 5; margin: 0 -16px 12px; padding: 10px 16px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.progress-track { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--sub), var(--accent)); transition: width .45s cubic-bezier(.2, .7, .2, 1); }
.progress-text { margin: 6px 0 0; font-size: 12px; font-weight: 700; color: var(--ink-soft); text-align: right; }
.progress.is-done .progress-text { color: var(--accent); }
.progress.is-prefilled .progress-text { color: var(--ink-soft); }
.progress-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.progress-row .progress-text { flex: 1; }
.progress-clear {
  flex: none; margin-top: 6px; padding: 4px 10px; min-height: 30px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--accent);
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .sr { opacity: 1; transform: none; }
}
.row-age.is-text { font-size: 16px; font-weight: 700; }

/* 平均寿命をこえている相手：やさしいメッセージカード */
.span-blessing {
  position: relative; overflow: hidden; margin: 16px 0 0; padding: 22px 18px 20px; text-align: center;
  border-radius: 22px; border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 50% 0%, var(--accent-soft) 0%, transparent 60%), linear-gradient(160deg, var(--surface), var(--sub-soft));
}
.span-blessing[hidden], .blessing-stat[hidden], .span-row[hidden] { display: none; }
.blessing-avatar {
  width: 76px; height: 76px; margin: 0 auto 10px; border-radius: 50%; overflow: hidden;
  background: var(--surface); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--accent-soft), var(--shadow);
  animation: floaty 5s ease-in-out infinite;
}
.blessing-avatar img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.42) translateY(9%); }
.blessing-badge {
  display: inline-block; margin: 4px 0 10px; padding: 4px 12px; border-radius: 999px;
  background: var(--surface); color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .04em;
  box-shadow: 0 2px 8px rgba(217, 119, 75, .12);
}
.blessing-main { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.6; color: var(--ink); word-break: keep-all; }
.blessing-sub { margin: 10px 0 0; font-size: 14px; line-height: 1.7; color: var(--ink-soft); }
.blessing-spark { position: absolute; color: var(--accent); opacity: .45; animation: twinkle 3.2s ease-in-out infinite; }
.blessing-spark.s1 { top: 16px; left: 22%; font-size: 12px; }
.blessing-spark.s2 { top: 44px; right: 20%; font-size: 16px; animation-delay: 1.1s; color: var(--sub); }
.blessing-spark.s3 { top: 84px; left: 16%; font-size: 10px; animation-delay: 2s; }
@keyframes twinkle { 0%, 100% { opacity: .15; transform: scale(.8); } 50% { opacity: .7; transform: scale(1.1); } }
.blessing-stat {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin: 12px 0 0; padding: 12px 2px; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; flex-wrap: nowrap; white-space: nowrap;
}
.blessing-stat strong { color: var(--ink); font-size: 20px; font-weight: 800; }
@media (prefers-reduced-motion: reduce) { .blessing-avatar, .blessing-spark { animation: none; } }

/* 年齢の入れまちがい：赤いエラーではなく、やさしい声かけ */
#age-gap-error { margin-top: 12px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--ink); font-size: 14px; line-height: 1.7; font-weight: 500; }
.compare-card[hidden] { display: none !important; }
.next-toggle[hidden], .next-q[hidden], .next-panel[hidden] { display: none !important; }

/* ===== さいごの1年カード ===== */
.view-result .year-card {
  padding: 30px 20px 24px;
  background:
    radial-gradient(140% 70% at 50% 0%, var(--accent-soft) 0%, transparent 55%),
    var(--surface);
}
.year-kicker { margin: 0 0 6px; font-size: 11px; letter-spacing: .32em; color: var(--accent); font-weight: 700; }
.year-card .result-total { margin: 8px 0 18px; }
.year-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(8px, 1fr)); gap: 4px;
  max-width: 320px; margin: 22px auto 0;
}
.year-grid i { display: block; aspect-ratio: 1; border-radius: 50%; background: var(--line); opacity: .7; }
.year-grid i.on { background: var(--accent); opacity: var(--o, 1); box-shadow: 0 0 0 2px var(--accent-soft); }
.year-card.is-in .year-grid i.on, .year-card:not(.sr) .year-grid i.on { animation: dotOn .5s cubic-bezier(.2, .9, .3, 1.4) both; animation-delay: calc(.35s + var(--k, 0) * .025s); }
@keyframes dotOn { from { transform: scale(0); opacity: 0; } to { transform: scale(1); } }
.year-caption { margin: 14px 0 6px; font-size: 14px; line-height: 1.7; color: var(--ink-soft); }
.year-caption strong { color: var(--accent); font-size: 16px; }

/* ===== さいごの言葉（一期一会） ===== */
.finale { text-align: center; padding: 28px 8px 34px; margin: 6px 0 22px; }
.finale-line { display: block; width: 1px; height: 44px; margin: 0 auto; background: linear-gradient(var(--line), var(--accent), var(--line)); }
.finale-word {
  margin: 22px 0 4px; font-size: 40px; font-weight: 800; letter-spacing: .3em; padding-left: .3em; color: var(--ink);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
}
.finale-read { margin: 0 0 18px; font-size: 12px; letter-spacing: .4em; color: var(--accent); }
.finale-mean { margin: 0 0 24px; font-size: 14px; line-height: 1.9; color: var(--ink-soft); }
.finale-src { display: inline-block; margin-top: 6px; font-size: 12px; opacity: .8; }
.finale .closing-message { margin: 0 0 24px; padding: 0; font-size: 20px; }
.finale .closing-message::before, .finale .closing-message::after { content: none; }
.finale.sr > * { opacity: 0; transform: translateY(10px); transition: opacity .9s ease, transform .9s ease; }
.finale.sr { opacity: 1; transform: none; }
.finale.sr.is-in > * { opacity: 1; transform: none; }
.finale.sr.is-in > :nth-child(2) { transition-delay: .25s; }
.finale.sr.is-in > :nth-child(3) { transition-delay: .45s; }
.finale.sr.is-in > :nth-child(4) { transition-delay: .7s; }
.finale.sr.is-in > :nth-child(5) { transition-delay: 1.1s; }
.finale.sr.is-in > :nth-child(6) { transition-delay: 1.4s; }
@media (prefers-reduced-motion: reduce) { .year-grid i.on { animation: none !important; } .finale > * { opacity: 1 !important; transform: none !important; } }
.finale-word.is-long { font-size: 24px; letter-spacing: .12em; padding-left: .12em; line-height: 1.6; text-wrap: balance; word-break: keep-all; }
.finale-word.is-latin { font-family: Georgia, "Times New Roman", serif; font-style: italic; letter-spacing: .04em; padding-left: 0; font-weight: 600; }
.finale-read[hidden] { display: none; }
.finale-word.is-xlong { font-size: 21px; letter-spacing: .06em; padding-left: .06em; }
.finale-word.is-latin { font-size: 28px; }

/* さいごの言葉：ふわっと入れ替わる */
.finale-body {
  min-height: 236px; display: flex; flex-direction: column; justify-content: center; align-items: center;
  transition: opacity .9s ease, filter .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1);
}
.finale-body > p { margin-left: 0; margin-right: 0; }
.finale-body .finale-mean { margin-bottom: 0; }
.finale-body .finale-word { margin-top: 0; }
.finale-body.is-out { opacity: 0; filter: blur(6px); transform: translateY(8px); }
.finale .finale-line:last-child { margin-top: 24px; }
.finale .finale-body, .finale.sr > .finale-body, .finale.sr.is-in > .finale-body {
  transition: opacity .9s ease, filter .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); transition-delay: 0s;
}
.finale .finale-body.is-out, .finale.sr.is-in > .finale-body.is-out { opacity: 0; filter: blur(6px); transform: translateY(8px); }

/* 「〇〇は、どんなことが好きそう？」の上に、相手の年ごろの絵 */
.acts-likes legend { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.likes-avatar {
  position: relative; width: 72px; height: 72px; border-radius: 50%; overflow: hidden; background: var(--surface);
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--accent-soft), 0 8px 18px rgba(91, 60, 35, .14);
  animation: floaty 5s ease-in-out infinite;
}
.likes-avatar[hidden] { display: none; }
.likes-avatar img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.42) translateY(9%); }
@media (prefers-reduced-motion: reduce) { .likes-avatar { animation: none; } }
