:root {
  --bg: #0f0f0f;
  --panel: #1a1a1a;
  --text: #f1f1f1;
  --muted: #aaa;
  --accent: #ff4444;
  --border: #333;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 56px;
}

/* ── site chrome ── */
.site-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.site-header .titles { flex: 1; min-width: 0; }
.site-header h1 { font-size: 1.25rem; font-weight: 600; }
.site-header p { color: var(--muted); font-size: 0.875rem; margin-top: 4px; line-height: 1.5; }
.site-header .back-link {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: #74b9ff;
  text-decoration: none;
}
.site-header .back-link:hover { text-decoration: underline; }
.roger-mark {
  flex-shrink: 0;
  display: block;
  opacity: 0.92;
  transition: opacity 0.15s;
}
.roger-mark:hover { opacity: 1; }
.roger-mark img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: block;
  box-shadow: 0 2px 12px rgba(0,0,0,0.45);
}

.disclaimer {
  position: fixed;
  bottom: 12px;
  right: 12px;
  max-width: 300px;
  font-size: 0.7rem;
  color: var(--muted);
  background: rgba(20,20,20,0.94);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 8px;
  z-index: 200;
  line-height: 1.5;
  backdrop-filter: blur(6px);
}
@media (max-width: 640px) {
  .disclaimer {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

/* ── hub (index) ── */
.hub { max-width: 720px; margin: 0 auto; padding: 32px 24px; }
.hub h2 { font-size: 1rem; color: var(--muted); margin-bottom: 20px; font-weight: 500; }
.episode-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.episode-card {
  display: block;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.episode-card:hover {
  border-color: var(--accent);
  background: #222;
}
.episode-card .ep-num {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 4px;
}
.episode-card .ep-title { font-size: 1.05rem; font-weight: 600; }
.episode-card .ep-meta { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }

/* ── player layout ── */
.layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 88px);
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
}
.main { padding: 20px; }

/* 影片 + 字幕舞台（可進入自訂全螢幕） */
.stage {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.video-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
}
#player { position: absolute; inset: 0; width: 100%; height: 100%; }

.fs-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.15s, background 0.15s;
}
.fs-btn:hover { opacity: 1; background: rgba(0,0,0,0.85); }
.fs-btn-inline {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}
.fs-btn-inline:hover { border-color: var(--accent); }

.subtitle-box {
  margin-top: 16px;
  padding: 20px 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 120px;
}
.stage .subtitle-box {
  margin-top: 0;
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--border);
}

/* ── 自訂全螢幕：影片最大化 + 底部字幕疊層 ── */
.stage:fullscreen,
.stage:-webkit-full-screen {
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: #000;
}
.stage:fullscreen .video-wrap,
.stage:-webkit-full-screen .video-wrap {
  position: absolute;
  inset: 0;
  padding-bottom: 0;
  width: 100%;
  height: 100%;
}
.stage:fullscreen .subtitle-box,
.stage:-webkit-full-screen .subtitle-box {
  position: absolute;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  width: min(92vw, 1100px);
  z-index: 15;
  margin: 0;
  padding: 14px 22px 16px;
  min-height: auto;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  pointer-events: none;
}
.stage:fullscreen .subtitle-box .zh,
.stage:-webkit-full-screen .subtitle-box .zh {
  font-size: clamp(1.1rem, 2.8vw, 1.75rem);
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.stage:fullscreen .subtitle-box .speaker,
.stage:-webkit-full-screen .subtitle-box .speaker {
  text-align: center;
  font-size: 0.75rem;
}
.stage:fullscreen .subtitle-box .en,
.stage:-webkit-full-screen .subtitle-box .en {
  text-align: center;
  font-size: 0.85rem;
}
.stage:fullscreen .fs-btn,
.stage:-webkit-full-screen .fs-btn {
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  z-index: 25;
  pointer-events: auto;
}

body:has(.stage:fullscreen) .disclaimer,
body:has(.stage:-webkit-full-screen) .disclaimer {
  display: none;
}
.subtitle-box .speaker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
  opacity: 0.9;
}
.subtitle-box .zh {
  font-size: 1.35rem;
  line-height: 1.6;
  font-weight: 500;
}
.subtitle-box .en {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.5;
}
.subtitle-box.empty .zh { color: var(--muted); font-size: 1rem; font-weight: 400; }
.controls {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.controls label { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.sidebar {
  border-left: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 88px);
}
@media (max-width: 960px) {
  .sidebar { max-height: 400px; border-left: none; border-top: 1px solid var(--border); }
}
.sidebar h2 {
  padding: 14px 16px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.transcript { overflow-y: auto; flex: 1; padding: 8px 0; }
.line {
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s;
}
.line:hover { background: rgba(255,255,255,0.04); }
.line.active {
  background: rgba(255,68,68,0.12);
  border-left-color: var(--accent);
}
.line .sp { font-size: 0.72rem; font-weight: 600; margin-bottom: 3px; opacity: 0.75; }
.line .txt { font-size: 0.88rem; line-height: 1.45; }
.line .time { font-size: 0.68rem; color: var(--muted); margin-top: 2px; }
.cast {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
  flex-shrink: 0;
}
.cast strong { color: var(--text); }
.loading, .error-msg {
  max-width: 600px;
  margin: 48px auto;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.error-msg { color: var(--accent); }
