/* =====================================================================
   player.css — 動画 1 フレームぶんの版面。

   CSS 上は 960x540 で組み、Playwright を deviceScaleFactor: 2 で走らせて
   1920x1080 の PNG を撮る。こうすると p5 の pixelDensity も 2 になるので、
   キャンバスを引き伸ばさずに 1080p のシャープな絵が得られる。
   ===================================================================== */

:root {
  --ink: #1e293b;
  --sub: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --panel: #ffffff;
  --accent: #0ea5e9;
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
  --dark: #16233a;

  /* 版面の大きさ。縦（ショート）では body[data-orient] が上書きする */
  --fw: 960px;
  --fh: 540px;
  --head-h: 52px;
  --cap-h: 96px;

  --jp: "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  width: var(--fw); height: var(--fh);
  overflow: hidden;
  background: #000;
  font-family: var(--jp);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#frame {
  width: var(--fw); height: var(--fh);
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* ---------------- ヘッダー ---------------- */
#head {
  height: var(--head-h); flex: 0 0 var(--head-h);
  background: var(--dark); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
}
.h-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
#h-main { font-size: 15px; font-weight: 700; letter-spacing: .02em; color: #cbd5e1; white-space: nowrap; }
#h-sub  { font-size: 19px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }
.h-brand { font-size: 12px; font-weight: 700; color: #64748b; letter-spacing: .08em; white-space: nowrap; }

/* ---------------- 章ラベル（右上） ----------------
   「結論 → 解説 → まとめ」のどこにいるかを、常に右上に出す。
   途中から見た人にも流れが伝わる。色は章の役割で決める。 */
.h-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
/* 出典やドメインは画面に出さない（概要欄に書く）。空なら場所も取らない */
.h-brand:empty { display: none; }
.h-chip {
  font-weight: 800; letter-spacing: .06em; white-space: nowrap;
  padding: 4px 12px; border-radius: 999px; color: #fff;
  background: #475569; box-shadow: 0 2px 8px rgba(15, 23, 42, .35);
}
.h-chip[data-kind="結論"]  { background: linear-gradient(135deg, #f97316, #ea580c); }
.h-chip[data-kind="解説"]  { background: linear-gradient(135deg, #0ea5e9, #4f46e5); }
.h-chip[data-kind="確かめ"] { background: linear-gradient(135deg, #10b981, #059669); }
.h-chip[data-kind="まとめ"] { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.h-chip:empty { display: none; }
.h-chip { transform-origin: right center; }

/* ---------------- ステージ ---------------- */
#stage {
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: stretch; gap: 14px;
  padding: 10px;
  position: relative;
}

/* ---------------- テロップ ----------------
   画面の上に短い言葉を出す。字幕（下の帯）とは役割が違う。
   字幕＝話していることの要約、テロップ＝**目を引くための一言**。
   出す位置は 4 隅と中央。動きは player.js が時刻から計算して当てる
   （CSS のアニメーションは実時間で動くのでコマ送りの撮影では使えない）。 */
#telops { position: absolute; inset: 10px; pointer-events: none; z-index: 5; }
.tel {
  position: absolute;
  font-weight: 800; line-height: 1.25; white-space: pre-line;
  padding: 8px 16px; border-radius: 12px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .22);
  transform-origin: center;
}
.tel-pop   { background: #fde047; color: #422006; border: 3px solid #ca8a04; }
.tel-alert { background: #ef4444; color: #fff;     border: 3px solid #991b1b; }
.tel-ok    { background: #10b981; color: #fff;     border: 3px solid #047857; }
.tel-plain { background: var(--dark); color: #fff; border: 3px solid #0f172a; }

.tel-tl { top: 6px; left: 6px; }
.tel-tr { top: 6px; right: 6px; }
.tel-bl { bottom: 6px; left: 6px; }
.tel-br { bottom: 6px; right: 6px; }
.tel-c  { top: 50%; left: 50%; }

body[data-orient="landscape"] .tel { font-size: 30px; }
/* 横版のテロップは**シムの上だけ**に置く。板の上に出すと、
   その下の文字がまるごと読めなくなる（実際に見出しと 1 行目が隠れた）。
   板は文字が住んでいる場所なので、そこには何も重ねない。 */
body[data-orient="landscape"] #telops { right: auto; width: 496px; }
/* シムが上端に出している数値の行（h = 10.0 m …）を避ける */
body[data-orient="landscape"] .tel-tl,
body[data-orient="landscape"] .tel-tr { top: 58px; }
body[data-orient="portrait"]  .tel { font-size: 30px; }
/* 縦版はシムの上に重ねるので、**シムが上端に出している数値の行を避ける**。
   10px に置いていたときは「e = 0.70 / e²h = 4.90 m」の上に乗って
   どちらも読めなくなった。 */
body[data-orient="portrait"] .tel-tl,
body[data-orient="portrait"] .tel-tr { top: 74px; }
/* 下寄せのテロップは、下に重ねた説明の板に掛からないところまで上げる。
   縦版はここが定位置。上に出すと、輪の名札や高さのものさしに乗ってしまう
   （「文字を決める」が h の輪を隠した）。床のあたりはたいてい空いている。 */
/* 板の高さは枚ごとに変わるので、**板のすぐ上**に置く。
   割合で決め打ちにすると、式を積んだ枚で板に重なる（実際に重なった）。 */
body[data-orient="portrait"] .tel-bl,
body[data-orient="portrait"] .tel-br { bottom: calc(var(--boardh, 23%) + 26px); }

#simcol   { flex: 0 0 496px; display: flex; align-items: center; justify-content: center; min-width: 0; }
#boardcol { flex: 1 1 auto; min-width: 0; display: flex; }
#simwrap  { width: 496px; }

/* レイアウト別 */
body[data-layout="board"] #simcol { display: none; }
body[data-layout="sim"]  #boardcol { display: none; }
body[data-layout="sim"]  #simcol { flex: 1 1 auto; }
body[data-layout="sim"]  #simwrap { width: 720px; }

/* シムのコントロール帯は動画では押せないので出さない
   （リポジトリの素材書き出しと同じ方針） */
/* **どれが「コントロール帯」かは、first-child では当たらない。**
   解説ページのシムは帯が先頭、講義ページの 3D シムは帯が末尾にある。
   実際に入力部品を抱えている div を狙う（3D シムのキャンバスを
   まるごと消してしまい、真っ白な画面を 1 本撮ってから気づいた）。 */
#simwrap.hide-ctrl > div > div:has(input, button, select) { display: none !important; }
/* 帯を消したら、そのぶんの下余白（paddingBottom: 4rem）も要らない */
#simwrap.hide-ctrl > div { padding-bottom: 0 !important; }
#simwrap { position: relative; }
#simmask {
  position: absolute; left: 0; right: 0; top: 0;
  display: none;
  background: #fafbfd;
  border-radius: 10px 10px 0 0;
  pointer-events: none;
}
#simwrap canvas {
  display: block; margin: 0 auto;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .10);
}

/* ---------------- ボード ---------------- */
#boards { position: relative; width: 100%; }
.board {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .08);
  padding: 14px 18px 12px;
  overflow: hidden;
}
.board.on { display: flex; }

body[data-layout="board"] .board { padding: 26px 46px 22px; }

/* 横版の付箋は板の下端に貼る（右上だと板の 1 行目に乗る）。
   板が埋まると今度は**最後の行に乗る**ので、貼る分を下に空けておく。
   空ける高さは player.js が実測して --memo-room に入れる。 */
body[data-orient="landscape"] .board { padding-bottom: var(--memo-room, 12px); }

.b-kicker {
  align-self: flex-start;
  font-size: 13px; font-weight: 800; letter-spacing: .06em;
  color: #fff; background: var(--accent);
  padding: 3px 10px; border-radius: 999px;
  margin-bottom: 8px;
}
.b-head {
  font-size: 25px; font-weight: 800; line-height: 1.28;
  margin: 0 0 10px; padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
body[data-layout="board"] .b-kicker { font-size: 17px; padding: 5px 15px; margin-bottom: 14px; }
body[data-layout="board"] .b-head { font-size: 40px; margin-bottom: 18px; }

.b-body {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  /* 中身が短い枚は中央に置きたいが、段が増えて背が高くなった枚では
     中央寄せのままだと上下にはみ出して見出しに食い込む。
     safe を付けると、入りきらないときだけ上そろえに切り替わる。 */
  justify-content: center;
  justify-content: safe center;
  /* スマホで見ても読める大きさにする。1920x1080 に直すと 2 倍になるので、
     20px は出力で 40px（画面の高さの約 3.7%）。これ以下だと小さすぎる。
     大きくしたぶん、板書の文は短く切ること。 */
  font-size: 20px; line-height: 1.62;
}
body[data-layout="board"] .b-body { font-size: 27px; line-height: 1.75; }

/* 1 段ずつ出すための印。透明度は player.js が時刻から計算して当てる
   （CSS のトランジションは実時間で動くので、コマ送りの撮影では使えない） */
.b-body { padding-left: 14px; }
.b-body .step { position: relative; }
.b-body .step.now::before {
  content: ''; position: absolute;
  left: -14px; top: .15em; bottom: .15em; width: 3px;
  border-radius: 2px; background: var(--accent);
}
.b-body .step.now {
  background: rgba(14, 165, 233, .055);
  border-radius: 0 6px 6px 0;
  box-shadow: 0 0 0 6px rgba(14, 165, 233, .055);
}
/* 答え・注記・警告はもともと自分の左線と地色を持っている。
   そこへ「いま」の青い線と地色を重ねると、線が 2 本並んで濁る。
   これらは輪郭だけで「いま」を示し、自分の色は残す。 */
.b-body .ans.now::before,
.b-body .note.now::before,
.b-body .warn.now::before { display: none; }
.b-body .ans.now,
.b-body .note.now,
.b-body .warn.now { box-shadow: 0 0 0 3px rgba(14, 165, 233, .20); }
.b-body .ans.now { background: #ecfdf5; }
.b-body .note.now { background: #f8fafc; }
.b-body .warn.now { background: #fff7ed; }

.b-body p { margin: 0 0 8px; }
.b-body .lead { font-size: 34px; line-height: 1.55; }
.b-body strong { color: #0f172a; background: linear-gradient(transparent 62%, #fde68a 62%); padding: 0 1px; }

/* 数式 */
.b-body .fx { margin: 6px 0 10px; text-align: center; }
.b-body mjx-container[display="true"] { margin: 4px 0 !important; }

/* 箇条書き */
.b-body ul.pts, .b-body ol.q, .b-body ol.sum { margin: 4px 0 8px; padding-left: 1.35em; }
.b-body ul.pts { list-style: none; padding-left: 0; }
.b-body ul.pts li { margin-bottom: 11px; position: relative; padding-left: 34px; }
/* 行頭の色見本だけをぶら下げる。2 つめ以降は文中に並べる
   （全部を left:0 に置くと重なって、後ろの色しか見えなくなる） */
.b-body ul.pts li > .sw:first-child { position: absolute; left: 0; top: .62em; margin: 0; }
.b-body ul.pts li > .sw ~ .sw { position: static; margin: 0 6px 0 2px; }
.b-body ol.q li, .b-body ol.sum li { margin-bottom: 13px; }
.b-body ol.sum { counter-reset: s; list-style: none; padding-left: 0; }
.b-body ol.sum li { counter-increment: s; padding-left: 1.9em; position: relative; }
.b-body ol.sum li::before {
  content: counter(s); position: absolute; left: 0; top: .12em;
  width: 1.35em; height: 1.35em; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: .8em; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

.sw { display: inline-block; width: 20px; height: 4px; border-radius: 2px; margin-right: 7px; vertical-align: middle; }
.sw-blue { background: #3b82f6; }
.sw-red  { background: var(--red); }

/* 答え・注記 */
.b-body .ans {
  margin-top: 14px;
  background: #ecfdf5; border-left: 5px solid var(--green);
  border-radius: 0 8px 8px 0;
  padding: 9px 14px; font-weight: 700; color: #065f46;
}
.b-body .note {
  background: #f8fafc; border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0; padding: 7px 12px; color: var(--sub); font-size: .92em;
}
.b-body .warn {
  background: #fff7ed; border-left: 4px solid var(--amber);
  border-radius: 0 6px 6px 0; padding: 7px 12px; color: #9a3412; font-size: .92em;
}

/* ---------------- 字幕 ---------------- */
#cap {
  height: var(--cap-h); flex: 0 0 var(--cap-h);
  background: var(--dark); color: #f8fafc;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 34px 12px; position: relative;
}
#cap-text {
  font-size: 27px; font-weight: 700; line-height: 1.4;
  text-align: center; white-space: pre-line;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  max-height: 100%; overflow: hidden;
}
#cap-text.sm { font-size: 23px; line-height: 1.35; }
#cap-text.xs { font-size: 19px; line-height: 1.3; }
/* 字幕は数式を含められる。全シーンぶんを先に組んでおき、出すものだけ表示する */
.cap-line { font-size: inherit; line-height: inherit; }
/* 字幕の中の数式は、まわりの文字と同じ大きさ・同じ色で組む */
#cap-text mjx-container { font-size: 108% !important; color: inherit; }
#cap-text mjx-container[display="true"] { margin: 0; display: inline-block; }

body[data-captions="off"] #cap-text { visibility: hidden; }

#progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .14); }
#progress i { display: block; height: 100%; width: 0; background: var(--accent); }


/* =====================================================================
   縦版面（YouTube ショート 9:16）
   CSS 540x960 → deviceScaleFactor 2 で 1080x1920 に撮る。

   横版と違うのは「シムと板書を左右ではなく上下に積む」ことだけ。
   段階表示・シムの再生と静止・字幕・決定的な書き出しは、そのまま効く。

   スマホの小さい画面で見られるので、横版よりさらに字を大きくする。
   そのぶん載せられる情報は減る。**1本＝1テーマに絞ること。**
   ===================================================================== */
body[data-orient="portrait"] {
  --fw: 540px;
  --fh: 960px;
  --head-h: 44px;
  --cap-h: 132px;
}

body[data-orient="portrait"] #head { padding: 0 14px; }
body[data-orient="portrait"] #h-main { display: none; }
body[data-orient="portrait"] #h-sub { font-size: 21px; }
body[data-orient="portrait"] .h-brand { font-size: 11px; }

/* 上下に積む。**シムが主役、説明は下 1/3 に収める。**
   ショートはスマホで見るので、動いているものが画面の大半を占めていないと
   スクロールで飛ばされる。式は下の帯に 1 行ずつ出す（下の replace 参照）。 */
body[data-orient="portrait"] #stage { flex-direction: column; gap: 8px; padding: 10px; }
body[data-orient="portrait"] #simcol { flex: 1 1 auto; min-height: 0; }
body[data-orient="portrait"] #simwrap { width: 520px; }
/* 下 1/3（960 の約 30%）に収める。はみ出すぶんは字を詰める */
body[data-orient="portrait"] #boardcol { flex: 0 0 auto; height: 290px; }
body[data-orient="portrait"] #boards { height: 100%; }
/* 縦版では「板書だけの枚」を作らない。どの枚でもシムを出す */
body[data-orient="portrait"][data-layout="board"] #simcol { display: flex; }
body[data-orient="portrait"][data-layout="board"] #boardcol { flex: 0 0 auto; height: 290px; }
body[data-orient="portrait"][data-layout="board"] .board { padding: 12px 16px; }
body[data-orient="portrait"][data-layout="board"] .b-head { font-size: 25px; }
body[data-orient="portrait"][data-layout="board"] .b-body { font-size: 23px; }
/* 1 段ずつ入れ替えるので、中身は縦中央に置く */
body[data-orient="portrait"] .b-body { justify-content: center; }
/* 縦版は板書が下 290px しかない。見出しは上の帯にテーマが出ているので省く。
   そのぶんを式の大きさに回す。 */
body[data-orient="portrait"] .b-head { display: none; }
body[data-orient="portrait"] .b-kicker { margin-bottom: 4px; }
body[data-orient="portrait"] .board { padding: 10px 16px; }
body[data-orient="portrait"] .b-body { font-size: 26px; }
body[data-orient="portrait"][data-layout="board"] .b-body { font-size: 26px; }

/* 縦版は「シムが主役」なので、板書だけの枚を作らない。
   （ここに以前あった #simcol { display:none } は、上の display:flex を
     同じ強さで後ろから打ち消していた。シムが消える原因だった） */
body[data-orient="portrait"][data-layout="sim"] #boardcol { display: none; }

/* 字を大きく。スマホで見て読める下限を優先する */
body[data-orient="portrait"] .board { padding: 12px 16px 12px; }
body[data-orient="portrait"] .b-kicker { font-size: 14px; padding: 3px 11px; }
body[data-orient="portrait"] .b-head { font-size: 25px; margin-bottom: 8px; padding-bottom: 6px; }
body[data-orient="portrait"] .b-body { font-size: 23px; line-height: 1.55; }
body[data-orient="portrait"][data-layout="board"] .b-head { font-size: 32px; }
body[data-orient="portrait"][data-layout="board"] .b-body { font-size: 26px; }
body[data-orient="portrait"] .b-body .lead { font-size: 32px; }
body[data-orient="portrait"] #cap-text { font-size: 27px; line-height: 1.35; }
body[data-orient="portrait"] #cap-text.sm { font-size: 24px; }
body[data-orient="portrait"] #cap-text.xs { font-size: 21px; }
body[data-orient="portrait"] #cap { padding: 8px 20px 14px; }

/* =====================================================================
   縦版（ショート）の作り直し — シムを全面に敷き、説明はその上に重ねる

   前は「シムの下に板書のカード」を置いていたが、画面が上下に割れて
   どちらも中途半端になった。**シムを画面いっぱいに敷き、説明は下に
   ガラス板のように重ねる**と、シムが主役のまま説明も読める。
   ===================================================================== */
body[data-orient="portrait"] #stage { position: relative; padding: 0; gap: 0; overflow: hidden; }
/* シムが版面より大きく組まれても、見出し・字幕の帯へは出さない */
body[data-orient="portrait"] #simcol { overflow: hidden; }

/* シムは画面いっぱい */
body[data-orient="portrait"] #simcol {
  position: absolute; inset: 0;
  align-items: flex-start; justify-content: center;   /* 下は説明の板に譲る */
  padding: 6px 10px 0;
}
body[data-orient="portrait"] #simwrap { width: 520px; }
body[data-orient="portrait"] #simwrap canvas { border-radius: 16px; box-shadow: none; }

/* 説明は下に重ねる。すりガラスにして、下のシムがうっすら透ける */
/* 板の高さは**固定**にする。段ごとに伸び縮みすると、動画では板が
   ぱたぱた動いて目障りになる。高さが決まっていれば
   「はみ出したか」も測れて、字を詰められる（auto だと測れない）。 */
/* 高さは JS が枚ごとに入れる（planBoards）。ここは初期値。
   代入を積んで見せる枚は広く、結論だけの枚は狭くしてシムを大きく見せる。 */
body[data-orient="portrait"] #boardcol {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  height: 23%;
  display: block; z-index: 4;
}
/* 板の高さを #boardcol から受け継がせる。auto のままだと
   .board の height:100% が効かず、板が中身の高さに縮む */
body[data-orient="portrait"] #boards { height: 100%; min-height: 0; position: static; }
body[data-orient="portrait"] .board {
  position: static; display: none;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 20px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .08);
  padding: 12px 18px 14px;
  height: 100%; overflow: hidden; box-sizing: border-box;
}
body[data-orient="portrait"] .board.on { display: flex; flex-direction: column; }
body[data-orient="portrait"] .board { transform-origin: center bottom; }
/* 出ている 1 段を板の中央に置く */
body[data-orient="portrait"] .b-body {
  flex: 1 1 auto; min-height: 0; font-size: 27px;
  /* 段を積むので**縦に並べる**。row のままだと式が横に並んでしまう */
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
}
/* 積んだ段どうしの間。詰めすぎると式の上下が触れる */
body[data-orient="portrait"] .b-body > * { margin: 3px 0; }
/* 答えの箱は中身の幅だけにして中央に。全幅に伸ばすと、
   ほかの行が中央そろえなのにここだけ左に寄って見える */
body[data-orient="portrait"] .b-body .ans { align-self: center; }
body[data-orient="portrait"] .b-kicker {
  font-size: 18px; letter-spacing: .06em; margin-bottom: 7px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  box-shadow: 0 3px 10px rgba(14, 165, 233, .35);
}
body[data-orient="portrait"] .b-body .fx { margin: 2px 0; }
body[data-orient="portrait"] .b-body .step.now {
  background: none; box-shadow: none;
}
body[data-orient="portrait"] .b-body .step.now::before { display: none; }
body[data-orient="portrait"] .b-body .ans {
  margin: 0; background: linear-gradient(135deg, rgba(16,185,129,.14), rgba(16,185,129,.06));
  border-left: 5px solid var(--green); border-radius: 0 12px 12px 0; padding: 8px 14px;
}
body[data-orient="portrait"] .b-body .note {
  margin: 0; background: rgba(248, 250, 252, .8);
  border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0; padding: 8px 14px;
}

/* タイトルを大きく。ショートは一覧で 1 行しか読まれないので、ここが効く */
body[data-orient="portrait"] #head {
  background: linear-gradient(120deg, #16233a 0%, #1e3a5f 100%);
  height: 62px; flex: 0 0 62px;
}
body[data-orient="portrait"] #h-sub { font-size: 26px; letter-spacing: .01em; }
body[data-orient="portrait"] .h-brand { font-size: 10px; opacity: .5; }
body[data-orient="portrait"] .h-chip { font-size: 24px; padding: 4px 16px; }
body[data-orient="landscape"] .h-chip { font-size: 15px; }

/* 字幕も少し magazine 寄りに */
body[data-orient="portrait"] #cap {
  background: linear-gradient(0deg, #0d1729 0%, #16233a 100%);
}

/* ---------------- お決まりのイントロ ----------------
   **現象を先に見せてから**ブランドの札を出す。
   いきなり札から始めると、見る側には「何の動画か」より先に「広告」に見える。
   0 秒から数秒はシムを動かしておき、その上にすっと重ねる。 */
#intro {
  /* 画面いっぱい（見出しの帯も覆う）。イントロだけは全面にして、
     「何のチャンネルか」を 1 秒で分からせる */
  position: fixed; inset: 0; z-index: 20;
  display: none; align-items: center; justify-content: center;
  background: linear-gradient(160deg, rgba(9, 16, 31, .93), rgba(23, 37, 70, .93));
  pointer-events: none;
}
#intro .in-card { text-align: center; color: #fff; padding: 0 22px; }
#intro .in-brand {
  font-weight: 900; letter-spacing: .16em;
  background: linear-gradient(120deg, #38bdf8, #818cf8 55%, #f472b6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* 冒頭の札は**問い**を出す。ブランド名だけだと広告に見えて飛ばされる */
#intro .in-topic { font-weight: 800; margin-top: 6px; white-space: pre-line; line-height: 1.35; }
#intro .in-hook {
  display: inline-block; margin-top: 14px; font-weight: 900;
  padding: 7px 20px; border-radius: 999px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  box-shadow: 0 8px 26px rgba(249, 115, 22, .45);
}
body[data-orient="portrait"] #intro .in-brand { font-size: 62px; }
body[data-orient="portrait"] #intro .in-topic { font-size: 30px; }
body[data-orient="portrait"] #intro .in-hook { font-size: 30px; }
body[data-orient="landscape"] #intro .in-brand { font-size: 64px; }
body[data-orient="landscape"] #intro .in-topic { font-size: 32px; }
body[data-orient="landscape"] #intro .in-hook { font-size: 30px; }

/* 進み具合のバーに、章の切れ目を刻む。あと何章かが分かると最後まで見やすい */
#progress b {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: rgba(255, 255, 255, .45);
}

/* ---------------- 場面転換のカード ----------------
   導入 → 説明 → まとめ の切れ目で、章の名前を大きく出す。
   長い動画でも「いまどこか」が分かる。 */
#section {
  position: absolute; inset: 0; z-index: 8;
  display: none; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(14, 165, 233, .96), rgba(99, 102, 241, .96));
  pointer-events: none;
}
#section .sec-in {
  text-align: center; color: #fff;
  padding: 18px 34px;
  border-radius: 18px;
  border: 3px solid rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .10);
  box-shadow: 0 18px 50px rgba(15, 23, 42, .3);
}
#section .sec-t { font-size: 46px; font-weight: 800; letter-spacing: .02em; white-space: pre-line; }
body[data-orient="portrait"] #section .sec-t { font-size: 40px; }
