:root {
  --bg: #f5efe1;
  --bg-2: #efe4c5;
  --panel: rgba(255, 250, 240, 0.78);
  --panel-strong: rgba(255, 252, 246, 0.92);
  --ink: #1b1f23;
  --muted: #5f645d;
  --accent: #0e7a62;
  --accent-2: #e56a28;
  --line: rgba(27, 31, 35, 0.12);
  --shadow: 0 10px 40px rgba(35, 28, 16, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(14, 122, 98, 0.16), transparent 40%),
    radial-gradient(circle at 88% 16%, rgba(229, 106, 40, 0.14), transparent 42%),
    linear-gradient(180deg, var(--bg), #f7f3ea 45%, var(--bg-2));
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(27, 31, 35, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 31, 35, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 50%, transparent 100%);
}

.app-shell {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font: 500 0.85rem/1 "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1;
  max-width: 15ch;
}

.subtitle {
  color: var(--muted);
  max-width: 70ch;
  margin: 0.9rem 0 0;
  line-height: 1.55;
}

code {
  font-family: "IBM Plex Mono", monospace;
  background: rgba(14, 122, 98, 0.08);
  border-radius: 6px;
  padding: 0.05rem 0.35rem;
}

.status-card,
.search-panel,
.panel {
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.status-card {
  padding: 1rem;
}

.status-card h2 {
  margin: 0;
  font-size: 1rem;
}

.status-card p {
  margin: 0.4rem 0 0.6rem;
  color: var(--muted);
}

.status-card ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  line-height: 1.35;
}

.search-panel {
  padding: 1rem;
  margin-bottom: 1rem;
}

.search-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.search-head h2 {
  margin: 0;
}

.search-head p {
  margin: 0;
  color: var(--muted);
}

.search-form {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

input[type="search"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 10rem;
  line-height: 1.45;
}

input[type="search"]:focus,
textarea:focus,
button:focus-visible,
.podcast-card:focus-visible,
.episode-item:focus-visible {
  outline: 2px solid rgba(14, 122, 98, 0.75);
  outline-offset: 2px;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), #159b7d);
  color: white;
  padding: 0.8rem 1rem;
  font: 600 0.95rem/1 "Space Grotesk", system-ui, sans-serif;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
  box-shadow: 0 4px 20px rgba(14, 122, 98, 0.15);
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(14, 122, 98, 0.2);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.message {
  min-height: 1.25rem;
  color: var(--muted);
  margin: 0.75rem 0 0;
}

.message[data-kind="error"] {
  color: #a93d1a;
}

.message[data-kind="success"] {
  color: var(--accent);
}

.podcast-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.75rem;
}

.podcast-card {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(27, 31, 35, 0.08);
  color: inherit;
}

.podcast-card.is-active {
  border-color: rgba(14, 122, 98, 0.45);
  box-shadow: 0 0 0 2px rgba(14, 122, 98, 0.12) inset;
}

.podcast-card:hover {
  background: rgba(255, 255, 255, 0.72);
}

.podcast-image {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: linear-gradient(135deg, #d8c7ab, #f4ede1);
  border: 1px solid rgba(27, 31, 35, 0.08);
}

.podcast-copy {
  min-width: 0;
}

.podcast-title {
  margin: 0;
  font-size: 0.98rem;
}

.podcast-meta {
  margin: 0.25rem 0 0;
  color: var(--accent-2);
  font: 500 0.75rem/1.2 "IBM Plex Mono", monospace;
}

.podcast-desc {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.workspace {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1rem;
  align-items: start;
}

.panel {
  padding: 1rem;
}

.panel-head h2 {
  margin: 0;
}

.panel-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.episodes-panel {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.episode-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.episode-item {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid rgba(27, 31, 35, 0.08);
  background: rgba(255, 255, 255, 0.56);
  color: inherit;
  box-shadow: none;
}

.episode-item:hover {
  background: rgba(255, 255, 255, 0.74);
}

.episode-item.is-active {
  border-color: rgba(229, 106, 40, 0.45);
  box-shadow: 0 0 0 2px rgba(229, 106, 40, 0.1) inset;
}

.episode-item-title {
  font-weight: 600;
  line-height: 1.25;
}

.episode-item-meta {
  color: var(--muted);
  font: 0.75rem/1.2 "IBM Plex Mono", monospace;
}

.media-row {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.media-block {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(27, 31, 35, 0.08);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.media-block h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.media-block audio {
  width: 100%;
}

.hint {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.transcript-actions {
  margin-top: 0.85rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.transcript-actions button:nth-child(2) {
  background: linear-gradient(135deg, var(--accent-2), #ef8f37);
  box-shadow: 0 4px 20px rgba(229, 106, 40, 0.15);
}

.transcript-output {
  margin: 0.75rem 0 0;
  padding: 1rem;
  min-height: 260px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  line-height: 1.5;
  font-family: "Space Grotesk", system-ui, sans-serif;
}

.tts-box {
  margin-top: 0.85rem;
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(27, 31, 35, 0.08);
  border-radius: var(--radius-md);
}

.tts-head h3 {
  margin: 0;
}

.tts-head p {
  margin: 0.35rem 0 0.75rem;
  color: var(--muted);
}

.tts-row {
  margin-top: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.count {
  color: var(--muted);
  font: 0.78rem/1 "IBM Plex Mono", monospace;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

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

  .episodes-panel {
    position: static;
    max-height: none;
  }
}

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

  .search-form {
    grid-template-columns: 1fr;
  }

  .podcast-card {
    grid-template-columns: 60px 1fr;
  }

  .podcast-image {
    width: 60px;
    height: 60px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }

  button {
    transition: none;
  }
}
