* { box-sizing: border-box; }

:root {
  --bg: #F4F5FA;
  --card: #FFFFFF;
  --ink: #16191F;
  --ink-2: #4A5162;
  --muted: #7B8194;
  --line: #E8EAF3;
  --brand: #6B67FA;
  --brand-dark: #5652E8;
  --brand-soft: #F0EEFF;
  --ok: #1D9E75;
  --danger: #C0392B;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(22, 25, 31, .04), 0 8px 24px -16px rgba(37, 42, 66, .28);
}

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 245, 250, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(232, 234, 243, .9);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(145deg, #7C78FF, #5652E8);
  display: grid; place-items: center;
  box-shadow: 0 8px 18px -10px rgba(86, 82, 232, .9);
}
.logo span {
  width: 12px; height: 12px;
  border-right: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  transform: rotate(45deg) translate(-2px, -2px);
}
.brand-text h1 { font-size: 16px; font-weight: 600; letter-spacing: .2px; }
.brand-text p { font-size: 12px; color: var(--muted); margin-top: 1px; }

.status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2);
}
.status i {
  width: 7px; height: 7px; border-radius: 50%;
  background: #C9CCD8; display: block;
}
.status.ok i { background: var(--ok); box-shadow: 0 0 0 3px rgba(29, 158, 117, .12); }
.status.bad i { background: var(--danger); box-shadow: 0 0 0 3px rgba(192, 57, 43, .12); }

/* ---------- 布局 ---------- */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 32px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 22px;
  align-items: start;
}
.col-main, .col-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* ---------- 输入 ---------- */
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #FAFBFE;
  padding: 13px 14px;
  font: inherit;
  color: var(--ink);
  resize: vertical;
  min-height: 84px;
  outline: none;
  transition: border-color .15s, background .15s;
}
textarea::placeholder { color: #A6ABB9; }
textarea:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(107, 103, 250, .1); }

.input-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.hint { font-size: 12px; color: var(--muted); }
.hint.invalid { color: var(--danger); }
.hint.valid { color: var(--ok); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  transition: transform .12s, background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px -12px rgba(86, 82, 232, .9); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.primary:disabled { background: #C9C7E8; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: #F3F4FA; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: #EDEFF8; }
.btn.block { width: 100%; }
.link-btn {
  background: none; border: none; padding: 0;
  color: var(--brand-dark); font-size: 12px; font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- 结果 ---------- */
.result-card { display: flex; flex-direction: column; gap: 18px; }
.media-head { display: flex; gap: 12px; align-items: flex-start; }
.platform-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 12px; font-weight: 600; flex: none; margin-top: 2px;
}
.platform-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.media-head-main { min-width: 0; }
.media-head h2 { font-size: 17px; font-weight: 600; line-height: 1.5; word-break: break-word; }
.media-meta { margin-top: 6px; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; }
.media-meta span:not(:last-child)::after { content: "·"; margin-left: 8px; color: #C6C9D4; }

.preview { border-radius: 12px; overflow: hidden; background: #F7F8FC; }
.preview video { display: block; width: 100%; max-height: 460px; background: #0F1116; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery-item { position: relative; border-radius: 10px; overflow: hidden; background: #F1F2F8; aspect-ratio: 3 / 4; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item label { position: absolute; inset: 0; cursor: pointer; }
.gallery-item input { position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; accent-color: var(--brand); }
.gallery-item.selected { outline: 2px solid var(--brand); outline-offset: -2px; }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.control-label { font-size: 12.5px; color: var(--muted); margin-right: 2px; }
select {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font: inherit; font-size: 13px;
  background: #FAFBFE; color: var(--ink); outline: none; min-width: 168px;
}
select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(107, 103, 250, .1); }

.progress { display: flex; flex-direction: column; gap: 7px; }
.progress-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.progress-head #progressPct { color: var(--brand-dark); font-weight: 600; }
.bar { height: 6px; border-radius: 999px; background: #EEF0F8; overflow: hidden; }
.bar > div { height: 100%; width: 0; border-radius: 999px; background: var(--brand); transition: width .3s ease; }
.progress.compact { margin-top: 14px; }

.caption { border-top: 1px solid var(--line); padding-top: 16px; }
.caption-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.caption-text { margin-top: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.caption-text.collapsed { max-height: 5.4em; overflow: hidden; }
.expand-btn { margin-top: 8px; }

/* ---------- 空状态 ---------- */
.empty-state { padding: 52px 24px 40px; text-align: center; color: var(--muted); }
.empty-art { position: relative; width: 84px; height: 84px; margin: 0 auto 18px; }
.empty-frame {
  position: absolute; inset: 0 0 14px 0;
  border: 2px dashed #D8DBEA; border-radius: 16px;
}
.empty-arrow {
  position: absolute; left: 50%; bottom: 0; width: 14px; height: 14px;
  border-right: 2px solid #C9CCDC; border-bottom: 2px solid #C9CCDC;
  transform: translateX(-50%) rotate(45deg);
}
.empty-state h2 { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.empty-state p { margin-top: 8px; font-size: 13px; max-width: 460px; margin-left: auto; margin-right: auto; }
.platform-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.platform-grid span {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2);
}
.platform-grid i {
  width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  background: var(--c); color: #fff; font-style: normal; font-size: 11px; font-weight: 600;
}

/* ---------- 侧栏工具 ---------- */
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title h3 { font-size: 14px; font-weight: 600; }
.tag { font-size: 11px; color: var(--brand-dark); background: var(--brand-soft); padding: 3px 9px; border-radius: 999px; }
.card-desc { margin-top: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }

.mode-switch { display: flex; gap: 4px; margin-top: 14px; padding: 4px; background: #F3F4FA; border-radius: 10px; }
.mode-btn {
  flex: 1; border: none; background: transparent; padding: 7px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s;
}
.mode-btn.active { background: #fff; color: var(--brand-dark); box-shadow: 0 1px 3px rgba(22, 25, 31, .08); }

.text-input {
  width: 100%; margin-top: 14px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #FAFBFE; font: inherit; font-size: 13px; color: var(--ink); outline: none;
}
.text-input::placeholder { color: #A6ABB9; }
.text-input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(107, 103, 250, .1); }

.audio-source {
  font-size: 11.5px; color: var(--muted); line-height: 1.6;
  background: #F8F9FD; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
}

.dropzone {
  margin-top: 14px; padding: 24px 16px;
  border: 1.5px dashed #D9DCEA; border-radius: 12px;
  background: #FAFBFE; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: border-color .15s, background .15s; outline: none;
}
.dropzone:hover, .dropzone:focus, .dropzone.dragover { border-color: var(--brand); background: #F7F5FF; }
.dropzone strong { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.dropzone span { font-size: 12px; color: var(--muted); }
.dz-icon {
  width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft);
  position: relative; margin-bottom: 2px;
}
.dz-icon::before, .dz-icon::after {
  content: ""; position: absolute; left: 50%; top: 50%; background: var(--brand);
  transform: translate(-50%, -50%); border-radius: 2px;
}
.dz-icon::before { width: 12px; height: 2px; }
.dz-icon::after { width: 2px; height: 12px; }

.file-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 11px 13px; background: #F8F9FD; border: 1px solid var(--line); border-radius: 10px; }
.file-main { min-width: 0; flex: 1; }
.file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 12px; color: var(--muted); margin-top: 2px; }
.format-row { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.format-row select { min-width: 0; flex: 1; }

#extractBtn { margin-top: 16px; }
.audio-result { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.audio-name { font-size: 13px; font-weight: 600; word-break: break-all; }
.audio-meta { font-size: 12px; color: var(--muted); }
.audio-result audio { width: 100%; height: 36px; }

/* ---------- 记录 ---------- */
.history-list { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.history-item {
  display: flex; gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; text-align: left; width: 100%;
  transition: background .15s, border-color .15s;
}
.history-item:hover { background: #F8F9FD; border-color: var(--line); }
.history-badge {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand-dark);
}
.history-main { min-width: 0; flex: 1; }
.history-title { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.history-empty { margin-top: 14px; font-size: 12.5px; color: var(--muted); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: #1E222D; color: #fff; font-size: 13px;
  padding: 10px 20px; border-radius: 999px; z-index: 60;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
  animation: rise .18s ease-out;
}
.toast.error { background: #A93B31; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.hidden, [hidden] { display: none !important; }

/* ---------- 窄屏 ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 18px 16px 48px; }
  .topbar-inner { padding: 12px 16px; }
  .empty-state { padding: 36px 16px 28px; }
}
