/* 親しみやすさ優先（2026-10-30 森さん）：生成りの地・こげ茶の文字・コーラルのマーカー・やわらかい青のボタン。
   ①〜④は、それぞれ淡い色の丸で見分けやすくする（色だけに頼らず番号も付ける）
   決め事（UI/UXレポートより）：余白は8の倍数／文字は役割で4段（見出し32・設問22〜24・本文16・注14。14未満は使わない）／
   文字のコントラスト4.5:1以上・部品の縁3:1以上（全ペア実測済み）／強調は1画面1か所／状態は色＋形で示す */
:root {
  color-scheme: light;
  --bg: #fbf6ee;        /* 生成り */
  --panel: #ffffff;
  --panel-2: #f4ede2;
  --line: #eadfce;      /* 飾りの線だけ（情報を持たない） */
  --edge: #968475;      /* 札・入力欄の縁：地に対して3:1以上 */
  --dim: #74675b;       /* 薄い文字：5:1以上 */
  --ink: #3a2f28;       /* こげ茶（真っ黒より柔らかい） */
  --muted: #6b5e53;
  --sky: #2470b3;       /* 主ボタン・選んだ札の縁 */
  --sky-soft: #e5f1fb;  /* 選んだ札の地 */
  --brush: #ffcdb2;     /* コーラルのマーカー */
  --n1: #ffd9c7; --n2: #cdeedd; --n3: #d4e8fb; --n4: #fde9a6;
  --red: #c0392b;
  --radius: 20px;
  --tap: 60px;
  --shadow: 0 2px 0 rgba(58, 47, 40, .06), 0 8px 24px -12px rgba(58, 47, 40, .18);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Zen Kaku Gothic New", system-ui, -apple-system, "Hiragino Sans", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* ---------- 画面の出入り ---------- */
.screen { display: flex; flex-direction: column; flex: 1; animation: in .38s var(--ease) both; }
.screen.back { animation-name: in-back; }
@keyframes in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes in-back { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen, .screen.back { animation: none; } * { transition: none !important; } }

/* ---------- 上の帯（戻る＋進み具合） ---------- */
.top { display: flex; align-items: center; gap: 12px; height: 48px; margin-bottom: 24px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel); border: 1.5px solid var(--edge); cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- 見出し ---------- */
h1, h2 { font-weight: 900; line-height: 1.35; margin: 0; letter-spacing: .01em; }
h1 { font-size: clamp(30px, 8.6vw, 36px); }
h2 { font-size: clamp(22px, 6.4vw, 24px); margin-bottom: 8px; }
.opt { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 2px 8px; border-radius: 999px; border: 1.5px solid var(--edge); color: var(--muted); font-size: 14px; font-weight: 700; line-height: 1.6; }
.brush { position: relative; z-index: 0; display: inline; padding: 0 .12em; }
.brush::before {
  content: ""; position: absolute; z-index: -1;
  left: -.18em; right: -.18em; top: .2em; bottom: .02em;
  background: var(--brush);
  transform: rotate(-1.6deg);
  clip-path: polygon(1% 12%, 99% 0, 100% 86%, 0 100%);
}
.hint { color: var(--muted); margin: 0 0 24px; }

/* ---------- 開始 ---------- */
.hero { justify-content: center; gap: 24px; padding-top: 4vh; }
.hero .lead { font-size: 18px; font-weight: 700; margin: 0; }
.intro { display: grid; gap: 16px; padding: 24px 0 8px; }
.intro .lead { font-size: 17px; font-weight: 700; margin: 0; }
.facts { color: var(--muted); font-size: 14px; margin: 0; }
/* 設問どうしは広く、設問の中は狭く（近接） */
.q { padding-top: 40px; }
.screen > .top + .q { padding-top: 0; }
.q[hidden] { display: none; }
.q:not([hidden]) { animation: rise .32s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 案内役（似顔絵＋吹き出し） ---------- */
.face { display: block; height: auto; }
.guide { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 16px; }
.guide .face { width: 72px; flex: none; }
.bubble {
  position: relative; margin: 0 0 16px; padding: 12px 16px; border-radius: 16px 16px 16px 4px;
  background: var(--panel); border: 1.5px solid var(--edge); font-size: 15px; font-weight: 700; line-height: 1.6;
}
.guide.sad .bubble { color: var(--red); border-color: var(--red); }
.face.pop { animation: pop .36s var(--ease); }
@keyframes pop { 0% { transform: scale(.85) rotate(-4deg); } 60% { transform: scale(1.06) rotate(2deg); } 100% { transform: none; } }
.intro-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 8px; align-items: end; }
.intro-row > div { display: grid; gap: 16px; }
.hero-face { width: 104px; margin-bottom: -8px; }
.done-head { display: grid; grid-template-columns: minmax(0, 1fr) 128px; align-items: center; gap: 8px; }
.done-face { width: 128px; }
@media (prefers-reduced-motion: reduce) { .face.pop { animation: none; } }

/* ---------- 選択の札 ---------- */
.cards { display: grid; gap: 8px; }
.card {
  position: relative; width: 100%; min-height: var(--tap);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 16px;
  text-align: left; padding: 16px;
  background: var(--panel); border: 1.5px solid var(--edge); border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.card:active { transform: scale(.985); }
.num {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--n1); color: var(--ink); font-weight: 900; font-size: 18px;
}
.num.n2 { background: var(--n2); } .num.n3 { background: var(--n3); } .num.n4 { background: var(--n4); }
.card .t { font-weight: 900; font-size: 17px; line-height: 1.4; display: block; }
.card .s { color: var(--muted); font-size: 14px; line-height: 1.5; display: block; margin-top: 4px; }
.card .tag {
  display: inline-block; font-size: 14px; font-weight: 700; line-height: 1.2;
  padding: 4px 8px; border-radius: 999px; background: var(--panel-2); color: var(--ink); margin-bottom: 8px;
}
.card .check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--edge);
  display: grid; place-items: center; transition: all .2s var(--ease);
}
.card.box .check { border-radius: 8px; }
.card .check svg { width: 16px; height: 16px; opacity: 0; transform: scale(.6); transition: all .2s var(--ease); }
/* 選んだ札：淡い青の地＋青の太い縁＋青のチェック（色と形の二重） */
.card[aria-checked="true"] { background: var(--sky-soft); border-color: var(--sky); box-shadow: 0 0 0 1.5px var(--sky); }
.card[aria-checked="true"] .tag { background: var(--panel); }
.card[aria-checked="true"] .check { border-color: var(--sky); background: var(--sky); color: #fff; }
.card[aria-checked="true"] .check svg { opacity: 1; transform: none; }
/* ①〜④は「札＋過去に作ったものを見る」をひとまとまりの枠にする */
.item { border: 1.5px solid var(--edge); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); overflow: hidden;
  transition: background .2s var(--ease), border-color .2s var(--ease); }
.item > .card { border: 0; box-shadow: none; background: transparent; border-radius: 0; }
.item.on { background: var(--sky-soft); border-color: var(--sky); box-shadow: 0 0 0 1.5px var(--sky); }
.item > .card[aria-checked="true"] { background: transparent; box-shadow: none; }
.pv-toggle {
  width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 4px;
  border: 0; border-top: 1px dashed var(--edge); background: transparent; color: var(--sky);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.pv-toggle svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.pv-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
/* 過去の開発の画面の流れ（3コマ） */
.pv { display: block; margin: 0 12px 12px; padding: 8px; border-radius: 12px; background: var(--bg); }
.pv-art svg { display: block; width: 100%; height: auto; }
.pv-steps { display: grid; grid-template-columns: 64fr 24fr 64fr 24fr 64fr; font-size: 14px; font-weight: 700; text-align: center; line-height: 1.3; margin-top: 4px; }
.pv-steps span:nth-child(2) { grid-column: 3; } .pv-steps span:nth-child(3) { grid-column: 5; }
.pv-note { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.pv[hidden] { display: none; }
.pv:not([hidden]) { animation: rise .28s var(--ease) both; }
.item.on .pv { background: var(--panel); }
.card.simple { grid-template-columns: 1fr auto; font-weight: 700; font-size: 17px; }

/* ---------- 自由記述 ---------- */
.write { position: relative; }
textarea {
  width: 100%; min-height: 200px; resize: vertical;
  padding: 16px; border-radius: var(--radius);
  background: var(--panel); border: 1.5px solid var(--edge); box-shadow: var(--shadow);
  font-size: 16px; line-height: 1.7;
  transition: border-color .2s var(--ease);
}
textarea:focus { outline: none; border-color: var(--sky); }
textarea::placeholder { color: var(--dim); }
.len { text-align: right; color: var(--muted); font-size: 14px; margin-top: 8px; }
.len.over { color: var(--red); font-weight: 700; }
.starters-label { color: var(--muted); font-size: 14px; font-weight: 700; margin: 16px 0 8px; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; }
.starter {
  min-height: 44px; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1.5px dashed var(--edge); color: var(--ink); font-size: 14px; font-weight: 700;
}
.starter:active { background: var(--panel-2); }
.note {
  margin: 0 0 16px; padding: 12px 16px; border-radius: 12px;
  background: var(--panel-2); font-size: 15px;
}

/* ---------- 下のボタン ---------- */
/* 主なボタンは、長い画面でも親指の届く下に留める */
.foot {
  margin-top: auto; padding-top: 24px; display: grid; gap: 8px;
  position: sticky; bottom: 0; z-index: 1;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  margin-bottom: calc(-1 * max(24px, env(safe-area-inset-bottom)));
  background: linear-gradient(to bottom, rgba(251, 246, 238, 0), var(--bg) 24px);
}
.btn {
  min-height: 56px; width: 100%; border-radius: 999px; cursor: pointer;
  font-weight: 900; font-size: 18px; letter-spacing: .04em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; border: 0;
  background: var(--sky); color: #fff;
  box-shadow: 0 4px 0 #1a5590;
  transition: transform .12s var(--ease), opacity .2s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #1a5590; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.ghost { background: var(--panel); color: var(--ink); border: 1.5px solid var(--edge); box-shadow: none; }
.btn svg { width: 20px; height: 20px; }

/* ---------- 確認 ---------- */
.review { display: grid; gap: 8px; margin-bottom: 16px; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: start;
  padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.row .k { color: var(--muted); font-size: 14px; font-weight: 700; }
.row .v { grid-column: 1; font-weight: 700; white-space: pre-wrap; word-break: break-word; }
.row .v.empty { color: var(--dim); font-weight: 400; }
.row .v.clip { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.row button {
  grid-column: 2; grid-row: 1 / span 2; align-self: center;
  background: none; border: 0; color: var(--sky); font-weight: 700; cursor: pointer; padding: 10px 4px; min-height: 44px;
}
.turnstile { min-height: 72px; display: flex; justify-content: center; align-items: center; color: var(--muted); font-size: 14px; }
.err { display: flex; gap: 8px; align-items: flex-start; color: var(--red); font-weight: 700; margin: 8px 0 0; font-size: 15px; }
.err::before { content: "!"; flex: none; width: 20px; height: 20px; margin-top: 3px; border-radius: 50%; background: var(--red); color: #fff; font-size: 14px; font-weight: 900; display: grid; place-items: center; line-height: 1; }
.cards.invalid .card, textarea.invalid { border-color: var(--red); }

/* ---------- 完了 ---------- */
.done { justify-content: center; gap: 24px; text-align: left; padding-top: 6vh; }
.pick {
  display: grid; gap: 8px;
  padding: 16px; border-radius: var(--radius); background: var(--panel); border: 1.5px solid var(--edge); box-shadow: var(--shadow);
}
.pick-row { display: flex; align-items: center; gap: 12px; }
.pick .num { flex: none; }
.pick small { color: var(--muted); font-weight: 700; }
.pick b { font-size: 18px; font-weight: 900; line-height: 1.4; }
.toast { min-height: 1.7em; text-align: center; color: var(--muted); margin: 0; font-size: 14px; }
.privacy { color: var(--dim); font-size: 14px; margin: 8px 0 0; }
