/* AIプリキュア相性占い（非公式ファンメイド）／作成：ワンダフルジャパン
 * 公式ロゴ・公式イラストは使わず、文字と図形だけで構成する */
:root {
  --pink: #ff5fa2;
  --pink-deep: #e0388a;
  --lav: #a98bff;
  --lav-deep: #7a5cf0;
  --ink: #3a2147;
  --muted: #8a6f96;
  --line: #f1d6ec;
  --bg1: #ffe4f2;
  --bg2: #ece4ff;
  --card: #ffffff;
  --res: linear-gradient(90deg, #ff8cc0, #ff5fa2);
  --adm: linear-gradient(90deg, #c4b0ff, #7a5cf0);
  --font: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Rounded Mplus 1c", "BIZ UDPGothic", "Yu Gothic", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); line-height: 1.7;
  background: linear-gradient(160deg, var(--bg1) 0%, #fdf0ff 45%, var(--bg2) 100%) fixed;
  min-height: 100vh;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ヘッダー */
.hero { text-align: center; padding: 28px 16px 12px; }
.hero-kicker { margin: 0; color: var(--lav-deep); letter-spacing: .4em; font-size: 14px; }
.hero-title {
  margin: 4px 0 6px; font-size: 28px; line-height: 1.3; font-weight: 800; letter-spacing: .02em;
  background: linear-gradient(90deg, var(--pink-deep), var(--lav-deep)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { margin: 0 0 6px; font-weight: 700; font-size: 15px; }
.hero-notice { margin: 0 auto; max-width: 560px; font-size: 12px; color: var(--muted); }

.main { max-width: 640px; margin: 0 auto; padding: 8px 12px 32px; }

/* ステップ表示 */
.steps { list-style: none; display: flex; gap: 4px; padding: 0; margin: 4px 0 12px; counter-reset: st; }
.steps li { flex: 1; text-align: center; font-size: 11px; color: var(--muted); counter-increment: st; line-height: 1.3; }
.steps li::before {
  content: counter(st); display: block; width: 24px; height: 24px; line-height: 24px; margin: 0 auto 3px; border-radius: 50%;
  background: #fff; border: 2px solid var(--line); font-weight: 700; font-size: 12px;
}
.steps li.done::before { background: var(--lav); border-color: var(--lav); color: #fff; content: "✓"; }
.steps li.now { color: var(--pink-deep); font-weight: 700; }
.steps li.now::before { background: var(--pink); border-color: var(--pink); color: #fff; }

/* パネル */
.panel { background: var(--card); border-radius: 18px; padding: 18px 16px; margin: 0 0 14px; box-shadow: 0 6px 20px rgba(160, 80, 160, .12); }
.panel-title { margin: 0 0 6px; font-size: 18px; }
.panel-error { border: 2px solid var(--pink); }
.step[hidden], [hidden] { display: none !important; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px;
  border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 700; font-size: 15px;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover { border-color: var(--pink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: linear-gradient(90deg, var(--pink), var(--lav-deep)); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(224, 56, 138, .3); }
.btn-primary:hover { filter: brightness(1.05); border-color: transparent; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-wide { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-row-between { justify-content: space-between; }
.btn-sheet { margin-top: 14px; border-color: var(--pink); color: var(--pink-deep); }

/* 入力 */
.input { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); width: 100%; min-height: 44px; }
.input:focus { outline: none; border-color: var(--lav); }
.search-row { display: grid; gap: 8px; margin-top: 10px; }
@media (min-width: 560px) { .search-row { grid-template-columns: 1fr 200px; } }

.pick-list { list-style: none; margin: 4px 0 0; padding: 0; max-height: 320px; overflow-y: auto; border: 2px solid var(--line); border-radius: 12px; }
.pick-list li { border-bottom: 1px solid #f7e6f2; }
.pick-list li:last-child { border-bottom: 0; }
.pick-item { display: block; width: 100%; text-align: left; background: #fff; border: 0; padding: 9px 12px; font: inherit; color: var(--ink); cursor: pointer; }
.pick-item:hover, .pick-item:focus { background: #fff1f8; outline: none; }
.pick-item[aria-selected="true"] { background: linear-gradient(90deg, #ffe0ef, #ece4ff); }
.pick-name { font-weight: 700; display: block; }
.pick-sub { font-size: 12px; color: var(--muted); display: block; }
.pick-empty { padding: 12px; color: var(--muted); font-size: 14px; }
.picked { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: linear-gradient(90deg, #ffe7f3, #efe8ff); }
.picked-label { display: block; font-size: 12px; color: var(--muted); }
.picked strong { font-size: 18px; margin-right: 6px; }

/* 質問 */
.quiz-no { margin: 0; color: var(--lav-deep); font-weight: 700; font-size: 13px; }
.quiz-text { margin: 4px 0 12px; font-size: 19px; line-height: 1.5; }
.quiz-options { display: grid; gap: 10px; }
.quiz-opt {
  text-align: left; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font: inherit; font-size: 15px;
  color: var(--ink); cursor: pointer; min-height: 52px;
}
.quiz-opt:hover, .quiz-opt:focus { border-color: var(--pink); outline: none; background: #fff6fb; }
.quiz-opt[aria-pressed="true"] { border-color: var(--pink); background: linear-gradient(90deg, #ffe0ef, #f0e8ff); font-weight: 700; }

/* チップ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  border: 2px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px;
  cursor: pointer; min-height: 40px;
}
.chip[aria-pressed="true"] { background: linear-gradient(90deg, var(--pink), var(--lav-deep)); color: #fff; border-color: transparent; font-weight: 700; }
.chip:disabled { opacity: .4; cursor: default; }
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; margin: 2px 4px 2px 0; }
.tag-res { background: #ffe0ef; color: var(--pink-deep); }
.tag-adm { background: #ece4ff; color: var(--lav-deep); }

/* 結果 */
.demo-note, .ai-error { border-radius: 12px; padding: 10px 14px; font-size: 13px; margin: 0 0 12px; }
.demo-note { background: #fff7d6; border: 2px dashed #f1c84b; }
.ai-error { background: #fff; border: 2px solid var(--pink); }
.result-block { text-align: center; }
.result-kicker { margin: 0; font-weight: 700; color: var(--lav-deep); font-size: 14px; }
.result-name { margin: 4px 0 0; font-size: 24px; line-height: 1.35; }
.result-series { margin: 0; font-size: 12px; color: var(--muted); }
.result-percent {
  margin: 4px 0 0; font-size: 72px; font-weight: 800; line-height: 1.1;
  background: linear-gradient(90deg, var(--pink-deep), var(--lav-deep)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.result-percent small { font-size: 32px; }
.result-rank { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.result-best { background: linear-gradient(180deg, #fff 0%, #fbf6ff 100%); }
.bars { display: grid; gap: 6px; margin: 10px auto 4px; max-width: 420px; }
.bar { display: grid; grid-template-columns: 3em 1fr 2.5em; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.bar-track { height: 12px; border-radius: 999px; background: #f6eaf3; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; width: 0; transition: width .6s ease; }
.bar-res { background: var(--res); }
.bar-adm { background: var(--adm); }
.bar-num { text-align: right; }
.bars-note { margin: 0; font-size: 11px; color: var(--muted); }
.reason { text-align: left; margin-top: 12px; }
.reason h4 { margin: 10px 0 2px; font-size: 14px; }
.reason p { margin: 0 0 4px; font-size: 15px; }
.reason .comment { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(90deg, #ffe7f3, #efe8ff); font-weight: 700; text-align: center; }
.reason .loading { color: var(--muted); font-size: 14px; text-align: center; padding: 10px 0; }
.loading::after { content: ""; display: inline-block; width: 1em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.runners { margin-top: 14px; text-align: left; }
.runners-title { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.runners-list { margin: 4px 0 0; padding-left: 0; list-style: none; display: grid; gap: 4px; }
.runners-list li { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 6px 10px; border-radius: 10px; background: #faf5ff; }
.runners-list b { color: var(--lav-deep); }

/* フッター */
.terms { max-width: 640px; margin: 0 auto; padding: 8px 20px 40px; font-size: 12px; color: var(--muted); }
.terms h2 { font-size: 14px; color: var(--ink); }
.terms-list { padding-left: 1.2em; }
.terms-foot { text-align: center; font-weight: 700; color: var(--ink); }

/* 結果画面のカード欄 */
.card-wait { margin: 10px 0 0; aspect-ratio: 4 / 5; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: linear-gradient(160deg, #fff1f8, #f3eeff); color: var(--muted); font-size: 14px; }
.card-error { margin-top: 10px; padding: 12px; border-radius: 10px; background: #faf5ff; text-align: center; color: var(--muted); }
.card-error p { margin: 0; }
.card-fig { margin: 10px 0 0; }
.card-fig img { width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--line); }
.card-actions { display: grid; gap: 8px; max-width: 420px; margin: 12px auto 0; }
.card-actions:empty { display: none; }
.card-x-hint { margin: 8px 0 0; text-align: center; font-size: 14px; font-weight: 700; color: var(--pink-deep); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(40px); opacity: 0; transition: .25s;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 60; max-width: 92vw; text-align: center; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 結果カード（幅1200・高さは最低1500で内容に合わせて伸びる。画面外で描いて PNG にする） ---------- */
.export-stage { position: fixed; left: -12000px; top: 0; pointer-events: none; }
.rcard {
  width: 1200px; min-height: 1500px; position: relative; overflow: hidden; font-family: var(--font); color: var(--ink);
  background: linear-gradient(160deg, #ffd6ea 0%, #fde9ff 48%, #dcd2ff 100%);
  padding: 64px 70px; display: flex; flex-direction: column;
}
.rcard-deco { position: absolute; border-radius: 50%; opacity: .55; }
.rcard-deco.d1 { width: 420px; height: 420px; right: -140px; top: -140px; background: radial-gradient(circle, #fff 0%, rgba(255, 255, 255, 0) 70%); }
.rcard-deco.d2 { width: 520px; height: 520px; left: -200px; bottom: -220px; background: radial-gradient(circle, #fff 0%, rgba(255, 255, 255, 0) 70%); }
.rcard-star { position: absolute; color: #fff; font-size: 44px; line-height: 1; text-shadow: 0 0 18px rgba(255, 255, 255, .9); }
.rcard-head { position: relative; text-align: center; }
.rcard-logo {
  margin: 0; font-size: 66px; font-weight: 800; letter-spacing: .03em; line-height: 1.2;
  background: linear-gradient(90deg, #e0388a, #7a5cf0); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rcard-logo-sub { margin: 6px 0 0; font-size: 24px; font-weight: 700; color: #7a5cf0; }
.rcard-box { position: relative; background: rgba(255, 255, 255, .9); border-radius: 36px; padding: 34px 44px; margin-top: 30px; box-shadow: 0 10px 30px rgba(160, 80, 160, .15); }
.rcard-kicker { margin: 0; font-size: 26px; font-weight: 800; color: #7a5cf0; }
.rcard-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.rcard-name { margin: 4px 0 0; font-weight: 800; line-height: 1.25; }
.rcard-series { margin: 4px 0 0; font-size: 20px; color: #8a6f96; }
.rcard-pct { margin: 0; font-weight: 800; line-height: 1; white-space: nowrap; background: linear-gradient(90deg, #e0388a, #7a5cf0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rcard-pct small { font-size: .45em; }
.rcard-bars { display: grid; gap: 10px; margin: 18px 0 0; }
.rcard-bar { display: grid; grid-template-columns: 90px 1fr 70px; align-items: center; gap: 14px; font-size: 24px; font-weight: 800; }
.rcard-bar .t { height: 20px; border-radius: 999px; background: #f6eaf3; overflow: hidden; }
.rcard-bar .f { display: block; height: 100%; border-radius: 999px; }
.rcard-bar .n { text-align: right; }
.rcard-comment { margin: 18px 0 0; font-size: 30px; font-weight: 800; line-height: 1.45; padding: 14px 22px; border-radius: 22px; background: linear-gradient(90deg, #ffe7f3, #efe8ff); text-align: center; }
.rcard-tags { margin: 14px 0 0; font-size: 22px; line-height: 1.6; }
.rcard-tags .lbl { font-weight: 800; margin-right: 8px; }
.rcard-tags .tg { display: inline-block; border-radius: 999px; padding: 2px 16px; margin: 4px 8px 4px 0; font-weight: 700; }
.rcard-tags .tg.r { background: #ffe0ef; color: #e0388a; }
.rcard-tags .tg.a { background: #ece4ff; color: #7a5cf0; }
.rcard-reasons { margin: 20px 0 0; display: grid; gap: 16px; text-align: left; }
.rcard-reason h5 { margin: 0 0 4px; font-size: 26px; font-weight: 800; }
.rcard-reason h5.rres { color: #e0388a; }
.rcard-reason h5.radm { color: #7a5cf0; }
.rcard-reason p { margin: 0; font-size: 27px; line-height: 1.65; }
.rcard-runners { margin: 12px 0 0; font-size: 22px; color: #6b5478; }
.rcard-foot { position: relative; margin-top: auto; text-align: center; font-size: 22px; line-height: 1.6; color: #6b5478; }
.rcard-foot b { color: #3a2147; }
