/* 智能车新生培训 · 授课幻灯片
 * 画布固定 1280×720（16:9），按窗口等比缩放；打印时每页一张幻灯片。 */
:root {
  --fg: #263238; --sub: #607d8b; --line: #cfd8dc; --bg: #eceff1;
  --acc: #1e88e5; --warn: #e65100; --ok: #2e7d32; --code-bg: #f6f8fa;
  --part: var(--acc);
  --font: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans CJK SC', 'Source Han Sans SC', sans-serif;
  --mono: Consolas, 'JetBrains Mono', 'DejaVu Sans Mono', 'Microsoft YaHei', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #263238; overflow: hidden; font-family: var(--font); color: var(--fg); }

/* ---------- 画布 ---------- */
#deck { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px; transform-origin: 0 0; }
.slide {
  position: absolute; inset: 0; background: #fff; color: var(--fg); padding: 64px 72px 52px; display: none;
  font-size: 28px; line-height: 1.55; overflow: hidden;
}
.slide.on { display: block; }
.slide::before { /* 顶部色条：不同部分不同颜色 */
  content: ''; position: absolute; left: 0; top: 0; right: 0; height: 8px; background: var(--part);
}
.slide[data-part="open"]  { --part: #546e7a; }
.slide[data-part="linux"] { --part: #43a047; }
.slide[data-part="code"]  { --part: #8e24aa; }
.slide[data-part="build"] { --part: #6d4c41; }
.slide[data-part="dsa"]   { --part: #1e88e5; }
.slide[data-part="path"]  { --part: #e65100; }
.slide[data-part="end"]   { --part: #546e7a; }

/* 页脚：所在部分 + 页码 */
.foot { position: absolute; left: 72px; right: 72px; bottom: 16px; display: flex; justify-content: space-between; font-size: 15px; color: var(--sub); }
.foot .pn { font-variant-numeric: tabular-nums; }

h1 { font-size: 44px; margin: 0 0 18px; line-height: 1.25; }
h2 { font-size: 38px; margin: 0 0 22px; line-height: 1.25; }
h2 small { font-size: 22px; color: var(--sub); font-weight: normal; margin-left: 12px; }
h3 { font-size: 26px; margin: 0 0 8px; color: var(--part); }
p { margin: 0 0 14px; }
ul, ol { margin: 0 0 14px; padding-left: 1.3em; }
li { margin: 4px 0; }
li::marker { color: var(--part); }
b, strong { color: #000; }
.hl { color: var(--part); font-weight: bold; }
.warn { color: var(--warn); font-weight: bold; }
.ok { color: var(--ok); font-weight: bold; }
.sub { color: var(--sub); }
.small { font-size: 23px; }
.tiny { font-size: 19px; }
.center { text-align: center; }
.big { font-size: 34px; }
code { white-space: nowrap; font-family: var(--mono); background: var(--code-bg); padding: 1px 6px; border-radius: 4px; font-size: 0.92em; }

/* 版式 */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }
.cols.c3 { grid-template-columns: 1fr 1fr 1fr; gap: 26px; }
.cols.w37 { grid-template-columns: 3fr 7fr; }
.cols.w73 { grid-template-columns: 7fr 3fr; }
.cols.w46 { grid-template-columns: 4fr 6fr; }
.cols.w64 { grid-template-columns: 6fr 4fr; }
.mid { align-items: center; }
.fig { text-align: center; }
.fig img { max-width: 100%; height: 470px; object-fit: contain; }
.fig.h380 img { height: 380px; }
.fig.h300 img { height: 300px; }
.fig.h120 img { height: 150px; }
.fig.h560 img { height: 560px; }
.cap { font-size: 19px; color: var(--sub); margin-top: 6px; text-align: center; }

/* 提示框 */
.box { border-left: 6px solid var(--part); background: #f7f9fa; padding: 12px 18px; border-radius: 4px; margin: 10px 0 14px; }
.box.try { --part: #00897b; }
.box.think { --part: #fb8c00; }
.box.warnb { --part: #e53935; background: #fff5f5; }
.box.key { --part: #3949ab; }
.box > .t { font-weight: bold; color: var(--part); margin-right: 8px; }

/* 表格 */
table { border-collapse: collapse; font-size: 24px; margin: 6px 0 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 7px 14px; text-align: left; }
th { background: #f3f6f8; }
td code { white-space: nowrap; }
table.full { width: 100%; }
table.nw1 td:first-child { white-space: nowrap; }
th, td { padding: 6px 12px; }

/* 代码 */
pre { font-family: var(--mono); font-size: 24px; line-height: 1.45; background: var(--code-bg); border: 1px solid #e3e8ec; border-radius: 6px; padding: 12px 16px; margin: 0 0 14px; overflow: hidden; white-space: pre; }
pre.sm { font-size: 20px; }
pre.xs { font-size: 18px; line-height: 1.4; }
pre.term { background: #1e272c; color: #e0e6ea; border-color: #1e272c; }
pre.term .pr { color: #81c784; }
pre.term mark, pre.term mark span { color: #263238; }
pre.term .sub { color: #cfd8dc; }
.demo .panels > div { zoom: 1.45; }
.k { color: #8e24aa; font-weight: bold; } .s { color: #2e7d32; } .c { color: #90a4ae; font-style: italic; }
.n { color: #e65100; } .ty { color: #1565c0; } .pp { color: #6d4c41; }
pre mark, .mk { background: #fff59d; color: inherit; border-radius: 3px; padding: 0 2px; }

/* 分步出现 */
.step { transition: opacity .25s; }
.step.hide { opacity: 0; pointer-events: none; }
.step.dim-after.passed { opacity: .35; }

/* 章节页 */
.slide.divider { display: none; flex-direction: column; justify-content: center; background: var(--part); color: #fff; }
.slide.divider.on { display: flex; }
.slide.divider::before { display: none; }
.divider h1 { font-size: 64px; color: #fff; }
.divider p { font-size: 30px; opacity: .9; }
.divider .foot { color: rgba(255,255,255,.75); }
.divider .stage-no { font-size: 26px; letter-spacing: .3em; opacity: .8; margin-bottom: 10px; }

/* 封面 */
.slide.cover h1 { font-size: 60px; margin-top: 120px; }
.slide.cover p { font-size: 28px; color: var(--sub); }

/* 路线图里的小车阶段 */
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 10px; }
.stage { border: 2px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.stage h3 { margin-bottom: 6px; }
.stage svg { display: block; margin: 6px auto 10px; }
.stage.now { border-color: var(--part); box-shadow: 0 0 0 4px rgba(30,136,229,.15); }

/* 流程图 */
.flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 18px; }
.flow .nd { border: 2px solid var(--part); border-radius: 8px; padding: 8px 14px; background: #fff; text-align: center; }
.flow .nd small { display: block; color: var(--sub); font-size: 18px; }
.flow .ar { color: var(--sub); font-size: 28px; }
.flow .nd.fill { background: var(--part); color: #fff; }

/* 数组格子 */
.cells { display: inline-flex; margin: 8px 0; }
.cells span { width: 64px; height: 56px; border: 2px solid #78909c; margin-left: -2px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 26px; position: relative; }
.cells span::after { content: attr(data-i); position: absolute; bottom: -28px; font-size: 16px; color: var(--sub); }
.cells span.on { background: #fff59d; }

/* ---------- 交互演示 ---------- */
.demo { display: flex; flex-direction: column; gap: 6px; }
.demo .panels { display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: center; }
.demo .panels svg { display: block; }
.demo .ctl { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 17px; color: var(--sub); }
.demo .ctl button { font: inherit; font-size: 17px; padding: 3px 12px; border: 1px solid var(--line); background: #fff; border-radius: 4px; cursor: pointer; color: var(--fg); }
.demo .ctl button:hover { border-color: var(--acc); }
.demo .desc { font-size: 19px; min-height: 1.6em; text-align: center; color: var(--fg); }
.demo .bars { zoom: 1.25; }
.demo .bars svg { display: block; margin: 0 auto; }

/* ---------- 界面 ---------- */
#progress { position: fixed; left: 0; bottom: 0; height: 4px; background: #90caf9; transition: width .2s; z-index: 20; }
#help, #overview, #jump { position: fixed; z-index: 30; display: none; }
#help { inset: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 18px; align-items: center; justify-content: center; }
#help.on { display: flex; }
#help table { color: #fff; font-size: 18px; }
#help td, #help th { border-color: rgba(255,255,255,.2); background: none; }
#overview { inset: 0; background: #263238; overflow: auto; padding: 20px; }
#overview.on { display: grid; grid-template-columns: repeat(auto-fill, 256px); gap: 14px; justify-content: center; align-content: start; }
#overview .th { width: 256px; height: 144px; position: relative; overflow: hidden; cursor: pointer; outline: 3px solid transparent; border-radius: 3px; }
#overview .th.cur { outline-color: #ffca28; }
#overview .th > .slide { display: block !important; transform: scale(.2); transform-origin: 0 0; width: 1280px; height: 720px; }
#overview .th > .slide.divider { display: flex !important; }
#overview .th .no { position: absolute; right: 4px; bottom: 2px; font-size: 13px; color: #fff; background: rgba(0,0,0,.5); padding: 0 5px; border-radius: 3px; z-index: 2; }
#jump.on { display: block; left: 50%; top: 40%; transform: translateX(-50%); background: #fff; padding: 12px 16px; border-radius: 6px; font-size: 18px; }
#black { position: fixed; inset: 0; background: #000; z-index: 40; display: none; }
#black.on { display: block; }
.notes { display: none; }

/* 讲者备注抽屉（单屏时用 N 打开） */
#drawer { position: fixed; left: 0; right: 0; bottom: 0; max-height: 34vh; overflow: auto; background: rgba(255,255,255,.97); border-top: 3px solid #ffca28; padding: 10px 18px; font-size: 17px; line-height: 1.6; z-index: 25; display: none; }
#drawer.on { display: block; }
#drawer .meta { color: var(--sub); font-size: 14px; margin-bottom: 4px; }

/* ---------- 讲者窗口（?presenter） ---------- */
body.presenter { background: #1e272c; color: #eceff1; overflow: auto; }
body.presenter #deck { display: none; }
#pv { display: none; }
body.presenter #pv { display: grid; grid-template-columns: 1.35fr 1fr; grid-template-rows: auto 1fr; gap: 14px; padding: 14px; height: 100vh; }
#pv .clock { grid-column: 1 / 3; display: flex; gap: 28px; align-items: baseline; font-size: 22px; }
#pv .clock b { color: #fff; font-size: 34px; font-variant-numeric: tabular-nums; }
#pv .clock button { font: inherit; font-size: 15px; }
#pv .cur, #pv .nxt { position: relative; background: #000; }
#pv .frame { width: 1280px; height: 720px; transform-origin: 0 0; position: absolute; left: 0; top: 0; }
#pv .frame > .slide { display: block !important; }
#pv .frame > .slide.divider { display: flex !important; }
#pv .side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
#pv .nxtwrap { position: relative; }
#pv .label { font-size: 14px; color: #90a4ae; margin-bottom: 4px; }
#pv .pnotes { flex: 1; overflow: auto; background: #263238; padding: 12px 16px; font-size: 21px; line-height: 1.65; border-radius: 4px; }
#pv .pnotes li { margin: 4px 0; }

/* ---------- 打印 / 导出 PDF：每页一张 ---------- */
@media print {
  @page { size: 1280px 720px; margin: 0; }
  html, body { overflow: visible; height: auto; background: #fff; }
  #deck { position: static; transform: none !important; width: auto; height: auto; }
  .slide, .slide.divider { display: block !important; position: relative; width: 1280px; height: 720px; page-break-after: always; break-after: page; }
  .slide.divider { display: flex !important; }
  .step.hide { opacity: 1 !important; }
  #progress, #drawer, #help, #overview, #jump, #black { display: none !important; }
  .demo .ctl { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
