:root {
  --bg: #f4efea;
  --bg-2: #eef4ee;
  --card: rgba(255, 255, 255, 0.72);
  --card-strong: rgba(255, 255, 255, 0.88);
  --text: #667061;
  --muted: #8f9688;
  --sage: #a8b89f;
  --sage-deep: #79846f;
  --peach: #edcf9e;
  --coral: #f08d85;
  --line: rgba(121, 132, 111, 0.15);
  --shadow: 0 18px 60px rgba(121, 132, 111, 0.12);
  --shadow-soft: 0 10px 30px rgba(121, 132, 111, 0.08);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 12%, rgba(168, 184, 159, 0.35), transparent 18%),
    radial-gradient(circle at 87% 20%, rgba(240, 141, 133, 0.24), transparent 18%),
    radial-gradient(circle at 78% 86%, rgba(237, 207, 158, 0.28), transparent 20%),
    radial-gradient(circle at 18% 86%, rgba(168, 184, 159, 0.22), transparent 18%),
    linear-gradient(180deg, #f6f2ed 0%, #f4efea 48%, #f2efe9 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(18px + var(--safe-top)) calc(18px + var(--safe-right)) calc(30px + var(--safe-bottom)) calc(18px + var(--safe-left));
}

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 0 auto 18px;
  max-width: 960px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow-soft);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-sage { background: var(--sage); }
.dot-peach { background: var(--peach); }
.dot-coral { background: var(--coral); }

.menu-button,
.close-button,
.ghost-button,
.panel-link,
.play-button {
  border: none;
  cursor: pointer;
}

.menu-button {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.menu-button span {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--sage-deep);
}

.main-content {
  position: relative;
  z-index: 2;
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.player-card,
.history-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.player-card {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.logo-frame {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.72));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 12px 30px rgba(121,132,111,0.08);
}

.logo-frame::after {
  content: "";
  position: absolute;
  inset: auto 10% 3% 10%;
  height: 18px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(121,132,111,0.18), transparent 70%);
  filter: blur(10px);
}

.logo-art {
  width: 100%;
  border-radius: 24px;
}

.player-meta {
  display: grid;
  gap: 18px;
}

.live-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(240, 141, 133, 0.12);
  color: #d06f67;
  font-size: 0.83rem;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.live-ping {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 rgba(240,141,133,0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(240,141,133,0.72); }
  70% { box-shadow: 0 0 0 12px rgba(240,141,133,0); }
  100% { box-shadow: 0 0 0 0 rgba(240,141,133,0); }
}

.status-text,
#trackArtist,
.history-item p,
.panel-section p,
.resource-card p,
.resource-note,
.ghost-button,
.panel-link {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted);
}

.now-playing-wrap h1,
.section-heading-row h2,
.side-panel-header h2 {
  margin: 0;
  color: var(--sage-deep);
}

.now-playing-wrap h1 {
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  line-height: 1.1;
}

#trackArtist {
  margin: 8px 0 0;
  font-size: 1rem;
}

.player-controls {
  display: flex;
  justify-content: center;
}

.play-button {
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(168,184,159,0.95), rgba(240,141,133,0.95));
  box-shadow: 0 18px 38px rgba(121, 132, 111, 0.22);
  position: relative;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.play-button:active {
  transform: scale(0.98);
}

.play-button:hover {
  transform: translateY(-1px);
}

.play-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-left: 24px solid white;
  transform: translateX(4px);
}

.play-button.is-playing .play-icon {
  width: 22px;
  height: 26px;
  border: none;
  transform: none;
}

.play-button.is-playing .play-icon::before,
.play-button.is-playing .play-icon::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7px;
  border-radius: 999px;
  background: white;
}

.play-button.is-playing .play-icon::before { left: 2px; }
.play-button.is-playing .play-icon::after { right: 2px; }

.history-card {
  padding: 22px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.ghost-button {
  padding: 11px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(121,132,111,0.12);
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(121,132,111,0.09);
}

.history-item strong {
  display: block;
  color: var(--sage-deep);
  margin-bottom: 4px;
}

.history-item p,
.history-item time,
.panel-section p,
.resource-card p,
.resource-note {
  margin: 0;
  line-height: 1.55;
}

.history-item time {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.placeholder {
  opacity: 0.9;
}

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  height: 100vh;
  height: 100dvh;
  transform: translateX(104%);
  transition: transform 220ms ease;
  z-index: 25;
  background: rgba(248, 244, 240, 0.92);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  box-shadow: -18px 0 50px rgba(121,132,111,0.16);
  border-left: 1px solid rgba(255,255,255,0.66);
  padding: calc(20px + var(--safe-top)) calc(18px + var(--safe-right)) calc(24px + var(--safe-bottom)) 18px;
  overflow-y: auto;
}

.side-panel.open {
  transform: translateX(0);
}

.side-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.close-button {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,0.75);
  color: var(--sage-deep);
  font-size: 1.6rem;
  line-height: 1;
  box-shadow: var(--shadow-soft);
}

.panel-nav {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.panel-link {
  display: block;
  width: 100%;
  text-align: left;
  text-decoration: none;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(121,132,111,0.1);
}

.panel-link.hidden {
  display: none;
}

.panel-content {
  display: grid;
  gap: 16px;
}

.panel-section {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.58);
  border: 1px solid rgba(121,132,111,0.09);
  box-shadow: var(--shadow-soft);
}

.resource-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.resource-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(121,132,111,0.08);
}

.resource-card h3 {
  margin: 0 0 6px;
  color: var(--sage-deep);
  font-size: 1rem;
}

.resource-note {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(240,141,133,0.08);
  border: 1px solid rgba(240,141,133,0.12);
}

.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(102, 112, 97, 0.18);
  z-index: 20;
}

body.panel-open {
  overflow: hidden;
}

@media (min-width: 760px) {
  .player-card {
    grid-template-columns: minmax(320px, 430px) 1fr;
    align-items: center;
    padding: 24px;
  }

  .resource-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 759px) {
  .history-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .history-item time {
    white-space: normal;
  }
}

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

.hidden {
  display: none !important;
}

.panel-section-title {
  margin: 0 0 8px;
  color: var(--sage-deep);
  font-size: 1.2rem;
}

.podcast-intro {
  margin-bottom: 14px !important;
}

.podcast-list,
.episode-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.podcast-card,
.episode-card,
.back-button {
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.podcast-card {
  width: 100%;
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(121,132,111,0.08);
  box-shadow: var(--shadow-soft);
}

.podcast-card img {
  width: 66px;
  height: 66px;
  object-fit: cover;
  border-radius: 16px;
  background: rgba(255,255,255,0.72);
}

.podcast-card strong,
.episode-card strong,
.podcast-player-wrap strong {
  display: block;
  color: var(--sage-deep);
}

.podcast-card small,
.episode-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.podcast-card em,
.episode-card em {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: normal;
  line-height: 1.4;
}

.episode-panel {
  margin-top: 14px;
}

.back-button {
  margin-bottom: 14px;
  padding: 10px 13px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(121,132,111,0.08);
  color: var(--sage-deep);
}

.selected-podcast-header {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.52);
  border: 1px solid rgba(121,132,111,0.08);
}

.selected-podcast-header img {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 15px;
}

.selected-podcast-header h4 {
  margin: 0;
  color: var(--sage-deep);
}

.episode-card {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(121,132,111,0.08);
}

.episode-card b {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(240, 141, 133, 0.12);
  color: #d06f67;
  font-size: 0.8rem;
}

.podcast-player-wrap,
.podcast-loading,
.podcast-empty {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(121,132,111,0.08);
}

.podcast-empty p {
  margin-top: 6px;
}

#podcastPlayer {
  width: 100%;
  margin-top: 12px;
}
