/* ダブルブッキング診断：色は 黄・こん・白・ピンク の4つだけ */
:root {
  --bg: #ffdf3d;
  --ink: #1f1a33;
  --card: #ffffff;
  --pink: #ff4f8b;
  --muted: #615c78;
  --pale: #fff4b8;
  --line: 3px solid var(--ink);
}

* { box-sizing: border-box; margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background-color: var(--bg);
  background-image: radial-gradient(rgba(31, 26, 51, 0.07) 2px, transparent 2.5px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
  font-weight: 500;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(14px + env(safe-area-inset-bottom));
}

/* ───── ボタン ───── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 10px 18px;
  border: var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 5px 0 var(--ink);
  font-weight: 800;
  font-size: 17px;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn-primary { background: var(--pink); color: #fff; }
.btn-big { min-height: 68px; font-size: 22px; }
.btn:focus-visible, .card:focus-visible, .back:focus-visible, .text-link:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.text-link {
  display: inline-block;
  padding: 10px 6px;
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  text-underline-offset: 4px;
}

/* ───── はじめの画面 ───── */
.screen-start { justify-content: space-between; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.start-top { flex: 1; display: flex; flex-direction: column; justify-content: center; position: relative; }
.start-deco { position: relative; height: 0; }
.start-deco i {
  position: absolute;
  right: 4px;
  top: -40px;
  width: 132px;
  height: 84px;
  background: var(--card);
  border: var(--line);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
  transform: rotate(9deg);
  animation: bob 3.2s ease-in-out infinite;
}
.start-deco i:last-child {
  right: 56px;
  top: 34px;
  background: var(--pink);
  transform: rotate(-7deg);
  animation-delay: -1.6s;
}
.start-deco i::before {
  content: '';
  position: absolute;
  left: 14px; top: 14px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: var(--line);
  background: var(--bg);
}
.start-deco i::after {
  content: '';
  position: absolute;
  left: 14px; right: 18px; bottom: 16px;
  height: 8px;
  border-radius: 8px;
  background: var(--ink);
  opacity: 0.85;
}
@keyframes bob { 50% { translate: 0 -8px; } }

.start-title {
  position: relative;
  font-size: clamp(52px, 16vw, 76px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 96px;
}
.start-lead { margin-top: 22px; font-size: 19px; font-weight: 800; }

/* ───── 設問の画面 ───── */
.screen-quiz { overflow: hidden; }
.quiz-head { display: flex; align-items: center; gap: 12px; height: 28px; flex: none; }
.progress {
  flex: 1;
  height: 12px;
  background: var(--card);
  border: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--pink);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.count { font-weight: 800; font-size: 15px; min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 0 6px;
}
.slot { position: relative; flex: 1; min-height: 0; max-height: 300px; }
.mid { height: 52px; flex: none; display: flex; align-items: center; justify-content: center; position: relative; z-index: 3; pointer-events: none; }

.chip { font-weight: 800; font-size: 15px; padding: 7px 16px; border-radius: 999px; white-space: nowrap; }
.chip.stat {
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  animation: chip-pop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.5) both;
}
.chip.stat b { color: var(--bg); font-size: 20px; margin-left: 4px; }
@keyframes chip-pop { from { transform: scale(0.5); opacity: 0; } to { transform: none; opacity: 1; } }

.card {
  position: absolute;
  inset: 0 0 7px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px;
  background: var(--card);
  border: var(--line);
  border-radius: 26px;
  box-shadow: 0 7px 0 var(--ink);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}
.card:active:not(.picked) { translate: 0 4px; box-shadow: 0 3px 0 var(--ink); }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-icon {
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--pale);
  border: var(--line);
  border-radius: 50%;
  font-size: 21px;
  line-height: 1;
}
.card-from { font-weight: 800; font-size: 15px; flex: 1; }
.card-from small { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 2px; }
.card-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--pink); border: 2px solid var(--ink); }
.card-what { font-weight: 800; font-size: clamp(20px, 5.9vw, 25px); line-height: 1.35; }
.card-how { font-size: clamp(14px, 4vw, 15.5px); line-height: 1.5; color: var(--muted); }
.card-was {
  position: absolute; right: 16px; bottom: 12px;
  font-size: 12px; font-weight: 800; color: var(--pink);
}
.card.was { border-color: var(--pink); box-shadow: 0 7px 0 var(--pink); }

.card-stamp {
  position: absolute;
  right: 14px; top: 12px;
  padding: 2px 14px;
  background: #fff;
  color: var(--pink);
  border: var(--line);
  border-radius: 12px;
  font-weight: 800;
  font-size: 20px;
  transform: rotate(8deg) scale(0);
  pointer-events: none;
}

/* 届く */
.card.in-top { animation: in-top 0.44s cubic-bezier(0.2, 0.9, 0.3, 1.15) both; }
.card.in-bottom { animation: in-bottom 0.44s cubic-bezier(0.2, 0.9, 0.3, 1.15) 0.06s both; }
@keyframes in-top { from { transform: translateY(-130%) rotate(-4deg); } to { transform: none; } }
@keyframes in-bottom { from { transform: translateY(130%) rotate(4deg); } to { transform: none; } }

/* 選んだ */
.card.picked {
  z-index: 2;
  background: var(--pink);
  color: #fff;
  animation: picked 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}
.card.picked .card-how, .card.picked .card-from small { color: #fff; }
.card.picked .card-dot { background: #fff; }
.card.picked .card-stamp { animation: stamp 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.6) 0.05s both; }
@keyframes picked { 0% { transform: scale(1); } 35% { transform: scale(0.95); } 100% { transform: scale(1.03); } }
@keyframes stamp { from { transform: rotate(-20deg) scale(2.2); opacity: 0; } to { transform: rotate(8deg) scale(1); opacity: 1; } }

/* 選ばなかったほうは飛んでいく */
.card.fly-l { animation: fly-l 0.42s cubic-bezier(0.5, 0, 0.9, 0.5) both; }
.card.fly-r { animation: fly-r 0.42s cubic-bezier(0.5, 0, 0.9, 0.5) both; }
@keyframes fly-l { to { transform: translate(-150%, -20%) rotate(-24deg); opacity: 0.4; } }
@keyframes fly-r { to { transform: translate(150%, -20%) rotate(24deg); opacity: 0.4; } }

/* 選んだほうが片づく */
.card.leave { animation: leave 0.22s ease-in both; }
@keyframes leave { from { transform: scale(1.03); } to { transform: scale(0.8); opacity: 0; } }
.card.gone { pointer-events: none; }

.quiz-foot { height: 48px; flex: none; display: flex; align-items: center; justify-content: space-between; }
.back {
  min-height: 44px;
  padding: 6px 16px;
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
}
.back:disabled { opacity: 0.25; cursor: default; }
.kbd-hint { display: none; font-size: 13px; color: var(--muted); }
@media (hover: hover) and (min-width: 700px) { .kbd-hint { display: inline; } }

/* ───── 結果の画面・タイプのページ ───── */
.screen-result { height: auto; min-height: 100vh; min-height: 100dvh; gap: 8px; position: relative; overflow: hidden; }
.brand { font-weight: 800; font-size: 13px; text-align: center; letter-spacing: 0.04em; }

.type-card {
  background: var(--card);
  border: var(--line);
  border-radius: 26px;
  box-shadow: 0 7px 0 var(--ink);
  padding: 14px 18px 16px;
  text-align: center;
  margin-bottom: 5px;
}
.type-label {
  display: inline-block;
  padding: 1px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
}
.type-name {
  margin-top: 6px;
  font-weight: 800;
  font-size: clamp(30px, 9.4vw, 44px);
  line-height: 1.2;
  color: var(--pink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.type-name.long { font-size: clamp(26px, 8vw, 38px); }
.type-desc { margin-top: 6px; font-size: 14px; line-height: 1.55; font-weight: 500; text-wrap: pretty; }

.pop-in { animation: pop-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4) both; }
@keyframes pop-in { from { transform: scale(0.4) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
.rise { animation: rise 0.4s ease-out both; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.axes { display: flex; flex-direction: column; gap: 5px; }
.axis-labels { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 500; color: var(--muted); line-height: 1.4; }
.axis-labels .on { color: var(--ink); font-weight: 800; }
.axis-track { display: flex; gap: 4px; margin-top: 2px; }
.axis-track i {
  flex: 1;
  height: 12px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.axis-track i.on { background: var(--pink); animation: cell 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.6) both; }
@keyframes cell { from { transform: scale(0.3); background: var(--card); } }
.axis-note { font-size: 11.5px; font-weight: 800; line-height: 1.4; margin-top: 2px; }
.axis-note.right { text-align: right; }

.facts { display: flex; flex-direction: column; gap: 7px; }
.fact {
  background: var(--pale);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 7px 14px 8px;
}
.fact-label { font-size: 11.5px; font-weight: 800; color: var(--muted); line-height: 1.4; }
.fact-main { font-size: 16px; font-weight: 800; line-height: 1.4; }
.fact-main small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.fact-sub { font-size: 12.5px; line-height: 1.4; }
.fact-sub b { color: var(--pink); font-size: 15px; }

.actions { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 4px; }
.actions-row { display: flex; justify-content: center; gap: 10px; }
.actions .text-link { background: none; border: 0; cursor: pointer; text-decoration: underline; }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 10px; height: 16px;
  border-radius: 3px;
  border: 2px solid var(--ink);
  animation: fall 1.5s cubic-bezier(0.3, 0.2, 0.7, 1) both;
}
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* タイプごとのページ（/t/…） */
.page-type {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 16px 32px;
}
.page-type .type-card { width: 100%; padding: 22px 18px 24px; }
.page-type .type-desc { font-size: 15.5px; margin-top: 10px; }
.page-type .type-lead { font-weight: 800; text-align: center; font-size: 17px; margin-top: 6px; }
.pills { list-style: none; padding: 0; display: flex; justify-content: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pills li { padding: 1px 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--pale); font-size: 12.5px; font-weight: 800; }

/* ───── みんなの答え・設問の一覧 ───── */
.page { padding: 20px 16px 48px; }
.page h1 { font-size: 28px; font-weight: 800; line-height: 1.3; margin-top: 6px; }
.page h2 { font-size: 17px; font-weight: 800; margin: 28px 0 10px; }
.page .lead { font-size: 14px; margin-top: 4px; }
.panel {
  background: var(--card);
  border: var(--line);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
  padding: 12px 16px 14px;
  margin-bottom: 14px;
}
.vs-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: end; }
.vs-row + .vs-row { margin-top: 8px; }
.vs-text { font-size: 14.5px; font-weight: 800; line-height: 1.4; }
.vs-text small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.vs-pct { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 10px; background: var(--pale); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--pink); }
.panel-foot { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: right; }
.page .btn { margin-top: 24px; }

.page-wide { max-width: 1100px; }
.table-wrap { overflow-x: auto; background: var(--card); border: var(--line); border-radius: 16px; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; min-width: 860px; font-size: 13px; line-height: 1.5; }
th, td { padding: 8px 10px; border-bottom: 1px solid rgba(31, 26, 51, 0.18); text-align: left; vertical-align: top; }
th { background: var(--ink); color: #fff; font-weight: 800; white-space: nowrap; }
td b { font-weight: 800; }
td small { color: var(--muted); display: block; }
tr.use td { background: var(--pale); }
.tag { display: inline-block; padding: 0 8px; border: 2px solid var(--ink); border-radius: 999px; font-weight: 800; font-size: 11.5px; white-space: nowrap; }
.tag.yes { background: var(--pink); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01s !important; animation-delay: 0s !important; transition-duration: 0.01s !important; }
}

/* ───── みんなの答え：2つのページの切り替えと、タイプの一覧 ───── */
.tabs { display: flex; gap: 8px; margin: 12px 0 16px; }
.tabs a {
  flex: 1;
  min-height: 44px;
  display: grid;
  place-items: center;
  background: var(--card);
  border: var(--line);
  border-radius: 999px;
  font-weight: 800;
  font-size: 14.5px;
  color: var(--ink);
  text-decoration: none;
}
.tabs a.on { background: var(--ink); color: #fff; }
.page h1 { margin-top: 0; }
.type-item { display: block; color: var(--ink); text-decoration: none; }
.type-item:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.type-item-name { font-size: 22px; font-weight: 800; color: var(--pink); line-height: 1.35; }
.type-item-desc { font-size: 14px; line-height: 1.55; margin-top: 2px; }
.type-item .pills { justify-content: flex-start; margin: 8px 0 6px; }
.link-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 6px; }
.page .lead { margin-bottom: 12px; }

/* 結果の画面を1画面に収めるための詰め */
.screen-result { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.screen-result .type-card { padding: 11px 16px 13px; }
.screen-result .facts { gap: 6px; }
.screen-result .fact { padding: 6px 14px 7px; }
.screen-result .btn { min-height: 48px; }
.screen-result .text-link { padding: 8px 5px; }
.screen-result { gap: 7px; }
.screen-result .axis-track i { height: 10px; }
.screen-result .axis-note { line-height: 1.3; margin-top: 1px; }
.screen-result .fact-label { line-height: 1.3; }
.screen-result .fact-main { font-size: 15px; line-height: 1.35; }
.screen-result .fact-sub { font-size: 12px; line-height: 1.35; }
.screen-result .type-desc { margin-top: 4px; line-height: 1.5; }

/* ───── いちばん下の小さなリンク（作った人・プライバシーポリシー） ───── */
.credit { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 14px; margin-top: 18px; }
.credit a { padding: 8px 2px; font-size: 12px; color: var(--muted); text-underline-offset: 3px; }
.screen-start { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.screen-start .credit { margin-top: 12px; }
.screen-result .credit { margin-top: 10px; }
.page-type .credit { margin-top: 8px; }
