/* 英語学習タイプ診断 — キャラ図鑑カード風
   文字サイズは 12 / 14 / 16 と見出し、角丸は 12 / 20 / 丸 の3種にそろえる */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --paper: #FBF3E4;
  --card: #fff;
  --ink: #2B2118;
  --muted: #6B5D4F;
  --yellow: #F6C544;
  --accent: #B5451B;
  --accent-pale: #FBE3D6;
  --line-green: #06C755;
  --r-s: 12px;
  --r-l: 20px;
  --font-body: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  --font-display: 'Dela Gothic One', 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', sans-serif;
}
/* 4グループの色（コードの先頭2文字で決まる） */
[data-group="sp"] { --accent: #1F5FA8; --accent-pale: #DCEBFA; }
[data-group="sf"] { --accent: #6B3FA0; --accent-pale: #EADFF7; }
[data-group="tp"] { --accent: #1E7A46; --accent-pale: #DDF1E4; }
[data-group="tf"] { --accent: #B5451B; --accent-pale: #FBE3D6; }

body {
  font-family: var(--font-body);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(43, 33, 24, 0.09) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.7;
}
[hidden] { display: none !important; }
button { font-family: inherit; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; cursor: pointer; }
a { color: inherit; }

.screen { display: none; padding: 20px 16px 56px; }
.screen.active { display: block; }
.card {
  max-width: 520px; margin: 0 auto; background: var(--card);
  border: 3px solid var(--ink); border-radius: var(--r-l); box-shadow: 6px 6px 0 var(--ink);
  padding: 24px 20px 28px;
}
.brand { display: flex; justify-content: center; margin-bottom: 16px; }
.brand img { height: 30px; width: auto; }

/* ── ボタン ── */
.btn-primary, .btn-ghost, .btn-line, .btn-share {
  display: block; width: 100%; text-align: center; text-decoration: none; font-weight: 900;
  border: 3px solid var(--ink); border-radius: var(--r-s); color: var(--ink);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn-primary { background: var(--yellow); font-size: 1rem; padding: 0.95rem 1rem; box-shadow: 4px 4px 0 var(--ink); letter-spacing: 0.04em; }
.btn-line { background: var(--line-green); font-size: 1rem; padding: 0.95rem 1rem; box-shadow: 4px 4px 0 var(--ink); }
.btn-ghost { background: var(--card); font-size: 0.875rem; padding: 0.7rem 1rem; margin-top: 12px; border-width: 2px; }
.btn-share { background: var(--card); font-size: 0.875rem; padding: 0.7rem 0.5rem; border-width: 2px; }
.btn-primary:hover, .btn-line:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.btn-primary:active, .btn-line:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn-ghost:hover, .btn-share:hover { background: var(--yellow); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── スタート ── */
.fan { position: relative; height: 196px; margin: 4px auto 14px; width: 300px; max-width: 100%; }
.fan-card {
  position: absolute; top: 14px; left: 50%; width: 124px; margin-left: -62px; background: var(--card);
  border: 3px solid var(--ink); border-radius: var(--r-s); overflow: hidden; box-shadow: 3px 3px 0 var(--ink);
}
.fan-card .char-img { border-radius: 0; background: var(--accent-pale); aspect-ratio: 1; }
.fan-card span { display: block; text-align: center; font-size: 0.75rem; font-weight: 900; padding: 2px 0 3px; background: var(--accent); color: #fff; }
.fan-card:nth-child(1) { transform: translateX(-92px) rotate(-9deg); }
.fan-card:nth-child(2) { transform: translateX(92px) rotate(9deg); }
.fan-card:nth-child(3) { top: 0; z-index: 1; }

h1 { font-family: var(--font-display); font-weight: 400; font-size: 2rem; line-height: 1.25; text-align: center; margin-bottom: 10px; }
.accent { color: var(--accent); }
.lead { text-align: center; font-size: 1rem; margin-bottom: 16px; text-wrap: balance; }
.lead strong { display: block; font-weight: 900; }
.feats { list-style: none; border: 2px solid var(--ink); border-radius: var(--r-s); padding: 10px 14px; margin-bottom: 18px; background: var(--paper); }
.feats li { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 0.875rem; padding: 3px 0; }
.feats span { font-size: 1rem; }

/* ── 質問 ── */
.progress-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.btn-back { background: none; border: none; color: var(--muted); font-weight: 700; font-size: 0.875rem; padding: 6px 4px; }
.q-count { font-family: var(--font-display); font-size: 0.875rem; background: var(--ink); color: #fff; border-radius: 999px; padding: 0 12px; }
.progress { height: 14px; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; margin-bottom: 22px; }
.progress-bar { height: 100%; width: 0; background: var(--yellow); transition: width 0.25s; }
.q-part { font-size: 0.875rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.q-text { font-size: 1.2rem; font-weight: 900; line-height: 1.6; min-height: 5.8em; margin-bottom: 16px; }
.q-options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  width: 100%; text-align: left; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-s);
  padding: 0.8rem 1rem; font-size: 1rem; font-weight: 700; transition: background 0.12s, transform 0.12s, box-shadow 0.12s;
}
.opt:hover, .opt.selected { background: var(--yellow); transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }

/* ── 図鑑カード（結果とトリセツの先頭） ── */
.zukan { border: 3px solid var(--ink); border-radius: var(--r-l); overflow: hidden; margin-bottom: 6px; }
.zukan-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--accent); color: #fff; padding: 6px 14px; font-weight: 900; font-size: 0.875rem; }
.zukan-no { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.06em; }
.zukan-body { background: var(--accent-pale); padding: 18px 16px 16px; text-align: center; }
.result-label { font-size: 0.875rem; font-weight: 700; color: var(--muted); }
.type-emoji {
  width: min(100%, 232px); aspect-ratio: 1; margin: 8px auto 10px; border: 3px solid var(--ink); border-radius: var(--r-s);
  overflow: hidden; background: var(--card); display: flex; align-items: center; justify-content: center; font-size: 4rem;
}
.char-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.type-name { font-family: var(--font-display); font-weight: 400; font-size: 2rem; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
.type-code { font-family: var(--font-display); font-size: 1rem; letter-spacing: 0.32em; color: var(--accent); margin: 2px 0 6px; }
.type-catch { font-weight: 700; font-size: 1rem; word-break: auto-phrase; }

/* 見出しは札（ラベル）にする */
.result-card h2, .result-card h3 {
  display: table; font-size: 0.875rem; font-weight: 900; line-height: 1.5; color: #fff; background: var(--ink);
  border-radius: 999px; padding: 2px 14px; margin: 24px 0 10px;
}
/* タイプ名とトリセツの題は見出しだが、札にはしない */
.result-card .type-name, .result-card .locked-title { display: block; background: none; color: var(--ink); border-radius: 0; padding: 0; font-weight: 400; }
.result-card .type-name { font-size: 2rem; line-height: 1.3; margin: 0; }
.result-card .locked-title { font-size: 1.35rem; line-height: 1.35; margin: 0; }
.body-text { font-size: 1rem; }

/* ステータス（4軸） */
.axes { display: grid; gap: 10px; }
.axis { display: grid; grid-template-columns: 5.6em 1fr 5.6em; align-items: end; gap: 8px; }
.axis-pole { font-size: 0.75rem; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.3; }
.axis-pole.on { color: var(--ink); font-weight: 900; }
.axis-letter { display: block; font-family: var(--font-display); font-weight: 400; font-size: 0.875rem; line-height: 1.3; }
.axis-pole.on .axis-letter { color: var(--accent); }
.axis-bar { height: 22px; background: var(--accent-pale); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; display: flex; }
.axis-fill { height: 100%; background: var(--accent); color: #fff; font-size: 0.75rem; font-weight: 900; display: flex; align-items: center; padding: 0 8px; }
.axis-fill.right { margin-left: auto; justify-content: flex-end; }

.check-list { list-style: none; }
.check-list li { position: relative; padding: 3px 0 3px 1.7em; font-size: 1rem; }
.check-list li::before { content: '✔'; position: absolute; left: 0.2em; color: var(--accent); font-weight: 900; }

/* ── LINEで受け取る「トリセツ」への誘導 ── */
.locked { margin-top: 26px; background: var(--accent-pale); border: 3px solid var(--ink); border-radius: var(--r-l); box-shadow: 4px 4px 0 var(--ink); padding: 18px 14px; }
.locked-kicker { display: table; margin: 0 auto 6px; background: var(--yellow); border: 2px solid var(--ink); font-size: 0.75rem; font-weight: 900; padding: 1px 12px; border-radius: 999px; }
.locked-title { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.35; text-align: center; overflow-wrap: anywhere; }
.locked-lead { font-size: 0.875rem; text-align: center; margin: 4px 0 12px; }
.teasers { list-style: none; display: grid; gap: 8px; margin-bottom: 14px; }
.teaser { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-s); padding: 9px 12px; }
.teaser.main { background: var(--yellow); }
.teaser-icon { flex: none; font-size: 1rem; line-height: 1.6; }
.teaser-body strong { display: block; font-size: 0.875rem; font-weight: 900; }
.teaser-body p { font-size: 0.875rem; }
.mask { background: var(--ink); color: #fff; font-weight: 900; border-radius: 999px; padding: 0 8px; margin: 0 2px; white-space: nowrap; }
.silhouette { display: inline-block; width: 40px; height: 40px; vertical-align: middle; margin-right: 4px; border-radius: 50%; overflow: hidden; border: 2px solid var(--ink); }
.silhouette .char-img { filter: blur(5px); transform: scale(1.25); }
.note { font-size: 0.75rem; color: var(--muted); margin-top: 8px; }

/* ── シェア ── */
.share-label { text-align: center; font-size: 0.875rem; font-weight: 700; color: var(--muted); margin-top: 26px; }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.btn-save { margin-top: 10px; }

/* ── 全16タイプ（4グループ） ── */
.group { margin-top: 12px; }
.group-name { display: table; font-size: 0.75rem; font-weight: 900; color: #fff; background: var(--accent); border-radius: 999px; padding: 0 10px; margin-bottom: 6px; }
.all-types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mini-type { display: block; text-decoration: none; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-s); overflow: hidden; text-align: center; }
.mini-type.me { background: var(--yellow); }
.mini-type.me .mini-code { color: var(--ink); }
.mini-emoji { aspect-ratio: 1; background: var(--accent-pale); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.mini-name { font-size: 0.75rem; font-weight: 900; line-height: 1.35; padding: 4px 4px 0; min-height: 2.9em; display: flex; align-items: center; justify-content: center; word-break: auto-phrase; overflow-wrap: anywhere; }
.mini-code { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.08em; padding-bottom: 4px; }
/* スマホ幅では2列にして、絵を左・名前を右に置く（縦に長くしない） */
@media (max-width: 480px) {
  .all-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-type { display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; text-align: left; }
  .mini-emoji { grid-row: 1 / 3; width: 44px; align-self: stretch; aspect-ratio: auto; }
  .mini-name { justify-content: flex-start; align-self: end; min-height: 0; padding: 6px 4px 0 6px; }
  .mini-code { align-self: start; padding: 0 4px 6px 6px; }
}

.provider { text-align: center; font-size: 0.75rem; color: var(--muted); margin-top: 18px; }

/* ── トリセツのページ ── */
.top3 { list-style: none; display: grid; gap: 10px; }
.top-item { display: flex; gap: 12px; align-items: flex-start; border: 2px solid var(--ink); border-radius: var(--r-s); padding: 12px; background: var(--card); }
.top-item.rank1 { background: var(--yellow); }
.top-rank { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff; font-family: var(--font-display); font-size: 0.875rem; display: flex; align-items: center; justify-content: center; }
.top-name { font-weight: 900; font-size: 1rem; word-break: auto-phrase; }
.top-why { font-size: 0.875rem; margin-top: 2px; }
.top-step { font-size: 0.875rem; font-weight: 700; margin-top: 6px; padding-top: 6px; border-top: 2px dashed var(--ink); }
.plain-list { list-style: none; display: grid; gap: 8px; }
.plain-list li, .buddy { border: 2px solid var(--ink); border-radius: var(--r-s); padding: 10px 12px; font-size: 0.875rem; background: var(--card); }
.plain-list strong { display: block; font-weight: 900; }
.worst-list li { background: var(--paper); }
.buddy { display: flex; gap: 12px; align-items: center; background: var(--accent-pale); }
.buddy-emoji { flex: none; width: 72px; height: 72px; border: 2px solid var(--ink); border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 2rem; background: var(--card); }
.link-btn { margin-top: 24px; }

@media (max-width: 380px) {
  .card { padding: 20px 14px 24px; }
  .axis { grid-template-columns: 4.8em 1fr 4.8em; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
