/* =========================================================
   Variables & Reset
   ========================================================= */
:root {
  --bg:          #12121f;
  --bg-card:     #1c1c2e;
  --bg-hover:    #252540;
  --sidebar-bg:  #0e0e1a;
  --border:      rgba(255,255,255,0.08);
  --accent:      #e94560;
  --accent-blue: #4f8ef7;
  --text:        #e8e8f0;
  --text-muted:  #7a7a9a;
  --text-light:  #b0b0c8;
  --success:     #2ecc71;
  --danger:      #e74c3c;
  --sidebar-w:   240px;
  --player-h:    80px;
  --radius:      10px;
  --radius-sm:   6px;
  --transition:  0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
ul { list-style: none; }

/* =========================================================
   Layout
   ========================================================= */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
}

.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding-bottom: calc(var(--player-h) + 16px);
}

.content {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* =========================================================
   Sidebar
   ========================================================= */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.mobile-header { display: none; }

.nav-links { padding: 12px 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: 0.93rem;
  border-radius: var(--radius-sm);
  margin: 2px 8px;
  transition: background var(--transition), color var(--transition);
}
.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link.active { background: rgba(233,69,96,0.15); color: var(--accent); }

.badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.badge--success { background: var(--success); }

.sidebar-section { padding: 12px 0; border-top: 1px solid var(--border); }

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 4px 16px 8px;
}

.podcast-list-nav { padding: 0 8px; }

.podcast-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: background var(--transition), color var(--transition);
}
.podcast-nav-item:hover { background: var(--bg-hover); color: var(--text); }

.podcast-nav-thumb {
  width: 28px; height: 28px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}
.podcast-nav-placeholder { width: 28px; height: 28px; border-radius: 5px; background: var(--bg-hover); flex-shrink: 0; }
.podcast-nav-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-footer { margin-top: auto; padding: 12px 0; border-top: 1px solid var(--border); }

/* =========================================================
   Page header
   ========================================================= */
.page-header { margin-bottom: 28px; }
.page-header--flex { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-header-actions { display: flex; align-items: center; gap: 8px; }
.page-header-actions form { display: contents; }

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

/* =========================================================
   Podcasts library grid
   ========================================================= */
.podcasts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}

.podcast-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  transition: background var(--transition), transform var(--transition);
}
.podcast-card:hover { background: var(--bg-hover); transform: translateY(-2px); }

.podcast-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.podcast-card-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.podcast-card-body { padding: 10px 12px 12px; }

.podcast-card-title {
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.podcast-card-author {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.podcast-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.podcast-card-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  line-height: 1.5;
}

.section { margin-bottom: 40px; }

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 500;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--secondary { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger-soft { color: var(--danger); }
.btn--danger-soft:hover { background: rgba(231,76,60,0.1); }
.btn--full { width: 100%; justify-content: center; }
.btn--sm { padding: 5px 12px; font-size: 0.8rem; }
.btn--icon { padding: 6px; border-radius: var(--radius-sm); color: var(--text-muted); }
.btn--icon:hover { background: var(--bg-hover); color: var(--text); }
.btn--active { color: var(--accent-blue); }
.btn--play { color: var(--accent); }
.btn--play:hover { background: rgba(233,69,96,0.1); }

/* =========================================================
   Forms / Inputs
   ========================================================= */
.input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  width: 100%;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.input:focus { border-color: var(--accent); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.88rem; }
.alert--error { background: rgba(231,76,60,0.15); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }

/* =========================================================
   Login page
   ========================================================= */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-container {
  width: 100%;
  max-width: 380px;
  padding: 40px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  color: var(--accent);
}
.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.login-form .btn { margin-top: 8px; }

/* =========================================================
   Episode rows
   ========================================================= */
.episodes-list { display: flex; flex-direction: column; gap: 4px; }

.episode-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: background var(--transition);
}
.episode-row:hover { background: var(--bg-hover); }
.episode-row--completed { opacity: 0.5; }
.episode-row--completed:hover { opacity: 0.85; }

.episode-row-img {
  width: 44px; height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.episode-row-body { flex: 1; min-width: 0; }
.episode-row-podcast { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.episode-row-title { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.episode-row-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.episode-row-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* Episode cards (in-progress) */
.episodes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

.episode-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
.episode-card-img { width: 100%; height: 140px; object-fit: cover; }
.episode-card-body { flex: 1; padding: 12px; }
.episode-card-podcast { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.episode-card-title { font-size: 0.88rem; font-weight: 500; margin-bottom: 8px; }
.episode-card-meta { font-size: 0.78rem; color: var(--text-muted); }
.episode-card-actions { padding: 0 12px 12px; display: flex; justify-content: flex-end; }

.episode-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 6px;
  overflow: hidden;
}
.episode-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

/* =========================================================
   Podcast detail header
   ========================================================= */
.podcast-header {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
  align-items: flex-start;
}
.podcast-header-img {
  width: 140px;
  height: 140px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
}
.podcast-header-body { flex: 1; }
.podcast-header-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.podcast-header-author { font-size: 0.9rem; color: var(--accent); margin-bottom: 8px; }
.podcast-header-desc { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
.podcast-header-meta { font-size: 0.82rem; color: var(--text-muted); display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.podcast-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* =========================================================
   Search
   ========================================================= */
.search-section { margin-bottom: 32px; }
.search-form { margin-bottom: 24px; }
.search-input-wrap { display: flex; gap: 8px; align-items: center; position: relative; }
.search-icon { position: absolute; left: 12px; color: var(--text-muted); pointer-events: none; }
.search-input { padding-left: 42px; flex: 1; }
.rss-section { padding: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.rss-form .search-input-wrap input { flex: 1; }

.search-results { display: flex; flex-direction: column; gap: 8px; }
.search-result-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.search-result-img, .search-result-placeholder {
  width: 60px; height: 60px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-hover);
}
.search-result-body { flex: 1; min-width: 0; }
.search-result-title { font-size: 0.92rem; font-weight: 600; margin-bottom: 2px; }
.search-result-author { font-size: 0.82rem; color: var(--text-muted); }
.search-result-genre { font-size: 0.75rem; color: var(--accent); margin-top: 2px; }
.search-result-action { flex-shrink: 0; }

/* =========================================================
   Playlist
   ========================================================= */
.playlist-hint { font-size: 0.82rem; margin-bottom: 12px; }
.playlist-items { display: flex; flex-direction: column; gap: 4px; }

.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.playlist-item.sortable-ghost { opacity: 0.4; }
.playlist-item.sortable-chosen { background: var(--bg-hover); box-shadow: 0 4px 20px rgba(0,0,0,0.4); }

.playlist-drag-handle { color: var(--text-muted); cursor: grab; flex-shrink: 0; }
.playlist-drag-handle:active { cursor: grabbing; }
.playlist-item-num { font-size: 0.75rem; color: var(--text-muted); width: 20px; text-align: right; flex-shrink: 0; }
.playlist-item-img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.playlist-item-body { flex: 1; min-width: 0; }
.playlist-item-podcast { font-size: 0.75rem; color: var(--accent-blue); margin-bottom: 2px; display: block; }
.playlist-item-title { font-size: 0.88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playlist-item-meta { font-size: 0.77rem; color: var(--text-muted); margin-top: 2px; }
.playlist-item-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* =========================================================
   Episode detail
   ========================================================= */
.ep-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 36px;
}
.ep-header-cover {
  width: 160px;
  height: 160px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-hover);
}
.ep-header-body { flex: 1; min-width: 0; }
.ep-header-podcast {
  font-size: 0.82rem;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
}
.ep-header-podcast:hover { text-decoration: underline; }
.ep-header-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}
.ep-header-meta { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 16px; }
.ep-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ep-header-actions form { display: contents; }

/* Description */
.ep-description {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-light);
  max-width: 720px;
}
.ep-description a { color: var(--accent-blue); text-decoration: underline; }
.ep-description p { margin-bottom: 10px; }

/* Chapters */
.chapters-list { display: flex; flex-direction: column; gap: 2px; }

.chapter-item { border-radius: var(--radius-sm); }

.chapter-seek-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: left;
  background: none;
  color: var(--text);
  transition: background var(--transition);
  cursor: pointer;
}
.chapter-seek-btn:hover { background: var(--bg-hover); }
.chapter-item--active .chapter-seek-btn { background: rgba(233,69,96,0.1); }
.chapter-item--active .chapter-time { color: var(--accent); }

.chapter-img {
  width: 36px;
  height: 36px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}
.chapter-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 42px;
}
.chapter-title { font-size: 0.88rem; flex: 1; }
.chapter-link {
  color: var(--text-muted);
  flex-shrink: 0;
  padding: 2px 4px;
  border-radius: 4px;
  display: flex;
}
.chapter-link:hover { color: var(--accent-blue); background: var(--bg-hover); }

/* episode-row-title as a link */
a.episode-row-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
a.episode-row-title:hover { color: var(--accent); }

/* =========================================================
   Stats
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  text-align: center;
}
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.stat-label { font-size: 0.82rem; color: var(--text-muted); }

.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 32px; }
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
canvas { width: 100%; }

.podcast-stats-list { display: flex; flex-direction: column; gap: 10px; }
.podcast-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.podcast-stat-img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.podcast-stat-body { flex: 1; min-width: 0; }
.podcast-stat-title { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 8px; }
.podcast-stat-title:hover { color: var(--accent); }

.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.5s ease; }
.progress-label { font-size: 0.78rem; color: var(--text-muted); }
.podcast-stat-time { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* =========================================================
   Player bar
   ========================================================= */
.player-bar {
  position: fixed;
  bottom: 0; left: var(--sidebar-w); right: 0;
  height: var(--player-h);
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  z-index: 200;
}

.player-cover { flex-shrink: 0; }
.player-cover-img { width: 52px; height: 52px; border-radius: 7px; object-fit: cover; background: var(--bg-hover); }

.player-info { width: 200px; flex-shrink: 0; overflow: hidden; }
.player-episode-title { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-podcast-title { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.player-btn { color: var(--text-muted); padding: 6px; border-radius: 50%; transition: color var(--transition), background var(--transition); }
.player-btn:hover { color: var(--text); background: var(--bg-hover); }
.player-btn--main { color: var(--accent); background: rgba(233,69,96,0.12); width: 40px; height: 40px; }
.player-btn--main:hover { background: rgba(233,69,96,0.25); }

.player-progress { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.player-time { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }

.player-seekbar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  border-radius: 4px;
}
.player-seekbar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  pointer-events: none;
  width: 0%;
  transition: width 0.25s linear;
}
.player-seekbar:hover .player-seekbar-fill { background: var(--accent); }

.player-extra { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.player-speed {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
}
.player-volume-label { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.player-volume { width: 70px; accent-color: var(--accent); cursor: pointer; }

/* =========================================================
   Utilities
   ========================================================= */
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state p { font-size: 1.05rem; }

.messages { margin-bottom: 20px; }
.message { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.88rem; }
.message--success { background: rgba(46,204,113,0.12); color: var(--success); }
.message--error { background: rgba(231,76,60,0.12); color: var(--danger); }
.message--warning { background: rgba(243,156,18,0.12); color: #f39c12; }
.message--info { background: rgba(79,142,247,0.12); color: var(--accent-blue); }

/* =========================================================
   Episode bottom sheet
   ========================================================= */
.episode-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 390;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.episode-sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.episode-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  z-index: 400;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.episode-sheet.open {
  transform: translateY(0);
}

.episode-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}

.episode-sheet-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 28px max(env(safe-area-inset-bottom), 28px);
  text-align: center;
  overflow-y: auto;
  flex: 1;
}

.episode-sheet-cover {
  width: 180px;
  height: 180px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--bg-hover);
  flex-shrink: 0;
  margin-bottom: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.episode-sheet-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.episode-sheet-podcast {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.episode-sheet-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  text-align: left;
  width: 100%;
  padding: 10px 0 2px;
  border-top: 1px solid var(--border);
}
.episode-sheet-desc:empty { display: none; }
.episode-sheet-desc p { margin-bottom: 6px; }
.episode-sheet-desc a { color: var(--accent-blue); }

.episode-sheet-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.episode-sheet-speed-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.episode-sheet-link {
  font-size: 0.82rem;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-light);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.episode-sheet-link:hover { background: var(--bg-hover); color: var(--text); }

/* =========================================================
   Subscribe loading overlay
   ========================================================= */
@keyframes spin { to { transform: rotate(360deg); } }

.subscribe-loader {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 31, 0.82);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.subscribe-loader[hidden] { display: none; }

.subscribe-loader-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  max-width: 320px;
}

.subscribe-loader-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

.subscribe-loader-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.subscribe-loader-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* =========================================================
   Sidebar search
   ========================================================= */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 8px 4px;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}
.sidebar-search:focus-within { border-color: var(--accent); }
.sidebar-search-icon { color: var(--text-muted); flex-shrink: 0; }
.sidebar-search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.85rem;
  width: 100%;
  min-width: 0;
}
.sidebar-search-input::placeholder { color: var(--text-muted); }

/* =========================================================
   Favorite button
   ========================================================= */
.favorite-btn svg { fill: none; }
.favorite-btn.btn--active { color: var(--accent); }
.favorite-btn.btn--active svg { fill: currentColor; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
    --player-h: 92px;
  }

  body { flex-direction: column; }

  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }

  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 99;
  }
  .hamburger-btn {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    flex-shrink: 0;
  }
  .mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
  }

  .main-wrapper { margin-left: 0; }

  /* Player — 2-row layout on mobile */
  .player-bar {
    left: 0;
    height: auto;
    flex-wrap: wrap;
    padding: 10px 12px max(env(safe-area-inset-bottom), 10px);
    gap: 6px 10px;
    align-items: center;
  }

  .player-cover { cursor: pointer; flex-shrink: 0; }
  .player-cover-img { width: 46px; height: 46px; border-radius: 8px; }

  .player-info {
    display: block;
    flex: 1;
    min-width: 0;
    width: auto;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .player-info:active .player-episode-title,
  .player-info:active .player-podcast-title { opacity: 0.7; }

  .player-controls { flex-shrink: 0; gap: 4px; }

  .player-btn { padding: 8px; }
  .player-btn--main { width: 38px; height: 38px; }

  /* Progress bar fills the full second row */
  .player-progress {
    width: 100%;
    order: 10;
    gap: 6px;
    padding-bottom: 2px;
  }

  /* Larger seekbar touch target */
  .player-seekbar {
    height: 5px;
    border-radius: 4px;
  }

  /* Hide volume on mobile — use system controls */
  .player-extra { display: none; }

  .charts-row { grid-template-columns: 1fr; }

  .podcast-header { flex-direction: column; }
  .podcast-header-img { width: 100px; height: 100px; }

  .ep-header { flex-direction: column; }
  .ep-header-cover { width: 120px; height: 120px; }

  .podcasts-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }

  .episode-row-title,
  a.episode-row-title,
  .playlist-item-title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}
