:root {
  color-scheme: light;
  --page-bg: #f5f7fa;
  --surface: #ffffff;
  --surface-muted: #eef2f6;
  --input-bg: #edf1f5;
  --search-bg: #ffffff;
  --search-border: #d7dfe8;
  --list-hover: #f0f4fa;
  --list-secondary: #526174;
  --text: #202a38;
  --text-muted: #59677a;
  --placeholder: #64748b;
  --border: #e1e7ee;
  --accent: #4169bd;
  --focus: #5578c8;
  --player-bg: #ffffff;
  --control-bg: #edf1f5;
  --control-hover: #e3eaf3;
  --shadow: rgba(26, 43, 68, 0.06);
  --cover-overlay: rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] .nav-item { color: #526174; }
:root[data-theme="light"] .nav-item:hover { color: var(--text); background: var(--list-hover); }
:root[data-theme="light"] .nav-item[aria-current="page"] { color: var(--accent-text); background: var(--accent-subtle); }
:root[data-theme="light"] .nav-item[aria-current="page"]::before { background: var(--accent); }
:root[data-theme="dark"] .nav-item[aria-current="page"] { color: var(--accent-text); background: var(--accent-subtle); }
:root[data-theme="light"] .unified-search { box-shadow: 0 2px 5px rgba(26, 43, 68, 0.03); }
:root[data-theme="light"] .unified-search:focus-within { box-shadow: 0 0 0 3px var(--accent-ring); }
:root[data-theme="light"] .discover-illustration { color: var(--accent-muted); }
:root[data-theme="light"] .player-artwork { background: var(--surface-muted); color: var(--text-muted); }
:root[data-theme="light"] :is(.setting-card, .about-card, .episode-description-card, #episodeList) { box-shadow: 0 2px 8px rgba(26, 43, 68, 0.025); }

:root[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: #121212;
    --surface: #202020;
    --surface-muted: #292929;
    --input-bg: #303030;
    --search-bg: #303030;
    --search-border: #444444;
    --list-hover: #2b2b2b;
    --list-secondary: #c2c2c2;
    --text: #f0f0f0;
    --text-muted: #b8b8b8;
    --placeholder: #aaaaaa;
    --border: #444444;
    --accent: #0069d9;
    --focus: #80bfff;
    --player-bg: rgba(32, 32, 32, 0.95);
    --control-bg: #333333;
    --control-hover: #454545;
    --shadow: rgba(0, 0, 0, 0.3);
    --cover-overlay: rgba(0, 0, 0, 0.65);
}


* { box-sizing: border-box; }
fluent-button { font: inherit; cursor: pointer; min-width: 0; }
fluent-button::part(content) { display: contents; }
fluent-button[disabled] { cursor: default; }
.podcast-card { height: auto; }
fluent-button::part(content) { white-space: inherit; }
.unified-search fluent-text-input { flex: 1; min-width: 0; border: 0; background: transparent; }
.unified-search fluent-text-input::part(root) { height: 100%; border: 0; background: transparent; box-shadow: none; }
.unified-search fluent-text-input::part(control) { box-sizing: border-box; height: 100%; color: var(--text); background: transparent; font: inherit; padding: 0; }
.unified-search fluent-text-input::part(control)::placeholder { color: var(--placeholder); }
fluent-slider { min-width: 0; }
#playbackRate { min-width: 0; width: 62px; }
#playbackRate fluent-listbox { min-width: 90px; max-height: 240px; }
[hidden] { display: none !important; }
body { margin: 0; padding: 0; background: var(--page-bg); color: var(--text); font-family: "Segoe UI", system-ui, sans-serif; }
:is(button, fluent-button), input, select { font: inherit; }
:is(button, fluent-button), a, input { -webkit-tap-highlight-color: transparent; }
:is(button, fluent-button) { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:is(button, fluent-button):focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; padding: 30px 20px; border-right: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px; font-size: 17px; font-weight: 400; margin-bottom: 44px; }
.brand img { width: 36px; height: 36px; border-radius: 8px; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px 10px 16px; border: 0; border-radius: var(--borderRadiusMedium, 4px); background: transparent; color: var(--colorNeutralForeground2, var(--text-muted)); font-size: 14px; font-weight: 400; line-height: 24px; text-align: left; transition: background 0.15s, color 0.15s; }
.nav-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.nav-item:hover { color: var(--colorNeutralForeground1, var(--text)); background: var(--colorSubtleBackgroundHover, var(--input-bg)); }
.nav-item:active { background: var(--colorSubtleBackgroundPressed, var(--input-bg)); }
.nav-item[aria-current="page"] { color: var(--colorNeutralForeground1, var(--text)); background: var(--colorNeutralBackground3Selected, var(--input-bg)); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 20px; transform: translateY(-50%); border-radius: 3px; background: var(--colorCompoundBrandStroke, var(--accent)); }
.nav-item:focus-visible { outline: 2px solid var(--colorStrokeFocus2, var(--focus)); outline-offset: 2px; }
.app-main { margin-left: 232px; padding: 0 5vw 40px; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 104px; background: var(--page-bg); border-bottom: 1px solid var(--border); margin-bottom: 44px; }
.history-controls { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.history-controls :is(button, fluent-button) { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: var(--text); }
.history-controls :is(button, fluent-button):hover:not(:disabled) { background: var(--input-bg); }
.history-controls :is(button, fluent-button):disabled { opacity: 0.25; cursor: default; }
.history-controls svg { width: 24px; height: 24px; }
.unified-search { display: flex; align-items: center; width: min(390px, 100%); background: var(--search-bg); border: 1px solid var(--search-border); border-radius: 10px; padding: 6px 10px 6px 16px; }
.unified-search:focus-within { border-color: var(--focus); }
.unified-search fluent-text-input { width: 100%; min-width: 0; height: 36px; padding: 0; color: var(--text); border: 0; outline: none; background: transparent; font-size: 14px; }
input::placeholder { color: var(--placeholder); opacity: 1; }
.unified-search :is(button, fluent-button) { display: grid; place-items: center; border: 0; background: transparent; color: var(--text-muted); width: 34px; height: 34px; flex-shrink: 0; }
.unified-search svg { width: 20px; height: 20px; min-height: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.eyebrow { font-size: 11px; letter-spacing: 2px; font-weight: bold; color: var(--text-muted); margin: 0 0 12px; }
h1 { margin: 0; font-size: clamp(28px, 3vw, 40px); letter-spacing: -1px; }
ul { list-style: none; margin: 0; padding: 0; }
.podcast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 30px 20px; }
.podcast-card { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; width: 100%; padding: 0; text-align: left; color: var(--text); background: transparent; border: 0; border-radius: 5px; }
.podcast-card .card-title, .podcast-card .card-author { width: 100%; text-align: left; }
.card-artwork { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 5px; overflow: hidden; background: var(--input-bg); color: var(--text-muted); font-size: 48px; margin-bottom: 12px; transition: transform 0.2s; }
.card-artwork img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.podcast-card:hover .card-artwork { transform: translateY(-4px); }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-author { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-top: 4px; }
.search-status, #feedStatus { padding: 28px 0; color: var(--text-muted); line-height: 1.6; }
.search-empty-state { padding: 60px 12px; text-align: center; color: var(--text-muted); }
.search-empty-state > span { font-size: 64px; }
.discover-illustration { display: block; width: 180px; height: 140px; margin: 0 auto 24px; }
.search-empty-state h2 { color: var(--text); font-size: 22px; }
.search-empty-state p { max-width: 440px; margin: 12px auto; font-size: 14px; line-height: 1.7; }
.text-button { color: var(--text); background: var(--input-bg); border: 0; border-radius: 6px; padding: 10px 14px; }
.is-loading { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.is-loading::before { content: ""; width: 14px; height: 14px; flex-shrink: 0; border: 2px solid var(--border); border-top-color: var(--text-muted); border-radius: 50%; animation: loading-spin 0.8s linear infinite; }
.loading-skeleton { padding-bottom: 24px; }
.skeleton-block { position: relative; overflow: hidden; background: var(--input-bg); border-radius: 5px; }
.skeleton-block::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, var(--surface) 50%, transparent 80%); transform: translateX(-100%); animation: loading-shimmer 1.6s ease-in-out infinite; }
.skeleton-artwork { width: 100%; aspect-ratio: 1; margin-bottom: 14px; }
.skeleton-line { height: 12px; width: 85%; margin: 12px 0; }
.skeleton-line.short { width: 45%; height: 10px; }
.skeleton-feed-header { display: flex; align-items: center; gap: 28px; margin-bottom: 36px; }
.skeleton-cover { width: 160px; height: 160px; flex-shrink: 0; }
.skeleton-copy { flex: 1; }
.skeleton-heading { width: 70%; height: 32px; margin-bottom: 20px; }
.skeleton-episode { padding: 18px 0; border-bottom: 1px solid var(--border); }
@keyframes loading-spin { to { transform: rotate(360deg); } }
@keyframes loading-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton-block::after, .is-loading::before { animation: none; } }
.podcast-info { display: flex; align-items: center; gap: 28px; margin-bottom: 36px; }
.cover-frame { position: relative; display: grid; place-items: center; width: 160px; height: 160px; flex-shrink: 0; overflow: hidden; border-radius: 8px; background: var(--input-bg); color: var(--text-muted); }
.cover-frame > svg { width: 45%; height: 45%; opacity: 0.6; }
.cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.meta { min-width: 0; }
.meta p { color: var(--text-muted); line-height: 1.6; }
#podcastAuthor { margin: 0 0 4px; font-size: 13px; }
#podcastTitle { margin-top: 0; }
#podcastDesc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#episodeList { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
#episodeList:empty { display: none; }
#episodeList li { display: flex; align-items: center; gap: 20px; padding: 20px 24px; color: var(--text); border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
#episodeList li:last-child { border-bottom: 0; }
#episodeList li:hover, #episodeList li:focus-within { background: var(--list-hover); }
.episode-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.episode-play { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; color: var(--text); background: var(--input-bg); transition: background 0.15s, color 0.15s; }
.episode-play svg { width: 22px; height: 22px; fill: currentColor; }
#episodeList li:hover .episode-play, .episode-play:focus-visible { background: var(--text); color: var(--surface); }
.episode-title { font-size: 16px; font-weight: 400; line-height: 1.5; }
.episode-meta { margin-top: 10px; font-size: 13px; color: var(--list-secondary); display: flex; flex-wrap: wrap; gap: 8px 16px; }
@media (max-width: 900px) { .sidebar { width: 190px; padding-inline: 12px; } .app-main { margin-left: 190px; padding-inline: 28px; } .brand { font-size: 16px; gap: 8px; } .nav-item { font-size: 14px; } }
@media (max-width: 600px) {
  .sidebar { position: static; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 16px; }
  .brand { margin-bottom: 0; padding: 0; min-width: 0; }
  .brand img { width: 30px; height: 30px; }
  .sidebar nav { display: flex; flex-shrink: 0; }
  #discoverNav { display: none; }
  .sidebar-download { display: none; }
  .sidebar > nav:not(.settings-nav) { display: none; }
  .nav-item { width: auto; min-height: 40px; padding: 8px; gap: 8px; white-space: nowrap; }
  .app-main { margin-left: 0; padding: 0 20px 32px; }
  .topbar { min-height: 84px; margin-bottom: 28px; }
  .history-controls { gap: 2px; }
  .topbar { gap: 12px; }
  .unified-search { width: 100%; }
  .podcast-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
  .podcast-info { align-items: flex-start; gap: 16px; }
  .cover-frame { width: 90px; height: 90px; }
  .skeleton-cover { width: 90px; height: 90px; }
  .skeleton-feed-header { gap: 16px; }
  .meta h1 { font-size: 24px; }
  #episodeList li { padding: 16px; gap: 12px; }
}

/* Custom bottom player */
body { padding-bottom: 150px; }
.audio-player {
  --player-ink: var(--text);
  --player-secondary: var(--text-muted);
  --player-track: var(--border);
  position: fixed;
  z-index: 10;
  inset: auto 0 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 28px calc(20px + env(safe-area-inset-bottom));
  color: var(--player-ink);
  background: var(--player-bg);
  border-top: 1px solid var(--player-track);
  box-shadow: 0 -4px 24px var(--shadow);
}
.player-artwork { position: relative; width: 72px; height: 72px; flex: 0 0 72px; border-radius: 5px; overflow: hidden; background: var(--player-track); display: grid; place-items: center; font-size: 32px; }
.player-artwork img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.transport-controls, .player-options { display: flex; align-items: center; gap: 14px; }
.audio-player fluent-button { position: relative; display: grid; place-items: center; padding: 0; width: 42px; height: 48px; appearance: none; border: 0; box-shadow: none; background: transparent; color: inherit; border-radius: 50%; flex-shrink: 0; transition: opacity 0.15s; }
.audio-player fluent-button:hover:not(:disabled) { background: transparent; opacity: 0.7; }
.audio-player fluent-button:disabled { opacity: 0.4; cursor: default; }
.audio-player fluent-button:focus-visible, .audio-player select:focus-visible, .audio-player input:focus-visible { outline: 2px solid var(--player-ink); outline-offset: 4px; }
.audio-player fluent-button svg { display: block; width: 26px; height: 26px; fill: currentColor; }
.audio-player #playPauseButton { width: 44px; height: 44px; }
.audio-player #playPauseButton svg { width: 36px; height: 36px; }
.audio-player .skip-button svg { width: 32px; height: 32px; fill: none; }
.skip-button span { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 5px; font-size: 12px; font-weight: bold; }
.player-main { flex: 1; min-width: 0; }
#currentEpisodeTitle, #playerSubtitle { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
#currentEpisodeTitle:not([aria-disabled="true"]):hover, #playerSubtitle:not([aria-disabled="true"]):hover { text-decoration: underline; text-underline-offset: 3px; }
#currentEpisodeTitle[aria-disabled="true"], #playerSubtitle[aria-disabled="true"] { cursor: default; }
#currentEpisodeTitle { font-size: 16px; font-weight: 600; margin: 0 0 5px; }
#playerSubtitle { font-size: 13px; color: var(--player-secondary); margin: 0 0 14px; }
.audio-player fluent-slider { display: inline-grid; align-items: center; cursor: pointer; padding: 0; margin: 0; height: 24px; min-height: 24px; }
/* Keep fine keyboard increments without drawing hundreds of step markers. */
.audio-player fluent-slider::part(track-container)::after { background-image: none; }
.audio-player fluent-slider::part(thumb-container) { transition: none; }
#playbackProgress { width: 100%; }
.player-times { display: flex; justify-content: space-between; color: var(--player-secondary); font-size: 11px; margin-top: 4px; font-variant-numeric: tabular-nums; }
#playerStatus { position: absolute; bottom: calc(100% + 8px); left: 16px; right: 16px; width: auto; max-width: 640px; margin: 0 auto; text-align: left; box-shadow: var(--shadow8); }
#playerStatusText { overflow-wrap: anywhere; }
.audio-player #dismissPlayerStatus { width: auto; min-width: 44px; height: 28px; min-height: 28px; margin-left: 12px; padding: 0 6px; border-radius: 4px; font-size: 12px; }
#playbackRate { --rate-font-size: 14px; color: inherit; background: transparent; border: 0; border-radius: 6px; padding: 0; font: inherit; font-size: 14px; cursor: pointer; }
#volumeControl { width: 80px; height: 40px; flex-shrink: 0; }
@media (max-width: 760px) {
  .audio-player { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; column-gap: 12px; row-gap: 0; padding: 10px 16px calc(8px + env(safe-area-inset-bottom)); }
  .player-artwork { grid-column: 1; grid-row: 1 / 3; width: 40px; height: 40px; font-size: 24px; }
  .artwork-toggle { grid-column: 1; grid-row: 1 / 3; }
  .player-main { display: contents; }
  #currentEpisodeTitle { grid-column: 2; grid-row: 1; text-align: left; font-size: 13px; line-height: 20px; margin: 0; }
  #playerSubtitle { grid-column: 2; grid-row: 2; text-align: left; font-size: 11px; line-height: 20px; margin: 0; }
  .transport-controls { grid-column: 3; grid-row: 1 / 3; gap: 2px; }
  .audio-player fluent-button { width: 34px; height: 40px; }
  .audio-player .skip-button svg { width: 24px; height: 24px; }
  .skip-button span { font-size: 10px; padding-top: 4px; }
  .audio-player #playPauseButton { width: 38px; height: 40px; }
  .audio-player #playPauseButton svg { width: 24px; height: 24px; }
  .player-options { grid-column: 4; grid-row: 1 / 3; margin: 0; gap: 0; }
  #volumeControl, #muteButton { display: none; }
  #playbackRate { --rate-font-size: 13px; padding: 0; width: 48px; font-size: 13px; max-width: 55px; }
  #playbackProgress { grid-column: 1 / -1; grid-row: 3; margin-top: 5px; }
  .player-times { grid-column: 1 / -1; grid-row: 4; margin-top: 0; font-size: 10px; line-height: 12px; }
  #playerStatus { left: 10px; right: 10px; }
  body { padding-bottom: calc(125px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .audio-player { column-gap: 6px; padding-inline: 10px; }
  .audio-player fluent-button { width: 30px; }
  .audio-player #playPauseButton { width: 34px; }
  #playbackRate { max-width: 48px; }
}

.player-artwork > svg { width: 55%; height: 55%; }
.card-artwork > svg { width: 40%; height: 40%; }

/* Expanded view reuses the same audio element and controls. */
.artwork-toggle { display: block; flex-shrink: 0; padding: 0; border: 0; border-radius: 5px; background: transparent; color: inherit; cursor: pointer; }
.artwork-toggle:hover { opacity: 0.85; }
.expanded-player-header { display: none; }
body.player-expanded { overflow: hidden; }
.audio-player.is-expanded { inset: 0; z-index: 30; height: 100dvh; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 640px); align-content: safe center; justify-content: center; justify-items: center; gap: clamp(16px, 3vh, 28px); padding: max(20px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); background: var(--surface); border: 0; box-shadow: none; }
.audio-player.is-expanded .expanded-player-header { grid-row: 1; display: flex; align-items: center; justify-content: space-between; width: 100%; color: var(--text-muted); font-size: 11px; letter-spacing: 2px; }
.audio-player.is-expanded #closeExpandedPlayer { width: 40px; height: 40px; }
#closeExpandedPlayer svg { transform: rotate(-90deg); }
.audio-player.is-expanded .artwork-toggle { grid-row: 2; grid-column: 1; }
.audio-player.is-expanded .player-artwork { width: clamp(160px, min(36vh, 70vw), 340px); height: auto; aspect-ratio: 1; border-radius: 16px; box-shadow: var(--shadow16); }
.audio-player.is-expanded .player-main { display: block; grid-row: 3; grid-column: 1; width: 100%; min-width: 0; }
.audio-player.is-expanded #currentEpisodeTitle { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-size: clamp(20px, 3vw, 28px); line-height: 1.3; text-align: center; margin: 0 0 10px; }
.audio-player.is-expanded #playerSubtitle { white-space: normal; text-align: center; font-size: 14px; line-height: 1.5; margin: 0 0 24px; }
.audio-player.is-expanded .player-times { font-size: 12px; line-height: 18px; margin-top: 5px; }
.audio-player.is-expanded .transport-controls { grid-row: 4; grid-column: 1; gap: 24px; }
.audio-player.is-expanded .skip-button { width: 48px; height: 48px; }
.audio-player.is-expanded .skip-button svg { width: 32px; height: 32px; }
.audio-player.is-expanded #playPauseButton { width: 64px; height: 64px; }
.audio-player.is-expanded #playPauseButton svg { width: 48px; height: 48px; }
.audio-player.is-expanded .player-options { grid-row: 5; grid-column: 1; gap: 16px; margin: 0; max-width: 100%; flex-wrap: wrap; justify-content: center; }
.audio-player.is-expanded #playbackRate { --rate-font-size: 16px; font-size: 16px; width: 72px; max-width: none; }
.audio-player.is-expanded #muteButton { display: grid; width: 40px; height: 40px; }
.audio-player.is-expanded #volumeControl { display: inline-grid; width: 120px; }
.audio-player.is-expanded #playerStatus { position: static; grid-row: 6; grid-column: 1; width: 100%; margin: 0; }

/* Settings uses the same theme tokens as the Fluent controls. */
@media (min-width: 601px) {
  .sidebar { display: flex; flex-direction: column; padding-bottom: 160px; }
  .sidebar .settings-nav { margin-top: auto; }
}
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: 36px; align-items: start; }
.setting-card { display: flex; align-items: center; gap: 20px; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.setting-icon { display: grid; place-items: center; flex-shrink: 0; }
.setting-icon svg { width: 24px; height: 24px; }
.setting-copy { flex: 1; min-width: 0; }
.setting-copy h2 { margin: 0; font-size: 16px; font-weight: 500; }
.setting-copy p { margin: 5px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
:is(#themePicker, #languagePicker) { flex-shrink: 0; width: 160px; }
.settings-about > h2 { margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.about-card { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.about-card h3 { font-size: 16px; margin: 0 0 12px; }
.about-card p { font-size: 14px; line-height: 1.65; color: var(--text-muted); margin: 12px 0; }
.about-card .about-note { font-size: 12px; }
.about-link { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--border); font-size: 14px; }
.about-link:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 1000px) { .settings-layout { grid-template-columns: 1fr; gap: 28px; } }
@media (max-width: 600px) {
  .sidebar { gap: 8px; padding-inline: 12px; }
  .sidebar .settings-nav { margin: 0; }
  .settings-nav .nav-label { display: none; }
  .settings-nav .nav-item { width: 36px; padding: 6px; min-height: 36px; justify-content: center; }
  .settings-nav .nav-item svg { width: 18px; height: 18px; }
  .sidebar > nav:not(.settings-nav) .nav-item { font-size: 12px; padding-inline: 4px; gap: 6px; }
  .sidebar > nav:not(.settings-nav) .nav-item svg { width: 18px; height: 18px; }
  .setting-card { flex-wrap: wrap; gap: 12px; padding: 20px; }
  :is(#themePicker, #languagePicker) { margin-left: 36px; width: calc(100% - 36px); }
  .about-card { padding: 20px; }
}

.episode-detail-header { display: flex; gap: 28px; align-items: flex-start; margin: 24px 0 36px; }
.episode-detail-info { flex: 1; min-width: 0; }
#episodeDetailChannel { display: inline-block; margin-bottom: 12px; color: var(--text-muted); font-size: 14px; }
#episodeDetailChannel:hover { text-decoration: underline; }
#episodeDetailTitle { font-size: clamp(24px, 3vw, 36px); line-height: 1.3; overflow-wrap: anywhere; }
#episodeDetailMeta { font-size: 13px; line-height: 1.5; color: var(--text-muted); margin: 16px 0; }
#episodeDetailPlay { min-width: 120px; padding: 8px 20px; }
.episode-detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.episode-detail-actions > fluent-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; margin: 0; }
.episode-description-card { padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.episode-description-card h2 { margin: 0 0 20px; font-size: 18px; }
#episodeDetailDescription { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; font-size: 15px; }
#episodeDetailDescription.shownotes-html { white-space: normal; }
#episodeDetailDescription a { color: var(--focus); text-decoration: underline; text-underline-offset: 3px; }
#episodeDetailDescription a:hover { color: var(--text); }
#episodeDetailDescription :is(p, ul, ol, dl, blockquote, pre) { margin: 0 0 1em; }
#episodeDetailDescription :is(ul, ol) { padding-left: 1.5em; }
#episodeDetailDescription ul { list-style: disc; }
#episodeDetailDescription ol { list-style: decimal; }
#episodeDetailDescription blockquote { padding-left: 1em; border-left: 3px solid var(--border); color: var(--text-muted); }
#episodeDetailDescription pre { white-space: pre-wrap; }
#episodeDetailDescription :is(h1, h2, h3, h4, h5, h6) { font-size: 18px; letter-spacing: normal; margin: 1em 0 .5em; }
.shownote-timestamp { display: inline; padding: 0 3px; border: 0; border-radius: 4px; background: var(--surface-muted); color: var(--focus); font: inherit; font-variant-numeric: tabular-nums; line-height: inherit; text-decoration: underline; text-underline-offset: 3px; }
.shownote-timestamp:hover { background: var(--control-hover); }
.shownote-timestamp:disabled { opacity: 0.5; cursor: default; }
#episodeDetailSource { margin-top: 24px; }
@media (max-width: 600px) { .episode-detail-header { gap: 16px; flex-wrap: wrap; } .episode-detail-info { flex-basis: 100%; } .episode-description-card { padding: 20px; } }

.settings-group-title { margin: 32px 0 16px; font-size: 16px; font-weight: 600; }
#sleepTimerPicker { flex-shrink: 0; width: 160px; }
.shortcuts-card { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.shortcuts-card > p { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; line-height: 1.5; }
.shortcuts-card dl { margin: 0; }
.shortcuts-card dl > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); font-size: 14px; }
.shortcuts-card dd { margin: 0; white-space: nowrap; color: var(--text-muted); }
.shortcuts-card kbd { font: inherit; font-size: 12px; padding: 3px 7px; border: 1px solid var(--border); border-radius: 4px; background: var(--page-bg); }
.audio-player #playerMoreButton { position: relative; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; flex-shrink: 0; border: 0; border-radius: 50%; color: inherit; background: transparent; }
#playerMoreButton > svg { width: 24px; height: 24px; }
#playerMoreButton:hover { background: var(--control-hover); }
.timer-active-dot { position: absolute; right: 5px; top: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--focus); }
#playerMoreMenu { position: fixed; z-index: 60; min-width: 210px; max-width: calc(100vw - 16px); padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: 0 8px 28px var(--shadow); }
#playerMoreMenu > button { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: 100%; min-height: 40px; padding: 10px 12px; border: 0; border-radius: 4px; background: transparent; color: inherit; text-align: left; font-size: 14px; }
#playerMoreMenu > button:hover:not(:disabled), #playerMoreMenu > button:focus-visible { background: var(--control-hover); }
#playerMoreMenu > button:disabled { opacity: 0.45; cursor: default; }
#sleepTimerButton[data-active="true"] { color: var(--colorBrandForeground1, var(--accent)); }
#sleepTimerLabel { font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .audio-player:not(.is-expanded) #playerMoreButton { width: 32px; height: 32px; min-width: 32px; min-height: 32px; aspect-ratio: 1; } }
@media (max-width: 600px) { #sleepTimerPicker { margin-left: 36px; width: calc(100% - 36px); } .shortcuts-card { padding: 20px; } }

.language-setting { margin-top: 12px; }
.accent-setting { margin-top: 12px; }
.accent-preview { width: 24px; height: 24px; min-width: 24px; border-radius: 50%; border: 5px solid var(--accent); background: var(--accent-subtle); }
.accent-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
#accentColorPicker { width: 44px; height: 36px; padding: 3px; border: 1px solid var(--search-border); border-radius: 6px; background: var(--surface); cursor: pointer; }
#accentColorValue { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
@media (max-width: 600px) { .accent-controls { width: calc(100% - 36px); margin-left: 36px; } }
.queue-count { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.episode-queue-add, .queue-action { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); }
.episode-queue-add:hover:not(:disabled), .queue-action:hover:not(:disabled) { background: var(--control-hover); color: var(--text); }
.episode-queue-add:disabled, .queue-action:disabled { opacity: 0.35; cursor: default; }
.episode-queue-add svg, .queue-action svg { display: block; width: 22px; height: 22px; }
.episode-row-actions { display: flex; align-items: center; flex-shrink: 0; gap: 12px; }
.episode-share { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); }
.episode-share svg { width: 22px; height: 22px; }
.episode-share:hover:not(:disabled) { background: var(--control-hover); color: var(--text); }
.episode-share:disabled { opacity: .35; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  #episodeList :is(.episode-share, .episode-queue-add) { opacity: 0; pointer-events: none; }
  #episodeList li:is(:hover, :focus-within) :is(.episode-share, .episode-queue-add) { opacity: 1; pointer-events: auto; }
  #episodeList li:is(:hover, :focus-within) :is(.episode-share, .episode-queue-add):disabled { opacity: .35; pointer-events: none; }
}
@media (max-width: 600px) { .episode-row-actions { gap: 8px; } }
.queue-action span { font-size: 24px; line-height: 1; }
.queue-help { color: var(--text-muted); line-height: 1.6; }
#queueList { margin-top: 24px; }
#queueList li { display: flex; align-items: center; gap: 16px; padding: 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
#queueList li:first-child { border-radius: 8px 8px 0 0; }
#queueList li:last-child { border-radius: 0 0 8px 8px; }
.queue-subtitle { color: var(--text-muted); font-size: 13px; margin: 6px 0 0; }
.queue-row-actions { display: flex; flex-shrink: 0; gap: 4px; }
#queueList .queue-current { background: var(--surface-muted); border-left: 3px solid var(--focus); padding-left: 17px; margin-bottom: 12px; border-radius: 8px; }
.queue-current-cover { position: relative; display: grid; place-items: center; width: 56px; height: 56px; flex: 0 0 56px; border-radius: 6px; overflow: hidden; background: var(--input-bg); color: var(--text-muted); }
.queue-current-cover > svg { width: 28px; height: 28px; }
.queue-current-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.queue-current-label { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 1px; color: var(--focus); }
.podcast-metadata { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 16px 0; color: var(--text-muted); font-size: 13px; overflow-wrap: anywhere; }
.podcast-category { padding: 4px 10px; border-radius: 6px; background: var(--accent-subtle); color: var(--accent-text); }
.podcast-metadata a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.episode-meta { flex-wrap: wrap; }
.episode-now-playing { display: inline-flex; align-items: center; gap: 7px; color: var(--focus); font-size: 12px; font-weight: 600; white-space: nowrap; }
.queue-playing-indicator { display: flex; align-items: center; gap: 2px; height: 14px; }
.queue-playing-indicator i { width: 3px; height: 10px; border-radius: 2px; background: currentColor; animation: queue-playing 0.8s ease-in-out infinite alternate; }
.queue-playing-indicator i:nth-child(2) { animation-delay: -0.3s; }
.queue-playing-indicator i:nth-child(3) { animation-delay: -0.6s; }
.is-paused .queue-playing-indicator i { animation: none; height: 4px; }
.queue-current-toggle { color: var(--focus); flex-shrink: 0; }
@keyframes queue-playing { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .queue-playing-indicator i { animation: none; } }
@media (max-width: 600px) { #queueList .queue-current { flex-wrap: nowrap; } #queueList .queue-current .episode-copy { flex-basis: auto; } .queue-current-cover { width: 44px; height: 44px; flex-basis: 44px; } }
@media (max-width: 600px) {
  .sidebar > nav:not(.settings-nav) { display: flex; margin-left: auto; }
  .sidebar #discoverNav { display: none; }
  .sidebar #queueNav { width: 36px; min-height: 36px; justify-content: center; padding: 6px; }
  #queueNav .nav-label, #queueCount { display: none; }
  #queueList li { flex-wrap: wrap; gap: 8px; padding: 16px; }
  #queueList .episode-copy { flex-basis: 100%; }
  .queue-row-actions { margin-left: auto; }
  .queue-action { width: 40px; height: 40px; }
  #episodeList li { column-gap: 8px; }
}
.subscription-feed-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subscription-card { position: relative; }
.subscription-remove { position: absolute; z-index: 1; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid rgba(255,255,255,0.35); border-radius: 50%; background: rgba(24,24,24,0.82); color: #fff; opacity: 0; pointer-events: none; transition: opacity 0.15s, background 0.15s; }
.subscription-remove svg { width: 20px; height: 20px; }
.subscription-card:hover .subscription-remove, .subscription-card:focus-within .subscription-remove { opacity: 1; pointer-events: auto; }
.subscription-remove:hover { background: #181818; }
@media (hover: none), (pointer: coarse) { .subscription-remove { opacity: 1; pointer-events: auto; width: 40px; height: 40px; } }
#subscriptionStatus, #subscriptionsEmpty { color: var(--text-muted); line-height: 1.6; }
.episode-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 24px 0; }
.episode-filter-field { display: flex; align-items: center; flex: 0 1 390px; max-width: 100%; min-width: 0; height: 44px; padding: 0 4px 0 12px; border: 1px solid var(--search-border); border-radius: 6px; background: var(--search-bg); }
.episode-filter-field:focus-within { border-color: var(--focus); box-shadow: inset 0 -2px var(--focus); }
.episode-filter-field fluent-text-input { flex: 1; width: 0; min-width: 0; height: 100%; }
.episode-filter-field fluent-text-input::part(root) { width: 100%; max-width: none; height: 100%; border: 0; background: transparent; box-shadow: none; }
.episode-filter-field fluent-text-input::part(control) { width: 100%; min-width: 0; height: 100%; padding: 0; background: transparent; color: var(--text); font: inherit; }
#clearEpisodeFilter { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--text-muted); }
#clearEpisodeFilter:hover { background: var(--control-hover); color: var(--text); }
#clearEpisodeFilter svg { display: block; width: 24px; height: 24px; }
#episodeSort { width: 160px; }
#subscribePodcastButton { margin-left: auto; flex-shrink: 0; }
.episode-details-link { padding: 0; border: 0; background: transparent; color: inherit; text-align: left; font: inherit; }
.episode-details-link:hover { text-decoration: underline; }
#episodeFilterEmpty { color: var(--text-muted); padding-block: 20px; }
#shareDialog { width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: var(--surface); box-shadow: 0 16px 60px var(--shadow); }
#shareDialog::backdrop { background: rgba(0, 0, 0, 0.45); }
#shareDialog h2 { margin-top: 0; }
#shareName { overflow-wrap: anywhere; }
#shareTimeOption { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block: 16px; }
#shareTime { width: 90px; }
#shareDialog input[type="text"] { min-width: 0; padding: 10px; border: 1px solid var(--search-border); border-radius: 6px; background: var(--search-bg); color: var(--text); }
#shareUrl { width: 100%; margin-top: 12px; }
#shareFeedback, #shareLocalNote { color: var(--text-muted); line-height: 1.5; }
.share-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
@media (max-width: 600px) { .episode-filter-field { flex-basis: 100%; } }
.feed-download { display: flex; align-items: flex-start; gap: 16px; max-width: 640px; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text-muted); line-height: 1.6; margin: 24px 0 28px; }
.feed-error-icon { display: grid; place-items: center; flex: 0 0 40px; height: 40px; border-radius: 10px; background: var(--accent-subtle); color: var(--accent-text); }
.feed-error-icon svg { width: 24px; height: 24px; }
.feed-error-copy { min-width: 0; }
.feed-download p { margin: 0 0 8px; font-size: 14px; }
.feed-download #feedStatus { padding: 0; color: var(--text); font-size: 17px; font-weight: 600; line-height: 1.5; }
.feed-download-link { display: inline-flex; align-items: center; justify-content: center; gap: 10px; max-width: 100%; margin-top: 12px; padding: 10px 16px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: #fff; font-size: 14px; line-height: 1.5; }
.feed-download-link svg { flex: 0 0 20px; width: 20px; height: 20px; }
.feed-download-link:hover { filter: brightness(0.94); }
@media (max-width: 600px) { .feed-download { gap: 12px; padding: 20px 16px; } .feed-error-icon { flex-basis: 32px; height: 32px; } .feed-download #feedStatus { font-size: 16px; } }

/* Only the content between the toolbar and player scrolls. */
html { height: 100%; overflow: hidden; }
body { height: 100vh; height: 100dvh; overflow: hidden; padding-bottom: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
.sidebar { position: relative; inset: auto; grid-column: 1; grid-row: 1; width: auto; min-height: 0; padding-bottom: 24px; overflow-y: auto; }
.app-main { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; margin-left: 0; padding: 0; overflow: hidden; }
.topbar { position: relative; top: auto; flex-shrink: 0; margin: 0 5vw; }
.content-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-color: var(--text-muted) transparent; padding: 44px 5vw 40px; }
.content-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.audio-player:not(.is-expanded) { position: relative; inset: auto; grid-column: 1 / -1; grid-row: 2; min-width: 0; }
.audio-player.is-expanded { position: fixed; }
@media (min-width: 601px) and (max-width: 900px) {
  body { grid-template-columns: 190px minmax(0, 1fr); }
  .topbar { margin-inline: 28px; }
  .content-scroll { padding-inline: 28px; }
}
@media (max-width: 600px) {
  body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .sidebar { grid-column: 1; grid-row: 1; padding: 12px 20px; overflow: visible; }
  .app-main { grid-column: 1; grid-row: 2; }
  .topbar { margin-inline: 20px; }
  .content-scroll { padding: 28px 20px 32px; }
  .audio-player:not(.is-expanded) { grid-row: 3; }
}
@media (max-width: 600px) {
  .sidebar { max-height: var(--mobile-header-size, 90px); overflow: hidden; transition: max-height .2s ease, padding .2s ease, opacity .16s ease; }
  body.mobile-header-hidden .sidebar { max-height: 0; padding-block: 0; border-bottom-width: 0; opacity: 0; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* Edge-to-edge iOS home-screen windows need their own screen safe areas. */
body { padding-top: env(safe-area-inset-top, 0px); }
@media (max-width: 760px) {
  .audio-player:not(.is-expanded) {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
}
@media (display-mode: standalone), (display-mode: fullscreen) {
  .audio-player:not(.is-expanded) {
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
    padding-bottom: max(20px, calc(8px + env(safe-area-inset-bottom, 0px)));
  }
}
@media (max-width: 600px) {
  .sidebar { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
  .topbar { margin-left: max(20px, env(safe-area-inset-left, 0px)); margin-right: max(20px, env(safe-area-inset-right, 0px)); }
  .content-scroll { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
}
