/* 東方キャラ性格診断 */
:root {
  --bg: #fbf6ee;
  --surface: #ffffff;
  --surface-2: #f4ecdf;
  --ink: #2a3050;
  --ink-2: #5d6482;
  --line: #e4d9c6;
  --accent: #cf2f6b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3ec;
  --nt: #5a48b5;  --nt-soft: #ebe7fa;
  --nf: #c22f6c;  --nf-soft: #fbe3ec;
  --sj: #2c6aa6;  --sj-soft: #e1eef9;
  --sp: #b96a0c;  --sp-soft: #fbecd2;
  --g: var(--accent); --g-soft: var(--accent-soft);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(42, 48, 80, .06), 0 8px 24px rgba(42, 48, 80, .07);
  --font-display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-body: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171a2b;
    --surface: #212540;
    --surface-2: #2a2f4f;
    --ink: #eef0fa;
    --ink-2: #a9aecb;
    --line: #363c62;
    --accent: #ff6f9f;
    --accent-ink: #2a0b18;
    --accent-soft: #46233a;
    --nt: #a99bff;  --nt-soft: #322d5c;
    --nf: #ff7eaa;  --nf-soft: #46233a;
    --sj: #7db9ee;  --sj-soft: #1f3a56;
    --sp: #f2b354;  --sp-soft: #47351a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
.g-NT { --g: var(--nt); --g-soft: var(--nt-soft); }
.g-NF { --g: var(--nf); --g-soft: var(--nf-soft); }
.g-SJ { --g: var(--sj); --g-soft: var(--sj-soft); }
.g-SP { --g: var(--sp); --g-soft: var(--sp-soft); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.35; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---- 枠 ---- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; max-width: 880px; width: 100%; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; }
/* 狭い画面で折り返すときは「東方キャラ / 性格診断」の切れ目(<wbr>)だけで折る */
.brand-text { word-break: keep-all; line-height: 1.25; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 18px;
}
.top-nav { display: flex; align-items: center; flex: none; }
.top-nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.top-nav a:hover { background: var(--surface-2); color: var(--ink); }
main { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 8px 16px 48px; outline: none; }
.foot { max-width: 880px; width: 100%; margin: 0 auto; padding: 20px 16px 36px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 12px; line-height: 1.8; }
.foot p + p { margin-top: 8px; }
.foot a { color: inherit; }

.eyebrow { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .14em; color: var(--accent); }
.lede { color: var(--ink-2); max-width: 36em; }
.note { color: var(--ink-2); font-size: 13px; }
.center { text-align: center; justify-content: center; }
.hint { color: var(--ink-2); font-size: 13px; }

/* ---- ボタン ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 8px 20px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-family: var(--font-display); font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background-color .12s ease, border-color .12s ease;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn[disabled] { opacity: .4; cursor: default; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* ---- トップ ---- */
.hero { padding: 12px 0 8px; }
.hero h1 { font-size: clamp(32px, 7vw, 52px); font-weight: 900; margin: 0 0 16px; letter-spacing: .01em; }
.hero .hint { margin-top: 14px; }
.wall {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 8px; margin: 32px 0;
}
.wall .portrait { width: 100%; height: auto; }
/* 押すとそのキャラの詳細が開く */
.wall-item { display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 14px; transition: transform .12s ease; }
.wall-item:hover { transform: translateY(-2px); }
.wall-item:hover .portrait { border-color: var(--accent); }
.portrait { display: block; background: #fff; border-radius: 14px; border: 1px solid var(--line); object-fit: cover; }
.how h2 { font-size: 20px; margin-bottom: 14px; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.steps li {
  counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; font-size: 14px; color: var(--ink-2); line-height: 1.75;
}
.steps li b { display: block; font-family: var(--font-display); color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.steps li::before {
  content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-family: var(--font-display); font-weight: 900; font-size: 14px; margin-bottom: 8px;
}

/* ---- 設問 ---- */
.quiz { max-width: 640px; margin: 0 auto; padding-top: 16px; }
.progress { display: flex; align-items: center; gap: 14px; }
.progress-num { font-family: var(--font-display); font-weight: 700; color: var(--ink-2); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-num b { color: var(--accent); font-size: 20px; }
.progress-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s ease; }
.question { display: block; font-size: clamp(20px, 4.6vw, 26px); font-weight: 700; line-height: 2; margin: 28px 0 24px; padding-top: .2em; min-height: 4.1em; text-wrap: wrap; line-break: strict; }
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  min-height: 54px; padding: 10px 18px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  transition: border-color .12s ease, background-color .12s ease, transform .12s ease;
}
.choice:hover { border-color: var(--accent); }
.choice:active { transform: scale(.99); }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice-key {
  display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 8px;
  background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums;
}
.choice.selected .choice-key { background: var(--accent); color: var(--accent-ink); }
.quiz-nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 20px; }

/* ---- 結果 ---- */
.result, .panel, .detail {
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.result { padding: 24px; margin-top: 12px; border-top: 6px solid var(--g); }
.result .eyebrow { color: var(--g); }
.result-head { display: flex; gap: 20px; align-items: center; margin: 10px 0 16px; }
.card-img { flex: none; width: 170px; height: auto; border-radius: 16px; background: #fff; }
.result-main { min-width: 0; }
.result-pre { color: var(--ink-2); font-size: 14px; margin-top: 10px; }
.result-main h1 { font-size: clamp(26px, 6vw, 38px); font-weight: 900; }
.result-main h2 { font-size: 24px; font-weight: 900; margin-top: 8px; }
.catch { font-family: var(--font-display); font-weight: 700; color: var(--g); margin-top: 2px; }
.sim { display: flex; align-items: baseline; gap: 2px; margin-top: 6px; font-family: var(--font-display); }
.sim-num { font-size: 34px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.sim-unit { font-weight: 700; }
.sim-label { margin-left: 8px; font-size: 13px; color: var(--ink-2); font-weight: 700; }
/* タイプの表示。押せる丸いボタンやリンクと紛れないよう、外側の塗りはなしで、4文字は角の立った札にする */
.type-badge {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--g); font-family: var(--font-display); font-weight: 700; font-size: 13px; line-height: 1.5;
}
.type-badge b { background: var(--g); color: var(--surface); border-radius: 4px; padding: 1px 8px; letter-spacing: .08em; font-weight: 900; }
.type-badge.big { font-size: 15px; }
.type-badge.big b { font-size: 16px; padding: 2px 10px; }
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 12px; }
.tag {
  display: inline-block; padding: 2px 11px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--surface);
}
/* 主属性。押せる作品リンク(.work.link)と見分けがつくよう、塗りはベージュにしてタイプ色は左の線だけ */
.tag.strong { border: 0; border-left: 3px solid var(--g); border-radius: 4px; background: var(--surface-2); color: var(--ink); padding: 3px 10px 3px 9px; }
/* 主属性のあとに並べるサブタイプ。主属性より一段控えめに、角の立った線だけの札にする */
.tags-sub { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; } /* 「サブ」と札は途中で折り返さず、まとめて次の行へ */
.tags-sub-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--ink-2); opacity: .75; }
.tag.sub { border-radius: 4px; background: transparent; color: var(--ink-2); padding: 2px 9px; }
.desc { font-size: 16px; }
.type-blurb { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-size: 14px; color: var(--ink-2); }
.type-blurb b { color: var(--ink); font-family: var(--font-display); }
.more { margin-top: 12px; font-size: 14px; }
.more a { color: var(--g); font-weight: 600; }

.panel { padding: 20px 24px 24px; margin-top: 16px; }
.panel h2 { font-size: 19px; margin-bottom: 6px; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; flex-wrap: wrap; }
.subtype { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; font-weight: 600; color: var(--ink-2); }

/* 軸バー */
.axes { display: grid; gap: 10px; }
.axis { display: grid; grid-template-columns: 5.4em 1fr 5.4em; align-items: center; gap: 10px; }
.axis-sub:nth-of-type(5) { margin-top: 10px; padding-top: 16px; border-top: 1px dashed var(--line); }
.axis-label { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.axis-label.neg { text-align: right; }
.axis-label.on { color: var(--ink); }
.axis-label b { font-family: var(--font-display); font-weight: 900; color: var(--accent); }
.axis-track { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); }
.axis-mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--line); border-radius: 2px; }
.axis-dot {
  position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; transform: translate(-50%, -50%);
}
.axis-dot.user { background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.axis-dot.chara { background: var(--surface); border: 3px solid var(--ink-2); width: 18px; height: 18px; }
/* ドパガキモードでサイコロで決めた軸の「あなた」の印。角の丸い四角に目を打ったサイコロ */
.axis-dot.user.dice { width: 20px; height: 20px; border-radius: 5px; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); display: grid; place-items: center; z-index: 1; }
.axis-dot.dice svg { width: 100%; height: 100%; fill: var(--accent); }
.axis-dot.inline { position: static; display: inline-block; transform: none; flex: none; margin-left: 8px; }
.axis-dot.dice.inline { display: inline-grid; }
.axis-dot.inline:first-child { margin-left: 0; }

/* キャラタイル */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; cursor: pointer; text-align: center;
  transition: transform .12s ease, border-color .12s ease;
}
.tile:hover { transform: translateY(-2px); border-color: var(--g); }
.tile .portrait { width: 100%; max-width: 107px; height: auto; border: 0; border-radius: 10px; }
.tile-name { font-size: 12px; font-weight: 700; line-height: 1.35; font-family: var(--font-display); overflow-wrap: anywhere; }
.tile-sim { font-size: 11px; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- 図鑑 ---- */
.zukan-head { padding: 20px 0 4px; }
.zukan-head h1 { font-size: clamp(26px, 6vw, 38px); font-weight: 900; margin: 4px 0 8px; }
.search { display: block; margin-top: 16px; max-width: 360px; }
.search input {
  width: 100%; min-height: 46px; padding: 8px 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit;
}
.search input::placeholder { color: var(--ink-2); }
.zgroup { margin-top: 32px; }
.zgroup-title { font-size: 22px; font-weight: 900; color: var(--g); display: flex; align-items: baseline; gap: 12px; padding-bottom: 8px; border-bottom: 3px solid var(--g); }
.zgroup-title small { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.ztype { margin-top: 20px; }
.ztype-head { display: flex; align-items: center; gap: 10px; }
.count { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.ztype-blurb { font-size: 14px; color: var(--ink-2); margin-top: 4px; }

/* ---- 詳細ダイアログ ---- */
.detail {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 22px; color: var(--ink);
  border-top: 6px solid var(--g); overflow: auto;
}
.detail::backdrop { background: rgba(20, 22, 40, .55); }
.detail .card-img { width: 136px; }
.detail .axes { margin-top: 16px; }
.close {
  position: sticky; top: 0; float: right; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); font-size: 20px; line-height: 1; cursor: pointer; z-index: 1;
}
.close:hover { background: var(--surface-2); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 999px; font-size: 14px; font-weight: 600;
  transition: opacity .2s ease, transform .2s ease; z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .wall { grid-template-columns: repeat(6, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .result { padding: 18px; }
  .panel { padding: 18px; }
  .result-head { gap: 14px; }
  .card-img { width: 120px; }
  .detail .card-img { width: 104px; }
  .axis { grid-template-columns: 4.6em 1fr 4.6em; gap: 8px; }
  .axis-label { font-size: 12px; }
  .brand-text { font-size: 15px; }
  .brand { gap: 8px; }
  .top { gap: 8px; }
  .top-nav a { padding: 8px 8px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- ドパガキモード ---- */
.dopa {
  margin-top: 22px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--dopa-bg, #fff3c4); border: 2px dashed var(--dopa-line, #e0a200); color: var(--dopa-ink, #5a4200);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
}
.dopa .cta { margin-top: 0; }
.dopa-text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 1.6; }
.dopa-text b { font-family: var(--font-display); font-size: 18px; }
.dopa-text strong { font-family: var(--font-display); color: var(--dopa-strong, #c1121f); white-space: nowrap; } /* 「結果は絶対間違ってるぞ！！」は途中で割らない */
.btn.dopa-btn { background: var(--dopa-strong, #c1121f); border-color: var(--dopa-strong, #c1121f); color: #fff; }
.dopa-banner {
  margin: 12px 0 14px; padding: 10px 14px; border-radius: 14px; font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 1.6;
  background: var(--dopa-bg, #fff3c4); border: 2px dashed var(--dopa-line, #e0a200); color: var(--dopa-ink, #5a4200);
}
.dopa-banner b { display: inline-block; margin-right: 8px; padding: 1px 10px; border-radius: 999px; background: var(--dopa-strong, #c1121f); color: #fff; font-size: 13px; transform: rotate(-2deg); }
.dopa-banner small { display: block; font-weight: 600; font-size: 12px; opacity: .8; }
@media (prefers-color-scheme: dark) {
  :root { --dopa-bg: #3b3010; --dopa-line: #c79a2a; --dopa-ink: #ffe08a; --dopa-strong: #ff6b6b; }
}

/* ---- 共有 ---- */
.share-row { display: flex; flex-wrap: wrap; gap: 10px; }
.share-preview { display: block; width: 100%; max-width: 480px; height: auto; margin-top: 14px; border-radius: 12px; border: 1px solid var(--line); }
.share-toggle { display: flex; justify-content: center; align-items: center; gap: 10px; width: 100%; padding: 16px 20px; font-size: 18px; border-radius: 16px; }
.share-toggle .dd-arrow { display: inline-block; transition: transform .25s ease; }
.share-toggle.is-open .dd-arrow { transform: rotate(180deg); }
.share-body { padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
/* 開閉アニメーション(高さ 0 → 中身の高さ) */
.collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .32s ease; }
.collapse.open { grid-template-rows: 1fr; }
.collapse > .collapse-inner { min-height: 0; overflow: hidden; opacity: 0; transition: opacity .25s ease; }
.collapse.open > .collapse-inner { opacity: 1; }
.share-kind { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); align-self: flex-start; }
.share-kind .kind {
  border: 0; background: transparent; color: var(--ink-2); font-family: var(--font-display); font-weight: 700; font-size: 13px;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.share-kind .kind.selected { background: var(--g); color: var(--surface); }
.share-body .share-preview { margin-top: 0; }

/* ---- 週刊東方キャラクターへのボタン ---- */
.btn.garakuta {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin-top: 16px; padding: 12px 16px;
  text-align: left; border: 2px solid var(--g); background: var(--g-soft); color: var(--ink);
}
.garakuta-eyebrow { font-size: 13px; color: var(--g); }
.garakuta-title { font-size: 15px; }
.garakuta-title::after { content: "→"; display: inline-block; margin-left: 6px; transition: transform .15s ease; }
/* ホバーは色を反転させず、背景を少し変えて矢印を動かす(文字は常に読める色のまま) */
.btn.garakuta:hover { background: var(--surface); border-color: var(--g); }
.btn.garakuta:hover .garakuta-title::after { transform: translateX(4px); }

/* ---- 相性: 赤い糸でつながる2人 ---- */
.pair { display: flex; align-items: center; gap: 6px; margin: 8px 0 4px; }
.pair-side {
  flex: 0 0 auto; width: 150px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; cursor: pointer; text-align: center;
  transition: transform .12s ease, border-color .12s ease;
}
.pair-side:hover { transform: translateY(-2px); border-color: var(--thread, #e0245e); }
.pair-side .portrait { width: 110px; height: auto; border: 0; border-radius: 12px; }
.pair-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.pair-role { font-size: 11px; color: var(--ink-2); font-weight: 600; line-height: 1.3; }
.pair-link { position: relative; flex: 1 1 auto; min-width: 70px; height: 90px; display: grid; place-items: center; }
.pair-link svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pair-link .thread { fill: none; stroke: var(--thread, #e0245e); stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pair-heart {
  position: relative; z-index: 1; font-size: 34px; line-height: 1; color: var(--thread, #e0245e);
  text-shadow: 0 0 0 3px var(--surface); background: var(--surface); border-radius: 50%; padding: 2px 6px;
  animation: heartbeat 1.6s ease-in-out infinite;
}
.pair-score {
  position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--font-display); font-weight: 700; font-size: 12px; color: var(--thread, #e0245e);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
}
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.sub-head { margin-top: 14px; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--ink-2); }
.tiles.small { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-top: 8px; }
.tiles.small .tile { padding: 6px 4px 8px; border-radius: 12px; }
.tiles.small .tile .portrait { max-width: 64px; }
.tiles.small .tile-name { font-size: 11px; }
.tiles.small .tile-sim { font-size: 10px; }
@media (prefers-color-scheme: dark) { :root { --thread: #ff6b8f; } }
@media (prefers-reduced-motion: reduce) { .pair-heart { animation: none; } }
@media (max-width: 640px) {
  .pair-side { width: 112px; padding: 8px 6px 10px; }
  .pair-side .portrait { width: 84px; }
  .pair-name { font-size: 12px; }
  .pair-link { min-width: 56px; height: 80px; }
  .pair-heart { font-size: 28px; }
  .pair-score { font-size: 11px; padding: 1px 8px; }
}

/* ---- 設問のふりがな ---- */
.question ruby { ruby-align: center; }
.question rt { font-size: .48em; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }

/* ---- キャラ名のふりがなと主な登場原作 ---- */
.result-main h1 rt, .result-main h2 rt { font-size: .38em; font-weight: 700; color: var(--ink-2); letter-spacing: .04em; }
.result-main h1, .result-main h2 { line-height: 1.5; }
.works { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 12px; font-size: 13px; }
.works-label { font-family: var(--font-display); font-weight: 700; color: var(--ink-2); margin-right: 2px; }
.work { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-weight: 600; }
.work.link { text-decoration: none; background: var(--g-soft); color: var(--g); border: 1px solid transparent; }
.work.link::after { content: " ↗"; font-size: 11px; }
.work.link:hover { border-color: var(--g); }

/* ---- リザルトの整理: 2大ボタンと折りたたみ ---- */
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; align-items: stretch; }
.hero-actions .btn.garakuta { margin-top: 0; align-items: center; justify-content: center; text-align: center; }
.hero-actions .share-toggle { font-size: 16px; height: 100%; }
.hero-actions .collapse { grid-column: 1 / -1; }
.acc { margin-top: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.acc-head {
  width: 100%; border: 0; background: transparent; color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  font-family: var(--font-display); font-weight: 700; font-size: 16px; text-align: left; border-radius: 16px;
}
.acc-head:hover { background: var(--surface-2); }
.acc-head .acc-sub { font-weight: 600; font-size: 12px; color: var(--ink-2); margin-left: auto; text-align: right; }
.acc-title { display: inline-flex; align-items: center; gap: 8px; }
/* ▼はタイトルのすぐ横に、丸い印にして「押すと開く」ことが分かるようにする */
.acc-head .acc-arrow {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--g-soft); color: var(--g); font-size: 14px; line-height: 1; transition: transform .25s ease;
}
.acc-head.is-open .acc-arrow { transform: rotate(180deg); }
.acc-body { padding: 0 18px 18px; }
.acc-body h3 { font-size: 14px; color: var(--ink-2); margin: 12px 0 8px; }
.acc-body .works { margin-top: 4px; }
.acc-body .tiles.small { margin-top: 0; }
@media (max-width: 640px) {
  .hero-actions { grid-template-columns: 1fr; }
  .acc-head { flex-wrap: wrap; row-gap: 4px; }
  .acc-head .acc-sub { flex-basis: 100%; margin-left: 0; text-align: left; }
}
.result .acc { margin-top: 12px; background: var(--surface-2); border-color: transparent; }
.result .acc-head:hover { background: var(--line); }

/* ---- 結果発表の演出 ---- */
body.no-scroll { overflow: hidden; }
.reveal {
  position: fixed; inset: 0; z-index: 60; background: #0b0d1a; color: #fff; overflow: hidden;
  display: grid; place-items: center; isolation: isolate;
}
.reveal.out { animation: reveal-out .45s steps(7) forwards; }
@keyframes reveal-out { to { opacity: 0; } }
.reveal .spot {
  position: absolute; left: 50%; top: 50%; width: 70vmax; height: 70vmax; margin: -35vmax 0 0 -35vmax; border-radius: 50%;
  /* ぼかさない、縁のくっきりした円いスポット */
  background: radial-gradient(circle, rgba(255, 236, 190, .34) 0 30%, transparent 30%);
  mix-blend-mode: screen; pointer-events: none;
}
/* 約16fps のコマ送り(1.5秒を24コマ、2.1秒を34コマ) */
.reveal .spot.a { animation: swirl 1.5s steps(24) infinite; }
.reveal .spot.b { animation: swirl 2.1s steps(34) infinite reverse; opacity: .8; }
@keyframes swirl {
  from { transform: rotate(0deg) translateX(22vmax) rotate(0deg); }
  to { transform: rotate(360deg) translateX(22vmax) rotate(-360deg); }
}
.reveal.lock .spot.a { animation-duration: .75s; animation-timing-function: steps(12); }
.reveal.lock .spot.b { animation-duration: .75s; animation-timing-function: steps(12); }
.reveal.shine .spot { animation: none; transform: none; opacity: 1; }
.reveal.shine .spot.b { background: radial-gradient(circle, rgba(255, 255, 255, .5) 0 24%, rgba(255, 236, 190, .3) 24% 34%, transparent 34%); }
.reveal-stage { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding: 24px; }
.reveal-defs { position: absolute; width: 0; height: 0; }
.reveal-img {
  width: min(44vw, 260px); height: auto; filter: brightness(0) drop-shadow(0 0 12px rgba(0, 0, 0, .6));
  transition: filter .45s steps(7), transform .45s steps(7);
}
.reveal-img.morph { filter: url(#munyo) brightness(0); transition: none; }
.reveal.shine .reveal-img { filter: brightness(1) drop-shadow(0 0 24px rgba(255, 240, 200, .9)); transform: scale(1.12); }
.reveal-text { font-family: var(--font-display); font-weight: 900; font-size: clamp(20px, 5vw, 30px); letter-spacing: .04em; }
.reveal-text .dots i { font-style: normal; animation: blink 1.2s steps(2) infinite; }
.reveal-text .dots i:nth-child(2) { animation-delay: .2s; }
.reveal-text .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .2; } 30% { opacity: 1; } }
.reveal-name { font-family: var(--font-display); font-weight: 900; font-size: clamp(28px, 7vw, 44px); min-height: 1.3em; opacity: 0; transform: translateY(10px); transition: opacity .4s steps(6) .15s, transform .4s steps(6) .15s; color: #ffe9b8; text-shadow: 0 0 18px rgba(255, 220, 150, .6); }
.reveal.shine .reveal-name { opacity: 1; transform: none; }
.reveal.shine::after { content: ""; position: absolute; inset: 0; background: #fff; animation: flash .5s steps(8) forwards; pointer-events: none; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }
.reveal-skip { position: absolute; right: 16px; bottom: 16px; z-index: 2; background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 8px 16px; font-family: var(--font-display); font-weight: 700; cursor: pointer; }

/* ---- リザルト: スペルカード ----
   結果カードだけを「札」にし、ほかの節は箱をやめて余白と札色の短い罫で区切る */
.result.spell-card {
  position: relative; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); border-top: 0;
  border-left: 12px solid var(--g); padding: 26px 28px 26px 26px;
}
.result.spell-card::before {
  content: attr(data-type); position: absolute; right: -8px; top: -22px; z-index: 0;
  font-family: var(--font-display); font-weight: 900; font-size: 168px; line-height: 1; letter-spacing: -.02em;
  color: transparent; -webkit-text-stroke: 2px var(--g); opacity: .13; pointer-events: none; user-select: none;
}
.result.spell-card > * { position: relative; z-index: 1; }
.spell { font-family: var(--font-display); font-weight: 700; color: var(--g); font-size: 16px; letter-spacing: .02em; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.spell small { font-size: 12px; font-weight: 700; color: var(--ink-2); letter-spacing: .12em; }
.spell-card .result-head { align-items: flex-start; margin: 14px 0 14px; gap: 24px; }
.spell-card .card-img { width: 190px; border-radius: 8px; border: 1px solid var(--line); }
.spell-card .result-pre { margin: 2px 0 14px; }
.spell-card .result-main h1 { font-size: clamp(34px, 7vw, 50px); line-height: 1.3; letter-spacing: .01em; margin-top: 0; }
.spell-card .result-main h1 rt { font-size: .34em; }
.spell-card .catch { color: var(--ink); font-size: 17px; margin-top: 4px; }
.match { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.bullets { display: inline-flex; gap: 5px; }
.bullets i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--g); background: transparent; box-sizing: border-box; }
.bullets i.on { background: var(--g); }
.bullets i.half { background: linear-gradient(90deg, var(--g) 50%, transparent 50%); }
.match b { font-family: var(--font-display); font-weight: 900; font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.match span { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.spell-card .tags { gap: 8px; margin: 2px 0 14px; }
.spell-card .tag.strong { border-radius: 3px; }
.spell-card .desc { max-width: 40em; }
.spell-card .hero-actions { margin-top: 20px; }
.spell-card .hero-actions .btn.garakuta { border-radius: 10px; background: transparent; }
.spell-card .hero-actions .share-toggle { border-radius: 10px; }
.spell-card .acc { background: transparent; border: 0; border-top: 1px dashed var(--line); border-radius: 0; margin-top: 16px; }
.spell-card .acc-head { padding: 14px 4px 4px; border-radius: 0; }
.spell-card .acc-head:hover { background: transparent; color: var(--g); }
.panel.plain { background: transparent; border: 0; box-shadow: none; border-radius: 0; padding: 26px 4px 6px; margin-top: 6px; }
.panel.plain h2 { font-size: 19px; display: flex; align-items: center; gap: 12px; }
.panel.plain h2::before { content: ""; width: 14px; height: 4px; border-radius: 2px; background: var(--g); }
.panel.plain .legend { margin-top: 8px; }
/* 「ほかの近いキャラ」。見出しと紛れて押せることに気づきにくかったので、枠のある押せる帯にする */
.acc.plain-acc { background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; margin-top: 18px; transition: border-color .12s ease; }
.acc.plain-acc:hover { border-color: var(--g); }
.acc.plain-acc .acc-head { padding: 14px 16px; border-radius: 12px; font-size: 17px; }
.acc.plain-acc .acc-head:hover { background: transparent; }
.acc.plain-acc .acc-body { padding: 0 16px 16px; }
@media (max-width: 640px) {
  .result.spell-card { padding: 20px 16px; border-left-width: 8px; }
  .result.spell-card::before { font-size: 112px; top: -12px; right: -6px; }
  .spell-card .result-head { gap: 14px; }
  .spell-card .card-img { width: 128px; }
  .match { gap: 8px; }
  .bullets { gap: 4px; }
  .bullets i { width: 11px; height: 11px; }
}
.spell-card .result-main h1 ruby { ruby-align: center; }
.spell-card .result-main h1 rt { letter-spacing: .04em; }
.spell-card .hero-actions { grid-template-columns: 1fr; }
.spell-card .acc-body .btn.garakuta { margin-top: 16px; border-radius: 10px; background: transparent; }
.spell-card .btn.garakuta:hover { background: var(--g-soft); }
.foot .tech { font-size: 11px; opacity: .85; }

/* SNS ごとの色(Bluesky・LINE) */
.btn.bsky { background: #1185fe; border-color: #1185fe; color: #fff; }
.btn.line { background: #06c755; border-color: #06c755; color: #fff; }
.btn.bsky:hover, .btn.line:hover { filter: brightness(1.06); }
