/* =========================================================
   takken/css/style.css
   ・スマホ縦（390×844）を主に、PC横でも崩れない1列の作り。
   ・文字は16px以上。ライト／ダークの両方に対応。
   ・フォントは BIZ UDGothic（無ければ端末のゴシック体）。
   ========================================================= */

:root {
  --font: "BIZ UDGothic", "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic Medium", "Yu Gothic", Meiryo, sans-serif;
  --bg: #f4f6f8;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --ink: #1b2430;
  --ink-soft: #4a5766;
  --line: #ccd5df;
  --line-soft: #e3e9ef;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --ok: #146c43;
  --ok-bg: #e3f5ea;
  --ng: #a4342c;
  --ng-bg: #fdeceb;
  --warn: #7a5300;
  --warn-bg: #fdf3dd;
  --shadow: 0 1px 2px rgba(20, 35, 50, .08);
  --hide-band: #d8455c;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151a20;
    --bg-soft: #1b222a;
    --card: #1e262f;
    --ink: #e8eef4;
    --ink-soft: #b3c0cd;
    --line: #37424e;
    --line-soft: #2a333d;
    --accent: #6cb2e0;
    --accent-ink: #10181f;
    --ok: #7fd3a1;
    --ok-bg: #17301f;
    --ng: #f2a29b;
    --ng-bg: #331c1a;
    --warn: #edc978;
    --warn-bg: #33290f;
    --hide-band: #a83648;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

/* 設定で明示的にえらんだときは、そちらを優先する */
html[data-theme="light"] {
  --bg: #f4f6f8; --bg-soft: #ffffff; --card: #ffffff; --ink: #1b2430; --ink-soft: #4a5766;
  --line: #ccd5df; --line-soft: #e3e9ef; --accent: #1f5f8b; --accent-ink: #ffffff;
  --ok: #146c43; --ok-bg: #e3f5ea; --ng: #a4342c; --ng-bg: #fdeceb;
  --warn: #7a5300; --warn-bg: #fdf3dd; --shadow: 0 1px 2px rgba(20, 35, 50, .08);
  --hide-band: #d8455c;
}
html[data-theme="dark"] {
  --bg: #151a20; --bg-soft: #1b222a; --card: #1e262f; --ink: #e8eef4; --ink-soft: #b3c0cd;
  --line: #37424e; --line-soft: #2a333d; --accent: #6cb2e0; --accent-ink: #10181f;
  --ok: #7fd3a1; --ok-bg: #17301f; --ng: #f2a29b; --ng-bg: #331c1a;
  --warn: #edc978; --warn-bg: #33290f; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --hide-band: #a83648;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  /* 日本語は文の途中でも自然に折り返す（keep-all は、用語のしるしのところで
     行が不自然に切れる原因になるため使わない） */
  word-break: normal;
  overflow-wrap: break-word;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 14px;
}
.skip-link:focus { left: 8px; top: 8px; z-index: 50; }

/* ------------------------------------------------ ヘッダー・ナビ */

.app-header {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.app-header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 16px 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.app-title { text-decoration: none; color: inherit; display: block; flex: 1 1 auto; min-width: 180px; }
.app-title-main { display: block; font-size: 1.25rem; font-weight: 700; }
.app-title-sub { display: block; font-size: 1rem; color: var(--ink-soft); }

.theme-toggle {
  font: inherit;
  font-size: 1rem;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.app-nav {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 8px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.app-nav a {
  flex: 1 1 auto;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 8px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.app-nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
}

/* ------------------------------------------------ 本文 */

.view {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}
.loading { color: var(--ink-soft); }

.app-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  color: var(--ink-soft);
  font-size: 1rem;
}
.app-footer p { margin: 4px 0; }

h1 { font-size: 1.5rem; line-height: 1.5; margin: 0 0 8px; }
h2 { font-size: 1.25rem; line-height: 1.5; margin: 24px 0 8px; }
h3 { font-size: 1.125rem; line-height: 1.5; margin: 16px 0 6px; }
p { margin: 6px 0; }
a { color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin: 12px 0;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.muted { color: var(--ink-soft); }
.small-note { font-size: 1rem; color: var(--ink-soft); }

.btn {
  font: inherit;
  font-size: 1rem;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.btn-row .btn { flex: 1 1 200px; }

.badge {
  display: inline-block;
  font-size: 1rem;
  line-height: 1.4;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink-soft);
  white-space: nowrap;
}
.badge-A { border-color: var(--ng); color: var(--ng); background: var(--ng-bg); font-weight: 700; }
.badge-B { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); font-weight: 700; }
.badge-C { border-color: var(--line); color: var(--ink-soft); }
.badge-D { border-color: var(--line-soft); color: var(--ink-soft); }
.badge-preparing { border-color: var(--line); color: var(--ink-soft); background: var(--bg); }

/* ------------------------------------------------ ホーム */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 700px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat-card { text-align: center; }
.stat-label { display: block; font-size: 1rem; color: var(--ink-soft); }
.stat-value { display: block; font-size: 2rem; font-weight: 700; line-height: 1.3; }
.stat-unit { font-size: 1rem; font-weight: 400; }

.bar {
  height: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--accent); }

.field-row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; }
.field-name { font-weight: 700; }
.field-num { color: var(--ink-soft); }
.field-card .bar { margin-top: 6px; }

/* ------------------------------------------------ 単元一覧 */

/* ------------------------------------------------ 用語（点線の下線・説明・用語集） */

.term {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  /* しるしは inline のまま（inline-block や flex にすると、行の途中で不自然に折り返す） */
  display: inline;
  min-height: 0;
  cursor: pointer;
  border-bottom: 1px dotted var(--accent);
  text-align: inherit;
  text-decoration: none;
  line-height: inherit;
}
.term:hover, .term:focus { background: var(--accent-bg, rgba(31, 95, 139, 0.12)); }

.term-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--card);
  border-top: 3px solid var(--accent);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
  padding: 12px 14px 16px;
  max-height: 70vh;
  overflow-y: auto;
}
.term-sheet[hidden] { display: none; }
.term-sheet-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.term-sheet-name { font-size: 1.25rem; font-weight: 700; }
.term-sheet-yomi { color: var(--ink-soft); }
.term-sheet-head .btn { margin-left: auto; }
.term-sheet-short { margin: 8px 0 4px; font-size: 1rem; }

.term-group { margin: 12px 0 18px; }
.term-group h2 { font-size: 1.05rem; margin: 10px 0 6px; color: var(--ink-soft); }
.term-row {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 6px;
  min-height: 44px;
  cursor: pointer;
}
.term-row:hover { border-color: var(--accent); }
.term-row-name { font-weight: 700; margin-right: 6px; }
.term-row-yomi { color: var(--ink-soft); font-size: 1rem; margin-right: 6px; }
.term-row-short { display: block; margin-top: 4px; }

/* ------------------------------------------------ 今日やること */

.plan-item {
  border-top: 1px solid var(--line-soft, var(--line));
  padding-top: 10px;
  margin-top: 10px;
}
.plan-item-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.plan-item-times { font-weight: 700; color: var(--accent); }
.plan-item-label { font-weight: 700; }
.today-plan-head { font-weight: 700; }

/* ------------------------------------------------ 解説の段階表示・隠して覚える */

.reveal-body[hidden] { display: none; }
.reveal-body { border-top: 1px solid var(--line-soft, var(--line)); margin-top: 10px; padding-top: 10px; }

/* 隠して覚える: 赤シートのような帯。文字数ぶんの幅になり、タップで出る */
.hide-cell {
  font: inherit;
  color: transparent;
  background: var(--hide-band);
  border: 0;
  border-radius: 3px;
  padding: 0 1px;
  margin: 0 1px;
  line-height: inherit;
  vertical-align: baseline;
  display: inline-block;
  cursor: pointer;
}
.hide-band-text { visibility: hidden; }
.hide-cell:hover, .hide-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.revealed-text { background: none; border: 0; padding: 0; font: inherit; color: inherit; }

/* ------------------------------------------------ 更新・訂正の履歴 */

[data-changelog] li { margin-bottom: 8px; }
[data-changelog] .badge { margin-right: 6px; }

.unit-row {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin: 8px 0;
}
.unit-row:hover { border-color: var(--accent); }
.unit-row.is-next { border-color: var(--accent); border-width: 2px; background: var(--bg-soft); }
.unit-row-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.unit-id { font-weight: 700; }
.unit-name { flex: 1 1 auto; }
.unit-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--ink-soft); }

/* ------------------------------------------------ 単元ページ */

.unit-head .unit-head-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; }

.chapter-row {
  border-top: 1px solid var(--line-soft);
  padding: 10px 0;
}
.chapter-row:first-child { border-top: 0; }
.chapter-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.chapter-no { font-weight: 700; white-space: nowrap; }
.chapter-time { color: var(--ink-soft); white-space: nowrap; }
.chapter-topics { color: var(--ink-soft); }
.chapter-row.is-target { background: var(--warn-bg); border-radius: var(--radius); padding: 10px; }

.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ------------------------------------------------ 講義の短い動画（一覧と再生） */

.clips-progress { margin: 10px 0 14px; }
.clips-progress p { margin: 0 0 6px; font-weight: 700; }

.clips-list { list-style: none; margin: 8px 0 0; padding: 0; }
.clip-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 2px 10px;
  align-items: start;
  border-top: 1px solid var(--line-soft);
  padding: 13px 0;
}
.clip-row:first-child { border-top: 0; }
.clip-row.is-target { background: var(--warn-bg); border-radius: var(--radius); padding: 13px; }

.clip-thumb {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  display: block;
  width: 132px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
  cursor: pointer;
}
.clip-thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.clip-thumb .clip-play {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(15, 25, 35, .72);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
}

.clip-main { grid-column: 2; grid-row: 1; min-width: 0; }
.clip-head { grid-column: 2; grid-row: 1; display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.clip-head-text { flex: 1 1 auto; min-width: 0; }
.clip-no { font-weight: 700; white-space: nowrap; margin-right: 6px; }
.clip-title { font-weight: 700; line-height: 1.45; }
.clip-meta { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; color: var(--ink-soft); }
.clip-meta .clip-length { font-variant-numeric: tabular-nums; white-space: nowrap; }
.clip-meta .clip-resume { white-space: nowrap; }
.clip-meta [hidden] { display: none; }
.clip-meta a.clip-book { color: var(--accent); }

.clip-watch {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  margin: -6px 0;
  font-weight: 700;
  cursor: pointer;
}
.clip-watch input { width: 22px; height: 22px; }
.clip-row.is-watched .clip-watch { color: var(--ok); }

.clip-panel { margin-top: 14px; }
.clip-panel h3 { margin-top: 0; }
.clip-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
}

.clip-done { border-top: 1px solid var(--line-soft); margin-top: 12px; padding-top: 10px; }
.clip-done[hidden] { display: none; }
.clip-done h4 { margin: 0 0 6px; }
/* 「見た」の状態で入れかえるボタン（.btn は display:inline-flex なので、[hidden] を効かせる） */
.clip-panel .btn[hidden] { display: none; }
.clip-quiz-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin: 10px 0; }
.clip-quiz-card > :first-child { margin-top: 0; }
.clip-quiz-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 6px; }
.clip-quiz-topic { color: var(--ink-soft); }
.clip-limbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.clip-limbs .limb-mark { border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 8px; }
.clip-limbs .limb-mark.is-chosen { border-color: var(--accent); font-weight: 700; }

.notes-block { margin: 12px 0; }
.table-wrap { overflow-x: auto; }
table.notes-table { border-collapse: collapse; width: 100%; font-size: 1rem; }
table.notes-table th, table.notes-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.notes-table th { background: var(--bg-soft); }
.point-list { margin: 6px 0 0; padding-left: 1.4em; }
.point-list li { margin: 4px 0; }

/* ------------------------------------------------ 演習 */

.quiz-progress { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; color: var(--ink-soft); }
.quiz-question { font-size: 1.125rem; line-height: 1.8; margin: 12px 0; }
.choice {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.7;
  padding: 12px 14px;
  margin: 8px 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.choice:hover { border-color: var(--accent); }
.choice-num { font-weight: 700; margin-right: 6px; }
.choice.is-correct { border-color: var(--ok); background: var(--ok-bg); font-weight: 700; }
.choice.is-wrong { border-color: var(--ng); background: var(--ng-bg); }
.choice.is-chosen { outline: 2px solid var(--accent); outline-offset: 1px; }
.choice:disabled, .btn:disabled { cursor: default; opacity: 1; }
.choice:disabled:hover, .btn:disabled:hover { border-color: var(--line); }

.result-head { font-size: 1.25rem; font-weight: 700; }
.result-ok { color: var(--ok); }
.result-ng { color: var(--ng); }
.result-unsure { color: var(--warn); }
.result-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid currentColor;
}
.quote-box {
  background: var(--bg-soft);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  padding: 10px 12px;
  margin: 10px 0;
}
.quote-law { font-weight: 700; }
.quote-text { margin: 4px 0 0; }
.limb {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 8px 0;
  background: var(--bg-soft);
}
.limb-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.limb-mark { font-weight: 700; }
.limb-mark.is-correct { color: var(--ok); }
.limb-mark.is-wrong { color: var(--ng); }

/* ------------------------------------------------ 復習 */

.review-item {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 8px 0;
  background: var(--card);
  box-shadow: var(--shadow);
}
.review-item:hover { border-color: var(--accent); }
.review-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.review-text { color: var(--ink-soft); }
.review-meta { color: var(--ink-soft); }

.empty { color: var(--ink-soft); }

/* ------------------------------------------------ 設定 */

.setting-row { border-top: 1px solid var(--line-soft); padding: 12px 0; }
.setting-row:first-child { border-top: 0; }
.field-label { display: block; font-weight: 700; margin-bottom: 4px; }
input[type="text"], input[type="url"], select {
  font: inherit;
  font-size: 1rem;
  min-height: 44px;
  width: 100%;
  max-width: 420px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--ink);
}
input[type="file"] { font: inherit; font-size: 1rem; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.radio-row input { width: 20px; height: 20px; }

.status-note { padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-soft); }
.status-ok { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.status-ng { border-color: var(--ng); color: var(--ng); background: var(--ng-bg); }

.credits { margin: 6px 0 0; padding-left: 1.4em; }

/* ------------------------------------------------ 模試 */

.mock-clock {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.mock-clock-card .bar { margin: 8px 0 4px; }
.mock-wrong { margin: 10px 0; padding: 12px; }
.mock-wrong .quiz-question { font-size: 1.0625rem; margin: 8px 0; }

/* ------------------------------------------------ 得点の見える化 */

[data-score-fields] th, [data-score-fields] td,
[data-mock-sections] th, [data-mock-sections] td { white-space: nowrap; }
[data-score-field], [data-score-fields] td:first-child { text-align: left; }

/* ------------------------------------------------ 教科書（読む講義） */

.tb-section h2 { margin-top: 0; }
.tb-block { margin: 12px 0; }
.tb-block > :last-child { margin-bottom: 0; }
.tb-label {
  display: inline-block;
  font-weight: 700;
  margin-bottom: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 1rem;
}
.tb-text { margin: 4px 0; }
.tb-p { margin: 8px 0; }
.tb-example {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  background: var(--bg-soft);
  padding: 10px 12px;
}
.tb-example .tb-label { color: var(--accent); }
.tb-point {
  border: 1px solid var(--ok);
  border-left: 4px solid var(--ok);
  border-radius: 4px;
  background: var(--ok-bg);
  padding: 10px 12px;
}
.tb-point .tb-label { color: var(--ok); }
.tb-trap {
  border: 1px solid var(--warn);
  border-left: 4px solid var(--warn);
  border-radius: 4px;
  background: var(--warn-bg);
  padding: 10px 12px;
}
.tb-trap .tb-label { color: var(--warn); }
.tb-table { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }
.tb-source-row { margin: 6px 0 0; }
.tb-source-btn { min-height: 44px; padding: 6px 14px; font-size: 1rem; }

/* ---------------------------------------------- 教科書の場面（scene）と本試験の言い方（exam） */
.tb-scene {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  background: var(--bg-soft);
  padding: 10px 12px;
}
.tb-scene .tb-label { color: var(--accent); }
.tb-scene-card { border-left: 4px solid var(--accent); }
.tb-exam {
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  background: var(--bg-soft);
  padding: 10px 12px;
}
.tb-exam .tb-label { color: var(--accent); }

/* ---------------------------------------------- 図（diagram） */
.dg-wrap { margin: 12px 0; }
.dg-caption {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.dg-caption .dg-kind {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-soft);
}
.dg-svg { display: block; width: 100%; height: auto; }
.dg-note {
  margin: 4px 0 0;
  font-size: .9rem;
  color: var(--ink-soft);
}
.dg-node { fill: var(--bg-soft); stroke: var(--line); stroke-width: 1.2; }
.dg-node-label { fill: var(--ink); font-weight: 700; }
.dg-node-sub { fill: var(--ink-soft); }
.dg-edge { stroke: var(--ink-soft); stroke-width: 1.2; }
.dg-arrow { fill: var(--ink-soft); }
.dg-edge-bg { fill: var(--card); stroke: none; }
.dg-edge-label { fill: var(--ink-soft); }
.dg-axis { stroke: var(--line); stroke-width: 2; }
.dg-axis-v { stroke: var(--line); stroke-width: 1; }
.dg-link { stroke: var(--line); stroke-width: 1.5; }
.dg-bracket { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 4 3; }
.dg-dot-start, .dg-dot-deadline { fill: var(--accent); }
.dg-dot-ring { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.dg-dot-normal { fill: var(--card); stroke: var(--ink-soft); stroke-width: 1.5; }
.dg-dot-end { fill: var(--ink-soft); }
.dg-date { fill: var(--ink-soft); }
.dg-event { fill: var(--ink); }
.dg-chip { fill: var(--bg-soft); stroke: var(--line); }
.dg-chip-text { fill: var(--ink-soft); }
.dg-flow-q { fill: var(--bg-soft); stroke: var(--line); stroke-width: 1.2; }
.dg-flow-q-start { stroke: var(--accent); stroke-width: 1.6; }
.dg-q-text { fill: var(--ink); font-weight: 700; }
.dg-branch { fill: var(--ink-soft); }
.dg-result { stroke-width: 1.2; }
.dg-result-ok { fill: var(--ok-bg); stroke: var(--ok); }
.dg-result-ng { fill: var(--ng-bg); stroke: var(--ng); }
.dg-result-note { fill: var(--bg-soft); stroke: var(--line); }
.dg-result-text { fill: var(--ink); }
.dg-bar-track { fill: var(--line-soft); }
.dg-bar-accent { fill: var(--accent); }
.dg-bar-muted { fill: var(--line); }
.dg-bar-ng { fill: var(--ng); }
.dg-bar-label { fill: var(--ink); }
.dg-bar-sub { fill: var(--ink-soft); }
.dg-bar-value { fill: var(--ink); font-weight: 700; }
.dg-bar-value-on { fill: var(--accent-ink); }
.dg-bar-note { stroke-width: 1.2; }
.dg-bar-note-note { fill: var(--bg-soft); stroke: var(--line); }
.dg-bar-note-ng { fill: var(--ng-bg); stroke: var(--ng); }
.dg-bar-note-text { fill: var(--ink); }
.dg-col-head { fill: var(--bg-soft); stroke: var(--accent); stroke-width: 1.2; }
.dg-col-title { fill: var(--ink); font-weight: 700; }
.dg-col-badge { fill: var(--ink-soft); }
.dg-cell { fill: var(--bg-soft); stroke: var(--line-soft); }
.dg-cell-text { fill: var(--ink); }
.dg-row-label { fill: var(--ink-soft); }
.dg-figure-note { fill: var(--ink-soft); }

/* ---------------------------------------------- 導入の4コマ */
.manga { margin: 8px 0 14px; }
.manga-head { margin: 0 0 6px; font-size: .95rem; color: var(--ink-soft); }
.manga-panel {
  position: relative;
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
}
.manga-frame { position: relative; line-height: 0; }
.manga-panel img, .koma-panel img { display: block; width: 100%; height: auto; }
/* セリフは絵の中の吹き出し。絵と同じ目盛り（0〜1000）の SVG を絵の上に重ねる */
.manga-svg-box { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.manga-svg { display: block; width: 100%; height: 100%; }
/* 吹き出しは白地に黒い線。絵の上に載るので、テーマが暗くても同じ色にする */
.manga-bubble-body { fill: #ffffff; }
.manga-bubble-tail { fill: #ffffff; stroke: #1b1b1b; stroke-width: 5; stroke-linejoin: round; }
.manga-bubble-line { fill: none; stroke: #1b1b1b; stroke-width: 5; }
/* しっぽの付け根にかかる枠線を、白で消す */
.manga-bubble-join { stroke: #ffffff; stroke-width: 7; }
/* 縦書き。文字の大きさは絵の目盛り（34）。スマホ幅でも約12px になる */
.manga-bubble-text {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-size: 34px;
  line-height: 1.06;
  writing-mode: vertical-rl;
  text-orientation: upright;
  color: #14181d;
  font-weight: 500;
}
/* ---------------------------------------------- 覚えるコマ（絵で覚えるところ） */
.koma-box { margin: 10px 0 14px; }
.koma-head-line { margin: 0 0 8px; font-size: .95rem; color: var(--ink-soft); }
.koma-panel {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
}
.koma-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: baseline;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft, var(--line));
}
.koma-chip {
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.koma-topic { font-size: .92rem; color: var(--ink); }
/* 論点の中でのコマ番号（1枚だけの論点では出さない） */
.koma-no { font-size: .8rem; color: var(--ink-soft); }
/* 根拠（条番号）は「根拠」ボタンの中に置く */
.koma-source-btn { padding: 2px 10px; font-size: .8rem; }
.koma-source {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft, var(--line));
  background: var(--bg);
  font-size: .85rem;
  color: var(--ink-soft);
}
.koma-panel .manga-frame { cursor: default; }
/* 隠して覚える: セリフの中の覚える語を赤シートのように隠す。絵をタップすると出る */
.koma-hide .manga-frame { cursor: pointer; }
.koma-hide .manga-key { background: var(--hide-band); color: transparent; border-radius: 3px; }
.koma-hide.koma-shown .manga-key { background: none; color: inherit; }
.koma-hint { margin: 0; padding: 6px 10px 10px; }

/* ---------------------------------------------- 覚えるコマ（図解カード） */
/* 1論点1枚。見出し（問い）＋図＋大きな横書きの答え＋根拠。縦の余白は詰める */
.zk-box { margin: 10px 0 14px; }
.zk-head-line { margin: 0 0 8px; font-size: .95rem; color: var(--ink-soft); }
.zk-card {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
}
.zk-head {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  align-items: baseline;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line-soft, var(--line));
}
.zk-chip {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  padding: 0 7px;
  white-space: nowrap;
}
.zk-ask { flex: 1 1 170px; font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.4; }
/* 根拠は見出しの行に小さなボタンを1つだけ置く（縦に積まない） */
.zk-src {
  margin-left: auto;
  min-height: 0;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
  white-space: nowrap;
}
.zk-source {
  margin: 0;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft, var(--line));
  background: var(--bg);
  font-size: .875rem;
  color: var(--ink-soft);
}
.zk-source-head { font-weight: 700; color: var(--ink); }
.zk-fig { line-height: 0; padding: 4px 6px 0; }
/* PC幅で図と絵が大きくなりすぎないように、幅の上限を決める（文字との釣り合い） */
.zk-fig .zk-svg, .zk-fig img { max-width: 430px; margin: 0 auto; }
.zk-fig img { display: block; width: 100%; height: auto; }
.zk-svg { display: block; width: 100%; height: auto; }
/* 図の中の文字は、横書き・14px以上（zukai.js が 15 で描く） */
.zk-svg text { fill: var(--ink); font-family: var(--font); }
.zk-svg .zk-row-title, .zk-svg .zk-sheet-title, .zk-svg .zk-step-label,
.zk-svg .zk-g-title, .zk-svg .zk-t-label-text { font-weight: 700; }
.zk-svg .zk-row-result { fill: var(--accent); font-weight: 700; }
.zk-svg .zk-count { fill: var(--accent); font-weight: 700; }
.zk-svg .zk-to-box, .zk-svg .zk-cell, .zk-svg .zk-t-label, .zk-svg .zk-t-text {
  fill: var(--bg); stroke: var(--line); stroke-width: 1;
}
.zk-svg .zk-file-body { fill: #2f7fd0; }
.zk-svg .zk-file-blue { fill: #2f7fd0; }
.zk-svg .zk-file-red { fill: #cf3b3b; }
.zk-svg .zk-card-green { fill: #2f9e5b; }
.zk-svg .zk-money-env { fill: #ffffff; stroke: var(--line); }
.zk-svg .zk-money-note { fill: #f0e3c0; }
.zk-svg .zk-file-sheet, .zk-svg .zk-file-sheet-frame { fill: #ffffff; }
.zk-svg .zk-file-sheet-frame { stroke: #1b1b1b; stroke-width: 1; }
.zk-svg .zk-sheet-line { fill: #9fb2c4; }
.zk-svg .zk-key-ring { fill: none; stroke: #b78a2f; stroke-width: 2; }
.zk-svg .zk-key-stem { stroke: #b78a2f; stroke-width: 2.5; }
.zk-svg .zk-phone { fill: #22303d; }
.zk-svg .zk-phone-screen { fill: #ffffff; }
.zk-svg .zk-pen { stroke: #22303d; stroke-width: 2.5; }
.zk-svg .zk-stamp { fill: #b5382f; }
.zk-svg .zk-stamp-top { fill: #6b5a52; }
.zk-svg .zk-clock { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; }
.zk-svg .zk-clock-hand { stroke: var(--ink-soft); stroke-width: 1.5; }
.zk-svg .zk-arrow { stroke: var(--ink-soft); stroke-width: 2; }
.zk-svg .zk-arrow-head { fill: var(--ink-soft); }
/* 顔アイコン: 丸く切り抜いた写真に、細い輪を重ねる（塗りつぶさない） */
.zk-svg .zk-face { fill: none; }
.zk-svg .zk-face-ring { fill: none; stroke: var(--line); stroke-width: 1.5; }
.zk-svg .zk-step { fill: var(--bg); stroke: var(--line); stroke-width: 1; }
.zk-svg .zk-step-start { stroke: var(--accent); }
.zk-svg .zk-step-end { stroke: var(--accent); }
.zk-svg .zk-step-sub { fill: var(--ink-soft); }
.zk-svg .zk-g-head-left { fill: var(--bg); stroke: var(--accent); stroke-width: 1.2; }
.zk-svg .zk-g-head-right { fill: var(--bg); stroke: var(--warn); stroke-width: 1.2; }
.zk-svg .zk-g-line { fill: var(--ink); }
.zk-svg .zk-t-text-inner { fill: var(--ink); }
.zk-svg .zk-bar-label, .zk-svg .zk-bar-value { fill: var(--ink); }
.zk-svg .zk-bar-value { font-weight: 700; }
.zk-svg .zk-bar-track { fill: var(--line-soft); }
.zk-svg .zk-bar-accent { fill: var(--accent); }
.zk-svg .zk-bar-muted { fill: var(--ink-soft); }
.zk-svg .zk-bar-note { fill: var(--warn-bg); stroke: var(--warn); stroke-width: 1; }
.zk-svg .zk-bar-label-note { fill: var(--ink); font-weight: 700; }
.zk-svg .zk-bar-note-text { fill: var(--ink); }
.zk-svg .zk-flow-q { fill: var(--bg); stroke: var(--accent); stroke-width: 1.2; }
.zk-svg .zk-flow-q-text, .zk-svg .zk-branch { fill: var(--ink); font-weight: 700; }
.zk-svg .zk-result { stroke-width: 1; }
.zk-svg .zk-result-ok { fill: var(--ok-bg); stroke: var(--ok); }
.zk-svg .zk-result-ng { fill: var(--ng-bg); stroke: var(--ng); }
.zk-svg .zk-result-note { fill: var(--warn-bg); stroke: var(--warn); }
.zk-svg .zk-note { fill: var(--ink-soft); }
/* 大きな横書きの答え（1〜2行） */
.zk-answer {
  margin: 0;
  padding: 6px 8px;
  border-top: 1px solid var(--line-soft, var(--line));
  font-size: 16px;
  line-height: 1.45;
  font-weight: 700;
  color: var(--ink);
}
/* 案Bのルールの帯（絵の下に、大きな文字で1〜2行） */
.zk-band {
  margin: 0;
  padding: 6px 8px;
  border-top: 1px solid var(--line-soft, var(--line));
  background: var(--bg-soft);
  font-size: 17px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--ink);
}
.zk-confuse { margin: 0; padding: 0 8px 6px; font-size: 14px; line-height: 1.35; color: var(--ink-soft); }
.zk-hint { margin: 0; padding: 0 8px 6px; font-size: 14px; }
/* 隠して覚える: 答えの中の隠す語を、赤シートのように隠す。タップすると出る */
.zk-hide .zk-key { background: var(--hide-band); color: transparent; border-radius: 3px; cursor: pointer; }
.zk-hide.zk-shown .zk-key { background: none; color: inherit; }
.zk-hide .zk-card, .zk-hide.zk-card { cursor: pointer; }

/* 読み上げ用のテキスト（画面には見えない） */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}


/* ---------------------------------------------- 暗記カード（今日のカード） */
.card-answer { display: flex; gap: 8px; align-items: baseline; font-size: 1.15rem; font-weight: 700; }
.card-answer .badge { flex: none; }
.card-answer-text { font-weight: 700; }
input.card-input { font-size: 1rem; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; width: 12rem; max-width: 100%; }

/* ------------------------------------------------ 数字と取り違えの総まとめ（#/summary） */

.sum-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.sum-tab, .sum-field {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 6px 14px; font-size: 1rem; line-height: 1.4;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink); text-decoration: none;
}
.sum-tab { flex: 1 1 auto; font-weight: 700; border-radius: var(--radius); }
.sum-tab[aria-current="page"], .sum-field[aria-current="true"] {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.sum-fields { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.sum-field { min-height: 40px; padding: 4px 12px; }

.sum-field-head { border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.sum-unit-head { margin: 14px 0 6px; font-size: 1.0625rem; }
.sum-unit-head a { color: var(--ink); text-decoration: none; }
.sum-unit-count { font-weight: 400; font-size: 1rem; color: var(--ink-soft); }

table.sum-table { min-width: 300px; }
.sum-table th, .sum-table td { overflow-wrap: anywhere; }
.sum-table .sum-value { font-size: 1.0625rem; min-width: 6.5em; }
.sum-table .sum-go { margin-top: 4px; }
.sum-table .sum-ask { width: 62%; }
.sum-table .sum-value { width: 38%; }
.sum-hide { min-height: 28px; min-width: 4em; }
.sum-link {
  display: inline-block; font-size: .875rem; line-height: 1.3;
  padding: 6px 8px; margin: 2px 4px 2px 0;
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--accent); background: var(--bg-soft); text-decoration: none; white-space: nowrap;
}
.sum-link:hover, .sum-link:focus-visible { border-color: var(--accent); }
.sum-tag {
  display: inline-block; font-size: .875rem; line-height: 1.3; padding: 0 6px;
  border-radius: 4px; border: 1px solid var(--line); vertical-align: baseline; white-space: nowrap;
}
.sum-tag-ex { color: var(--warn); background: var(--warn-bg); border-color: var(--warn); }
.sum-tag-tax { color: var(--ink-soft); }

.sum-pair { margin: 18px 0 22px; }
.sum-pair-title { margin: 0 0 4px; }
.sum-pair-table { min-width: 560px; }
.sum-pair-table th.sum-aspect {
  min-width: 6.5em; max-width: 8em; background: var(--bg-soft); font-weight: 700;
  position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--line);
}
.sum-pair-table td.sum-side { min-width: 10em; }
.sum-pair-table th.sum-side { min-width: 10em; }
.sum-side-0 { background: rgba(31, 95, 139, .09); }
.sum-side-1 { background: rgba(164, 52, 44, .08); }
.sum-side-2 { background: rgba(20, 108, 67, .09); }
.sum-none { color: var(--ink-soft); }

.sum-answer { font-size: 1.75rem; font-weight: 700; line-height: 1.4; margin: 10px 0; color: var(--accent); }
.sum-drill .sum-go { margin: 6px 0; }

.line-flash { animation: line-flash 3.2s ease-out 1; }
@keyframes line-flash {
  0%, 60% { background: var(--warn-bg); outline: 2px solid var(--warn); outline-offset: 2px; }
  100% { background: transparent; outline-color: transparent; }
}

/* 印刷用の1ページ表示 */
.print-sheet { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.pr-title { font-size: 1.25rem; margin: 0 0 6px; }
.pr-field { font-size: 1.125rem; margin: 14px 0 4px; border-bottom: 2px solid var(--ink); }
.pr-unit { break-inside: avoid; margin: 0 0 10px; }
.pr-unit-head { font-size: 1rem; margin: 8px 0 2px; }
table.pr-table, table.pr-pair-table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.pr-table td, .pr-pair-table th, .pr-pair-table td { border: 1px solid var(--line); padding: 4px 8px; vertical-align: top; text-align: left; }
.pr-table .pr-val { font-weight: 700; width: 38%; }
.pr-blank { height: 1.9em; }
.pr-pair { margin: 12px 0; break-inside: avoid; overflow-x: auto; }
.pr-pair-title { font-size: 1.0625rem; margin: 0 0 2px; }
.pr-pair-table th { background: var(--bg-soft); }
@media (min-width: 700px) {
  .pr-cols { column-count: 2; column-gap: 18px; }
}

@media print {
  html, body { background: #fff !important; color: #000 !important; }
  .app-header, .app-footer, .skip-link, .no-print { display: none !important; }
  .view { max-width: none; padding: 0; }
  .print-sheet { border: 0; padding: 0; margin: 0; background: #fff; }
  .pr-title { font-size: 14pt; }
  .pr-field { font-size: 11pt; margin: 8pt 0 3pt; border-color: #000; break-after: avoid; }
  .pr-unit-head { font-size: 9.5pt; margin: 4pt 0 1pt; break-after: avoid; }
  table.pr-table, table.pr-pair-table { font-size: 8.5pt; line-height: 1.35; }
  .pr-table td, .pr-pair-table th, .pr-pair-table td { border: .5pt solid #444; padding: 1.5pt 4pt; }
  .pr-pair-title { font-size: 10pt; }
  .pr-pair-table th { background: #eee !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pr-cols { column-count: 2; column-gap: 14pt; }
  .pr-blank { height: 14pt; }
  @page { size: A4 portrait; margin: 12mm; }
}

/* S3: 表をスマホでカード表示にする */
@media (max-width: 599px) {
  table.tbl-cards, table.tbl-cards tbody, table.tbl-cards tr, table.tbl-cards td { display: block; width: 100%; box-sizing: border-box; }
  table.tbl-cards thead { position: absolute; left: -9999px; }
  table.tbl-cards tr { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin: 0 0 10px; padding: 6px 10px; box-shadow: var(--shadow); }
  table.tbl-cards td { border: 0; border-bottom: 1px solid var(--line-soft); padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.tbl-cards td:last-child { border-bottom: 0; }
  table.tbl-cards td::before { content: attr(data-label); color: var(--ink-soft); text-align: left; flex: 0 0 auto; }
  table.tbl-cards td:first-child { font-weight: bold; text-align: left; display: block; }
  table.tbl-cards td:first-child::before { display: none; }
}

/* S3: 用語集の検索欄と頭文字ジャンプを上に固定 */
.gl-sticky { position: sticky; top: 0; z-index: 5; }
.gl-anchor { scroll-margin-top: 150px; }
.gl-jump { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gl-chip { min-width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); color: var(--ink); font: inherit; cursor: pointer; }
@media (max-width: 599px) { .gl-chip { min-width: 40px; height: 44px; } .gl-sticky { padding-bottom: 8px; } }

/* S3: 折りたたみ（単元ページの講義一覧など） */
details.fold > summary.fold-sum { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: bold; color: var(--ink); }
details.fold { margin: 8px 0; }

/* S3: 設定の目次と区切り */
.set-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.set-toc-btn { min-height: 44px; }
.set-section { scroll-margin-top: 12px; border-left: 4px solid var(--accent); }
.danger-head { color: var(--ng); border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 18px; }
.danger-zone .btn { border-color: var(--ng); color: var(--ng); min-height: 44px; }

/* ------------------------------------------------ 上の案内（その他）・ホームの入口 */
.nav-more-btn {
  flex: 1 1 auto; font: inherit; font-size: 1rem; min-height: 44px; padding: 10px 8px;
  color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer; display: none;
}
.nav-more-btn[data-current] { border-color: var(--accent); font-weight: 700; box-shadow: inset 0 -3px 0 var(--accent); }
.nav-more { display: contents; }
.app-nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent-ink); }
@media (max-width: 699px) {
  .nav-more-btn { display: block; }
  .nav-more { display: none; flex: 1 1 100%; gap: 6px; flex-wrap: wrap; }
  .nav-more.is-open { display: flex; }
  .nav-more a { flex: 1 1 40%; }
}

.home-hero { border-width: 2px; border-color: var(--accent); }
.home-hero-kicker { margin: 0; font-weight: 700; color: var(--accent); }
.home-hero-title { margin: 4px 0; font-size: 1.4rem; font-weight: 700; line-height: 1.4; }
.home-hero-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 56px; font-size: 1.15rem; margin-top: 8px; }
.home-fold > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; padding: 6px 2px; }

@media (min-width: 1000px) {
  .view, .app-header-inner, .app-nav, .app-footer { max-width: 1120px; }
  .home-fold .home-fold-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; }
  .home-fold .home-fold-body > h2, .home-fold .home-fold-body > p, .home-fold .home-fold-body > [data-score-box] { grid-column: 1 / -1; }
}

/* S3: 模試の選択を短い一覧に */
.mock-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 12px; margin: 0 0 8px; }
.mock-row .mock-row-head { margin: 0; }
.mock-row .mock-row-fields { display: none; }
.mock-row .btn-row { margin: 0; }
.mock-row .btn { min-height: 44px; }

/* S3: 教科書の漫画をタップで拡大 */
.manga-zoomable { cursor: zoom-in; }
.manga-zoom { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .82); overflow: auto; -webkit-overflow-scrolling: touch; padding: 60px 8px 16px; }
.manga-zoom-close { position: fixed; top: 8px; right: 8px; min-height: 44px; min-width: 88px; z-index: 101; }
.manga-zoom-inner { width: 220vw; max-width: 1100px; margin: 0 auto; background: var(--card); }
@media (min-width: 700px) { .manga-zoom-inner { width: 90vw; } }

/* ---------- 学習の記録（#/progress）・達成のしるし ---------- */
.pg-chart { display: block; width: 100%; height: auto; max-width: 560px; }
.pg-chart .pg-grid { stroke: var(--line-soft); stroke-width: 1; }
.pg-chart .pg-axis { fill: var(--ink-soft); font-size: 10px; font-family: var(--font); }
.pg-chart .pg-bar-q { fill: var(--accent); }
.pg-chart .pg-bar-c { fill: var(--ok); }
.pg-chart .pg-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.pg-chart .pg-dot { fill: var(--accent); stroke: var(--card); stroke-width: 1.5; }
.pg-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.pg-key-q { background: var(--accent); }
.pg-key-c { background: var(--ok); }
.pg-badges { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 600px) { .pg-badges { grid-template-columns: 1fr 1fr; } }
.pg-badge { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--bg-soft); }
.pg-badge-done { border-color: var(--ok); background: var(--ok-bg); }
.pg-badge-mark { flex: 0 0 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 50%; border: 2px solid var(--line); color: var(--ink-soft); font-weight: 700; }
.pg-badge-done .pg-badge-mark { border-color: var(--ok); background: var(--ok); color: #fff; }
.pg-badge-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.pg-badge-body .bar { display: block; }
.pg-homelink a { display: inline-block; min-height: 44px; line-height: 44px; }
.pg-toast { position: fixed; left: 12px; right: 12px; bottom: 16px; z-index: 50; max-width: 420px; margin: 0 auto; padding: 12px 14px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .25); text-decoration: none; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .25s, transform .25s; }
.pg-toast.pg-toast-show { opacity: 1; transform: none; pointer-events: auto; }

/* 問題の印・メモ・演習の続き（js/qmarks.js） */
.qmark-box { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--bg-soft); }
.qmark-box h3 { margin: 0 0 6px; font-size: 1rem; }
.qmark-flag[aria-pressed="true"] { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); font-weight: 700; }
.qmark-memo { display: block; width: 100%; box-sizing: border-box; min-height: 72px; margin: 6px 0; padding: 10px; font: inherit; font-size: 1rem; line-height: 1.6; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); resize: vertical; }
.qmark-memo-view { margin: 8px 0; padding: 8px 12px; border-left: 4px solid var(--warn); background: var(--warn-bg); color: var(--warn); border-radius: 4px; overflow-wrap: anywhere; }
.qmark-resume { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.qmark-resume .btn { min-height: 44px; }
.qmark-item { display: block; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow-wrap: anywhere; }
.qmark-item .btn { min-height: 44px; }

/* S3: 用語集の検索欄は横幅いっぱい・高さ44px・文字16px */
#termSearch { display: block; width: 100%; box-sizing: border-box; height: 44px; font-size: 16px; padding: 0 12px; }
.plan-item-now { color: var(--ink-soft); font-size: 1rem; }
