/* 倉ぼっこ様のお見通し：利用者向け画面（8.3、付録A）
   スマートフォンを第一に設計し、900px 以上で PC 用の2列レイアウトにする。 */

:root {
  --bg: #F6F1E7;
  --ink: #1F2757;
  --ink-hover: #3A4690;
  --sub: #4F5675;
  --muted: #8A8FA8;
  --line: #E2D8C1;
  --gold: #C79A3B;
  --cream: #F6E7B8;
  --paper: #FFFFFF;
  --chip: #F3EEDF;
  --danger: #9B2C2C;
  --font: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  --display: 'Kaisei Decol', 'Hiragino Mincho ProN', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
a { color: var(--ink); }
a:hover { color: var(--ink-hover); }
button { font-family: inherit; }
.noscript { padding: 24px 16px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---- ヘッダー ---- */
.hdr { border-bottom: 1px solid var(--line); }
.hdr-in {
  max-width: 1120px; margin: 0 auto; height: 56px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.logo { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: .04em; text-decoration: none; white-space: nowrap; }
.pill { padding: 3px 12px; border-radius: 999px; border: 1px solid var(--gold); font-size: 12px; font-weight: 700; white-space: nowrap; }
.qno { padding: 4px 14px; border-radius: 999px; background: var(--ink); color: var(--cream); font-size: 14px; font-weight: 700; white-space: nowrap; }
.hdr-right { display: flex; align-items: center; gap: 16px; }
.linkbtn {
  border: none; background: none; color: var(--ink); font-size: 14px; font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px; padding: 12px 0; cursor: pointer; min-height: 44px;
}

/* ---- 本文 ---- */
.main {
  flex-grow: 1; width: 100%; max-width: 480px; margin: 0 auto;
  padding: 18px 16px 28px; display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.stack { width: 100%; display: flex; flex-direction: column; gap: 10px; }

/* ---- 吹き出し（A.2：HTML / CSS で表示し、長文でも伸縮する） ---- */
.bubble {
  position: relative; width: 100%; background: var(--paper); border: 1.5px solid var(--ink);
  border-radius: 18px; padding: 14px 18px; font-size: 16px; line-height: 1.65; font-weight: 700;
  text-align: center; overflow-wrap: anywhere;
}
.bubble::after {
  content: ''; position: absolute; width: 14px; height: 14px; background: var(--paper);
  left: 50%; bottom: -8px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink);
  transform: translateX(-50%) rotate(45deg);
}
.bubble.up::after { bottom: auto; top: -8px; border: none; border-left: 1.5px solid var(--ink); border-top: 1.5px solid var(--ink); }
.bubble.q { font-size: 21px; line-height: 1.55; padding: 18px 20px; }
.aside { display: block; font-size: 13px; font-weight: 500; color: var(--sub); margin-bottom: 6px; line-height: 1.5; }
.status { margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 500; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: blink 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* ---- キャラクター（表示領域の寸法は固定する。8.3、A.2） ---- */
.chara { position: relative; width: 228px; height: 304px; flex-shrink: 0; }
.chara img { width: 100%; height: 100%; object-fit: contain; display: block; }
.chara.sm { width: 198px; height: 264px; }
.face {
  width: 116px; height: 116px; border-radius: 50%; border: 2px solid var(--gold);
  background: var(--paper); overflow: hidden; flex-shrink: 0;
}
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face.xs { width: 72px; height: 72px; }
.chara.empty, .face.empty { display: none; }
.sparkle { position: absolute; fill: var(--gold); }

/* ---- 手順 ---- */
.steps { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.steps li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; line-height: 1.45; text-align: center; }
.steps b { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--gold); display: flex; align-items: center; justify-content: center; font-size: 13px; }

/* ---- ボタン ---- */
.btn {
  width: 100%; min-height: 56px; border-radius: 28px; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--cream); font-size: 18px; font-weight: 700; letter-spacing: .06em;
  display: flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; padding: 8px 16px;
}
.btn:hover { background: var(--ink-hover); color: var(--cream); }
.btn.outline { background: var(--paper); color: var(--ink); }
.btn.outline:hover { background: var(--chip); }
.btn:disabled { opacity: .55; cursor: default; }
.grid2 { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.answers { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.ans {
  min-height: 52px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink);
  font-size: 17px; font-weight: 500; cursor: pointer; touch-action: manipulation;
}
.ans.strong { font-weight: 700; }
.ans.soft { border-color: var(--muted); color: var(--sub); }
.ans:hover:not(:disabled) { background: var(--chip); }
.ans:disabled { border-color: #B9BCCB; color: var(--muted); cursor: default; }
.ans.chosen, .ans.chosen:disabled { background: var(--ink); color: var(--cream); border-color: var(--ink); font-weight: 700; }
.back {
  align-self: flex-start; min-height: 44px; padding: 0 14px 0 8px; border: none; background: transparent; color: var(--ink);
  font-size: 15px; display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.back:disabled { color: var(--muted); cursor: default; }
.back svg { stroke: currentColor; }

/* ---- カード ---- */
.card { width: 100%; background: var(--paper); border: 2px solid var(--gold); border-radius: 16px; padding: 18px 20px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.card .title { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.3; overflow-wrap: anywhere; }
.card .desc { font-size: 14px; line-height: 1.6; color: var(--sub); }
.card .label { font-size: 13px; font-weight: 700; color: var(--sub); letter-spacing: .1em; }
.note { margin: 0; font-size: 13px; line-height: 1.7; color: var(--sub); text-align: center; }
.small { font-size: 12px; }

/* ---- テーマ選択 ---- */
.themes { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.theme-link {
  min-height: 88px; padding: 14px 16px; border: 1.5px solid var(--ink); border-radius: 16px; background: var(--paper);
  text-decoration: none; display: flex; align-items: center; gap: 14px;
}
.theme-link:first-child { border: 2px solid var(--gold); }
.theme-link span { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }
.theme-link .t { font-family: var(--display); font-size: 20px; font-weight: 700; }
.theme-link .d { font-size: 13px; line-height: 1.5; color: var(--sub); }
.theme-link .c { font-size: 12px; font-weight: 700; }
.row { width: 100%; display: flex; align-items: center; gap: 12px; }
.row .bubble { text-align: left; }
.row .bubble::after { left: -8px; top: 50%; bottom: auto; border: none; border-left: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: translateY(-50%) rotate(45deg); }

/* ---- 学習投稿フォーム ---- */
.form { width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.field > label, legend { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--ink); color: var(--cream); }
.tag.opt { background: none; border: 1px solid var(--muted); color: var(--sub); }
.input { height: 48px; border: 1.5px solid var(--ink); border-radius: 12px; padding: 0 14px; font-family: inherit; font-size: 16px; color: var(--ink); background: var(--paper); width: 100%; }
.input.opt { border-color: var(--muted); }
.suggest { list-style: none; margin: 0; padding: 4px; border: 1px solid #D4CAB2; border-radius: 12px; background: var(--paper); display: flex; flex-direction: column; }
.suggest:empty { display: none; }
.suggest button {
  width: 100%; min-height: 44px; border: none; border-radius: 8px; background: var(--paper); text-align: left; padding: 6px 12px;
  font-size: 15px; color: var(--ink); display: flex; flex-direction: column; gap: 1px; cursor: pointer;
}
.suggest button:hover, .suggest button[aria-selected="true"] { background: var(--chip); }
.suggest .n { font-weight: 700; }
.suggest .d { font-size: 12px; color: var(--sub); }
.picked { font-size: 13px; color: var(--sub); }
fieldset { margin: 0; padding: 0; border: none; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-size: 13px; }
.radios { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.radios label { min-height: 44px; border: 1.5px solid var(--ink); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 14px; font-weight: 700; cursor: pointer; }
.radios input { margin: 0; accent-color: var(--ink); }
.radios label:has(input:checked) { background: var(--ink); color: var(--cream); }
.err { color: var(--danger); font-size: 13px; margin: 0; }
.hidden { display: none !important; }

/* ---- PC（8.3：PCでは吹き出しと並ぶ大きさ） ---- */
@media (min-width: 900px) {
  .logo { font-size: 22px; }
  .hdr-in { height: 64px; padding: 0 32px; }
  .main.pc2 {
    max-width: 1120px; padding: 40px 32px 48px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 48px;
  }
  .pc2 .col-chara { flex: 0 1 380px; display: flex; justify-content: center; }
  .pc2 .col-body { flex: 999 1 480px; min-width: 0; max-width: 560px; display: flex; flex-direction: column; gap: 22px; align-items: stretch; }
  .pc2 .chara { width: 380px; height: 507px; }
  .pc2 .face { display: none; }
  .pc2 .chara.mobile-hide { display: block; }
  .pc2 .bubble { text-align: left; font-size: 20px; padding: 22px 26px; }
  .pc2 .bubble::after { left: -9px; top: 50%; bottom: auto; border: none; border-left: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: translateY(-50%) rotate(45deg); }
  .pc2 .bubble.q { font-size: 28px; line-height: 1.5; }
  .pc2 .ans { min-height: 54px; font-size: 18px; }
}
@media (max-width: 899px) {
  /* スマートフォンでは2列の枠を外し、吹き出し → キャラクター → 操作 の順に縦に並べる */
  .main > .col-chara, .main > .col-body { display: contents; }
  .main .bubble-top { order: -1; }
  .col-chara .chara.mobile-hide { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dots i { animation: none; opacity: .7; }
}
