:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --border: #ececee;
  --border-strong: #dcdde0;
  --text: #16181d;
  --text-2: #565960;
  --text-3: #9b9da4;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;
  --success: #1a8f44;
  --success-soft: #ecf7f0;
  --error: #d83a3a;
  --error-soft: #fbecec;
  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 22px 64px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 44px;
  gap: 12px;
}

.brand { display: flex; align-items: baseline; gap: 10px; }

.brand-mark {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--accent);
  align-self: center;
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--text);
}
.brand-text p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 400;
}

.badge {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 400;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
}
.badge--ok { color: var(--success); border-color: #c7e6d3; background: var(--success-soft); }
.badge--err { color: var(--error); border-color: #f0caca; background: var(--error-soft); }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; gap: 28px; }

/* Section label */
.section-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin: 0 0 12px;
}

/* Dropzone */
.dropzone {
  display: block;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface);
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dropzone-icon { color: var(--text-3); transition: color 0.15s; }
.dropzone:hover .dropzone-icon { color: var(--accent); }
.dropzone-text { display: flex; flex-direction: column; gap: 3px; }
.dropzone-title { font-size: 14px; font-weight: 500; color: var(--text); }
.dropzone-hint { font-size: 12.5px; color: var(--text-3); }
.dropzone.has-file .dropzone-title { color: var(--success); }
.dropzone.has-file .dropzone-hint { color: var(--text-2); }

/* Output type */
.options { display: flex; flex-direction: column; }
.type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-card {
  position: relative;
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface);
}
.type-card:hover { border-color: var(--border-strong); }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.type-card-title { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.type-card-desc { display: block; font-size: 12px; color: var(--text-3); line-height: 1.5; font-weight: 400; }

/* Sub options */
.options--sub {
  padding: 4px 0 0;
  background: transparent;
  border: none;
}
.options--sub .field-row { margin-bottom: 14px; }
.options--sub .field-row:last-child { margin-bottom: 0; }
.field-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); min-width: 80px; }

.seg-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg {
  border: none;
  background: var(--surface);
  padding: 7px 16px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-family: inherit;
  font-weight: 400;
  border-right: 1px solid var(--border);
}
.seg:last-child { border-right: none; }
.seg:hover { background: var(--surface-2); }
.seg.active { background: var(--accent); color: #fff; }

.select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
  min-width: 190px;
  cursor: pointer;
}
.select:focus { outline: none; border-color: var(--accent); }

/* Button */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}
.btn--primary:not(:disabled):hover { background: var(--accent-hover); }

/* Progress */
.progress-card { padding: 22px 0; }
.progress-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.progress-stage { font-size: 13.5px; font-weight: 500; color: var(--text); }
.progress-pct { font-size: 12.5px; color: var(--accent); font-weight: 500; font-variant-numeric: tabular-nums; }
.progress-bar { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0%;
  transition: width 0.3s ease;
}

/* Results */
.results-card { padding: 24px; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); padding: 0; }
.tab {
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 13.5px;
  color: var(--text-3);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  position: relative;
  transition: color 0.12s;
}
.tab:hover { color: var(--text-2); }
.tab.tab--active { color: var(--text); }
.tab.tab--active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 999px;
}

.download-bar { display: flex; gap: 8px; }
.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.dl-btn:hover { border-color: var(--accent); color: var(--accent); }

.tab-body { position: relative; }
.panel { display: none; }
.panel.panel--active { display: block; }

.transcript-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--text-2);
  margin: 0;
  max-height: 540px;
  overflow: auto;
}

/* Markdown */
.markdown { color: var(--text); line-height: 1.8; max-height: 560px; overflow: auto; }
.markdown h1, .markdown h2, .markdown h3 { line-height: 1.4; margin: 1.4em 0 0.5em; font-weight: 500; }
.markdown h1 { font-size: 1.35em; }
.markdown h2 { font-size: 1.18em; }
.markdown h3 { font-size: 1.05em; }
.markdown h1:first-child, .markdown h2:first-child { margin-top: 0; }
.markdown p { margin: 0.7em 0; }
.markdown ul, .markdown ol { padding-left: 1.4em; margin: 0.7em 0; }
.markdown li { margin: 0.3em 0; }
.markdown table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 13px; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.markdown th { background: var(--surface-2); font-weight: 500; }
.markdown code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 0.88em; font-family: "JetBrains Mono", Consolas, monospace; }
.markdown blockquote { border-left: 2px solid var(--border-strong); padding-left: 14px; color: var(--text-2); margin: 0.8em 0; }

/* Error */
.error-card {
  border-color: #f0caca;
  background: var(--error-soft);
  padding: 16px 20px;
}
.error-message { color: var(--error); font-size: 13.5px; font-weight: 500; }

/* Footer */
.footer {
  margin-top: 48px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

.hidden { display: none !important; }

@media (max-width: 600px) {
  .page { padding: 36px 16px 48px; }
  .type-cards { grid-template-columns: 1fr; }
  .results-head { flex-direction: column; align-items: flex-start; }
  .header { margin-bottom: 32px; }
}
