:root {
  --bg: #f5f1e8;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-2: rgba(17, 17, 17, 0.04);
  --text: #111111;
  --muted: #5d5b55;
  --line: rgba(17, 17, 17, 0.1);
  --glass: rgba(245, 241, 232, 0.72);
}

html.dark {
  --bg: #111111;
  --panel: rgba(26, 26, 26, 0.9);
  --panel-2: rgba(255, 255, 255, 0.04);
  --text: #f5f1e8;
  --muted: #bdb7aa;
  --line: rgba(255, 255, 255, 0.09);
  --glass: rgba(17, 17, 17, 0.74);
}

body.theme-shell {
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(213, 204, 184, 0.44), transparent 36%),
    radial-gradient(circle at bottom right, rgba(17, 17, 17, 0.08), transparent 28%),
    var(--bg);
}

body.has-persistent-player {
  padding-bottom: 5.2rem;
}

.page-fade {
  opacity: 0;
  transform: translateY(10px);
  animation: page-enter 0.65s ease forwards;
}

@keyframes page-enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input-shell,
.file-shell {
  width: 100%;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 0.95rem 1rem;
  outline: none;
  transition: border-color 180ms ease, transform 180ms ease, background-color 180ms ease;
}

.input-shell:focus,
.file-shell:focus {
  border-color: rgba(17, 17, 17, 0.24);
  transform: translateY(-1px);
}

.range-shell {
  accent-color: var(--text);
}

.player-volume-shell {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.65rem 0.9rem;
  color: var(--muted);
}

.player-volume-shell-compact {
  padding-inline: 0.75rem;
}

.player-volume-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  white-space: nowrap;
}

.player-volume-range {
  width: 7rem;
}

.player-volume-range-compact {
  width: 5.5rem;
}

.episode-card {
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.episode-card:hover {
  transform: translateY(-4px) scale(1.01);
}

.prose-shell {
  color: var(--text);
  line-height: 1.85;
}

.prose-shell h1,
.prose-shell h2,
.prose-shell h3 {
  font-family: Georgia, serif;
  line-height: 1.2;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.prose-shell p,
.prose-shell ul,
.prose-shell ol,
.prose-shell blockquote {
  margin: 0.9rem 0;
}

.prose-shell ul,
.prose-shell ol {
  padding-left: 1.3rem;
}

.prose-shell a {
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.prose-shell blockquote {
  border-left: 3px solid var(--line);
  padding-left: 1rem;
  color: var(--muted);
}

.embed-shell {
  backdrop-filter: blur(18px);
}

#embed-waveform {
  min-height: 92px;
}

.persistent-wave-note {
  display: flex;
  align-items: center;
  min-height: 92px;
  border-radius: 1.25rem;
  border: 1px dashed var(--line);
  padding: 1rem 1.1rem;
  color: var(--muted);
  line-height: 1.7;
}

.persistent-player {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 40;
  padding: 0.5rem 0.65rem;
}

.persistent-player__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: min(900px, calc(100% - 0.5rem));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--glass);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 28px rgba(17, 17, 17, 0.14);
  padding: 0.55rem 0.7rem;
}

.persistent-player__meta {
  flex: 0 1 15rem;
  min-width: 0;
}

.persistent-player__eyebrow {
  margin: 0;
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.persistent-player__title {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0.14rem;
  color: var(--text);
  font-family: Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.15;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.persistent-player__controls {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

.persistent-player__controls > * {
  min-width: 0;
}

.persistent-player__button {
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 2rem;
  padding: 0.46rem 0.82rem;
}

.persistent-player__button--ghost {
  background: var(--panel-2);
  color: var(--text);
}

.persistent-player__button--icon {
  min-width: 2rem;
  padding-inline: 0;
}

.persistent-player__time {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.persistent-player__progress {
  flex: 1 1 9rem;
  width: min(15rem, 30vw);
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.persistent-player__progress::-webkit-slider-runnable-track {
  height: 1.4rem;
  border: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 24' preserveAspectRatio='none'%3E%3Cpath d='M0 12 C15 4 30 20 45 12 S75 4 90 12 S120 20 135 12 S165 4 180 12 S210 20 225 12 S255 4 270 12 S300 20 315 12 S345 4 360 12 S390 20 405 12 S435 4 450 12 S480 20 495 12 S525 4 540 12 S570 20 585 12 S595 8 600 12' fill='none' stroke='rgba(245,241,232,0.38)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.persistent-player__progress::-moz-range-track {
  height: 1.4rem;
  border: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 24' preserveAspectRatio='none'%3E%3Cpath d='M0 12 C15 4 30 20 45 12 S75 4 90 12 S120 20 135 12 S165 4 180 12 S210 20 225 12 S255 4 270 12 S300 20 315 12 S345 4 360 12 S390 20 405 12 S435 4 450 12 S480 20 495 12 S525 4 540 12 S570 20 585 12 S595 8 600 12' fill='none' stroke='rgba(245,241,232,0.38)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.persistent-player__progress::-webkit-slider-thumb {
  appearance: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--panel) 88%, transparent);
}

.persistent-player__progress::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--panel) 88%, transparent);
}

.persistent-player__volume {
  width: 3.5rem;
}

.persistent-player__mute {
  font-size: 0.74rem;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.embed-code {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 880px) {
  body.has-persistent-player {
    padding-bottom: 6.7rem;
  }

  .persistent-player__inner {
    align-items: flex-start;
    flex-direction: column;
    width: min(100%, calc(100% - 0.15rem));
  }

  .persistent-player__controls {
    justify-content: flex-start;
    width: 100%;
    flex-wrap: wrap;
  }

  .persistent-player__progress {
    flex: 1 1 12rem;
    width: 100%;
  }

  .persistent-player__meta {
    flex-basis: auto;
  }
}

@media (max-width: 560px) {
  body.has-persistent-player {
    padding-bottom: 9.8rem;
  }

  .persistent-player {
    padding: 0.35rem;
  }

  .persistent-player__inner {
    gap: 0.5rem;
    border-radius: 0.9rem;
    padding: 0.55rem 0.6rem;
    width: calc(100% - 0.1rem);
  }

  .persistent-player__eyebrow {
    display: none;
  }

  .persistent-player__title {
    display: block;
    font-size: 0.84rem;
  }

  .persistent-player__controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem 0.65rem;
    align-items: center;
  }

  .persistent-player__button {
    min-height: 1.9rem;
    padding: 0.42rem 0.78rem;
  }

  .persistent-player__button--icon {
    min-width: 1.9rem;
  }

  .persistent-player__button:not(.persistent-player__button--icon) {
    order: 1;
  }

  .persistent-player__time {
    order: 2;
    text-align: center;
  }

  .persistent-player__button--icon {
    order: 3;
    justify-self: end;
  }

  .persistent-player__progress {
    width: 100%;
    grid-column: 1 / -1;
    order: 4;
  }

  .persistent-player__mute {
    order: 5;
    justify-self: start;
  }

  .persistent-player__volume {
    grid-column: 2 / -1;
    order: 6;
    width: 100%;
  }

  .persistent-player__button,
  .persistent-player__time,
  .persistent-player__mute,
  .persistent-player__progress,
  .persistent-player__volume {
    width: auto;
  }

  .persistent-player__button,
  .persistent-player__time,
  .persistent-player__mute {
    text-align: center;
  }

  .persistent-player__progress,
  .persistent-player__volume {
    min-width: 0;
  }

  .persistent-player__mute {
    white-space: nowrap;
    font-size: 0.68rem;
  }

  .persistent-player__time {
    font-size: 0.68rem;
  }
}

@media (max-width: 420px) {
  body.has-persistent-player {
    padding-bottom: 10.2rem;
  }

  .persistent-player__title {
    font-size: 0.78rem;
  }

  .persistent-player__controls {
    grid-template-columns: auto 1fr auto;
  }

  .persistent-player__time,
  .persistent-player__mute {
    font-size: 0.66rem;
  }

  .persistent-player__volume {
    grid-column: 2 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-fade,
  .episode-card,
  .input-shell,
  .file-shell,
  .player-volume-button {
    animation: none;
    transition: none;
  }
}
