:root {
  color-scheme: dark;
  --bg: #070912;
  --bg-soft: #0d1120;
  --card: rgba(18, 22, 40, 0.82);
  --card-border: rgba(126, 140, 220, 0.18);
  --text: #e8ecff;
  --muted: #98a2c8;
  --accent: #8b7dff;
  --accent-2: #39d0ff;
  --ok: #3ddc97;
  --warn: #ffbe4d;
  --err: #ff6b81;
  --radius: 16px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 48px;
  overflow-x: hidden;
}

.glow {
  position: fixed;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}
.glow-a { background: #5b4bff; top: -280px; left: -160px; }
.glow-b { background: #0f8fb8; top: 120px; right: -260px; opacity: 0.22; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  background: rgba(7, 9, 18, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}

.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-mark { width: 38px; height: 38px; display: block; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: 0.3px; }
.brand-text small { color: var(--muted); font-size: 11.5px; }

.pill-nav { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border); }
.pill-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  transition: all 0.18s ease;
}
.pill-nav a:hover, .pill-nav a.active { color: #fff; background: rgba(139, 125, 255, 0.18); }

.token-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--muted);
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.token-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 10px currentColor; }
.token-badge.custom .dot { background: var(--ok); }

main {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero { padding: 46px 0 26px; max-width: 860px; }
.hero h1 {
  font-size: clamp(26px, 3.6vw, 40px);
  margin: 0 0 12px;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, #ffffff 10%, #b9b2ff 55%, #6fe1ff 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); margin: 0 0 18px; font-size: 15px; }
.hero code { background: rgba(139, 125, 255, 0.14); padding: 2px 7px; border-radius: 6px; font-size: 13px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-chips span {
  font-size: 12.5px; color: #cfd6ff;
  padding: 6px 13px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(139, 125, 255, 0.16), rgba(57, 208, 255, 0.12));
  border: 1px solid rgba(139, 125, 255, 0.28);
}

.grid { display: grid; gap: 22px; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); align-items: start; }
.docs-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 22px; }
#settings { margin-top: 22px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}
.card h2 { font-size: 17px; margin: 0 0 12px; }
.card h3 { font-size: 14px; margin: 0; }
.card h3.sub { margin-top: 18px; font-size: 13.5px; color: #cfd6ff; }
.muted { color: var(--muted); font-size: 13.5px; }
.card p.muted code, .card table code { background: rgba(139, 125, 255, 0.13); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 5px; border-radius: 12px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--card-border); margin-bottom: 20px; }
.tab {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.tab:hover { color: #fff; }
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(139, 125, 255, 0.9), rgba(57, 160, 255, 0.75));
  box-shadow: 0 8px 22px rgba(90, 92, 255, 0.35);
}

.block { margin-bottom: 20px; }
.block-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.block-head h3 { margin-right: auto; }
.block-tools { display: flex; gap: 8px; }

input[type="text"], input[type="url"], input[type="password"], input[type="search"], textarea {
  width: 100%;
  background: rgba(9, 12, 24, 0.85);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
input:focus, textarea:focus { border-color: rgba(139, 125, 255, 0.75); box-shadow: 0 0 0 3px rgba(139, 125, 255, 0.14); }
textarea { resize: vertical; line-height: 1.7; }
.block-tools input[type="search"] { width: 160px; }

button { font-family: inherit; cursor: pointer; }
button.primary {
  border: 0;
  border-radius: 11px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 22px;
  background: linear-gradient(135deg, #7c6bff, #2bb8ff);
  box-shadow: 0 12px 28px rgba(84, 92, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
button.primary:hover { transform: translateY(-1px); }
button.primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
button.ghost, a.ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: #cfd6ff;
  border-radius: 9px;
  font-size: 12.5px;
  padding: 7px 13px;
  text-decoration: none;
  display: inline-block;
  transition: all 0.16s ease;
}
button.ghost:hover, a.ghost:hover { background: rgba(139, 125, 255, 0.18); color: #fff; }

.picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  max-height: 268px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(7, 10, 20, 0.5);
}
.picker-empty { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; padding: 18px; text-align: center; }
.avatar-card {
  border: 1px solid var(--card-border);
  border-radius: 11px;
  background: linear-gradient(160deg, rgba(139, 125, 255, 0.13), rgba(57, 208, 255, 0.06));
  padding: 12px 10px;
  text-align: left;
  color: var(--text);
  transition: all 0.16s ease;
}
.avatar-card:hover { border-color: rgba(139, 125, 255, 0.6); transform: translateY(-2px); }
.avatar-card.selected { border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(57, 208, 255, 0.28); }
.avatar-card .ava {
  width: 100%; height: 46px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  margin-bottom: 8px;
}
.avatar-card b { display: block; font-size: 12px; font-weight: 500; line-height: 1.35; word-break: break-all; }
.avatar-card small { color: var(--muted); font-size: 10.5px; word-break: break-all; }

.voice-list { max-height: 250px; overflow-y: auto; border: 1px solid var(--card-border); border-radius: 12px; background: rgba(7, 10, 20, 0.5); }
.voice-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: transparent; border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  color: var(--text); font-size: 12.8px; padding: 10px 12px;
  transition: background 0.14s ease;
}
.voice-item:last-child { border-bottom: 0; }
.voice-item:hover { background: rgba(139, 125, 255, 0.12); }
.voice-item.selected { background: rgba(57, 208, 255, 0.14); }
.voice-item .tag { font-size: 10px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--card-border); color: var(--muted); margin-left: auto; }
.voice-item.selected .tag { color: #9beaff; border-color: rgba(57, 208, 255, 0.45); }

.dropzone {
  display: flex; flex-direction: column; gap: 4px;
  align-items: center; justify-content: center;
  border: 1.5px dashed rgba(139, 125, 255, 0.42);
  border-radius: 12px;
  padding: 24px 16px;
  background: rgba(139, 125, 255, 0.05);
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: center;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent-2); background: rgba(57, 208, 255, 0.08); }
.dropzone-title { font-size: 13.5px; color: #fff; }
.dropzone-sub { font-size: 11.5px; color: var(--muted); }

.preview-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.preview-row img { width: 74px; height: 74px; object-fit: cover; border-radius: 10px; border: 1px solid var(--card-border); }
.preview-row div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.preview-row strong { font-size: 12.5px; word-break: break-all; }
.file-badge {
  width: 74px; height: 74px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; letter-spacing: 0.6px; color: #cfe9ff;
  background: linear-gradient(140deg, rgba(57, 208, 255, 0.22), rgba(139, 125, 255, 0.22));
  border: 1px solid var(--card-border);
}

.alt { margin-top: 12px; }
.alt summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.alt input { margin-top: 8px; }

.field { display: block; margin-top: 14px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }

.row-between { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.hint.warn { color: var(--warn); }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.actions .primary { flex: 1 1 auto; }

.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.result-head h2 { margin: 0; }
.status-pill {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--card-border); color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}
.status-pill[data-state="running"] { color: #9beaff; border-color: rgba(57, 208, 255, 0.5); background: rgba(57, 208, 255, 0.12); }
.status-pill[data-state="done"] { color: #a6ffd6; border-color: rgba(61, 220, 151, 0.5); background: rgba(61, 220, 151, 0.12); }
.status-pill[data-state="error"] { color: #ffb3c0; border-color: rgba(255, 107, 129, 0.5); background: rgba(255, 107, 129, 0.12); }

.pipeline { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; }
.pipeline li {
  flex: 1;
  font-size: 11.5px; color: var(--muted);
  display: flex; flex-direction: column; gap: 6px;
}
.pipeline li span { height: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.09); transition: background 0.3s ease; }
.pipeline li.active { color: #fff; }
.pipeline li.active span { background: linear-gradient(90deg, #7c6bff, #2bb8ff); box-shadow: 0 0 12px rgba(80, 160, 255, 0.5); }
.pipeline li.done span { background: rgba(61, 220, 151, 0.75); }
.pipeline li.done { color: #a6ffd6; }

.stage {
  border: 1px solid var(--card-border);
  border-radius: 13px;
  background: radial-gradient(circle at 30% 10%, rgba(139, 125, 255, 0.14), rgba(7, 10, 20, 0.6) 60%);
  min-height: 232px;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.stage-empty { text-align: center; color: var(--muted); font-size: 13px; max-width: 320px; }
#player { width: 100%; border-radius: 11px; background: #000; max-height: 420px; }
.spinner-ring {
  width: 46px; height: 46px; margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid rgba(139, 125, 255, 0.2);
  border-top-color: var(--accent-2);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-meta {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  margin-top: 14px; padding: 12px 14px;
  border: 1px solid var(--card-border); border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}
.result-meta > div { display: flex; align-items: baseline; gap: 8px; }
.result-meta .k { font-size: 11.5px; color: var(--muted); }
.result-meta .v { font-size: 12.8px; }
.result-meta .meta-actions { margin-left: auto; gap: 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.log {
  margin-top: 14px;
  max-height: 132px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--muted);
  border-left: 2px solid rgba(139, 125, 255, 0.35);
  padding-left: 12px;
}
.log div { padding: 2px 0; }
.log div.err { color: var(--err); }
.log div.ok { color: var(--ok); }

.history { margin-top: 20px; border-top: 1px solid var(--card-border); padding-top: 14px; }
.history ul { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 8px; }
.history li.hist-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--card-border); border-radius: 10px;
  padding: 8px 12px; font-size: 12.3px;
  background: rgba(255, 255, 255, 0.025);
}
.history li.hist-item .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history li.hist-item .time { color: var(--muted); font-size: 11px; }

.map { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 12.6px; }
.map th, .map td { text-align: left; padding: 9px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: top; }
.map th { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.steps, .faq { margin: 0; padding-left: 20px; font-size: 13px; color: #d7dcff; }
.steps li, .faq li { margin-bottom: 8px; }
.meta-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.meta-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.meta-list span { color: var(--muted); font-size: 12.5px; }

footer {
  max-width: 1240px; margin: 40px auto 0; padding: 20px 24px 0;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--card-border);
  position: relative; z-index: 1;
}

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: rgba(20, 24, 44, 0.96);
  border: 1px solid rgba(139, 125, 255, 0.45);
  color: #fff; font-size: 13px;
  padding: 11px 20px; border-radius: 11px;
  opacity: 0; pointer-events: none;
  transition: all 0.24s ease;
  z-index: 50;
  max-width: 82vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 107, 129, 0.6); }

.hidden { display: none !important; }

@media (max-width: 1000px) {
  .grid, .docs-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .pill-nav { order: 3; width: 100%; justify-content: space-between; }
  .pill-nav a { flex: 1; text-align: center; }
  main { padding: 0 16px; }
  .hero { padding-top: 30px; }
}
