:root {
  --surface: var(--card, #ffffff);
  --ink: var(--text, #2b2420);
  --muted: var(--subtle, #6b5f58);
  --line: var(--border, #ead6c7);
  --accent-2: #1f7a72;
  --accent-3: #d9a441;
}

* {
  box-sizing: border-box;
}

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

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px clamp(20px, 5vw, 48px) 64px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-mark {
  font-family: 'Fraunces', 'Times New Roman', serif;
  font-size: 1.9rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-tag {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.7rem;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.refresh-alert {
  margin: -12px 0 24px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 239, 229, 0.95);
  border: 1px solid rgba(178, 91, 47, 0.35);
  color: #7a3f1f;
  display: grid;
  gap: 8px;
  box-shadow: 0 12px 24px rgba(178, 91, 47, 0.1);
}

.refresh-alert-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.refresh-alert-body {
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed rgba(178, 91, 47, 0.25);
  max-height: 160px;
  overflow: auto;
}

.pill-button {
  text-decoration: none;
  color: inherit;
  background: var(--surface);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  min-height: 44px;
  background: var(--surface);
  border-radius: 999px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(40, 26, 15, 0.08);
  font-size: 0.85rem;
  transition: background 0.25s ease, border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.status-pill.refreshing {
  background: linear-gradient(135deg, #e9f7ee, #f5fdf8);
  border-color: rgba(64, 160, 120, 0.28);
  box-shadow: 0 14px 32px rgba(64, 160, 120, 0.14);
}

.status-pill.sending {
  background: linear-gradient(135deg, #eef3fd, #f6f8ff);
  border-color: rgba(47, 128, 237, 0.28);
  box-shadow: 0 14px 32px rgba(47, 128, 237, 0.14);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(31, 122, 114, 0.45);
  animation: pulse 1.6s infinite;
}

.status-pill.refreshing .pulse {
  background: #2f80ed;
  box-shadow: 0 0 0 0 rgba(47, 128, 237, 0.4);
  animation: pulse-blue 1.6s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 122, 114, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(31, 122, 114, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(31, 122, 114, 0);
  }
}

@keyframes pulse-blue {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 128, 237, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(47, 128, 237, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(47, 128, 237, 0);
  }
}

.status-pill.accent {
  border-color: rgba(212, 104, 45, 0.25);
  box-shadow: 0 12px 30px rgba(212, 104, 45, 0.12);
}

.pulse-amber {
  background: #d9a441;
  box-shadow: 0 0 0 0 rgba(217, 164, 65, 0.35);
  animation: pulse-amber 2.4s infinite;
}

.refresh-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(47, 37, 33, 0.12);
  background: rgba(255, 255, 255, 0.8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.refresh-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  color: var(--muted);
}

.refresh-stop {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #c23a3a;
  box-shadow: inset 0 0 0 2px #de5a5a;
}

.refresh-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(28, 16, 8, 0.12);
}

.refresh-icon.busy svg {
  animation: spin 1s linear infinite;
  color: var(--accent-2);
}

.refresh-icon.busy:hover {
  background: #f6d2d2;
  border-color: rgba(194, 58, 58, 0.45);
  color: #b53232;
}

.refresh-icon.busy:hover svg {
  display: none;
}

.refresh-icon.busy:hover .refresh-stop {
  display: inline-block;
}

.send-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(47, 37, 33, 0.12);
  background: rgba(255, 255, 255, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.send-icon svg {
  width: 20px;
  height: 20px;
  color: #d9682d;
}

.send-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(28, 16, 8, 0.12);
  border-color: rgba(217, 104, 45, 0.25);
}

.send-icon.busy {
  animation: pulse-working 1.6s ease-in-out infinite;
  color: var(--accent-2);
}

.send-icon.busy svg {
  animation: spin 1s linear infinite;
}

.pill-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(47, 37, 33, 0.12);
  background: rgba(255, 255, 255, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
}

.pill-icon svg {
  width: 22px;
  height: 22px;
  color: var(--muted);
}

.status-pill.refreshing .refresh-icon {
  background: rgba(47, 128, 237, 0.08);
  border-color: rgba(47, 128, 237, 0.2);
}

.status-pill.refreshing .refresh-icon svg {
  color: #2f80ed;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-amber {
  0% {
    box-shadow: 0 0 0 0 rgba(217, 164, 65, 0.35);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(217, 164, 65, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(217, 164, 65, 0);
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
    color 0.2s ease;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(47, 37, 33, 0.12);
  background: rgba(255, 255, 255, 0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  color: var(--ink);
}

.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(28, 16, 8, 0.12);
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), #f39a63);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(38, 24, 12, 0.08);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  border: 1px solid rgba(47, 37, 33, 0.1);
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#refresh-data.busy {
  position: relative;
  overflow: hidden;
  animation: pulse-working 1.6s ease-in-out infinite;
  color: #fff;
}

#refresh-data.busy.stage-podcast {
  background: linear-gradient(
    120deg,
    rgba(106, 50, 208, 0.08),
    rgba(167, 123, 255, 0.08)
  );
  border-color: rgba(106, 50, 208, 0.18);
}

#refresh-data.busy.stage-youtube {
  background: linear-gradient(
    120deg,
    rgba(204, 0, 0, 0.08),
    rgba(255, 77, 77, 0.08)
  );
  border-color: rgba(204, 0, 0, 0.18);
}

#refresh-data.busy::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.18);
  transform-origin: left;
  transform: scaleX(calc(var(--progress, 0) / 100));
  transition: transform 0.3s ease;
}

@keyframes pulse-working {
  0% {
    box-shadow: 0 0 0 0 rgba(212, 104, 45, 0.25);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(212, 104, 45, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(212, 104, 45, 0);
  }
}

.episode-link {
  position: relative;
  overflow: hidden;
}

.episode-link::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  transform-origin: left;
  animation: pulse-cta 1.6s ease-in-out infinite;
}

@keyframes pulse-cta {
  0% {
    transform: scaleX(0);
    opacity: 0.3;
  }
  50% {
    transform: scaleX(1);
    opacity: 0.12;
  }
  100% {
    transform: scaleX(0);
    opacity: 0;
  }
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 28px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 16px;
  align-self: flex-start;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.focus-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 12px 0 10px;
}

textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(47, 37, 33, 0.12);
  font-family: inherit;
  resize: vertical;
  margin-bottom: 12px;
}

select,
input[type='text'] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(47, 37, 33, 0.12);
  background: #fff;
  font-family: inherit;
  font-size: 0.9rem;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 12px 0 6px;
}

.inline-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.focus-actions {
  display: flex;
  justify-content: flex-start;
}

.divider {
  height: 1px;
  background: rgba(47, 37, 33, 0.08);
  margin: 18px 0;
}

.favorite-note {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(31, 122, 114, 0.08);
  border: 1px solid rgba(31, 122, 114, 0.2);
  font-size: 0.85rem;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stacked-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
}

.tabs {
  display: inline-flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.6);
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(47, 37, 33, 0.1);
  width: fit-content;
}

.tab {
  border: none;
  background: transparent;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 10px 20px rgba(28, 16, 8, 0.08);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.tab-panel.active {
  display: flex;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.panel-header h2 {
  font-family: 'Fraunces', 'Times New Roman', serif;
  margin: 0 0 6px;
}

.legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(47, 37, 33, 0.1);
  border-radius: 999px;
  padding: 6px;
  width: max-content;
  min-width: 0;
}

.type-bar {
  justify-content: flex-start;
}

.filter-chip {
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  padding: 10px 16px;
  border-radius: 14px;
}

.filter-chip.all {
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  border-color: rgba(47, 37, 33, 0.15);
}

.filter-chip.active {
  box-shadow: 0 12px 24px rgba(28, 16, 8, 0.12);
  transform: translateY(-1px);
  background: #fff;
  border-color: rgba(47, 37, 33, 0.14);
}

.filter-chip.all.active {
  color: var(--ink);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.chip.sent {
  background: rgba(31, 122, 114, 0.12);
  color: #1f7a72;
  border-color: rgba(31, 122, 114, 0.25);
}

.chip.pending {
  background: rgba(217, 164, 65, 0.18);
  color: #a26c1a;
  border-color: rgba(217, 164, 65, 0.3);
}

.chip.favorite {
  background: rgba(50, 100, 255, 0.16);
  color: #2f5bff;
  border-color: rgba(50, 100, 255, 0.28);
}

.type-chip.podcast {
  background: rgba(114, 65, 217, 0.12);
  color: #6a32d0;
  border-color: rgba(114, 65, 217, 0.25);
}

.type-chip.youtube {
  background: rgba(204, 0, 0, 0.12);
  color: #cc0000;
  border-color: rgba(204, 0, 0, 0.25);
}

.type-chip.active {
  background: #fff;
  box-shadow: 0 12px 24px rgba(28, 16, 8, 0.12);
  transform: translateY(-1px);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.source-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 18px;
  border: 1px solid rgba(47, 37, 33, 0.08);
  box-shadow: 0 16px 32px rgba(25, 15, 8, 0.08);
  animation: card-rise 0.6s ease both;
  animation-delay: var(--delay, 0s);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.source-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
}

.source-identity {
  display: flex;
  gap: 14px;
  align-items: center;
}

.thumb {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: rgba(47, 37, 33, 0.08);
  overflow: hidden;
  flex-shrink: 0;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(140deg, #d4682d, #f0a06a);
}

.source-identity h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.source-identity p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.channel-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  position: absolute;
  top: 0;
  right: 0;
}

.station-select {
  min-width: 180px;
  width: auto;
}

.channel-station {
  margin-top: 4px;
}

.pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid rgba(47, 37, 33, 0.1);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}

.pill.subtle {
  background: rgba(31, 122, 114, 0.08);
  border-color: rgba(31, 122, 114, 0.18);
  color: #1f7a72;
}

.pill.youtube {
  background: rgba(204, 0, 0, 0.12);
  border-color: rgba(204, 0, 0, 0.25);
  color: #cc0000;
}

.pill.podcast {
  background: rgba(114, 65, 217, 0.12);
  border-color: rgba(114, 65, 217, 0.25);
  color: #6a32d0;
}

.select-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.source-counts {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.source-card.selected {
  background: linear-gradient(
    145deg,
    rgba(212, 104, 45, 0.08),
    rgba(255, 255, 255, 0.9)
  );
  border-color: rgba(212, 104, 45, 0.4);
}

.episode-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
}

.episode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(250, 247, 243, 0.9);
  border: 1px solid rgba(47, 37, 33, 0.06);
}

.episode-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.episode-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.episode-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.episode-meta span {
  font-size: 0.7rem;
}

.episode-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.episode-alerts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.episode-alert {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(47, 37, 33, 0.18);
  color: rgba(47, 37, 33, 0.65);
  background: rgba(47, 37, 33, 0.06);
}

.episode-alert svg {
  width: 14px;
  height: 14px;
}

.episode-alert.transcript {
  color: #b25b2f;
  border-color: rgba(178, 91, 47, 0.35);
  background: rgba(178, 91, 47, 0.12);
}

.episode-alert.summary {
  color: #b25b2f;
  border-color: rgba(178, 91, 47, 0.35);
  background: rgba(178, 91, 47, 0.12);
}

.episode-link {
  font-size: 0.75rem;
  text-decoration: none;
  color: #1f7a72;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(31, 122, 114, 0.12);
  border: 1px solid rgba(31, 122, 114, 0.25);
}

.episode-link.youtube {
  background: rgba(204, 0, 0, 0.12);
  border-color: rgba(204, 0, 0, 0.25);
  color: #cc0000;
}

.episode-link.podcast {
  background: rgba(114, 65, 217, 0.12);
  border-color: rgba(114, 65, 217, 0.25);
  color: #6a32d0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.72rem;
  color: var(--muted);
}

.page-controls {
  display: inline-flex;
  gap: 6px;
}

.page-btn {
  border: 1px solid rgba(47, 37, 33, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  cursor: pointer;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.favorite-toggle {
  border: none;
  background: transparent;
  color: #2f5bff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: absolute;
  top: 10px;
  right: 10px;
  margin-left: auto;
}

.favorite-toggle.active {
  background: transparent;
}

.favorite-toggle svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.favorite-floating {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 2;
}

.cta-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
}

.card-footer {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 4px;
}

.pagination-slot {
  flex: 1 1 auto;
}

.count-row {
  justify-content: flex-end;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid rgba(47, 37, 33, 0.1);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}

.count-pill.sent {
  background: rgba(31, 122, 114, 0.12);
  color: #1f7a72;
  border-color: rgba(31, 122, 114, 0.25);
}

.count-pill.pending {
  background: rgba(217, 164, 65, 0.18);
  color: #a26c1a;
  border-color: rgba(217, 164, 65, 0.3);
}

.count-pill.favorite {
  background: rgba(50, 100, 255, 0.16);
  color: #2f5bff;
  border-color: rgba(50, 100, 255, 0.28);
}

.count-pill.total {
  background: rgba(47, 37, 33, 0.06);
  border-color: rgba(47, 37, 33, 0.1);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  width: min(520px, 100%);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(47, 37, 33, 0.1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
}

.modal textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(47, 37, 33, 0.12);
  font-family: inherit;
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.settings-row label {
  font-size: 0.85rem;
  color: var(--muted);
}

.settings-row input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(47, 37, 33, 0.12);
  font-family: inherit;
}

.settings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(47, 37, 33, 0.08);
}

.settings-list li:last-child {
  border-bottom: none;
}

.station-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.station-chip-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(47, 37, 33, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.station-chip {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 14px;
}

.station-chip.active {
  box-shadow: 0 12px 24px rgba(28, 16, 8, 0.12);
  transform: translateY(-1px);
  background: #fff;
  border-color: rgba(47, 37, 33, 0.14);
  color: var(--ink);
}

.station-chip.add {
  border-style: dashed;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.station-chip-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.station-chip.unassigned {
  color: #a55b00;
  border-color: rgba(217, 164, 65, 0.25);
}

.station-chip.unassigned.active {
  background: rgba(217, 164, 65, 0.12);
  border-color: rgba(217, 164, 65, 0.35);
  color: #a55b00;
}

.station-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.station-title {
  font-family: 'Fraunces', 'Times New Roman', serif;
  font-size: 1.3rem;
}

.station-card {
  background: linear-gradient(145deg, #fff8f1, #fffdfb);
  border-radius: 24px;
  padding: 20px;
  border: 1px solid rgba(212, 104, 45, 0.12);
  box-shadow: 0 18px 40px rgba(212, 104, 45, 0.12);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.station-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.station-add-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.pill-input {
  display: flex;
  align-items: stretch;
  gap: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(47, 37, 33, 0.12);
  border-radius: 14px;
  padding: 6px;
  width: 100%;
}

.pill-input input {
  flex: 1;
  border: none;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  outline: none;
}

.pill-input .add {
  margin: 0;
}

.help-card {
  margin-top: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(145deg, #fff6ed, #fffdf9);
  border: 1px solid rgba(212, 104, 45, 0.2);
  box-shadow: 0 12px 24px rgba(212, 104, 45, 0.12);
}

.help-card h4 {
  margin: 0 0 6px;
  font-family: 'Fraunces', 'Times New Roman', serif;
}

.help-card p {
  margin: 0 0 8px;
  color: var(--muted);
}

.help-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.station-header h3 {
  margin: 0 0 6px;
  font-family: 'Fraunces', 'Times New Roman', serif;
}

.station-meta {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 8px;
}

.station-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: 0;
  padding-left: 0;
  justify-content: flex-start;
}

.station-counts.count-row {
  justify-content: flex-start;
}

.station-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.station-channel-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 16px;
  border: 1px solid rgba(47, 37, 33, 0.08);
  box-shadow: 0 14px 28px rgba(25, 15, 8, 0.08);
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 14px;
  position: relative;
  animation: card-rise 0.5s ease both;
  animation-delay: var(--delay, 0s);
}

.station-channel-layout {
  display: contents;
}

.thumb-tall {
  width: 100%;
  height: 100%;
  min-height: 150px;
  border-radius: 18px;
  overflow: hidden;
}

.station-channel-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.station-channel-card h4 {
  margin: 4px 0 2px;
}

.station-channel-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.station-channel-card.selected {
  background: linear-gradient(
    145deg,
    rgba(212, 104, 45, 0.08),
    rgba(255, 255, 255, 0.9)
  );
  border-color: rgba(212, 104, 45, 0.4);
}

.station-channel-card {
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.station-channel-card:hover {
  border-color: rgba(212, 104, 45, 0.35);
  box-shadow: 0 16px 32px rgba(25, 15, 8, 0.12);
}

.episode-list-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.episode-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.episode-group-card {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(47, 37, 33, 0.08);
  background: var(--surface);
  box-shadow: 0 16px 30px rgba(25, 15, 8, 0.08);
}

.episode-group-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0 6px;
  border-radius: 12px;
  border: none;
  background: transparent;
  box-shadow: none;
  margin-bottom: 2px;
  justify-content: space-between;
}

.group-thumb {
  width: 104px;
  height: 104px;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(47, 37, 33, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: -0px;
  margin-top: -6px;
  box-shadow: 0 12px 28px rgba(25, 15, 8, 0.12);
}

.group-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-thumb-fallback {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #d4682d, #f0a06a);
}

.group-title {
  font-weight: 700;
  color: var(--ink);
  font-size: 1.2rem;
}

.group-left {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
}

.group-right {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.episode-group-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.episode-row:hover {
  border-color: rgba(212, 104, 45, 0.25);
  box-shadow: 0 12px 28px rgba(25, 15, 8, 0.12);
}

.episode-row.expanded {
  background: #fffdfa;
  border-color: rgba(212, 104, 45, 0.25);
}

.episode-row-main {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.episode-row-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.episode-row-title {
  font-weight: 700;
}

.episode-row-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.episode-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-self: end;
}

.episode-thumb {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(47, 37, 33, 0.06);
  flex-shrink: 0;
}

.episode-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stacked-labels {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-direction: column;
}

.episode-row-summary {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(47, 37, 33, 0.04);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.summary-loading {
  color: var(--muted);
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

.bulk-assign {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(47, 37, 33, 0.08);
}

.group-toggle,
.episode-alert-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.episode-alert-filters {
  margin-top: 8px;
}

.inline-check {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.selected-count {
  font-size: 0.8rem;
  color: var(--muted);
}

.bulk-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bulk-controls select {
  width: auto;
  min-width: 200px;
}

.bulk-assign.inline {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(47, 37, 33, 0.12);
  box-shadow: 0 10px 24px rgba(28, 16, 8, 0.12);
}

.bulk-assign.sticky {
  position: sticky;
  top: 16px;
  z-index: 5;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 16px;
  background: rgba(47, 37, 33, 0.9);
  color: #ffffff;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.notification-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 30;
}

.notification-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(47, 37, 33, 0.1);
  box-shadow: 0 14px 28px rgba(25, 15, 8, 0.16);
  animation: card-rise 0.35s ease both;
}

.notification-card.hide {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.notify-thumb {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(47, 37, 33, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notify-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.notify-thumb-fallback {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #d4682d, #f0a06a);
}

.notify-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notify-title {
  font-weight: 700;
  color: var(--ink);
}

.notify-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1024px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .episode {
    flex-direction: column;
    align-items: flex-start;
  }

  .episode-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
.episode-row {
  width: 100%;
  border: 1px solid rgba(47, 37, 33, 0.1);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(250, 247, 243, 0.9);
  box-shadow: 0 6px 16px rgba(25, 15, 8, 0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  position: relative;
}

.episode-row.favorite-active {
  background: rgba(50, 100, 255, 0.06);
  border-color: rgba(50, 100, 255, 0.35);
  box-shadow: 0 12px 28px rgba(50, 100, 255, 0.12);
}
