:root {
  --bg-page: #F7F8FA;
  --bg-white: #FFFFFF;
  --bg-subtle: #F1F3F6;
  --bg-dark: #0B1D17;
  --bg-dark-card: #122B22;

  --ink-1: #101418;
  --ink-2: #4A5564;
  --ink-3: #7A8699;

  --line: #E2E6EC;
  --line-strong: #CBD2DC;

  --brand: #0F6B4A;
  --brand-hover: #0B553B;
  --brand-soft: #ECF8F3;
  --brand-border: #B5E2CF;

  --amber: #B45309;
  --amber-soft: #FEF7EB;
  --amber-border: #F5D7A1;

  --red: #B91C1C;
  --red-soft: #FEF2F2;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0B0E11;
  font-family: var(--font-sans);
  color: var(--ink-1);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* Projector 16:9 Stage */
#viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #0E1216;
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1280px;
  height: 720px;
  min-width: 1280px;
  min-height: 720px;
  transform-origin: center center;
  transform: translate(-50%, -50%) scale(1);
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  background: var(--bg-white);
}

/* Slide Transitions */
.slide {
  position: absolute;
  inset: 0;
  width: 1280px;
  height: 720px;
  padding: 38px 54px 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-white);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 340ms var(--ease), transform 380ms var(--ease);
  overflow: hidden;
}

.slide.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  z-index: 2;
}

.slide.leaving {
  opacity: 0;
  transform: translateY(-8px);
  z-index: 1;
}

/* Dark Botanical Cover & Closing Slides */
.slide-dark {
  background: var(--bg-dark);
  color: #FFFFFF;
}

.slide-subtle {
  background: var(--bg-page);
}

/* Clean Top Accent Bar */
.top-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand);
}

/* Slide Header */
.s-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  gap: 20px;
}

.s-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.s-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--ink-1);
}

.s-page {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-subtle);
}

.s-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: 20px 0 12px;
}

.s-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Cards & Visual Anchors */
.card {
  background: var(--bg-white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 2px 10px rgba(16, 20, 24, 0.03);
}

.card-soft {
  background: var(--bg-page);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
}

.card-brand {
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  padding: 20px 22px;
}

.card-amber {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  border-radius: 12px;
  padding: 20px 22px;
}

.card-dark {
  background: var(--bg-dark);
  color: #FFFFFF;
  border-radius: 12px;
  padding: 22px 24px;
}

/* Numbered Step Anchor (Helps presenter speak directly from slide) */
.step-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  align-items: start;
}

.step-num {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.step-num.amber {
  background: var(--amber);
}

.step-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-1);
  line-height: 1.25;
  margin-bottom: 3px;
}

.step-desc {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.45;
}

/* Big Metric Callouts */
.big-stat {
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* Tables */
.clean-tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-white);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}

.clean-tbl th {
  text-align: left;
  padding: 11px 14px;
  background: var(--bg-subtle);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line-strong);
}

.clean-tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-1);
}

.clean-tbl tr:last-child td {
  border-bottom: none;
}

.dp-tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  background: var(--bg-white);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}

.dp-tbl th,
.dp-tbl td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: center;
}

.dp-tbl th {
  background: var(--bg-subtle);
  color: var(--ink-2);
  font-weight: 700;
}

.dp-tbl th.row-h {
  text-align: left;
  font-family: var(--font-sans);
  color: var(--ink-1);
  font-weight: 600;
}

.dp-tbl td.cell-take {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--brand);
}

.dp-tbl td.cell-skip {
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 700;
  box-shadow: inset 0 0 0 1.5px var(--amber);
}

/* Bars & Buttons */
.bar-track {
  width: 100%;
  height: 16px;
  background: var(--bg-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
}

.demo-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--brand);
  color: #FFFFFF;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 150ms ease, transform 150ms ease;
}

.demo-btn:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.meta-val[contenteditable="true"] {
  outline: none;
  border-radius: 4px;
  user-select: text;
}

.meta-val[contenteditable="true"]:focus {
  box-shadow: 0 0 0 1.5px #34D399;
}

/* Clean Keynote Animations */
[data-anim] {
  opacity: 0;
  will-change: transform, opacity;
}

.slide.active [data-anim="up"] {
  animation: animUp 460ms var(--ease) var(--d, 60ms) forwards;
}

.slide.active [data-anim="right"] {
  animation: animRight 460ms var(--ease) var(--d, 80ms) forwards;
}

.slide.active [data-anim="bar"] {
  opacity: 1;
  transform-origin: left center;
  animation: animBar 720ms var(--ease) var(--d, 200ms) forwards;
}

.slide.active [data-anim="draw"] {
  opacity: 1;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  animation: animDraw 840ms var(--ease) var(--d, 180ms) forwards;
}

@keyframes animUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes animRight {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes animBar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes animDraw {
  to { stroke-dashoffset: 0; }
}

/* Minimal Floating Bottom HUD (Projector Window) */
#hud {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(16, 20, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 40;
}

#hud button,
#hud a {
  height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

#hud button:hover,
#hud a:hover {
  background: rgba(255, 255, 255, 0.16);
}

#hud button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

#hud .hud-presenter {
  background: var(--brand);
  border-color: #1A8F65;
}

#hud .hud-presenter:hover {
  background: var(--brand-hover);
}

.prog-wrap {
  width: 82px;
  height: 4px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  width: 12.5%;
  background: #34D399;
  transition: width 0.25s ease;
}

/* Single-Window Fallback Notes Drawer (Press N) */
#notesPanel {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 32px));
  background: #101418;
  color: #FFFFFF;
  border: 1px solid #2A323B;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 39;
  display: none;
}

#notesPanel.open {
  display: block;
}

/* Auto-hide HUD & Notes cleanly in Projector Fullscreen */
body.clean-mode #hud,
body.clean-mode #notesPanel {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media all and (display-mode: fullscreen) {
  #hud,
  #notesPanel {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  #stage {
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}

:fullscreen #hud,
:fullscreen #notesPanel {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* =========================================================
   DEDICATED LAPTOP PRESENTER CONSOLE (?presenter=1)
   ========================================================= */
body.is-presenter {
  background: #0D1114;
  color: #F3F5F7;
  overflow: auto;
  user-select: text;
}

body.is-presenter #viewport,
body.is-presenter #hud,
body.is-presenter #notesPanel {
  display: none !important;
}

#presenterConsole {
  display: none;
  min-height: 100vh;
  padding: 16px 22px 22px;
  flex-direction: column;
  gap: 14px;
  max-width: 1440px;
  margin: 0 auto;
}

body.is-presenter #presenterConsole {
  display: flex;
}

.pc-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #151B20;
  border: 1px solid #28313A;
  border-radius: 12px;
  padding: 11px 16px;
}

.pc-top-left,
.pc-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pc-role-badge {
  background: var(--brand);
  color: #FFFFFF;
  padding: 5px 11px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

#pcSlideBadge {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
}

#pcTimer {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  color: #34D399;
  min-width: 82px;
  text-align: center;
}

.pc-btn {
  height: 34px;
  padding: 0 13px;
  border-radius: 7px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.pc-btn:hover {
  background: var(--brand-hover);
}

.pc-btn.sec {
  background: #1F272E;
  border-color: #313C46;
  color: #E5EAF0;
}

.pc-btn.sec:hover {
  background: #2A343E;
}

.pc-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 0.9fr 1.3fr;
  gap: 16px;
  min-height: 0;
}

.pc-card {
  background: #151B20;
  border: 1px solid #28313A;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.pc-section-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #8B98A5;
  text-transform: uppercase;
}

.pc-preview-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #090C0E;
  border: 1.5px solid #2E7D5E;
}

.pc-next-box {
  padding: 12px 14px;
  border-radius: 8px;
  background: #101519;
  border: 1px solid #242D35;
}

.pc-next-title {
  font-size: 15px;
  font-weight: 600;
  color: #FFFFFF;
  margin-top: 4px;
}

.pc-jump-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.pc-jump-btn {
  height: 31px;
  padding: 0 10px;
  border-radius: 6px;
  background: #1F272E;
  color: #C7D1DB;
  border: 1px solid #313C46;
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
}

.pc-jump-btn.cur {
  background: var(--brand);
  color: #FFFFFF;
  border-color: #34D399;
}

/* Structured Slide-Triggered Cue List */
.pc-script-card {
  background: #13191E;
  border-color: #2A453B;
}

.pc-script-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#pcSpeaker {
  background: #19382D;
  color: #A7F3D0;
  border: 1px solid #2B5E4B;
  padding: 4px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
}

.pc-hint {
  font-size: 12px;
  color: #8B98A5;
}

#pcCueList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cue-row {
  background: #0D1114;
  border: 1px solid #263038;
  border-left: 3px solid #34D399;
  border-radius: 8px;
  padding: 12px 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cue-trigger {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: #6EE7B7;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cue-say {
  font-size: clamp(16px, 1.55vw, 20px);
  line-height: 1.42;
  font-weight: 600;
  color: #FFFFFF;
}

#pcNote {
  font-size: 14.5px;
  line-height: 1.5;
  color: #FDE68A;
  background: #231D11;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #4A3B1C;
}

@media (max-width: 960px) {
  .pc-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  #hud,
  #notesPanel,
  #presenterConsole {
    display: none !important;
  }
  #viewport {
    position: static;
    background: none;
  }
  #stage {
    width: auto;
    height: auto;
    transform: none !important;
    box-shadow: none;
    overflow: visible;
  }
  .slide {
    position: relative;
    opacity: 1 !important;
    transform: none !important;
    page-break-after: always;
  }
  [data-anim] {
    opacity: 1 !important;
    animation: none !important;
  }
}
