:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --surface-2: #f4f2ef;
  --ink: #1c1b19;
  --ink-2: #6b6862;
  --ink-3: #a09c95;
  --line: #e7e4df;
  --accent: #a8452f;
  --accent-soft: rgba(168, 69, 47, 0.075);
  --accent-line: rgba(168, 69, 47, 0.35);
  --sans: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", "Songti SC", serif;
  --radius: 10px;
  --maxw: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15151a;
    --surface: #1c1c22;
    --surface-2: #232329;
    --ink: #ecebe7;
    --ink-2: #a4a19a;
    --ink-3: #726f6a;
    --line: #2b2b32;
    --accent: #e08a72;
    --accent-soft: rgba(224, 138, 114, 0.1);
    --accent-line: rgba(224, 138, 114, 0.4);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, select { font: inherit; color: inherit; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }

.mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: 0.01em; }
.brand p { margin: 1px 0 0; font-size: 12px; color: var(--ink-3); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chip:hover { border-color: var(--ink-3); color: var(--ink); }

.chip:disabled,
.round:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.chip:disabled:hover { border-color: var(--line); color: var(--ink-2); }
.round:disabled:hover { border-color: var(--line); color: var(--ink-2); }

.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
}

.meta { font-size: 12px; color: var(--ink-3); margin-left: 4px; }

/* ----------------------------------------------------------------- layout */

.layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px 96px;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 20px; padding: 18px 16px 96px; }
  .sidebar { order: 2; }
  .content { order: 1; }
}

/* ---------------------------------------------------------------- sidebar */

.sidebar { position: sticky; top: 82px; }

@media (max-width: 860px) {
  .sidebar { position: static; }
}

.sidebar-title {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px 2px;
}

.episodes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 860px) {
  .episodes {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }
  .episodes li { flex: 0 0 210px; }
}

.ep {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  transition: background 0.13s ease, border-color 0.13s ease;
}

.ep:hover { background: var(--surface-2); }

.ep[aria-current="true"] {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ep-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}

.ep[aria-current="true"] .ep-date { color: var(--accent); }

.ep-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink-3); opacity: 0.5; flex: none;
}
.ep[data-ready="1"] .ep-dot { background: var(--accent); opacity: 1; }

.ep-title {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ep[aria-current="true"] .ep-title { color: var(--ink); font-weight: 550; }

/* ---------------------------------------------------------------- content */

.empty { color: var(--ink-3); padding: 48px 0; text-align: center; }

.ep-head { margin-bottom: 20px; }

.ep-head h2 {
  margin: 4px 0 0;
  font-size: 21px;
  line-height: 1.45;
  font-weight: 620;
  letter-spacing: -0.005em;
}

.ep-date-lg { font-size: 12.5px; color: var(--accent); font-variant-numeric: tabular-nums; }

.ep-title-zh { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.ep-title-zh:empty { display: none; }

.ep-links {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 12px 0 0; font-size: 12.5px; color: var(--ink-3);
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--surface-2);
  color: var(--ink-3);
  border: 1px solid var(--line);
}

.badge.ok { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

/* ----------------------------------------------------------------- player */

.player {
  position: sticky;
  top: 72px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.035);
}

.play {
  width: 38px; height: 38px;
  flex: none;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: var(--accent); color: #fff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.play:hover { filter: brightness(1.08); }
.play:active { transform: scale(0.94); }

.round {
  min-width: 40px; height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all 0.13s ease;
}
.round:hover { border-color: var(--ink-3); color: var(--ink); }
.round[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.track { flex: 1 1 140px; min-width: 120px; padding: 8px 0; cursor: pointer; }
.bar { height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.1s linear; }

.time {
  font-size: 12px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.speed { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.speed select {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 5px 6px;
  font-size: 12px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------- tabs */

.tabs { display: flex; gap: 4px; margin-bottom: 14px; }

.tab {
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.13s ease;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.is-active { background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------- transcript */

.transcript { display: flex; flex-direction: column; }

.s {
  position: relative;
  margin: 0;
  padding: 9px 12px 9px 14px;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
  scroll-margin-top: 150px;
}

.s:hover { background: var(--surface-2); }

.s.is-active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.s .fr {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.85;
  color: var(--ink);
  display: block;
}

.s.is-active .fr { font-weight: 600; }

.s .zh {
  display: none;
  margin-top: 5px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-2);
  border-left: 1px solid var(--line);
  padding-left: 10px;
}

body.show-zh .s .zh:not(:empty) { display: block; }
body.show-zh .s.has-zh { padding-bottom: 12px; }

.hint {
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
  background: var(--surface);
}

/* ------------------------------------------------------------------ notes */

.notes { display: flex; flex-direction: column; gap: 26px; }

.note-group h3 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.note-group h3 .gzh { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }

.note-group > .gdesc { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-3); }

.note {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  margin-bottom: 8px;
}

.note-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.note-fr { font-weight: 620; font-size: 14.5px; }
.note-zh { color: var(--ink-2); font-size: 13.5px; }
.note-n { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-left: auto; }

.note-ex {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
  border-left: 2px solid var(--line);
  padding-left: 10px;
}
.note-ex em { font-style: normal; background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 2px; }

.note-explain { margin: 8px 0 0; font-size: 13px; line-height: 1.75; color: var(--ink-2); }

.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }

@media (max-width: 560px) {
  .player { top: 0; }
  .ep-head h2 { font-size: 18px; }
  .s .fr { font-size: 16px; }
}
