:root {
  /* Sumi Ink & River Stone Zen Palette */
  --bg-outer: #1d2024;
  --shell-bg: #141517;
  --panel-bg: #1b1d20;
  --panel-recessed: #16181b;
  --border-subtle: #2c2f35;
  --border-accent: #5e5950;
  --text-primary: #f0efeb;
  --text-secondary: #9c9b96;
  --accent: #cbb89d;
  --accent-hover: #dccbb2;
  --accent-ink: #141517;
  --radius-shell: 14px;
  --radius-box: 8px;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-outer);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* Outer Architectural Shell */
.app-shell {
  width: 100%;
  max-width: 920px;
  background-color: var(--shell-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-shell);
  padding: 1.75rem 2rem;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Top Bar with 1px Hairline Divider Underneath */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.brand-logo {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
}

.brand h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent);
  display: inline-block;
}

.brand-tagline {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 400;
}

select {
  background-color: var(--panel-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-accent);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  min-width: 200px;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

select:hover,
select:focus {
  border-color: var(--accent);
}

/* Main Two-Column Hairline Grid */
.player-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: opacity 0.2s ease;
}

.player-grid.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

/* Left Panel: Framed Standalone Artwork Box */
.art-panel {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-box);
  padding: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.art-wrapper {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background-color: var(--panel-recessed);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.art-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Right Column: Stacked Metadata Box + Inline Transport Box */
.right-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Top-Right Metadata Box */
.episode-info {
  flex: 1;
  background-color: var(--panel-bg);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-box);
  padding: 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
}

.meta-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.category-badge {
  background-color: var(--accent);
  color: var(--accent-ink);
  padding: 0.18rem 0.6rem;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meta-divider {
  color: var(--text-secondary);
}

.podcast-name {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.episode-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.6rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.episode-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Bottom-Right Inline Transport Bar */
.controls-bar {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-box);
  padding: 0.95rem 1.35rem;
  display: flex;
  align-items: center;
}

.transport-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

.left-buttons {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.play-pause-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--accent);
  color: var(--accent-ink);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.play-pause-btn:hover {
  background-color: var(--accent-hover);
  transform: scale(1.04);
}

.play-pause-btn:active {
  transform: scale(0.96);
}

.next-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.next-btn:hover {
  background-color: var(--accent);
  color: var(--accent-ink);
  transform: scale(1.04);
}

.next-btn:active {
  transform: scale(0.96);
}

.next-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Inline Waveform-Style Scrubber + Timestamps */
.scrubber-inline {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.track-wrap {
  position: relative;
  height: 22px;
  display: flex;
  align-items: center;
}

/* Subtle vertical tick bars mimicking an architectural audio waveform */
.progress-bg {
  position: absolute;
  left: 0;
  right: 0;
  height: 16px;
  background-image: repeating-linear-gradient(
    90deg,
    var(--border-subtle) 0px,
    var(--border-subtle) 2px,
    transparent 2px,
    transparent 5px
  );
  border-radius: 2px;
  overflow: hidden;
  pointer-events: none;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background-image: repeating-linear-gradient(
    90deg,
    var(--accent) 0px,
    var(--accent) 2px,
    transparent 2px,
    transparent 5px
  );
  transition: width 0.08s linear;
}

.seek-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* Volume Control */
.volume-control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.mute-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
  transition: color 0.15s ease;
}

.mute-btn:hover {
  color: var(--text-primary);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 68px;
  height: 3px;
  background: var(--border-subtle);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* Full-Width Bordered Share Footer Bar */
.share-bar {
  background-color: var(--panel-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-box);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.84rem;
}

.share-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}

.share-label {
  color: var(--text-secondary);
}

.share-link {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.share-link:hover {
  color: var(--accent);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: var(--panel-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 0.3rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.status-note {
  font-size: 0.78rem;
  color: var(--accent);
  margin-left: 0.35rem;
}

.status-note:empty {
  display: none;
}

/* Desktop Widescreen Layout: Side-by-Side Left Artwork Panel + Right Stack */
@media (min-width: 760px) {
  .player-grid {
    flex-direction: row;
    align-items: stretch;
  }

  .art-panel {
    width: 280px;
  }

  .art-wrapper {
    width: 228px;
    height: 228px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 1.25rem;
  }

  .transport-row {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .scrubber-inline {
    order: -1;
    width: 100%;
    flex: 1 1 100%;
  }

  .share-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}