:root {
  --bg: #0e1014;
  --panel: #151923;
  --ink: #f1f1f1;
  --muted: #9da3ad;
  --dim: #636a74;
  --formal: #5b8fc8;
  --informal: #d56d55;
  --match: #e0a33a;
  --judge: #a786c9;
  --green: #67b87f;
  --wrong: #c76b63;
  --line: rgba(255,255,255,0.12);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.deck {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
}

.slide {
  position: absolute;
  inset: 0;
  padding: 5vh 5.2vw 6vh;
  opacity: 0;
  transform: translateX(22px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}
.slide.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.eyebrow {
  color: var(--match);
  font-size: clamp(14px, 1.02vw, 20px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.2vh;
}

h1, h2, h3, p { margin: 0; }
h1 {
  font-size: clamp(54px, 6.7vw, 112px);
  line-height: 0.95;
  letter-spacing: 0;
  max-width: 13.5ch;
}
h2 {
  font-size: clamp(37px, 3.75vw, 66px);
  line-height: 1.02;
  letter-spacing: 0;
  max-width: 18ch;
}
h3 {
  font-size: clamp(24px, 2.0vw, 34px);
  line-height: 1.15;
  color: var(--muted);
  font-weight: 500;
}
p {
  font-size: clamp(21px, 1.45vw, 28px);
  line-height: 1.35;
  color: var(--muted);
}
.paper-meta {
  max-width: 46em;
  font-size: clamp(15px, 0.95vw, 19px);
  line-height: 1.35;
  color: var(--muted);
}

.title-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6.2vw;
  align-items: center;
  height: 100%;
}
.title-grid .stack {
  position: relative;
  z-index: 3;
  padding-right: 1vw;
}
.title-grid .visual {
  z-index: 1;
  transform: translateX(2vw) scale(0.88);
  transform-origin: center right;
}
.title-card img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 22px 80px rgba(0,0,0,0.45);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: 4.8vw;
  align-items: center;
  height: 78vh;
}
.split.reverse {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
}
.stack {
  display: grid;
  gap: 2.4vh;
  position: relative;
  z-index: 3;
}
.wide { height: 78vh; display: grid; align-content: center; gap: 3vh; }
.video-first {
  display: grid;
  grid-template-columns: minmax(0, 0.55fr) minmax(0, 1.45fr);
  gap: 3.2vw;
  align-items: center;
  height: 84vh;
}
.video-first .stack {
  align-self: center;
}
.video-first h2 {
  max-width: 13ch;
}
.video-first p {
  max-width: 24em;
}

.visual {
  position: relative;
  z-index: 1;
  min-height: 48vh;
  border: 0;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}
.visual.plain {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.visual video,
.visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.visual video.fill,
.visual img.fill { object-fit: cover; }
.hero-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  height: auto;
  max-height: 70vh;
}
.wide-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  height: auto;
  max-height: 70vh;
  background: transparent;
}
.wide-video video {
  object-fit: contain;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.3vw;
}
.stat {
  padding: 1.8vh 1.4vw;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.035);
  border-radius: 12px;
}
.stat .num {
  display: block;
  font-size: clamp(34px, 3.5vw, 60px);
  line-height: 1;
  font-weight: 800;
  color: var(--match);
}
.stat .label {
  display: block;
  color: var(--muted);
  font-size: clamp(16px, 1.25vw, 22px);
  margin-top: 0.8vh;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 0.8vw; margin-top: 1.6vh; }
.tag {
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.75vh 1vw;
  font-size: clamp(15px, 1.05vw, 20px);
}
.formal { color: var(--formal); }
.informal { color: var(--informal); }
.match { color: var(--match); }
.judge { color: var(--judge); }
.green { color: var(--green); }
.wrong { color: var(--wrong); }

.build > * {
  opacity: 0.18;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
}
.build > *.shown {
  opacity: 1;
  transform: translateY(0);
}
ul.clean {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1.3vh;
}
ul.clean li {
  font-size: clamp(23px, 1.65vw, 32px);
  line-height: 1.25;
  color: var(--ink);
  padding-left: 1.5vw;
  border-left: 4px solid var(--match);
}
ul.clean li.muted {
  color: var(--muted);
  border-left-color: var(--line);
}

.equation {
  font-family: Menlo, ui-monospace, SFMono-Regular, monospace;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  padding: 1.2vh 1vw;
  border-radius: 10px;
  font-size: clamp(18px, 1.25vw, 24px);
}

.timeline {
  position: fixed;
  left: 6vw;
  right: 6vw;
  bottom: 2.8vh;
  height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  overflow: hidden;
}
.timeline-fill {
  height: 100%;
  width: 0%;
  background: var(--match);
  transition: width 180ms ease;
}
.hud {
  position: fixed;
  right: 2.2vw;
  bottom: 2.2vh;
  color: var(--dim);
  font-size: 14px;
  display: flex;
  gap: 1vw;
}

.notes-panel {
  position: fixed;
  right: 1.5vw;
  top: 1.5vh;
  width: min(440px, 32vw);
  max-height: 72vh;
  overflow: auto;
  padding: 18px 20px;
  background: rgba(10, 12, 16, 0.94);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.42);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.notes-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.notes-panel h4 {
  color: var(--match);
  font-size: 15px;
  margin: 0 0 8px;
}
.notes-panel p {
  font-size: 17px;
  line-height: 1.35;
  color: var(--ink);
}
.slide .notes {
  display: none;
}

.section-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1vw;
  margin-top: 3vh;
}
.section-tile {
  opacity: 0.42;
  transition: opacity 220ms ease, transform 220ms ease;
}
.section-tile.active {
  opacity: 1;
  transform: translateY(-6px);
}
.section-tile img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.section-tile span {
  display: block;
  text-align: center;
  margin-top: 0.7vh;
  color: var(--muted);
  font-size: 15px;
}

.center {
  height: 78vh;
  display: grid;
  place-items: center;
  text-align: center;
}
.center h2 { margin: 0 auto; }
.center p { max-width: 36em; margin: 2vh auto 0; }
.thanks-slide .stack {
  justify-items: center;
  max-width: min(980px, 72vw);
}
.thanks-slide h1 {
  max-width: none;
}
.thanks-slide h3 {
  max-width: 34em;
}
.paper-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.2vw;
  align-items: center;
  margin-top: 2vh;
  padding: 1.1vh 1.1vw;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  text-align: left;
}
.paper-card img {
  width: clamp(92px, 7vw, 128px);
  height: clamp(92px, 7vw, 128px);
  border-radius: 6px;
  display: block;
}
.paper-card-label {
  color: var(--match);
  font-weight: 800;
  font-size: clamp(13px, 0.9vw, 17px);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.paper-card-title {
  color: var(--ink);
  font-weight: 700;
  font-size: clamp(16px, 1.12vw, 22px);
  line-height: 1.2;
  margin-top: 0.35vh;
}
.paper-card-link {
  color: var(--muted);
  font-size: clamp(15px, 1.0vw, 19px);
  margin-top: 0.45vh;
}

.paper-credit {
  position: fixed;
  left: 5.2vw;
  right: 5.2vw;
  bottom: 3.65vh;
  z-index: 20;
  color: rgba(157, 163, 173, 0.72);
  font-size: clamp(10px, 0.68vw, 13px);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.footer-note {
  position: absolute;
  left: 6vw;
  bottom: 5.2vh;
  color: var(--dim);
  font-size: 16px;
}

@media (max-aspect-ratio: 1/1) {
  h1 { font-size: 10vw; }
  h2 { font-size: 7vw; }
  .title-grid, .split, .split.reverse { grid-template-columns: 1fr; height: auto; }
  .visual { min-height: 34vh; }
}
