:root {
  color-scheme: light;
  --paper: #f4f1ea;
  --paper-deep: #e9e4da;
  --ink: #171714;
  --muted: #777267;
  --line: #d9d3c7;
  --accent: #e34b2f;
  --accent-soft: #f7ded6;
  --panel: #fbfaf6;
  --shadow: 0 24px 70px rgba(45, 39, 29, .12);
}

* { box-sizing: border-box; }

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

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

button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  height: 72px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(244, 241, 234, .9);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 760;
  letter-spacing: -.035em;
  font-size: 20px;
}

.brand em { color: var(--accent); font-style: normal; }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  font-size: 12px;
  padding-left: 2px;
}

.topbar p { margin: 0; color: var(--muted); font-size: 13px; }

.workspace {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
}

.video-side {
  padding: clamp(22px, 3.1vw, 48px);
  border-right: 1px solid var(--line);
  min-width: 0;
}

.player-shell {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #171714;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}

#player, #player iframe { width: 100%; height: 100%; display: block; }

.player-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: #ded8cc;
  background: radial-gradient(circle at 40% 30%, #3e3a34, #151513 66%);
}

.player-placeholder span {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding-left: 4px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  font-size: 20px;
}

.player-placeholder p { margin: 0; font-size: 14px; }
.player-placeholder.hidden { display: none; }

.player-fallback {
  margin-top: 5px;
  padding: 11px 17px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(227, 75, 47, .24);
}

.player-fallback[hidden] { display: none; }

.now-playing {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 28px 2px 30px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--accent);
  font-weight: 760;
  font-size: 10px;
}

.now-playing h1 {
  max-width: 720px;
  margin: 7px 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(23px, 2.2vw, 34px);
  line-height: 1.08;
  letter-spacing: -.025em;
}

.now-playing p { color: var(--muted); margin: 0; font-size: 13px; }

.youtube-link {
  color: var(--ink);
  text-underline-offset: 4px;
  font-size: 13px;
  white-space: nowrap;
}

.sources { padding-top: 26px; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-heading h2 { font-size: 15px; margin: 0; }
.section-heading span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }

.source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.source-card {
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 11px;
  text-align: left;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.source-card:hover { background: var(--panel); transform: translateY(-1px); }
.source-card.active { border-color: #d2c9ba; background: var(--panel); }

.source-card img {
  width: 96px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: var(--paper-deep);
}

.source-card strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 690;
}

.source-card small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }

.source-skeleton {
  height: 74px;
  border-radius: 12px;
  background: linear-gradient(90deg, #ebe6dc 25%, #f5f2eb 50%, #ebe6dc 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer { to { background-position: -200% 0; } }

.reading-side {
  background: var(--panel);
  min-width: 0;
  max-height: calc(100vh - 72px);
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
}

.tabs {
  display: flex;
  gap: 28px;
  padding: 0 clamp(24px, 4vw, 58px);
  height: 70px;
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 0 17px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.tab[hidden] { display: none; }

.reading-status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(24px, 4vw, 58px) 0;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .11em;
}

#timingBadge { color: #9a6830; }

.content {
  overflow-y: auto;
  padding: 28px clamp(24px, 4vw, 58px) 80px;
  scrollbar-color: #c9c1b5 transparent;
}

.content p,
.content li {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(16px, 1.3vw, 19px);
  line-height: 1.72;
}

.content p { margin: 0 0 1.35em; }
.content h1, .content h2, .content h3, .content h4 { font-family: Georgia, "Times New Roman", serif; line-height: 1.18; letter-spacing: -.02em; }
.content h1 { font-size: 32px; }
.content h2 { margin: 1.8em 0 .65em; font-size: 25px; }
.content h3 { margin: 1.6em 0 .55em; font-size: 20px; }
.content ul { padding-left: 22px; }
.content a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }

.time-link {
  font-family: inherit;
  font-weight: 700;
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
}

.loading { color: var(--muted); }

.empty-state {
  min-height: 60vh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 { color: var(--ink); margin: 18px 0 6px; }
.empty-state p { max-width: 390px; font: 14px/1.5 Inter, sans-serif; margin: 0; }
.empty-icon { width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-family: Georgia, serif; color: var(--accent); }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, .92fr) minmax(390px, 1.08fr); }
  .source-list { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .topbar { height: 60px; }
  .topbar p { display: none; }
  .workspace { display: block; }
  .video-side { border-right: 0; padding: 18px; }
  .reading-side { position: static; max-height: none; border-top: 1px solid var(--line); }
  .content { min-height: 65vh; overflow: visible; }
  .tabs { position: sticky; top: 60px; background: rgba(251,250,246,.94); backdrop-filter: blur(12px); z-index: 10; padding: 0 22px; gap: 22px; }
  .source-list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 7px; }
  .source-card { flex: 0 0 280px; scroll-snap-align: start; }
  .now-playing { align-items: flex-start; }
}
