* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--letterbox);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow: hidden;
  height: 100%;
}

.app { display: flex; height: 100vh; }

/* ---------- Left rail: outline tree (UI chrome, not part of the slide canvas) ---------- */
.rail {
  width: 264px;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  background: #1c1c19;
  border-right: 1px solid #333;
  padding: 28px 0;
  display: flex;
  flex-direction: column;
}

.rail-brand {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.14em;
  padding: 0 24px 22px;
  color: #f0f0ea;
}
.rail-brand span { color: var(--accent); }

.rail-version { padding: 0 24px 16px; }
.rail-version select {
  width: 100%;
  background: #262622;
  color: #f0f0ea;
  border: 1px solid #3a3a35;
  border-radius: var(--radius);
  padding: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.rail-nav { flex: 1; overflow-y: auto; padding: 0 10px; }

.rail-link {
  display: block;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: #a3a39a;
  text-decoration: none;
  line-height: 1.4;
  border-left: 2px solid transparent;
  cursor: pointer;
}
.rail-link:hover { color: #f0f0ea; background: #262622; }
.rail-link.active { color: #f0f0ea; border-left-color: var(--accent); background: #262622; }
.rail-link[data-hidden="true"] { display: none; }

.rail-footer {
  padding: 16px 24px 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #6a6a62;
  border-top: 1px solid #333;
  margin-top: 14px;
}
.rail-footer .row { display: flex; gap: 8px; margin-top: 8px; }
.rail-footer button {
  background: none;
  border: 1px solid #3a3a35;
  color: #a3a39a;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 6px 9px;
  border-radius: var(--radius);
  cursor: pointer;
}
.rail-footer button:hover { color: #f0f0ea; border-color: #666; }

/* ---------- Stage: fixed 16:9 canvas, transform-scaled to fit ---------- */
.stage {
  flex: 1;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--letterbox);
}

.stage-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--canvas-w) * 1px);
  height: calc(var(--canvas-h) * 1px);
  transform-origin: center center;
  /* transform set by JS: translate(-50%,-50%) scale(s) */
}

.slide {
  position: absolute;
  inset: 0;
  width: 1920px;
  height: 1080px;
  background: var(--bg);
  color: var(--text-primary);
  padding: 100px 120px;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.slide.is-active { display: flex; }

.slide-tag {
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 28px;
}
.slide-tag .tag-num { color: var(--text-tertiary); margin-right: 4px; }

/* Punchline typography — Chinese headlines use Noto Sans TC 700
   (Bebas Neue has no CJK glyphs — reserved for numerals/Latin accents only,
   matching the design system's own logo treatment). Line breaks are
   hand-placed in the markup; width is generous px (not ch) so CJK never
   re-wraps mid-phrase. */
h1.punch {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: 0.01em;
  margin: 0 0 28px;
  color: var(--text-primary);
  width: 100%;
}
h1.punch .hl { color: var(--accent); }
h1.punch .num { font-family: var(--font-display); font-weight: 400; }

.punch-xl { font-size: 110px; max-width: 1600px; }
.punch-lg { font-size: 78px; max-width: 1500px; }
.punch-md { font-size: 60px; max-width: 1550px; }
.punch-sm { font-size: 46px; max-width: 1600px; }

/* Lead line — the demoted/setup clause that precedes the real punchline.
   Small-to-big reading order builds toward the point that should land. */
.punch-lead {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 30px;
  color: var(--text-tertiary);
  margin: 0 0 14px;
  line-height: 1.4;
}

.subline {
  font-family: var(--font-mono);
  font-size: 26px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  margin-bottom: 40px;
}

/* Body content */
.bullets { list-style: none; padding: 0; margin: 0 0 32px; max-width: 60ch; }
.bullets li {
  font-size: 29px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 26px;
  padding-left: 32px;
  position: relative;
}
.bullets li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.65em;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
}
.bullets li strong { color: var(--text-primary); font-weight: 700; }
.bullets.tight li { font-size: 22px; margin-bottom: 12px; }

.note {
  font-size: 19px;
  color: var(--text-tertiary);
  border-left: 3px solid var(--border);
  padding-left: 20px;
  margin-top: 24px;
  max-width: 70ch;
  line-height: 1.7;
}
.note.flag-warn { border-left-color: var(--status-warn); color: var(--status-warn); }

/* Cover-specific */
.slide-cover { justify-content: center; }
.slide-cover .body-row { flex: none; }
.slide-cover .eyebrow {
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.2em;
  color: var(--text-tertiary);
  margin-bottom: 20px;
}
.cover-stats {
  flex: 0.6;
  border-left: 1px solid var(--border);
  padding-left: 64px;
  margin-left: 24px;
  gap: 40px;
  justify-content: center;
}
.slide-cover .col.wide { flex: 1.6; }
.cover-stat { display: flex; flex-direction: column; }
.cover-stat .v {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 44px;
  color: var(--text-primary);
  line-height: 1;
}
.cover-stat .v .num { font-family: var(--font-display); font-size: 52px; color: var(--accent); }
.cover-stat .l { font-family: var(--font-mono); font-size: 15px; color: var(--text-tertiary); margin-top: 8px; }

/* Breather / axis pages get a bolder chapter mark */
.slide-axis .slide-tag { font-size: 24px; margin-bottom: 40px; }
.slide-axis .punch { margin-bottom: 40px; }

/* Body row: fills remaining vertical space below headline, no dead space */
.body-row { flex: 1; display: flex; min-height: 0; }
.body-row.cols-2 { gap: 72px; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.col.narrow { flex: 0.85; }
.col.wide { flex: 1.15; }

/* Placeholder visuals */
.placeholder-visual {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 17px;
  background: var(--bg-card-alt);
}
.placeholder-visual .ph-label {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--status-warn);
  color: var(--status-warn);
  border-radius: 3px;
  font-size: 13px;
  margin-bottom: 12px;
  letter-spacing: 0.08em;
}

.real-asset { display: flex; flex-direction: column; }
.real-asset img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}
.real-asset .caption {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-tertiary);
  margin-top: 12px;
}
.real-asset.fill { flex: 1; min-height: 0; }
.real-asset.fill img { width: 100%; height: 100%; max-height: none; object-fit: cover; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }

/* ---------- Nav controls ---------- */
.stage-nav {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 5;
}
.stage-nav button {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid #444;
  background: rgba(0,0,0,0.35);
  color: #f0f0ea;
  font-family: var(--font-mono);
  cursor: pointer;
  font-size: 16px;
}
.stage-nav button:hover { background: rgba(0,0,0,0.55); }
.stage-nav .counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #cfcfc8;
  background: rgba(0,0,0,0.35);
  padding: 8px 14px;
  border-radius: 20px;
}

@media (max-width: 900px) {
  .rail { position: fixed; z-index: 10; transform: translateX(-100%); transition: transform .2s; }
  .rail.open { transform: translateX(0); }
}

/* Print mode: unroll all slides sequentially, ignore pagination JS.
   Page size is set to the deck's native 16:9 canvas (@page below) instead of
   A4/Letter, so slides print at their authored pixel sizes with no reflow —
   this is what makes it WYSIWYG instead of re-wrapping into a narrower page. */
@media print {
  html, body { overflow: visible; height: auto; background: #fff; margin: 0; }
  .app { display: block; height: auto; }
  .rail, .stage-nav { display: none !important; }
  .stage { overflow: visible; height: auto; background: #fff; }
  .stage-inner { position: static; transform: none !important; width: auto; height: auto; }
  .slide {
    display: flex !important;
    position: static;
    page-break-after: always;
    break-after: page;
  }
}

@page {
  size: 20in 11.25in; /* 1920×1080 canvas at 96 CSS px/in — matches the on-screen design 1:1 */
  margin: 0;
}
