:root {
  --menv-bg: #ffffff;
  --menv-surface: #ffffff;
  --menv-surface-2: #f4f6f8;
  --menv-text: #111827;
  --menv-text-muted: #6b7280;
  --menv-border: #e5e9ee;
  --menv-accent: #00b894;
  --menv-accent-soft: color-mix(in srgb, var(--menv-accent) 13%, transparent);
}
:root[data-menv-theme="dark"] {
  --menv-bg: #12151f;
  --menv-surface: #1a1f2b;
  --menv-surface-2: #232a38;
  --menv-text: #f1f5f9;
  --menv-text-muted: #9ca3af;
  --menv-border: #2f3747;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: transparent;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.menv-podcast { padding: 10px; color: var(--menv-text); }

.menv-podcast-loading, .menv-podcast-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--menv-text-muted);
  font-size: 0.9rem;
}
.menv-podcast-error {
  text-align: center;
  padding: 24px 12px;
  color: #dc2626;
  font-size: 0.9rem;
}

/* ─── Now playing ─────────────────────────────────────────────────────── */
.menv-podcast-player {
  position: relative;
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--menv-border);
  background:
    radial-gradient(120% 140% at 0% 0%, var(--menv-accent-soft), transparent 60%),
    var(--menv-surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 12px 30px rgba(16, 24, 40, .08);
}

.menv-podcast-art { position: relative; }
.menv-podcast-cover {
  display: block;
  width: 140px;
  height: 140px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .22);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}
.menv-podcast.is-playing .menv-podcast-cover { transform: scale(1.03); }
.menv-podcast-art-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--menv-accent), color-mix(in srgb, var(--menv-accent) 55%, #111827));
  color: #ffffff;
}
.menv-podcast-cover.menv-podcast-art-fallback svg { width: 54px; height: 54px; }

.menv-podcast-showname {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--menv-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.menv-podcast-now-title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
  font-weight: 800;
  color: var(--menv-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.menv-podcast-host { margin-top: 3px; font-size: 0.82rem; color: var(--menv-text-muted); }

/* Seek bar */
.menv-podcast-seek { margin-top: 14px; }
.menv-podcast-seek input[type="range"] {
  --menv-progress: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 0;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(90deg, var(--menv-accent) var(--menv-progress), var(--menv-border) var(--menv-progress));
}
.menv-podcast-seek input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--menv-accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  transition: transform .15s ease;
}
.menv-podcast-seek input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.2); }
.menv-podcast-seek input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--menv-accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.menv-podcast-seek input[type="range"]:focus-visible { outline: 2px solid var(--menv-accent); outline-offset: 4px; }
.menv-podcast-times {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--menv-text-muted);
}

/* Controls */
.menv-podcast-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.menv-podcast-controls button { cursor: pointer; border: 0; }
.menv-podcast-controls button:focus-visible { outline: 2px solid var(--menv-accent); outline-offset: 3px; }

.menv-podcast-play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--menv-accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--menv-accent) 40%, transparent);
  transition: transform .15s ease, filter .2s ease;
}
.menv-podcast-play:hover { filter: brightness(1.07); transform: scale(1.05); }
.menv-podcast-play:active { transform: scale(.95); }
.menv-podcast-play svg { width: 24px; height: 24px; }
.menv-podcast-play .i-pause, .menv-podcast.is-playing .menv-podcast-play .i-play { display: none; }
.menv-podcast.is-playing .menv-podcast-play .i-pause { display: block; }

.menv-podcast-skip {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  color: var(--menv-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
}
.menv-podcast-skip:hover { background: var(--menv-surface-2); }
.menv-podcast-skip svg { width: 28px; height: 28px; }
.menv-podcast-skip span {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.55rem;
  font-weight: 800;
}

.menv-podcast-speed {
  margin-left: auto;
  min-width: 46px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--menv-surface-2) !important;
  color: var(--menv-text);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.menv-podcast-subscribe {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--menv-accent);
  background: var(--menv-surface);
  border: 1.5px solid var(--menv-accent);
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.menv-podcast-subscribe:hover { background: var(--menv-accent); color: #ffffff; }
/* Keep the title clear of the subscribe pill in the corner */
.menv-podcast-player:has(.menv-podcast-subscribe:not([hidden])) .menv-podcast-now { padding-right: 96px; }

/* ─── Episode list ────────────────────────────────────────────────────── */
.menv-podcast-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.menv-podcast-episode {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .2s ease, border-color .2s ease;
}
.menv-podcast-episode:hover { background: var(--menv-surface-2); }
.menv-podcast-episode.is-current {
  background: var(--menv-accent-soft);
  border-color: color-mix(in srgb, var(--menv-accent) 30%, transparent);
}

.menv-podcast-ep-btn {
  position: relative;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: none;
}
.menv-podcast-ep-btn:focus-visible { outline: 2px solid var(--menv-accent); outline-offset: 2px; }
.menv-podcast-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.menv-podcast-thumb.menv-podcast-art-fallback { display: flex; }
.menv-podcast-thumb.menv-podcast-art-fallback svg { width: 24px; height: 24px; }
.menv-podcast-ep-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .35);
  color: #ffffff;
  opacity: 0;
  transition: opacity .2s ease;
}
.menv-podcast-ep-state svg { width: 22px; height: 22px; }
.menv-podcast-episode:hover .menv-podcast-ep-state,
.menv-podcast-episode.is-playing .menv-podcast-ep-state { opacity: 1; }
.menv-podcast-eq { display: none; align-items: flex-end; gap: 3px; height: 18px; }
.menv-podcast-eq i { width: 4px; border-radius: 2px; background: #ffffff; animation: menv-podcast-eq 0.9s ease-in-out infinite; }
.menv-podcast-eq i:nth-child(2) { animation-delay: -.3s; }
.menv-podcast-eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes menv-podcast-eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }
.menv-podcast-episode.is-playing .menv-podcast-eq { display: flex; }
.menv-podcast-episode.is-playing .menv-podcast-ep-state .i-play { display: none; }

.menv-podcast-ep-body { flex: 1; min-width: 0; }
.menv-podcast-ep-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--menv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menv-podcast-episode.is-current .menv-podcast-ep-title { color: var(--menv-accent); }
.menv-podcast-ep-meta { font-size: 0.75rem; color: var(--menv-text-muted); margin-top: 2px; }
.menv-podcast-ep-meta:empty { display: none; }
.menv-podcast-ep-desc {
  font-size: 0.8rem;
  color: var(--menv-text-muted);
  line-height: 1.45;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Small screens ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .menv-podcast-player { grid-template-columns: 1fr; text-align: center; padding: 18px 16px; }
  .menv-podcast-art { justify-self: center; }
  .menv-podcast-cover { width: 160px; height: 160px; }
  .menv-podcast-controls { justify-content: center; }
  .menv-podcast-speed { margin-left: 4px; }
  .menv-podcast-subscribe { position: static; justify-self: center; }
  .menv-podcast-player:has(.menv-podcast-subscribe:not([hidden])) .menv-podcast-now { padding-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .menv-podcast-eq i { animation: none; height: 70%; }
  .menv-podcast-cover { transition: none; }
}

/* A long word with no spaces breaks instead of spilling out of its box */
.menv-podcast-showname,
.menv-podcast-now-title,
.menv-podcast-host,
.menv-podcast-subscribe { overflow-wrap: anywhere; }
