:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --ink: #101010;
  --ink-soft: #2f2f31;
  --muted: #737373;
  --muted-soft: #a1a1a6;
  --line: rgba(0, 0, 0, 0.09);
  --line-strong: rgba(0, 0, 0, 0.18);
  --focus: rgba(0, 0, 0, 0.08);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.08);
  --soft-shadow: 0 10px 28px rgba(0, 0, 0, 0.055);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfbfd 28%, var(--bg) 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

button:active {
  transform: scale(0.985);
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.055);
  color: var(--ink-soft);
  font-size: 12px;
}

.app-frame {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.top-nav,
.brand,
.panel-header,
.time-row,
.controls,
.action-row,
.note-actions,
.status-pills {
  display: flex;
  align-items: center;
}

.top-nav {
  justify-content: space-between;
  gap: 20px;
  min-height: 54px;
  margin-bottom: 18px;
  padding: 0 2px;
}

.top-nav > p {
  color: var(--muted);
  font-size: 13px;
}

.brand {
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #111111;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.import-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
}

.import-panel {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(420px, 1.18fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 16px;
  padding: 22px;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.import-copy h1 {
  margin-bottom: 10px;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.08;
  word-break: keep-all;
}

.import-copy p:not(.eyebrow) {
  max-width: 680px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.import-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.import-form input {
  min-width: 0;
  height: 52px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  outline: none;
  padding: 0 12px;
  font-size: 16px;
}

.import-form input::placeholder,
.search input::placeholder,
.raw-transcript::placeholder {
  color: var(--muted-soft);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(270px, 320px) minmax(420px, 1fr) minmax(340px, 430px);
  gap: 16px;
  align-items: start;
}

.left-stack,
.center-stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2,
.notes-panel h2 {
  color: var(--ink);
  font-size: 20px;
  font-weight: 720;
  line-height: 1.2;
}

.search {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.search input,
.raw-transcript,
.note-output {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  outline: none;
}

.search input {
  height: 42px;
  padding: 0 12px;
}

.search input:focus,
.raw-transcript:focus,
.note-output:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px var(--focus);
}

.feed {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 315px);
  overflow: auto;
  padding-right: 2px;
}

.feed::-webkit-scrollbar,
.transcript::-webkit-scrollbar,
.note-output::-webkit-scrollbar,
.raw-transcript::-webkit-scrollbar {
  width: 8px;
}

.feed::-webkit-scrollbar-thumb,
.transcript::-webkit-scrollbar-thumb,
.note-output::-webkit-scrollbar-thumb,
.raw-transcript::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.15);
}

.episode-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 11px;
  width: 100%;
  min-height: 68px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.episode-card:hover,
.episode-card.active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--soft-shadow);
}

.mini-cover,
.cover-art {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #111111, #3a3a3c 58%, #d2d2d7);
}

.mini-cover {
  width: 48px;
  height: 48px;
}

.episode-card strong {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 690;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.episode-card span span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-playing {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.cover-art {
  aspect-ratio: 1;
  box-shadow: var(--shadow);
}

.record {
  position: absolute;
  inset: 16%;
  border: 26px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
}

.record::after {
  content: "";
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
}

.sound-lines {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: end;
  gap: 5px;
  height: 44px;
}

.sound-lines span {
  width: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
}

.sound-lines span:nth-child(1) { height: 18px; }
.sound-lines span:nth-child(2) { height: 31px; }
.sound-lines span:nth-child(3) { height: 44px; }
.sound-lines span:nth-child(4) { height: 26px; }
.sound-lines span:nth-child(5) { height: 36px; }

.episode-meta {
  min-width: 0;
}

.episode-meta > p:first-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-meta h2 {
  margin: 8px 0 9px;
  font-size: clamp(22px, 1.8vw, 28px);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.16;
}

#episodeDesc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.progress-wrap {
  margin: 20px 0 15px;
}

.time-row {
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--ink);
}

.audio-status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.controls,
.action-row,
.note-actions {
  gap: 9px;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button,
.play-button,
.speed-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 0 13px;
  font-size: 14px;
  font-weight: 680;
  white-space: nowrap;
}

.primary-button,
.play-button {
  border-color: #111111;
  background: #111111;
  color: #ffffff;
}

.primary-button:hover,
.play-button:hover {
  background: #000000;
}

.secondary-button:hover,
.text-button:hover,
.icon-button:hover,
.speed-button:hover {
  border-color: var(--line-strong);
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.primary-button:disabled,
.secondary-button:disabled,
.text-button:disabled,
.icon-button:disabled,
.play-button:disabled,
.speed-button:disabled {
  cursor: wait;
  opacity: 0.56;
}

.icon-button {
  min-width: 45px;
  padding: 0 10px;
}

.play-button {
  min-width: 86px;
}

.speed-button {
  min-width: 68px;
}

.transcript {
  display: grid;
  gap: 7px;
  max-height: 285px;
  overflow: auto;
  padding-right: 2px;
}

.line {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 11px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.line.active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

.line time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.line p {
  min-width: 0;
  font-size: 13px;
  line-height: 1.6;
}

.line small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.notes-panel {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.transcript-helper {
  margin-top: -4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.raw-transcript,
.note-output {
  resize: vertical;
  padding: 13px;
  line-height: 1.65;
}

.raw-transcript {
  min-height: 210px;
  max-height: 380px;
}

.note-output {
  min-height: 560px;
  max-height: calc(100vh - 285px);
  background: rgba(255, 255, 255, 0.92);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 13px;
}

.markdown-panel {
  position: sticky;
  top: 16px;
}

.note-actions button,
.action-row button {
  flex: 1;
}

.status-pills {
  gap: 7px;
  flex-wrap: wrap;
}

.status-pill {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 650;
}

.status-pill.done {
  border-color: #111111;
  background: #111111;
  color: #ffffff;
}

.status-pill.active {
  border-color: var(--line-strong);
  color: var(--ink);
}

.hidden-settings {
  display: none;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 44px));
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
}

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

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }

  .markdown-panel {
    position: static;
    grid-column: 1 / -1;
  }

  .note-output {
    min-height: 360px;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .app-frame {
    width: min(100% - 24px, 760px);
    padding-top: 14px;
  }

  .top-nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .import-panel,
  .workspace,
  .now-playing {
    grid-template-columns: 1fr;
  }

  .import-panel {
    gap: 18px;
    padding: 18px;
  }

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

  .import-form button {
    min-height: 46px;
  }

  .feed,
  .transcript {
    max-height: none;
  }

  .cover-art {
    width: min(260px, 100%);
  }

  .episode-meta h2 {
    font-size: clamp(24px, 7vw, 32px);
  }
}

@media (max-width: 540px) {
  .app-frame {
    width: calc(100% - 18px);
  }

  .import-copy h1 {
    font-size: 27px;
  }

  .panel,
  .import-panel {
    padding: 14px;
  }

  .controls,
  .action-row,
  .note-actions {
    flex-wrap: wrap;
  }

  .controls button,
  .action-row button,
  .note-actions button {
    flex: 1 1 42%;
  }

  .line {
    grid-template-columns: 48px minmax(0, 1fr);
  }
}
