:root {
  color-scheme: light; /* スマホがダークモードでも、いつも明るい配色で出す（2026-11-09） */
  font-family: system-ui, sans-serif;
  --bg: #fffaf6;
  --fg: #2d2a32;
  --muted: #6e6875;
  --accent: #d9708f;
  --accent-fg: #ffffff;
  --card: #ffffff;
  --line: #eadfe3;
  --error: #c0392b;
  --no: #7f8fd6;
}


* { box-sizing: border-box; }

body.shindan {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
}

.shindan main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}


.title { font-size: 1.6rem; line-height: 1.4; margin: 24px 0 12px; }
.lead { color: var(--muted); }
.facts { padding-left: 1.2em; }

.button {
  display: inline-block;
  padding: 12px 24px;
  border: 0;
  border-radius: 0;
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button.secondary { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }

.edition h2 { margin-top: 32px; }

/* 質問は枠で囲まず、文字を中央に大きく出す。質問どうしは細い線で区切る。 */
.question {
  margin: 0;
  padding: 28px 0 24px;
  border: 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.q-text { float: left; width: 100%; padding: 0 4px; font-size: 1.1rem; font-weight: 600; line-height: 1.6; text-align: center; }
.q-text + * { clear: both; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.progress-head { position: sticky; top: 0; z-index: 1; margin: 0 -16px 8px; padding: 10px 16px 8px; background: var(--bg); }
.progress {
  display: block;
  width: 100%;
  height: 10px;
  margin: 6px 0 2px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--card);
  overflow: hidden;
  appearance: none;
}
.progress::-webkit-progress-bar { background: var(--card); border-radius: 0; }
.progress::-webkit-progress-value { background: var(--accent); border-radius: 0; }
.progress::-moz-progress-bar { background: var(--accent); border-radius: 0; }
.progress-count { display: flex; justify-content: space-between; gap: 8px; margin: 0; color: var(--muted); font-size: 0.85rem; }

.pager { display: flex; flex-direction: column; gap: 12px; align-items: center; margin: 24px 0 8px; }
.link-button { padding: 8px; border: 0; background: none; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
.question.has-error .q-text { color: var(--error); }
.field-error { text-align: center; }
.field-error, .error-summary { color: var(--error); margin: 6px 0 0; }

/* 選択肢は、5つに区切った1本のバー。左（そう思わない）の青むらさきから、
   右（そう思う）のピンクへ色が移っていく。押したところが濃くなり、白い点が付く。 */
.bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 340px;
  margin: 18px auto 0;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px var(--line);
}
.seg {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  background: color-mix(in srgb, var(--seg) 32%, var(--card));
  cursor: pointer;
  transition: background-color 0.12s;
}
.seg + .seg { border-left: 2px solid var(--bg); }
.seg-0 { --seg: var(--no); border-radius: 0; }
.seg-1 { --seg: color-mix(in srgb, var(--no) 60%, var(--muted)); }
.seg-2 { --seg: var(--muted); }
.seg-3 { --seg: color-mix(in srgb, var(--accent) 60%, var(--muted)); }
.seg-4 { --seg: var(--accent); border-radius: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.seg-mark { width: 12px; height: 12px; border-radius: 50%; background: transparent; }
.seg:hover { background: color-mix(in srgb, var(--seg) 50%, var(--card)); }
.seg:has(input:checked) { background: var(--seg); }
.seg input:checked + .seg-mark { background: var(--card); }
.seg:has(input:focus-visible) { outline: 3px solid var(--fg); outline-offset: 2px; z-index: 1; }
.scale-ends { display: flex; justify-content: space-between; max-width: 340px; margin: 6px auto 0; color: var(--muted); font-size: 0.8rem; }

.submit { margin: 20px 0 8px; text-align: center; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.edition-result {
  margin: 16px 0;
  padding: 18px;
  border-radius: 0;
  background: var(--card);
  border: 1px solid var(--line);
}
.edition-result .label { margin: 0; color: var(--muted); }
.type-name { margin: 20px 0 4px; font-size: 1.5rem; line-height: 1.6; }
.catch { margin: 0 0 8px; }
.main { margin: 0; color: var(--muted); }
.ingredients { list-style: none; padding: 0; margin: 12px 0 0; }
.ingredient { display: grid; grid-template-columns: 6em 1fr 3em; align-items: center; gap: 8px; }
.ingredient meter { width: 100%; }
.ingredient .percent { text-align: right; }
.ingredients-title { margin: 16px 0 0; font-size: 0.95rem; color: var(--muted); }
.ingredients { display: grid; gap: 4px; }
.ingredient { font-size: 0.9rem; }
.ingredient.top { font-weight: 700; font-size: 1rem; }
.ingredient meter {
  height: 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  appearance: none;
}
.ingredient meter::-webkit-meter-bar { height: 10px; border: 0; border-radius: 0; background: var(--bg); }
.ingredient meter::-webkit-meter-optimum-value,
.ingredient meter::-webkit-meter-suboptimum-value,
.ingredient meter::-webkit-meter-even-less-good-value { border-radius: 0; background: var(--accent); }
.ingredient meter::-moz-meter-bar { border-radius: 0; background: var(--accent); }
.ingredient:not(.top) meter::-webkit-meter-optimum-value { background: color-mix(in srgb, var(--accent) 55%, var(--card)); }
.ingredient:not(.top) meter::-moz-meter-bar { background: color-mix(in srgb, var(--accent) 55%, var(--card)); }

.gap {
  margin: 24px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--card);
}
.gap h2 { margin: 0 0 4px; }
.gap .lead { margin: 0 0 12px; }
.gap-list { display: grid; gap: 10px; margin: 0 0 12px; padding: 0; list-style: none; }
.gap-list li { display: grid; padding: 10px 12px; border-radius: 0; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.gap-name { font-weight: 700; }
.gap-values { font-size: 0.95rem; }
.gap-note { color: var(--muted); font-size: 0.85rem; }
.gap .soon { margin: 0; }

.locked {
  margin: 24px 0;
  padding: 18px;
  border: 2px solid var(--accent);
  border-radius: 0;
  background: var(--card);
}
.locked h2 { margin: 0 0 4px; }
.locked p { margin: 0 0 8px; }
.unlock-list { margin: 0 0 16px; padding-left: 1.2em; }
/* スマホでは親指で押しやすいよう、幅いっぱい・高さ52pxにする。 */
.button.wide { display: block; width: 100%; min-height: 52px; padding: 13px 24px; font-size: 1.05rem; text-align: center; }
.soon { color: var(--muted); font-size: 0.85rem; }
.locked .soon { margin: 10px 0 0; }

@media (min-width: 600px) {
  .button.wide { display: inline-block; width: auto; }
}


/* PCなど広い画面: 横幅を広げ、選択肢を横一列、結果を2列に並べる。 */
.share { margin: 24px 0; text-align: center; }
.share h2 { margin: 0 0 4px; font-size: 1.1rem; }
.share .soon { margin: 0 0 12px; }
.button.share-x { display: block; min-height: 52px; padding: 13px 24px; background: #111; color: #fff; font-size: 1.05rem; text-align: center; }

.type-group h2 { margin: 24px 0 8px; font-size: 1rem; color: var(--muted); }
.type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; list-style: none; }
.type-cards a {
  display: grid;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
}
.type-cards a:hover { border-color: var(--accent); }
.type-card-name { font-weight: 700; line-height: 1.9; }
.type-card-main { color: var(--muted); font-size: 0.85rem; }
.type-detail { margin: 8px 0 0; }
.type-detail .label { margin: 24px 0 0; color: var(--muted); }
.type-detail .title { margin-top: 26px; font-size: 2rem; line-height: 1.6; }
.type-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 16px 0 0; }
.type-facts dt { color: var(--muted); }
.type-facts dd { margin: 0; }

@media (min-width: 760px) {
  .button.share-x { display: inline-block; }
  .type-cards { grid-template-columns: repeat(4, 1fr); }
  .shindan main { max-width: 1040px; padding: 0 32px; }
  .progress-head { margin: 0 -32px 8px; padding: 12px 32px 10px; }
  .question { padding: 40px 0 32px; }
  .q-text { font-size: 1.3rem; }
  .bar { max-width: 520px; margin-top: 24px; }
  .seg { height: 56px; }
  .scale-ends { max-width: 520px; font-size: 0.9rem; }
  .pager { flex-direction: row; justify-content: center; flex-wrap: wrap; }
  .pager .link-button { order: -1; }
}

@media (min-width: 960px) {
  .editions.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .editions.two .edition-result { margin: 8px 0; }
  .gap-list { grid-template-columns: repeat(3, 1fr); }
}

/* 答え終えた直後の「集計中」の演出（CSSだけ）。
   0〜1.6秒「集計中...」→ 1.6〜3.2秒「そろそろ結果が出ます」→ 3.2秒から消えて結果を見せる。
   結果は裏ですでに表示されているので、アニメーションが動かない環境でも最後には必ず消える。 */
.tallying {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--bg);
  animation: tally-out 0.4s ease 3.2s forwards;
}
.tally-spinner {
  width: 56px;
  height: 56px;
  border: 5px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tally-spin 0.9s linear infinite;
}
.tally-text { display: grid; margin: 0; font-size: 1.1rem; font-weight: 700; text-align: center; }
.tally-step { grid-area: 1 / 1; opacity: 0; }
.tally-step-1 { animation: tally-show 1.6s ease 0s forwards; }
.tally-step-2 { animation: tally-show-last 1.6s ease 1.6s forwards; }

@keyframes tally-spin { to { transform: rotate(360deg); } }
@keyframes tally-show { 0% { opacity: 0; } 15%, 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tally-show-last { 0% { opacity: 0; } 15%, 100% { opacity: 1; } }
@keyframes tally-out { to { opacity: 0; visibility: hidden; } }

/* 動きを減らす設定の人には、回転をやめて短く見せる。 */
@media (prefers-reduced-motion: reduce) {
  .tally-spinner { animation: none; }
  .tallying { animation-delay: 1.2s; }
  .tally-step-1 { animation-duration: 0.6s; }
  .tally-step-2 { animation-delay: 0.6s; animation-duration: 0.6s; }
}

/* アフィリエイト（管理画面で ON にした枠）。広告であることを「PR」で必ず示す。 */
.affiliate { margin: 24px 0; padding: 12px 16px; border: 1px solid var(--line); background: var(--card); text-align: left; }
.affiliate ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.affiliate li { display: flex; align-items: center; gap: 8px; }
.affiliate .pr { flex: none; padding: 0 6px; border: 1px solid var(--muted); color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.affiliate a { color: var(--fg); }

/* 結果のレーダーグラフ。プライベートは --accent、仕事は --no の色。角は丸めない。 */
.radar {
  margin: 16px 0;
  padding: 18px 12px;
  border-radius: 0;
  background: var(--card);
  border: 1px solid var(--line);
}
.radar h2 { margin: 0 0 8px; padding: 0 6px; font-size: 1.1rem; }
.radar-chart { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; overflow: visible; }
.radar-ring { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-axis { stroke: var(--line); stroke-width: 1; }
.radar-area { stroke-width: 2; stroke-linejoin: miter; }
.radar-area.private { fill: color-mix(in srgb, var(--accent) 28%, transparent); stroke: var(--accent); }
.radar-area.work { fill: color-mix(in srgb, var(--no) 22%, transparent); stroke: var(--no); }
.radar-dot.private { fill: var(--accent); }
.radar-dot.work { fill: var(--no); }
.radar-label { fill: var(--fg); font-size: 12px; }
.radar-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 0.9rem; }
.radar-legend li { display: flex; align-items: center; gap: 6px; }
.radar-key { display: inline-block; width: 14px; height: 14px; border-radius: 0; }
.radar-key.private { background: var(--accent); }
.radar-key.work { background: var(--no); }
.radar-note { margin: 6px 0 0; color: var(--muted); font-size: 0.8rem; text-align: center; }

/* タイプ名のふりがな（すべてのタイプに付ける）。 */
.type-ruby { ruby-position: over; }
.type-ruby rt { font-size: 0.5em; font-weight: 400; letter-spacing: 0.05em; line-height: 1.2; }

/* 結果の動き。成分のかたちは中心から広がり、メーターは左から伸びる。
   static/js/shindan-grow.js が、画面に映った部分に grow-in を付けて動かす。
   JavaScript が動かない環境や、動きを減らす設定の人には、最初から全部を表示する。 */
.radar-area,
.radar-dot {
  transform-box: view-box;
  transform-origin: 170px 170px; /* グラフの中心（shindan/radar.py の CENTER） */
}
.ingredient meter { transform-origin: left center; }
.grow-wait .radar-area,
.grow-wait .radar-dot { transform: scale(0); opacity: 0; }
.grow-wait .ingredient meter { transform: scaleX(0); }
.grow-in .radar-area,
.grow-in .radar-dot { animation: radar-grow 1s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.grow-in .radar-area.work,
.grow-in .radar-dot.work { animation-delay: 0.2s; }
.grow-in .ingredient meter { animation: meter-grow 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.grow-in .ingredient:nth-child(n+4) meter { animation-delay: 0.15s; }
.grow-in .ingredient:nth-child(n+9) meter { animation-delay: 0.3s; }

@keyframes radar-grow { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes meter-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
