/* ========================================================================
   大学物理 · 第12章 气体动理论 —— 讲义放映样式（slide 风格）
   配色：深色 #1a1a1a / 橙 #EA7600 / 暖白 #f5f4f0
   支持：全屏放映（F / 按钮）、键盘翻页、缩略图概览
   ======================================================================== */

:root {
  --color-bg: #f5f4f0;
  --color-bg-alt: #ffffff;
  --color-text: #1a1a1a;
  --color-text-soft: #4a4a4a;
  --color-muted: #7a7a7a;
  --color-accent: #EA7600;
  --color-accent-soft: #fde2c8;
  --color-hero: #1a1a1a;
  --color-hero-text: #f5f4f0;
  --color-border: #d8d5cc;
  --color-card: #ffffff;
  --color-info-bg: #fff6ec;
  --color-warn-bg: #fde9d6;
  --color-ok-bg: #e8f2e3;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, .06);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .08);
  --radius: 10px;
  --font-cn: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-cn);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------- 顶部状态栏 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 50px;
  background: var(--color-hero); color: var(--color-hero-text);
  display: flex; align-items: center; padding: 0 20px; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar .brand {
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
  color: var(--color-accent); margin-right: 16px; white-space: nowrap;
}
.topbar .crumb { font-size: 13px; color: #c8c5be; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb a { color: #c8c5be; text-decoration: none; margin-right: 6px; }
.topbar .crumb a:hover { color: var(--color-accent); }
.topbar .crumb .sep { color: #555; margin: 0 6px; }
.topbar .pageinfo { font-size: 12px; color: #c8c5be; font-family: var(--font-mono); white-space: nowrap; }

/* ---------- 舞台与页面 ---------- */
.stage {
  position: absolute; top: 50px; bottom: 54px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 18px; overflow: hidden;
}
.slide {
  display: none; width: 100%; max-width: 1240px; height: 100%;
  background: var(--color-bg-alt); border-radius: var(--radius);
  padding: 40px 60px 48px; overflow-y: auto;
  box-shadow: var(--shadow-md); border: 1px solid var(--color-border);
  animation: slideIn .3s ease;
}
.slide.active { display: block; }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 页码 / 小节标签 */
.slide-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-bottom: 8px; margin-bottom: 18px;
  border-bottom: 1px dashed var(--color-border);
}
.slide-head .sec { font-size: 12.5px; color: var(--color-muted); font-family: var(--font-mono); letter-spacing: .5px; }
.slide-head .pg {
  font-size: 12px; font-family: var(--font-mono); color: #a85800;
  background: var(--color-accent-soft); border-radius: 20px; padding: 2px 10px; white-space: nowrap;
}

/* ---------- 标题 ---------- */
.slide h1 {
  margin: 0 0 20px; font-size: 32px; line-height: 1.35; color: var(--color-hero);
  border-left: 6px solid var(--color-accent); padding-left: 16px; font-weight: 700;
}
.slide h2 {
  margin: 24px 0 12px; font-size: 22px; color: var(--color-hero);
  border-bottom: 2px solid var(--color-accent); padding-bottom: 6px;
}
.slide h3 { margin: 18px 0 10px; font-size: 18px; color: var(--color-accent); }
.slide h4 { margin: 14px 0 6px; font-size: 16px; color: var(--color-text); }
.slide p, .slide li { font-size: 17px; line-height: 1.9; color: var(--color-text); margin: .5em 0; }
.slide ul, .slide ol { margin: 6px 0 12px; padding-left: 26px; }
.slide li { margin-bottom: 5px; }
.slide li::marker { color: var(--color-accent); }
@media (max-width: 1100px) {
  .slide { padding: 28px 32px 36px; }
  .slide h1 { font-size: 26px; }
  .slide p, .slide li { font-size: 16px; }
}

/* ---------- 重点块 ---------- */
.callout {
  border-left: 5px solid var(--color-accent); background: var(--color-info-bg);
  padding: 14px 18px; margin: 16px 0; border-radius: 6px; font-size: 16px; line-height: 1.8;
}
.callout.warn { border-color: #d97c00; background: var(--color-warn-bg); }
.callout.ok   { border-color: #4f8a3d; background: var(--color-ok-bg); }
.callout .label {
  display: inline-block; font-size: 12px; font-weight: 700; color: var(--color-accent);
  letter-spacing: 1px; margin-right: 8px;
}
.callout.warn .label { color: #a85800; }
.callout.ok   .label { color: #3d6c2e; }
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }

/* ---------- 表格 ---------- */
table.tbl {
  width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 15px;
  background: #fff; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-sm);
}
table.tbl th, table.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: top; }
table.tbl th { background: var(--color-hero); color: var(--color-hero-text); font-weight: 600; font-size: 14px; }
table.tbl tr:nth-child(even) td { background: #faf8f3; }
table.tbl td.num, table.tbl th.num { text-align: center; font-family: var(--font-mono); }

/* ---------- 网格卡片 ---------- */
.grid-2, .grid-3 { display: grid; gap: 14px; margin: 14px 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.card {
  background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: 8px; padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.card .title { font-size: 15px; font-weight: 700; color: var(--color-accent); margin-bottom: 6px; }
.card .body { font-size: 15.5px; line-height: 1.8; color: var(--color-text-soft); }

/* ---------- 封面 / 章节页 ---------- */
.cover {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; height: 100%; min-height: 380px;
  background: linear-gradient(135deg, #1a1a1a 0%, #2b2b2b 100%);
  color: var(--color-hero-text); border-radius: var(--radius); padding: 40px;
}
.cover .ch-num { font-size: 15px; color: var(--color-accent); letter-spacing: 5px; margin-bottom: 14px; }
.cover h1 { font-size: 46px; margin: 0 0 16px; color: var(--color-hero-text); border: none; padding: 0; }
.cover .subtitle { font-size: 17px; color: #c8c5be; margin-bottom: 26px; letter-spacing: 2px; }
.cover .meta { font-size: 13px; color: #888; font-family: var(--font-mono); }
.cover img { max-height: 34vh; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 8px 26px rgba(0,0,0,.5); }

.section-page {
  display: flex; flex-direction: column; justify-content: center; height: 100%; min-height: 300px;
  background: linear-gradient(120deg, #fff6ec 0%, #fde2c8 100%);
  border-left: 10px solid var(--color-accent); border-radius: var(--radius); padding: 30px 48px;
}
.section-page .no { font-family: var(--font-mono); font-size: 80px; font-weight: 700; color: rgba(234,118,0,.28); line-height: 1; }
.section-page h1 { font-size: 40px; margin: 6px 0 10px; border: none; padding: 0; }
.section-page .sub { font-size: 17px; color: #a85800; }

/* ---------- 图片 ---------- */
.figs { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: flex-start; margin: 16px 0; }
.figs figure { margin: 0; flex: 0 1 auto; max-width: 100%; text-align: center; }
.figs img {
  max-height: 46vh; max-width: 100%; border-radius: 6px;
  border: 1px solid var(--color-border); background: #fff; box-shadow: var(--shadow-sm);
}
.figs.wide img { max-height: 40vh; }
.figs figcaption { font-size: 13px; color: var(--color-muted); margin-top: 6px; line-height: 1.6; }

/* ---------- 两栏 ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- 测验题 ---------- */
.quiz { background: #fbf8f2; border: 1px solid var(--color-border); border-left: 5px solid #2d7cc1; border-radius: 6px; padding: 16px 20px; margin: 14px 0; }
.quiz .qt { font-size: 12px; font-weight: 700; color: #1e40af; letter-spacing: 1px; margin-bottom: 8px; display: block; }
.quiz .qq { font-size: 17px; line-height: 1.85; margin: .2rem 0 .5rem; }
.quiz .opts { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.quiz .opts li { font-size: 15.5px; color: var(--color-text-soft); padding-left: 26px; position: relative; }
.quiz .opts li::before {
  content: attr(data-k); position: absolute; left: 0; top: 0;
  width: 19px; height: 19px; line-height: 19px; text-align: center; border-radius: 50%;
  background: #dbeafe; color: #1e40af; font-size: 12px; font-weight: 700; font-family: var(--font-mono);
}
@media (max-width: 900px) { .quiz .opts { grid-template-columns: 1fr; } }
.quiz .ans { margin-top: 10px; font-size: 15px; color: #3d6c2e; background: var(--color-ok-bg); border-radius: 4px; padding: 6px 12px; display: inline-block; }

/* ---------- 数学公式 ---------- */
mjx-container { font-size: 112% !important; }
.slide .formula {
  background: #fff; border: 1px dashed var(--color-border); border-radius: 6px;
  padding: 12px 18px; margin: 12px 0; text-align: center; overflow-x: auto;
}
.slide mjx-container[display="true"] { margin: 4px 0 !important; }

/* ---------- 关键术语 ---------- */
.term {
  display: inline-block; background: var(--color-accent-soft); color: #a85800;
  padding: 1px 7px; border-radius: 4px; font-weight: 600; font-size: 15.5px; margin: 0 2px;
}
.kbd {
  font-family: var(--font-mono); font-size: 12.5px; background: #efece4;
  border: 1px solid var(--color-border); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; color: #444;
}

/* ---------- 底部导航 ---------- */
.toolbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 54px;
  background: var(--color-hero); color: var(--color-hero-text);
  display: flex; align-items: center; padding: 0 18px; gap: 10px; z-index: 100;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, .1);
}
.toolbar .btn {
  background: transparent; color: var(--color-hero-text); border: 1px solid #444;
  padding: 6px 13px; border-radius: 4px; cursor: pointer; font-size: 13px;
  font-family: inherit; transition: all .15s; white-space: nowrap;
}
.toolbar .btn:hover { background: var(--color-accent); border-color: var(--color-accent); }
.toolbar .btn:disabled { opacity: .35; cursor: not-allowed; }
.toolbar .btn:disabled:hover { background: transparent; border-color: #444; }
.toolbar .progress { flex: 1; min-width: 60px; height: 6px; background: #333; border-radius: 3px; overflow: hidden; position: relative; }
.toolbar .progress-bar {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: linear-gradient(90deg, var(--color-accent), #ffb96b); transition: width .3s;
}
.toolbar .counter { font-family: var(--font-mono); font-size: 13px; color: #c8c5be; min-width: 78px; text-align: center; white-space: nowrap; }
.toolbar .accent-btn { background: var(--color-accent); border-color: var(--color-accent); font-weight: 600; }
.toolbar .accent-btn:hover { background: #ff8c1a; }

/* ---------- 缩略图概览 ---------- */
.overview-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .88); z-index: 200;
  display: none; overflow-y: auto; padding: 36px;
}
.overview-mask.show { display: block; }
.overview-mask h2 { color: var(--color-hero-text); font-size: 20px; margin: 0 0 20px; text-align: center; letter-spacing: 2px; }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; max-width: 1400px; margin: 0 auto; }
.thumb {
  background: #fff; border-radius: 6px; padding: 12px 14px; cursor: pointer;
  border: 2px solid transparent; transition: all .15s; font-size: 12.5px; line-height: 1.5;
  color: var(--color-text); min-height: 86px;
}
.thumb:hover { border-color: var(--color-accent); transform: translateY(-2px); }
.thumb .num { color: var(--color-accent); font-weight: 700; font-family: var(--font-mono); font-size: 11px; display: block; margin-bottom: 4px; }
.thumb.current { border-color: var(--color-accent); background: #fff2e0; }
.overview-mask .hint { color: #999; font-size: 12.5px; text-align: center; margin-top: 22px; font-family: var(--font-mono); }

/* ---------- 提示小字 / 打印 ---------- */
.hint { font-size: 12.5px; color: var(--color-muted); margin-top: 14px; text-align: center; font-family: var(--font-mono); }
.slide::-webkit-scrollbar { width: 8px; }
.slide::-webkit-scrollbar-track { background: transparent; }
.slide::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }
.slide::-webkit-scrollbar-thumb:hover { background: var(--color-muted); }

/* ========================================================================
   固体物理 · 第 2 章：排版加密
   ------------------------------------------------------------------------
   本讲内容密度高于其他课程（含大量公式块、SVG 图表、对比表格），
   在 1920×1080 放映下需要收窄竖直方向的留白，保证每页不出现滚动条。
   这里的取值均以「整页零溢出」为目标调过。
   ======================================================================== */

.slide { padding: 26px 52px 28px; }

.slide-head { padding-bottom: 4px; margin-bottom: 9px; }

.slide h1 { margin: 0 0 10px; font-size: 27px; line-height: 1.26; padding-left: 13px; }
.slide h2 { margin: 11px 0 6px;  font-size: 19px; padding-bottom: 3px; }
.slide h3 { margin: 12px 0 6px;  font-size: 17px; }

.slide p, .slide li { font-size: 15.5px; line-height: 1.65; margin: .36em 0; }
.slide ul, .slide ol { margin: 4px 0 8px; }
.slide li { margin-bottom: 3px; }

.slide .formula { padding: 6px 12px; margin: 6px 0; }

.callout { padding: 8px 13px; margin: 8px 0; font-size: 15px; line-height: 1.62; }

table.tbl { margin: 8px 0; font-size: 14px; }
table.tbl th, table.tbl td { padding: 4.5px 9px; }
table.tbl th { font-size: 13.5px; }

.figs { margin: 8px 0; }
.figs img { max-height: 30vh; }
.figs figcaption { font-size: 13px; margin-top: 6px; }

.grid-2, .grid-3 { gap: 12px; }
.card { padding: 12px 15px; }
.card .title { font-size: 16px; margin-bottom: 6px; }
.card .body { font-size: 15px; line-height: 1.65; }

.quiz { padding: 10px 14px; margin: 8px 0; }
.quiz .qq { font-size: 16px; margin: 6px 0; }
.quiz .opts li { padding: 5px 10px; font-size: 15px; }

/* 图内的 SVG 用 max-height 约束（本讲图表统一给宽高比约 1.7:1） */
.figs svg { max-height: 31vh; height: auto; }

/* 内容最密集的少数几页（如图 + 双卡 + 两处 callout 同屏）：
   用 .figs.tight 把图再收一档，避免出现纵向滚动条。 */
.figs.tight { margin: 6px 0; }
.figs.tight svg { max-height: 25vh; }
.figs.tight figcaption { font-size: 12.5px; margin-top: 4px; }

/* ---------- 推导步骤链（steps） ----------
   比 callout 更紧凑：左侧一条竖线串起编号，适合一页放 3~5 步推导。
   相比同内容用多个 callout，纵向可省 30%~40%。 */
.steps { list-style: none; margin: 7px 0 9px; padding: 0 0 0 4px; }
.steps > li {
  position: relative; padding: 0 0 7px 30px; margin: 0;
  border-left: 2px solid var(--color-border); font-size: 15px;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps .sn {
  position: absolute; left: -11px; top: 1px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--color-accent); color: #fff;
  font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center;
  font-family: var(--font-mono, Consolas, monospace);
}
.steps .st { display: block; font-weight: 700; color: #a85800; font-size: 15px; line-height: 1.4; }
.steps .sb { display: block; line-height: 1.6; }
.steps .sb .formula { margin: 4px 0; padding: 5px 10px; }

/* ---------- 跳转阅读资料按钮（doclink） ---------- */
.doclink {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 9px 0 4px; padding: 7px 13px; border-radius: 8px;
  background: #fff6ec; border: 1px dashed #e8b47c;
}
.doclink a {
  color: var(--color-accent); font-weight: 700; font-size: 15px;
  text-decoration: none; border-bottom: 1px solid var(--color-accent);
  white-space: nowrap;
}
.doclink a:hover { color: #b25a00; }
.doclink .dl-note { font-size: 13.5px; color: #6b6b6b; }

/* ---------- 「思考」紧凑块（think） ----------
   把「提问 + 公式 + 结论」压成一屏能放下的横排结构：
   第一行左标题右公式（对齐基线），第二行为结论条。
   相比「h2 + formula + callout」三件套，纵向可省 35%~45%。 */
.think {
  margin: 8px 0 0; padding: 6px 12px 7px;
  border-radius: 8px; background: #fff8ef;
  border: 1px solid #f0d9bb; border-left: 5px solid var(--color-accent);
}
.think .tk-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.think .tk-title {
  flex: 0 0 auto; font-size: 15px; font-weight: 700; color: #a85800;
  letter-spacing: .02em;
}
.think .tk-title::before {
  content: "?"; display: inline-block; width: 16px; height: 16px; margin-right: 6px;
  border-radius: 50%; background: var(--color-accent); color: #fff;
  font-size: 11.5px; font-weight: 700; line-height: 16px; text-align: center;
  vertical-align: 1px;
}
.think .tk-eq { flex: 1 1 auto; min-width: 0; overflow-x: auto; }
/* 注意：必须带 .slide 前缀，否则会被 .slide.tight .formula 的
   padding 覆盖（特异性相同、后者在文件中更靠后），导致公式被撑大。 */
.slide .think .tk-eq .formula { margin: 0; padding: 0 4px; background: transparent; box-shadow: none; }
.think .tk-body {
  margin-top: 3px; padding-top: 4px; border-top: 1px dashed #eccfa8;
  font-size: 14px; line-height: 1.5; color: #4a3a22;
}
.think .tk-body b { color: #8a4a00; }
.think .tk-body .tk-arrow { color: var(--color-accent); font-weight: 700; }
/* 行内公式不要在中文排版里被断行、也不要把行高撑开 */
.think .tk-body mjx-container,
.think .tk-title mjx-container { white-space: nowrap; vertical-align: baseline; }
.think mjx-container:not([display="true"]) { line-height: 0; }

/* ---------- 页面级加密（.slide.tight）----------
   当某页内容确实比常规页面多（例如末尾追加了一个「思考」块），
   用这个类把该页的段落/公式/callout 间距各收一档，
   避免逐块去挤压内容本身的可读性。 */
.slide.tight { padding-top: 20px; padding-bottom: 20px; }
.slide.tight h1 { margin-bottom: 7px; }
.slide.tight h2 { margin: 8px 0 4px; }
.slide.tight p { margin: .26em 0; }
/* 只收「正文无序列表」，不碰 .steps > li（它的留白靠 padding 而非 margin） */
.slide.tight ul > li { margin-bottom: 1px; }
.slide.tight .formula { padding: 5px 11px; margin: 4px 0; }
.slide.tight .callout { padding: 7px 12px; margin: 6px 0; }
.slide.tight .think { margin-top: 6px; padding: 5px 11px 6px; }
.slide.tight .think .tk-body { margin-top: 3px; padding-top: 4px; font-size: 13.5px; line-height: 1.48; }
.slide.tight .grid-2, .slide.tight .grid-3 { gap: 10px; }
.slide.tight .card { padding: 9px 12px; }
.slide.tight .card .body { line-height: 1.56; }
.slide.tight .doclink { margin: 6px 0 2px; padding: 6px 12px; }
/* 宽表格（如三方案对照表）在 tight 页上再收一档行列间距，
   这比压缩文字更不影响可读性，通常能省 30~50px。 */
.slide.tight table.tbl { margin: 5px 0; font-size: 13.5px; }
.slide.tight table.tbl th, .slide.tight table.tbl td { padding: 3px 8px; }
.slide.tight table.tbl th { font-size: 13px; }
