:root {
  --paper: #fafaf8;
  --paper-rgb: 250, 250, 248;
  --ink: #0a0a0a;
  --ink-rgb: 10, 10, 10;
  --grey-1: #f0f0ee;
  --grey-2: #d4d4d2;
  --grey-3: #737373;
  --accent: #c5e803;
  --accent-rgb: 197, 232, 3;
  --accent-on: #0a0a0a;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --sans-zh: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --toolbar-h: 58px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow: hidden;
  background: var(--grey-1);
  color: var(--ink);
  font-family: var(--sans), var(--sans-zh);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
a {
  font: inherit;
}

.toolbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--grey-2);
  background: var(--paper);
}

.toolbar strong,
.toolbar span,
.toolbar button,
.toolbar a,
.chrome,
.meta,
.claim-strip,
.progress,
.timeline-row,
.word-grid span,
.rail-list span,
.scene-list span {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .14em;
}

.toolbar strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}

.toolbar span {
  display: block;
  margin-top: 4px;
  color: var(--grey-3);
  font-size: 10px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.toolbar button,
.toolbar a {
  min-height: 34px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 0 11px;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-size: 10px;
  cursor: pointer;
}

.toolbar button:hover,
.toolbar button[aria-pressed="true"],
.toolbar a:hover {
  background: var(--accent);
}

.deck {
  position: fixed;
  inset: var(--toolbar-h) 0 0;
  display: flex;
  gap: var(--side-pad, 48px);
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--side-pad, 48px);
  padding: 26px var(--side-pad, 48px) 42px;
}

.deck::-webkit-scrollbar {
  height: 10px;
}

.deck::-webkit-scrollbar-track {
  background: var(--grey-1);
}

.deck::-webkit-scrollbar-thumb {
  background: var(--grey-2);
}

.slide {
  position: relative;
  flex: 0 0 auto;
  height: min(calc(100vh - var(--toolbar-h) - 68px), 900px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  scroll-snap-align: center;
  background: var(--paper);
  color: var(--ink);
}

.stage-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: filter .18s ease;
}

.is-grey .stage-img {
  filter: grayscale(1) contrast(1.08);
}

.slide::before {
  display: none;
}

.chrome {
  position: absolute;
  z-index: 5;
  inset: 0 0 auto;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid currentColor;
  padding: 0 56px;
  background: var(--paper);
  color: var(--ink);
  font-size: 10px;
  font-weight: 400;
}

.slide-ink .chrome {
  background: var(--ink);
  color: var(--paper);
}

.slide-accent .chrome {
  background: var(--accent);
  color: var(--accent-on);
}

.text-plate,
.compare-stack,
.word-grid,
.rail-list,
.timeline-row,
.scene-list,
.claim-strip {
  position: absolute;
  z-index: 4;
}

.text-plate {
  width: 34%;
  min-width: 290px;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  background: var(--paper);
  color: var(--ink);
  padding: 22px 24px 24px;
}

.plate-clear {
  background: var(--accent);
}

.plate-ink {
  background: var(--ink);
  color: var(--paper);
}

.plate-left {
  left: 56px;
  top: 28%;
}

.plate-right {
  right: 56px;
  top: 30%;
}

.plate-top {
  left: 56px;
  top: 96px;
  width: 48%;
}

.plate-top-left {
  left: 56px;
  top: 96px;
}

.plate-bottom {
  left: 56px;
  bottom: 54px;
  width: 42%;
}

.text-plate.small {
  width: 29%;
  min-width: 250px;
}

.text-plate.wide {
  width: 44%;
}

.text-plate.thin {
  width: 34%;
  padding-block: 16px;
}

.text-plate.narrow {
  width: 28%;
}

.meta {
  margin: 0 0 12px;
  color: var(--grey-3);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
}

.plate-ink .meta {
  color: rgba(250, 250, 248, .66);
}

.slide-accent .meta,
.accent-card .meta,
.plate-clear .meta {
  color: rgba(10, 10, 10, .7);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--sans), var(--sans-zh);
  font-weight: 200;
  line-height: .98;
  letter-spacing: 0;
}

h1 {
  max-width: 5em;
  font-size: 66px;
}

h2 {
  max-width: 9em;
  font-size: 36px;
}

h3 {
  max-width: 6em;
  font-size: 30px;
}

.text-plate p:last-child,
.compare-stack p:last-child {
  max-width: 22em;
  margin-top: 14px;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.58;
}

.claim-strip {
  left: 56px;
  bottom: 24px;
  width: 38%;
  border-top: 1px solid currentColor;
  padding-top: 10px;
  font-size: 10px;
}

.word-grid {
  right: 56px;
  bottom: 62px;
  width: 34%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
  background: var(--paper);
}

.word-grid span,
.scene-list span {
  min-height: 54px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-size: 11px;
  font-weight: 500;
}

.rail-list {
  left: 56px;
  right: 56px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--ink);
  background: var(--paper);
}

.rail-bottom {
  bottom: 54px;
}

.rail-list span {
  min-height: 44px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-size: 10px;
}

.timeline-row {
  left: 56px;
  top: 96px;
  width: 42%;
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--ink);
  padding-top: 13px;
  color: var(--ink);
  font-size: 10px;
}

.timeline-row i {
  height: 1px;
  background: currentColor;
}

.compare-stack {
  left: 56px;
  bottom: 54px;
  width: 48%;
  display: grid;
  grid-template-columns: 1fr .72fr;
  gap: 0;
}

.compare-stack article {
  min-height: 214px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
  padding: 22px 24px;
}

.compare-stack .accent-card {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-on);
}

.scene-list {
  right: 56px;
  top: 96px;
  width: 30%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
  background: var(--paper);
}

.progress {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--grey-2);
  transform-origin: left center;
}

.progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

body.export-mode {
  overflow: hidden;
  background: var(--paper);
}

body.export-mode .toolbar,
body.export-mode .progress {
  display: none !important;
}

body.export-mode .deck {
  position: static;
  display: block;
  width: 100vw;
  height: 100vh;
  padding: 0;
  overflow: hidden;
}

body.export-mode .slide {
  display: none;
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
}

body.export-mode .slide.export-active {
  display: block;
}

@media (max-width: 900px) {
  :root {
    --toolbar-h: 52px;
  }

  .toolbar {
    height: var(--toolbar-h);
    padding: 8px 12px;
  }

  .toolbar span,
  .toolbar button[data-prev-slide],
  .toolbar button[data-next-slide],
  .toolbar a {
    display: none;
  }

  .deck {
    gap: 18px;
    scroll-padding-inline: 12px;
    padding: 14px 12px 28px;
  }

  .slide {
    width: calc(100vw - 24px);
    height: auto;
  }

  .chrome {
    height: 34px;
    padding: 0 18px;
    font-size: 7px;
  }

  .slide::before {
    inset: 34px 0 0;
  }

  .text-plate {
    min-width: 0;
    width: 46%;
    padding: 8px 9px;
  }

  .text-plate.small,
  .text-plate.narrow,
  .text-plate.wide,
  .text-plate.thin {
    width: 45%;
  }

  .plate-left,
  .plate-top-left,
  .plate-top,
  .plate-bottom,
  .claim-strip,
  .compare-stack,
  .timeline-row {
    left: 18px;
  }

  .plate-right,
  .scene-list,
  .word-grid {
    right: 18px;
  }

  .plate-left,
  .plate-right {
    top: 29%;
  }

  .plate-top,
  .plate-top-left,
  .timeline-row {
    top: 48px;
  }

  .plate-bottom,
  .compare-stack,
  .rail-bottom {
    bottom: 18px;
  }

  .claim-strip {
    bottom: 8px;
    width: 44%;
    padding-top: 5px;
    font-size: 5px;
  }

  .meta {
    margin-bottom: 4px;
    font-size: 5px;
  }

  h1 {
    font-size: 23px;
  }

  h2 {
    font-size: 15px;
  }

  h3 {
    font-size: 13px;
  }

  .text-plate p:last-child,
  .compare-stack p:last-child {
    margin-top: 5px;
    font-size: 6px;
    line-height: 1.38;
  }

  .word-grid,
  .scene-list {
    width: 38%;
    bottom: 22px;
  }

  .word-grid span,
  .scene-list span {
    min-height: 20px;
    font-size: 5px;
  }

  .rail-list {
    left: 18px;
    right: 18px;
  }

  .rail-list span,
  .timeline-row {
    min-height: 19px;
    font-size: 5px;
  }

  .compare-stack {
    width: 56%;
  }

  .compare-stack article {
    min-height: 68px;
    padding: 7px 8px;
  }
}

@media (orientation: portrait) and (min-width: 901px) {
  .deck {
    align-items: flex-start;
    padding-top: 34px;
  }

  .slide {
    width: calc(100vw - 96px);
    height: auto;
  }
}

@media print {
  @page {
    size: 1920px 1080px;
    margin: 0;
  }

  html,
  body {
    width: 1920px;
    margin: 0;
    overflow: visible;
    background: var(--paper);
  }

  .toolbar,
  .progress,
  .editor-panel,
  .editor-outline,
  .editor-fab {
    display: none !important;
  }

  .deck {
    position: static;
    display: block;
    padding: 0;
    overflow: visible;
  }

  .slide {
    width: 1920px;
    height: 1080px;
    aspect-ratio: auto;
    break-after: page;
    page-break-after: always;
    scroll-snap-align: none;
  }

  .slide:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}

.editor-mode .slide :is(.chrome, .text-plate, .compare-stack, .word-grid, .rail-list, .timeline-row, .scene-list, .claim-strip, img) {
  cursor: pointer;
}

.editor-mode [contenteditable="true"] {
  outline: 0;
  cursor: text;
}

.editor-mode [data-editor-selected="true"] {
  outline: 1px solid var(--accent);
  outline-offset: 0;
}

.editor-outline {
  position: fixed;
  z-index: 1000;
  display: none;
  border: 1px solid var(--accent);
  pointer-events: none;
}

.editor-move,
.editor-resize,
.editor-fab,
.editor-panel button {
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.editor-move {
  position: absolute;
  left: 0;
  top: -28px;
  height: 28px;
  padding: 0 9px;
  pointer-events: auto;
  cursor: move;
}

.editor-resize {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  padding: 0;
  background: var(--accent);
  pointer-events: auto;
  cursor: nwse-resize;
}

.editor-panel {
  position: fixed;
  z-index: 1001;
  right: 14px;
  bottom: 14px;
  width: min(330px, calc(100vw - 28px));
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 12px;
  font-family: var(--sans), var(--sans-zh);
  display: none;
}

.editor-mode .editor-panel {
  display: block;
}

.editor-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.editor-panel-head strong,
.editor-readout {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.editor-readout {
  margin-bottom: 10px;
  color: var(--grey-3);
  line-height: 1.5;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.editor-panel button {
  min-height: 30px;
  cursor: pointer;
}

.editor-panel button:hover,
.editor-fab:hover {
  background: var(--accent);
}

.editor-panel p {
  margin-top: 10px;
  color: var(--grey-3);
  font-size: 12px;
  line-height: 1.45;
}

.editor-fab {
  position: fixed;
  z-index: 1002;
  top: 10px;
  right: 10px;
  min-height: 32px;
  padding: 0 10px;
  display: none;
}

@media (max-width: 560px) {
  .editor-tools-enabled .editor-fab {
    display: block;
  }
}
