/* Atmos Labs — Studio 深色界面。
 * 方向：近黑底 + 柔和光晕、玻璃质感面板、细描边、蓝紫渐变单一强调色、等宽数字。
 * 只用系统字体（站点开启了 COEP require-corp，外链字体会被拦）。 */

:root {
  color-scheme: dark;

  --bg: #07080c;
  --bg-raise: #0c0e14;
  --surface: rgb(255 255 255 / 3.2%);
  --surface-2: rgb(255 255 255 / 5.5%);
  --surface-3: rgb(255 255 255 / 8%);
  --border: rgb(255 255 255 / 7.5%);
  --border-strong: rgb(255 255 255 / 13%);

  --text: #eef1f7;
  --text-2: #a7afc0;
  --text-3: #6c7488;

  --accent: #7d93ff;
  --accent-2: #a77bff;
  --accent-3: #ff7ac6;
  --accent-soft: rgb(125 147 255 / 14%);
  --grad: linear-gradient(120deg, #6d8bff 0%, #a77bff 55%, #ff7ac6 100%);
  --grad-soft: linear-gradient(120deg, rgb(109 139 255 / 18%), rgb(167 123 255 / 18%));

  --ok: #3ddc97;
  --ok-soft: rgb(61 220 151 / 12%);
  --warn: #ffb547;
  --warn-soft: rgb(255 181 71 / 12%);
  --danger: #ff6b7a;
  --danger-soft: rgb(255 107 122 / 12%);

  --radius-xl: 24px;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 9px;

  --shadow: 0 1px 0 rgb(255 255 255 / 4%) inset, 0 24px 60px -24px rgb(0 0 0 / 70%);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --font: "Inter", "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Code", "Consolas", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgb(125 147 255 / 35%);
}

/* ---------------------------------------------------------------- 背景 */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
}

.glow-a {
  top: -220px;
  left: -160px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgb(93 120 255 / 55%), transparent 65%);
  animation: drift 26s ease-in-out infinite alternate;
}

.glow-b {
  top: -120px;
  right: -200px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, rgb(160 110 255 / 45%), transparent 65%);
  animation: drift 32s ease-in-out infinite alternate-reverse;
}

.glow-c {
  bottom: -320px;
  left: 30%;
  width: 720px;
  height: 520px;
  background: radial-gradient(circle, rgb(255 110 190 / 16%), transparent 65%);
}

.gridlines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(255 255 255 / 2.6%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 2.6%) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}

@keyframes drift {
  to {
    transform: translate3d(60px, 40px, 0) scale(1.08);
  }
}

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px) saturate(140%);
  background: rgb(7 8 12 / 62%);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 28px;
}

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

.brand-mark {
  width: 28px;
  height: 28px;
}

.brand-name {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.brand-sub {
  padding: 2px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* 语言切换：分段按钮 */
.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.lang-btn {
  height: 24px;
  min-width: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition:
    background 160ms var(--ease),
    color 160ms var(--ease);
}

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

.lang-btn[aria-pressed="true"] {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 14px -6px rgb(150 110 255 / 80%);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot-ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgb(61 220 151 / 18%), 0 0 12px rgb(61 220 151 / 70%);
}

/* ---------------------------------------------------------------- 布局 */

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 40px;
  align-items: center;
  padding: 56px 0 44px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--grad);
}

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 4.4vw, 56px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.8px;
}

.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  max-width: 640px;
  margin: 22px 0 0;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.8;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.hero-stats li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 26px 4px 0;
  margin-right: 26px;
  border-right: 1px solid var(--border);
}

.hero-stats li:last-child {
  border-right: 0;
}

.hero-stats strong {
  font-size: 17px;
  font-weight: 650;
}

.hero-stats span {
  color: var(--text-3);
  font-size: 12.5px;
}

/* ---------------------------------------------------------------- 3D 声场 */

.stage {
  margin: 0;
  justify-self: end;
  width: min(100%, 470px);
}

.stage-frame {
  position: relative;
  aspect-ratio: 1 / 0.9;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    radial-gradient(ellipse at 50% 55%, rgb(125 110 255 / 12%), transparent 65%),
    linear-gradient(180deg, rgb(255 255 255 / 4%), rgb(255 255 255 / 1%));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.stage[data-playing="true"] .stage-frame {
  border-color: rgb(167 123 255 / 30%);
  box-shadow: var(--shadow), 0 0 60px -20px rgb(167 123 255 / 55%);
}

#stage-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  outline: none;
}

#stage-canvas.dragging {
  cursor: grabbing;
}

#stage-canvas:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
  border-radius: inherit;
}

.stage-views,
.stage-zoom {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgb(7 8 12 / 55%);
  backdrop-filter: blur(10px);
}

.view-btn,
.zoom-btn {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition:
    background 160ms var(--ease),
    color 160ms var(--ease);
}

.view-btn:hover,
.zoom-btn:hover {
  color: var(--text);
}

.stage-zoom {
  left: auto;
  right: 12px;
}

.zoom-btn {
  width: 28px;
  padding: 0;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
}

.zoom-btn:hover {
  background: var(--surface-3);
}

.view-btn.is-active {
  background: var(--surface-3);
  color: var(--text);
}

.stage-hint {
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.6px;
  pointer-events: none;
}

.stage-caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 14px;
  padding: 0 4px;
}

.stage-kicker {
  overflow: hidden;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stage[data-playing="true"] .stage-kicker {
  color: var(--accent-3);
}

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

/* ---------------------------------------------------------------- 卡片 */

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgb(255 255 255 / 4.2%), rgb(255 255 255 / 1.8%));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.card h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.card-sub {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------------------------------------------------------------- 设置 */

.settings {
  position: sticky;
  top: 80px;
  padding: 22px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 12%) transparent;
}

.card-head {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.group {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.step {
  display: inline-grid;
  place-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--grad-soft);
  color: #c7d0ff;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field label {
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
}

select,
input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 3.5%);
  color: var(--text);
  font: 500 14px/1 var(--font);
  font-variant-numeric: tabular-nums;
  outline: none;
  transition:
    border-color 160ms var(--ease),
    background 160ms var(--ease),
    box-shadow 160ms var(--ease);
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a7afc0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 16px;
  cursor: pointer;
}

select option {
  background: #12151e;
  color: var(--text);
}

select:hover:not(:disabled),
input:hover:not(:disabled) {
  border-color: rgb(255 255 255 / 22%);
  background-color: rgb(255 255 255 / 5.5%);
}

select:focus-visible,
input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(125 147 255 / 18%);
}

select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input::placeholder {
  color: var(--text-3);
}

.field-hint {
  margin: 10px 0 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
}

.field-hint.warn {
  color: var(--warn);
}

.kv {
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11px;
}

#bitrate-hint {
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: pre-wrap;
}

/* ---------------------------------------------------------------- 自绘下拉框（lib/select.js） */

.sel {
  position: relative;
  width: 100%;
  min-width: 0;
}

/* 原生 select 留着当数据源（脚本和验收都靠它），叠在按钮下面、不可见、不接鼠标。 */
.sel > select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.sel-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 3.5%);
  color: var(--text);
  font: 500 14px/1 var(--font);
  font-variant-numeric: tabular-nums;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms var(--ease),
    background 160ms var(--ease),
    box-shadow 160ms var(--ease);
}

.sel-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sel-chevron {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-2);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 220ms var(--ease);
}

.sel-trigger:hover:not(:disabled) {
  border-color: rgb(255 255 255 / 22%);
  background: rgb(255 255 255 / 5.5%);
}

.sel-trigger:focus-visible,
.sel-trigger[aria-expanded="true"] {
  outline: none;
  border-color: var(--accent);
  background: rgb(255 255 255 / 5.5%);
  box-shadow: 0 0 0 4px rgb(125 147 255 / 18%);
}

.sel-trigger[aria-expanded="true"] .sel-chevron {
  transform: rotate(180deg);
  stroke: var(--text);
}

.sel-trigger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.panel-grid .sel-trigger {
  height: 36px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.sel-menu {
  position: fixed;
  z-index: 80;
  max-width: min(340px, calc(100vw - 16px));
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: rgb(16 18 26 / 96%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 24px 60px -16px rgb(0 0 0 / 80%),
    0 1px 0 rgb(255 255 255 / 5%) inset;
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top center;
  transition:
    opacity 140ms var(--ease),
    transform 180ms var(--ease);
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 14%) transparent;
}

.sel-menu[data-placement="top"] {
  transform: translateY(4px) scale(0.98);
  transform-origin: bottom center;
}

.sel-menu.in {
  opacity: 1;
  transform: none;
}

.sel-option {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
  padding: 8px 12px 8px 8px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.sel-option + .sel-option {
  margin-top: 1px;
}

.sel-option.is-active {
  background: rgb(255 255 255 / 7%);
  color: var(--text);
}

.sel-option[aria-selected="true"] {
  background: linear-gradient(90deg, rgb(109 139 255 / 16%), rgb(167 123 255 / 10%));
  color: var(--text);
  font-weight: 600;
}

.sel-option[aria-selected="true"].is-active {
  background: linear-gradient(90deg, rgb(109 139 255 / 24%), rgb(167 123 255 / 16%));
}

.sel-check {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: #b9c6ff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.sel-option[aria-selected="true"] .sel-check {
  opacity: 1;
}

.sel-desc {
  grid-column: 2;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 400;
  white-space: normal;
}

.sel-option[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 折叠面板 */
.fold {
  border-bottom: 1px solid var(--border);
}

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

.fold summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 0;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  user-select: none;
  transition: color 160ms var(--ease);
}

.fold summary::-webkit-details-marker {
  display: none;
}

.fold summary::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 220ms var(--ease);
}

.fold[open] summary::after {
  transform: rotate(225deg) translateY(-2px);
}

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

.fold[open] {
  padding-bottom: 16px;
}

.badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--grad-soft);
  color: #cdb8ff;
  font-size: 11px;
  font-weight: 600;
}

.badge[hidden] {
  display: none;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  font-size: 12px;
}

.panel-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.panel-grid input,
.panel-grid select {
  height: 36px;
  font-size: 13px;
}

.fold-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.fold-foot .field-hint {
  margin-top: 8px;
}

/* 开关：隐藏原生 checkbox，用 track + knob 画出来。 */
.panel-grid label.switch-field {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  align-self: end;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 3.5%);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.panel-grid label.switch-field input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgb(255 255 255 / 14%);
  transition: background 0.2s var(--ease);
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 40%);
  transition: transform 0.2s var(--ease);
}

.switch-field input:checked + .switch {
  background: var(--grad);
}

.switch-field input:checked + .switch::after {
  transform: translateX(16px);
}

.switch-field input:focus-visible + .switch {
  box-shadow: 0 0 0 4px rgb(125 147 255 / 25%);
}

/* ---------------------------------------------------------------- 按钮 */

button {
  font: inherit;
}

.ico {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button.primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  min-width: 132px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--grad);
  background-size: 160% 100%;
  color: #fff;
  font-weight: 650;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 10px 30px -10px rgb(140 110 255 / 70%), 0 1px 0 rgb(255 255 255 / 25%) inset;
  transition:
    background-position 400ms var(--ease),
    transform 160ms var(--ease),
    box-shadow 200ms var(--ease),
    opacity 160ms;
}

button.primary svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  stroke: none;
}

button.primary .ico {
  fill: currentColor;
  stroke: none;
}

button.primary:hover:not(:disabled) {
  background-position: 100% 0;
  box-shadow: 0 14px 34px -10px rgb(160 110 255 / 85%), 0 1px 0 rgb(255 255 255 / 25%) inset;
}

button.primary:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

button.primary:disabled {
  background: var(--surface-3);
  color: var(--text-3);
  box-shadow: none;
  cursor: not-allowed;
}

button.primary.busy:disabled {
  color: var(--text-2);
}

button.primary.busy::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border: 2px solid rgb(255 255 255 / 25%);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

button.ghost,
a.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 160ms var(--ease),
    border-color 160ms var(--ease),
    color 160ms var(--ease);
}

button.ghost:hover:not(:disabled),
a.download:hover {
  border-color: rgb(255 255 255 / 24%);
  background: var(--surface-3);
}

button.ghost:disabled {
  color: var(--text-3);
  opacity: 0.55;
  cursor: not-allowed;
}

button.ghost.tiny {
  flex: none;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

button.primary.small,
button.ghost.small,
a.download.small {
  height: 36px;
  min-width: 0;
  padding: 0 14px;
  font-size: 13px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition:
    background 160ms,
    color 160ms,
    border-color 160ms;
}

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

button:focus-visible,
a:focus-visible,
.dropzone:focus-visible,
.wave:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- 拖放区 */

.main-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 230px;
  padding: 32px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(ellipse at 50% 0%, rgb(125 147 255 / 10%), transparent 70%),
    var(--surface);
  text-align: center;
  cursor: pointer;
  isolation: isolate;
  transition:
    min-height 380ms var(--ease),
    padding 380ms var(--ease),
    background 200ms var(--ease),
    transform 200ms var(--ease);
}

/* 渐变虚线描边 */
.dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1.5px dashed rgb(255 255 255 / 16%);
  border-radius: inherit;
  transition: border-color 200ms var(--ease);
}

.dropzone:hover::before,
.dropzone[data-active="true"]::before {
  border-color: rgb(150 140 255 / 70%);
}

.dropzone:hover,
.dropzone[data-active="true"] {
  background:
    radial-gradient(ellipse at 50% 0%, rgb(140 120 255 / 20%), transparent 70%),
    var(--surface-2);
}

.dropzone[data-active="true"] {
  transform: scale(1.01);
}

.dz-orb {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--grad);
  box-shadow: 0 14px 40px -12px rgb(150 110 255 / 80%), 0 1px 0 rgb(255 255 255 / 30%) inset;
  transition:
    transform 300ms var(--ease),
    width 380ms var(--ease),
    height 380ms var(--ease);
}

.dz-orb svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dropzone:hover .dz-orb {
  transform: translateY(-3px);
}

.dz-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dz-text strong {
  font-size: 18px;
  font-weight: 650;
}

.dz-sub {
  color: var(--text-3);
  font-size: 13px;
}

.dz-cta {
  display: none;
  flex: none;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
}

/* 队列里已经有任务：拖放区收成一条，把空间让给队列。 */
.dropzone[data-compact="true"] {
  flex-direction: row;
  justify-content: flex-start;
  min-height: 84px;
  padding: 16px 20px;
  text-align: left;
}

.dropzone[data-compact="true"] .dz-orb {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.dropzone[data-compact="true"] .dz-orb svg {
  width: 20px;
  height: 20px;
}

.dropzone[data-compact="true"] .dz-text {
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.dropzone[data-compact="true"] .dz-text strong {
  font-size: 15px;
}

.dropzone[data-compact="true"] .dz-sub {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone[data-compact="true"] .dz-cta {
  display: inline-flex;
}

/* 整页拖放遮罩 */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgb(7 8 12 / 72%);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease);
}

.drop-overlay[data-active="true"] {
  opacity: 1;
}

.drop-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 56px 72px;
  border: 1.5px dashed rgb(160 140 255 / 60%);
  border-radius: 32px;
  background: rgb(255 255 255 / 3%);
  transform: scale(0.96);
  transition: transform 260ms var(--ease);
}

.drop-overlay[data-active="true"] .drop-overlay-inner {
  transform: scale(1);
}

.drop-overlay strong {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 650;
}

.drop-overlay span:not(.dz-orb) {
  color: var(--text-2);
  font-size: 14px;
}

.dz-orb.big {
  width: 76px;
  height: 76px;
  border-radius: 24px;
}

.dz-orb.big svg {
  width: 34px;
  height: 34px;
}

/* ---------------------------------------------------------------- 队列 */

.queue-card {
  padding: 20px;
}

.queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 2px 18px;
  border-bottom: 1px solid var(--border);
}

.queue-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.queue-summary {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
}

.queue-actions {
  display: flex;
  gap: 10px;
}

.queue {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue:not(:empty) {
  padding-top: 18px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 52px 20px 40px;
  text-align: center;
}

.empty[hidden] {
  display: none;
}

.empty-art {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 44px;
  margin-bottom: 18px;
}

.empty-art span {
  width: 5px;
  border-radius: 3px;
  background: var(--grad);
  opacity: 0.55;
  animation: eq 1.6s ease-in-out infinite;
}

.empty-art span:nth-child(1) { height: 30%; animation-delay: -0.2s; }
.empty-art span:nth-child(2) { height: 60%; animation-delay: -0.5s; }
.empty-art span:nth-child(3) { height: 90%; animation-delay: -0.1s; }
.empty-art span:nth-child(4) { height: 50%; animation-delay: -0.8s; }
.empty-art span:nth-child(5) { height: 75%; animation-delay: -0.3s; }
.empty-art span:nth-child(6) { height: 40%; animation-delay: -0.6s; }
.empty-art span:nth-child(7) { height: 25%; animation-delay: -0.9s; }

@keyframes eq {
  0%,
  100% {
    transform: scaleY(0.6);
  }
  50% {
    transform: scaleY(1.1);
  }
}

.empty-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.empty-sub {
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 13px;
}

/* 行 */
.row {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 16px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 2.4%);
  transition:
    border-color 200ms var(--ease),
    background 200ms var(--ease);
}

.row:hover {
  border-color: var(--border-strong);
  background: rgb(255 255 255 / 3.6%);
}

.row.is-new {
  animation: row-in 420ms var(--ease) both;
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* 进行中：渐变描边慢慢流动 */
.row[data-status="copying"],
.row[data-status="encoding"],
.row[data-status="decoding"] {
  border-color: transparent;
  background:
    linear-gradient(#0d0f16, #0d0f16) padding-box,
    linear-gradient(120deg, rgb(109 139 255 / 70%), rgb(167 123 255 / 70%), rgb(255 122 198 / 50%), rgb(109 139 255 / 70%)) border-box;
  background-size: 100% 100%, 300% 100%;
  animation: border-flow 4s linear infinite;
}

@keyframes border-flow {
  to {
    background-position: 0 0, 300% 0;
  }
}

.row[data-status="done"] {
  background: linear-gradient(180deg, rgb(61 220 151 / 3%), rgb(255 255 255 / 2%));
}

.row[data-status="failed"] {
  border-color: rgb(255 107 122 / 28%);
  background: linear-gradient(180deg, rgb(255 107 122 / 5%), rgb(255 255 255 / 1.5%));
}

.row-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text-2);
}

.row-icon .ico {
  width: 20px;
  height: 20px;
}

.row[data-status="copying"] .row-icon,
.row[data-status="encoding"] .row-icon,
.row[data-status="decoding"] .row-icon {
  border-color: transparent;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 24px -8px rgb(150 110 255 / 80%);
}

.row[data-status="copying"] .row-icon .ico,
.row[data-status="encoding"] .row-icon .ico,
.row[data-status="decoding"] .row-icon .ico {
  animation: eq 1s ease-in-out infinite;
}

.row[data-status="done"] .row-icon {
  border-color: rgb(61 220 151 / 25%);
  background: var(--ok-soft);
  color: var(--ok);
}

.row[data-status="failed"] .row-icon {
  border-color: rgb(255 107 122 / 25%);
  background: var(--danger-soft);
  color: var(--danger);
}

.row-body {
  min-width: 0;
}

.row-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.row-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill.copying,
.pill.encoding,
.pill.decoding {
  background: var(--accent-soft);
  color: #b9c6ff;
}

.pill.copying::before,
.pill.encoding::before,
.pill.decoding::before {
  animation: blink 1s ease-in-out infinite;
}

.pill.done {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill.failed {
  background: var(--danger-soft);
  color: var(--danger);
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

.row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-2);
  font-size: 11.5px;
  white-space: nowrap;
}

.tag-accent {
  border-color: rgb(167 123 255 / 30%);
  color: #cdb8ff;
}

.tag-exp {
  border-color: rgb(255 181 71 / 30%);
  color: var(--warn);
}

.tag-quiet {
  color: var(--text-3);
}

/* 进度 */
.row-progress {
  margin-top: 14px;
}

.steps {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.steps li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 12px;
}

.steps li + li::before {
  content: "";
  width: 18px;
  height: 1px;
  margin-right: 2px;
  background: var(--border-strong);
}

.steps li.done {
  color: var(--text-2);
}

.steps li.active {
  color: var(--text);
  font-weight: 600;
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.track {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgb(255 255 255 / 7%);
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--grad);
  box-shadow: 0 0 14px rgb(150 120 255 / 70%);
  transition: width 220ms var(--ease);
}

/* finish() 期间没有真实百分比，用流动光带表达“在工作” */
.fill.indeterminate {
  width: 38%;
  animation: sweep 1.3s var(--ease) infinite;
}

@keyframes sweep {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(280%);
  }
}

.pct {
  min-width: 48px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
}

/* 失败 */
.row-error {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgb(255 107 122 / 20%);
  border-radius: var(--radius-sm);
  background: rgb(255 107 122 / 6%);
}

.bad {
  margin: 0;
  color: var(--danger);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

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

/* 试听波形 */
.player {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgb(0 0 0 / 22%);
}

.wave {
  --p: 0;
  position: relative;
  flex: 1;
  height: 46px;
  cursor: pointer;
}

.wave canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.wave-lit {
  clip-path: inset(0 calc((1 - var(--p)) * 100%) 0 0);
}

.wave-head {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: calc(var(--p) * 100%);
  width: 2px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 12px rgb(255 255 255 / 80%);
  opacity: 0;
  transition: opacity 200ms;
}

.player.is-playing .wave-head {
  opacity: 1;
}

.wave:hover .wave-lit {
  filter: brightness(1.15);
}

.wave-time {
  flex: none;
  min-width: 92px;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 实时输出电平：竖条，0 = -60 dBFS，1 = 0 dBFS */
.meter {
  --level: 0;
  position: relative;
  flex: none;
  width: 6px;
  height: 40px;
  border-radius: 3px;
  background: rgb(255 255 255 / 8%);
  overflow: hidden;
}

.meter::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: calc(var(--level) * 100%);
  border-radius: inherit;
  background: linear-gradient(0deg, #3ddc97, #ffb547 75%, #ff6b7a);
  transition: height 60ms linear;
}

.row-warn {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgb(255 181 71 / 30%);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
}

/* 码流事实 */
.row-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1px;
  margin: 14px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--border);
  overflow: hidden;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: #0c0e14;
}

.fact.wide {
  grid-column: 1 / -1;
}

.fact dt {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.fact dd {
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
}

/* ---------------------------------------------------------------- 提示 */

.toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgb(18 21 30 / 88%);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 16px 40px -12px rgb(0 0 0 / 70%);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 260ms var(--ease),
    transform 260ms var(--ease);
}

.toast.in {
  opacity: 1;
  transform: none;
}

.toast.ok {
  border-color: rgb(61 220 151 / 30%);
}

.toast.bad {
  border-color: rgb(255 107 122 / 35%);
}

/* ---------------------------------------------------------------- 页脚 */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
}

.footer-sep {
  opacity: 0.5;
}

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

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1040px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding-top: 40px;
  }

  .stage {
    justify-self: stretch;
    width: min(100%, 560px);
  }

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

  .settings {
    position: static;
    max-height: none;
  }
}

@media (max-width: 620px) {
  .shell,
  .topbar-inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .brand-sub,
  .topbar-meta .chip {
    display: none;
  }

  .hero-stats li {
    padding-right: 16px;
    margin-right: 16px;
  }

  .fields,
  .panel-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .queue-actions {
    width: 100%;
  }

  .queue-actions button {
    flex: 1;
  }

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

  .row-icon {
    display: none;
  }

  .dropzone[data-compact="true"] .dz-cta {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* 系统关了动画时，不确定进度条会停在轨道外看不见；改成整条静态的低亮度条。 */
  .fill.indeterminate {
    width: 100%;
    opacity: 0.45;
    transform: none;
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------------------------------------------------------- 启动失败提示 */

.boot-error {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(640px, calc(100% - 32px));
  padding: 14px 18px;
  border: 1px solid rgb(255 181 71 / 40%);
  border-radius: 14px;
  background: rgb(30 22 10 / 92%);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 13px;
  transform: translateX(-50%);
  box-shadow: 0 16px 40px -12px rgb(0 0 0 / 70%);
}

.boot-error[hidden] {
  display: none;
}

.boot-error strong {
  color: var(--warn);
  font-size: 14px;
}

.boot-error code {
  padding: 0 5px;
  border-radius: 4px;
  background: rgb(255 255 255 / 8%);
  font-family: var(--mono);
  font-size: 12px;
}
