/* =========================================================================
   このこ図鑑 — 知育玩具えらび しぼりこみ診断
   design_handoff_konoko_zukan の hifi 仕様を vanilla CSS に移植。
   ========================================================================= */

:root {
  /* 紙地・面 */
  --paper:      oklch(0.955 0.018 80);
  --paper-2:    oklch(0.925 0.022 78);
  --backdrop:   oklch(0.885 0.024 76);
  --card:       oklch(0.972 0.013 82);
  /* 文字 */
  --ink:        oklch(0.305 0.018 58);
  --ink-soft:   oklch(0.47 0.018 58);
  --ink-faint:  oklch(0.62 0.016 60);
  /* 罫 */
  --line:       oklch(0.80 0.02 70);
  --line-soft:  oklch(0.86 0.018 72);

  /* 4つの興味軸（くすませた図鑑トーン） */
  --terracotta:      oklch(0.62 0.115 42);
  --terracotta-soft: oklch(0.905 0.045 50);
  --terracotta-ink:  oklch(0.43 0.10 42);
  --mustard:      oklch(0.735 0.10 82);
  --mustard-soft: oklch(0.925 0.05 88);
  --mustard-ink:  oklch(0.485 0.085 78);
  --blue:      oklch(0.63 0.06 246);
  --blue-soft: oklch(0.905 0.03 248);
  --blue-ink:  oklch(0.435 0.05 246);
  --sage:      oklch(0.655 0.062 152);
  --sage-soft: oklch(0.905 0.034 150);
  --sage-ink:  oklch(0.44 0.05 150);

  /* タイポ */
  --serif: "Klee One", "Hiragino Maru Gothic ProN", serif;       /* 見出し・名前・図鑑タイトル */
  --sans:  "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif; /* 本文 */
  --mono:  "Spline Sans Mono", ui-monospace, monospace;          /* ラテン小ラベル・番号 */

  --cta:        oklch(0.40 0.058 150);   /* 深いボタニカルグリーン（主要ボタン） */
  --cta-strong: oklch(0.345 0.052 150);  /* 押下・濃い側 */

  --maxw: 440px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--backdrop);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 紙のざらつき（固定オーバーレイ） */
.grain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 300;
  opacity: 0.05; mix-blend-mode: multiply;
}
body[data-grain="off"] .grain { display: none; }

/* 筐体（スマホ縦・中央寄せ） */
.app {
  max-width: var(--maxw);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  display: flex; flex-direction: column;
  box-shadow: 0 0 0 1px oklch(0.3 0.04 60 / 0.05), 0 24px 60px -30px oklch(0.3 0.04 60 / 0.4);
}

.kicker {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.22em;
  color: var(--ink-faint); text-transform: none;
}

.hidden { display: none !important; }

/* ---- PR常設バー ---- */
.pr-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line-soft);
}
.pr-tag {
  flex: 0 0 auto;
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  color: #fff; background: var(--ink-soft);
  border-radius: 3px; padding: 1px 6px;
}
.pr-text { font-family: var(--mono); font-size: 10.5px; color: var(--ink-soft); line-height: 1.3; }

/* ---- scroll area ---- */
.scroll { flex: 1; }

/* 画面遷移アニメ */
.screen { animation: screen-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* トップ初回ロード：要素を順番に立ち上げる（統制されたstagger） */
#screen-top { animation: none; }
#screen-top > * { animation: rise-in 0.62s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
#screen-top > *:nth-child(1) { animation-delay: 0.04s; }
#screen-top > *:nth-child(2) { animation-delay: 0.14s; }
#screen-top > *:nth-child(3) { animation-delay: 0.24s; }
#screen-top > *:nth-child(4) { animation-delay: 0.34s; }
#screen-top > *:nth-child(5) { animation-delay: 0.44s; }
#screen-top > *:nth-child(6) { animation-delay: 0.54s; }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
/* 標本サムネイルは少し遅れて1つずつ咲く */
#screen-top .spec { animation: thumb-in 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
#screen-top .spec:nth-child(1) { animation-delay: 0.30s; }
#screen-top .spec:nth-child(2) { animation-delay: 0.40s; }
#screen-top .spec:nth-child(3) { animation-delay: 0.50s; }
#screen-top .spec:nth-child(4) { animation-delay: 0.60s; }
@keyframes thumb-in {
  from { opacity: 0; transform: translateY(10px) scale(0.92); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .screen, #screen-top > *, #screen-top .spec, .q-opt { animation: none !important; }
}

/* =======================================================================
   トップ
   ======================================================================= */
#screen-top { padding: 30px 24px 40px; }
.top-head { text-align: center; }
.top-title {
  font-family: var(--serif); font-weight: 600;
  font-size: 46px; letter-spacing: 0.04em;
  margin: 10px 0 0; color: var(--ink);
}
.top-lead {
  font-size: 14.5px; color: var(--ink-soft);
  margin: 14px auto 0; max-width: 320px; text-wrap: pretty;
}
.top-lead em {
  font-style: normal; font-family: var(--serif); font-weight: 600;
  color: var(--terracotta-ink);
}

.top-hero {
  margin: 18px -4px 6px;
}
.top-hero img {
  display: block; width: 100%; height: auto;
  border-radius: 10px;
}

.specimens {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 14px 0 26px; padding: 16px 8px;
  border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
}
.spec-legend-cap {
  text-align: center; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.16em; color: var(--ink-faint); margin: 0 0 2px;
}
.spec { text-align: center; }
.spec-mark { display: flex; justify-content: center; margin-bottom: 6px; }
.spec-thumb {
  width: 66px; height: 66px; margin: 0 auto 8px;
  border: 1.5px solid; border-radius: 14px; overflow: hidden;
  background: #f7f0dd;
  box-shadow: 0 5px 12px -8px oklch(0.3 0.04 60 / 0.45);
}
.spec-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.spec-name { font-family: var(--serif); font-size: 13px; color: var(--ink); }

.top-form {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 16px 16px 18px; margin-bottom: 22px;
}
.form-kicker { letter-spacing: 0.16em; margin-bottom: 12px; }
.field { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.field-label { font-family: var(--serif); font-size: 13.5px; color: var(--ink); min-width: 64px; }
.field-input {
  flex: 1; font: inherit; font-size: 15px; color: var(--ink);
  background: transparent; border: none; border-bottom: 1.5px solid var(--line);
  padding: 6px 2px; outline: none;
}
.field-input:focus { border-bottom-color: var(--ink-soft); }
.age-row { display: flex; flex-wrap: wrap; gap: 8px 8px; margin-top: 10px; }
.age-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; font: inherit; font-size: 13.5px; color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 16px; white-space: nowrap; cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s;
}
.age-chip:active { transform: scale(0.96); }
.age-chip[aria-pressed="true"] { color: var(--paper); background: var(--cta); border-color: var(--cta); }

.cta {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px;
  font: inherit; font-family: var(--serif); font-weight: 600; font-size: 17px;
  color: var(--paper); background: var(--cta);
  border: none; border-radius: 14px; padding: 16px 18px; white-space: nowrap; cursor: pointer;
  box-shadow: 0 14px 28px -14px oklch(0.40 0.058 150 / 0.65);
  transition: transform 0.15s ease, background 0.18s ease;
}
.cta:hover { background: var(--cta-strong); }
.cta:active { transform: translateY(1px) scale(0.995); }
.cta-arrow { font-family: var(--mono); font-size: 16px; }
.top-disclaim {
  font-size: 11.5px; line-height: 1.7; color: var(--ink-faint);
  text-align: center; margin: 16px auto 0; max-width: 320px;
}

/* =======================================================================
   質問
   ======================================================================= */
#screen-q { padding: 22px 24px 40px; }
.q-top { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.q-back {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink-soft); font-size: 18px; line-height: 1; cursor: pointer;
}
.q-prog { flex: 1; }
.q-prog-text { font-family: var(--mono); font-size: 12px; margin-bottom: 7px; }
.q-prog-num { color: var(--ink); font-weight: 600; font-size: 14px; }
.q-prog-tot { color: var(--ink-faint); }
.q-prog-track { display: flex; align-items: center; gap: 5px; }
.q-prog-dot { height: 8px; border-radius: 999px; transition: all 0.35s ease; }

.q-title {
  font-family: var(--serif); font-weight: 600;
  font-size: 25px; line-height: 1.4; color: var(--ink);
  text-wrap: balance; margin: 0 0 6px;
}
.q-note { font-size: 12.5px; color: var(--ink-faint); margin: 0 0 24px; }

.q-opts { display: flex; flex-direction: column; gap: 11px; }
.q-opt {
  display: flex; align-items: center; gap: 14px; text-align: left;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line-soft);
  border-radius: 14px; padding: 16px 17px; cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.12s;
  animation: opt-in 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: var(--delay, 0s);
}
.q-opt:active { transform: scale(0.99); }
.q-opt.is-picked { /* border/bg set inline via axis color */ }
.q-opt-dot { flex: 0 0 auto; width: 13px; height: 13px; border-radius: 999px; opacity: 0.55; transition: opacity 0.2s; }
.q-opt.is-picked .q-opt-dot { opacity: 1; }
.q-opt-text { text-wrap: pretty; }
@keyframes opt-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* =======================================================================
   結果
   ======================================================================= */
#screen-result { padding: 20px 18px 40px; }
.res-lead { text-align: center; margin-bottom: 16px; }
.res-lead-text { font-family: var(--serif); font-size: 15px; color: var(--ink-soft); margin: 6px 0 0; }

/* ---- 標本カード（主役） ---- */
.zukan-card {
  position: relative; background: var(--card);
  border: 1.5px solid var(--ink-soft); border-radius: 6px;
  padding: 22px 22px 20px;
  box-shadow: 0 1px 0 var(--line) inset, 0 18px 40px -22px oklch(0.3 0.04 60 / 0.55);
  overflow: hidden;
}
.zukan-grid {
  position: absolute; inset: 6px; border-radius: 3px; pointer-events: none;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px);
  background-size: 100% 26px; opacity: 0.35;
}
.zukan-corner { position: absolute; opacity: 0.8; line-height: 0; }
.zukan-corner.tl { top: 5px; left: 5px; }
.zukan-corner.tr { top: 5px; right: 5px; }
.zukan-corner.bl { bottom: 5px; left: 5px; }
.zukan-corner.br { bottom: 5px; right: 5px; }

.zk-header { position: relative; display: flex; align-items: baseline; justify-content: space-between; }
.zk-brand { display: flex; align-items: baseline; gap: 7px; font-family: var(--serif); font-size: 16px; color: var(--ink); }
.zk-brand-mark { color: var(--terracotta); font-size: 13px; }
.zk-brand-en { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.24em; color: var(--ink-faint); }
.zk-no { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); letter-spacing: 0.05em; }
.zk-hr { position: relative; height: 1.5px; background: var(--ink-soft); margin: 8px 0 9px; opacity: 0.55; }

.zk-meta {
  position: relative; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); margin-bottom: 16px;
}
.zk-meta-dot { opacity: 0.6; }
.zk-pr-chip {
  margin-left: auto; color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 3px; padding: 1px 6px; letter-spacing: 0.04em; white-space: nowrap;
}

.zk-title-wrap { position: relative; margin-bottom: 16px; }
.zk-kicker { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; color: var(--ink-faint); margin-bottom: 5px; }
.zk-title { font-family: var(--serif); font-weight: 600; font-size: 27px; line-height: 1.25; color: var(--ink); letter-spacing: 0.01em; margin: 0; }
.zk-title-tail { font-size: 18px; color: var(--ink-soft); font-weight: 400; }

/* 標本パネル（主役） */
.zk-specimen {
  position: relative; border: 1.5px solid; border-radius: 8px;
  padding: 18px 18px 20px; margin-bottom: 16px;
  background: var(--card);
}
.zk-spec-mark { display: flex; justify-content: center; margin-bottom: 10px; }
.zk-spec-plate {
  width: 202px; max-width: 70%; margin: 2px auto 14px;
  border: 1px solid; border-radius: 6px; overflow: hidden;
  background: #f7f0dd;
  box-shadow: 0 8px 20px -12px oklch(0.3 0.04 60 / 0.5), 0 1px 0 oklch(1 0 0 / 0.6) inset;
}
.zk-spec-img { display: block; width: 100%; height: auto; }
.zk-spec-body { text-align: center; }
.zk-spec-en { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.32em; opacity: 0.9; margin-bottom: 5px; }
.zk-spec-bloom { font-family: var(--serif); font-size: 31px; font-weight: 600; line-height: 1.16; letter-spacing: 0.01em; }
.zk-spec-name { font-size: 13px; color: var(--ink-soft); margin-top: 7px; }
.zk-observe { font-size: 13.5px; color: var(--ink); line-height: 1.7; margin: 8px 0 0; text-wrap: pretty; }

/* あわせ持つ芽 */
.zk-sub { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px dashed var(--line); }
.zk-sub-inner { display: flex; align-items: center; gap: 9px; }
.zk-sub-label { flex: 0 0 auto; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 3px; padding: 2px 6px; }
.zk-sub-mark { flex: 0 0 auto; display: inline-flex; line-height: 0; }
.zk-sub-name { font-family: var(--serif); font-size: 16px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.zk-sub-bloom { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 6px; }

/* 系統提案 */
.zk-section { margin-bottom: 16px; }
.zk-section-title { font-family: var(--serif); font-size: 15px; color: var(--ink); font-weight: 600; display: block; margin-bottom: 10px; }
.zk-lineages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.zk-lineage { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.zk-line-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 999px; transform: translateY(-1px); }
.zk-line-label { color: var(--ink); font-weight: 500; white-space: nowrap; }
.zk-line-leader { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-3px); min-width: 12px; }
.zk-line-note { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.zk-line-disclaim { font-size: 10.5px; color: var(--ink-faint); margin: 11px 0 0; }

/* おうちでのヒント */
.zk-hint { border: 1px solid; border-radius: 8px; padding: 13px 15px; margin-bottom: 18px; }
.zk-hint-head { font-family: var(--serif); font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.zk-hint-text { font-size: 13px; line-height: 1.7; color: var(--ink); margin: 0; text-wrap: pretty; }

.zk-foot-hr { height: 1px; background: var(--line-soft); margin: 2px 0 11px; }
.zk-foot-disclaim { font-size: 9.8px; line-height: 1.65; color: var(--ink-faint); margin: 0 0 8px; text-wrap: pretty; }
.zk-foot-brand { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; color: var(--ink-faint); text-align: right; }

/* ---- シェア／導線 ---- */
.res-actions { display: flex; gap: 10px; margin-top: 20px; }
.res-btn-primary {
  flex: 1; min-height: 50px; font: inherit; font-family: var(--serif); font-weight: 600; font-size: 15.5px;
  color: var(--paper); background: var(--cta); border: none; border-radius: 12px; padding: 14px; cursor: pointer;
  box-shadow: 0 12px 24px -14px oklch(0.40 0.058 150 / 0.6);
  transition: background 0.18s ease, transform 0.12s ease;
}
.res-btn-primary:hover { background: var(--cta-strong); }
.res-btn-primary:active { transform: translateY(1px); }
.res-btn-ghost {
  flex: 1; min-height: 50px; font: inherit; font-family: var(--serif); font-weight: 600; font-size: 15.5px;
  color: var(--ink); background: var(--card); border: 1.5px solid var(--ink); border-radius: 12px; padding: 14px; cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease;
}
.res-btn-ghost:hover { background: var(--paper-2); }
.res-btn-ghost:active { transform: translateY(1px); }
.res-share-hint { font-size: 12px; color: var(--ink-faint); text-align: center; margin: 11px 0 0; }

.res-pr-cta {
  display: flex; align-items: center; gap: 11px; text-decoration: none;
  margin-top: 22px; padding: 16px 16px; border-radius: 12px; min-height: 58px;
  border: 1.5px solid; color: var(--ink);
  box-shadow: 0 10px 22px -16px oklch(0.3 0.04 60 / 0.55);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}
.res-pr-cta:hover { box-shadow: 0 14px 26px -14px oklch(0.3 0.04 60 / 0.6); }
.res-pr-cta:active { transform: translateY(1px); }
.res-pr-tag { flex: 0 0 auto; font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: var(--paper); border-radius: 3px; padding: 3px 7px; }
.res-pr-text { flex: 1; font-family: var(--serif); font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.res-pr-arrow { flex: 0 0 auto; font-family: var(--mono); font-size: 16px; }
.res-pr-note { font-size: 10.5px; color: var(--ink-faint); margin: 8px 2px 0; text-wrap: pretty; }

/* 二段オファー（A8主CTA＋Amazon二次） */
.res-offers { margin-top: 22px; }
.res-offers-head {
  font-family: var(--serif); font-size: 13px; font-weight: 600;
  color: var(--ink-soft); text-align: center; margin: 0 0 11px;
}
.res-pr-primary { margin-top: 0; align-items: center; }
.res-pr-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; text-align: left; }
.res-pr-kind { font-family: var(--mono); font-size: 10px; letter-spacing: 0.03em; color: var(--ink-faint); }
.res-pr-name { font-family: var(--serif); font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.res-pr-feat { font-family: var(--sans); font-size: 11.5px; font-weight: 500; color: var(--ink-soft); }
.res-pr-primary .res-pr-text { flex: none; font-size: 12px; font-weight: 500; color: var(--ink); line-height: 1.5; }
.res-pr-secondary {
  margin-top: 10px; padding: 12px 14px; min-height: 0;
  border-color: var(--line); background: var(--card); box-shadow: none;
}
.res-pr-secondary .res-pr-text { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.res-pr-secondary:hover { box-shadow: 0 8px 18px -14px oklch(0.3 0.04 60 / 0.5); }
.res-pr-tag-amazon { background: var(--ink-faint); }
.res-pr-imp { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.res-retake {
  display: block; margin: 26px auto 0; font: inherit; font-size: 13.5px;
  color: var(--ink-soft); background: transparent; border: none; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---- サイトフッター ---- */
.site-foot {
  padding: 18px 22px 26px; border-top: 1px solid var(--line-soft);
  background: var(--paper-2);
}
.site-foot p { margin: 0; font-size: 10.5px; line-height: 1.7; color: var(--ink-faint); text-wrap: pretty; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: var(--paper); font-size: 13px; font-family: var(--sans);
  padding: 10px 18px; border-radius: 999px; z-index: 400; white-space: nowrap;
  box-shadow: 0 12px 30px -10px oklch(0.3 0.04 60 / 0.6);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 軸色ヘルパ */
.ax-karada   { color: var(--terracotta); }
.ax-te       { color: var(--mustard); }
.ax-kotoba   { color: var(--blue); }
.ax-kangaeru { color: var(--sage); }

@media (max-width: 380px) {
  .top-title { font-size: 40px; }
  .q-title { font-size: 23px; }
}
