:root {
  --brand: #830604;
  --brand-light: #a82824;
  --brand-dim: rgba(131, 6, 4, 0.12);
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --paper: #ffffff;
  --card: #ffffff;
  --line: rgba(131, 6, 4, 0.2);
  --shadow: 0 24px 60px rgba(131, 6, 4, 0.08);
  --slide-w: 1280px;
  --slide-h: 720px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #3a3a3a;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
}

body::before {
  display: none;
}

#app {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
}

.stage-wrap {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: 100vh;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

/* ── ZJUT template layers (from example.pptx) ── */
.tpl {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.tpl img {
  position: absolute;
  display: block;
  object-fit: fill;
}

.tpl-bg-full,
.tpl-cover-building,
.tpl-toc-header,
.tpl-toc-footer,
.tpl-footer-bar {
  width: 100%;
  left: 0;
}

.tpl-bg-full {
  inset: 0;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* 5.53/7.5≈73.7% 原模板；略增高建筑区、压缩底部蓝衬 */
.tpl-cover-building {
  top: 0;
  height: 83%;
  object-fit: cover;
  object-position: center top;
  z-index: 1;
}

.tpl-header-bar {
  top: 0;
  left: 0;
  width: 66.3%;
  height: 10.4%;
}

.tpl-toc-header {
  top: 0;
  height: 31.87%;
  object-fit: cover;
  object-position: top center;
}

.tpl-footer-bar,
.tpl-toc-footer {
  bottom: 0;
  height: 7.47%;
  object-fit: fill;
}

.tpl-logo-tr {
  top: 2.2%;
  right: 1.2%;
  width: 13.1%;
  height: auto;
  max-height: 5.5%;
  object-fit: contain;
  object-position: right top;
}

.tpl-logo-br {
  bottom: 0.8%;
  right: 1.2%;
  width: 13%;
  max-height: 7%;
  object-fit: contain;
  object-position: right bottom;
}

.tpl-logo-bottom {
  bottom: 6.8%;
  left: 43.5%;
  width: 13%;
  max-height: 7%;
  transform: translateX(-50%);
  object-fit: contain;
}

.tpl-logo-center {
  top: 16.9%;
  left: 50%;
  width: 24%;
  transform: translateX(-50%);
  object-fit: contain;
}

.tpl-divider {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--brand);
  opacity: 0.35;
}

.tpl-divider-top { top: 10.27%; }
.tpl-divider-bottom { bottom: 7.47%; }

.tpl-thanks-frame {
  position: absolute;
  left: 4.3%;
  top: 8.5%;
  width: 91.4%;
  height: 84.3%;
  border: 1px solid rgba(131, 6, 4, 0.25);
  background: rgba(255, 255, 255, 0.55);
}

.slide-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 0;
}

.slide {
  position: absolute;
  inset: 0;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.slide.layout-content .slide-inner {
  padding: 10.2% 3.2% 8.4% 3.2%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 6px 14px;
}

.slide.layout-cover .slide-inner,
.slide.layout-thanks .slide-inner {
  height: 100%;
}

.slide.layout-toc .slide-inner {
  height: 100%;
  padding: 0;
}

.slide.is-active {
  pointer-events: auto;
}

.slide-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0;
  margin: 0;
  border: none;
}

.slide.layout-content .slide-bar {
  margin-top: -7.5%;
  margin-bottom: 4px;
}

.slide-section {
  font-size: clamp(14px, 1.5vw, 17px);
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.02em;
}

.slide-num {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.slide-title {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(21px, 2.25vw, 30px);
  font-weight: 700;
  color: var(--brand);
  line-height: 1.25;
}

.slide-sub {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.slide-body {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  overflow: hidden;
}

/* cover (template slide 1) */
.layout-cover .cover-inner {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.layout-cover .cover-title {
  position: absolute;
  left: 3%;
  top: 22%;
  width: 94%;
  text-align: center;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(38px, 5.6vw, 66px);
  font-weight: 900;
  color: #ffffff;
  line-height: 1.3;
  margin: 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55), 0 0 40px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.06em;
}

.layout-cover .cover-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20%;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 0 3%;
}

.layout-cover .cover-meta-item {
  font-size: 13px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid rgba(131, 6, 4, 0.45);
  border-radius: 8px;
  padding: 10px 22px;
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}

.layout-cover .slide-inner {
  position: relative;
  height: 100%;
}

/* toc (template slide 2) */
.toc-page {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.toc-slide-no {
  position: absolute;
  left: 4.5%;
  top: 7%;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(30px, 3.8vw, 44px);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.35);
  z-index: 3;
  pointer-events: none;
}

.toc-head-text {
  position: absolute;
  left: 0;
  right: 0;
  top: 8%;
  text-align: center;
  z-index: 3;
  pointer-events: none;
}

.toc-title {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(38px, 4.8vw, 52px);
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.toc-en {
  margin: 8px 0 0;
  font-size: 13px;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: rgba(255, 255, 255, 0.88);
}

.toc-en::before,
.toc-en::after {
  content: "";
  display: inline-block;
  width: 36px;
  height: 1px;
  background: rgba(255, 255, 255, 0.55);
  vertical-align: middle;
  margin: 0 12px;
}

.toc-main {
  position: absolute;
  left: 0;
  right: 0;
  top: 31.5%;
  bottom: 8.5%;
  padding: 1.5% 6% 0;
}

.toc-grid2 {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.toc-grid2::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 1px;
  background: rgba(131, 6, 4, 0.35);
  z-index: 1;
}

.toc-grid2::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 12%;
  bottom: 12%;
  width: 1px;
  background: rgba(131, 6, 4, 0.35);
  z-index: 1;
}

.toc-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 0 8%;
  z-index: 2;
}

.toc-cell[data-i="0"],
.toc-cell[data-i="2"] {
  padding-left: 12%;
}

.toc-cell[data-i="1"],
.toc-cell[data-i="3"] {
  padding-left: 10%;
}

.toc-num {
  font-family: "Noto Serif SC", serif;
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 900;
  color: rgba(131, 6, 4, 0.28);
  line-height: 1;
  flex-shrink: 0;
  min-width: 1.1em;
}

.toc-label {
  font-size: clamp(16px, 1.8vw, 20px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}

/* thanks (template slide 13) */
.layout-thanks .thanks-inner {
  display: grid;
  place-content: center;
  text-align: center;
  height: 100%;
  padding-top: 8%;
}

.layout-thanks .thanks-title {
  font-family: "Noto Serif SC", serif;
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 900;
  color: var(--brand);
  letter-spacing: 0.2em;
}

.layout-thanks .thanks-sub {
  margin-top: 20px;
  font-size: clamp(18px, 2vw, 24px);
  color: var(--brand);
  letter-spacing: 0.35em;
}

.layout-split .slide-body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr);
  gap: 16px;
  align-items: stretch;
  min-height: 0;
}

.slide-body.layout-split > .diagram-wrap {
  min-height: 0;
}

.bullet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.bullet-list li {
  position: relative;
  padding-left: 18px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}

.bullet-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  background: var(--brand);
  border-radius: 50%;
}

.cards-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.slide-body.slide-body-cards {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 10px;
  align-content: stretch;
}

.slide-body-cards .cards-4 {
  flex: 0 0 auto;
  gap: 8px;
}

.slide-body-cards .card {
  padding: 10px 12px;
}

.slide-body-cards .card-title {
  font-size: 13px;
  margin-bottom: 4px;
}

.slide-body-cards .card-text {
  font-size: 11px;
  line-height: 1.35;
}

.slide-gallery {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: center;
  justify-items: center;
}

.slide-gallery img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #111;
}

.slide-gallery-2 {
  grid-template-columns: repeat(2, 1fr);
}

.slide-body-gallery-intro {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.slide-body-gallery-intro .bullet-list-compact {
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1.45;
}

.slide-body-gallery-intro .slide-gallery {
  flex: 1 1 0;
  min-height: 180px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-radius: 2px;
}

.card .card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 6px;
}

.card .card-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.slide-body.layout-split .pairs {
  gap: 6px;
}

.slide-body.layout-split .pair {
  grid-template-columns: 78px 1fr;
  gap: 6px;
}

.slide-body.layout-split .pair dt {
  font-size: 11px;
}

.slide-body.layout-split .pair dd {
  font-size: 11px;
  line-height: 1.32;
}

.slide-body.layout-split .highlight-box {
  font-size: 10.5px;
  line-height: 1.35;
  padding: 7px 9px;
  margin-bottom: 6px;
}

.pair {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: start;
  font-size: 14px;
  line-height: 1.5;
}

.pair dt {
  font-weight: 700;
  color: var(--brand);
}

.pair dd {
  margin: 0;
  color: var(--ink);
}

.diagram-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.diagram-wrap-full {
  min-height: 0;
}

.intro-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 280px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px;
}

.intro-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* ── inline flow diagrams ── */
.flow-diagram {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10px;
  line-height: 1.28;
  color: var(--ink);
  min-height: 0;
}

.flow-caption {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  flex-shrink: 0;
}

.flow-loop-hint {
  flex-shrink: 0;
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--brand);
  padding: 3px 6px;
  background: #fff8f8;
  border: 1px dashed var(--brand);
  border-radius: 4px;
}

.flow-chain,
.flow-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 3px;
  flex: 1;
  min-height: 0;
}

.flow-chain {
  flex-wrap: wrap;
  align-items: center;
}

.flow-node {
  flex: 1 1 auto;
  min-width: 46px;
  max-width: 88px;
  padding: 6px 3px;
  text-align: center;
  font-weight: 700;
  font-size: 9px;
  line-height: 1.25;
  background: #fff8f8;
  border: 2px solid var(--brand);
  border-radius: 10px;
}

.flow-box {
  flex: 1;
  min-width: 0;
  background: #fff8f8;
  border: 2px solid var(--brand);
  border-radius: 10px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.flow-box-title {
  font-size: 11px;
  font-weight: 900;
  color: var(--brand);
}

.flow-box-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 9px;
  color: #333;
}

.flow-arrow-h,
.flow-arrow-v {
  flex-shrink: 0;
  color: var(--brand);
  font-weight: 900;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  flex: 1;
}

.flow-stack .flow-box {
  flex: 0 0 auto;
}

.flow-compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 5px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.flow-vs {
  align-self: center;
  font-size: 14px;
  font-weight: 900;
  color: var(--brand);
}

.flow-footnote {
  flex-shrink: 0;
  text-align: center;
  font-size: 9px;
  color: var(--muted);
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}

.flow-system .flow-chain {
  align-content: center;
}

.flow-system-layers {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  flex: 1;
  min-height: 0;
}

.flow-layer {
  border: 2px solid var(--brand);
  border-radius: 8px;
  background: #fffdfb;
  padding: 6px 8px;
  flex: 0 1 auto;
  min-height: 0;
}

.flow-layer-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--brand);
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.08em;
}

.flow-layer-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}

.flow-module-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.flow-module-row-nested {
  gap: 3px;
}

.flow-module {
  padding: 6px 3px;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--brand);
  border-radius: 6px;
}

.flow-process-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.flow-process-row .flow-module {
  flex: 1 1 0;
  min-width: 0;
}

.flow-detector {
  flex: 1.4 1 0;
  min-width: 0;
  border: 1.5px dashed var(--brand);
  border-radius: 8px;
  padding: 4px;
  background: #fff8f8;
}

.flow-detector-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--brand);
  text-align: center;
  margin-bottom: 3px;
}

.flow-system-layers .flow-arrow-v {
  flex-shrink: 0;
  margin: 0 auto;
}

.diagram-wrap-full .flow-diagram {
  max-height: 100%;
}

.flow-arch .flow-stack {
  justify-content: center;
}

/* Chapter 3 flow diagrams: keep generated diagrams fully visible in split slides. */
.flow-detect,
.flow-pose,
.flow-track,
.flow-kalman,
.flow-ballistic,
.flow-validate {
  justify-content: stretch;
}

.flow-detect .flow-compare,
.flow-pose .flow-row,
.flow-track .flow-row,
.flow-kalman .flow-row,
.flow-validate .flow-row {
  align-items: stretch;
}

.flow-pose .flow-box,
.flow-track .flow-box,
.flow-kalman .flow-box,
.flow-validate .flow-box {
  justify-content: center;
}

.flow-system-plan .flow-system-layers {
  justify-content: center;
}

.flow-system-plan .flow-layer {
  flex: 0 0 auto;
}

.flow-system-plan .flow-module,
.flow-system-plan .flow-detector {
  min-height: 34px;
}

.flow-ballistic {
  justify-content: center;
}

.flow-ballistic .flow-row {
  flex: 0 0 auto;
  min-height: 74px;
}

.flow-ballistic .flow-box {
  min-height: 70px;
  justify-content: center;
}

.flow-ballistic .flow-loop-hint {
  flex: 0 0 auto;
}

.flow-detect .flow-box {
  padding: 6px 7px;
}

.flow-detect .flow-box-body {
  font-size: 8.4px;
  line-height: 1.18;
}

.flow-detect .flow-footnote {
  padding-top: 2px;
}

.diagram-wrap img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: var(--brand-dim);
  color: var(--brand);
  font-weight: 700;
}

.tables-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.timeline .step {
  text-align: center;
  padding: 16px 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  font-size: 13px;
  line-height: 1.4;
}

.timeline .step strong {
  display: block;
  color: var(--brand);
  margin-bottom: 6px;
  font-size: 14px;
}

.layout-thanks {
  /* legacy selector kept */
}

.highlight-box {
  background: var(--brand-dim);
  border-left: 4px solid var(--brand);
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

.dual-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dual-images img {
  width: 100%;
  border-radius: 2px;
  border: 1px solid var(--line);
}

/* chrome */
.chrome {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chrome button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s;
}

.chrome button:hover {
  background: var(--brand);
  border-color: var(--brand);
}

.progress-dots {
  display: flex;
  gap: 4px;
  max-width: 280px;
  overflow: hidden;
}

.progress-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  transition: background 0.25s, transform 0.25s;
}

.progress-dots span.active {
  background: var(--brand-light);
  transform: scale(1.3);
}

.slide-counter {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
  min-width: 64px;
  text-align: center;
}

.hint {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.05em;
}

.anim-item {
  opacity: 0;
  transform: translateY(18px);
}

@media (max-width: 900px) {
  .slide {
    padding: 0;
  }

  .layout-split .slide-body,
  .tables-2,
  .cards-4,
  .timeline,
  .layout-cover .cover-meta {
    flex-wrap: wrap;
    bottom: 14%;
  }

  .layout-cover .cover-meta-item {
    flex: 1 1 100%;
    text-align: center;
  }

  .toc-main {
    top: 34%;
    padding: 2% 4%;
  }

  .toc-grid2 {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, 1fr);
  }

  .toc-grid2::before,
  .toc-grid2::after {
    display: none;
  }

  .toc-cell {
    padding: 0 4% !important;
  }
}
