:root {
  --bg: #fff7ed;
  --surface: #ffffff;
  --surface-2: #fff1e2;
  --text: #1c1917;
  --muted: #78716c;
  --line: #f1e4d6;
  --brand: #f97316;
  --brand-ink: #ffffff;
  --brand-soft: #ffedd5;
  --ok: #10b981;
  --ok-soft: #d1fae5;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --ok-ink: #047857;
  --info-ink: #1d4ed8;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 20px rgb(120 60 0 / 0.07);
  --radius: 18px;
  /* 言語ごとに、その国の人が見慣れた OS 標準フォントを優先する（下の :root[lang] で切り替え） */
  --font-latin: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font: var(--font-latin);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17120e;
    --surface: #221b15;
    --surface-2: #2b221a;
    --text: #f5f0eb;
    --muted: #a8a29e;
    --line: #3a2f25;
    --brand-soft: #3b2412;
    --ok-soft: #0f3a2c;
    --warn-soft: #3d2d0b;
    --info-soft: #172a4d;
    --warn: #fbbf24;
    --ok-ink: #6ee7b7;
    --info-ink: #93c5fd;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #17120e;
  --surface: #221b15;
  --surface-2: #2b221a;
  --text: #f5f0eb;
  --muted: #a8a29e;
  --line: #3a2f25;
  --brand-soft: #3b2412;
  --ok-soft: #0f3a2c;
  --warn-soft: #3d2d0b;
  --info-soft: #172a4d;
  --warn: #fbbf24;
  --ok-ink: #6ee7b7;
  --info-ink: #93c5fd;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  color-scheme: dark;
}

/* ---------- 言語別フォント ---------- */
/* 日本語：iPhone・Mac はヒラギノ、Windows は游ゴシック・メイリオ、Android は Noto Sans JP */
:root[lang="ja"] { --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", YuGothic, Meiryo, "Noto Sans JP", sans-serif; }
/* 日本語の子ども向け：学校の教科書に近い UD デジタル教科書体（Windows）、丸ゴシック（iPhone・Mac） */
:root[lang="ja"] body.kid { --font: "UD デジタル 教科書体 NK-R", "UD Digi Kyokasho NK-R", "Hiragino Maru Gothic ProN", "M PLUS Rounded 1c", "Hiragino Sans", "Yu Gothic", Meiryo, "Noto Sans JP", sans-serif; }
/* 中国語（簡体字）：苹方・微软雅黑 */
:root[lang="zh-Hans"] { --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif; }
/* 中国語（繁体字）：蘋方・微軟正黑體 */
:root[lang="zh-Hant"] { --font: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Source Han Sans TC", sans-serif; }
/* 韓国語：Apple SD ゴシック Neo・マルグンゴシック */
:root[lang="ko"] { --font: "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Noto Sans KR", sans-serif; }
/* アラビア語：Geeza Pro・Segoe UI・Tahoma */
:root[lang="ar"] { --font: "Geeza Pro", "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif; }
/* ヒンディー語：Kohinoor Devanagari・Nirmala UI */
:root[lang="hi"] { --font: "Kohinoor Devanagari", "Nirmala UI", Mangal, "Noto Sans Devanagari", sans-serif; }
/* タイ語：Thonburi・Leelawadee UI */
:root[lang="th"] { --font: Thonburi, "Leelawadee UI", Leelawadee, "Noto Sans Thai", sans-serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
}
h1, h2, h3 { line-height: 1.3; margin: 0 0 0.5em; font-weight: 800; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 0.6em; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.lead { font-size: 1.05rem; }

/* ---------- レイアウト ---------- */
.view {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
  outline: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidenav { display: none; }
.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a, .sidenav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.68rem;
  padding: 4px 0;
  border-radius: 12px;
}
.tabbar .ni { font-size: 1.3rem; line-height: 1; }
.tabbar a.active, .sidenav a.active { color: var(--brand); font-weight: 700; }
.onboarding .tabbar, .onboarding .sidenav { display: none !important; }

@media (min-width: 960px) {
  .sidenav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: 220px;
    padding: 24px 14px;
    background: var(--surface);
    border-inline-end: 1px solid var(--line);
  }
  .sidenav .brand { font-weight: 800; font-size: 1.2rem; padding: 0 10px 18px; }
  .sidenav a { flex-direction: row; gap: 12px; font-size: 0.98rem; padding: 10px 12px; }
  .sidenav a.active { background: var(--brand-soft); }
  .sidenav .ni { font-size: 1.2rem; }
  .tabbar { display: none; }
  body:not(.onboarding) .view { margin-inline-start: 220px; padding: 32px 40px 48px; max-width: none; }
}
@media (min-width: 1400px) {
  body:not(.onboarding) .view { margin-inline-start: calc(220px + (100vw - 220px - 1120px) / 2); max-width: 1120px; padding-inline: 0; }
}

/* ---------- 部品 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: currentColor; background: transparent; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 0.85rem; }
.btn.big { min-height: 54px; font-size: 1.05rem; width: 100%; }
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
.pill.hot { background: var(--brand); color: var(--brand-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip {
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
}
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.src { font-size: 0.75rem; min-height: 28px; background: var(--surface-2); border-color: transparent; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.row.center { justify-content: center; }
.row > .chips { flex: 1 1 100%; min-width: 0; margin: 0; }
.chips { min-width: 0; }
.link { color: var(--brand); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.back { align-self: flex-start; }
.status { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.status-official { background: var(--ok-soft); color: var(--ok-ink); }
.status-reported { background: var(--info-soft); color: var(--info-ink); }
.status-disputed { background: var(--warn-soft); color: var(--warn); }
.status-peer { background: var(--info-soft); color: var(--info-ink); }

.avatar {
  --c: var(--brand);
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000));
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.avatar.emoji { background: var(--brand-soft); font-size: 1.5rem; }
.avatar.xs { width: 24px; height: 24px; font-size: 0.6rem; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.2rem; }
.avatar.xl { width: 88px; height: 88px; font-size: 1.6rem; }
.avatar.locked { background: var(--surface-2); color: var(--muted); }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 0.92rem; }
.form input, .form select {
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  padding: 0 12px;
  font-weight: 400;
}
.form fieldset { border: 0; padding: 0; margin: 0; }
.form legend { font-weight: 700; font-size: 0.92rem; margin-bottom: 6px; }
.form.inline { flex-direction: row; flex-wrap: wrap; }
.form.inline input { flex: 1 1 140px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { flex-direction: row; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg.toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
}
.seg input:checked + span, .seg.toggle button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--info); outline-offset: 2px; }
.seg.toggle { align-self: flex-start; background: var(--surface-2); padding: 4px; border-radius: 999px; gap: 4px; }
.seg.toggle button { border: 0; background: transparent; }

.grid { display: grid; gap: 14px; }
.two-col { display: grid; gap: 16px; }
.two-col > div { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 720px) { .two-col { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ---------- オンボーディング ---------- */
.onb { max-width: 560px; width: 100%; margin: 0 auto; }
.onb-hero { font-size: 3rem; text-align: center; }
.onb h1 { text-align: center; }

/* ---------- 今日 ---------- */
.today-head { display: flex; flex-direction: column; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  min-width: 0;
}
.stat small { color: var(--muted); font-size: 0.72rem; line-height: 1.3; }
.big-emoji { font-size: 1.5rem; line-height: 1; }
.bar { display: block; width: 100%; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i, .progress-line i { display: block; height: 100%; background: linear-gradient(90deg, #fbbf24, var(--brand)); border-radius: inherit; transition: width 0.4s; }
.progress-line { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 12px; }
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--brand-soft);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 700;
}
.banner.warn { background: var(--warn-soft); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tasks { display: grid; gap: 14px; }
@media (min-width: 720px) { .tasks { grid-template-columns: 1fr 1fr; } }
.task { display: flex; flex-direction: column; gap: 8px; }
.task-top { display: flex; gap: 12px; align-items: center; }
.task-meta { min-width: 0; }
.task-meta h3 { margin: 0; }
.step { font-size: 0.78rem; font-weight: 700; color: var(--brand); }
.who { display: block; font-size: 0.8rem; color: var(--muted); }
.task-body { font-size: 1rem; flex: 1; }
.safety { background: var(--warn-soft); border-radius: 10px; padding: 8px 10px; font-size: 0.85rem; }
.basis summary { cursor: pointer; font-size: 0.82rem; color: var(--muted); }
.task-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-actions .btn { flex: 1; }
.task.is-done { background: var(--ok-soft); border-color: transparent; }
.task.is-done .task-actions .btn { flex: none; }
.done-mark { color: var(--ok); font-weight: 800; }
.checkin { text-align: center; }
.moods { display: flex; justify-content: center; gap: 6px; margin: 8px 0 12px; }
.mood { font-size: 2rem; width: 56px; height: 56px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; transition: transform 0.1s; }
.mood:hover, .mood:focus-visible { transform: scale(1.12); }
.notice { background: var(--info-soft); }
.rest { background: var(--brand-soft); }
.done-card, .paywall { text-align: center; }
.advice .advisor { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.advice .advisor small { display: block; }
.adv-emoji { font-size: 1.8rem; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }

/* ---------- レジェンド ---------- */
.filter { margin-bottom: 4px; }
.legends { grid-template-columns: 1fr; }
@media (min-width: 600px) { .legends { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .legends { grid-template-columns: repeat(3, 1fr); } }
.legend-card { display: flex; gap: 14px; text-decoration: none; border-top: 5px solid var(--c); transition: transform 0.15s; }
.legend-card:hover { transform: translateY(-2px); }
.legend-card h3 { margin: 2px 0 4px; }
.legend-card p { font-size: 0.9rem; }
.legend-card.unlocked { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 10%, var(--surface)), var(--surface)); }
.legend-head { display: flex; gap: 16px; align-items: center; border-inline-start: 6px solid var(--c); }
.legend-head h1 { margin: 0 0 4px; }
.facts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.facts li { border-inline-start: 3px solid var(--line); padding-inline-start: 12px; }
.quote { margin: 0 0 16px; }
.quote blockquote { margin: 0 0 8px; font-size: 1.05rem; font-weight: 700; border-inline-start: 4px solid var(--brand); padding-block: 4px; padding-inline: 12px 0; }
.quote .tr { background: var(--surface-2); padding: 8px 12px; border-radius: 10px; font-size: 0.92rem; }
.quote figcaption { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.myth { border: 2px dashed var(--warn); }
.lesson { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.source-list { padding-inline-start: 20px; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 0.9rem; word-break: break-word; }

/* ---------- チーム ---------- */
.members { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.members li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-2); border-radius: 12px; }
.members li .check { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.members input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--ok); }
.team-group { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.team-group ol { padding-inline-start: 20px; margin: 0; display: flex; flex-direction: column; gap: 6px; }

/* ---------- 記録 ---------- */
.stats-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.stat-card b { font-size: 1.6rem; }
.stat-card small { color: var(--muted); }
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; max-width: 420px; }
.cell { aspect-ratio: 1; border-radius: 6px; background: var(--surface-2); }
.cell.l1 { background: #fed7aa; } .cell.l2 { background: #fdba74; } .cell.l3 { background: #fb923c; } .cell.l4 { background: #ea580c; }
.cell.lr { background: #93c5fd; }
.badges { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 720px) { .badges { grid-template-columns: repeat(6, 1fr); } }
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 10px 4px; border-radius: 14px; background: var(--surface-2); filter: grayscale(1); opacity: 0.45; }
.badge span { font-size: 2rem; }
.badge.on { filter: none; opacity: 1; background: var(--brand-soft); }
.cards { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 600px) { .cards { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(7, 1fr); } }
.tcard { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 14px 8px; border-radius: 16px; border: 2px dashed var(--line); text-decoration: none; font-size: 0.85rem; }
.tcard.on { border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }

/* ---------- プラン ---------- */
.plans { grid-template-columns: 1fr; }
@media (min-width: 840px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan { display: flex; flex-direction: column; gap: 6px; position: relative; }
.plan.popular { border: 2px solid var(--brand); }
.plan .pill.hot { position: absolute; top: 14px; inset-inline-end: 14px; }
.price { font-size: 2rem; font-weight: 800; margin: 6px 0 0; }
.price small { font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.plan ul { list-style: none; padding: 0; margin: 8px 0 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }

/* ---------- タイマー・トースト ---------- */
.timer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgb(23 18 14 / 0.88);
  display: grid;
  place-items: center;
  padding: 16px;
}
.timer[hidden] { display: none; }
.timer-box { background: var(--surface); border-radius: 24px; padding: 24px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; align-items: center; }
.timer-msg { font-weight: 800; font-size: 1.1rem; text-align: center; }
.ring { position: relative; width: 200px; height: 200px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--surface-2); }
.ring .prog { stroke: var(--brand); stroke-linecap: round; stroke-dasharray: 327; transition: stroke-dashoffset 0.25s linear; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 60;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { top: 105%; transform: rotate(720deg); } }

/* ---------- 子ども向け表示（幼児・小学生） ---------- */
body.kid { font-size: 17px; }
body.kid .task-body { font-size: 1.1rem; }
body.kid .btn { min-height: 52px; font-size: 1.05rem; }
body.kid .card { border-radius: 24px; }

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

/* ---------- 図解（js/figures.js） ---------- */
.figs { display: grid; gap: 8px; }
.figs.multi { grid-template-columns: repeat(2, 1fr); }
.fig {
  margin: 0;
  background: var(--surface-2);
  border-radius: 14px;
  padding: 6px;
  color: var(--text);
}
.fig svg { display: block; width: 100%; height: auto; direction: ltr; }
.fig .b { fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.fig .b.hi { stroke: var(--brand); }
.fig .hd { fill: currentColor; }
.fig .g { stroke: var(--muted); stroke-width: 2; opacity: 0.5; }
.fig .a { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; }
.fig .a.dash { stroke-dasharray: 6 6; }
.fig .ng { fill: none; stroke: var(--danger); stroke-width: 3; }
.fig .okc { fill: none; stroke: var(--ok); stroke-width: 4; }
.fig .ngx { stroke: var(--danger); stroke-width: 4; stroke-linecap: round; }
.fig .ball { fill: #fbbf24; stroke: currentColor; stroke-width: 2; }
.fig .cone { fill: var(--brand); }
.fig .tgt { fill: none; stroke: var(--danger); stroke-width: 4; }
.fig .tgtc { fill: var(--danger); }
.fig .cell { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.fig .cellc { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 3; }
.fig .plate, .fig .box, .fig .cup { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.fig .hi2 { fill: var(--muted); }
.fig .tx { font: 700 12px var(--font); fill: currentColor; text-anchor: middle; }
.fig .tx.acc { fill: var(--brand); font-size: 13px; }
.fig .tx.small { font-size: 10px; }
.fig .tx.big { font-size: 26px; }
.fig .tx.emo { font-size: 22px; }
body.kid .fig .tx { font-size: 14px; }
body.kid .fig .tx.small { font-size: 12px; }

/* ---------- 相棒キャラクター ---------- */
.buddy {
  display: flex;
  align-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--c) 14%, var(--surface));
  border: 2px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 22px;
  padding: 12px 14px;
}
.buddy-face {
  position: relative;
  flex: none;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  font-size: 48px;
  background: var(--surface);
  border-radius: 50%;
  animation: bob 2.4s ease-in-out infinite;
}
.buddy-face.stage-2, .buddy-face.stage-3 { font-size: 54px; }
.buddy-face .crown { position: absolute; top: -14px; font-size: 24px; }
.bubble { position: relative; background: var(--surface); border-radius: 16px; padding: 10px 12px; flex: 1; min-width: 0; }
.bubble::before { content: ""; position: absolute; inset-inline-start: -8px; top: 22px; border: 8px solid transparent; border-inline-end-color: var(--surface); border-inline-start: 0; }
.bubble p { margin: 2px 0; font-weight: 700; }
@keyframes bob { 50% { transform: translateY(-5px); } }

.finding { background: var(--info-soft); border-radius: 10px; padding: 8px 10px; font-size: 0.9rem; }
.evidence { display: inline-block; background: var(--info-soft); color: var(--info-ink); border-radius: 6px; padding: 2px 8px; font-size: 0.75rem; font-weight: 700; }
.sci-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; border-top: 5px solid var(--info); }
.sci-card h3 { margin: 0; }
.timer-task { margin: 0; text-align: center; }
.timer-box .figs { width: 100%; }
.fig figcaption { text-align: center; font-size: 0.78rem; font-weight: 700; color: var(--muted); padding: 2px 0 4px; }

/* ---------- 広告枠・共有・規約 ---------- */
.ad { display: flex; flex-direction: column; gap: 4px; border: 1px dashed var(--line); border-radius: 14px; padding: 8px; background: var(--surface); }
.ad.placeholder { align-items: center; justify-content: center; min-height: 100px; color: var(--muted); font-weight: 700; }
.ad-label { align-self: flex-start; font-size: 0.7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.share-box { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 0.9rem; }
.share-box textarea { width: 100%; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--text); padding: 10px; font: inherit; font-size: 0.85rem; }
.legal { max-width: 760px; }
.legal h2 { margin-top: 1em; }
