@property --spectrum-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@font-face {
  font-family: "Berkeley Mono Local";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/BerkeleyMono-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Berkeley Mono Local";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/BerkeleyMono-Bold.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --page: #000000;
  --display: #0d0d0d;
  --control: #0d0d0d;
  --raised-control: #2c2c2e;
  --border: #1c1c1e;
  --text-primary: #edeceb;
  --text-secondary: #d3d2d0;
  --text-tertiary: #727270;
  --icon-light: #636366;
  --playback: #1e85e2;
  --font-interface: "Berkeley Mono Local", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --content-width: 620px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  background: var(--page);
}

body {
  color: var(--text-primary);
  font-family: var(--font-interface);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: -3px;
}

svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.app-shell {
  display: flex;
  width: min(100%, var(--content-width));
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  flex-direction: column;
  overflow: hidden;
  background: var(--page);
}

.app-header {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  background: var(--display);
  padding: calc(12px + env(safe-area-inset-top)) 20px 18px;
}

.header-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.header-copy {
  min-width: 0;
  flex: 1;
}

.title-plate,
.episode-title-plate {
  display: flex;
  width: fit-content;
  max-width: 100%;
  height: 40px;
  min-width: 0;
  align-items: flex-start;
  background: var(--page);
  padding: 8px 12px;
}

.title-plate h1,
.episode-title-plate h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-asterisk {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  margin: 2px 0 0 5px;
  background: var(--text-primary);
  mask: url("assets/asterisk.svg") center / contain no-repeat;
  -webkit-mask: url("assets/asterisk.svg") center / contain no-repeat;
}

.episode-title-plate {
  width: 100%;
  align-items: center;
}

.episode-title-plate h1 {
  width: 100%;
  font-size: 16px;
  line-height: 20px;
}

.header-subtitle {
  margin: 8px 0 0 12px;
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 16px;
}

.header-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 5px;
  background: var(--page);
  cursor: pointer;
}

.header-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}

.catalog-screen {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--raised-control) transparent;
  scrollbar-width: thin;
  background: var(--page);
  -webkit-overflow-scrolling: touch;
}

.catalog-list {
  min-height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.show-row,
.episode-row {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  -webkit-user-select: none;
  user-select: none;
}

.show-row {
  grid-template-columns: 30px minmax(0, 1fr) 12px;
  gap: 12px;
  align-items: start;
  padding: 12px 20px;
}

.show-row.is-current {
  background: rgb(30 133 226 / 8%);
}

.show-rank,
.episode-sequence {
  padding-top: 2px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  line-height: 17px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.show-copy,
.episode-copy {
  min-width: 0;
}

.show-title,
.episode-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 20px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.show-metadata {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.show-description,
.episode-summary,
.show-introduction {
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 17px;
}

.show-description {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.show-chevron {
  align-self: start;
  padding-top: 3px;
  color: var(--icon-light);
}

.show-chevron svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

.show-introduction {
  margin: 0;
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
}

.episode-row {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 20px;
}

.episode-row::before {
  position: absolute;
  z-index: 0;
  inset: 0 auto 0 0;
  width: var(--episode-progress, 0%);
  background: rgb(30 133 226 / 20%);
  content: "";
  pointer-events: none;
}

.episode-row.is-current {
  background: var(--control);
}

.episode-row > * {
  position: relative;
  z-index: 1;
}

.episode-row:not(.is-current) .episode-title {
  color: var(--text-secondary);
}

.episode-row.is-current .episode-sequence {
  color: var(--episode-accent, var(--text-primary));
}

.episode-meta-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.episode-metadata {
  min-width: 0;
  flex: 1;
  margin: 0;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-summary-wrap {
  position: relative;
  margin-top: 4px;
}

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

.episode-row.is-expanded .episode-summary {
  display: block;
  overflow: visible;
}

.details-button {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.episode-summary-wrap .details-button {
  position: absolute;
  right: 0;
  bottom: -5px;
}

.episode-summary-wrap.has-details .episode-summary {
  padding-right: 32px;
}

.details-button svg {
  width: 10px;
  height: 10px;
  stroke-width: 2.1;
  transition: transform 160ms ease;
}

.episode-row.is-expanded .details-button svg {
  transform: rotate(180deg);
}

.episode-details {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 17px;
}

.episode-detail-group {
  display: grid;
  gap: 3px;
}

.episode-detail-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
}

.episode-detail-group p {
  margin: 0;
}

.screen-status {
  display: grid;
  min-height: 100%;
  place-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--text-tertiary);
  font-size: 13px;
  text-align: center;
}

.screen-status strong {
  color: var(--text-primary);
  font-size: 16px;
}

.now-playing {
  position: relative;
  display: grid;
  width: 100%;
  height: 64px;
  min-height: 64px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--border);
  background: var(--control);
  padding: 0 20px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
}

.now-playing-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgb(30 133 226 / 20%);
  pointer-events: none;
}

.now-playing-copy,
.now-playing-time {
  position: relative;
  z-index: 1;
}

.now-playing-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.marquee {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marquee-track {
  display: block;
  width: max-content;
}

.now-playing-show {
  height: 16px;
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 16px;
}

.now-playing-episode {
  height: 20px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 20px;
}

.now-playing-time {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.transport {
  display: grid;
  width: 100%;
  height: calc(64px + env(safe-area-inset-bottom));
  min-height: calc(64px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  gap: 4px;
  border-top: 1px solid var(--border);
  background: var(--control);
  padding: 4px 4px env(safe-area-inset-bottom);
}

.transport-button,
.play-button {
  display: grid;
  place-items: center;
  justify-self: center;
  border-radius: 50%;
  background: var(--page);
  color: var(--text-primary);
  cursor: pointer;
}

.transport-button {
  width: 48px;
  height: 48px;
  margin-top: 4px;
}

.transport-button:disabled,
.play-button:disabled {
  cursor: default;
}

.transport-button svg {
  width: 22px;
  height: 22px;
}

.transport-skip svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: none;
}

.transport-seek svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.8;
}

.transport-seek svg text {
  fill: currentColor;
  font-family: var(--font-interface);
  font-size: 7px;
  font-weight: 700;
  stroke: none;
}

.play-button {
  position: relative;
  width: 50px;
  height: 50px;
  margin-top: 3px;
  background:
    linear-gradient(var(--page), var(--page)) padding-box,
    conic-gradient(
      from var(--spectrum-angle),
      #e83838,
      #ff8b1f,
      #ffc400,
      #5ed368,
      #5ee0ea,
      #1e85e2,
      #7141b5,
      #ff6491,
      #e83838
    ) border-box;
  border: 2px solid transparent;
  animation: spectrum-spin 30s linear infinite;
}

.play-button::before {
  position: absolute;
  z-index: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--page);
  content: "";
}

.play-button svg {
  position: relative;
  z-index: 1;
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: none;
}

.play-button .play-icon {
  transform: translateX(1px);
}

@keyframes spectrum-spin {
  to {
    --spectrum-angle: 360deg;
  }
}

@media (min-width: 621px) {
  .app-shell {
    border-right: 1px solid var(--border);
    border-left: 1px solid var(--border);
  }
}

@media (max-width: 370px) {
  .app-header,
  .show-row,
  .episode-row,
  .show-introduction,
  .now-playing {
    padding-right: 16px;
    padding-left: 16px;
  }

  .title-plate h1 {
    font-size: 20px;
  }

  .show-row {
    grid-template-columns: 28px minmax(0, 1fr) 14px;
    gap: 10px;
  }

  .episode-row {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
  }

  .transport-button {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
