:root {
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 160ms ease;
  --player-h: 104px;
  --sidebar-w: 320px;
  --right-w: 400px;
}

:root {
  --track: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] {
  --track: rgba(255, 255, 255, 0.22);
  --bg: #0e0f12;
  --bg-elev: #16181d;
  --bg-elev-2: #1d2026;
  --bg-hover: #20242b;
  --border: #262a31;
  --text: #e7e9ee;
  --text-muted: #9aa0aa;
  --text-dim: #6b7280;
  --accent: #8b5cf6;
  --accent-hover: #a78bfa;
  --danger: #ef4444;
  --danger-hover: #f87171;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --track: rgba(0, 0, 0, 0.16);
  --bg: #f7f7f9;
  --bg-elev: #ffffff;
  --bg-elev-2: #f1f2f5;
  --bg-hover: #ebeef2;
  --border: #e3e5ea;
  --text: #1a1c20;
  --text-muted: #5a6068;
  --text-dim: #8a909a;
  --accent: #6d28d9;
  --accent-hover: #7c3aed;
  --danger: #dc2626;
  --danger-hover: #ef4444;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"][data-hc="on"] {
  --track: #ffffff;
  --bg: #000000;
  --bg-elev: #000000;
  --bg-elev-2: #000000;
  --bg-hover: #1a1a1a;
  --border: #ffffff;
  --text: #ffffff;
  --text-muted: #ffffff;
  --text-dim: #c7c7c7;
  --accent: #ffffff;
  --accent-hover: #ffffff;
  --danger: #ff6b6b;
  --danger-hover: #ff8a8a;
  --shadow: 0 8px 32px rgba(255, 255, 255, 0.08);
}

[data-theme="light"][data-hc="on"] {
  --track: #000000;
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-elev-2: #ffffff;
  --bg-hover: #f0f0f0;
  --border: #000000;
  --text: #000000;
  --text-muted: #000000;
  --text-dim: #333333;
  --accent: #000000;
  --accent-hover: #000000;
  --danger: #b91c1c;
  --danger-hover: #991b1b;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }

/* Layout */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  padding-bottom: 0;
  transition: padding-bottom var(--transition);
}
body.player-active .app { padding-bottom: var(--player-h); }
@media (min-width: 1200px) {
  body.player-active .app {
    grid-template-columns: var(--sidebar-w) 1fr var(--right-w);
  }
}

/* Sidebar */
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;
}

.brand {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.add-btn {
  margin: 8px 16px 12px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.add-btn:hover { background: var(--accent-hover); }

[data-theme="dark"] .add-btn {
  background: #000;
  color: #fff;
  border-color: #fff;
}
[data-theme="dark"] .add-btn:hover {
  background: #fff;
  color: #000;
}

/* High-contrast overrides (works for both dark+hc and light+hc via variables) */
[data-hc="on"] .brand {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--text);
}

[data-hc="on"] .add-btn,
[data-hc="on"] .primary-btn,
[data-hc="on"] .ghost-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
[data-hc="on"] .add-btn:hover,
[data-hc="on"] .primary-btn:hover,
[data-hc="on"] .ghost-btn:hover {
  background: var(--text);
  color: var(--bg);
}

[data-hc="on"] .podcast-item.active {
  outline: 2px solid var(--border);
  outline-offset: -2px;
}

[data-hc="on"] .episode-play {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
[data-hc="on"] .episode-play:hover,
[data-hc="on"] .episode-play.completed {
  background: var(--text);
  color: var(--bg);
}
[data-hc="on"] .episode-play.completed:hover {
  background: var(--bg);
  color: var(--text);
}

[data-hc="on"] #search,
[data-hc="on"] #rss-input {
  border: 1px solid var(--border);
}

[data-hc="on"] .ep-status.played {
  color: var(--text);
  font-weight: 700;
}
[data-hc="on"] .podcast-author {
  color: var(--text);
}

.search-wrapper {
  position: relative;
  margin: 0 16px 12px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
#search {
  width: 100%;
  padding: 9px 12px 9px 32px;
  background: var(--bg-elev-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}
#search:focus { border-color: var(--accent); }
#search::placeholder { color: var(--text-dim); }

.podcast-list {
  list-style: none;
  margin: 0;
  padding: 4px 8px 16px;
  overflow-y: auto;
  flex: 1;
}

.podcast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.podcast-item:hover { background: var(--bg-hover); }
.podcast-item.active { background: var(--bg-hover); }
.podcast-item.active .podcast-item-title { color: var(--accent-hover); }

.podcast-item-cover {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elev-2);
}

.podcast-item-meta {
  min-width: 0;
  flex: 1;
}
.podcast-item-title {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.podcast-item-author {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podcast-item-menu {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.podcast-item:hover .podcast-item-menu,
.podcast-item:focus-within .podcast-item-menu,
.podcast-item-menu:focus-visible,
.podcast-item-menu.open { opacity: 1; }
.podcast-item-menu:hover,
.podcast-item-menu.open {
  background: var(--bg-elev-2);
  color: var(--text);
}

.ctx-menu {
  position: fixed;
  z-index: 150;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  min-width: 150px;
  box-shadow: var(--shadow);
}
.ctx-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  transition: background var(--transition);
}
.ctx-menu-item:hover { background: var(--bg-hover); }
.ctx-menu-danger { color: var(--danger); }
.ctx-menu-danger:hover { background: rgba(239, 68, 68, 0.12); color: var(--danger-hover); }

.toast {
  position: fixed;
  bottom: calc(var(--player-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 220;
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease;
}
body:not(.player-active) .toast { bottom: 20px; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

.empty-list {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

/* Main */
.main {
  overflow-y: auto;
  position: relative;
}

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  gap: 8px;
  padding: 24px;
}
.empty-state h2 {
  margin: 8px 0 0;
  font-size: 18px;
  color: var(--text);
}
.empty-state p { margin: 0; max-width: 360px; }

.empty-add-btn {
  margin: 14px 0 4px;
  min-width: 180px;
}

.empty-suggestions {
  margin-top: 24px;
  width: 100%;
  max-width: 480px;
  text-align: left;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.empty-suggestions .suggestions-title {
  text-align: center;
  margin-bottom: 10px;
}

.podcast-view { padding: 32px 40px; max-width: 1100px; }

.podcast-header {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  margin-bottom: 32px;
}
.podcast-cover {
  width: 200px;
  height: 200px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg-elev-2);
  box-shadow: var(--shadow);
}
.podcast-meta { min-width: 0; display: flex; flex-direction: column; }
.podcast-author {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-hover);
}
.podcast-title {
  margin: 6px 0 12px;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.podcast-description {
  margin: 0 0 16px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.podcast-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* Episode list */
.episodes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.episodes-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.episode-search-wrapper {
  position: relative;
  width: 260px;
  max-width: 100%;
}
.episode-search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
#episode-search {
  width: 100%;
  padding: 8px 12px 8px 30px;
  background: var(--bg-elev-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
  font-size: 13px;
}
#episode-search:focus { border-color: var(--accent); }
#episode-search::placeholder { color: var(--text-dim); }
[data-hc="on"] #episode-search { border: 1px solid var(--border); }

.episode-empty {
  list-style: none;
  padding: 24px 12px;
  text-align: center;
  font-size: 13px;
}

.episodes-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#tags-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
}
#tags-btn.active {
  border: 1px solid var(--accent);
  color: var(--accent-hover);
}
.tags-btn-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
[data-hc="on"] .tags-btn-count {
  background: var(--text);
  color: var(--bg);
}

.tags-btn-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 2px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.tags-btn-clear:hover {
  background: var(--bg-hover);
  color: var(--danger);
}
[data-hc="on"] .tags-btn-clear:hover {
  background: var(--text);
  color: var(--bg);
}

/* Tags modal */
.tags-search-wrapper {
  position: relative;
  margin: 10px 0 14px;
}
.tags-search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
#tags-search {
  width: 100%;
  padding: 9px 12px 9px 30px;
  background: var(--bg-elev-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
  font-size: 13px;
}
#tags-search:focus { border-color: var(--accent); }
[data-hc="on"] #tags-search { border: 1px solid var(--border); }

.tags-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 4px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-elev-2);
  border-radius: var(--radius-sm);
}
.tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.tag-row:hover { background: var(--bg-hover); }
.tag-row.selected { background: var(--bg-hover); }
.tag-row-name {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-row-count {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tag-row-check {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  background: transparent;
}
.tag-row.selected .tag-row-check {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
[data-hc="on"] .tag-row.selected .tag-row-check {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.tag-row-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  list-style: none;
}
.episode-list { list-style: none; margin: 0; padding: 0; }

.episode-item {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.episode-share {
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.episode-item:hover .episode-share,
.episode-item:focus-within .episode-share,
.episode-share:focus-visible { opacity: 1; }
.episode-share:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}
[data-hc="on"] .episode-share:hover {
  background: var(--text);
  color: var(--bg);
}
.episode-item:hover { background: var(--bg-hover); }
.episode-item.playing { background: var(--bg-hover); }
.episode-item.playing .episode-title { color: var(--accent-hover); }

.episode-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elev-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
}
.episode-play:hover { background: var(--accent); color: white; transform: scale(1.05); }
.episode-play.completed { background: var(--accent); color: white; }
.episode-play.completed:hover { background: var(--bg-elev-2); color: var(--accent-hover); }

.episode-meta { min-width: 0; }
.episode-title {
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.episode-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.episode-sub .dot { color: var(--text-dim); }

.episode-duration {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.episode-item.completed .episode-title { color: var(--text-muted); }

.episode-progress {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.episode-progress-bar {
  flex: 1;
  max-width: 220px;
  height: 3px;
  background: var(--bg-elev-2);
  border-radius: 2px;
  overflow: hidden;
}
.episode-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.ep-status {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ep-status.played {
  color: var(--accent-hover);
  font-weight: 500;
}

.ep-sentinel {
  list-style: none;
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Buttons */
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.icon-btn.labeled-btn {
  width: auto;
  padding: 0 10px;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}

@media (max-width: 640px) {
  .icon-btn.labeled-btn span { display: none; }
  .icon-btn.labeled-btn { padding: 0; width: 32px; }
}

[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* HC toggle: visibly "pressed" when active so users can see the state. */
#hc-toggle[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}
#hc-toggle[aria-pressed="true"]:hover {
  background: var(--text);
  color: var(--bg);
  opacity: 0.85;
}

.ghost-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  color: var(--text);
  font-weight: 500;
  transition: background var(--transition);
}
.ghost-btn:hover { background: var(--bg-hover); }
.ghost-btn.small { padding: 4px 10px; font-size: 12px; min-width: 38px; }

.primary-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  font-weight: 600;
  transition: background var(--transition);
}
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.danger-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--danger);
  font-weight: 500;
  transition: background var(--transition);
}
.danger-btn:hover { background: rgba(239, 68, 68, 0.12); color: var(--danger-hover); }

/* Now-playing right panel */
.now-playing {
  display: none;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-direction: column;
}
@media (min-width: 1200px) {
  body.player-active .now-playing { display: flex; }
}
.np-header {
  padding: 18px 20px 10px;
  border-bottom: 1px solid var(--border);
}
.np-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.np-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.np-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg-elev-2);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.np-podcast {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-hover);
}
.np-title {
  margin: 4px 0 6px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.np-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 2px 0 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.np-meta-sep { opacity: 0.5; }
.np-played {
  color: var(--accent-hover);
  font-weight: 600;
}

.np-progress {
  margin: 0 0 14px;
}
.np-progress-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--bg-elev-2);
  overflow: hidden;
}
.np-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0;
}
.np-progress-times {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.np-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 16px;
}
.np-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  color: var(--text-muted);
}
[data-hc="on"] .np-tag {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.np-chapters {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.np-chapters-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.np-chapter {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.45;
  transition: background var(--transition);
}
.np-chapter:hover,
.np-chapter:focus-visible {
  background: var(--bg-hover);
  outline: none;
}
.np-chapter-time {
  flex-shrink: 0;
  width: 52px;
  color: var(--accent-hover);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.np-chapter-title {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
[data-hc="on"] .np-chapter-time { color: var(--text); }

.np-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.np-section-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.np-description,
.np-podcast-description {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  white-space: pre-line;
}
[data-hc="on"] .np-podcast { color: var(--text); }

/* Player */
.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--player-h);
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  box-shadow: var(--shadow);
  z-index: 100;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.player-info img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-elev-2);
  flex-shrink: 0;
}
.player-titles { min-width: 0; }
.player-episode {
  margin: 0;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-podcast {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.player-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), background var(--transition);
}
.play-btn:hover { transform: scale(1.05); }
.play-btn svg { width: 26px; height: 26px; }

.player .icon-btn { width: 38px; height: 38px; }
.player .icon-btn svg { width: 22px; height: 22px; }

.player-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 540px;
}
.time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: center;
}

.player-extra {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}
.volume {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.volume input { width: 96px; }

/* Range sliders — track is a played/remaining gradient driven by --fill (set from JS). */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--fill, 0%),
    var(--track) var(--fill, 0%),
    var(--track) 100%
  );
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.2); }
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}
input[type="range"]::-moz-range-progress {
  background: var(--accent);
  height: 6px;
  border-radius: 3px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 92%;
  max-width: 460px;
  box-shadow: var(--shadow);
}
.modal-content-narrow { max-width: 380px; }

/* Visually hidden but accessible to screen readers. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.modal-content h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
}
.modal-content .muted { margin: 0 0 16px; }

#rss-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
}
#rss-input:focus { border-color: var(--accent); }

.error {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--danger);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.modal-suggestions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.suggestions-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.suggestion-list { list-style: none; margin: 0; padding: 0; }
.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.suggestion-item:hover { background: var(--bg-elev-2); }
.suggestion-meta { min-width: 0; flex: 1; }
.suggestion-title {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggestion-url {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggestion-add { flex-shrink: 0; }
.suggestion-add.added {
  background: transparent;
  color: var(--accent-hover);
  font-weight: 600;
  cursor: default;
}
.suggestion-empty {
  padding: 8px 10px;
  font-size: 12px;
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid var(--bg-elev); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Loading */
.loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 900px) {
  .app { grid-template-columns: 240px 1fr; }
  .podcast-header { grid-template-columns: 140px 1fr; gap: 20px; }
  .podcast-cover { width: 140px; height: 140px; }
  .podcast-title { font-size: 22px; }
  .podcast-view { padding: 24px; }
  .player { grid-template-columns: 1fr 1.5fr auto; }
  .volume { display: none; }
}
@media (max-width: 640px) {
  :root { --sidebar-w: 200px; }
  .player-extra .ghost-btn { display: none; }
}
