/* DESIGN.md（吉野）準拠。派閥色は --c-main / --c-sub の差し替えで全部連動する。 */
:root {
  --bg: #0e0f13;
  --card: #16181f;
  --text: #e8eaf0;
  --muted: #9aa0ae;
  --c-main: #7c8cff; /* 派閥決定時に JS が上書き */
  --c-sub: #a7b4ff;
}

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

body {
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.screen { width: 100%; max-width: 480px; }
.hidden { display: none; }

h1 { font-size: 1.6rem; font-weight: 900; margin-bottom: 8px; }
.lead { color: var(--muted); margin-bottom: 24px; line-height: 1.7; }

button { font: inherit; cursor: pointer; border: none; border-radius: 12px; }

.primary {
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--c-main);
  color: #fff;
}

/* 設問画面: 進捗は白30%の細バー */
.progress { color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; }
.progress-bar {
  height: 4px; background: rgba(255,255,255,0.12); border-radius: 2px;
  overflow: hidden; margin-bottom: 24px;
}
.progress-bar > div { height: 100%; background: rgba(255,255,255,0.3); transition: width .2s; }

.question { font-size: 1.2rem; line-height: 1.6; margin-bottom: 24px; min-height: 3.2em; font-weight: 700; }

.choices { display: grid; gap: 10px; }
.choices button {
  padding: 14px;
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  text-align: center;
}
.choices button:hover { outline: 2px solid rgba(255,255,255,0.3); }

/* 結果カード = 所属証明カード。派閥色の縁 + 淡いグロー。面は塗らない */
.result-card {
  background: var(--card);
  border: 2px solid var(--c-main);
  border-radius: 16px;
  box-shadow: 0 0 24px color-mix(in srgb, var(--c-main) 35%, transparent);
  padding: 28px 24px 20px;
  text-align: center;
  margin-bottom: 16px;
}
.result-you { color: var(--muted); font-size: 0.8rem; margin-bottom: 4px; }
.result-emoji { font-size: 72px; line-height: 1.2; margin-bottom: 4px; }
.result-name {
  font-size: 40px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--c-main), var(--c-sub));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.result-en {
  font-size: 12px;
  letter-spacing: 0.35em;
  color: var(--muted);
  margin-bottom: 14px;
}
.result-flavor { line-height: 1.6; margin-bottom: 8px; }
.result-desc { color: var(--muted); font-size: 0.8rem; line-height: 1.7; margin-bottom: 20px; }

/* 2軸メーター: アクセル度 / 実現感 */
.axes { display: grid; gap: 14px; text-align: left; margin-bottom: 18px; }
.axis-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.72rem; color: var(--muted); margin-bottom: 6px;
}
.axis-label { font-size: 0.8rem; color: var(--text); font-weight: 700; }
.axis-track {
  position: relative; height: 8px;
  background: var(--bg); border-radius: 4px;
}
.axis-dot {
  position: absolute; top: 50%;
  width: 16px; height: 16px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, var(--c-main), var(--c-sub));
  box-shadow: 0 0 10px color-mix(in srgb, var(--c-main) 60%, transparent);
}

.result-footer { color: var(--muted); font-size: 0.7rem; }

.actions { display: grid; gap: 10px; }
.secondary {
  width: 100%; padding: 12px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--muted);
}
.copied { color: var(--text); font-size: 0.9rem; text-align: center; margin-top: 8px; min-height: 1.2em; }

/* デバッグモード（?debug） */
#debug { max-width: 720px; }
.debug-h { font-size: 1.05rem; margin: 24px 0 8px; }
.debug-note { color: var(--muted); font-size: 0.8rem; margin-bottom: 8px; }
.debug-pattern { display: flex; gap: 8px; margin-bottom: 8px; }
.debug-pattern input {
  flex: 1; font: inherit; padding: 10px 12px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--muted); border-radius: 10px;
}
.debug-pattern .primary { width: auto; padding: 10px 18px; }
.debug-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.debug-presets button {
  padding: 6px 10px; font-size: 0.8rem;
  background: var(--card); color: var(--text);
}
.debug-result {
  background: var(--card); border-radius: 12px; padding: 14px 16px;
  font-size: 0.9rem; line-height: 1.7; min-height: 1em; margin-bottom: 8px;
  white-space: pre-wrap;
}
.debug-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.debug-table th, .debug-table td {
  border: 1px solid #2a2e3a; padding: 6px 8px; text-align: center;
}
.debug-table td.q { text-align: left; }
.debug-table td.dbg-q { font-weight: 700; }
.debug-table .pos { color: #2ecc8f; }
.debug-table .neg { color: #e11d48; }
.debug-table-wrap { overflow-x: auto; }

/* サーバー全体の分布 */
.dist { margin-bottom: 16px; }
.dist:empty { display: none; }
.dist-title { color: var(--muted); font-size: 0.85rem; margin-bottom: 10px; text-align: center; }
.dist .bar-row {
  display: grid; grid-template-columns: 7.5em 1fr 3em; gap: 8px;
  align-items: center; font-size: 0.85rem; margin-bottom: 6px;
}
.dist .bar-track { height: 10px; background: var(--card); border-radius: 5px; overflow: hidden; }
.dist .bar-fill { height: 100%; background: #3a3f4d; }
.dist .bar-row.mine .bar-fill { background: linear-gradient(90deg, var(--c-main), var(--c-sub)); }
.dist-pct { text-align: right; color: var(--muted); }

/* トップ画面（research/top-mock.html 準拠） */
.start { text-align: center; }
.eyebrow { font-size: 11px; letter-spacing: 0.35em; color: var(--muted); margin-bottom: 10px; }
.start h1 { font-size: 2rem; }
.start .lead { line-height: 1.8; margin-bottom: 26px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.chip {
  --c: #7c8cff;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--c);
  box-shadow: 0 0 12px color-mix(in srgb, var(--c) 22%, transparent);
  font-size: 0.85rem; font-weight: 700;
}
.chip .en { font-size: 9px; letter-spacing: 0.12em; color: var(--muted); font-weight: 400; }
.chip.acc  { --c: #ff5c00; }
.chip.prag { --c: #3b82f6; }
.chip.cau  { --c: #2ecc8f; }
.chip.doom { --c: #8b5cf6; }
.chip.skep { --c: #9ca3af; }
.which { color: var(--muted); font-size: 0.9rem; margin-bottom: 24px; }
.which b { color: var(--text); }
.cta {
  padding: 16px; font-size: 1.1rem; font-weight: 900;
  background: linear-gradient(135deg, #ff5c00, #8b5cf6);
  box-shadow: 0 0 28px rgba(139, 92, 246, 0.35);
}
.cta:hover { filter: brightness(1.1); }
.micro { color: var(--muted); font-size: 0.75rem; margin-top: 10px; }
.social { color: var(--muted); font-size: 0.75rem; margin-top: 26px; }
.social b { color: var(--text); }

/* 押下フィードバックと診断中 */
.choices button.picked {
  outline: 2px solid var(--text);
  background: #232838;
}
.choices button:disabled { cursor: default; }
.loading-text {
  text-align: center; font-size: 1.3rem; font-weight: 700;
  animation: pulse 0.8s ease-in-out infinite alternate;
}
@keyframes pulse { from { opacity: 0.4; } to { opacity: 1; } }

/* 図鑑リンクと記事ページ */
.fac-link { text-align: center; margin-bottom: 16px; }
.fac-link a { color: var(--c-sub); text-decoration: none; font-size: 0.9rem; }
.article { max-width: 640px; padding: 32px 0; }
.article-back { margin-bottom: 16px; }
.article-back a { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.fac {
  background: var(--card);
  border: 2px solid var(--c-main);
  border-radius: 16px;
  box-shadow: 0 0 24px color-mix(in srgb, var(--c-main) 25%, transparent);
  padding: 24px;
  margin: 24px 0;
}
.fac h2 {
  font-size: 1.5rem; font-weight: 900; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--c-main), var(--c-sub));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fac h2 .fac-en {
  -webkit-text-fill-color: var(--muted);
  font-size: 11px; letter-spacing: 0.3em; font-weight: 400; margin-left: 8px;
}
.fac h3 { font-size: 0.95rem; margin: 16px 0 6px; color: var(--c-sub); }
.fac p { line-height: 1.9; font-size: 0.9rem; }
.fac ul { padding-left: 1.2em; }
.fac li { line-height: 1.8; font-size: 0.9rem; margin-bottom: 4px; }

.fac-map { width: 100%; height: auto; margin: 8px 0 4px; }

/* 結果カードのリッチ化（DESIGN.md 第2弾） */
.result-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #181b23, #14161d);
  box-shadow:
    0 0 24px color-mix(in srgb, var(--c-main) 35%, transparent),
    inset 0 1px 0 rgba(255,255,255,0.08);
}
.result-wm {
  position: absolute; top: -14px; right: -10px;
  font-size: 90px; font-weight: 900; letter-spacing: -0.02em;
  color: var(--text); opacity: 0.05;
  pointer-events: none; white-space: nowrap;
}
.result-emoji { position: relative; width: 120px; height: 120px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center; }
.result-emoji::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c-main) 25%, transparent) 0%, transparent 70%);
}
.result-emoji::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%; padding: 1.5px;
  background: conic-gradient(var(--c-main), var(--c-sub), var(--c-main));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.6;
}
.axis-track { background: #2a2d36; }
.axis-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(90deg, var(--c-main), var(--c-sub));
}
.axis-dot {
  border: 2px solid #fff;
  box-shadow: 0 0 12px var(--c-main);
}
.result-cert {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 0.65rem; opacity: 0.5; letter-spacing: 0.1em;
}

/* 図鑑の目次チップ */
.chip-link { text-decoration: none; color: var(--text); }
.chip-link:hover { filter: brightness(1.2); }
.toc-chips { justify-content: flex-start; margin-top: 16px; }

/* 一番割れた質問 */
.divisive { margin-top: 20px; }
.divisive-q { font-size: 0.9rem; font-weight: 700; margin-bottom: 10px; text-align: center; }
.divisive .bar-row { grid-template-columns: minmax(8em, 14em) 1fr 3em; font-size: 0.78rem; }
.divisive-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 図鑑ページ v2: 挿絵・ひとことで・マップ図 */
.fac-img { width: 100%; height: auto; border-radius: 12px; margin-bottom: 14px; }
.fac-oneliner {
  font-size: 1.05rem; font-weight: 700; line-height: 1.6; margin-bottom: 6px;
  background: linear-gradient(135deg, var(--c-main), var(--c-sub));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fac-map-fig { margin-top: 20px; }
.fac-map-fig figcaption { color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: 6px; }

/* ロゴ */
.logo-h { margin-bottom: 4px; }
.logo { width: min(420px, 100%); height: auto; }
.logo-small { width: 170px; }
.logo-line { text-align: left; margin-bottom: 4px; }

/* 代表人物 */
.people-list { margin: 2px 0 14px; }
.people-row { font-size: 0.78rem; color: var(--text); margin-bottom: 3px; }
.people-fac { font-weight: 700; margin-right: 4px; }
.people-note { color: var(--muted); font-size: 0.65rem; margin-top: 14px; text-align: center; }
.result-people { font-size: 0.85rem; line-height: 1.7; margin-bottom: 20px; }
.result-people strong { color: var(--c-sub); }
.people-asterisk { color: var(--muted); font-size: 0.7em; vertical-align: super; }

/* トリビア */
.loading-trivia { color: var(--muted); font-size: 0.85rem; line-height: 1.7; text-align: center; margin-top: 16px; }
.trivia-text { color: var(--text); font-size: 0.85rem; line-height: 1.7; text-align: center; }

/* フッターリンク */
.site-footer { margin-top: 18px; font-size: 0.75rem; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

.chip-mascot { width: 26px; height: 26px; object-fit: contain; }

/* トップのタイル型チップ: マスコット主役・文字は画像に重ねて中央寄せ */
.chips:has(.tile) {
  display: grid; grid-template-columns: repeat(3, minmax(0, 132px));
  gap: 10px; justify-content: center; align-items: stretch;
}
.chip.tile {
  position: relative; display: block;
  padding: 10px 6px 34px; border-radius: 16px;
}
.chip.tile .chip-mascot, .chip.tile .chip-emoji {
  width: 100%; height: 104px; object-fit: contain;
  font-size: 76px; line-height: 104px; display: block; text-align: center;
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--c) 50%, transparent));
}
.chip.tile .tile-name {
  position: absolute; left: 0; right: 0; bottom: 22px;
  text-align: center;
  font-size: 1.05rem; font-weight: 900; color: #fff;
  -webkit-text-stroke: 4px #0e0f13;
  paint-order: stroke fill;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 14px color-mix(in srgb, var(--c) 60%, transparent);
}
.chip.tile .en {
  position: absolute; left: 0; right: 0; bottom: 8px;
  text-align: center; font-size: 8px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}
@media (max-width: 430px) {
  .chips:has(.tile) { grid-template-columns: repeat(2, minmax(0, 140px)); }
}
