/* AI QUEST — 親しみやすい学習アプリ（大きめの文字・ボタン） */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #1d2433;
  --ink-2: #4a5568;
  --muted: #6b7486;
  --line: #e2e7f0;
  --primary: #2f5bea;
  --primary-d: #2146c2;
  --primary-soft: #eaf0ff;
  --accent: #ff9f1c;
  --accent-soft: #fff4e2;
  --ok: #17915a;
  --ok-soft: #e5f7ee;
  --part: #c77c00;
  --part-soft: #fff5dc;
  --info: #2f6fd6;
  --info-soft: #e8f1ff;
  --danger: #c2413b;
  --radius: 18px;
  --shadow: 0 2px 0 rgba(20, 30, 60, .04), 0 8px 24px rgba(20, 30, 60, .06);
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
@media (min-width: 900px) { html { font-size: 19px; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: .02em;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
b, strong, h1, h2 { font-weight: 700; }
.app { max-width: 820px; margin: 0 auto; padding: 16px 16px 120px; outline: none; }

/* ── 上部バー */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; line-height: 1.2; }
.brand-mark { font-size: 1.6rem; }
.brand b { display: block; font-size: 1.05rem; letter-spacing: .06em; color: var(--primary); }
.brand small { font-size: .72rem; color: var(--muted); }
.xpbox { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.xpbox.bump { animation: bump .6s ease; }
.lv { background: var(--primary); color: #fff; border-radius: 999px; padding: 2px 10px; font-weight: 700; }
.xpbar { width: 80px; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ffc15e); transition: width .6s; }
.xpnum { font-weight: 700; white-space: nowrap; }
@media (max-width: 420px) { .xpbar { width: 48px; } .brand small { display: none; } }

/* ── ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 56px; padding: 12px 22px; border-radius: 14px;
  border: 2px solid transparent; background: var(--surface);
  font-weight: 700; font-size: 1rem; text-decoration: none; line-height: 1.3; text-align: center;
  transition: transform .08s, background .2s, box-shadow .2s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-d); }
.btn.primary:hover:not(:disabled) { background: var(--primary-d); }
.btn.primary:disabled { background: #b8c3de; box-shadow: none; }
.btn.success { background: var(--ok); color: #fff; box-shadow: 0 4px 0 #0f6b42; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.text { background: none; min-height: 48px; }
.danger-text { color: var(--danger); }
.btn.xl { min-height: 64px; font-size: 1.15rem; padding: 14px 28px; width: 100%; }
.btn.small { min-height: 44px; font-size: .88rem; padding: 8px 14px; }
.btn.primary.soft { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.btn.pulse { animation: pulse 1.4s ease 3; }

/* ── 共通 */
.screen { animation: fadein .25s ease; }
.kicker { margin: 18px 0 4px; color: var(--primary); font-weight: 700; font-size: .9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kicker.bonus { color: var(--part); }
.slide-tag { font-size: .72rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 1px 10px; font-weight: 500; }
.title { font-size: 1.55rem; line-height: 1.45; margin: 0 0 12px; }
.title.q { font-size: 1.35rem; }
.title.big { font-size: 1.9rem; text-align: center; }
@media (min-width: 900px) { .title { font-size: 1.75rem; } }
.lead { font-size: 1.05rem; color: var(--ink-2); margin: 0 0 16px; }
.sub { font-size: 1.1rem; margin: 26px 0 10px; }
.fine { font-size: .82rem; color: var(--muted); margin: 8px 0; }
.hint { color: var(--muted); font-size: .9rem; margin: 0 0 10px; }
.note { background: var(--accent-soft); border-left: 6px solid var(--accent); border-radius: 12px; padding: 14px 16px; margin: 18px 0; font-weight: 700; }
.banner { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; font-weight: 700; margin-bottom: 12px; }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 14px; }
.bar.big { height: 16px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #5b8bff); border-radius: 99px; transition: width .6s; }

/* ── ホーム */
.hero { background: linear-gradient(160deg, #2f5bea 0%, #4b7bff 60%, #6d95ff 100%); color: #fff; border-radius: 24px; padding: 26px 20px 22px; margin-top: 4px; box-shadow: var(--shadow); }
.hero-kicker { margin: 0; opacity: .9; font-size: .9rem; }
.hero h1 { margin: 2px 0 10px; font-size: 2.3rem; letter-spacing: .06em; line-height: 1.2; }
.hero h1 span { display: block; font-size: 1.1rem; letter-spacing: .04em; opacity: .95; }
.hero-goal { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 16px; font-weight: 700; }
.hero-goal .from { opacity: .8; text-decoration: line-through; text-decoration-thickness: 2px; }
.hero-goal .to { background: #fff; color: var(--primary); border-radius: 10px; padding: 2px 10px; }
.progress-card { background: rgba(255, 255, 255, .16); border-radius: 16px; padding: 14px 16px; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; }
.progress-head b { font-size: 1.6rem; }
.progress-card .bar { background: rgba(255, 255, 255, .3); }
.progress-card .bar i { background: linear-gradient(90deg, #ffd166, var(--accent)); }
.progress-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; }
.hero-actions { margin-top: 16px; }
.hero .btn.primary { background: var(--accent); box-shadow: 0 4px 0 #c97600; color: #3a2400; }
.section-title { font-size: 1.15rem; margin: 28px 0 10px; }
.stage-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.stage-card {
  width: 100%; display: grid; grid-template-columns: 60px 1fr; gap: 4px 14px; align-items: center; text-align: left;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.stage-card.open { border-color: var(--primary); }
.stage-card.cleared { border-color: #bfe8d3; background: #fbfffd; }
.stage-card.locked { opacity: .6; box-shadow: none; }
.stage-card.final.open { background: var(--accent-soft); border-color: var(--accent); }
.stage-icon { grid-row: span 2; width: 60px; height: 60px; display: grid; place-items: center; font-size: 1.9rem; background: var(--primary-soft); border-radius: 16px; }
.stage-body { display: flex; flex-direction: column; line-height: 1.4; }
.stage-body small { color: var(--muted); font-size: .78rem; font-weight: 700; }
.stage-body b { font-size: 1.12rem; }
.stage-body em { font-style: normal; color: var(--ink-2); font-size: .85rem; }
.mini-bar { display: block; height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; margin-top: 6px; }
.mini-bar i { display: block; height: 100%; background: var(--ok); }
.stage-state { grid-column: 2; font-size: .82rem; font-weight: 700; color: var(--primary); }
.cleared .stage-state { color: var(--ok); }
.locked .stage-state { color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badges.center { justify-content: center; margin: 14px 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px 6px 8px; font-size: .88rem; font-weight: 700; }
.badge span { font-size: 1.2rem; }
.home-foot { margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }

/* ── ステップ上部 */
.stage-head { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--ink-2); margin-top: 4px; }
.back-home { color: var(--muted); text-decoration: none; padding: 8px 4px; white-space: nowrap; }
.stage-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-count { font-weight: 700; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 2px 12px; white-space: nowrap; }
.dots { display: flex; gap: 6px; margin: 8px 0 4px; }
.dots i { flex: 1; height: 8px; border-radius: 9px; background: var(--line); }
.dots i.bonus { background: repeating-linear-gradient(45deg, var(--line), var(--line) 4px, #eef1f6 4px, #eef1f6 8px); }
.dots i.done { background: var(--ok); }
.dots i.now { background: var(--primary); }

/* ── 下部ナビ */
.stepnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); backdrop-filter: blur(8px); }
.stepnav-inner { max-width: 820px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr; gap: 12px; }
.stepnav-inner > :only-child { grid-column: 1 / -1; }

/* ── カード */
.cards { display: grid; gap: 12px; margin: 14px 0; }
.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .cols-2 { grid-template-columns: 1fr 1fr; gap: 10px; } .cols-2.wide { grid-template-columns: 1fr; } }
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card-icon { font-size: 2rem; display: block; line-height: 1.2; }
.card b { display: block; font-size: 1.08rem; margin: 4px 0 2px; }
.card p { margin: 0; color: var(--ink-2); font-size: .92rem; line-height: 1.6; }
.flow { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; }
.flow li { background: var(--surface); border: 2px solid var(--primary-soft); border-radius: 14px; padding: 12px 16px; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 12px; position: relative; }
.flow li span { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; }
.flow li:not(:last-child)::after { content: "↓"; position: absolute; left: 26px; bottom: -20px; color: var(--primary); font-weight: 700; z-index: 1; }
.flow li:last-child { background: var(--ok-soft); border-color: #bfe8d3; }
.flow-steps { padding-left: 1.2em; margin: 0; }
.howto { background: var(--surface); border-radius: var(--radius); padding: 4px 18px 10px; margin-top: 18px; border: 1px solid var(--line); }

/* ── クイズ */
.options { display: grid; gap: 10px; margin: 8px 0 16px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; text-align: left;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 12px 16px; font-size: 1.05rem; font-weight: 700;
}
.option:hover:not(:disabled) { border-color: var(--primary); }
.option.on { border-color: var(--primary); background: var(--primary-soft); }
.option .mark { font-size: 1.3rem; width: 1.4em; flex: none; text-align: center; color: var(--primary); }
.option.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.option.is-correct .mark { color: var(--ok); }
.option.is-wrong { border-color: #9db8e8; background: var(--info-soft); }
.option.is-other { opacity: .65; }
.option:disabled { color: var(--ink); }
.check { width: 100%; }
.sort-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 12px; }
.sort-item { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.sort-item > p:first-child { margin: 0 0 8px; font-weight: 700; font-size: 1.05rem; }
.sort-item.is-correct { border-color: var(--ok); background: #fbfffd; }
.sort-item.is-wrong { border-color: #9db8e8; }
.sort-fb { margin: 6px 0 0; font-size: .88rem; font-weight: 700; color: var(--info); }
.sort-fb:empty { display: none; }
.is-correct .sort-fb { color: var(--ok); }
.chips { display: grid; gap: 8px; }
.chips.b2 { grid-template-columns: 1fr 1fr; }
.chips.b4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) { .chips.b4 { grid-template-columns: repeat(4, 1fr); } }
.chips.wrap { display: flex; flex-wrap: wrap; }
.chip { min-height: 48px; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fafbfe; font-weight: 700; font-size: .95rem; }
.chips.small .chip { min-height: 42px; font-size: .88rem; padding: 6px 12px; }
.chip:hover:not(:disabled) { border-color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.answer { outline: 3px solid var(--ok); outline-offset: 1px; }
.chip:disabled { opacity: 1; }

/* 結果 */
.result { border-radius: var(--radius); padding: 4px 18px 16px; margin: 6px 0 10px; animation: pop .35s ease; scroll-margin-top: 80px; }
.result:empty { display: none; }
.result.correct { background: var(--ok-soft); }
.result.partial { background: var(--part-soft); }
.result.wrong { background: var(--info-soft); }
.result-head { display: flex; align-items: center; gap: 10px; font-size: 1.45rem; font-weight: 700; margin: 12px 0 6px; }
.result-head span { font-size: 2rem; line-height: 1; }
.result-head.correct { color: var(--ok); }
.result-head.partial { color: var(--part); }
.result-head.wrong { color: var(--info); }
.fb { margin: 6px 0; font-weight: 700; }
.explain { background: var(--surface); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.explain p { margin: 4px 0 0; }
.result-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 14px; }
.done-note { background: var(--ok-soft); padding: 8px 12px; border-radius: 10px; }

/* 間違い探し */
.ai-q { background: var(--primary-soft); border-radius: 14px; padding: 12px 16px; font-weight: 700; margin-bottom: 10px; }
.ai-answer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; }
.ai-label { margin: 0 0 6px; font-weight: 700; color: var(--muted); font-size: .88rem; }
.sentence { display: block; width: 100%; text-align: left; background: #fafbfe; border: 2px dashed var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0; line-height: 1.7; font-size: 1rem; }
.sentence.on { border: 2px solid var(--accent); background: var(--accent-soft); }
.sentence.on::before { content: "🖍 "; }
.sentence .sfb { display: block; font-size: .88rem; font-weight: 700; margin-top: 6px; }
.sentence .sfb:empty { display: none; }
.sentence.is-must .sfb { color: var(--part); }
.sentence.is-ok .sfb { color: var(--muted); font-weight: 500; }
.sentence:disabled { color: var(--ink); }

/* ── ミッション */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; box-shadow: var(--shadow); }
.panel-title { font-size: 1.02rem; margin: 0 0 8px; }
.howto-list { margin: 0; padding-left: 1.4em; }
.howto-list li { margin: 4px 0; }
.prompt { border: 2px solid var(--primary-soft); border-radius: 14px; padding: 10px 12px; margin: 10px 0; background: #fbfcff; }
.prompt-label { font-size: .85rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.prompt-text { margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; font-family: var(--font); font-size: 1.02rem; font-weight: 700; line-height: 1.7; background: none; }
textarea.prompt-text { width: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 10px; resize: vertical; background: #fff; }
.btn.copy { min-height: 48px; width: 100%; background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn.copy.big { min-height: 56px; }
.btn.copy.copied { background: var(--ok-soft); color: var(--ok); }
.copy-row { display: grid; gap: 8px; margin-top: 10px; }
.longtext { max-height: 220px; overflow: auto; font-size: .92rem; line-height: 1.8; background: #fafbfe; border: 1px solid var(--line); border-radius: 12px; padding: 12px; white-space: normal; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 0; }
.tools .tool:only-child { grid-column: 1 / -1; }
.btn.tool { border-color: var(--line); background: var(--surface); box-shadow: var(--shadow); }
.tool-chatgpt { color: #0b7a5c; }
.tool-gemini { color: #3b5bdb; }
.tool-google { color: #c2410c; grid-column: 1 / -1; }
.ext { font-size: .8em; opacity: .7; }
.field { display: block; margin: 10px 0; }
.field > span { display: block; font-weight: 700; margin-bottom: 4px; }
.field small { color: var(--muted); font-weight: 500; }
.field input { width: 100%; min-height: 54px; border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; background: #fff; font-size: 1rem; }
.field input:focus { border-color: var(--primary); outline: none; }
.before { margin: 0; font-size: 1.02rem; }
.meter { margin: 12px 0 0; font-size: .92rem; }
.placeholder-msg { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.choice { min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 2px solid var(--line); border-radius: 14px; background: #fafbfe; font-weight: 700; }
.choice span { font-size: 1.6rem; }
.choice.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.map { display: grid; gap: 10px; margin-bottom: 6px; }
@media (min-width: 700px) { .map { grid-template-columns: 1fr 1fr; } }
.zone { background: #fafbfe; border-radius: 12px; padding: 10px; }
.zone b { display: block; margin-bottom: 6px; }
.checks .check-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 4px; border-top: 1px dashed var(--line); cursor: pointer; }
.checks .check-item:first-of-type { border-top: 0; }
.check-item input { width: 26px; height: 26px; flex: none; margin-top: 2px; accent-color: var(--ok); }
.complete-box { text-align: center; margin: 22px 0 8px; }
.done-msg { font-size: 1.3rem; font-weight: 700; color: var(--ok); background: var(--ok-soft); border-radius: 14px; padding: 14px; margin: 0; }
.done-msg.pop { animation: pop .4s ease; }
.warn { font-size: .88rem; color: var(--part); background: var(--part-soft); border-radius: 10px; padding: 10px 12px; font-weight: 700; margin: 10px 0 0; }

/* ── クリア・結果 */
.clear-screen, .final-result, .final-intro { text-align: center; position: relative; }
.clear-screen .panel, .final-result .panel { text-align: left; }
.burst { display: flex; justify-content: center; gap: 12px; font-size: 2.2rem; margin-top: 14px; }
.burst span { animation: rise .9s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: calc(var(--k) * .08s); }
.badge-get { display: inline-flex; align-items: center; gap: 14px; background: var(--surface); border: 2px solid var(--accent); border-radius: 18px; padding: 12px 22px; text-align: left; box-shadow: var(--shadow); animation: pop .5s ease .3s both; }
.badge-icon { font-size: 2.6rem; }
.badge-get small { display: block; color: var(--part); font-weight: 700; font-size: .8rem; }
.badge-get b { font-size: 1.2rem; }
.stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin: 18px 0; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 18px; min-width: 140px; }
.stats small { display: block; color: var(--muted); font-size: .8rem; }
.stats b { font-size: 1.3rem; }
.recap { margin: 0; padding-left: 1.2em; }
.recap li { margin: 8px 0; }
.score { font-size: 1.2rem; font-weight: 700; margin: 6px 0 10px; }
.score b { font-size: 3.4rem; color: var(--primary); }
.final-result.fail .score b { color: var(--info); }

/* ── 修了画面 */
.cert { background: var(--surface); border: 3px solid #e5c56a; outline: 6px solid #fff6d8; border-radius: 24px; padding: 26px 18px 22px; text-align: center; margin: 14px 4px 20px; box-shadow: var(--shadow); }
.cert-kicker { margin: 0; color: var(--muted); font-size: .85rem; }
.cert-cap { font-size: 3.4rem; line-height: 1.2; animation: pop .6s ease; }
.cert-title { margin: 4px 0 10px; font-size: 1.6rem; line-height: 1.3; }
.cert-title span { display: inline-block; margin-top: 4px; font-size: 2.3rem; letter-spacing: .18em; color: var(--primary); }
.cert-name { display: inline-flex; align-items: baseline; gap: 6px; margin: 6px 0; }
.cert-name input { border: 0; border-bottom: 2px solid var(--line); text-align: center; font-size: 1.3rem; font-weight: 700; padding: 4px; width: 12em; max-width: 60vw; background: transparent; }
.cert-name input:focus { outline: none; border-color: var(--primary); }
.cert-msg { color: var(--ink-2); }
.cert-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 6px; }
.cert-stats div { background: #fafbfe; border-radius: 12px; padding: 10px 6px; }
.cert-stats div:last-child { grid-column: 1 / -1; }
.cert-stats dt { font-size: .8rem; color: var(--muted); }
.cert-stats dd { margin: 0; font-size: 1.25rem; font-weight: 700; }
.cert-stats dd small { display: block; font-size: .75rem; color: var(--muted); font-weight: 500; }
@media (min-width: 700px) { .cert-stats { grid-template-columns: repeat(3, 1fr); } .cert-stats div:last-child { grid-column: auto; } .cert-stats div:nth-child(4) { grid-column: auto; } }
.tomorrow { background: var(--accent-soft); border-radius: 14px; padding: 10px 14px; margin-top: 10px; }
.tomorrow small { display: block; font-size: .8rem; color: var(--part); font-weight: 700; }
.ending p { margin: 4px 0; }
.complete-actions { display: grid; gap: 10px; }

/* ── トースト・ダイアログ */
.toast {
  position: fixed; left: 50%; top: 76px; transform: translate(-50%, -20px); z-index: 50;
  background: var(--ink); color: #fff; font-weight: 700; padding: 12px 20px; border-radius: 99px;
  opacity: 0; pointer-events: none; transition: all .3s; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.xp { background: var(--accent); color: #3a2400; }
.toast.level, .toast.streak { background: var(--primary); }
.modal { position: fixed; inset: 0; background: rgba(20, 28, 45, .5); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--surface); border-radius: 20px; padding: 22px; max-width: 440px; width: 100%; }
.modal-card h2 { margin: 0 0 6px; font-size: 1.25rem; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.noscript { padding: 24px; text-align: center; }

/* ── アニメーション（動きを減らす設定の人には止める） */
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.9); opacity: 0; } 70% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bump { 50% { transform: scale(1.12); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(47, 91, 234, .2); } }
@keyframes rise { from { transform: translateY(30px) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── 印刷（修了画面） */
@media print {
  .topbar, .stepnav, .toast, .complete-actions, .ending, .home-foot { display: none !important; }
  body { background: #fff; }
  .app { padding: 0; }
  .cert { box-shadow: none; margin: 0; }
  .cert-name input { border: 0; }
}

/* ── スマホ微調整 */
@media (max-width: 480px) {
  .tools { grid-template-columns: 1fr; }
  .chips.b4 .chip { font-size: .88rem; padding: 8px 6px; }
  .result-actions { grid-template-columns: 1fr; }
  .result-actions #retry { order: 2; }
}
