/* ミカタ 共通スタイル。モバイル最優先 (9:16 の画面で全部完結する)。 */

:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #1f1b16;
  --muted: #6f675e;
  --line: #e8e1d7;
  --accent: #ff6b4a;
  --accent-ink: #ffffff;
  --accent-soft: #ffe7df;
  --sub: #2a9d8f;
  --sub-soft: #dff3f0;
  --danger: #c0392b;
  --radius: 16px;
  --shadow: 0 8px 28px rgba(31, 27, 22, .08);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.6;
  font-feature-settings: "palt";
}
a { color: var(--sub); }
button { font-family: inherit; }
img { max-width: 100%; }

.wrap { max-width: 520px; margin: 0 auto; padding: 20px 18px 56px; }
.hidden { display: none !important; }

/* ── ヘッダー ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0 14px;
}
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
.brand strong { font-size: 20px; letter-spacing: .04em; }
.brand small { color: var(--muted); font-size: 12px; }
.topbar .links a { font-size: 13px; margin-left: 12px; }

/* ── ヒーロー ── */
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 30px; line-height: 1.25; margin: 0 0 8px; letter-spacing: .01em; }
.hero h1 span { color: var(--accent); }
.hero .lead { color: var(--muted); margin: 0 0 18px; font-size: 15px; }
.hero .example {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 0 0 20px; box-shadow: var(--shadow);
}
.hero .example .row { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.hero .example .row b { color: var(--ink); font-size: 14px; }
.hero .example .arrow { color: var(--muted); font-size: 12px; margin: 4px 0; }
.hero .example .head { font-size: 22px; font-weight: 800; letter-spacing: .01em; }

/* ── ボタン ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 16px; font-weight: 700; text-decoration: none; line-height: 1;
  transition: transform .06s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(255, 107, 74, .35); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-sub { background: var(--sub); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 10px 14px; font-size: 14px; }
.btn-line { background: #06c755; color: #fff; box-shadow: 0 6px 18px rgba(6, 199, 85, .3); }
.btn-line::before { content: ""; width: 20px; height: 20px; border-radius: 4px; background: #fff; -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 3C7 3 3 6.3 3 10.4c0 3.6 3.2 6.6 7.5 7.2.3.1.7.2.8.5.1.3.1.6 0 .9l-.1.8c0 .2-.2.9.8.5s5.4-3.2 7.4-5.5c1.3-1.5 1.6-2.7 1.6-4.4C21 6.3 17 3 12 3z'/></svg>") center/contain no-repeat; mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 3C7 3 3 6.3 3 10.4c0 3.6 3.2 6.6 7.5 7.2.3.1.7.2.8.5.1.3.1.6 0 .9l-.1.8c0 .2-.2.9.8.5s5.4-3.2 7.4-5.5c1.3-1.5 1.6-2.7 1.6-4.4C21 6.3 17 3 12 3z'/></svg>") center/contain no-repeat; }
.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid #f0c8c2; }

/* ── セクション/カード ── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h2 { font-size: 18px; margin: 0 0 6px; }
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.section-title { font-size: 13px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; margin: 22px 0 8px; }

/* ── 16 ボタン ── */
.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.type-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; padding: 7px 2px 8px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card);
  font-size: 13px; font-weight: 800; letter-spacing: .06em; cursor: pointer; color: var(--ink);
  transition: all .12s ease;
}
.type-btn img { display: block; width: 54px; height: 54px; object-fit: contain; }
.type-btn span { line-height: 1.2; }
.type-btn:hover { border-color: var(--accent); }
.type-btn.selected { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(255, 107, 74, .35); }
.type-grid + .center { margin-top: 14px; }
.center { text-align: center; }
.linkish { background: none; border: 0; color: var(--sub); text-decoration: underline; cursor: pointer; font-size: 14px; padding: 6px; }

/* ── 設問 ── */
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 6px 0 18px; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s ease; }
.q-num { color: var(--muted); font-size: 13px; letter-spacing: .06em; }
.q-text { font-size: 21px; font-weight: 800; margin: 4px 0 18px; line-height: 1.4; }
.q-options { display: grid; gap: 10px; }
.opt {
  text-align: left; padding: 16px 16px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--card); font-size: 16px; cursor: pointer; color: var(--ink);
  transition: all .12s ease;
}
.opt:hover { border-color: var(--accent); }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.q-nav { display: flex; justify-content: space-between; margin-top: 16px; }

/* ── フォーム ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input-wrap { position: relative; }
.input-wrap .at { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
input[type=text], input[type=password] {
  width: 100%; padding: 14px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  font-size: 16px; font-family: inherit; background: #fff; color: var(--ink); outline: none;
}
input.with-at { padding-left: 32px; }
input:focus { border-color: var(--accent); }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--muted); }
.check input { margin-top: 3px; }
.error { color: var(--danger); font-size: 13px; margin: 8px 0 0; min-height: 1em; }
.notice { background: var(--sub-soft); color: #145c53; border-radius: 12px; padding: 12px 14px; font-size: 14px; }

/* ── 結果 ── */
.result-card {
  background: linear-gradient(160deg, #fff5f1 0%, #ffffff 55%, #eef8f6 100%);
  border: 1px solid var(--line); border-radius: 22px; padding: 26px 22px 20px; box-shadow: var(--shadow);
  margin-bottom: 14px; position: relative; overflow: hidden;
}
.result-card .kicker { font-size: 12px; color: var(--muted); letter-spacing: .14em; }
.result-card .headline { font-size: 30px; font-weight: 900; line-height: 1.25; margin: 6px 0 16px; letter-spacing: .01em; }
.result-card .headline .type { color: var(--accent); }
.type-character { display: block; object-fit: contain; }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.result-heading-copy { min-width: 0; flex: 1; }
.result-heading > .headline { flex: 1; min-width: 0; }
.result-character-main { width: clamp(96px, 26vw, 140px); height: clamp(96px, 26vw, 140px); flex: 0 0 auto; }
.result-heading .headline { font-size: 27px; }
.card-title-with-character { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title-with-character h2 { flex: 1; }
.result-character-small { width: 76px; height: 76px; flex: 0 0 auto; margin: -10px 0 -4px; }
.done-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.done-result-heading .headline { min-width: 0; flex: 1; }
.done-character { width: 132px; height: 132px; flex: 0 0 auto; }
.types { display: flex; gap: 22px; margin: 0 0 16px; }
.types div { font-size: 13px; color: var(--muted); }
.types b { display: block; font-size: 22px; color: var(--ink); letter-spacing: .06em; }
.bars { display: grid; gap: 9px; margin: 0 0 16px; }
.bar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.bar .track { height: 12px; background: #eee7dd; border-radius: 999px; overflow: hidden; position: relative; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--accent), #ff9a7b); border-radius: 999px; }
.bar .self { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--ink); border-radius: 2px; opacity: .55; }
.bar .pct { text-align: right; font-weight: 700; }
.gapline { background: rgba(255,255,255,.7); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.gapline .lab { font-size: 12px; color: var(--muted); }
.count { margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend { font-size: 11px; color: var(--muted); margin-top: -8px; margin-bottom: 12px; }
.body-text { font-size: 15px; line-height: 1.8; }
.body-text h3 { font-size: 14px; margin: 14px 0 4px; color: var(--muted); }

/* ── 共有 ── */
.share-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.share-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 10px;
  border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer; color: var(--ink);
}
.share-btn.x { background: #000; color: #fff; border-color: #000; }
.share-btn.line { background: #06c755; color: #fff; border-color: #06c755; }
.share-btn.instagram { background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7); color: #fff; border-color: transparent; }
.share-btn.native { background: var(--sub); color: #fff; border-color: var(--sub); }
.share-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ── 表 ── */
table.stats { width: 100%; border-collapse: collapse; font-size: 13px; }
table.stats th, table.stats td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.stats th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.stats td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--accent-soft); color: #9a3b28; }
.pill.line { background: #dff7e8; color: #17703d; }
.pill.x { background: #e9e9e9; color: #222; }
.pill.instagram { background: #fce4f1; color: #a01860; }
.pill.native { background: var(--sub-soft); color: #145c53; }
.pill.copy { background: #eee7dd; color: #5a4d3c; }

/* ── フッター ── */
footer { margin-top: 36px; color: var(--muted); font-size: 12px; line-height: 1.7; }
footer a { color: var(--muted); }

/* ── ユーティリティ ── */
.mt { margin-top: 14px; }
.mt-lg { margin-top: 26px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
details summary { cursor: pointer; font-weight: 700; font-size: 14px; }
details { margin-top: 12px; }
canvas.preview { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); display: block; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 50; white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ── フィードバック ── */
.fb-catch { display: inline-block; background: var(--accent-soft); color: #9a3b28; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.traits { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.traits li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.traits li::before { content: "👀 "; }
.tipbox { background: var(--sub-soft); color: #145c53; border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-top: 12px; line-height: 1.7; }
.tipbox b { display: block; font-size: 12px; letter-spacing: .1em; margin-bottom: 2px; }
.axis-list { display: grid; gap: 10px; }
.axis-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.axis-item .head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; font-size: 15px; }
.axis-item .head small { color: var(--muted); font-weight: 600; font-size: 12px; }
.axis-item .cmt { font-size: 14px; margin-top: 4px; }
.axis-item .cmp { font-size: 13px; color: var(--muted); margin-top: 4px; }
.axis-item .split { font-size: 12px; color: #9a3b28; margin-top: 4px; }
.otherflips { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* ══════════════════════════════════════════════════════════════════════════
   アニメーション (かわいい印象づくり)。動きは全部ここ。
   prefers-reduced-motion のときは最後のブロックで全部止める。
   ══════════════════════════════════════════════════════════════════════ */

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); } }
@keyframes inRight { from { opacity: 0; transform: translateX(48px); } to { opacity: 1; transform: none; } }
@keyframes inLeft { from { opacity: 0; transform: translateX(-48px); } to { opacity: 1; transform: none; } }
@keyframes outLeft { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(-40px); } }
@keyframes outRight { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(40px); } }
@keyframes qLeave { to { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes qEnter { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes bounce { 0% { transform: scale(1); } 35% { transform: scale(.94); } 70% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-8px) rotate(1.5deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes dots { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes heroPop { 0% { opacity: 0; transform: translateY(20px) scale(.9); } 100% { opacity: 1; transform: none; } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(255,107,74,.45); } 100% { box-shadow: 0 0 0 16px rgba(255,107,74,0); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes barGrow { from { width: 0; } }

/* 画面遷移 (motion.js swapSection) */
.anim-in-right { animation: inRight .36s cubic-bezier(.2,.8,.2,1) both; }
.anim-in-left { animation: inLeft .36s cubic-bezier(.2,.8,.2,1) both; }
.anim-out-left { animation: outLeft .22s ease-in both; }
.anim-out-right { animation: outRight .22s ease-in both; }

/* 設問カードの差し替え */
.q-leave { animation: qLeave .16s ease-in both; }
.q-enter { animation: qEnter .3s cubic-bezier(.2,.8,.2,1) both; }
.bounce { animation: bounce .32s ease-out; }

/* 子要素を順にポップイン */
.stagger > * { animation: popIn .38s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * var(--stagger, 40ms)); }

/* カード類は出たときにふわっと */
.card, .result-card { animation: fadeUp .4s ease both; }
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .45s ease, transform .45s cubic-bezier(.2,.8,.2,1); }
.reveal.revealed { opacity: 1; transform: none; }

/* キャラはぷかぷか */
.type-character, .loader-char, .hero-chars img { animation: floaty 3.2s ease-in-out infinite; }
.result-character-main { animation: popIn .5s cubic-bezier(.2,.8,.2,1) both, floaty 3.2s ease-in-out .5s infinite; }
.done-character { animation: popIn .5s cubic-bezier(.2,.8,.2,1) both, floaty 3.2s ease-in-out .5s infinite; }
.type-btn img { transition: transform .15s ease; }
.type-btn:hover img, .type-btn.selected img { animation: wiggle .4s ease-in-out; }

/* 見出し・数字 */
.result-card .headline { animation: popIn .5s cubic-bezier(.2,.8,.2,1) .1s both; }
.result-card .types b { animation: fadeUp .4s ease .25s both; }
.bar .fill { transition: width .9s cubic-bezier(.2,.8,.2,1); }
.gapline { animation: fadeUp .4s ease .9s both; }

/* ヒーローのキャラ行進 */
.hero-chars { display: flex; justify-content: center; gap: 2px; margin: 6px 0 14px; }
.hero-chars img { width: 64px; height: 64px; object-fit: contain; animation: heroPop .5s cubic-bezier(.2,.8,.2,1) both, floaty 3.4s ease-in-out infinite; animation-delay: calc(var(--i) * 80ms), calc(var(--i) * 80ms + .5s); }
.hero h1 { animation: fadeUp .5s ease both; }
.hero .lead { animation: fadeUp .5s ease .1s both; }
.hero .example { animation: popIn .5s cubic-bezier(.2,.8,.2,1) .2s both; }
.hero .btn-primary { animation: fadeUp .5s ease .3s both; }

/* ボタン */
.btn { transition: transform .12s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease, opacity .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.96); }
.btn-primary:not([disabled]) { animation: pulseRing 2.4s ease-out infinite; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-ghost.is-busy::after, .btn-danger.is-busy::after { border-color: rgba(0,0,0,.15); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.share-btn { transition: transform .12s ease, filter .2s ease; }
.share-btn:active { transform: scale(.96); }
.share-btn.is-busy { filter: saturate(.4); opacity: .7; pointer-events: none; }
.opt { transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.opt:active { transform: scale(.98); }
.type-btn { transition: transform .15s cubic-bezier(.2,.8,.2,1), border-color .12s, background .12s, color .12s; }
.type-btn:hover { transform: translateY(-2px); }
.type-btn.selected { transform: scale(1.04); }

/* トースト */
.toast.show { animation: toastIn .26s cubic-bezier(.2,.8,.2,1) both; }

/* ローダー */
.loader { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 0 18px; }
.loader-char { width: 120px; height: 120px; object-fit: contain; }
.dots { display: flex; gap: 7px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: block; animation: dots 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
.loader-label { font-size: 13px; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, #f1ebe2 25%, #faf7f2 50%, #f1ebe2 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 10px; }

/* 2 人待ち (結果が出る前) */
.waiting { display: flex; align-items: center; gap: 14px; margin: 10px 0 4px; }
.waiting .slots { display: flex; gap: 8px; }
.slot { width: 46px; height: 46px; border-radius: 50%; border: 2px dashed var(--line); display: grid; place-items: center; font-size: 18px; color: var(--muted); background: #fff; }
.slot.filled { border: 2px solid var(--accent); background: var(--accent-soft); color: #9a3b28; animation: popIn .4s cubic-bezier(.2,.8,.2,1) both; }
.slot.next { animation: pulseRing 1.8s ease-out infinite; }
.waiting .txt { font-size: 14px; }
.waiting .txt b { font-size: 18px; }

/* 紙吹雪 */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* 動きが苦手な人にはぜんぶ止める */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .btn.is-busy::after { display: none; }
}

/* ── 規約・ポリシー ───────────────────────────── */
.legal h2 { margin: 0 0 6px; }
.legal .updated { font-size: 12px; color: var(--muted, #8a8a95); margin: 0 0 22px; }
.legal h3 { font-size: 15px; margin: 26px 0 8px; }
.legal p { margin: 0 0 12px; line-height: 1.9; }
.legal ul { margin: 0 0 14px; padding-left: 1.3em; }
.legal li { margin-bottom: 7px; line-height: 1.85; }
.legal table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 0 0 16px; }
.legal th, .legal td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line, #2a2a33); vertical-align: top; line-height: 1.75; }
.legal th { white-space: nowrap; font-weight: 700; }
.legal code { font-size: .88em; padding: 1px 5px; border-radius: 4px; background: var(--surface2, #23232c); }
.legal .tw { overflow-x: auto; }
