:root {
  color-scheme: light;
  --paper: #f7f2e8;
  --ink: #19332b;
  --muted: #506459;
  --wash: #ebe6da;
  --green: #123e34;
  --gold: #fadc70;
  --light: #e3eae4;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
main {
  margin: 0 auto;
  max-width: 520px;
  padding: calc(env(safe-area-inset-top) + 19px) 18px calc(32px + env(safe-area-inset-bottom));
}
button, select { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #bc7d1d; outline-offset: 3px; }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 17px; }
.brand-icon { display: block; border-radius: 13px; }
h1 { margin: 0; font-size: 1.35rem; font-weight: 800; white-space: nowrap; }
.import-button {
  margin-left: auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: .86rem;
  font-weight: 660;
  padding: 0 2px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
header:focus-within .import-button { outline: 2px solid #bc7d1d; outline-offset: 2px; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.import-status { margin: -3px 0 14px; color: var(--muted); font-size: .88rem; line-height: 1.5; }

.channels { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; }
.channels button {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--wash);
  font-size: .88rem;
  font-weight: 730;
  white-space: nowrap;
}
.channels button[aria-pressed="true"] { color: white; background: var(--green); }

.player-card { border-radius: 25px; background: var(--green); color: white; padding: 21px 20px 14px; }
.source, .topic { color: var(--light); margin: 0; font-size: .9rem; }
.episode-title {
  margin: 10px 0 5px;
  font-family: ui-serif, Georgia, "Songti SC", serif;
  font-weight: 700;
  font-size: clamp(1.65rem, 7.3vw, 2.4rem);
  line-height: 1.11;
  overflow-wrap: anywhere;
}
.waveform { height: 31px; display: flex; align-items: center; justify-content: space-between; gap: 2px; margin: 15px 0; }
.waveform span { flex: 0 1 3px; min-width: 2px; border-radius: 3px; background: var(--gold); }
.controls { display: flex; justify-content: center; align-items: center; gap: clamp(13px, 5vw, 24px); }
.skip, .play { border-radius: 50%; display: grid; place-items: center; position: relative; }
.skip { width: 52px; height: 52px; color: white; background: #2b5048; }
.skip span { font: 35px/1 system-ui; transform: translateY(-2px); }
.skip small { position: absolute; top: 26px; font-size: .66rem; font-weight: 800; }
.play { width: 68px; height: 68px; background: var(--gold); color: var(--green); }
.play-icon { width: 0; height: 0; border-top: 11px solid transparent; border-bottom: 11px solid transparent; border-left: 18px solid currentColor; margin-left: 3px; }
.play[data-state="pause"] .play-icon { width: 19px; height: 22px; border: 0; border-left: 6px solid; border-right: 6px solid; margin: 0; }
.play[data-state="loading"] .play-icon { width: 23px; height: 23px; border: 3px solid #a7ab62; border-top-color: var(--green); border-radius: 50%; margin: 0; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .play-icon { animation: none !important; } }

.progress { margin-top: 14px; }
#seek { display: block; width: 100%; height: 40px; margin: 0; accent-color: var(--gold); cursor: pointer; }
.timestamps { display: flex; justify-content: space-between; margin-top: -3px; color: var(--light); font: .8rem ui-monospace, monospace; }
.player-options { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; flex-wrap: wrap; font-size: .89rem; }
.speed { display: inline-flex; align-items: center; background: #2b5048; border-radius: 20px; padding-left: 10px; }
.speed select { min-height: 44px; border: 0; color: white; background: transparent; padding: 0 6px; color-scheme: dark; font-weight: 650; cursor: pointer; }
.player-options a { min-height: 44px; display: inline-flex; align-items: center; color: var(--light); text-underline-offset: 3px; }
.playback-status { margin: 6px 0 4px; color: var(--gold); line-height: 1.5; font-size: .91rem; }
.playlist { margin-top: 20px; }
.queue-header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.queue-header h2 { font-size: 1.05rem; margin: 0; }
.queue-header span { font-size: .85rem; color: var(--muted); }
ol { padding: 0; margin: 9px 0 0; list-style: none; }
li + li { margin-top: 3px; }
.episode-row {
  width: 100%;
  min-height: 53px;
  border-radius: 13px;
  background: transparent;
  padding: 7px 8px;
  text-align: left;
  display: grid;
  grid-template-columns: 33px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.episode-row[aria-current="true"] { background: var(--wash); }
.row-icon { width: 33px; height: 33px; border-radius: 50%; display: grid; place-items: center; background: var(--wash); }
.episode-row[aria-current="true"] .row-icon { background: var(--green); color: white; }
.row-icon::before { content: ""; display: block; width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid currentColor; transform: translateX(1px); }
.episode-row[data-playing="true"] .row-icon::before { width: 9px; height: 11px; border: 0; border-left: 3px solid; border-right: 3px solid; transform: none; }
.row-title, .row-topic { display: block; overflow-wrap: anywhere; }
.row-title { font-weight: 700; font-size: .91rem; }
.row-topic { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.row-duration { color: var(--muted); font: .77rem ui-monospace, monospace; }

@media (max-width: 340px) {
  main { padding-left: 12px; padding-right: 12px; }
  .player-card { padding-left: 15px; padding-right: 15px; }
}

.queue-header { flex-wrap: wrap; }
#refresh-feed {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--wash);
  font-size: .83rem;
  font-weight: 700;
}
#refresh-feed:disabled { cursor: default; opacity: .65; }
.feed-status { margin: 2px 0 4px; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.channels button { padding-inline: 11px; }
