:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f1f1f7;
  --text: #16161d;
  --muted: #5d5d6e;
  --border: #e3e3ec;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-text: #ffffff;
  --danger: #c2261d;
  --success: #15803d;
  --warn-bg: #fff6e0;
  --warn-text: #7a5300;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(16 16 29 / 0.04), 0 8px 24px rgb(16 16 29 / 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e14;
    --surface: #17171f;
    --surface-2: #20202b;
    --text: #ececf3;
    --muted: #a0a0b2;
    --border: #2c2c3a;
    --accent: #8b85ff;
    --accent-hover: #a29dff;
    --accent-soft: #23224a;
    --accent-text: #0e0e14;
    --danger: #ff7b72;
    --success: #3fb950;
    --warn-bg: #3a2c0b;
    --warn-text: #f5d58a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Noto Sans", sans-serif;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
}

.wrap {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 20px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}

.nav a:hover {
  color: var(--text);
}

/* Hero */
.hero {
  padding-top: 56px;
  padding-bottom: 28px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

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

.lede {
  margin: 0 auto;
  max-width: 600px;
  color: var(--muted);
  font-size: 18px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.tool {
  padding: 24px;
}

/* Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 16px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dz-icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
}

.dz-title {
  font-weight: 600;
  font-size: 17px;
}

.dz-sub {
  color: var(--muted);
  font-size: 14px;
}

.dropzone.is-compact {
  padding: 18px 16px;
}

.dropzone.is-compact .dz-icon {
  width: 28px;
  height: 28px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.icon-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--border);
  color: var(--text);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
}

.file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted);
  font-size: 14px;
}

.notice {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 14px;
}

/* Options */
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  border-color: var(--accent);
}

.btn:focus-visible,
.btn-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

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

.btn-block {
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  font-size: 17px;
}

.btn-ghost {
  background: transparent;
}

.btn-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Progress */
.work-head,
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stage {
  font-weight: 700;
  font-size: 18px;
}

.stage-detail {
  color: var(--muted);
  font-size: 14px;
}

.bar {
  height: 10px;
  margin-top: 16px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
}

.bar.is-indeterminate .bar-fill {
  width: 30%;
  animation: slide 1.2s ease-in-out infinite;
}

@keyframes slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(340%); }
}

.bar-small {
  height: 6px;
  margin-top: 10px;
}

/* Batch list */
.jobs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.job {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.job-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.job-icon {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.job[data-status="decoding"] .job-icon,
.job[data-status="working"] .job-icon {
  border-color: var(--accent);
  border-right-color: transparent;
  animation: spin 0.9s linear infinite;
}

.job[data-status="done"] .job-icon {
  border-color: var(--success);
  background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

.job[data-status="error"] .job-icon {
  border-color: var(--danger);
  background: var(--danger) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 5l6 6M11 5l-6 6' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.job[data-status="cancelled"] {
  opacity: 0.6;
}

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

.job-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.job-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-detail {
  color: var(--muted);
  font-size: 14px;
}

.job[data-status="error"] .job-detail {
  color: var(--danger);
}

.job-live {
  margin: 8px 0 0;
  max-height: 3.2em;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.btn-small {
  flex: none;
  padding: 6px 14px;
  font-size: 14px;
}

/* Result */
.back {
  margin-bottom: 14px;
}

.result-title {
  min-width: 0;
}

.result-title .stage {
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 18px;
  border-bottom: 1px solid var(--border);
}

.tab {
  margin-bottom: -1px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

[role="tabpanel"] {
  padding-top: 16px;
}

select.compact {
  width: auto;
  padding: 6px 10px;
  font-size: 14px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.transcript {
  margin-top: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.seg {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.seg:last-child {
  border-bottom: 0;
}

.seg-time {
  flex: none;
  min-width: 58px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  padding-top: 2px;
}

.transcript.no-times .seg-time {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.again {
  margin-top: 16px;
}

.error-text {
  color: var(--danger);
}

/* Summary */
.summary-intro p:first-child {
  margin-top: 0;
}

.summary-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  color: var(--muted);
}

.spinner {
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.summary h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.summary h4 {
  margin: 20px 0 8px;
  font-size: 16px;
}

.summary ul {
  margin: 0;
  padding-left: 22px;
}

.summary li + li {
  margin-top: 4px;
}

.mindmap-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.mindmap {
  height: 440px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
}

.mindmap svg {
  display: block;
  width: 100%;
  height: 100%;
}

.mindmap .markmap {
  --markmap-text-color: var(--text);
  --markmap-circle-open-bg: var(--surface);
  --markmap-font: 400 14px/20px system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Noto Sans", sans-serif;
}

/* Sections */
.section {
  padding-top: 64px;
}

.section h2 {
  margin: 0 0 20px;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  padding: 20px;
}

.steps h3 {
  margin: 10px 0 6px;
  font-size: 17px;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.faq {
  margin-bottom: 10px;
  padding: 0 20px;
  box-shadow: none;
}

.faq summary {
  padding: 16px 0;
  font-weight: 600;
  cursor: pointer;
}

.faq p {
  margin: 0 0 16px;
  color: var(--muted);
}

.site-footer {
  margin-top: 72px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 640px) {
  .hero {
    padding-top: 36px;
  }

  .lede {
    font-size: 16px;
  }

  .tool {
    padding: 16px;
  }

  .options,
  .steps {
    grid-template-columns: 1fr;
  }

  .mindmap {
    height: 360px;
  }

  .nav {
    gap: 14px;
  }

  .actions .btn {
    flex: 1 1 calc(50% - 10px);
  }
}
