:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #fffdfa;
  --ink: #23201d;
  --muted: #6c6258;
  --line: #ddd5c8;
  --accent: #b43d2f;
  --accent-strong: #7f281f;
  --green: #2f6f57;
  --shadow: 0 12px 34px rgba(40, 31, 24, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px clamp(18px, 5vw, 56px);
  background: rgba(247, 245, 239, 0.92);
  border-bottom: 1px solid rgba(221, 213, 200, 0.8);
  backdrop-filter: blur(18px);
}

.brand {
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 800;
}

.chinese-toggle {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(40, 31, 24, 0.05);
}

.directory,
.episode-reader {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) 0;
}

.eyebrow,
.scene-label,
.episode-code {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 920px;
  margin: 8px 0 12px;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 1.05;
}

.lede,
.chinese-title {
  max-width: 760px;
  margin: 0 0 34px;
  color: var(--muted);
  font-size: 18px;
}

.season-section {
  margin-top: 44px;
}

.season-section h2 {
  margin: 0 0 16px;
  font-size: 24px;
}

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.episode-card {
  display: grid;
  gap: 8px;
  min-height: 158px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.episode-card:hover,
.episode-card:focus-visible {
  border-color: rgba(180, 61, 47, 0.5);
  outline: none;
}

.episode-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.episode-title-cn {
  align-self: end;
  color: var(--muted);
  font-size: 15px;
}

.episode-heading {
  margin-bottom: 32px;
}

.scene-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.scene-navigation a {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 800;
}

.scene {
  margin-top: 28px;
  padding-top: 28px;
}

.scene-heading {
  margin-bottom: 18px;
  padding: 18px;
  border-left: 4px solid var(--accent);
  background: rgba(255, 253, 250, 0.7);
}

.scene-heading p {
  margin: 0;
}

.scene-text {
  max-width: 900px;
}

.dialogues {
  display: grid;
  gap: 10px;
}

.dialogue-line {
  display: grid;
  grid-template-columns: minmax(112px, 160px) minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(221, 213, 200, 0.65);
}

.dialogue-line p {
  margin: 0;
}

.speaker {
  color: var(--accent-strong);
  font-weight: 800;
}

.dialogue-text {
  overflow-wrap: anywhere;
}

.chinese {
  color: #4c4540;
}

html[data-chinese-hidden="true"] [data-chinese-text] {
  visibility: hidden;
}

.episode-navigation {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 64px;
}

.episode-navigation a,
.episode-navigation span {
  min-width: 130px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 800;
}

.episode-navigation .disabled {
  color: var(--muted);
  opacity: 0.55;
}

@media (max-width: 760px) {
  .site-header {
    min-height: 58px;
  }

  h1 {
    font-size: 36px;
  }

  .dialogue-line {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .speaker {
    font-size: 14px;
  }

  .episode-navigation {
    flex-direction: column;
  }
}
