/* ============================================================
   相棒しんだん（template-aibou.php。2026-11-27）
   はじめ → 質問（Q1〜Q3）→ けっか を、1ページの中で 出し入れする。
   けっかの 色は その子の 系統の 色（--ab-accent ほか。aibou.js が けっかの カードに 入れる）。
   文字の 色は いつも ink（系統の 色は うすいので、線と 地の 色に だけ 使う）
   ============================================================ */

.wrap-app.ab-guest { width: min(100% - 32px, 560px); }
.ab { position: relative; display: grid; gap: var(--space-4); max-width: 560px; margin-inline: auto; word-break: keep-all; overflow-wrap: anywhere; } /* 分かち書きの 空白で 折る（ことばの 途中で 切らない） */
.ab [hidden] { display: none !important; }
.ab-card { display: grid; gap: var(--space-3); }
.ab-lead { margin: 0; font-size: var(--fs-sm); line-height: 1.7; color: var(--ink-900); }
.ab .btn { max-width: 100%; white-space: normal; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.4; }
.ab .btn--block { padding-block: 10px; }
.ab-note { margin: 0; font-size: var(--fs-xs); line-height: 1.6; color: var(--ink-700); }

/* ---- はじめ ---- */
.ab-intro__top { display: flex; align-items: center; gap: 12px; }
.ab-buddy { flex: none; display: block; width: 84px; }
.ab-buddy svg { display: block; width: 84px; height: auto; filter: drop-shadow(0 6px 10px rgba(90,110,170,.16)); }
.ab-intro__h {
  margin: 0; font-family: var(--font-display); font-size: var(--fs-lg); line-height: 1.4;
  text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; color: var(--ink-900); outline: none;
}
.ab-family { display: grid; gap: 6px; }
.ab-family__h { margin: 0; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-700); }
.ab-family__list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.ab-family__list li {
  display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: var(--r-md); background: var(--surface-soft);
  animation: ab-in 420ms var(--ease-out, ease-out) both; animation-delay: calc(var(--i, 0) * 50ms);
}
.ab-family__list svg { display: block; width: 100%; max-width: 64px; height: auto; }
.ab-family__list small { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-700); text-align: center; overflow-wrap: anywhere; }
.ab-points { display: grid; gap: 6px; margin: 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-soft); list-style: none; }
.ab-points li { position: relative; padding-left: 1.5em; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-900); }
.ab-points li::before { content: "○"; content: "○" / ""; position: absolute; left: 0; font-weight: 700; color: var(--sky-700); }

/* ともだちの リンクから 来た人 */
.ab-friend {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--lemon-100), var(--rose-50)); box-shadow: inset 0 0 0 2px var(--lemon-200);
}
.ab-friend__art { flex: none; width: 64px; }
.ab-friend__art svg { display: block; width: 64px; height: auto; }
.ab-friend__text { display: grid; gap: 2px; margin: 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-900); }
.ab-friend__text b { font-family: var(--font-display); font-size: var(--fs-base); }

/* 前回の けっか */
.ab-last {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin: 0; padding: 10px 14px;
  border: 0; border-radius: var(--r-md); background: var(--sky-50); box-shadow: inset 0 0 0 2px var(--sky-100);
  font: inherit; font-size: var(--fs-sm); font-weight: 700; color: var(--sky-700); text-align: left; cursor: pointer;
}
.ab-last:hover { background: var(--sky-100); }
.ab-last:focus-visible { outline: 3px solid var(--color-ring); outline-offset: 2px; }
.ab-last i { font-style: normal; }

/* ---- 質問 ---- */
.ab-quiz__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ab-progress { margin: 0; padding: 2px 12px; border-radius: var(--r-pill); background: var(--sky-50); font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--sky-700); }
.ab-guide { display: flex; align-items: center; gap: 10px; }
.ab-guide__art { flex: none; width: 56px; }
.ab-guide__art svg { display: block; width: 56px; height: auto; }
.ab-bubble {
  position: relative; margin: 0; padding: 8px 14px; border-radius: 18px; background: var(--surface-soft);
  box-shadow: inset 0 0 0 2px var(--border); font-size: var(--fs-sm); font-weight: 700; line-height: 1.5; color: var(--ink-900);
}
.ab-bubble:empty { display: none; }
.ab-q__h {
  margin: 0; font-family: var(--font-display); font-size: var(--fs-lg); line-height: 1.4;
  text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; color: var(--ink-900); outline: none;
}
.ab-q__note { margin: -4px 0 0; font-size: var(--fs-xs); line-height: 1.6; color: var(--ink-700); }
.ab-opts { display: grid; gap: 8px; }
.ab-opt {
  display: grid; gap: 2px; width: 100%; min-height: 52px; margin: 0; padding: 12px 14px; text-align: left;
  border: 2px solid var(--border); border-left-width: 8px; border-radius: var(--r-md); background: var(--surface);
  font: inherit; color: var(--ink-900); cursor: pointer;
  animation: ab-in 320ms var(--ease-out, ease-out) both;
  transition: border-color var(--dur-fast, 150ms) var(--ease-out, ease-out), background var(--dur-fast, 150ms) var(--ease-out, ease-out), transform var(--dur-fast, 150ms) var(--ease-out, ease-out);
}
.ab-opt:nth-child(2) { animation-delay: 40ms; }
.ab-opt:nth-child(3) { animation-delay: 80ms; }
.ab-opt:nth-child(4) { animation-delay: 120ms; }
.ab-opt:nth-child(5) { animation-delay: 160ms; }
.ab-opt:nth-child(6) { animation-delay: 200ms; }
.ab-opt--tint { border-left-color: var(--tc, var(--border)); }
.ab-opt:hover { border-color: var(--border-strong); background: var(--surface-soft); }
.ab-opt--tint:hover { border-color: var(--tc, var(--border-strong)); background: var(--tc-soft, var(--surface-soft)); }
.ab-opt:active { transform: scale(.99); }
.ab-opt:focus-visible { outline: 3px solid var(--color-ring); outline-offset: 2px; }
.ab-opt__text { font-family: var(--font-display); font-size: var(--fs-base); font-weight: 700; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
.ab-opt__sub { font-size: var(--fs-xs); line-height: 1.55; color: var(--ink-700); overflow-wrap: anywhere; }

/* ---- けっか ---- */
.ab-result__card { --ab-accent: #69B4EA; --ab-accent2: #3E90D2; --ab-glow: #DCEEFC; --ab-bottom: #EDF7FF; --ab-line: #B3DBF3; }
.ab-hero { position: relative; display: grid; justify-items: center; gap: 4px; text-align: center; }
.ab-pill { background: var(--ab-glow); color: var(--ink-900); box-shadow: inset 0 0 0 2px var(--ab-accent); }
.ab-result__h { margin: 4px 0 0; font-family: var(--font-display); font-size: var(--fs-lg); line-height: 1.4; text-wrap: balance; word-break: keep-all; color: var(--ink-900); outline: none; }
.ab-hero__art {
  display: grid; place-items: center; width: min(240px, 66vw); aspect-ratio: 1; margin-top: 4px; border-radius: 50%;
  background: radial-gradient(circle at 50% 54%, var(--ab-glow) 0 60%, transparent 61%);
}
.ab-hero__art svg { display: block; width: 112%; max-width: none; height: auto; overflow: visible; }
.ab-hero.is-popped .ab-hero__art { animation: ab-pop-in 520ms var(--ease-out, ease-out) both; }
.ab-hero__name { margin: 0; font-family: var(--font-display); font-size: clamp(1.7rem, 8vw, 2.2rem); font-weight: 700; line-height: 1.2; color: var(--ink-900); }
.ab-hero__label { margin: 0; }
.ab-tag { display: inline-block; padding: 3px 14px; border-radius: var(--r-pill); background: var(--ab-glow); box-shadow: inset 0 0 0 2px var(--ab-accent); font-size: var(--fs-sm); font-weight: 700; color: var(--ink-900); }
.ab-hero__desc { margin: 2px 0 0; font-size: var(--fs-sm); font-weight: 700; line-height: 1.6; color: var(--ink-700); }
.ab-answers { margin: 4px 0 0; font-size: var(--fs-xs); line-height: 1.6; color: var(--ink-700); overflow-wrap: anywhere; }

/* 登場（ぽっか → ふんふん → この子）。とばせる（ボタン）。ほかの ところは そのあいだ 見せない */
.ab-reveal {
  position: absolute; inset: 0; z-index: 2; display: grid; place-content: start center; justify-items: center; gap: 8px; /* 上に 寄せる（小さい スマホで 下の バーに かくれない） */
  margin: 0; padding: 8px 0 0; border: 0; border-radius: var(--r-lg); background: transparent; font: inherit; cursor: pointer;
}
.ab-reveal__art svg { display: block; width: 150px; height: auto; }
.ab-reveal__cap { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; color: var(--ink-900); }
.ab-hero.is-revealing > :not(.ab-reveal) { visibility: hidden; }
.ab-result__card.is-revealing > :not(.ab-hero) { visibility: hidden; }
.ab-hop { animation: ab-hop 440ms var(--ease-out, ease-out) both; }
@keyframes ab-hop { 0% { transform: translateY(8px) scale(.9); opacity: 0; } 55% { transform: translateY(-10px) scale(1.04); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes ab-pop-in { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes ab-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ともだちと くらべる */
.ab-compare { display: grid; justify-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); background: linear-gradient(135deg, var(--lemon-100), var(--rose-50)); text-align: center; }
.ab-compare__text { margin: 0; font-size: var(--fs-sm); font-weight: 700; line-height: 1.6; color: var(--ink-900); }
.ab-compare__pair { display: flex; gap: 18px; }
.ab-compare__one { display: grid; justify-items: center; gap: 2px; }
.ab-compare__art svg { display: block; width: 88px; height: auto; }
.ab-compare__one small { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-700); }

/* 会員（いまの相棒との ちがい） */
.ab-me { display: grid; gap: 4px; padding: 10px 14px; border-radius: var(--r-md); background: var(--sky-50); }
.ab-me p { margin: 0; font-size: var(--fs-sm); line-height: 1.7; color: var(--ink-900); }

/* 育っていく すがた */
.ab-sub__h { margin: 0; font-family: var(--font-display); font-size: var(--fs-base); font-weight: 700; color: var(--ink-900); }
.ab-grow { display: grid; gap: 8px; }
.ab-grow__line { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.ab-node { position: relative; display: grid; justify-items: center; align-content: start; gap: 2px; padding: 8px 2px 6px; border-radius: var(--r-md); background: var(--surface-soft); text-align: center; }
.ab-node__art { display: grid; place-items: center; width: 100%; aspect-ratio: 1; }
.ab-node__art svg { display: block; width: 100%; max-width: 72px; height: auto; }
.ab-node__name { font-size: var(--fs-xs); font-weight: 700; line-height: 1.3; color: var(--ink-900); overflow-wrap: anywhere; }
.ab-node__lv { font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-700); }
.ab-node__badge, .ab-node__last, .ab-node__now { font-size: 0.68rem; font-weight: 700; line-height: 1.3; }
.ab-node__badge { padding: 1px 4px; border-radius: var(--r-pill); background: #fff; box-shadow: inset 0 0 0 2px var(--ab-accent); color: var(--ink-900); white-space: nowrap; }
.ab-node__last { color: var(--ink-700); }
.ab-node__now { padding: 1px 6px; border-radius: var(--r-pill); background: var(--rose-100); color: var(--rose-700, #B92F63); }
.ab-node.is-here { background: var(--ab-glow); box-shadow: inset 0 0 0 2px var(--ab-accent); }
.ab-node.is-now { box-shadow: inset 0 0 0 2px var(--rose-200); }
.ab-node.is-hidden .ab-node__art svg { filter: brightness(0) opacity(.16); } /* 図鑑の まだ 会っていない子と 同じ 影 */
.ab-node.is-hidden .ab-node__name { color: var(--ink-700); }
.ab-grow__note { margin: 0; font-size: var(--fs-xs); line-height: 1.6; color: var(--ink-700); }
@media (max-width: 600px) {
  .ab-grow__line { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* この子に 会うには */
.ab-how { display: grid; gap: 8px; padding: 14px; border-radius: var(--r-lg); background: var(--surface-soft); box-shadow: inset 0 0 0 2px var(--ab-line); }
.ab-how__list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ab-how__list li { position: relative; padding-left: 1.5em; font-size: var(--fs-sm); line-height: 1.7; color: var(--ink-900); }
.ab-how__list li::before { content: "○"; content: "○" / ""; position: absolute; left: 0; font-weight: 700; color: var(--ink-700); }
.ab-how__note { margin: 0; font-size: var(--fs-xs); line-height: 1.6; color: var(--ink-700); }

.ab-rhythm, .ab-trial { margin: 0; padding: 8px 14px; border-radius: var(--r-md); font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-900); }
.ab-rhythm { background: var(--lemon-100); }
.ab-rhythm a { font-weight: 700; color: var(--lemon-700); }
.ab-trial { background: var(--rose-50); }
.ab-trial a { font-weight: 700; color: var(--rose-700, #A8285A); }

/* ようこそ（登録して もどってきた すぐあと） */
.ab-welcome { display: grid; gap: 10px; padding: 16px; border-radius: var(--r-lg); background: linear-gradient(135deg, var(--sky-50), var(--rose-50)); box-shadow: inset 0 0 0 2px var(--sky-100); }
.ab-welcome__h { margin: 0; font-family: var(--font-display); font-size: var(--fs-lg); line-height: 1.4; text-wrap: balance; word-break: keep-all; color: var(--ink-900); outline: none; }
.ab-welcome__buddy { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ab-welcome__buddy .ab-bubble { flex: 1 1 168px; }
.ab-welcome__art { flex: none; width: 84px; }
.ab-welcome__art svg { display: block; width: 84px; height: auto; }
.ab-steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ab-step { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-xs); }
.ab-step__body { display: grid; gap: 2px; min-width: 0; flex: 1 1 12em; }
.ab-step__body b { font-size: var(--fs-sm); color: var(--ink-900); }
.ab-step__body span { font-size: var(--fs-xs); line-height: 1.6; color: var(--ink-700); }

/* 登録の箱（ログインしていない人） */
.ab-join {
  display: grid; gap: 10px; width: 100%; padding: 16px; border: 2px solid var(--sky-100); border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--sky-50), var(--rose-50));
}
.ab-join__h { margin: 0; font-family: var(--font-display); font-size: var(--fs-base); font-weight: 700; text-align: center; text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; color: var(--ink-900); }
.ab-join__list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ab-join__list li { position: relative; padding-left: 1.5em; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-900); }
.ab-join__list li::before { content: "○"; content: "○" / ""; position: absolute; left: 0; font-weight: 700; color: var(--rose-500); }
.ab-join__note, .ab-join__login { margin: 0; font-size: var(--fs-xs); line-height: 1.6; text-align: center; color: var(--ink-700); }
.ab-join__login a { font-weight: 700; color: var(--sky-700); }

/* シェア */
.ab-share { display: grid; gap: 8px; padding: 12px; border-radius: var(--r-md); background: var(--surface-soft); }
.ab-share__h { margin: 0; font-family: inherit; font-size: var(--fs-sm); font-weight: 700; line-height: 1.5; color: var(--ink-900); }
.ab-share__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ab-share__img { flex: none; width: 72px; height: auto; border-radius: 8px; box-shadow: 0 4px 10px rgba(90,110,170,.18); }
.ab-share__btns { flex: 1 1 170px; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; } /* 170px 取れない せまい 画面では 画像の 下に 回る */
.ab-share .btn { min-height: 44px; padding-block: 8px; }
.ab-share__msg { margin: 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--ink-700); }
.ab-share__msg:empty { display: none; }
.ab-share__url { width: 100%; padding: 8px 10px; border: 2px solid var(--border); border-radius: var(--r-sm); font: inherit; font-size: var(--fs-xs); color: var(--ink-900); background: #fff; }

.ab-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* 画像を 長おしで 保存（アプリの 中の 画面） */
.ab-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(30,40,60,.55); }
.ab-modal__panel {
  display: grid; justify-items: center; gap: 10px; width: min(100%, 420px); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 16px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-xl); text-align: center;
}
.ab-modal__h { margin: 0; font-family: var(--font-display); font-size: var(--fs-base); line-height: 1.4; text-wrap: balance; color: var(--ink-900); outline: none; }
.ab-modal__img { display: block; width: min(100%, 300px); height: auto; border-radius: 12px; box-shadow: var(--sh-md); -webkit-touch-callout: default; }
.ab-modal__note { margin: 0; font-size: var(--fs-xs); line-height: 1.6; color: var(--ink-700); }
.ab-modal__btns { position: sticky; bottom: 0; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding-block: 8px; background: var(--surface); } /* 小さい スマホでも「とじる」が いつも 見える */
body.ab-modal-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .ab-family__list li, .ab-opt, .ab-hop, .ab-hero.is-popped .ab-hero__art { animation: none; }
  .ab-opt { transition: none; }
}
