/* 8タイプ診断チェック — 本の誌面（クリーム紙・グレー罫・表紙の赤）をイメージ */
:root {
  --paper: #fbf7ea;
  --card: #fffdf6;
  --ink: #3a3834;
  --muted: #8a857a;
  --line: #d9d3c2;
  --accent: #c8173c;
  --accent-soft: #fbe3e8;
  --yes: #c8173c;
  --no: #6d6a62;
  --radius: 18px;
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
b { font-weight: 700; }

.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- ヘッダー / ナビ ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px;
  background: rgba(251, 247, 234, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--accent), #8e1440); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 18px;
}
.topnav { display: flex; gap: 4px; }
.topnav a, .bottomnav a {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px; border-radius: 999px; color: var(--muted); font-weight: 700; font-size: 15px;
}
.topnav a.active { background: var(--accent-soft); color: var(--accent); }
.bottomnav { display: none; }

.wrap { max-width: 760px; margin: 0 auto; padding: 28px 20px 80px; }

/* ---------- 共通パーツ ---------- */
.panel {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 900; margin: 0 0 14px; }
.note { font-size: 14px; color: var(--muted); margin: 12px 0 0; }
.center { text-align: center; justify-content: center; }
.empty { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 0 26px;
  border-radius: 999px; border: 2px solid var(--accent);
  font-weight: 700; font-size: 16px;
  transition: transform .1s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #a91232; }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.sm { min-height: 48px; padding: 0 18px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .35; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }

.tchip {
  display: inline-grid; place-items: center;
  min-width: 46px; height: 26px; padding: 0 10px;
  border-radius: 999px; background: var(--c); color: #fff;
  font-weight: 900; font-size: 14px; letter-spacing: .02em;
}
.tchip.big { min-width: 70px; height: 38px; font-size: 18px; }

/* ---------- はじめに ---------- */
.hero { text-align: center; padding: 16px 0 26px; }
.hero-badge {
  display: inline-block; padding: 4px 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
}
.hero h1 { font-size: clamp(28px, 6vw, 40px); font-weight: 900; margin: 10px 0 6px; letter-spacing: .04em; }
.lead { max-width: 560px; margin: 0 auto; color: #5b574f; }

.field { display: block; }
.field-label { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.field input {
  width: 100%; min-height: 52px; padding: 0 16px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff;
  font: inherit; font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--accent); }

.steps { margin: 0; padding-left: 1.4em; }
.steps li { margin: 4px 0; }
.type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 16px; }
.type-mini { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--c) 8%, #fff); font-weight: 700; font-size: 15px; }

/* ---------- 診断 ---------- */
.quiz-head { position: sticky; top: 61px; z-index: 5; background: var(--paper); padding: 6px 0 12px; }
.progress { height: 10px; background: #ece6d4; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s; }
.quiz-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 15px; }
.quiz-meta b { font-size: 20px; color: var(--accent); }
.seg { display: flex; background: #ece6d4; border-radius: 999px; padding: 3px; }
.seg button {
  display: flex; align-items: center; gap: 4px;
  min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent;
  font-size: 14px; font-weight: 700; color: var(--muted);
}
.seg button .icon { width: 16px; height: 16px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.qcard {
  background: var(--card); border: 2px solid var(--line); border-radius: 24px;
  padding: 28px 24px 22px; text-align: center;
  box-shadow: 0 6px 0 #ece6d4;
}
.qno { font-weight: 900; font-size: 22px; color: var(--accent); display: flex; align-items: center; justify-content: center; gap: 10px; }
.qpage { font-size: 13px; color: var(--muted); font-weight: 500; border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; }
.qtext { font-size: clamp(20px, 4.6vw, 26px); font-weight: 700; margin: 18px 0 26px; min-height: 2.6em; display: grid; place-items: center; line-height: 1.5; }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.yn-btn {
  min-height: 76px; border-radius: 18px; font-size: 22px; font-weight: 900;
  border: 3px solid; background: #fff; transition: transform .1s, background .15s, color .15s;
}
.yn-btn.yes { border-color: var(--yes); color: var(--yes); }
.yn-btn.no { border-color: var(--no); color: var(--no); }
.yn-btn.yes.on { background: var(--yes); color: #fff; }
.yn-btn.no.on { background: var(--no); color: #fff; }
@media (hover: hover) {
  .yn-btn.yes:hover { background: var(--yes); color: #fff; }
  .yn-btn.no:hover { background: var(--no); color: #fff; }
}
.yn-btn.pop { transform: scale(.95); }
.qnav { display: flex; justify-content: space-between; margin-top: 20px; }

.dots { display: grid; grid-template-columns: repeat(16, 1fr); gap: 4px; margin-top: 22px; }
.dot {
  aspect-ratio: 1; border: 1px solid var(--line); background: #fff; border-radius: 6px;
  font-size: 11px; color: var(--muted); padding: 0; min-width: 0;
}
.dot.y { background: var(--yes); border-color: var(--yes); color: #fff; }
.dot.n { background: #cfcabd; border-color: #cfcabd; color: #fff; }
.dot.cur { outline: 3px solid var(--ink); outline-offset: 1px; }

.list-page { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 6px 18px 10px; margin-bottom: 18px; }
.list-page-h { display: flex; align-items: baseline; gap: 10px; font-size: 16px; margin: 12px 0 4px; }
.list-page-h span { font-size: 13px; color: var(--muted); font-weight: 500; }
.lrow { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px dashed var(--line); }
.lno { font-weight: 700; color: var(--muted); min-width: 2.2em; font-size: 15px; }
.ltext { flex: 1; font-size: 15px; line-height: 1.55; }
.lyn { display: flex; gap: 6px; flex: none; }
.mini {
  min-width: 64px; min-height: 48px; border-radius: 12px; border: 2px solid; background: #fff; font-weight: 700; font-size: 14px;
}
.mini.yes { border-color: var(--yes); color: var(--yes); }
.mini.no { border-color: var(--no); color: var(--no); }
.mini.yes.on { background: var(--yes); color: #fff; }
.mini.no.on { background: var(--no); color: #fff; }
.lrow:not(.done) .ltext { color: var(--ink); }
.lrow.done .lno { color: var(--accent); }
.sticky-finish { position: sticky; bottom: 16px; padding-top: 6px; }

/* ---------- 結果 ---------- */
.result-hero { text-align: center; margin-bottom: 22px; }
.rh-meta { color: var(--muted); font-size: 14px; }
.result-hero h1 { font-size: 28px; font-weight: 900; margin: 4px 0 12px; }
.result-types { display: grid; gap: 14px; text-align: left; }
.rtype {
  background: var(--card); border: 3px solid var(--c); border-radius: 22px;
  padding: 20px 22px; position: relative; overflow: hidden;
}
.rtype::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--c); opacity: .08; }
.rtype-head { display: flex; align-items: center; gap: 14px; }
.rtype h2 { margin: 0; font-size: 24px; font-weight: 900; color: var(--c); line-height: 1.3; }
.rtype-score { font-size: 14px; color: var(--muted); }
.rtype-score b { font-size: 20px; color: var(--ink); }
.rtype p { margin: 12px 0 0; }

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 210px 1fr 54px; align-items: center; gap: 10px; }
.bar-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.bar-track { position: relative; height: 18px; background: #f0ebdc; border-radius: 999px; }
.bar-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--c) 45%, #fff); border-radius: 999px; }
.bar-row.hit .bar-fill { background: var(--c); }
.bar-max { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #b5af9f; }
.bar-th { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--accent); }
.bar-val { text-align: right; font-size: 13px; color: var(--muted); }
.bar-val b { font-size: 18px; color: var(--ink); }
.bar-row:not(.hit) .bar-name { color: var(--muted); }

.table-wrap { overflow-x: auto; }
.sheet { width: 100%; border-collapse: collapse; text-align: center; font-size: 16px; }
.sheet th, .sheet td { border: 1px solid var(--line); padding: 8px 6px; }
.sheet thead th { background: #f3eedf; font-size: 14px; }
.sheet thead small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.sheet td.sum { font-weight: 900; font-size: 18px; }
.sheet tr.hit td.sum { color: var(--accent); background: var(--accent-soft); }

details summary { cursor: pointer; list-style: none; margin: 0; }
details summary::before { content: "＋"; color: var(--accent); }
details[open] summary::before { content: "－"; }
.ans-list { margin-top: 10px; }
.ans-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px dashed var(--line); font-size: 15px; }
.ans-col { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; flex: none; }
.ans-v { flex: none; min-width: 3.6em; text-align: center; font-weight: 700; font-size: 14px; border-radius: 8px; padding: 2px 6px; }
.ans-v.y { background: var(--accent-soft); color: var(--accent); }
.ans-v.n { background: #eeeae0; color: var(--muted); }

/* ---------- きろく ---------- */
.hist { display: grid; gap: 10px; }
.hist-row { display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 14px; background: #fff; }
.hist-main { flex: 1; padding: 12px 16px; min-height: 48px; }
.hist-name { font-weight: 700; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.hist-name span { font-size: 13px; color: var(--muted); font-weight: 500; }
.hist-types { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.hist-tn { font-size: 14px; margin-right: 6px; }
.muted { color: var(--muted); }
.icon-btn { width: 48px; height: 48px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; margin-right: 6px; border-radius: 12px; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

/* ---------- モバイル ---------- */
@media (max-width: 768px) {
  .topnav { display: none; }
  .topbar { padding: 10px 16px; }
  .wrap { padding: 18px 16px 110px; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(3, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: #fffdf6; border-top: 1px solid var(--line);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
  }
  .bottomnav a { flex-direction: column; gap: 2px; font-size: 12px; padding: 8px 4px; min-height: 56px; justify-content: center; border-radius: 12px; }
  .bottomnav a.active { color: var(--accent); }
  .panel { padding: 18px 16px; }
  .quiz-head { top: 57px; }
  .quiz-meta { font-size: 14px; }
  .seg button { padding: 0 10px; }
  .dots { grid-template-columns: repeat(8, 1fr); }
  .dot { font-size: 12px; }
  .type-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr 50px; }
  .bar-label { grid-column: 1 / -1; }
  .bar-track { grid-column: 1; }
  .lrow { flex-wrap: wrap; }
  .lyn { width: 100%; padding-left: 2.2em; }
  .mini { flex: 1; }
  .sticky-finish { bottom: 84px; }
  .rtype h2 { font-size: 20px; }
}

@media print {
  .topbar, .bottomnav, .no-print { display: none !important; }
  body { background: #fff; }
  .panel, .rtype { break-inside: avoid; }
  details > *:not(summary) { display: block; }
}
