:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --fg: #f5f5f7;
  --dim: #8a8a90;
  --accent: #3ea6ff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  height: 100dvh;
  width: 100vw;
  touch-action: none;
  display: flex;
  flex-direction: column;
}

#screen {
  position: relative;
  flex: 1;
  min-height: 0;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  padding: 0 20px;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* --- podcasts / episodes carousel --- */

.carousel {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .28s ease, filter .28s ease;
}
.carousel-item img {
  width: min(50vw, 200px);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
  background: #1c1c1f;
}
.carousel-item .title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.carousel-item .meta {
  font-size: 12px;
  color: var(--dim);
}

.episode-card {
  width: min(58vw, 230px);
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  background: linear-gradient(160deg, #1c1c20, #131316);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  padding: 20px;
  overflow: hidden;
  text-align: left;
}
.episode-top-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  gap: 12px;
  margin-bottom: 8px;
}
img.episode-thumb {
  width: 42%;
  aspect-ratio: 1 / 1;
  flex: none;
  border-radius: 14px;
  object-fit: cover;
  opacity: .85;
}
.episode-number {
  flex: 1;
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  text-align: center;
}
.episode-title-inner {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.episode-date {
  font-size: 10px;
  color: var(--dim);
  margin-top: 2px;
}
.episode-date .dot-sep {
  display: inline-block;
  margin: 0 6px;
  opacity: .6;
  transform: translateY(-1px);
}

.carousel-item.pos-current {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  filter: none;
  z-index: 2;
}
.carousel-item.pos-prev {
  transform: translate(calc(-50% - 92%), -50%) scale(.72);
  opacity: .3;
  filter: blur(.5px);
  z-index: 1;
}
.carousel-item.pos-next {
  transform: translate(calc(-50% + 92%), -50%) scale(.72);
  opacity: .3;
  filter: blur(.5px);
  z-index: 1;
}
.carousel-item.pos-hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.5);
}

.index-label {
  flex: 0 0 auto;
  padding: 6px 14px;
  margin-bottom: max(env(safe-area-inset-bottom, 10px), 10px);
  background: #1c1c1f;
  border-radius: 999px;
  font-size: 12px;
  color: var(--dim);
}

/* --- playing screen --- */
.artwork-info-wrap {
  position: relative;
  width: min(55vw, 260px);
  border-radius: 20px;
  overflow: hidden;
}
.artwork-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}
.artwork {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
  background: #1c1c1f;
}
.now-playing-text {
  text-align: center;
  margin-top: 16px;
  max-width: 340px;
}
.podcast-name {
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 4px;
}
.episode-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.progress-wrap {
  width: min(80vw, 340px);
  margin-top: 22px;
}
.progress-bar {
  height: 4px;
  background: #2a2a2e;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .2s linear;
}
.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--dim);
  margin-top: 6px;
}

.seek-flash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: rgba(0,0,0,.4);
  font-size: min(15vw, 64px);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0,0,0,.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity .1s ease;
}
.seek-flash.show {
  opacity: 1;
  transition: opacity .08s ease;
}

.info-overlay {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: #050506;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.info-overlay.show {
  opacity: 1;
}
.info-overlay-text {
  height: 100%;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
  white-space: pre-line;
}

#audio-player { display: none; }
