:root {
  --bg: #0d1014;
  --bg-deep: #151a20;
  --panel: rgba(20, 25, 31, 0.95);
  --panel-soft: rgba(24, 30, 36, 0.95);
  --card: rgba(36, 43, 52, 0.82);
  --card-strong: rgba(36, 43, 52, 0.88);
  --line: rgba(225, 232, 240, 0.08);
  --line-strong: rgba(225, 232, 240, 0.12);
  --ink: #edf2f7;
  --muted: rgba(237, 242, 247, 0.66);
  --accent: #c9723b;
  --accent-strong: #f0a36d;
  --blue: #6db7df;
  --green: #77c39b;
  --gold: #d0aa57;
  --red: #eb7f74;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(201, 114, 59, 0.08), transparent 26%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.app-shell {
  width: min(1380px, calc(100% - 30px));
  margin: 0 auto;
  padding: 16px 0 24px;
}

.topbar,
.editorial-grid,
.stack,
.top-actions,
.actions,
.auth-row {
  display: grid;
  gap: 14px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 12px;
  padding: 16px 18px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.74rem;
}

.eyebrow {
  color: var(--accent-strong);
}

h1,
h2,
.card h4 {
  font-family: "Oxanium", "Segoe UI", sans-serif;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

h2 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1;
}

.quiet,
.meta,
.small,
.card p,
#episodes-label,
.pane-head p {
  color: var(--muted);
}

.panel,
.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: none;
  backdrop-filter: blur(10px);
}

.pane {
  padding: 14px;
}

.auth-panel {
  padding: 16px;
  margin-bottom: 12px;
}

.pane-head {
  margin-bottom: 10px;
}

.pane-head.inline {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.pane-head h2,
.card h4,
.card p {
  margin: 0;
}

.top-actions {
  grid-auto-flow: column;
  align-items: start;
}

.editorial-grid {
  grid-template-columns: 290px minmax(0, 1fr) 320px;
  align-items: start;
  gap: 12px;
}

.search-pane,
.episode-pane,
.queue-pane,
.library-pane {
  min-height: 0;
}

.episode-pane {
  background: var(--panel);
}

.queue-pane {
  align-content: start;
}

.stack {
  grid-template-columns: 1fr auto;
  margin-bottom: 10px;
}

.secondary-stack {
  margin-bottom: 0;
}

.list {
  display: grid;
  gap: 10px;
  max-height: 640px;
  overflow: auto;
  padding-right: 4px;
}

.queue-list,
.library-list {
  max-height: 640px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--card);
}

.card p {
  margin-top: 8px;
}

.queue-card {
  display: grid;
  gap: 14px;
  background: var(--card-strong);
}

.library-card {
  display: grid;
  gap: 10px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0 0 12px;
}

.library-headline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.library-copy {
  display: grid;
  gap: 4px;
}

.library-duration {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.delete-button {
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 12px;
}

.queue-copy {
  display: grid;
  gap: 8px;
}

.queue-card h4 {
  font-size: 1.02rem;
  line-height: 1.25;
}

.queue-step {
  margin: 0;
  font-size: 0.95rem;
}

.queue-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
}

.progress-label {
  color: var(--muted);
  font-size: 0.84rem;
}

.job-error {
  color: var(--red);
  font-size: 0.88rem;
}

.job-updated {
  color: var(--muted);
  font-size: 0.8rem;
}

.job-log-preview {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(9, 12, 15, 0.45);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink);
}

.job-log-preview-title {
  color: var(--accent-strong);
  font-family: "Oxanium", "Segoe UI", sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.job-log-preview-empty {
  color: var(--muted);
}

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

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

.episode-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  accent-color: var(--accent);
}

.job-log {
  margin-top: 4px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.job-log summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-family: "Oxanium", "Segoe UI", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.job-log pre {
  margin: 10px 0 0;
  padding: 10px;
  max-height: 240px;
  overflow: auto;
  border-radius: 12px;
  background: rgba(9, 12, 15, 0.58);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

label,
input,
button {
  font: inherit;
}

button,
.pill,
.status-banner-minimal,
.section-meta,
.empty-state,
#episodes-label,
.meta,
.library-duration {
  font-family: "Oxanium", "Segoe UI", sans-serif;
}

label {
  color: var(--muted);
}

input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: rgba(9, 12, 15, 0.58);
  color: var(--ink);
  outline: none;
}

input::placeholder {
  color: rgba(237, 242, 247, 0.42);
}

input:focus {
  border-color: rgba(201, 114, 59, 0.48);
  box-shadow: 0 0 0 3px rgba(201, 114, 59, 0.12);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  background: var(--ink);
  color: #101418;
  cursor: pointer;
  font-weight: 600;
}

button.secondary {
  background: var(--accent);
  color: #fff8f0;
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.chip,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.status-banner-minimal {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
}

.pill {
  background: rgba(240, 163, 109, 0.1);
  color: var(--accent-strong);
}

.status-queued {
  background: rgba(208, 170, 87, 0.14);
  color: var(--gold);
}

.status-processing {
  background: rgba(109, 183, 223, 0.14);
  color: var(--blue);
}

.status-completed {
  background: rgba(119, 195, 155, 0.14);
  color: var(--green);
}

.status-failed {
  background: rgba(235, 127, 116, 0.14);
  color: var(--red);
}

audio {
  width: 100%;
  margin-top: 4px;
  filter: saturate(0.85) brightness(0.92);
}

.hidden {
  display: none;
}

.section-meta {
  margin: 2px 0 0;
  font-size: 0.84rem;
}

.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 8px 2px;
}

.library-list .library-card:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

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

  .search-pane,
  .episode-pane,
  .queue-pane,
  .library-pane {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .topbar,
  .stack,
  .auth-row {
    grid-template-columns: 1fr;
  }

  .pane-head.inline,
  .top-actions {
    display: flex;
    flex-direction: column;
    align-items: start;
  }

  .app-shell {
    width: min(100% - 18px, 1380px);
  }

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