/* ══════════════════════════════════════════════════════════════
   色彩検定2級 一問一答
   「色票帳」— 箱で囲わず、髪罫と余白で区切る。色は青紫ひとつ。
   地は無彩色にそろえる。色を学ぶ教材で地に色味があると、
   同時対比で本文中の色の話が歪んで読まれる。
   色は必ずトークン経由。bare :root が明、media と [data-theme] で暗。
   ══════════════════════════════════════════════════════════════ */

:root {
  /* 紙と罫。色票を見るときの周囲とおなじく無彩色にそろえる */
  --paper:      #F7F7F7;
  --raise:      #FFFFFF;
  --sink:       #EFEFEF;
  --line:       #DFDFDF;
  --line-firm:  #BFBFBF;

  /* 文字 */
  --ink:        #1A1A1A;
  --ink-2:      #4F4F4F;
  --ink-3:      #7D7D7D;

  /* 青紫ひとつ。正解もこれを使い、色数を増やさない */
  --accent:     #4C3A99;
  --accent-2:   #E8E5F4;
  --on-accent:  #FCFBFF;

  /* 誤答だけに使う赤 */
  --wrong:      #A8412F;
  --wrong-2:    #F6E6E1;

  --jp:   "IBM Plex Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #161616;
    --raise:     #1C1C1C;
    --sink:      #232323;
    --line:      #2F2F2F;
    --line-firm: #4A4A4A;
    --ink:       #EAEAEA;
    --ink-2:     #B2B2B2;
    --ink-3:     #868686;
    --accent:    #A79BE8;
    --accent-2:  #262238;
    --on-accent: #14111F;
    --wrong:     #E08B73;
    --wrong-2:   #34201B;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper:     #161616;
  --raise:     #1C1C1C;
  --sink:      #232323;
  --line:      #2F2F2F;
  --line-firm: #4A4A4A;
  --ink:       #EAEAEA;
  --ink-2:     #B2B2B2;
  --ink-3:     #868686;
  --accent:    #A79BE8;
  --accent-2:  #262238;
  --on-accent: #14111F;
  --wrong:     #E08B73;
  --wrong-2:   #34201B;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--jp);
  font-size: 16px;
  line-height: 1.85;          /* 和文は1.7〜1.9が読みやすい */
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: 100%;
  max-width: 45rem;            /* 本文がおよそ40字で折り返す幅 */
  margin-inline: auto;
  padding-inline: 22px;
}

b, strong { font-weight: 600; }

/* 数字はすべてモノスペースの等幅数字で揃える */
.num, .qno b, .qno span, .qscore b, .verdict-score, .bar-num,
.mast-meta b, .foot-in b, .chip .n, .key {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ── 見出しラベル（台帳の項目名） ── */
.frow-label, .tbl-head, .recall-label, .resume-label, .verdict-tag, .mast-meta {
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .14em;
  color: var(--ink-3);
  margin: 0;
}

/* ══ 天板 ══ */
.mast { border-bottom: 1px solid var(--line); background: var(--raise); }
.mast-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 20px; flex-wrap: wrap;
  padding-block: 15px;
}
.logo { margin: 0; display: flex; align-items: center; }
.logo-btn {
  font: inherit; color: inherit; background: none; border: 0;
  margin: 0; padding: 0; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 11px;
  border-radius: 2px;
}
.logo-mark { color: var(--accent); display: flex; }
.logo-txt { display: flex; flex-direction: column; line-height: 1.4; }
.logo-name { font-weight: 600; font-size: 1rem; letter-spacing: .06em; }
.logo-sub {
  font-family: var(--mono); font-size: .66rem;
  letter-spacing: .22em; color: var(--ink-3);
}
.mast-meta i { font-style: normal; opacity: .45; margin-inline: .5em; }
.mast-meta b { color: var(--ink-2); font-weight: 500; }

/* ══ 画面 ══ */
main { padding-block: 44px 64px; }
.screen { display: flex; flex-direction: column; gap: 34px; }

.lede { display: flex; flex-direction: column; gap: 10px; }
.lede h1 {
  margin: 0;
  font-size: clamp(1.45rem, 4.6vw, 1.8rem);
  font-weight: 600; letter-spacing: .04em; line-height: 1.5;
  text-wrap: balance;
}
.lede p { margin: 0; color: var(--ink-2); max-width: 40em; }
.lede b { color: var(--ink); }

/* ══ 設定フォーム：箱ではなく罫で区切る ══ */
.form { border-top: 1px solid var(--line); }
.frow {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 4px 22px;
  align-items: start;
  padding-block: 16px;
  border-bottom: 1px solid var(--line);
}
.frow-label { padding-top: .45em; }
.frow-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.frow-help { margin: 0; font-size: .8rem; line-height: 1.7; color: var(--ink-3); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: .85rem; letter-spacing: .02em;
  line-height: 1.5;
  padding: 5px 12px;
  border: 1px solid var(--line-firm);
  background: transparent; color: var(--ink-2);
  border-radius: 2px;
  cursor: pointer;
  display: inline-flex; align-items: baseline; gap: 7px;
  transition: color .12s, border-color .12s, background .12s;
}
.chip .n { font-size: .72em; opacity: .65; }
/* 単一選択（難易度・出題数・出題順）＝ひとつだけ塗る */
.chip[aria-checked="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
.chip[aria-checked="true"] .n { opacity: .8; }

/* 複数選択（カテゴリ）＝「含む」ことが分かればよいので淡く */
.chip[aria-pressed="true"] {
  background: var(--accent-2); border-color: var(--accent); color: var(--accent);
  font-weight: 500;
}
.chip[aria-pressed="true"] .n { opacity: .75; }

.launch {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.tally { margin: 0; font-size: .85rem; color: var(--ink-2); }
.tally b {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 1.35rem; font-weight: 500; color: var(--ink);
  margin-inline: .12em;
}
.tally span { color: var(--ink-3); }

/* ══ ボタン ══ */
.btn {
  font: inherit; font-size: .92rem; letter-spacing: .06em;
  cursor: pointer; border: 1px solid transparent; border-radius: 2px;
  padding: 11px 26px;
  transition: background .12s, color .12s, border-color .12s, opacity .12s;
}
.btn-solid { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-solid:disabled { opacity: .35; cursor: not-allowed; }
.btn-quiet { background: transparent; border-color: var(--line-firm); color: var(--ink-2); }
.btn-quiet:disabled { opacity: .35; cursor: not-allowed; border-color: var(--line); }
.btn-text {
  background: none; border: 0; padding: 4px 0;
  font-size: .78rem; color: var(--ink-3);
  text-decoration: underline; text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

:where(button, [tabindex], a):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}

/* ══ 前回の記録 ══ */
.recall {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  padding: 16px 0 0; border-top: 1px solid var(--line);
}
.recall-line { margin: 0; font-size: .88rem; color: var(--ink-2); }
.recall-line b { font-family: var(--mono); font-weight: 500; color: var(--ink); }

/* 中断中のクイズ。設定画面のいちばん上に出して、続きから戻れることを知らせる */
.resume {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  padding: 15px 16px;
  background: var(--accent-2);
  border-left: 2px solid var(--accent);
}
.resume-label { color: var(--accent); }
.resume-line { margin: 0; font-size: .88rem; color: var(--ink-2); }
.resume-line b { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.resume-actions { display: flex; flex-wrap: wrap; gap: 9px; }

.fineprint { margin: 0; font-size: .75rem; line-height: 1.8; color: var(--ink-3); }

/* ══ 出題：目盛りつきの進捗 ══ */
.ruler {
  height: 2px; background: var(--line);
  position: relative;
}
.ruler span {
  position: absolute; inset: 0 auto 0 0;
  width: 0; background: var(--accent);
  transition: width .28s ease;
}

.qhead {
  display: flex; align-items: baseline; gap: 8px 18px; flex-wrap: wrap;
  margin-top: -20px;
}
.qno { margin: 0; color: var(--ink-3); font-size: .8rem; }
.qno b { font-size: 1.5rem; font-weight: 500; color: var(--ink); margin-right: .15em; }
.qmeta { margin: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cat {
  font-size: .76rem; letter-spacing: .08em; color: var(--ink-2);
  padding-left: 12px; border-left: 1px solid var(--line-firm);
}

/* 難易度は色ではなく本数で示す（色覚に依存しない） */
.gauge { display: inline-flex; align-items: center; gap: 3px; }
.gauge i {
  width: 3px; height: 11px; background: var(--line-firm);
  display: block; border-radius: 0;
}
.gauge[data-level="1"] i:nth-child(1),
.gauge[data-level="2"] i:nth-child(-n+2),
.gauge[data-level="3"] i { background: var(--accent); }
.gauge span {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em;
  color: var(--ink-3); margin-left: 5px;
}

.qscore { margin: 0 auto 0 0; font-size: .78rem; color: var(--ink-3); }
.qscore b { font-size: .95rem; font-weight: 500; color: var(--accent); }

/* ══ 設問 ══ */
.qcard {
  display: flex; flex-direction: column; gap: 22px;
  padding-top: 4px;
}
.qtext {
  margin: 0;
  font-size: clamp(1.08rem, 3.1vw, 1.22rem);
  font-weight: 500; line-height: 1.85; letter-spacing: .02em;
  text-wrap: pretty;
}

/* ══ 選択肢：答案用紙の行 ══ */
.choices { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.choices li { border-bottom: 1px solid var(--line); }

.choice {
  width: 100%; display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0 14px; align-items: start;
  text-align: left; font: inherit; color: var(--ink);
  background: transparent; border: 0;
  border-left: 2px solid transparent;
  padding: 15px 14px 15px 12px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.choice:disabled { cursor: default; color: var(--ink); opacity: 1; -webkit-text-fill-color: currentColor; }

.key {
  font-size: .82rem; font-weight: 500; color: var(--ink-3);
  padding-top: .2em;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.55rem; height: 1.55rem;
  border: 1px solid var(--line-firm); border-radius: 50%;
  transition: color .12s, border-color .12s, background .12s;
}

.label { line-height: 1.8; }
.mark {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .1em;
  color: var(--ink-3); white-space: nowrap; padding-top: .35em;
}
.mark::before { margin-right: .45em; font-size: 1.05em; }

.exp {
  display: block; margin-top: 9px;
  font-size: .875rem; line-height: 1.85; color: var(--ink-2);
}

/* 回答後：正解＝緑青、選んだ誤答＝弁柄、残り＝無彩。記号と文字も添える */
.choice.is-correct { background: var(--accent-2); border-left-color: var(--accent); }
.choice.is-correct .key { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.choice.is-correct .mark { color: var(--accent); }
.choice.is-correct .mark::before { content: "○"; }

.choice.is-wrong { background: var(--wrong-2); border-left-color: var(--wrong); }
.choice.is-wrong .key { color: var(--wrong); border-color: var(--wrong); }
.choice.is-wrong .mark { color: var(--wrong); }
.choice.is-wrong .mark::before { content: "✕"; }

.choice.is-rest { border-left-color: var(--line); }
.choice.is-rest .mark::before { content: "–"; }

.note {
  margin: 0; padding: 14px 16px;
  background: var(--sink);
  border-left: 2px solid var(--line-firm);
  font-size: .875rem; line-height: 1.85; color: var(--ink-2);
}
.note::before {
  content: "補足"; display: block;
  font-family: var(--mono); font-size: .66rem; letter-spacing: .16em;
  color: var(--ink-3); margin-bottom: 5px;
}

.qfoot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.hint { margin: 0; font-size: .78rem; color: var(--ink-3); }
kbd {
  font-family: var(--mono); font-size: .92em;
  border: 1px solid var(--line-firm); border-radius: 2px;
  padding: 0 .35em; color: var(--ink-2);
}

/* ══ 結果 ══ */
.verdict {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding-bottom: 26px; border-bottom: 2px solid var(--ink);
}
.verdict-score { margin: 2px 0 0; color: var(--ink-3); font-size: 1rem; }
.verdict-score b {
  font-size: clamp(3rem, 13vw, 4rem); font-weight: 500; line-height: 1;
  color: var(--ink); margin-right: .12em;
}
.verdict-rate { margin: 0; font-size: .85rem; color: var(--ink-2); }
.verdict-rate b { font-family: var(--mono); font-weight: 500; color: var(--accent); font-size: 1rem; }
.verdict-note { margin: 10px 0 0; max-width: 40em; color: var(--ink-2); }

.tbl { display: flex; flex-direction: column; gap: 14px; }
.tbl-head { display: flex; align-items: baseline; gap: 10px; }
.tbl-count { font-family: var(--mono); font-size: .78rem; color: var(--wrong); letter-spacing: .06em; }

.bars { list-style: none; margin: 0; padding: 0; }
.bar-row {
  display: grid; grid-template-columns: 1fr auto;
  gap: 5px 14px; align-items: baseline;
  padding-block: 11px; border-bottom: 1px solid var(--line);
}
.bar-row:first-child { border-top: 1px solid var(--line); }
.bar-name { font-size: .88rem; }
.bar-num { font-size: .8rem; color: var(--ink-3); letter-spacing: .04em; }
.bar-track { grid-column: 1 / -1; height: 2px; background: var(--line); }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.bar-row.is-weak .bar-fill { background: var(--wrong); }
.bar-row.is-weak .bar-num { color: var(--wrong); }

.review { list-style: none; margin: 0; padding: 0; }
.review li {
  padding: 13px 0 13px 14px;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid var(--wrong);
  display: flex; flex-direction: column; gap: 4px;
}
.review li:first-child { border-top: 1px solid var(--line); }
.r-q { margin: 0; font-size: .92rem; line-height: 1.75; }
.r-a { margin: 0; font-size: .84rem; color: var(--ink-3); }
.r-a b { color: var(--accent); font-weight: 600; }
.review-empty { margin: 0; font-size: .9rem; color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 9px; }

/* ══ 地板 ══ */
.foot { border-top: 1px solid var(--line); margin-top: 10px; }
.foot-in {
  padding-block: 20px 40px;
  display: flex; justify-content: space-between; gap: 6px 20px; flex-wrap: wrap;
  font-size: .74rem; color: var(--ink-3);
}
.foot-in p { margin: 0; }
.foot-in b { font-weight: 400; }
.build-line { font-family: var(--mono); letter-spacing: .06em; }
.build-line:empty { display: none; }

/* ══ 小さい画面 ══
   指で触る前提にする。タップ領域はおよそ44px以上を確保し、
   横2カラムの表組みは縦に積む。 */
@media (max-width: 600px) {
  .wrap { padding-inline: 18px; }
  main { padding-block: 30px 52px; }
  .screen { gap: 28px; }

  /* 項目名を上に、内容を下に積む */
  .frow { grid-template-columns: 1fr; gap: 10px; padding-block: 18px; }
  .frow-label { padding-top: 0; }

  /* 指で押せる大きさに */
  .chip { padding: 10px 14px; min-height: 44px; font-size: .88rem; align-items: center; }
  .btn { padding: 13px 22px; min-height: 46px; }
  .launch { flex-direction: column; align-items: stretch; gap: 16px; }
  .launch .btn-solid { width: 100%; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
  .recall .btn-quiet { width: 100%; }
  .resume-actions { flex-direction: column; align-items: stretch; width: 100%; }
  .resume-actions .btn { width: 100%; }

  /* 選択肢：番号を小さめにして本文の幅を稼ぎ、印は本文の下へ回す */
  .choices { border-top: 0; }
  .choice {
    grid-template-columns: 1.6rem 1fr;
    gap: 0 11px;
    padding: 16px 4px;
  }
  .key { width: 1.5rem; height: 1.5rem; font-size: .78rem; }
  .mark { grid-column: 2; padding-top: 8px; }
  .exp { margin-top: 8px; }

  /* 見出し行は折り返す前提でまとめる */
  .qhead { gap: 4px 12px; margin-top: -14px; }
  .qno b { font-size: 1.3rem; }
  .qscore { margin-left: 0; }
  .qfoot { flex-direction: column; align-items: stretch; gap: 14px; }
  .qfoot .btn-solid { width: 100%; }
  .hint { order: 2; text-align: center; }

  .verdict-score b { font-size: 3.1rem; }
  .foot-in { padding-block: 18px 34px; }

  /* マスコットは小さめに、吹き出しの余白は詰める */
  .toon { gap: 10px; }
  .greet .mascot { width: 64px; height: 68px; }
  .react .mascot { width: 48px; height: 52px; }
  .finale .mascot { width: 76px; height: 80px; }
  .speak { padding: 10px 13px; font-size: .87rem; }
}

/* ごく狭い画面では吹き出しの尻尾を上向きにして縦に積む */
@media (max-width: 380px) {
  .toon { flex-direction: column; gap: 8px; }
  .toon .mascot { margin-left: 6px; }
  .speak::before, .speak::after {
    top: auto; right: auto; bottom: 100%; left: 22px;
    border-right-color: transparent;
  }
  .speak::before { border-bottom-color: var(--line-firm); }
  .speak::after { border-bottom-color: var(--raise); margin: 0 0 -1px 0; }
  .react .speak::before { border-right-color: transparent; border-bottom-color: var(--accent); }
  .react[data-tone="ng"] .speak::before { border-right-color: transparent; border-bottom-color: var(--wrong); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ══════════════════════════════════════════════════════════════
   マスコット
   青いモコモコの人形。毛並みは feTurbulence の変位で出している。
   気分（data-mood）で 目・口・腕 が切り替わる。
   ══════════════════════════════════════════════════════════════ */

:root {
  --fur:      #4C9FE0;
  --fur-dim:  #3D86C2;
  --limb:     #22262C;
  --eye:      #FCFCFA;
  --pupil:    #14171A;

  /* 白いほう */
  --wool:     #F5F4F0;
  --wool-ln:  #BDBDB3;
  --red:      #D63B27;

  /* 灰色のほう */
  --shag:     #C6C6C0;
  --shag-ln:  #9D9D96;
  --felt:     #1B1E22;
  --hat:      #7A5B3A;
  --hat-dark: #63482D;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fur: #57A8E8; --fur-dim: #3F84BE; --limb: #3A434D;
    --wool: #EFEEE8; --wool-ln: #9EA09A; --red: #E4503B;
    --shag: #B9B9B2; --shag-ln: #85857E; --felt: #2E343A;
    --hat: #97744D; --hat-dark: #7C5E3C;
  }
}
:root[data-theme="dark"] {
  --fur: #57A8E8; --fur-dim: #3F84BE; --limb: #3A434D;
  --wool: #EFEEE8; --wool-ln: #9EA09A; --red: #E4503B;
  --shag: #B9B9B2; --shag-ln: #85857E; --felt: #2E343A;
  --hat: #97744D; --hat-dark: #7C5E3C;
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.mascot { display: block; flex: none; overflow: visible; }
.m-body { fill: var(--fur); }
.arm {
  fill: none; stroke: var(--limb); stroke-width: 11; stroke-linecap: round;
  transform-box: fill-box;
}
/* 回転軸は肩（胴に接する側の端）に置く */
.arm-l { transform-origin: 100% 0%; transform: rotate(6deg); }
.arm-r { transform-origin: 0% 0%;   transform: rotate(-6deg); }
.ball   { fill: var(--eye); stroke: var(--pupil); stroke-width: 1.1; }
.pupil  { fill: var(--pupil); }
.glint  { fill: #fff; }
.nose   { fill: var(--pupil); }
.mouth  { fill: var(--pupil); }
.mouth-smile, .mouth-flat { fill: none; stroke: var(--pupil); stroke-linecap: round; }

/* 既定は「まる口」。ほかの口は隠しておく */
.mouth-smile, .mouth-flat, .mouth-wide { display: none; }

.arm, .pupil, .mouth { transition: transform .2s ease; }

/* ── 白いほう ──
   目が豆粒なので、気分は腕と目の形だけで出す。口はない。 */
.n-body   { fill: var(--wool); stroke: var(--wool-ln); stroke-width: 1.7; }
.n-scarf  { fill: none; stroke: var(--wool-ln); stroke-width: 1.4; opacity: .8; }
.n-eye    { fill: var(--pupil); }
.n-eye-arc{ fill: none; stroke: var(--pupil); stroke-width: 2.6; stroke-linecap: round; display: none; }
.n-nose   { fill: var(--red); }
.n-arm    { stroke: var(--red); stroke-width: 10; }

/* にっこりすると目が弧になる */
.mascot[data-who="non"][data-mood="good"]  .n-eye,
.mascot[data-who="non"][data-mood="party"] .n-eye { display: none; }
.mascot[data-who="non"][data-mood="good"]  .n-eye-arc,
.mascot[data-who="non"][data-mood="party"] .n-eye-arc { display: block; }

/* ── 灰色のほう ──
   縦に長いふさふさ。シルクハット、黒い長い手足、とじた波形の目。 */
.g-body  { fill: var(--shag); stroke: var(--shag-ln); stroke-width: 1.4; }
.g-arm   { fill: none; stroke: var(--felt); stroke-width: 7; stroke-linecap: round; }

/* 腕＋手をまとめて肩から回す */
.limb   { transform-box: fill-box; transition: transform .2s ease; }
.limb-l { transform-origin: 100% 0%; transform: rotate(6deg); }
.limb-r { transform-origin: 0% 0%;   transform: rotate(-6deg); }
.mascot[data-mood="good"]    .limb-l { transform: rotate(66deg); }
.mascot[data-mood="good"]    .limb-r { transform: rotate(-66deg); }
.mascot[data-mood="party"]   .limb-l { transform: rotate(96deg); }
.mascot[data-mood="party"]   .limb-r { transform: rotate(-96deg); }
.mascot[data-mood="oops"]    .limb-l { transform: rotate(-14deg); }
.mascot[data-mood="oops"]    .limb-r { transform: rotate(14deg); }
.mascot[data-mood="cheerup"] .limb-r { transform: rotate(-80deg); }
.mascot[data-mood="think"]   .limb-l { transform: rotate(-4deg); }
.g-hand  { fill: var(--felt); }
.g-leg path { fill: none; stroke: var(--felt); stroke-width: 7; stroke-linecap: round; }
.g-shoe  { fill: var(--felt); }
.g-crown { fill: var(--hat); }
.g-brim  { fill: var(--hat-dark); }
.g-eye   { fill: none; stroke: var(--felt); stroke-width: 2; stroke-linecap: round; }
.g-nose  { fill: var(--felt); }

/* 帽子は喜ぶとわずかに浮く */
.g-hat { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .2s ease; }
.mascot[data-who="gent"][data-mood="good"]  .g-hat { transform: translateY(-6%) rotate(-5deg); }
.mascot[data-who="gent"][data-mood="party"] .g-hat { transform: translateY(-12%) rotate(-9deg); }
.mascot[data-who="gent"][data-mood="oops"]  .g-hat { transform: translateY(3%) rotate(4deg); }

/* まれにしか出てこないので、出たときだけ小さく弾ませる */
.mascot[data-who="non"] { animation: arrive .45s cubic-bezier(.2, 1.4, .5, 1); }
/* いちばん珍しいので、もう少しゆっくり現れる */
.mascot[data-who="gent"] { animation: arrive .72s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes arrive {
  from { transform: translateY(9%) scale(.86); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── 気分 ── */
/* ふつう */
.mascot[data-mood="idle"] .pupil { transform: translate(0, 0); }

/* 考えごと：目線を上に、口は小さく */
.mascot[data-mood="think"] .pupil  { transform: translate(-1.5px, -3px); }
.mascot[data-mood="think"] .mouth-o { display: none; }
.mascot[data-mood="think"] .mouth-flat { display: block; }
.mascot[data-mood="think"] .arm-l { transform: rotate(-4deg); }

/* 正解：にっこり、両手を上げる */
.mascot[data-mood="good"] .mouth-o { display: none; }
.mascot[data-mood="good"] .mouth-smile { display: block; }
.mascot[data-mood="good"] .arm-l { transform: rotate(72deg); }
.mascot[data-mood="good"] .arm-r { transform: rotate(-72deg); }
.mascot[data-mood="good"] .pupil { transform: translate(0, -1px); }

/* 誤答：目線を落として、腕は下ろす */
.mascot[data-mood="oops"] .mouth-o { display: none; }
.mascot[data-mood="oops"] .mouth-flat { display: block; }
.mascot[data-mood="oops"] .pupil { transform: translate(0, 2.5px); }
.mascot[data-mood="oops"] .arm-l { transform: rotate(-16deg); }
.mascot[data-mood="oops"] .arm-r { transform: rotate(16deg); }

/* 大喜び：口を大きく開けて跳ねる */
.mascot[data-mood="party"] .mouth-o { display: none; }
.mascot[data-mood="party"] .mouth-wide { display: block; }
.mascot[data-mood="party"] .arm-l { transform: rotate(104deg); }
.mascot[data-mood="party"] .arm-r { transform: rotate(-104deg); }
.mascot[data-mood="party"] { animation: hop .62s ease-in-out 2; }
@keyframes hop {
  0%, 100% { transform: translateY(0); }
  30%      { transform: translateY(-7%); }
  60%      { transform: translateY(0); }
}

/* 励まし：片手を上げる */
.mascot[data-mood="cheerup"] .mouth-o { display: none; }
.mascot[data-mood="cheerup"] .mouth-smile { display: block; }
.mascot[data-mood="cheerup"] .arm-r { transform: rotate(-92deg); }

/* ── 吹き出し ── */
.speak {
  position: relative;
  background: var(--raise);
  border: 1px solid var(--line-firm);
  border-radius: 3px;
  padding: 11px 15px;
  font-size: .9rem; line-height: 1.7;
  color: var(--ink);
  min-width: 0;
}
.speak::before, .speak::after {
  content: ""; position: absolute; top: 17px; right: 100%;
  border: 7px solid transparent;
}
.speak::before { border-right-color: var(--line-firm); }
.speak::after  { border-right-color: var(--raise); margin-right: -1px; }
.speak b { color: var(--accent); font-weight: 600; }
.speak .sub { display: block; margin-top: 3px; font-size: .8rem; color: var(--ink-3); }

.toon { display: flex; align-items: flex-start; gap: 13px; }
.toon .mascot { width: 62px; height: 66px; margin-top: 2px; }
.toon .speak { flex: 1; }

/* 設定画面のあいさつは少し大きく */
.greet .mascot { width: 78px; height: 82px; }

/* 回答後のひとこと */
.react { padding-top: 2px; }
.react .mascot { width: 54px; height: 58px; }
.react .speak { border-color: var(--accent); }
.react .speak::before { border-right-color: var(--accent); }
.toon:has(.mascot[data-who="non"]) .speak { border-color: var(--red); }
.toon:has(.mascot[data-who="non"]) .speak::before { border-right-color: var(--red); }
.toon:has(.mascot[data-who="gent"]) .speak { border-color: var(--hat); }
.toon:has(.mascot[data-who="gent"]) .speak::before { border-right-color: var(--hat); }
.react[data-tone="ng"] .speak { border-color: var(--wrong); }
.react[data-tone="ng"] .speak::before { border-right-color: var(--wrong); }

/* 結果の講評 */
.finale .mascot { width: 96px; height: 102px; }
.finale .speak { font-size: .95rem; }

@media (prefers-reduced-motion: reduce) {
  .mascot[data-mood="party"], .mascot[data-who="non"], .mascot[data-who="gent"] { animation: none; }
  .g-hat { transition: none; }
}

/* ══════════════════════════════════════════════════════════════
   ホバー
   タッチ端末では :hover がタップ後も貼りつき、最後に触った要素だけ
   別の見た目のまま残ってしまう。マウスなど本物のホバーがある環境に
   限って適用する。
   ══════════════════════════════════════════════════════════════ */
@media (hover: hover) and (pointer: fine) {
  .chip:hover { color: var(--accent); border-color: var(--accent); }
  .chip[aria-pressed="true"]:hover { background: transparent; }

  .btn-solid:hover { opacity: .86; }
  .btn-quiet:hover { border-color: var(--accent); color: var(--accent); }
  .btn-quiet:disabled:hover { border-color: var(--line); color: var(--ink-2); }
  .btn-text:hover { color: var(--wrong); }
  .logo-btn:hover .logo-name { color: var(--accent); }

  .choice:hover:not(:disabled) { background: var(--sink); border-left-color: var(--line-firm); }
  .choice:hover:not(:disabled) .key { color: var(--accent); border-color: var(--accent); }
}

/* 押した瞬間の手応えは、ホバーではなく :active で返す（タッチでも効く） */
.chip:active { transform: scale(.97); }
.btn-solid:active:not(:disabled), .btn-quiet:active:not(:disabled) { transform: scale(.99); }
.choice:active:not(:disabled) { background: var(--sink); }
@media (prefers-reduced-motion: reduce) {
  .chip:active, .btn-solid:active, .btn-quiet:active { transform: none; }
}
