:root {
  --board: #070b12;
  --ink: #eef6ff;
  --muted: #9eb0c2;
  --accent: #8ed4e4;
  --accent-soft: rgba(142, 212, 228, 0.16);
  --paper: #0b121c;
  --border: rgba(180, 214, 230, 0.18);
  --footer-h: clamp(70px, 8.4svh, 86px);
  --scrim: linear-gradient(180deg, rgba(7, 11, 18, 0.22) 0%, rgba(7, 11, 18, 0.58) 48%, rgba(7, 11, 18, 0.28) 100%);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--board);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

button { font-family: inherit; cursor: pointer; }
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.deck-shell {
  width: 100vw;
  height: 100svh;
  display: grid;
  grid-template-columns: clamp(180px, 18vw, 240px) 1fr;
  grid-template-rows: minmax(0, 1fr) var(--footer-h);
  transition: grid-template-columns .25s ease;
}

.deck-shell.toc-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.toc {
  padding: 1rem 0.8rem;
  border-right: 1px solid var(--border);
  background: #080d14;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-width: 0;
  overflow: hidden;
}

.toc-collapsed .toc {
  width: 0;
  min-width: 0;
  padding: 0;
  opacity: 0;
  border-right-color: transparent;
  pointer-events: none;
}

.brand {
  display: grid;
  gap: .15rem;
  border-left: 3px solid var(--accent);
  padding-left: .55rem;
}

.brand span {
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.brand strong { font-size: .95rem; line-height: 1.2; }

.toc nav {
  display: grid;
  gap: .22rem;
  min-width: 0;
  overflow: auto;
}

#slideNav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: .32rem .4rem;
  border-radius: 6px;
  font-size: .72rem;
}

#slideNav button.active {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 700;
}

.sync-state {
  color: var(--muted);
  margin-top: auto;
  padding-top: .5rem;
  border-top: 1px dashed var(--border);
  font-size: .7rem;
}

.stage {
  container-type: size;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
}

.slide {
  display: none;
  height: calc(100svh - var(--footer-h));
  padding: clamp(1rem, 2cqw, 2rem);
  overflow: hidden;
  gap: clamp(.5rem, 1.1cqh, .9rem);
  font-size: clamp(22px, calc(1.05cqw + 1.45cqh), 30px);
}

.slide.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.deck-shell:not(:has(.slide.active)) .slide:first-of-type {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.slide > * { min-width: 0; }

h1, h2, h3, p, ul, ol, figure, li { margin: 0; }

h1 {
  font-size: clamp(2.4rem, 5.2cqw, 4.1rem);
  line-height: 1.04;
  font-weight: 800;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.55rem, 3.2cqw, 2.45rem);
  line-height: 1.12;
  font-weight: 800;
  text-wrap: balance;
}

h3 { font-size: 1.05em; font-weight: 800; }

.eyebrow {
  color: var(--accent);
  font-size: .55em;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0 0 .2rem;
}

.subtitle { color: var(--muted); font-size: .82em; }

.slide header {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: .7rem;
  align-items: start;
}

.soil-frame {
  background: rgba(8, 14, 22, 0.72);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: 10px;
  padding: .55rem .75rem;
  display: grid;
  gap: .2rem;
}

.soil-claim,
.soil-task {
  font-size: .72em;
  line-height: 1.35;
  color: #d7e7f2;
}

.soil-claim b,
.soil-task b { color: var(--accent); }

.takeaway {
  color: var(--ink);
  font-weight: 750;
  font-size: .92em;
}

.muted { color: var(--muted); font-size: .78em; }

.cards {
  display: grid;
  gap: .7rem;
  min-height: 0;
}

.cards.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.card {
  min-height: 0;
  border: 1px solid rgba(156, 224, 236, 0.42);
  border-left: 5px solid #9be7f5;
  border-radius: 14px;
  padding: .7rem .85rem;
  background: linear-gradient(165deg, rgba(54, 108, 136, 0.58) 0%, rgba(16, 34, 50, 0.94) 72%);
  box-shadow: 0 10px 28px rgba(0, 10, 22, 0.38), inset 0 1px 0 rgba(190, 242, 255, 0.16);
  display: grid;
  align-content: start;
  gap: .28rem;
}

.card strong {
  color: #d4f6ff;
  font-size: 1.05em;
  line-height: 1.15;
}

.card span { color: #c5dbe8; font-size: .78em; }

.giant {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
  min-height: 0;
  align-items: stretch;
}

.giant .card b {
  display: block;
  font-size: clamp(2.4rem, 7cqh, 4.2rem);
  line-height: .95;
  color: var(--accent);
  font-weight: 800;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, .32fr) minmax(0, .68fr);
  gap: .85rem;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.split.wide-text,
.split.equal { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.stack.dense {
  gap: .32rem;
  align-self: stretch;
  justify-content: space-between;
}

.stack.dense .card {
  padding: .42rem .7rem;
}

.stack.dense .card strong { font-size: .98em; }
.stack.dense .card span { font-size: .74em; }

.stack {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  min-width: 0;
  align-self: start;
}

.stack .card,
.stack .step {
  flex: 0 0 auto;
  padding: .95rem 1.05rem;
}

.stack .card strong {
  font-size: 1.18em;
}

.stack .card span {
  font-size: .86em;
  line-height: 1.38;
}

.split ul {
  display: grid;
  gap: .45rem;
  padding-left: 1.1em;
  align-content: center;
}

.media,
.shot-slot {
  min-height: 0;
  height: 100%;
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  background: #05080d;
}

.media img,
.shot-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.media.hero img,
.shot-slot.hero img {
  object-fit: cover;
}

.media.shot {
  cursor: zoom-in;
  background: #05080d;
}

.media.shot img {
  object-fit: contain;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  margin: 0;
  padding: 1.2rem;
  background: rgba(5, 8, 13, 0.92);
  place-items: center;
  cursor: zoom-out;
}

.lightbox.is-on { display: grid; }

.lightbox img {
  max-width: min(96vw, 1600px);
  max-height: 90svh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.lightbox-close {
  position: absolute;
  top: .7rem;
  right: .9rem;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(8, 14, 22, 0.8);
  color: var(--ink);
  border-radius: 8px;
  padding: .35rem .7rem;
  font-weight: 700;
}

.shot-slot {
  display: grid;
  place-items: center;
}

.shot-slot img { position: absolute; inset: 0; }

.shot-slot.is-empty img { display: none; }

.shot-slot.is-empty::before {
  content: attr(data-label);
  color: var(--accent);
  font-weight: 800;
  font-size: .9em;
  text-align: center;
  padding: 1rem;
  z-index: 1;
}

.shot-slot.is-empty::after {
  content: attr(data-hint);
  position: absolute;
  bottom: .7rem;
  color: var(--muted);
  font-size: .62em;
  text-align: center;
  width: 90%;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
  min-height: 0;
}

.step {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: .8rem;
  background: rgba(10, 18, 28, 0.78);
  display: grid;
  gap: .3rem;
  align-content: start;
}

.step b {
  color: var(--accent);
  font-size: 1.35em;
}

.chip-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: .55rem;
  min-height: 0;
  align-content: center;
}

.chip {
  border: 1px solid rgba(156, 224, 236, 0.42);
  border-left: 4px solid #9be7f5;
  border-radius: 12px;
  padding: .7rem .75rem;
  background: linear-gradient(165deg, rgba(54, 108, 136, 0.58) 0%, rgba(16, 34, 50, 0.94) 72%);
  box-shadow: 0 8px 22px rgba(0, 10, 22, 0.32), inset 0 1px 0 rgba(190, 242, 255, 0.14);
  font-weight: 750;
  color: #d4f6ff;
}

.chip small {
  display: block;
  color: #c5dbe8;
  font-size: .72em;
  font-weight: 500;
  margin-top: .2rem;
}

.title-slide,
.section-slide {
  background-image: var(--scrim), var(--hero);
  background-size: cover;
  background-position: center;
}

.title-slide { --hero: url("./assets/library-cover.jpg"); }
.section-slide { --hero: url("./assets/library-cover.jpg"); }

.title-slide.active {
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
}

.title-slide .copy {
  text-align: center;
  justify-items: center;
  max-width: 52rem;
  display: grid;
  gap: .55rem;
}

.title-slide .kicker-row { justify-content: center; }

.thanks-slide.active {
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
}

.thanks-slide h1 {
  font-size: clamp(3.4rem, 10cqw, 6.4rem);
  text-align: center;
  text-wrap: balance;
}

.section-slide.active {
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: end;
}

.section-slide .copy {
  align-self: end;
  max-width: 58rem;
  display: grid;
  gap: .55rem;
}

.giant-lines {
  display: grid;
  gap: .15em;
  align-content: center;
  height: 100%;
  min-height: 0;
}

.reveal-line {
  opacity: 0;
  transform: translateY(.35rem);
  font-weight: 800;
  line-height: 1.02;
  font-size: clamp(2.3rem, 8.2cqh, 4.5rem);
  color: var(--accent);
}

.reveal-line.is-on {
  opacity: 1;
  transform: none;
  transition: opacity .32s ease, transform .32s ease;
}

.reveal-line small {
  display: inline;
  margin-left: .35em;
  font-size: .34em;
  font-weight: 600;
  color: var(--muted);
}

.alcove {
  position: relative;
  height: 100%;
  min-height: 0;
}

.alcove .media { height: 100%; }

.alcove-labels {
  position: absolute;
  left: .55rem;
  right: .55rem;
  bottom: .55rem;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .4rem;
}

.alcove-labels span {
  text-align: center;
  background: rgba(7, 11, 18, 0.78);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .28rem .2rem;
  font-weight: 800;
  font-size: .62em;
}

.kicker-row {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.kicker {
  border: 1px solid var(--border);
  background: rgba(8, 14, 22, 0.7);
  border-radius: 999px;
  padding: .28rem .7rem;
  font-size: .62em;
  letter-spacing: .04em;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .6rem;
  min-height: 0;
  height: 100%;
}

.demo-grid .shot-slot { min-height: 0; }

.controls {
  grid-column: 1 / -1;
  position: relative;
  z-index: 8;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(.5rem, 2vw, 2rem);
  padding: .5rem clamp(.5rem, 1.6vw, 1.5rem);
  border-top: 1px solid var(--border);
  background: #060a10;
}

.deck-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .65rem;
}

.deck-identity-mark {
  width: 4px;
  align-self: stretch;
  min-height: 38px;
  border-radius: 999px;
  background: var(--accent);
}

.deck-identity-copy { min-width: 0; display: grid; gap: .08rem; }

.deck-identity-copy strong,
.deck-identity-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-identity-copy strong { font-size: clamp(.74rem, 1vw, .96rem); }
.deck-identity-copy span { color: var(--muted); font-size: clamp(.58rem, .8vw, .76rem); }

.page-controls { display: flex; align-items: center; gap: .4rem; }

.page-controls #pageInfo {
  min-width: 4.2rem;
  color: var(--muted);
  font: 650 .7rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
}

.controls button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .42rem .65rem;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 5px;
  background: rgba(255,255,255,.075);
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 900px) {
  .deck-shell,
  .deck-shell.toc-collapsed { grid-template-columns: 1fr; }
  .toc,
  .toc-collapsed .toc,
  #tocToggle { display: none; }
  .split,
  .split.wide-text,
  .split.equal,
  .slide header,
  .cards.cols-4,
  .cards.cols-5,
  .steps,
  .demo-grid,
  .giant,
  .alcove-labels { grid-template-columns: 1fr; }
  .cards.cols-3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --footer-h: 72px; }
  .slide { padding: .72rem; }
  .nav-label { display: none; }
  .controls button { width: 38px; min-height: 38px; padding: 0; }
}
