
:root {
  --bg: #ffffff; --panel: #f4f8fb; --line: #d9e4ec; --ink: #0d2b45; --body: #2c4257; --dim: #56697c; --faint: #8a9bab;
  --a: #0e9474; --b: #2456c9; --c: #0a84c6; --sum: #0d2b45; --warn: #7c4dcc;
  --A: #13894a; --B: #2456c9; --C: #8a5cd6; --X: #a3339c; --jp: #a3339c;
  --popbg: #ffffff; --popline: #cfdce6; --soft: #eef5fb; --mint: #e9f7f2; --shadow: 0 8px 28px rgba(16, 58, 104, .08);
  --jpf: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  --num: "SF Mono", "Menlo", ui-monospace, monospace;
  --math: "Times New Roman", "STIX Two Math", serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--jpf); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--a); outline-offset: 2px; border-radius: 4px; }

/* 左上の小さな行き先（表紙より下では消える） */
#nav { position: fixed; left: 22px; top: 18px; z-index: 30; display: flex; gap: 8px; transition: opacity .35s ease; }
#nav a { text-decoration: none; font: 12px/1 var(--jpf); color: var(--dim); letter-spacing: .03em; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.85); backdrop-filter: blur(6px); }
#nav a:hover { color: var(--ink); border-color: var(--dim); }
body.past-cover #nav { opacity: 0; pointer-events: none; }
/* 右はしの目盛り：いまどの見開きか */
#rail { position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 20; display: grid; gap: 7px; opacity: 0; transition: opacity .4s; }
body.past-cover #rail { opacity: 1; }
#rail a { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
#rail a.on { background: var(--a); }
#rail a:hover { background: var(--dim); }

/* 表紙 */
.cover { position: relative; min-height: 100vh; padding: 9vh 6vw 6vh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; scroll-snap-align: start;
  background: linear-gradient(160deg, #eaf3ff 0%, #ffffff 42%, #e8f8f1 100%); }
.cover .brand { font: 500 11px/1 var(--num); letter-spacing: .18em; color: var(--dim); }
.cover h1 { align-self: end; margin: 6vh 0 0; font-weight: 600; font-size: clamp(52px, 9.5vw, 150px); line-height: 1.04; letter-spacing: .02em; }
.cover h1 { color: var(--b); }
.cover h1 em { font-style: normal; color: var(--a); }
.cover .sub { margin: 18px 0 0; font-size: clamp(16px, 1.7vw, 26px); font-weight: 600; letter-spacing: .04em; }
.cover .feat { margin: 18px 0 0; display: inline-block; padding: 10px 16px; border-radius: 12px; background: #fff; border: 1px solid #cfe3f3; box-shadow: var(--shadow); font-size: clamp(14px, 1.25vw, 18px); font-weight: 600; color: var(--ink); line-height: 1.7; max-width: 100%; }
.cover .feat strong { color: var(--a); font-size: 1.15em; }
.cover .lead { margin: 16px 0 0; color: var(--dim); font-size: clamp(14px, 1.2vw, 16px); line-height: 1.9; max-width: 100%; }
.cover .art { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 8%, rgba(0,0,0,.35) 38%, #000 70%); mask-image: linear-gradient(90deg, transparent 8%, rgba(0,0,0,.35) 38%, #000 70%); }
.cover .art canvas { width: 100%; height: 100%; display: block; opacity: .9; }
.cover > *:not(.art) { position: relative; z-index: 1; }
.toc { margin-top: 5vh; display: grid; grid-template-columns: repeat(var(--cols, 7), minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.toc a { background: rgba(255,255,255,.92); padding: 14px 8px 16px 11px; text-decoration: none; display: block; transition: background .2s; min-width: 0; }
.toc a:hover { background: var(--mint); }
.toc b { display: block; font: 600 11px/1 var(--num); color: var(--a); margin-bottom: 10px; }
.toc span { font-size: 13px; font-weight: 700; display: block; line-height: 1.45; color: var(--ink); }

.toc span, .toc i, .pager a { word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
.toc i { display: block; font-style: normal; font-size: 11px; color: var(--dim); margin-top: 6px; line-height: 1.5; }

/* 見開き */
.spread { min-height: 100vh; padding: 4.5vh 5vw; display: grid; grid-template-columns: minmax(320px, 5.4fr) 6.6fr; gap: 2.6vw; align-items: center;
  border-top: 1px solid var(--line); scroll-snap-align: start; position: relative; }
.read { position: relative; min-width: 0; }
.side { position: relative; display: grid; gap: 12px; align-content: center; min-width: 0; }
/* 右側：1 つの枠（stage）の上の帯に「さわってみる ｜ Python のコード」の切りかえ。下に図か、コード */
.stage { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: var(--shadow); min-width: 0; }
.stagebar { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, #eef5ff, #ecf8f3); }
.viewtabs { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(255,255,255,.7); border: 1px solid var(--line); }
.viewtabs .vt { font: 600 12.5px/1 var(--jpf); color: var(--dim); background: transparent; border: 0; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.viewtabs .vt[aria-selected="true"] { background: var(--b); color: #fff; box-shadow: 0 1px 4px rgba(36,86,201,.3); }
.viewtabs .vt[data-view="py"][aria-selected="true"] { background: var(--a); box-shadow: 0 1px 4px rgba(14,148,116,.3); }
.stagebar .hint { margin-left: auto; font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage > .look { border: 0; border-radius: 0; box-shadow: none; }
.look[hidden] { display: none; }
.side .myth { margin-top: 0; font-size: 13px; line-height: 1.8; padding: 10px 14px; }
.read .no { font: 700 12px/1 var(--num); letter-spacing: .14em; color: #fff; background: var(--a); padding: 4px 8px; border-radius: 999px; }
.read .field { font: 600 11px/1 var(--num); letter-spacing: .1em; color: var(--b); margin-left: 10px; }
.read h2 { margin: 18px 0 0; font-size: clamp(26px, 2.6vw, 38px); font-weight: 700; line-height: 1.35; color: var(--b); }
.read .q { margin: 10px 0 0; color: var(--a); font-size: 15px; line-height: 1.8; font-weight: 600; }
.read p { font-size: 15px; line-height: 1.85; color: var(--body); margin: 12px 0 0; line-break: strict; word-break: auto-phrase; }
.read p strong { color: var(--ink); font-weight: 600; }
.read code { font: 13px var(--num); color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.eq { margin-top: 16px; padding: 12px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.eq .f { font-family: var(--math); font-size: clamp(18px, 1.45vw, 23px); letter-spacing: .01em; line-height: 1.6; overflow-x: auto; }
.eq .f .a { color: var(--a); } .eq .f .b { color: var(--b); }
.eq dl { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; color: var(--dim); line-break: strict; word-break: auto-phrase; }
.eq dt { font-family: var(--math); color: var(--ink); font-size: 16px; }
.eq dd { margin: 0; }
.note { margin-top: 14px; font-size: 13px; color: var(--dim); line-height: 1.8; border-left: 2px solid var(--a); padding-left: 14px; line-break: strict; word-break: auto-phrase; }
.myth { margin-top: 18px; font-size: 13.5px; line-height: 1.85; color: var(--body); background: #f5f2ff; border: 1px solid #ddd3f7; border-radius: 12px; padding: 12px 16px; }
.myth .lab { display: block; font: 600 11px/1 var(--num); letter-spacing: .12em; color: var(--warn); margin-bottom: 8px; }
.myth b { color: var(--ink); }
.qm { display: inline-grid; place-items: center; width: 17px; height: 17px; margin: 0 2px 0 5px; padding: 0; vertical-align: 2px;
  border-radius: 50%; border: 1px solid var(--faint); background: transparent; color: var(--dim); font: 600 10px/1 var(--num); cursor: pointer; }
.qm:hover, .qm[aria-expanded="true"] { border-color: var(--a); color: var(--a); }
.pop { position: absolute; left: 0; z-index: 25; width: min(34em, 100%); max-height: 70vh; overflow: auto; padding: 16px 18px; background: var(--popbg);
  border: 1px solid var(--popline); border-radius: 12px; box-shadow: 0 16px 40px rgba(13,43,69,.18); }
.pop > b { font-size: 14px; }
.pop p { margin: 8px 0 0; font-size: 13px; line-height: 1.85; color: var(--body); line-break: strict; word-break: auto-phrase; }
.pop .terms { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; line-height: 1.9; color: var(--faint); }
.tools { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.tools button, .tools a { font: 12px/1 var(--jpf); color: var(--dim); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; text-decoration: none; }
.tools button:hover, .tools a:hover, .tools button[aria-expanded="true"] { color: var(--ink); border-color: var(--dim); }
.tools button, .tools a { background: #fff; }

/* 右：模型 */
.look { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; min-width: 0; }
.model { position: relative; aspect-ratio: 16 / 9; max-height: 52vh; width: 100%; background: radial-gradient(120% 90% at 50% 15%, #ffffff 0%, #f2f7fb 75%);
  border-bottom: 1px solid var(--line); overflow: hidden; touch-action: none; }
.model canvas { display: block; width: 100%; height: 100%; }
/* 色見本（左）と数（右）は、図に重ねず、図のすぐ下の帯に並べる（字が重ならないように） */
.look .model { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) auto; }
.look .model canvas { grid-column: 1 / -1; grid-row: 1; min-height: 0; }
.legend { position: static; grid-row: 2; grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; font-size: 12px; color: var(--dim);
  background: #f7fafc; border-top: 1px solid var(--line); padding: 6px 12px; min-width: 0; }
.legend:empty { display: none; }
.legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.probe { position: static; grid-row: 2; grid-column: 2; font: 500 12px/1.6 var(--num); text-align: right; color: var(--dim); background: #f7fafc; border-top: 1px solid var(--line); padding: 6px 12px; white-space: normal; max-width: 34em; }
.legend:empty + .probe { grid-column: 1 / -1; max-width: none; }
.probe .sep { color: var(--line); margin: 0 .5em; }
.probe:empty { display: none; }
.probe b { color: var(--b); font-weight: 700; }
/* 画面が小さめの机（幅 861〜1199px。2 列の見開きのまま）では、図が細くなり、色見本が数の欄に押されて 1 字ずつ折り返し、図がつぶれる。
   色見本と数を上下 2 段に分ける（2026-09-25。各章の図のファイルにも同じ決まりがあるが、ここにまとめて、どの図にも効くようにした） */
@media (min-width: 861px) and (max-width: 1199px) {
  .look .model { grid-template-columns: minmax(0, 1fr); }
  .look .model .probe { grid-row: 3; grid-column: 1; text-align: left; max-width: none; }
}
.graph { height: 15.5vh; min-height: 100px; background: #fbfdfe; border-bottom: 1px solid var(--line); position: relative; display: flex; flex-direction: column; }
.graph canvas { display: block; width: 100%; flex: 1 1 auto; min-height: 0; height: auto; order: 2; }
/* グラフの題は、グラフの上に重ねず、すぐ上の行に置く（重ねると左上の目盛りの数を隠していた。2026-09-25） */
.graph .cap { order: 1; flex: none; font-size: 11px; line-height: 15px; color: var(--faint); letter-spacing: .06em; padding: 4px 12px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; font-size: 13px; color: var(--dim); padding: 12px 16px; }
.ctrl .row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; min-width: 0; }
/* 両端を選べるつまみ */
.ctrl .range2 { display: inline-flex; align-items: center; gap: 8px; }
.ctrl .range2 .lab:empty { display: none; }
.ctrl .r2 { position: relative; width: 140px; height: 22px; flex: none; }
.ctrl .r2track { position: absolute; left: 9px; right: 9px; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--line); }
.ctrl .r2track i { position: absolute; top: 0; bottom: 0; background: var(--b); border-radius: 2px; }
.ctrl .r2 input[type=range] { position: absolute; left: 0; top: 0; width: 100%; height: 22px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; z-index: 2; }
.ctrl .r2 input[type=range]::-webkit-slider-runnable-track { background: none; border: 0; height: 22px; }
.ctrl .r2 input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; pointer-events: auto; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; background: var(--b); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); cursor: pointer; }
.ctrl .r2 input[type=range]::-moz-range-track { background: none; border: 0; }
.ctrl .r2 input[type=range]::-moz-range-thumb { pointer-events: auto; width: 14px; height: 14px; border-radius: 50%; background: var(--b); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); cursor: pointer; }
.ctrl .range2 output { font-family: var(--num); color: var(--ink); white-space: nowrap; }
.ctrl [hidden] { display: none !important; }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { font: 500 13px/1 var(--jpf); color: var(--dim); background: transparent; border: 0; padding: 9px 11px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--b); color: #fff; }
.btn { font: 600 13px/1 var(--jpf); color: var(--b); background: #fff; border: 1px solid #c5d6ea; border-radius: 8px; padding: 9px 13px; cursor: pointer; }
.btn:hover { border-color: var(--b); background: var(--soft); }
.ctrl label { display: inline-flex; align-items: center; gap: 10px; }
.ctrl input[type=range] { width: 150px; accent-color: var(--b); }
.ctrl input[type=checkbox] { accent-color: var(--a); }
.ctrl output { font-family: var(--num); color: var(--ink); min-width: 3.2em; }

/* Python の引き出し（見開きの下に開く） */
.pybox { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.pybox[hidden] { display: none; }
.pybar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.pybar .name { font: 500 12px var(--num); color: var(--dim); margin-right: auto; }
.pybar .run { background: var(--a); color: #fff; border-color: var(--a); font-weight: 700; }
.pybar .run:hover { background: #0b7f63; }
.pybar .st { font-size: 12px; color: var(--dim); }
.pybody { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 300px; }
.pybody textarea { width: 100%; min-height: 300px; max-height: 60vh; border: 0; border-right: 1px solid var(--line); background: #f7fafc; color: var(--ink);
  font: 12.5px/1.6 var(--num); padding: 12px 14px; resize: vertical; tab-size: 4; white-space: pre; overflow: auto; }
.pybody pre { margin: 0; background: var(--mint); color: var(--ink); font: 12px/1.55 var(--num); padding: 12px 14px; white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto; }
.pybody pre:empty::before { content: "▶ 動かす を押すと、ここに結果が出ます"; color: var(--faint); }
.pybody pre .err { color: #c0392b; }
/* 右側に入ったプログラム：模型と同じ高さの中に、説明・ボタン・コード（上）・結果（下） */
.side > .pybox, .stage > .pybox { display: flex; flex-direction: column; border: 0; border-radius: 0; }
.side > .pybox[hidden], .stage > .pybox[hidden] { display: none; }
.pyhint { margin: 0; padding: 12px 14px 0; font-size: 12.5px; line-height: 1.7; color: var(--dim); }
.pyhint b { color: var(--a); }
.stage > .pybox .pybar { border-bottom: 1px solid var(--line); }
.stage > .pybox .pybar .run { font-size: 14px; padding: 9px 18px; }
.stage > .pybox .pybar .name { margin: 0 0 0 auto; }
.stage > .pybox .pybody { flex: 1; min-height: 0; grid-template-columns: 1fr; grid-template-rows: minmax(0, 1.3fr) minmax(0, 1fr); }
.stage > .pybox .pybody textarea { height: 100%; min-height: 0; max-height: none; resize: none; border-right: 0; border-bottom: 1px solid var(--line); }
.stage > .pybox .pybody pre { height: 100%; max-height: none; }

/* 元の資料（出来事のカード） */
.src { margin-top: 16px; font-size: 12.5px; color: var(--dim); line-height: 1.7; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font: 600 11px/1.5 var(--jpf); white-space: nowrap; border: 1px solid currentColor; }
.cA { color: var(--A); } .cB { color: var(--B); } .cC { color: var(--C); } .cX { color: var(--X); }
.jpb { display: inline-block; padding: 0 6px; border-radius: 4px; font: 700 11px/1.6 var(--jpf); color: var(--jp); border: 1px solid rgba(163,51,156,.4); }
.evs { display: grid; gap: 10px; margin-top: 10px; }
/* 元の資料と確度：画面の上に重ねて出す（半分すける黒の上の白い枠。見開きの形を崩さない。2026-09-25） */
.src:not([hidden]) { position: fixed; inset: 0; z-index: 50; margin: 0; background: rgba(8, 20, 34, .62); display: flex; align-items: center; justify-content: center; padding: 4vh 16px; }
.src .sheet { position: relative; background: var(--bg, #fff); width: min(780px, 100%); max-height: 88vh; overflow: auto; overscroll-behavior: contain; border-radius: 16px; padding: 18px 22px 22px; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.src .sheet h3 { margin: 0 40px 4px 0; font-size: 15px; line-height: 1.6; color: var(--ink); }
.src .sheet h3 span { display: block; font-size: 12.5px; font-weight: 600; color: var(--dim); }
.src .close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 19px; line-height: 1; cursor: pointer; }
.src .close:hover { border-color: var(--b); color: var(--b); }
body.modal-open { overflow: hidden; }
.ev { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ev.hit { border-color: var(--a); box-shadow: 0 0 0 3px rgba(14,148,116,.18); }
.ev .top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font: 12px var(--num); color: var(--dim); }
.ev h4 { margin: 6px 0 4px; font-size: 14px; line-height: 1.6; color: var(--ink); font-weight: 600; }
.ev p { margin: 4px 0 0; font-size: 13px; line-height: 1.8; color: var(--body); }
.ev .bvs { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #f5f2ff; font-size: 13px; line-height: 1.8; }
.ev .bvs b { color: var(--warn); font-weight: 600; }
.ev details { margin-top: 6px; font-size: 12px; }
.ev details summary { cursor: pointer; color: var(--a); }
.ev ol { padding-left: 1.3em; margin: 6px 0 0; }
.ev li { margin: 3px 0; color: var(--dim); }
.ev li a { color: var(--body); }

/* 押せる引用 */
.qt { background: none; color: inherit; border: 0; border-bottom: 1.5px dotted rgba(36,86,201,.55); padding: 0; margin: 0; font: inherit; cursor: pointer; line-height: inherit; text-align: left; }
.qt:hover { color: var(--ink); border-bottom-color: var(--b); background: rgba(36,86,201,.06); }
.qpop { position: fixed; z-index: 60; max-width: min(460px, calc(100vw - 24px)); background: var(--popbg); color: var(--ink); border: 1px solid var(--popline);
  border-radius: 12px; box-shadow: 0 16px 40px rgba(13,43,69,.18); padding: 14px 16px; font-size: 13px; line-height: 1.75; }
.qpop h5 { margin: 0 0 4px; font-size: 11px; color: var(--dim); font-weight: 600; letter-spacing: .06em; }
.qpop .orig { font-family: Georgia, "Times New Roman", serif; font-style: italic; background: var(--panel); padding: 4px 8px; border-radius: 6px; margin: 6px 0; }
.qpop dl { margin: 6px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.qpop dt { color: var(--dim); } .qpop dd { margin: 0; word-break: break-word; }
.qpop a { color: var(--a); }
.qpop .x { position: absolute; top: 6px; right: 8px; border: 0; background: none; color: var(--dim); font-size: 16px; cursor: pointer; }

/* 章のまとめ・おわりに */
.closing { min-height: 100vh; display: grid; place-items: center; padding: 8vh 6vw; border-top: 1px solid var(--line); scroll-snap-align: start; background: linear-gradient(180deg, #ffffff 0%, #eef6ff 60%, #e9f7f2 100%); }
.closing-read { width: min(52em, 88vw); }
.closing-read .no { font: 500 11px/1 var(--num); letter-spacing: .14em; color: var(--a); }
.closing-read h2 { margin: 14px 0 0; font-size: clamp(26px, 2.8vw, 40px); font-weight: 700; color: var(--b); }
.closing-read p, .closing-read li { font-size: 15px; line-height: 2; color: var(--body); }
.closing-read ul { padding-left: 1.2em; }
.pager { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.pager a { flex: 1 1 220px; text-decoration: none; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.pager a small { display: block; color: var(--dim); font-size: 11px; font-family: var(--num); letter-spacing: .1em; margin-bottom: 4px; }
.pager a:hover { border-color: var(--a); }

/* ふつうのページ（年表・確かさ・先生へ）も同じ色で */
.plain { max-width: 820px; margin: 0 auto; padding: 88px 20px 80px; }
.plain.wide { max-width: 1100px; }
.plain h1 { font-size: clamp(28px, 3vw, 40px); font-weight: 700; margin: 0 0 10px; color: var(--b); }
.plain h2 { font-size: 20px; margin: 42px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.plain h3 { font-size: 16px; margin: 26px 0 8px; }
.plain p, .plain li { font-size: 15px; line-height: 1.95; color: var(--body); }
.tw { overflow-x: auto; margin: 12px 0 20px; border: 1px solid var(--line); border-radius: 10px; }
.tw table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 1.7; }
.tw th, .tw td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; color: var(--body); }
.tw th { background: var(--panel); color: var(--ink); white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; }
.filters input, .filters select { font: 14px var(--jpf); padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.filters input[type=search] { flex: 1 1 220px; }
.filters label { font-size: 13px; color: var(--dim); display: inline-flex; gap: 6px; align-items: center; }
.tl-year { position: sticky; top: 0; z-index: 5; background: var(--bg); font: 700 15px var(--num); color: var(--a); padding: 10px 0 4px; border-bottom: 1px solid var(--line); margin-top: 14px; }
.foot { padding: 30px 6vw 50px; color: var(--faint); font-size: 12px; border-top: 1px solid var(--line); }

/* スマホ：縦に積む。見出しと図だけ（「解説を見る」で開く） */
@media (max-width: 860px) {
  #rail { display: none; }
  #nav { left: 10px; top: 10px; gap: 5px; }
  #nav a { padding: 7px 9px; font-size: 11.5px; }
  .cover { min-height: 0; padding: 64px 18px 26px; display: block; }
  .cover h1 { font-size: clamp(40px, 13vw, 68px); margin-top: 22px; }
  .cover .sub { font-size: 16px; }
  .cover .lead { font-size: 14px; line-height: 1.85; }
  .cover .art { height: 300px; bottom: auto; -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.5) 45%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.5) 45%, transparent 100%); }
  .toc { --cols: 2 !important; margin-top: 26px; }
  .toc a { padding: 11px 8px 12px 11px; }
  .toc i { font-size: 10.5px; }
  .spread { display: block; padding: 0 0 22px; min-height: 0; }
  .spread > .read { padding: 26px 18px 12px; }
  .read h2 { font-size: 24px; margin-top: 12px; }
  .read .q { font-size: 14px; }
  .read p { font-size: 14.5px; line-height: 1.8; margin-top: 12px; }
  
  /* 図のファイルが見開きごとに足した「最初の段落を何行か見せる」決まり（前のスマホの形の名残）より強くするため、!important を付ける */
  .read:not(.open) > :not(.no):not(.field):not(h2):not(.more):not(.tools):not(.src), .read:not(.open) > .tools > :not(.go) { display: none !important; }
  .read:not(.open) > .tools:not(:has(.go)) { display: none !important; }
  .read > .more { display: inline-flex !important; }
  
  .read:not(.open) > .tools:has(.go) { display: inline-flex !important; vertical-align: middle; margin-right: 8px; }
  .read:not(.open) > .tools:has(.go) ~ .more { vertical-align: middle; }
  .more { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 10px 16px; font: 600 13px/1 var(--jpf); color: var(--b); background: #fff; border: 1.5px solid var(--b); border-radius: 999px; }
  .more::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
  .read.open .more::after { transform: translateY(2px) rotate(-135deg); }
  .more .c, .read.open .more .o { display: none; }
  .read.open .more .c { display: inline; }
  .eq { padding: 12px 14px; }
  .eq .f { font-size: 16.5px; }
  .pop { left: 0; width: 100%; }
  .side > .look, .side > .stage { border-radius: 0; border-width: 1px 0; box-shadow: none; }
  .side { gap: 0; }
  .side .myth { margin: 12px 12px 0; }
  .model { aspect-ratio: auto; max-height: none; }
  .look .model { grid-template-columns: minmax(0, 1fr); }
  .model canvas { aspect-ratio: 4 / 3; height: auto; }
  .look .model .probe { grid-row: 3; grid-column: 1; text-align: left; max-width: none; }
  .graph { height: 132px; min-height: 0; }
  .graph .cap { white-space: normal; }
  .ctrl { padding: 10px 12px 12px; gap: 8px; font-size: 12px; }
  .ctrl input[type=range] { width: 120px; }
  .ctrl .r2 { width: 150px; }
  .seg button { padding: 8px 10px; font-size: 12px; }
  .legend { font-size: 10.5px; }
  .probe { font-size: 11px; }
  .pybox { margin: 12px 12px 0; }
  .stage > .pybox { height: auto !important; }
  .stagebar .hint { display: none; }
  .stage > .pybox .pybody { grid-template-rows: auto auto; }
  .stage > .pybox .pybody textarea { min-height: 260px; max-height: 50vh; }
  .stage > .pybox .pybody pre { min-height: 140px; max-height: 45vh; }
  .pybody { grid-template-columns: 1fr; }
  .pybody textarea { border-right: 0; border-bottom: 1px solid var(--line); min-height: 220px; max-height: 45vh; }
  .closing { min-height: 0; padding: 50px 18px; }
}
@media (min-width: 861px) { .more { display: none; } }
@media print { #nav, #rail, .ctrl, .tools { display: none; } .spread { min-height: 0; break-inside: avoid; } }
/* 第 1 形の図（予言の地図）が使う色の名前 */
:root { --accent: #7c4dcc; --card: var(--panel); --muted: var(--dim); --fg: var(--ink); }
.fig-predmap svg { display: block; width: 100%; height: auto; max-height: 72vh; }
.fig-predmap figcaption { font-size: 12.5px; color: var(--dim); line-height: 1.8; margin-top: 8px; }
.pm-info { margin: 10px 0 0; }
.toc .pad { background: var(--bg); }
@media (max-width: 860px) { .toc .pad { display: none; } }
.cover .art { display: block; border: 0; border-radius: 0; background: none; }
.cover .art .model { position: absolute; inset: 0; aspect-ratio: auto; max-height: none; height: auto; background: none; border: 0; }
.cover .art .legend, .cover .art .probe, .cover .art .ctrl { display: none; }


strong { font-weight: 700; background: linear-gradient(transparent 55%, #c6e8ff 55%); padding: 0 .08em; border-radius: 1px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.cover .feat strong { background: linear-gradient(transparent 60%, #c6e8ff 60%); }


.tools a.go { font: 600 14px/1 var(--jpf); color: #fff; background: var(--b); border-color: var(--b); padding: 12px 22px; box-shadow: 0 2px 8px rgba(36, 86, 201, .25); }
.tools a.go:hover { color: #fff; background: #1d47a8; border-color: #1d47a8; }
.tools a.go:focus-visible { outline: 3px solid var(--a); outline-offset: 2px; }



/* 枠の上の帯の左はしの「最初から」（くるくるのマークだけ。2026-10-12） */
.stage .stagebar button.replay { flex: none; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--b); cursor: pointer; }
.stage .stagebar button.replay:hover { border-color: var(--b); }
.stage .stagebar button.replay:focus-visible { outline: 3px solid var(--a); outline-offset: 2px; }
.stagebar .replay.spin svg { animation: replay-spin .5s ease; }
@keyframes replay-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .stagebar .replay.spin svg { animation: none; } }
