:root {
  --bg-app: #eae6dc;
  --bg-sidebar: #f3efe6;
  --slide-bg: #f8f6f0;
  --slide-bg-tint: #f1ede2;
  --slide-surface: rgba(255, 255, 255, 0.88);
  --slide-subtle: rgba(238, 233, 221, 0.78);
  --border: #dcd4c4;
  --border-strong: #c2b8a3;
  --ink: #182c42;
  --text: #243342;
  --text-secondary: #485868;
  --text-muted: #707d8a;
  --navy: #1b365d;
  --navy-soft: rgba(27, 54, 93, 0.10);
  --gold: #b87d28;
  --gold-soft: rgba(184, 125, 40, 0.13);
  --sage: #2e6b5a;
  --sage-soft: rgba(46, 107, 90, 0.12);
  --terra: #a6463c;
  --terra-soft: rgba(166, 70, 60, 0.11);
  --aura-1: rgba(184, 125, 40, 0.11);
  --aura-2: rgba(27, 54, 93, 0.09);
  --closing-bg: #17202b;
  --closing-bg-2: #243244;
  --closing-text: #f5f1e8;
  --closing-muted: #b9c4cf;
  --closing-gold: #dfab56;
  --shadow-slide: 0 18px 46px rgba(20, 30, 42, 0.11), 0 2px 8px rgba(20, 30, 42, 0.05);
  --sidebar-w: 296px;
}

/* ==================== 14 PERSONALIZED DECK COLOR PALETTES ==================== */
[data-deck-theme="01"] {
  --slide-bg: #f9f6ef; --slide-bg-tint: #f0eadc;
  --ink: #162b49; --navy: #1b3b68; --navy-soft: rgba(27, 59, 104, 0.10);
  --gold: #c28224; --gold-soft: rgba(194, 130, 36, 0.14);
  --sage: #2d6d60; --sage-soft: rgba(45, 109, 96, 0.12);
  --aura-1: rgba(194, 130, 36, 0.13); --aura-2: rgba(27, 59, 104, 0.10);
  --closing-bg: #141e2e; --closing-bg-2: #223552;
}
[data-deck-theme="02"] {
  --slide-bg: #f2f7f9; --slide-bg-tint: #e5eff3;
  --border: #cddce2; --border-strong: #b0c6cf;
  --ink: #123440; --navy: #0f5264; --navy-soft: rgba(15, 82, 100, 0.11);
  --gold: #63489a; --gold-soft: rgba(99, 72, 154, 0.13);
  --sage: #0e7c6b; --sage-soft: rgba(14, 124, 107, 0.12);
  --terra: #b5495b; --terra-soft: rgba(181, 73, 91, 0.11);
  --aura-1: rgba(14, 124, 107, 0.12); --aura-2: rgba(99, 72, 154, 0.11);
  --closing-bg: #11222b; --closing-bg-2: #1f3a47; --closing-gold: #7fd4c4;
}
[data-deck-theme="03"] {
  --slide-bg: #f4f7f2; --slide-bg-tint: #e7efe3;
  --border: #cedbcf; --border-strong: #b3c6b5;
  --ink: #1c382b; --navy: #285440; --navy-soft: rgba(40, 84, 64, 0.11);
  --gold: #9e6d30; --gold-soft: rgba(158, 109, 48, 0.13);
  --sage: #3d7a5a; --sage-soft: rgba(61, 122, 90, 0.13);
  --aura-1: rgba(61, 122, 90, 0.13); --aura-2: rgba(158, 109, 48, 0.10);
  --closing-bg: #15261e; --closing-bg-2: #244033; --closing-gold: #a8d8b9;
}
[data-deck-theme="04"] {
  --slide-bg: #f9f4f0; --slide-bg-tint: #f2e7df;
  --border: #e2d1c6; --border-strong: #cbb4a5;
  --ink: #243046; --navy: #2b446b; --navy-soft: rgba(43, 68, 107, 0.11);
  --gold: #cf533e; --gold-soft: rgba(207, 83, 62, 0.13);
  --sage: #2e6f73; --sage-soft: rgba(46, 111, 115, 0.12);
  --aura-1: rgba(207, 83, 62, 0.13); --aura-2: rgba(43, 68, 107, 0.10);
  --closing-bg: #1c2434; --closing-bg-2: #313e57; --closing-gold: #ef836d;
}
[data-deck-theme="05"] {
  --slide-bg: #f1f6f6; --slide-bg-tint: #e3eeee;
  --border: #cbdada; --border-strong: #aec4c4;
  --ink: #163642; --navy: #1b4b5c; --navy-soft: rgba(27, 75, 92, 0.11);
  --gold: #267872; --gold-soft: rgba(38, 120, 114, 0.13);
  --sage: #38765c; --sage-soft: rgba(56, 118, 92, 0.12);
  --aura-1: rgba(38, 120, 114, 0.13); --aura-2: rgba(184, 125, 40, 0.09);
  --closing-bg: #12262e; --closing-bg-2: #1e3f4b; --closing-gold: #7fd1c8;
}
[data-deck-theme="06"] {
  --slide-bg: #fbf6ec; --slide-bg-tint: #f4ead7;
  --border: #e4d5bc; --border-strong: #cbb795;
  --ink: #332417; --navy: #5c3a1e; --navy-soft: rgba(92, 58, 30, 0.10);
  --gold: #c96818; --gold-soft: rgba(201, 104, 24, 0.14);
  --sage: #2d6e5e; --sage-soft: rgba(45, 110, 94, 0.12);
  --aura-1: rgba(201, 104, 24, 0.14); --aura-2: rgba(45, 110, 94, 0.09);
  --closing-bg: #241911; --closing-bg-2: #3d2a1b; --closing-gold: #f2a359;
}
[data-deck-theme="07"] {
  --slide-bg: #f3f6fa; --slide-bg-tint: #e6eef6;
  --border: #cedae6; --border-strong: #b1c2d4;
  --ink: #163047; --navy: #1f496e; --navy-soft: rgba(31, 73, 110, 0.11);
  --gold: #bd782e; --gold-soft: rgba(189, 120, 46, 0.14);
  --sage: #2f7066; --sage-soft: rgba(47, 112, 102, 0.12);
  --aura-1: rgba(31, 73, 110, 0.12); --aura-2: rgba(189, 120, 46, 0.12);
  --closing-bg: #132333; --closing-bg-2: #223d57; --closing-gold: #eab36b;
}
[data-deck-theme="08"] {
  --slide-bg: #f9f4f6; --slide-bg-tint: #f1e6eb;
  --border: #dfd0d7; --border-strong: #c8b2bc;
  --ink: #381e2e; --navy: #5c2b47; --navy-soft: rgba(92, 43, 71, 0.11);
  --gold: #a66f27; --gold-soft: rgba(166, 111, 39, 0.14);
  --sage: #35695c; --sage-soft: rgba(53, 105, 92, 0.12);
  --aura-1: rgba(154, 56, 87, 0.12); --aura-2: rgba(166, 111, 39, 0.11);
  --closing-bg: #261520; --closing-bg-2: #422437; --closing-gold: #e6b26a;
}
[data-deck-theme="09"] {
  --slide-bg: #f2f5fa; --slide-bg-tint: #e5ecf6;
  --border: #ced8e8; --border-strong: #b2c1d8;
  --ink: #172a45; --navy: #1e4273; --navy-soft: rgba(30, 66, 115, 0.11);
  --gold: #2667a8; --gold-soft: rgba(38, 103, 168, 0.13);
  --sage: #1e785a; --sage-soft: rgba(30, 120, 90, 0.12);
  --aura-1: rgba(38, 103, 168, 0.12); --aura-2: rgba(30, 120, 90, 0.10);
  --closing-bg: #121f33; --closing-bg-2: #1f3659; --closing-gold: #7bb3f0;
}
[data-deck-theme="10"] {
  --slide-bg: #f3f7fb; --slide-bg-tint: #e6eff8;
  --border: #cde0ee; --border-strong: #b0cbe0;
  --ink: #18344c; --navy: #205278; --navy-soft: rgba(32, 82, 120, 0.11);
  --gold: #6c4f94; --gold-soft: rgba(108, 79, 148, 0.13);
  --sage: #2b7a78; --sage-soft: rgba(43, 122, 120, 0.12);
  --aura-1: rgba(43, 122, 120, 0.12); --aura-2: rgba(108, 79, 148, 0.11);
  --closing-bg: #152636; --closing-bg-2: #24415c; --closing-gold: #9dc8eb;
}
[data-deck-theme="11"] {
  --slide-bg: #faf4f2; --slide-bg-tint: #f2e6e1;
  --border: #e2d1cb; --border-strong: #cbb3aa;
  --ink: #3c2220; --navy: #6b332e; --navy-soft: rgba(107, 51, 46, 0.11);
  --gold: #ad5245; --gold-soft: rgba(173, 82, 69, 0.13);
  --sage: #446e49; --sage-soft: rgba(68, 110, 73, 0.12);
  --aura-1: rgba(173, 82, 69, 0.12); --aura-2: rgba(68, 110, 73, 0.11);
  --closing-bg: #261716; --closing-bg-2: #422826; --closing-gold: #e89b8c;
}
[data-deck-theme="12"] {
  --slide-bg: #f6f4fa; --slide-bg-tint: #ebe6f4;
  --border: #d8d0e6; --border-strong: #bfb3d4;
  --ink: #272042; --navy: #42336e; --navy-soft: rgba(66, 51, 110, 0.11);
  --gold: #6a4ca6; --gold-soft: rgba(106, 76, 166, 0.13);
  --sage: #2f7068; --sage-soft: rgba(47, 112, 104, 0.12);
  --aura-1: rgba(106, 76, 166, 0.13); --aura-2: rgba(189, 125, 46, 0.11);
  --closing-bg: #1c1730; --closing-bg-2: #312854; --closing-gold: #cbb2f5;
}
[data-deck-theme="13"] {
  --slide-bg: #f1f5f4; --slide-bg-tint: #e3ecea;
  --border: #cad8d4; --border-strong: #adc2bc;
  --ink: #162925; --navy: #1b453d; --navy-soft: rgba(27, 69, 61, 0.11);
  --gold: #0f766e; --gold-soft: rgba(15, 118, 110, 0.13);
  --sage: #2b6e52; --sage-soft: rgba(43, 110, 82, 0.12);
  --terra: #c26d1f; --terra-soft: rgba(194, 109, 31, 0.12);
  --aura-1: rgba(15, 118, 110, 0.13); --aura-2: rgba(194, 109, 31, 0.11);
  --closing-bg: #101c1a; --closing-bg-2: #1c332f; --closing-gold: #5eead4;
}
[data-deck-theme="14"] {
  --slide-bg: #f7f3ea; --slide-bg-tint: #eee7d8;
  --ink: #2c251d; --navy: #4a3d2e; --navy-soft: rgba(74, 61, 46, 0.11);
  --gold: #946632; --gold-soft: rgba(148, 102, 50, 0.14);
  --aura-1: rgba(148, 102, 50, 0.12); --aura-2: rgba(61, 90, 108, 0.10);
  --closing-bg: #211c17; --closing-bg-2: #383027;
}

/* Dark Theme Adaptation */
[data-theme="dark"],
[data-theme="dark"] [data-deck-theme] {
  --bg-app: #0f1318;
  --bg-sidebar: #151a21;
  --slide-bg: #192029;
  --slide-bg-tint: #202935;
  --slide-surface: rgba(34, 43, 54, 0.88);
  --slide-subtle: rgba(41, 51, 64, 0.82);
  --border: #2f3b4a;
  --border-strong: #435366;
  --ink: #eff2f6;
  --text: #e3e8ee;
  --text-secondary: #b4c0cc;
  --text-muted: #8492a0;
  --navy: #7eb8da;
  --navy-soft: rgba(126, 184, 218, 0.15);
  --gold: #e0ad58;
  --gold-soft: rgba(224, 173, 88, 0.16);
  --sage: #6ec4a7;
  --sage-soft: rgba(110, 196, 167, 0.15);
  --terra: #e08379;
  --terra-soft: rgba(224, 131, 121, 0.15);
  --shadow-slide: 0 20px 54px rgba(0, 0, 0, 0.50);
}

/* ==================== 6 PER-SLIDE PERSONALIZED VISUAL VARIANTS ==================== */
.slide-sheet.slide-var-0 {
  background: radial-gradient(circle at 92% 10%, var(--aura-1) 0%, transparent 46%),
              radial-gradient(circle at 8% 92%, var(--aura-2) 0%, transparent 42%),
              var(--slide-bg);
}
.slide-sheet.slide-var-1 {
  background: linear-gradient(135deg, var(--slide-bg) 0%, var(--slide-bg-tint) 100%);
  border-left: 5px solid var(--gold);
}
.slide-sheet.slide-var-2 {
  background: radial-gradient(ellipse at 50% 0%, var(--aura-2) 0%, transparent 55%),
              var(--slide-bg);
  border-top: 4px solid var(--navy);
}
.slide-sheet.slide-var-3 {
  background: radial-gradient(circle at 12% 14%, var(--aura-1) 0%, transparent 44%),
              radial-gradient(circle at 88% 86%, var(--sage-soft) 0%, transparent 46%),
              var(--slide-bg);
}
.slide-sheet.slide-var-4 {
  background: linear-gradient(180deg, var(--slide-bg-tint) 0%, var(--slide-bg) 32%, var(--slide-bg) 100%);
  box-shadow: inset 0 0 0 8px var(--slide-bg), inset 0 0 0 9px var(--border), var(--shadow-slide);
}
.slide-sheet.slide-var-5 {
  background: radial-gradient(circle at 85% 50%, var(--aura-1) 0%, transparent 52%),
              radial-gradient(circle at 15% 80%, var(--aura-2) 0%, transparent 48%),
              var(--slide-bg-tint);
}

.slide-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0.52;
}
.slide-sheet > *:not(.slide-watermark) {
  position: relative;
  z-index: 1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  background: var(--bg-app);
  color: var(--text);
  font-family: "Be Vietnam Pro", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14.5px;
  line-height: 1.58;
  overflow-x: clip;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s ease, color 0.3s ease;
}

svg {
  max-width: 100%;
  height: auto;
}

/* Progress Track */
.progress-track {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3.5px;
  background: var(--border);
  z-index: 130;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--gold), var(--sage));
  width: 0%;
  transition: width 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: 3.5px;
}

/* Sidebar & Mobile Backdrop Scrim */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 26, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 75;
  opacity: 0;
  transition: opacity 0.26s ease;
}
.sidebar-backdrop.visible {
  display: block;
  opacity: 1;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 3.5px; bottom: 0; left: 0;
  z-index: 80;
  transition: transform 0.30s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header {
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--slide-surface);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.sidebar-kicker {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--gold);
}
.sidebar-title {
  font-family: "Newsreader", "Playfair Display", Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 3px;
  line-height: 1.28;
  padding-right: 28px;
}
.sidebar-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
  background: var(--slide-subtle);
}
.sidebar-tab {
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
}
.sidebar-tab.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
  background: var(--bg-sidebar);
}

.nav-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 10px 10px calc(24px + env(safe-area-inset-bottom, 0px));
}
.nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 8px 5px;
}
.deck-nav-item, .page-nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.38;
  margin-bottom: 3px;
  transition: all 0.16s ease;
}
.deck-nav-item:hover, .page-nav-item:hover {
  background: var(--slide-subtle);
  color: var(--ink);
}
.deck-nav-item.active, .page-nav-item.active {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--ink);
  font-weight: 500;
}
.nav-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
}
.nav-count-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--slide-subtle);
  padding: 1px 6px;
  border-radius: 99px;
  flex-shrink: 0;
}

/* Stage */
.stage-wrap {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 3.5px);
  min-height: calc(100dvh - 3.5px);
  transition: margin-left 0.30s cubic-bezier(0.16, 1, 0.3, 1);
}
.stage-wrap.expanded { margin-left: 0; }

/* Topbar */
.topbar {
  min-height: 52px;
  padding: 8px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 3.5px;
  z-index: 45;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ctrl-btn {
  background: var(--slide-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 6px 11px;
  min-height: 35px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.18s ease;
}
.ctrl-btn:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--ink);
  transform: translateY(-1px);
}
.ctrl-btn:disabled { opacity: 0.38; cursor: not-allowed; }
.ctrl-btn-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}
.ctrl-btn-gold {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--ink);
  font-weight: 600;
}
.ctrl-btn-gold:hover:not(:disabled) {
  background: var(--gold);
  border-color: var(--gold);
  color: #ffffff;
}
[data-theme="dark"] .ctrl-btn-primary { color: #10161c; }

.page-indicator {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dual-Version Segmented Switcher (Đơn giản 296 ↔ Minh họa 739) */
.version-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--slide-subtle);
  gap: 2px;
  flex-shrink: 0;
}
.version-pill {
  padding: 4px 9px;
  min-height: 30px;
  border-radius: 7px;
  font-size: 11.8px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.version-pill:hover {
  color: var(--ink);
  background: var(--slide-surface);
}
.version-pill.active {
  background: var(--navy);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 24, 36, 0.14);
}
[data-theme="dark"] .version-pill.active {
  color: #10161c;
}

/* Mobile Thumb-Zone Bottom Bar (hidden on Desktop/Tablet >= 700px) */
.mobile-bottom-nav {
  display: none;
}

/* Slide Canvas Container & Dual-Layer Transition Stage */
.deck-stage {
  flex: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 26px 28px;
}

.slide-transition-box {
  width: 100%;
  max-width: 1180px;
  position: relative;
  perspective: 1600px;
}

/* Widescreen Editorial Slide Sheet */
.slide-sheet {
  width: 100%;
  min-height: 640px;
  background: var(--slide-bg);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow-slide);
  padding: 34px 44px 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  will-change: transform, opacity, clip-path;
  backface-visibility: hidden;
}

/* ==================== 8 RANDOMIZED CINEMA SLIDE TRANSITIONS ==================== */
.slide-leave-layer {
  position: absolute !important;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.fx-glide-in-next { animation: fxGlideInNext 0.48s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-glide-out-next { animation: fxGlideOutNext 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.fx-glide-in-prev { animation: fxGlideInPrev 0.48s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-glide-out-prev { animation: fxGlideOutPrev 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes fxGlideInNext { from { opacity: 0; transform: translate3d(58px, 0, 0) scale(0.98); } to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } }
@keyframes fxGlideOutNext { from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } to { opacity: 0; transform: translate3d(-52px, 0, 0) scale(0.98); } }
@keyframes fxGlideInPrev { from { opacity: 0; transform: translate3d(-58px, 0, 0) scale(0.98); } to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } }
@keyframes fxGlideOutPrev { from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } to { opacity: 0; transform: translate3d(52px, 0, 0) scale(0.98); } }

.fx-cube-in-next { transform-origin: left center; animation: fxCubeInNext 0.54s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-cube-out-next { transform-origin: right center; animation: fxCubeOutNext 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.fx-cube-in-prev { transform-origin: right center; animation: fxCubeInPrev 0.54s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-cube-out-prev { transform-origin: left center; animation: fxCubeOutPrev 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes fxCubeInNext { from { opacity: 0; transform: translate3d(38px, 0, -50px) rotateY(-16deg); } to { opacity: 1; transform: translate3d(0, 0, 0) rotateY(0deg); } }
@keyframes fxCubeOutNext { from { opacity: 1; transform: rotateY(0deg); } to { opacity: 0; transform: translate3d(-38px, 0, -50px) rotateY(14deg); } }
@keyframes fxCubeInPrev { from { opacity: 0; transform: translate3d(-38px, 0, -50px) rotateY(16deg); } to { opacity: 1; transform: translate3d(0, 0, 0) rotateY(0deg); } }
@keyframes fxCubeOutPrev { from { opacity: 1; transform: rotateY(0deg); } to { opacity: 0; transform: translate3d(38px, 0, -50px) rotateY(-14deg); } }

.fx-flip-in-next, .fx-flip-in-prev { transform-origin: center bottom; animation: fxFlipIn 0.52s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-flip-out-next, .fx-flip-out-prev { transform-origin: center top; animation: fxFlipOut 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes fxFlipIn { from { opacity: 0; transform: translate3d(0, 32px, -30px) rotateX(12deg); } to { opacity: 1; transform: translate3d(0, 0, 0) rotateX(0deg); } }
@keyframes fxFlipOut { from { opacity: 1; transform: rotateX(0deg); } to { opacity: 0; transform: translate3d(0, -28px, -30px) rotateX(-10deg); } }

.fx-zoom-in-next { animation: fxZoomInNext 0.50s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-zoom-out-next { animation: fxZoomOutNext 0.40s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.fx-zoom-in-prev { animation: fxZoomInPrev 0.50s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-zoom-out-prev { animation: fxZoomOutPrev 0.40s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes fxZoomInNext { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes fxZoomOutNext { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.06); } }
@keyframes fxZoomInPrev { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: scale(1); } }
@keyframes fxZoomOutPrev { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.92); } }

.fx-wipe-in-next { animation: fxWipeInNext 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards; z-index: 3; }
.fx-wipe-out-next { animation: fxFadeHold 0.46s ease forwards; }
.fx-wipe-in-prev { animation: fxWipeInPrev 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards; z-index: 3; }
.fx-wipe-out-prev { animation: fxFadeHold 0.46s ease forwards; }
@keyframes fxWipeInNext { from { clip-path: inset(0 0 0 100%); transform: translateX(14px); } to { clip-path: inset(0 0 0 0); transform: translateX(0); } }
@keyframes fxWipeInPrev { from { clip-path: inset(0 100% 0 0); transform: translateX(-14px); } to { clip-path: inset(0 0 0 0); transform: translateX(0); } }
@keyframes fxFadeHold { from { opacity: 1; transform: scale(1); } to { opacity: 0.15; transform: scale(0.985); } }

.fx-iris-in-next, .fx-iris-in-prev { animation: fxIrisIn 0.58s cubic-bezier(0.16, 1, 0.3, 1) forwards; z-index: 3; }
.fx-iris-out-next, .fx-iris-out-prev { animation: fxFadeHold 0.48s ease forwards; }
@keyframes fxIrisIn { from { clip-path: circle(6% at 50% 50%); opacity: 0.4; } to { clip-path: circle(145% at 50% 50%); opacity: 1; } }

.fx-diag-in-next { animation: fxDiagInNext 0.50s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-diag-out-next { animation: fxDiagOutNext 0.40s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.fx-diag-in-prev { animation: fxDiagInPrev 0.50s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-diag-out-prev { animation: fxDiagOutPrev 0.40s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes fxDiagInNext { from { opacity: 0; transform: translate3d(40px, 20px, 0) rotate(1.1deg) scale(0.98); } to { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg) scale(1); } }
@keyframes fxDiagOutNext { from { opacity: 1; transform: rotate(0deg); } to { opacity: 0; transform: translate3d(-38px, -18px, 0) rotate(-1deg) scale(0.98); } }
@keyframes fxDiagInPrev { from { opacity: 0; transform: translate3d(-40px, -20px, 0) rotate(-1.1deg) scale(0.98); } to { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg) scale(1); } }
@keyframes fxDiagOutPrev { from { opacity: 1; transform: rotate(0deg); } to { opacity: 0; transform: translate3d(38px, 18px, 0) rotate(1deg) scale(0.98); } }

.fx-swing-in-next, .fx-swing-in-prev { transform-origin: top left; animation: fxSwingIn 0.52s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-swing-out-next, .fx-swing-out-prev { transform-origin: bottom right; animation: fxSwingOut 0.40s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes fxSwingIn { from { opacity: 0; transform: rotate(-1.8deg) translateY(20px) scale(0.98); } to { opacity: 1; transform: rotate(0deg) translateY(0) scale(1); } }
@keyframes fxSwingOut { from { opacity: 1; transform: rotate(0deg); } to { opacity: 0; transform: rotate(1.5deg) translateY(-16px) scale(0.98); } }

/* Vertical Touch Swipe / Pull Transitions */
.fx-vslide-in-next { animation: fxVSlideInNext 0.44s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-vslide-out-next { animation: fxVSlideOutNext 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.fx-vslide-in-prev { animation: fxVSlideInPrev 0.44s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fx-vslide-out-prev { animation: fxVSlideOutPrev 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes fxVSlideInNext { from { opacity: 0; transform: translate3d(0, 56px, 0) scale(0.985); } to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } }
@keyframes fxVSlideOutNext { from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } to { opacity: 0; transform: translate3d(0, -48px, 0) scale(0.985); } }
@keyframes fxVSlideInPrev { from { opacity: 0; transform: translate3d(0, -56px, 0) scale(0.985); } to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } }
@keyframes fxVSlideOutPrev { from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } to { opacity: 0; transform: translate3d(0, 48px, 0) scale(0.985); } }

.pull-page-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) scale(0.94);
  padding: 7px 15px;
  border-radius: 99px;
  background: var(--slide-surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid var(--border-strong);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(15, 23, 34, 0.16);
  z-index: 210;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.pull-page-hint.pos-top {
  top: calc(56px + env(safe-area-inset-top, 0px));
}
.pull-page-hint.pos-bottom {
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}
body.presentation-mode .pull-page-hint.pos-top {
  top: max(18px, env(safe-area-inset-top, 18px));
}
body.presentation-mode .pull-page-hint.pos-bottom {
  bottom: calc(68px + env(safe-area-inset-bottom, 10px));
}
.pull-page-hint.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.pull-page-hint.armed {
  background: var(--navy);
  border-color: var(--gold);
  color: #ffffff;
}
[data-theme="dark"] .pull-page-hint.armed {
  color: #10161c;
}

.slide-enter-neutral { animation: fxZoomInNext 0.44s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* ==================== 4 RANDOMIZED INNER STAGGER CHOREOGRAPHIES ==================== */
.sheet-top {
  margin-bottom: 18px;
  animation: headerReveal 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes headerReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stagger-item {
  animation-duration: 0.50s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  animation-fill-mode: both;
  animation-delay: calc(60ms + var(--i, 0) * 65ms);
}
.stagger-mode-0 .stagger-item { animation-name: stgRise; }
.stagger-mode-1 .stagger-item { animation-name: stgFanRight; }
.stagger-mode-2 .stagger-item { animation-name: stgPopSpring; }
.stagger-mode-3 .stagger-item { animation-name: stgTiltUnfold; }

@keyframes stgRise { from { opacity: 0; transform: translate3d(0, 16px, 0) scale(0.985); } to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } }
@keyframes stgFanRight { from { opacity: 0; transform: translate3d(-18px, 6px, 0) rotate(-0.6deg); } to { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg); } }
@keyframes stgPopSpring { 0% { opacity: 0; transform: scale(0.93); } 70% { opacity: 1; transform: scale(1.01); } 100% { opacity: 1; transform: scale(1); } }
@keyframes stgTiltUnfold { from { opacity: 0; transform: perspective(800px) rotateX(10deg) translateY(12px); } to { opacity: 1; transform: perspective(800px) rotateX(0deg) translateY(0); } }

.eq-op {
  font-family: "Newsreader", Georgia, serif;
  font-size: 30px;
  font-weight: 600;
  color: var(--gold);
  padding: 0 4px;
  text-align: center;
  animation: opPop 0.46s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 180ms;
}
@keyframes opPop { from { opacity: 0; transform: scale(0.70); } to { opacity: 1; transform: scale(1); } }

/* Ambient Living SVG Micro-Animations */
.svg-orbit { transform-origin: 100px 100px; animation: slowOrbit 34s linear infinite; }
.svg-pulse { transform-origin: 50% 50%; animation: softPulse 5.2s ease-in-out infinite; }
.svg-pulse-delayed { transform-origin: 50% 50%; animation: softPulse 5.2s ease-in-out 1.6s infinite; }
.svg-sway { transform-origin: 100px 150px; animation: gentleSway 6s ease-in-out infinite; }
.svg-float { animation: gentleFloat 4.6s ease-in-out infinite; }
.svg-flow { stroke-dasharray: 7 5; animation: dashFlow 11s linear infinite; }

@keyframes slowOrbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes softPulse { 0%, 100% { transform: scale(0.95); opacity: 0.72; } 50% { transform: scale(1.05); opacity: 1; } }
@keyframes gentleSway { 0%, 100% { transform: rotate(-2.4deg); } 50% { transform: rotate(2.4deg); } }
@keyframes gentleFloat { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-5px); } }
@keyframes dashFlow { from { stroke-dashoffset: 48; } to { stroke-dashoffset: 0; } }

.slide-sheet.closing-sheet {
  background: radial-gradient(circle at 50% 22%, var(--closing-bg-2) 0%, var(--closing-bg) 74%) !important;
  color: var(--closing-text);
  border-color: rgba(255, 255, 255, 0.14);
}

/* Slide Sheet Header & Footer */
.sheet-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.sheet-kicker {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gold);
}
.sheet-section-tag {
  font-size: 11.5px;
  color: var(--navy);
  background: var(--navy-soft);
  padding: 2px 11px;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--navy) 22%, transparent);
  font-weight: 500;
}
.sheet-title {
  font-family: "Newsreader", "Playfair Display", Georgia, serif;
  font-size: clamp(21px, 2.5vw, 33px);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.24;
  letter-spacing: -0.2px;
  word-wrap: break-word;
}
.sheet-subtitle {
  margin-top: 6px;
  font-size: clamp(13.5px, 1.2vw, 15px);
  color: var(--text-secondary);
  max-width: 940px;
}

.sheet-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.sheet-bottom {
  margin-top: 20px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.closing-sheet .sheet-bottom {
  border-top-color: rgba(255, 255, 255, 0.14);
  color: var(--closing-muted);
}

/* Slide Dot Strip Below Sheet */
.dot-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  max-width: 1080px;
  padding: 0 8px;
}
.page-dot {
  width: 20px;
  height: 6px;
  border-radius: 99px;
  border: none;
  background: var(--border-strong);
  opacity: 0.45;
  cursor: pointer;
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
.page-dot:hover { opacity: 0.85; transform: scaleY(1.3); }
.page-dot.active {
  width: 36px;
  background: var(--gold);
  opacity: 1;
}

/* Editorial Layouts & Responsive Grids */
.s-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.s-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.s-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; align-items: stretch; }
.s-split-60-40 { display: grid; grid-template-columns: 1.25fr 0.95fr; gap: 24px; align-items: center; }
.s-split-45-55 { display: grid; grid-template-columns: 0.92fr 1.18fr; gap: 24px; align-items: center; }

.paradigm-banner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 16px 22px;
}

.s-panel {
  min-width: 0;
  background: var(--slide-surface);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 19px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.24s ease, box-shadow 0.24s ease, opacity 0.24s ease;
}
@media (hover: hover) {
  .s-panel:hover {
    transform: translateY(-3px);
    border-color: var(--gold);
    box-shadow: 0 10px 26px rgba(20, 30, 42, 0.08);
  }
}

.sheet-body.has-spotlight .s-panel:not(.is-spotlight) {
  opacity: 0.44;
  transform: scale(0.988);
}
.sheet-body.has-spotlight .s-panel.is-spotlight {
  border-color: var(--gold);
  box-shadow: 0 12px 32px var(--gold-soft);
  transform: translateY(-3px) scale(1.01);
}

.s-panel-subtle {
  min-width: 0;
  background: var(--slide-subtle);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px 17px;
}
.s-panel-navy { border-top: 3.5px solid var(--navy); }
.s-panel-gold { border-top: 3.5px solid var(--gold); }
.s-panel-sage { border-top: 3.5px solid var(--sage); }
.s-panel-terra { border-top: 3.5px solid var(--terra); }

.s-heading {
  font-family: "Newsreader", "Playfair Display", Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.s-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
}
.s-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.s-badge-navy { background: var(--navy-soft); color: var(--navy); }
.s-badge-gold { background: var(--gold-soft); color: var(--gold); }
.s-badge-sage { background: var(--sage-soft); color: var(--sage); }
.s-badge-terra { background: var(--terra-soft); color: var(--terra); }

.s-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.s-list li {
  position: relative;
  padding-left: 14px;
  font-size: 13.6px;
  color: var(--text-secondary);
  line-height: 1.54;
}
.s-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--gold);
  font-weight: bold;
}
.s-list li strong { color: var(--ink); font-weight: 600; }

.s-kv-block { display: flex; flex-direction: column; gap: 10px; }
.s-kv-item { padding-bottom: 9px; border-bottom: 1px dashed var(--border); }
.s-kv-item:last-child { border-bottom: none; padding-bottom: 0; }
.s-kv-key { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.s-kv-val { font-size: 13.5px; color: var(--text-secondary); }

.s-takeaway {
  background: linear-gradient(90deg, var(--gold-soft), var(--slide-subtle));
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--gold);
  border-radius: 9px;
  padding: 11px 16px;
  font-size: 13.6px;
  color: var(--ink);
  text-align: center;
}
.s-takeaway strong { color: var(--gold); }

.s-illus-box {
  min-width: 0;
  background: radial-gradient(circle at 50% 50%, var(--slide-surface) 0%, var(--slide-subtle) 100%);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 230px;
}

/* Original, slide-specific artworks: show the whole image, including in PDF. */
.slide-original-art {
  display: block;
  width: 100%;
  height: auto;
  max-height: 310px;
  object-fit: contain;
  border-radius: 8px;
}
.metaphor-art-frame img[src*="art/illustrations/"],
.cover-art-plate img[src*="art/illustrations/"] {
  object-fit: contain;
  transform: none;
}
@media (max-width: 760px) {
  .slide-original-art { max-height: 250px; }
}
@media print {
  .slide-original-art { max-height: 72mm; }
}

.flow-trigger {
  margin: 0 auto;
  padding: 9px 20px;
  background: var(--slide-surface);
  border: 1.5px solid var(--navy);
  border-radius: 8px;
  font-weight: 600;
  color: var(--ink);
  font-size: 13.8px;
  text-align: center;
  max-width: 100%;
}
.flow-diamond {
  margin: 6px auto;
  padding: 9px 22px;
  background: var(--gold-soft);
  border: 1.5px solid var(--gold);
  border-radius: 99px;
  font-weight: 600;
  color: var(--ink);
  font-size: 13.4px;
  text-align: center;
  max-width: min(540px, 100%);
}

.eq-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

/* ==================== 80% VISUAL METAPHOR SLIDE LAYOUTS ==================== */
.metaphor-art-frame,
.metaphor-svg-frame {
  width: 100%;
  flex: 1;
  min-height: 220px;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--slide-subtle);
  box-shadow: 0 12px 30px rgba(15, 24, 36, 0.11);
}
.metaphor-art-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.slide-sheet:hover .metaphor-art-frame img {
  transform: scale(1.022);
}
.metaphor-art-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 -40px 64px rgba(14, 22, 34, 0.22);
}
.metaphor-svg-frame svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Layout 1: Metaphor Hero (~80% Visual Canvas) */
.hero-metaphor-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.hero-visual-stage {
  flex: 1;
  display: flex;
  min-height: 360px;
  max-height: 440px;
}
.hero-visual-stage .metaphor-art-frame,
.hero-visual-stage .metaphor-svg-frame {
  aspect-ratio: 16 / 9;
  height: 100%;
}
.hero-caption-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 18px;
  background: var(--slide-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
}
.hero-metaphor-tag {
  font-size: 10.8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 3px;
}
.hero-insight {
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(16px, 1.55vw, 19.5px);
  font-weight: 500;
  line-height: 1.42;
  color: var(--ink);
}

/* Layout 2: Metaphor Spotlight (~75% Visual Stage + 25% Concise Distillation) */
.spotlight-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: 0;
}
.spotlight-visual {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 350px;
}
.spotlight-visual .metaphor-art-frame,
.spotlight-visual .metaphor-svg-frame {
  min-height: 330px;
}
.spotlight-caption {
  font-size: 12.2px;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
}

/* Layout 3: Metaphor Duo (~78% Split Visual Contrast) */
.duo-metaphor-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 0;
}
.duo-metaphor-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--slide-surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  min-width: 0;
}
.duo-metaphor-card.tone-navy { border-top: 3.5px solid var(--navy); }
.duo-metaphor-card.tone-gold { border-top: 3.5px solid var(--gold); }
.duo-metaphor-card.tone-sage { border-top: 3.5px solid var(--sage); }
.duo-metaphor-card.tone-terra { border-top: 3.5px solid var(--terra); }
.duo-metaphor-card .metaphor-svg-frame,
.duo-metaphor-card .metaphor-art-frame {
  aspect-ratio: 16 / 10;
  min-height: 225px;
  flex: 1;
}
.duo-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 4px;
}

/* Bespoke Cover & Closing Fine-Art Plates */
.cover-art-plate {
  width: 100%;
  max-width: 780px;
  aspect-ratio: 16 / 9;
  max-height: 335px;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: var(--slide-subtle);
  border: 1.5px solid var(--gold);
  box-shadow: 0 18px 42px rgba(15, 24, 36, 0.18);
  position: relative;
}
.cover-art-plate img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.closing-art-plate {
  width: 100%;
  max-width: 580px;
  aspect-ratio: 16 / 9;
  max-height: 240px;
  margin: 0 auto;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid rgba(223, 171, 86, 0.45);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.closing-art-plate img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Library Card Thumbnail */
.deck-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: var(--slide-subtle);
}
.deck-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
@media (hover: hover) {
  .deck-card:hover .deck-thumb img {
    transform: scale(1.04);
  }
}

/* Fullscreen optimization for 80% visual slides */
body.presentation-mode .hero-visual-stage {
  max-height: none;
  min-height: 0;
}
body.presentation-mode .spotlight-visual {
  min-height: 0;
}
body.presentation-mode .spotlight-visual .metaphor-art-frame,
body.presentation-mode .spotlight-visual .metaphor-svg-frame {
  min-height: 0;
}
body.presentation-mode .cover-art-plate {
  max-height: 46dvh;
}

/* Library View */
.library-wrap { width: 100%; max-width: 1180px; margin: 0 auto; }
.deck-card {
  background: linear-gradient(145deg, var(--slide-bg) 0%, var(--slide-bg-tint) 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (hover: hover) {
  .deck-card:hover {
    border-color: var(--gold);
    transform: translateY(-4px);
    box-shadow: var(--shadow-slide);
  }
}

/* Interactive Lab Responsive Helpers */
.pill-row { display: flex; flex-wrap: wrap; gap: 7px; }
.pill-btn {
  background: var(--slide-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  min-height: 34px;
  border-radius: 99px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.16s ease;
}
.pill-btn:hover { border-color: var(--gold); color: var(--ink); }
.pill-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
  font-weight: 500;
}
[data-theme="dark"] .pill-btn.active { color: #10161c; }

.lab-canvas-3d {
  width: 100%;
  height: auto;
  aspect-ratio: 520 / 270;
  display: block;
  margin-top: 8px;
  border-radius: 9px;
  background: var(--slide-subtle);
  border: 1px solid var(--border);
  cursor: grab;
  touch-action: none;
}
.lab-canvas-wave {
  width: 100%;
  height: auto;
  aspect-ratio: 520 / 190;
  display: block;
  border-radius: 8px;
  background: var(--slide-subtle);
  border: 1px solid var(--border);
}
.lab-slider-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.lab-slider-row label {
  font-size: 12.5px;
  min-width: 138px;
  color: var(--ink);
}
.lab-slider-row input[type="range"] {
  flex: 1;
  min-width: 140px;
  height: 28px;
  cursor: pointer;
}
.lazy-q-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  background: var(--slide-subtle);
  border-radius: 8px;
}

/* Responsive Scrollable Tables */
.table-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--slide-surface);
}
.table-swipe-hint {
  display: none;
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: right;
  margin-bottom: 4px;
}
.clean-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
.clean-table th {
  text-align: left;
  padding: 9px 12px;
  background: var(--navy-soft);
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  font-weight: 600;
}
.clean-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
.clean-table tr:last-child td { border-bottom: none; }

/* ==================== FULLSCREEN PRESENTATION MODE ==================== */
.fs-hud { display: none; }

body.presentation-mode {
  background: radial-gradient(circle at 50% 40%, #1a222d 0%, #0b0e13 100%) !important;
  overflow: hidden;
}
body.presentation-mode .sidebar,
body.presentation-mode .sidebar-backdrop,
body.presentation-mode .topbar,
body.presentation-mode .dot-strip,
body.presentation-mode .mobile-bottom-nav {
  display: none !important;
}
body.presentation-mode .stage-wrap {
  margin-left: 0 !important;
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
}
body.presentation-mode .deck-stage {
  height: 100vh;
  height: 100dvh;
  padding: max(1.6vh, env(safe-area-inset-top, 10px)) max(2.2vw, 12px) max(2vh, env(safe-area-inset-bottom, 12px));
  display: flex;
  align-items: center;
  justify-content: center;
}
body.presentation-mode .slide-transition-box {
  width: min(95vw, calc(93dvh * 16 / 9));
  max-width: 1560px;
  height: min(92dvh, calc(95vw * 9 / 16));
  min-height: 0;
  display: flex;
  align-items: stretch;
}
body.presentation-mode .slide-sheet {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(20px, 3.4vh, 46px) clamp(20px, 4vw, 60px) clamp(18px, 2.6vh, 34px);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.68);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
body.presentation-mode .sheet-title { font-size: clamp(22px, 2.8vw, 40px); }
body.presentation-mode .sheet-subtitle { font-size: clamp(13.5px, 1.25vw, 17px); }
body.presentation-mode .s-heading { font-size: clamp(16.5px, 1.5vw, 22px); }
body.presentation-mode .s-list li,
body.presentation-mode .s-kv-val { font-size: clamp(13.2px, 1.1vw, 15.5px); }

body.presentation-mode .fs-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 7px;
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom, 14px));
  left: 50%;
  transform: translateX(-50%) translateY(0);
  max-width: 96vw;
  background: rgba(16, 21, 28, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 7px 13px;
  border-radius: 99px;
  z-index: 200;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.48);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
body.presentation-mode .fs-hud.hud-idle {
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
  pointer-events: none;
}
body.presentation-mode .fs-hud:hover {
  opacity: 1 !important;
  transform: translateX(-50%) translateY(0) !important;
  pointer-events: auto !important;
}
.fs-hud-btn {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1efe9;
  border-radius: 99px;
  padding: 6px 12px;
  min-height: 34px;
  font-size: 12px;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
}
.fs-hud-btn:hover:not(:disabled) {
  background: rgba(224, 173, 88, 0.28);
  border-color: #e0ad58;
  color: #ffffff;
}
.fs-hud-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.fs-hud-counter {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #e0ad58;
  font-weight: 600;
  padding: 0 4px;
  white-space: nowrap;
}
.fs-fx-tag {
  font-size: 11px;
  color: #a5b4c4;
  padding: 0 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  white-space: nowrap;
}

/* ==================== BREAKPOINT 1: TABLET & SMALL LAPTOP (<= 1120px) ==================== */
@media (max-width: 1120px) {
  .sidebar {
    width: min(86vw, 310px);
    transform: translateX(-100%);
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.24);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-close-btn {
    display: inline-flex;
  }
  .stage-wrap {
    margin-left: 0 !important;
  }
  .s-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .deck-stage {
    padding: 18px 18px 26px;
  }
  .slide-sheet {
    padding: 28px 30px 22px;
    min-height: 560px;
  }
}

/* ==================== BREAKPOINT 2: TABLET PORTRAIT (<= 860px) ==================== */
@media (max-width: 860px) {
  .topbar {
    padding: 7px 14px;
  }
  .s-split-60-40,
  .s-split-45-55,
  .spotlight-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .hero-visual-stage {
    min-height: 260px;
    max-height: 360px;
  }
  .spotlight-visual,
  .spotlight-visual .metaphor-art-frame,
  .spotlight-visual .metaphor-svg-frame {
    min-height: 240px;
  }
  .s-grid-3 {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .eq-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .eq-op {
    font-size: 24px;
    padding: 2px 0;
  }
  .s-illus-box {
    min-height: 190px;
    padding: 14px;
  }
  #btn-print {
    display: none;
  }
  /* Fullscreen on Portrait Tablet / Phone fills full height cleanly above HUD */
  body.presentation-mode .deck-stage {
    align-items: stretch;
    padding: max(10px, env(safe-area-inset-top, 10px)) 10px calc(66px + env(safe-area-inset-bottom, 8px));
  }
  body.presentation-mode .slide-transition-box {
    width: 100%;
    height: 100%;
    max-width: none;
  }
}

/* ==================== BREAKPOINT 3: MOBILE PHONE (<= 680px) ==================== */
@media (max-width: 680px) {
  html, body {
    font-size: 14px;
  }
  .topbar {
    min-height: 48px;
    padding: 6px 10px;
    gap: 6px;
  }
  .topbar-left, .topbar-right {
    gap: 6px;
  }
  .ctrl-btn {
    padding: 6px 9px;
    min-height: 36px;
    font-size: 12px;
  }
  .btn-label-desktop {
    display: none;
  }
  .version-pill {
    padding: 4px 7px;
    font-size: 11px;
  }
  /* Move Prev/Next to ergonomic thumb-zone bottom bar on phones */
  #btn-prev, #btn-next {
    display: none;
  }
  .page-indicator {
    font-size: 11.5px;
    max-width: 132px;
  }
  .deck-stage {
    padding: 12px 10px calc(76px + env(safe-area-inset-bottom, 0px));
    justify-content: flex-start;
  }
  .slide-sheet {
    padding: 20px 16px 18px;
    min-height: auto;
    border-radius: 13px;
  }
  .slide-sheet.slide-var-4 {
    box-shadow: var(--shadow-slide);
  }
  .s-grid-2, .s-grid-3, .s-grid-4, .duo-metaphor-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .hero-visual-stage {
    min-height: 215px;
    max-height: 290px;
  }
  .hero-caption-band {
    padding: 11px 13px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .spotlight-visual,
  .spotlight-visual .metaphor-art-frame,
  .spotlight-visual .metaphor-svg-frame {
    min-height: 200px;
  }
  .duo-metaphor-card .metaphor-svg-frame,
  .duo-metaphor-card .metaphor-art-frame {
    min-height: 175px;
  }
  .cover-art-plate {
    max-height: 220px;
  }
  .paradigm-banner {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }
  .paradigm-banner .eq-op {
    transform: rotate(90deg);
    display: inline-block;
    margin: 0 auto;
  }
  .s-panel {
    padding: 14px 15px;
  }
  .s-heading {
    font-size: 16.5px;
  }
  .sheet-title {
    font-size: clamp(20px, 5.6vw, 24px);
  }
  .sheet-subtitle {
    font-size: 13.5px;
  }
  .sheet-bottom {
    margin-top: 16px;
    font-size: 11px;
    flex-wrap: wrap;
  }
  .dot-strip {
    display: none;
  }
  .lazy-q-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .table-swipe-hint {
    display: block;
  }
  .fs-fx-tag {
    display: none;
  }

  /* Fixed Ergonomic Thumb-Zone Navigation Bar at Bottom of Phone */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.08);
    z-index: 50;
  }
  .mobile-bottom-nav.hidden-in-lib {
    display: none !important;
  }
  .mob-nav-btn {
    min-height: 40px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--slide-surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }
  .mob-nav-btn.primary {
    background: var(--navy);
    border-color: var(--navy);
    color: #ffffff;
  }
  [data-theme="dark"] .mob-nav-btn.primary {
    color: #10161c;
  }
  .mob-nav-btn:disabled {
    opacity: 0.36;
  }
  .mob-page-pill {
    padding: 6px 11px;
    min-height: 40px;
    border-radius: 9px;
    border: 1px solid var(--gold);
    background: var(--gold-soft);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
}

/* ==================== BREAKPOINT 4: PHONE LANDSCAPE (short height <= 500px) ==================== */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar {
    min-height: 42px;
    padding: 4px 12px;
  }
  .deck-stage {
    padding: 10px 14px 18px;
  }
  .slide-sheet {
    min-height: auto;
    padding: 18px 22px 16px;
  }
  body.presentation-mode .deck-stage {
    padding: 8px 14px 48px;
  }
  body.presentation-mode .slide-transition-box {
    width: 96vw;
    height: 100%;
  }
}

@media (pointer: coarse) {
  .page-dot {
    height: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print / Save Deck as 20-25 Page Widescreen PDF */
#print-deck-container { display: none; }

@media print {
  @page { size: 297mm 167mm; margin: 0; }
  body { background: #f8f6f0 !important; }
  .progress-track, .sidebar, .sidebar-backdrop, .topbar, .deck-stage, .fs-hud, .mobile-bottom-nav, .pull-page-hint {
    display: none !important;
  }
  #print-deck-container { display: block !important; }
  .print-page {
    width: 297mm;
    height: 167mm;
    page-break-after: always;
    break-after: page;
    padding: 0; margin: 0;
    display: flex;
  }
  .print-page .slide-sheet {
    width: 100%; height: 100%;
    max-width: none; min-height: 0;
    border: none; border-radius: 0;
    box-shadow: none;
    animation: none !important;
  }
  .print-page .stagger-item,
  .print-page .sheet-top,
  .print-page .eq-op {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}


/* Edition links are part of the reading UI, outside the slide and PDF. */
.edition-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 4px clamp(10px, 2vw, 22px);
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
}
.edition-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 8px;
  color: var(--text-secondary);
  font-size: 13px;
  text-underline-offset: 3px;
}
.edition-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  text-decoration-thickness: 2px;
}
.edition-nav a:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}
body.presentation-mode .edition-nav { display: none; }
@media print {
  .edition-nav { display: none; }
}
