:root {
  --bg: #000;
  --panel: #141414;
  --card: #2a2a2a;
  --accent: #e50914;
  --text: #fff;
  --muted: #888;
  --hover: #404040;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
}
.sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--bg);
  border-right: 1px solid #222;
  padding: 40px 24px 24px;
  overflow-y: auto;
  transition: width 0.3s ease;
}
.sidebar-heading {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
  color: var(--text);
}
.episode-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.episode-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid transparent;
}
.episode-item:hover {
  background: var(--hover);
  transform: translateX(4px);
}
.episode-item.active {
  background: #333;
  border-color: var(--muted);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15);
}
.episode-item .thumb {
  width: 96px;
  height: 54px;
  border-radius: 4px;
  object-fit: cover;
  background: #1c1c1c;
  flex-shrink: 0;
}
.episode-item .meta { min-width: 0; }
.episode-item .title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.episode-item .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px;
  overflow-y: auto;
}
.video-panel {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.player-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(200,24,0,0.1);
}
.player-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.player-heading {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}
/* Controls overlay */
.controls {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0.75) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.controls > * { pointer-events: auto; }
.player-stage.show-controls .controls { opacity: 1; }
.controls-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(0,0,0,0.6), transparent);
}
.controls-top .title-text {
  font-size: 16px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.seek-row { display: flex; align-items: center; gap: 10px; padding: 0 16px 8px; }
.seek-row .time {
  font-size: 12px;
  color: #ddd;
  font-variant-numeric: tabular-nums;
  min-width: 40px;
}
.progress {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}
.progress .filled {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  position: relative;
}
.progress .filled::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.15s ease;
}
.progress:hover .filled::after { transform: translateY(-50%) scale(1); }
.controls-bottom {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px 14px;
}
.icon-btn {
  background: transparent;
  border: none;
  color: #eee;
  cursor: pointer;
  border-radius: 50%;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease, filter 0.2s ease;
}
.icon-btn:hover { transform: scale(1.1); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.spacer { flex: 1; }
.volume-wrap { display: flex; align-items: center; gap: 6px; }
.volume-slider { width: 70px; }
.volume-slider::-webkit-slider-runnable-track { height: 4px; background: #555; border-radius: 2px; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; margin-top: -4px; cursor: pointer; }
/* Big center play button on click-to-play */
.clickplay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  opacity: 1;
  transition: opacity 0.3s ease;
}
.clickplay.hidden { opacity: 0; pointer-events: none; }
.clickplay .play-svg {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: rgba(20,20,20,0.9);
  border: 2px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.clickplay .play-svg:hover { transform: scale(1.1); background: var(--accent); }
.clickplay .play-svg svg { width: 36px; height: 36px; fill: #fff; margin-left: 4px; }
.animate-pulse { animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,9,20,0.5); }
  50% { box-shadow: 0 0 0 18px rgba(229,9,20,0); }
}
/* Quality toast */
.toast {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: rgba(0,0,0,0.8);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translateX(-50%) scale(1); }
/* Skip button flash */
.skip-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.skip-flash.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.skip-flash svg { width: 30px; height: 30px; fill: #fff; }
.loader {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.4s ease;
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader-ring {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  background: #000;
  text-align: center;
  padding: 20px;
}
@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid #222; padding: 16px; }
  .episode-list { flex-direction: row; }
  .episode-item .thumb { width: 80px; height: 45px; }
  .main { padding: 16px; }
}