:root,
[data-theme="dark"] {
  --bg: #0c0b0a;
  --bg-elevated: #161310;
  --line: rgba(232, 220, 196, 0.12);
  --text: #f3eee6;
  --muted: #9a9185;
  --accent: #d4c0a0;
  --player-bg: #110e0b;
  --card: #14110e;
  --sans: "Noto Sans TC", "PingFang HK", "Microsoft JhengHei", sans-serif;
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
}

[data-theme="light"] {
  --bg: #f3efe7;
  --bg-elevated: #fffcf7;
  --line: rgba(40, 32, 20, 0.12);
  --text: #1c1915;
  --muted: #6a635a;
  --accent: #8a6a3d;
  --player-bg: #110e0b;
  --card: #faf7f1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--accent);
  color: #111;
  padding: 0.5rem 0.8rem;
  z-index: 20;
}

.skip-link:focus { top: 1rem; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 1rem;
}

.wordmark {
  margin: 0;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text);
  outline: none;
}

.theme-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  padding: 0;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
  outline: none;
}

.stage {
  padding: 0 0.75rem;
}

.player-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  aspect-ratio: 3 / 4;
  min-height: 34rem;
  background: var(--player-bg);
  border: 1px solid var(--line);
  overflow: hidden;
}

.player-shell video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}

.player-shell video:not([src]),
.player-shell.is-empty video {
  visibility: hidden;
}

.title-card {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 1.5rem 1.25rem;
  background: #0a0806;
}

.title-atmosphere {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.title-atmosphere span {
  position: absolute;
  inset: 0;
}

.atm-base {
  background:
    radial-gradient(88% 78% at 50% 46%, #1d1610 0%, #120e0b 48%, #080705 100%);
}

.atm-lamp {
  background:
    radial-gradient(58% 50% at 14% 4%, rgba(204, 150, 78, 0.42) 0%, rgba(140, 88, 36, 0.14) 34%, transparent 66%);
}

.atm-key {
  background:
    radial-gradient(48% 42% at 50% 48%, rgba(214, 160, 78, 0.58) 0%, rgba(156, 100, 42, 0.22) 36%, transparent 70%);
}

.atm-bloom {
  inset: auto;
  left: 50%;
  top: 47%;
  width: min(38rem, 84%);
  height: 15.5rem;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(226, 180, 96, 0.32) 0%, rgba(176, 116, 48, 0.1) 40%, transparent 72%);
  filter: blur(10px);
}

.atm-grain {
  background-image: url("grain.png");
  pointer-events: none;
}

.atm-grain-a {
  background-size: 320px 320px;
  opacity: 0.34;
  mix-blend-mode: overlay;
}

.atm-grain-b {
  background-size: 160px 160px;
  background-position: 48px 28px;
  opacity: 0.18;
  mix-blend-mode: soft-light;
}

.atm-vignette {
  background:
    radial-gradient(72% 66% at 50% 46%, transparent 28%, rgba(0, 0, 0, 0.28) 64%, rgba(0, 0, 0, 0.78) 100%);
}

.atm-frame {
  inset: 0.85rem 0.9rem;
  border: 1px solid rgba(232, 220, 196, 0.18);
}

.title-copy {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
}

.title-kicker {
  position: relative;
  margin: 0 0 1.25rem;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  color: var(--accent);
}

.title-kicker::after {
  content: "";
  display: block;
  width: 2.6rem;
  height: 1px;
  margin: 0.95rem auto 0;
  background: currentColor;
  opacity: 0.5;
}

.title-card h1 {
  position: relative;
  margin: 0;
  max-width: 12em;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.45rem, 6.2vw, 2.85rem);
  line-height: 1.45;
  letter-spacing: 0.06em;
  color: #f6f1e8;
  text-wrap: pretty;
  text-shadow: 0 0 2.8rem rgba(210, 160, 80, 0.2);
}

.title-break {
  display: block;
}

.player-shell:not(.is-empty) .title-card {
  display: none;
}

.stage-meta {
  width: min(720px, calc(100% - 2.5rem));
  margin: 1rem auto 0;
}

.stage-journey {
  margin: 0 0 0.2rem;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.stage-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
}

.epigraph {
  width: min(42rem, calc(100% - 2.5rem));
  margin: 2.4rem auto 0;
}

.nowrap { white-space: nowrap; }

.hero-lead {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 2;
  color: var(--muted);
  text-wrap: pretty;
}

.library {
  width: min(1040px, calc(100% - 2.5rem));
  margin: 3.2rem auto 0;
  padding-bottom: 3rem;
}

.library h2 {
  margin: 0 0 1.25rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.chapter-card,
.video-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 10.5rem;
  padding: 1.15rem 1.15rem 1.2rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: inherit;
  font: inherit;
  text-align: left;
}

.chapter-card.is-reserved {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 11.5rem;
  justify-content: space-between;
  border-color: rgba(232, 220, 196, 0.16);
}

.chapter-card.is-reserved::before,
.chapter-card.is-reserved::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.chapter-card.is-reserved::before {
  inset: 0;
  background-image: url("grain.png");
  background-size: 200px 200px;
  opacity: 0.28;
  mix-blend-mode: overlay;
  z-index: 1;
}

.chapter-card.is-reserved::after {
  inset: 0.6rem;
  border: 1px solid rgba(232, 220, 196, 0.1);
  z-index: 1;
}

.chapter-index,
.chapter-label {
  position: relative;
  z-index: 2;
}

.chapter-index {
  margin: 0;
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--text);
}

.chapter-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.chapter-card.is-reserved[data-chapter="01"] {
  justify-content: space-between;
  align-items: flex-start;
  background:
    radial-gradient(90% 80% at 12% 0%, rgba(196, 140, 72, 0.38) 0%, transparent 58%),
    radial-gradient(80% 70% at 50% 120%, rgba(80, 50, 24, 0.35) 0%, transparent 60%),
    linear-gradient(165deg, #2a2118 0%, #16110d 52%, #0e0c0a 100%);
}

.chapter-card.is-reserved[data-chapter="01"] .chapter-index {
  font-size: 2.85rem;
  font-weight: 600;
  color: #f7f1e8;
}

.chapter-card.is-reserved[data-chapter="02"] {
  justify-content: center;
  align-items: flex-start;
  background:
    radial-gradient(70% 90% at 100% 42%, rgba(168, 124, 68, 0.28) 0%, transparent 62%),
    radial-gradient(80% 60% at 20% 100%, rgba(40, 28, 16, 0.4) 0%, transparent 55%),
    linear-gradient(180deg, #161310 0%, #12100d 48%, #0d0b09 100%);
}

.chapter-card.is-reserved[data-chapter="02"] .chapter-index {
  font-size: 2.35rem;
  font-weight: 500;
  opacity: 0.92;
}

.chapter-card.is-reserved[data-chapter="02"] .chapter-label {
  position: absolute;
  left: 1.15rem;
  bottom: 1.2rem;
}

.chapter-card.is-reserved[data-chapter="03"] {
  justify-content: flex-end;
  align-items: flex-end;
  text-align: right;
  background:
    linear-gradient(180deg, rgba(196, 150, 88, 0.16) 0%, transparent 22%),
    radial-gradient(70% 70% at 88% 92%, rgba(150, 104, 52, 0.22) 0%, transparent 58%),
    linear-gradient(200deg, #14110e 0%, #0c0a09 62%, #090807 100%);
}

.chapter-card.is-reserved[data-chapter="03"] .chapter-index {
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.chapter-card.is-reserved[data-chapter="03"] .chapter-label {
  position: absolute;
  left: 1.15rem;
  top: 1.2rem;
  text-align: left;
}

[data-theme="light"] .chapter-card.is-reserved {
  border-color: rgba(40, 32, 20, 0.14);
}

[data-theme="light"] .chapter-card.is-reserved::before {
  opacity: 0.22;
  mix-blend-mode: multiply;
}

[data-theme="light"] .chapter-card.is-reserved::after {
  border-color: rgba(40, 32, 20, 0.1);
}

[data-theme="light"] .chapter-card.is-reserved[data-chapter="01"] {
  background:
    radial-gradient(90% 80% at 10% 0%, rgba(196, 150, 86, 0.32) 0%, transparent 58%),
    linear-gradient(165deg, #f7f1e4 0%, #efe6d4 55%, #e8dcc6 100%);
}

[data-theme="light"] .chapter-card.is-reserved[data-chapter="01"] .chapter-index {
  color: #1c1915;
}

[data-theme="light"] .chapter-card.is-reserved[data-chapter="02"] {
  background:
    radial-gradient(70% 90% at 100% 40%, rgba(160, 128, 80, 0.2) 0%, transparent 62%),
    linear-gradient(180deg, #efebe3 0%, #e7e1d6 50%, #ddd5c6 100%);
}

[data-theme="light"] .chapter-card.is-reserved[data-chapter="03"] {
  background:
    linear-gradient(180deg, rgba(140, 110, 70, 0.12) 0%, transparent 24%),
    radial-gradient(70% 70% at 88% 92%, rgba(120, 90, 50, 0.14) 0%, transparent 58%),
    linear-gradient(200deg, #e6dfd2 0%, #d9cfc0 58%, #d0c4b2 100%);
}

.video-card {
  width: 100%;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.video-card:hover,
.video-card:focus-visible,
.video-card.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  outline: none;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #161310;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--accent);
  letter-spacing: 0.16em;
  font-size: 0.7rem;
}

.duration {
  position: absolute;
  right: 0.5rem;
  bottom: 0.45rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
}

.card-body { padding: 0.9rem 1rem 1.05rem; }

.card-category {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
}

.card-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
}

.site-footer {
  width: min(1040px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 0 0 2.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.site-footer p { margin: 0; }

@media (min-width: 720px) {
  .site-header { padding: 1.35rem 2rem 1.15rem; }

  .wordmark { font-size: 0.82rem; }

  .stage { padding: 0 2rem; }

  .player-shell {
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .atm-frame { inset: 1.15rem 1.25rem; }

  .title-kicker { margin-bottom: 1.45rem; font-size: 0.72rem; }

  .title-kicker::after { width: 3rem; margin-top: 1.05rem; }

  .title-card h1 { max-width: 14em; letter-spacing: 0.08em; }

  .epigraph {
    width: min(42rem, calc(100% - 4rem));
    margin-top: 3.1rem;
  }

  .hero-lead { font-size: 1.02rem; }

  .library {
    width: min(1040px, calc(100% - 4rem));
    margin-top: 4rem;
  }

  .video-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .chapter-card.is-reserved { min-height: 14rem; }

  .chapter-index { font-size: 3rem; }

  .chapter-card.is-reserved[data-chapter="01"] .chapter-index { font-size: 3.55rem; }

  .chapter-card.is-reserved[data-chapter="02"] .chapter-index { font-size: 2.85rem; }

  .chapter-card.is-reserved[data-chapter="03"] .chapter-index { font-size: 2.15rem; }

  .site-footer { width: min(1040px, calc(100% - 4rem)); }
}
