/* こそだてくらべ まなび — 方眼ノートと積み木
   トークンの正本は manabi/DESIGN.md。色・角丸・影はここの :root だけで定義する。
   たて・よこ・高さの3色は Okabe–Ito の色覚配慮パレットから選び、3D の軸・式・ラベルで同じ意味に使う。 */
:root {
  --paper: #FBF8F1;
  --panel: #FFFFFF;
  --ink: #1D2433;
  --ink-soft: #596172;
  --grid: #E3DDCC;
  --tate: #0072B2;
  --yoko: #D55E00;
  --takasa: #009E73;
  --wood: #E9C68D;
  --wood-light: #F3DDB4;
  --wood-dark: #DDB271;
  --wood-edge: #A87A3F;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-pill: 999px;
  /* 影は「積み木の底」: ぼかさず真下へずらした墨の面だけ */
  --lift: 0 5px 0 var(--ink);
  --lift-hover: 0 7px 0 var(--ink);
  --lift-press: 0 1px 0 var(--ink);
  --t: 160ms cubic-bezier(.3, .7, .4, 1);

  --font-head: "Zen Maru Gothic", "BIZ UDPGothic", sans-serif;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body.m-body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(color-mix(in srgb, var(--grid) 55%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--grid) 55%, transparent) 1px, transparent 1px);
  background-size: 24px 24px;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.85;
  word-break: auto-phrase;
  font-variant-numeric: tabular-nums;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--tate); text-underline-offset: .2em; text-decoration-thickness: 1.5px; transition: color var(--t); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--tate); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 900; line-height: 1.3; margin: 0; text-wrap: balance; }
p { margin: 0; }

.m-wrap { width: min(1180px, 100%); margin-inline: auto; padding-inline: 20px; }
.m-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.m-skip { position: absolute; left: 12px; top: -60px; z-index: 10; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: var(--radius-s); transition: top var(--t); }
.m-skip:focus-visible { top: 12px; }

/* ヘッダ */
.m-header { background: var(--paper); border-bottom: 2px solid var(--ink); }
.m-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; flex-wrap: wrap; }
.m-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; border-radius: var(--radius-s); }
.m-brand__mark { width: 40px; height: 40px; transition: transform var(--t); }
.m-brand:hover .m-brand__mark { transform: translateY(-2px) rotate(-4deg); }
.m-brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.m-brand__site { font-size: 12px; color: var(--ink-soft); letter-spacing: .06em; }
.m-brand__name { font-family: var(--font-head); font-weight: 900; font-size: 26px; letter-spacing: .08em; }
.m-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.m-nav__link { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; padding: 8px 14px; border-radius: var(--radius-pill); transition: background-color var(--t), color var(--t); }
.m-nav__link:hover { background: var(--wood-light); color: var(--ink); }
.m-nav__link--out { color: var(--ink-soft); font-weight: 400; }

/* パンくず */
.m-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 0; padding: 20px 0 0; margin: 0; font-size: 14px; color: var(--ink-soft); }
.m-crumbs li + li::before { content: "›"; margin: 0 10px; color: var(--ink-soft); }
.m-crumbs a { color: var(--ink-soft); }
.m-crumbs a:hover { color: var(--ink); }

/* 単元の表紙 */
.m-hero { padding: 28px 0 104px; }
.m-hero__grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 48px; align-items: start; }
.m-hero__text { padding-top: 24px; }
.m-chip { display: inline-flex; border: 2px solid var(--ink); border-radius: var(--radius-pill); overflow: hidden; font-weight: 700; font-size: 14px; line-height: 1; }
.m-chip span { padding: 8px 12px; }
.m-chip__grade { background: var(--ink); color: var(--paper); }
.m-chip__subject { background: var(--wood); }
.m-hero__title { font-size: clamp(56px, 7vw, 88px); letter-spacing: .04em; margin-top: 24px; }
.m-hero__sub { display: block; font-size: clamp(20px, 2vw, 24px); letter-spacing: .08em; margin-top: 8px; color: var(--ink-soft); font-weight: 700; }
.m-hero__lead { margin-top: 24px; font-size: 19px; line-height: 1.8; }
.m-facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 0 28px; margin: 36px 0 0; }
.m-facts div { border-top: 2px solid var(--ink); padding-top: 10px; }
.m-facts dt { font-size: 13px; color: var(--ink-soft); }
.m-facts dd { margin: 2px 0 0; font-weight: 700; font-size: 17px; }
.m-facts small { font-weight: 400; font-size: 13px; color: var(--ink-soft); }

/* 再生画面（16:9）。文字は画面幅に比例（cqw）させ、動画書き出しと同じ見た目にする */
.m-screen {
  position: relative;
  aspect-ratio: 16 / 9;
  container-type: inline-size;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-m);
  background: var(--paper);
  box-shadow: var(--lift);
  overflow: hidden;
}
.m-stage { position: relative; }
.m-screen .m-stage { position: absolute; inset: 0; }
.m-stage canvas { width: 100%; height: 100%; touch-action: none; }
.m-stage__overlay { position: absolute; inset: 0; pointer-events: none; font-family: var(--font-head); }
.m-stage__overlay [hidden] { display: none !important; }
.m-screen__chapter {
  position: absolute; left: 2.4cqw; top: 2.2cqw;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-head); font-weight: 700; font-size: 1.9cqw; line-height: 1;
  padding: 1cqw 1.6cqw; border-radius: var(--radius-pill);
}
.m-screen__chapter:empty { display: none; }
.m-screen__caption {
  position: absolute; left: 4cqw; right: 4cqw; bottom: 2.6cqw;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 2px solid var(--ink); border-radius: 1.4cqw;
  padding: 1.2cqw 2.4cqw;
  font-family: var(--font-head); font-weight: 700; font-size: 2.9cqw; line-height: 1.45;
  text-align: center; text-wrap: balance;
  /* 字幕は文節ごとに空白を入れて書くので、空白と句読点でだけ折り返す（長すぎる語だけは途中で折る） */
  word-break: keep-all; overflow-wrap: anywhere;
}
.m-screen__caption:empty { display: none; }

.stage-tag { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: .5em; white-space: nowrap; font-size: 2.4cqw; }
.stage-tag__name {
  /* 1〜2字は丸、3字以上は横に伸びる小判形（「あまり」などが欠けない） */
  display: grid; place-items: center; min-width: 2.1em; height: 2.1em; padding: 0 .5em; box-sizing: border-box; border-radius: 1.05em;
  background: var(--ink); color: var(--paper); font-weight: 900; font-size: 1.15em; line-height: 1;
}
.stage-tag__count, .stage-tag__value {
  background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius-pill);
  padding: .25em .8em; font-weight: 900; font-size: 1.2em; line-height: 1.2; font-variant-numeric: tabular-nums;
}
.stage-tag small { font-size: .7em; margin-left: .15em; }
.stage-tag__value.is-bigger { background: var(--wood); box-shadow: 0 .18em 0 var(--ink); }
.stage-tag--unit { font-size: 3.2cqw; }
.stage-dim {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border-radius: var(--radius-pill); padding: .2em .7em;
  font-size: 2.2cqw; font-weight: 700; line-height: 1.3; color: var(--ink);
}
.stage-dim b { font-weight: 900; margin-right: .2em; }
.stage-dim--tate b { color: var(--tate); }
.stage-dim--yoko b { color: var(--yoko); }
.stage-dim--takasa b { color: var(--takasa); }
.stage-dim--plain b { color: var(--ink-soft); }
.stage-dim--return { background: var(--panel); border: 2px solid var(--ink); font-size: 1.8cqw; }
.stage-dim--prop { font-size: 1.9cqw; transform: translate(-50%, -100%); white-space: pre-line; text-align: center; line-height: 1.25; }
/* 文字のタイル（メールアドレスの部分） */
.stage-tile {
  /* 2行に折ったタイルは改行（\n）で行を分ける */
  position: absolute; transform: translate(-50%, -50%); white-space: pre; text-align: center;
  font-family: var(--font-body); font-weight: 700; font-size: calc(3.2cqw * var(--tile-scale, 1)); line-height: 1.25; color: var(--ink);
  letter-spacing: .02em;
}
.stage-tile--at { font-size: calc(3.8cqw * var(--tile-scale, 1)); }
.stage-slot {
  position: absolute; transform: translate(-50%, -100%); white-space: nowrap;
  background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius-pill);
  padding: .15em .6em; font-family: var(--font-body); font-weight: 700; font-size: 1.6cqw; line-height: 1.2;
}
.stage-slot.is-hit { background: var(--wood); }
/* 「a/b」だけのタイルは縦書きの分数（分子が上、横線、分母が下） */
.stage-frac { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stage-frac__num { padding: 0 .2em .06em; border-bottom: .09em solid currentColor; }
.stage-frac__den { padding: .06em .2em 0; }
/* 多角形の頂点の記号（ア・イ・ウ）。強調した頂点は青 */
.stage-vertex {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font-family: var(--font-head); font-weight: 900; font-size: 2.3cqw; line-height: 1; color: var(--ink);
}
.stage-vertex.is-hit { color: var(--tate); }
/* 強調した辺・頂点の名札（「辺」「頂点」） */
.stage-dim--mark { background: var(--panel); border: 2px solid var(--yoko); }
/* 時計の文字盤の数字 */
.stage-clocknum {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font-family: var(--font-body); font-weight: 700; font-size: 1.7cqw; line-height: 1; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
/* 筆算。方眼ノートに書いたように、位ごとの列にそろえる。強調した位の列は木の色の帯、くり上がりは小さく */
.stage-hissan {
  position: absolute; transform: translate(-50%, -50%);
  background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius-s);
  padding: .15em .45em .25em;
  font-family: var(--font-body); font-weight: 700; font-size: calc(5cqw * var(--hs-scale, 1)); line-height: 1.15; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hs { display: grid; align-items: end; }
.hs-c { text-align: center; }
.hs-c.is-col { background: var(--wood-light); }
.hs-op { color: var(--ink-soft); }
.hs-small { font-size: .5em; line-height: 1.3; color: var(--yoko); font-weight: 900; }
.hs-line { grid-column: 1 / -1; height: 0; border-top: .08em solid var(--ink); margin: .06em 0 .1em; }
.hs-answer { color: var(--tate); }
.hs-c.is-struck { text-decoration: line-through; text-decoration-thickness: .08em; text-decoration-color: var(--yoko); }
.hs .is-hidden { visibility: hidden; }
.stage-stamp {
  position: absolute; transform: translate(-50%, -50%) rotate(-4deg); white-space: nowrap;
  background: var(--wood-light); border: 3px solid var(--ink); color: var(--ink); border-radius: .6cqw;
  padding: .35em .8em; font-weight: 900; font-size: 2.3cqw; line-height: 1.2;
}
.formula__result--note { font-size: .55em; line-height: 1.5; font-weight: 700; }
.m-textfield { display: grid; gap: 8px; }
.m-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.m-chip-btn { font-size: 18px; padding: 9px 16px; background: var(--wood-light); }
.m-chip-btn:hover { background: var(--wood); }
.m-textfield__name { font-family: var(--font-head); font-weight: 900; font-size: 17px; }
.m-textfield input {
  font: inherit; font-size: 20px; font-weight: 700; padding: 12px 14px; color: var(--ink);
  border: 2px solid var(--ink); border-radius: var(--radius-s); background: var(--paper);
  transition: box-shadow var(--t), background-color var(--t);
}
.m-textfield input:hover { background: var(--panel); }
.m-textfield input:focus-visible { outline: 3px solid var(--tate); outline-offset: 2px; background: var(--panel); }
.m-textfield__note { font-size: 13px; color: var(--ink-soft); }
.stage-timer {
  position: absolute; transform: translate(-50%, -50%); display: flex; gap: .9em; white-space: nowrap;
  background: var(--panel); border: 2px solid var(--ink); border-radius: 1.2cqw; padding: .5em .9em;
  font-size: 2.6cqw; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums;
}
.stage-timer span { display: inline-flex; flex-direction: column; align-items: flex-end; min-width: 2.6em; }
.stage-timer small { font-size: .5em; color: var(--ink-soft); font-weight: 700; }
.stage-timer span small:last-child { align-self: auto; }

/* 式。たて・よこ・高さは下線の色でも区別する */
.m-formula { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .1em .45em; font-family: var(--font-head); font-weight: 900; line-height: 1; }
.m-formula--stage {
  position: absolute; right: 2.4cqw; top: 2.2cqw; font-size: 3.4cqw;
  background: var(--panel); border: 2px solid var(--ink); border-radius: 1.4cqw; padding: 1.1cqw 1.8cqw 1.4cqw;
}
.m-formula[hidden] { display: none; }
.formula__title { flex-basis: 100%; font-size: .5em; color: var(--ink-soft); margin-bottom: .5em; font-weight: 700; }
.formula__term { display: inline-flex; flex-direction: column; align-items: center; gap: .25em; padding-bottom: .2em; border-bottom: .14em solid currentColor; min-width: 1.4em; }
.formula__term small { font-size: .42em; font-weight: 700; }
.formula__term--tate { color: var(--tate); }
.formula__term--yoko { color: var(--yoko); }
.formula__term--takasa { color: var(--takasa); }
.formula__op { color: var(--ink-soft); padding-bottom: .3em; }
.formula__result { padding-bottom: .2em; }
.formula__result small { font-size: .55em; margin-left: .1em; }

/* 再生の操作 */
.m-controls { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.m-play {
  flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  border: 2.5px solid var(--ink); background: var(--wood); color: var(--ink); cursor: pointer;
  box-shadow: 0 4px 0 var(--ink); transition: transform var(--t), box-shadow var(--t), background-color var(--t);
}
.m-play:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); background: var(--wood-light); }
.m-play:active { transform: translateY(3px); box-shadow: var(--lift-press); }
.m-play__icon--pause, [data-playing="1"] .m-play__icon--play { display: none; }
[data-playing="1"] .m-play__icon--pause { display: block; }
.m-seek { flex: 1; display: flex; }
.m-time { flex: none; font-weight: 700; font-size: 15px; min-width: 7.5em; text-align: right; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0;
  --fill: var(--ink);
}
input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: var(--radius-pill); border: 2px solid var(--ink); background: linear-gradient(90deg, var(--fill) calc(var(--p, 0) * 100%), var(--panel) 0); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: var(--radius-pill); border: 2px solid var(--ink); background: var(--panel); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: var(--radius-pill); background: var(--fill); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: var(--wood); border: 2.5px solid var(--ink); transition: transform var(--t);
}
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--wood); border: 2.5px solid var(--ink); transition: transform var(--t); }
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]:hover::-moz-range-thumb { transform: scale(1.15); }
input[type="range"]:focus-visible { outline: 3px solid var(--tate); outline-offset: 4px; }
.m-seek input { --p: var(--progress, 0); }

.m-chapters { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.m-chapters a {
  display: flex; align-items: center; gap: 8px; height: 100%;
  padding: 8px 10px; border: 2px solid var(--ink); border-radius: var(--radius-s); background: var(--panel);
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 700; line-height: 1.35;
  transition: background-color var(--t), transform var(--t);
}
.m-chapters a:hover { background: var(--wood-light); transform: translateY(-1px); }
.m-chapters__no { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 12px; }
.m-chapters__time { margin-left: auto; font-weight: 400; color: var(--ink-soft); font-size: 12px; }
.m-player__file { margin-top: 14px; font-size: 14px; }

/* 節 */
.m-section { padding: 0 0 112px; }
.m-section__head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 32px; }
.m-section__icon { flex: none; width: 48px; height: 48px; padding: 4px; border: 2px solid var(--ink); border-radius: var(--radius-s); background: var(--panel); }
.m-section__title { font-size: clamp(28px, 3.2vw, 38px); }
.m-section__lead { margin-top: 8px; color: var(--ink-soft); }

/* さわって考える */
.m-lab { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 0; border: 2.5px solid var(--ink); border-radius: var(--radius-m); background: var(--panel); box-shadow: var(--lift); overflow: hidden; }
.m-lab__stage { aspect-ratio: 4 / 3; container-type: inline-size; border-right: 2.5px solid var(--ink); background: var(--paper); cursor: grab; }
.m-lab__stage:active { cursor: grabbing; }
.m-lab__stage .m-stage__overlay { font-size: 1.3cqw; }
.m-lab__stage .stage-dim { font-size: 3.2cqw; }
.m-lab__panel { padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; }
.m-slider { display: grid; grid-template-columns: 4.2em 1fr 3.6em; align-items: center; gap: 12px; }
.m-slider__name { font-family: var(--font-head); font-weight: 900; font-size: 17px; }
.m-slider__value { font-weight: 700; text-align: right; font-size: 18px; }
.m-slider--tate .m-slider__name { color: var(--tate); }
.m-slider--yoko .m-slider__name { color: var(--yoko); }
.m-slider--takasa .m-slider__name { color: var(--takasa); }
.m-slider--tate input { --fill: var(--tate); }
.m-slider--yoko input { --fill: var(--yoko); }
.m-slider--takasa input { --fill: var(--takasa); }
.m-slider--plain .m-slider__name { color: var(--ink); }
.m-formula--lab { font-size: 34px; margin-top: 18px; padding-top: 22px; border-top: 2px dashed var(--grid); }
.m-lab__layers { font-size: 15px; color: var(--ink-soft); line-height: 1.7; }
.m-lab__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: auto; padding-top: 12px; }

.m-btn {
  font: inherit; font-weight: 700; font-size: 16px; color: var(--ink); cursor: pointer;
  padding: 11px 20px; border: 2px solid var(--ink); border-radius: var(--radius-s); background: var(--panel);
  box-shadow: 0 4px 0 var(--ink); transition: transform var(--t), box-shadow var(--t), background-color var(--t);
}
.m-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.m-btn:active { transform: translateY(3px); box-shadow: var(--lift-press); }
.m-btn--primary { background: var(--wood); }
.m-btn--primary:hover { background: var(--wood-light); }

/* やってみよう */
.m-try { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.m-try__item { background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius-m); padding: 28px; box-shadow: var(--lift); display: flex; flex-direction: column; gap: 12px; }
.m-try__q { font-family: var(--font-head); font-weight: 700; font-size: 20px; line-height: 1.6; display: flex; gap: 12px; margin-bottom: 8px; }
.m-try__no { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 16px; margin-top: 1px; }
.m-reveal { border-top: 2px dashed var(--grid); padding-top: 10px; }
.m-reveal summary {
  cursor: pointer; font-weight: 700; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 8px; border-radius: var(--radius-pill); transition: background-color var(--t);
}
.m-reveal summary::-webkit-details-marker { display: none; }
.m-reveal summary::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); background: linear-gradient(var(--ink), var(--ink)) center / 8px 2px no-repeat, linear-gradient(var(--ink), var(--ink)) center / 2px 8px no-repeat; transition: transform var(--t); }
.m-reveal[open] summary::before { background: linear-gradient(var(--ink), var(--ink)) center / 8px 2px no-repeat; }
.m-reveal summary:hover { background: var(--wood-light); }
.m-reveal p { margin-top: 8px; }
.m-reveal--answer summary { color: var(--yoko); }
.m-reveal--answer summary::before { border-color: var(--yoko); }
.m-try__a { font-family: var(--font-head); font-weight: 900; font-size: 22px; }

/* ことば */
.m-words { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; }
.m-words__item { background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius-m); padding: 20px 20px 18px; }
.m-words dt { font-family: var(--font-head); font-weight: 900; font-size: 26px; }
.m-words rt { font-size: 11px; font-weight: 700; color: var(--ink-soft); letter-spacing: .08em; }
.m-words dd { margin: 10px 0 0; font-size: 15px; line-height: 1.7; }

/* おうちの方へ */
.m-parents { padding-top: 72px; border-top: 2px solid var(--ink); background: var(--panel); }
.m-parents__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px; }
.m-parents__title { font-size: 26px; }
.m-parents__list { margin: 20px 0 0; padding-left: 1.2em; display: grid; gap: 12px; }
.m-note { font-size: 14px; line-height: 1.75; color: var(--ink-soft); border: 2px solid var(--grid); border-radius: var(--radius-m); padding: 22px 24px; display: grid; gap: 10px; align-content: start; }
.m-note__title { font-size: 16px; color: var(--ink); }
.m-note ul { margin: 0; padding-left: 1.2em; }

/* 一覧 */
.m-index-hero { padding: 72px 0 96px; }
.m-index-hero__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px; align-items: center; }
.m-index-hero__title { font-size: clamp(40px, 5.6vw, 72px); letter-spacing: .03em; }
.m-index-hero__lead { margin-top: 28px; font-size: 19px; max-width: 34em; }
.m-index-hero__art { width: 100%; height: auto; max-width: 380px; justify-self: center; }
.m-art-label { font-family: var(--font-head); font-weight: 900; font-size: 13px; }
.m-grade { scroll-margin-top: 24px; }
.m-grade__title { font-size: clamp(30px, 3.4vw, 40px); padding-bottom: 14px; border-bottom: 2.5px solid var(--ink); margin-bottom: 28px; }
.m-grade__subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.m-subject { scroll-margin-top: 24px; }
.m-subject__title { font-size: 20px; margin-bottom: 12px; }
.m-subject__empty { color: var(--ink-soft); font-size: 14px; border: 2px dashed var(--grid); border-radius: var(--radius-m); padding: 18px; background: color-mix(in srgb, var(--panel) 60%, transparent); }
.m-units { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.m-unit-card {
  display: grid; gap: 6px; padding: 18px 18px 16px; color: var(--ink); text-decoration: none;
  background: var(--panel); border: 2px solid var(--ink); border-radius: var(--radius-m); box-shadow: 0 4px 0 var(--ink);
  transition: transform var(--t), box-shadow var(--t), background-color var(--t);
}
.m-unit-card:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); background: #FFFDF7; color: var(--ink); }
.m-unit-card__title { font-family: var(--font-head); font-weight: 900; font-size: 22px; }
.m-unit-card__title small { font-size: 13px; margin-left: 8px; color: var(--ink-soft); font-weight: 700; }
.m-unit-card__lead { font-size: 14px; line-height: 1.6; }
.m-unit-card__meta { font-size: 12px; color: var(--ink-soft); }

/* フッタ */
.m-footer { border-top: 2px solid var(--ink); background: var(--paper); padding: 40px 0 56px; }
.m-footer__inner { display: grid; gap: 10px; font-size: 14px; }
.m-footer__brand { font-family: var(--font-head); font-weight: 900; font-size: 18px; }
.m-footer__note { color: var(--ink-soft); }
.m-footer__links { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; margin: 6px 0 0; }
.m-footer__links a { color: var(--ink); }

@media (max-width: 960px) {
  .m-hero__grid, .m-lab, .m-parents__grid, .m-index-hero__grid { grid-template-columns: minmax(0, 1fr); }
  .m-hero__grid { gap: 28px; }
  .m-hero__text { padding-top: 8px; }
  .m-lab__stage { border-right: 0; border-bottom: 2.5px solid var(--ink); }
  .m-chapters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-words { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-index-hero__art { max-width: 280px; }
}
@media (max-width: 640px) {
  body.m-body { font-size: 16px; }
  .m-header__inner { padding-block: 10px; }
  .m-nav__link { padding: 6px 10px; font-size: 14px; }
  .m-hero { padding-bottom: 72px; }
  .m-hero__title { margin-top: 16px; }
  .m-facts { gap: 0 16px; }
  .m-try { grid-template-columns: minmax(0, 1fr); }
  .m-words { grid-template-columns: minmax(0, 1fr); }
  .m-lab__panel { padding: 24px 18px; }
  .m-formula--lab { font-size: 28px; }
  .m-section { padding-bottom: 80px; }
  .m-try__item { padding: 22px 20px; }
  .m-time { min-width: 0; font-size: 13px; }
  /* 小さい画面では字幕を画面の下へ出し、文字を大きく保つ（動画書き出しは画面内のまま） */
  html:not([data-render]) .m-screen { aspect-ratio: auto; display: flex; flex-direction: column; }
  html:not([data-render]) .m-screen .m-stage { position: relative; inset: auto; aspect-ratio: 16 / 9; }
  html:not([data-render]) .m-screen__caption {
    position: static; border: 0; border-top: 2px solid var(--ink); border-radius: 0;
    font-size: 17px; padding: 12px 16px; min-height: calc(2 * 1.45em + 24px); display: grid; place-items: center;
  }
  .m-screen__chapter { font-size: 3cqw; }
  .m-formula--stage { font-size: 4.4cqw; }
  .stage-tag { font-size: 3.4cqw; }
  .stage-dim { font-size: 3.2cqw; }
  /* 表紙: 題名のすぐ下に再生画面を置き、説明と数字はそのあと */
  .m-hero__text { display: contents; }
  .m-hero__grid { gap: 0; }
  .m-hero .m-chip { order: 1; justify-self: start; }
  .m-hero__title { order: 2; font-size: 48px; margin-top: 12px; }
  .m-player { order: 3; margin-top: 20px; }
  .m-hero__lead { order: 4; margin-top: 28px; font-size: 17px; }
  .m-facts { order: 5; margin-top: 24px; }
  .m-nav__link--out { display: none; }
  .m-brand__name { font-size: 22px; }
  .m-header__inner { min-height: 64px; }
}

/* 動画書き出し: 再生画面だけを 1280×720 で出す */
html[data-render] body { background: var(--paper); }
html[data-render] body > *:not(main), html[data-render] main > *:not(.m-hero), html[data-render] .m-hero__text,
html[data-render] .m-controls, html[data-render] .m-chapters, html[data-render] .m-crumbs, html[data-render] .m-player__file { display: none !important; }
html[data-render] .m-screen { position: fixed; left: 0; top: 0; width: 1280px; height: 720px; border: 0; border-radius: 0; box-shadow: none; }

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