/* ============================================
   爆款视频混剪智能体
   高端工作台后台 · 质感 / 克制 / 精密
   参考：Linear · Vercel · Stripe Dashboard
   ============================================ */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  /* 石墨工作台色阶 */
  --bg-0: #09090b;
  --bg-1: #0c0c0f;
  --bg-2: #111114;
  --bg-3: #16161a;
  --bg-4: #1c1c21;
  --bg-5: #23232a;
  --bg-hover: #1a1a20;

  --border-subtle: rgba(255, 255, 255, 0.045);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(255, 255, 255, 0.22);

  /* 文字：精确灰阶，非纯白 */
  --text: #ececef;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-faint: #52525b;

  /* 强调：冷琥珀 — 克制、贵气，非营销橙 */
  --accent: #d4a574;
  --accent-bright: #e8c4a0;
  --accent-dim: rgba(212, 165, 116, 0.12);
  --accent-glow: rgba(212, 165, 116, 0.18);
  --accent-border: rgba(212, 165, 116, 0.35);

  --success: #4ade80;
  --success-dim: rgba(74, 222, 128, 0.1);
  --info: #7dd3fc;
  --info-dim: rgba(125, 211, 252, 0.1);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.1);
  --warning: #fbbf24;

  /* 结构 */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-full: 9999px;

  /* 多层阴影 = 真实厚度 */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --shadow-md:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-lg:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
  --shadow-focus: 0 0 0 2px var(--bg-0), 0 0 0 4px var(--accent-border);

  --font: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
    "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /*
   * 字号阶梯 · 规范上限（演示可读 + 产品后台）
   * 根 22–24px ≈ WCAG「大文本」边界 18pt / 24px
   * 标题 ≤ 1.5rem，避免破坏工作台信息层级
   */
  --fs-caption: 0.875rem;   /* 辅注 / 角标 */
  --fs-label: 0.9375rem;    /* 字段标签 / 分区小标题 */
  --fs-body: 1.0625rem;     /* 正文 / 列表 */
  --fs-input: 1.125rem;     /* 表单输入 · 可交互正文 */
  --fs-title: 1.375rem;     /* 模块标题 */
  --fs-display: 1.5rem;     /* 页面主标题 · 阶梯顶 */
  --fs-btn: 1.125rem;       /* 主按钮 */

  --max-w: 1120px;
  --module-gap: 24px;
  --pad: clamp(14px, 3vw, 26px);
  --header-h: 72px;

  /* 控件/角标字号（随正文约 75% 缩放） */
  --ui-xs: 10px;
  --ui-sm: 11px;
  --ui-md: 12px;
  --ui-lg: 13px;
  --icon-sm: 18px;
  --icon-md: 24px;
  --icon-lg: 36px;
}

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

html {
  /* 演示字号：约为原 22–24px 的 75%（可读且更省版面） */
  font-size: 16.5px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (min-width: 768px) {
  html {
    font-size: 17.25px;
  }
}

@media (min-width: 1200px) {
  html {
    font-size: 18px;
  }
}

body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
  font-feature-settings: "ss01", "kern";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 深空底 + 极弱顶光，避免 AI 紫/霓虹 */
  background-image:
    radial-gradient(ellipse 100% 60% at 50% -30%, rgba(212, 165, 116, 0.06), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(255, 255, 255, 0.02), transparent),
    linear-gradient(180deg, #0c0c0f 0%, var(--bg-0) 40%);
  background-attachment: fixed;
}

/* 细噪点质感层 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px;
  mix-blend-mode: overlay;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--accent-bright);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

img {
  max-width: 100%;
  display: block;
}

/* ---- layout ---- */
.app-shell {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad) 96px;
  position: relative;
  z-index: 1;
  width: 100%;
  overflow-x: clip;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0 calc(-1 * var(--pad));
  padding: 0 var(--pad);
  background: rgba(9, 9, 11, 0.78);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--header-h);
  padding: 10px 0 8px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(145deg, #2a241c 0%, #1a1714 100%);
  border: 1px solid var(--accent-border);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: var(--ui-md);
  letter-spacing: 0.04em;
  color: var(--accent-bright);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm), 0 0 20px rgba(212, 165, 116, 0.08);
  font-family: var(--font-mono);
  line-height: 1;
}

.brand-text {
  min-width: 0;
  overflow: hidden;
}

.brand-text h1 {
  font-size: clamp(1rem, 2.8vw, var(--fs-title));
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text p {
  font-size: var(--ui-sm);
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-family: var(--font-mono);
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.demo-code-control {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.demo-code-control label {
  color: var(--text-muted);
  font-size: var(--ui-sm);
  white-space: nowrap;
}

.demo-code-control input {
  width: 116px;
  min-width: 0;
  height: 36px;
  padding: 7px 9px;
  color: var(--text);
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--ui-md);
  outline: none;
}

.demo-code-control input:focus {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-focus);
}

.demo-code-control .btn-secondary {
  min-height: 36px;
  padding: 7px 10px;
  white-space: nowrap;
}

.cloud-load-status {
  padding: 0 0 8px;
  color: var(--text-muted);
  font-size: var(--ui-sm);
  line-height: 1.4;
}

.cloud-load-status:empty {
  display: none;
}

.cloud-load-status.success {
  color: #86d9aa;
}

.cloud-load-status.error {
  color: #f5a3a3;
}

@media (max-width: 720px) {
  .app-header .header-row {
    flex-wrap: wrap;
  }

  .app-header .brand {
    flex-basis: 100%;
  }

  .app-header .header-actions {
    width: 100%;
  }

  .demo-code-control {
    flex: 1 1 auto;
  }

  .demo-code-control label {
    display: none;
  }

  .demo-code-control input {
    width: auto;
    flex: 1 1 96px;
  }
}

.btn-ghost {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: var(--ui-md);
  font-weight: 500;
  letter-spacing: 0.01em;
  background: var(--bg-2);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn-ghost:hover {
  border-color: var(--border-focus);
  color: var(--text);
  background: var(--bg-4);
  box-shadow: var(--shadow-sm);
}

/* 流程步骤条 — 精密仪器感 */
.flow-progress {
  display: flex;
  gap: 4px;
  padding: 0 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.flow-progress::-webkit-scrollbar {
  display: none;
}

.flow-dot {
  flex: 1;
  min-width: 40px;
  height: 3px;
  border-radius: 2px;
  background: var(--bg-5);
  transition: background 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.flow-dot.done {
  background: rgba(212, 165, 116, 0.45);
}

.flow-dot.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.35);
}

/* ---- module cards · 工作台面板 ---- */
.module {
  position: relative;
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 2.5vw, 26px) clamp(14px, 2.2vw, 24px) clamp(18px, 2.5vw, 28px);
  margin-top: var(--module-gap);
  box-shadow: var(--shadow-md);
  scroll-margin-top: 110px;
  overflow: hidden;
  min-width: 0;
}

/* 顶缘高光 — 金属面板感 */
.module::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1) 20%,
    rgba(255, 255, 255, 0.14) 50%,
    rgba(255, 255, 255, 0.1) 80%,
    transparent
  );
  pointer-events: none;
}

.module-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  min-width: 0;
}

.module-head > div:last-child {
  min-width: 0;
  flex: 1 1 auto;
}

.module-num {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-weight: 600;
  font-size: var(--ui-lg);
  font-family: var(--font-mono);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
  letter-spacing: -0.02em;
  line-height: 1;
}

.module-title {
  font-size: clamp(1.15rem, 2.6vw, var(--fs-display));
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.3;
  color: var(--text);
}

.module-desc {
  font-size: clamp(0.9rem, 2vw, var(--fs-body));
  color: var(--text-muted);
  margin-top: 5px;
  letter-spacing: 0.005em;
  line-height: 1.45;
  word-break: break-word;
}

.module.locked {
  opacity: 0.5;
  pointer-events: none;
}

.module.active-glow {
  border-color: rgba(212, 165, 116, 0.22);
  box-shadow:
    var(--shadow-md),
    0 0 0 1px rgba(212, 165, 116, 0.06),
    0 0 40px -12px rgba(212, 165, 116, 0.12);
}

.module.active-glow .module-num {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  color: var(--accent-bright);
  box-shadow: 0 0 16px rgba(212, 165, 116, 0.12);
}

/* ---- forms ---- */
.form-grid {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.form-row.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

@media (max-width: 560px) {
  .form-row.two {
    grid-template-columns: minmax(0, 1fr);
  }
}

label.field-label {
  font-size: var(--ui-sm);
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  line-height: 1.3;
}

label.field-label .req {
  color: var(--accent);
  font-size: var(--ui-xs);
  letter-spacing: 0.04em;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-dim);
  border: 1px solid rgba(212, 165, 116, 0.2);
  white-space: nowrap;
}

label.field-label .opt {
  color: var(--text-faint);
  font-weight: 400;
  font-size: var(--ui-xs);
  letter-spacing: 0.02em;
  text-transform: none;
  font-family: var(--font);
  white-space: nowrap;
}

.field,
.select {
  width: 100%;
  max-width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: clamp(1rem, 2.2vw, var(--fs-input));
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: var(--shadow-xs), 0 1px 0 rgba(255, 255, 255, 0.02) inset;
  min-width: 0;
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2371717a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1.5 1.5L6 6l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-color: var(--bg-1);
  padding-right: 36px;
  text-overflow: ellipsis;
}

.field:hover,
.select:hover {
  border-color: var(--border-focus);
}

.field:focus,
.select:focus {
  border-color: var(--accent-border);
  background: var(--bg-2);
  box-shadow: var(--shadow-focus);
}

.field::placeholder {
  color: var(--text-faint);
}

textarea.field {
  min-height: 100px;
  resize: vertical;
  line-height: 1.55;
}

/* ---- module 2: copy direction ---- */
.copy-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 2.1fr);
  gap: 12px;
  min-height: 280px;
  align-items: stretch;
}

@media (max-width: 720px) {
  .copy-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.industry-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  padding: 6px;
  border: 1px solid var(--border);
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  min-width: 0;
}

@media (max-width: 720px) {
  .industry-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    -webkit-overflow-scrolling: touch;
  }
}

.ind-item {
  text-align: left;
  padding: 11px 12px;
  border-radius: 6px;
  font-size: clamp(0.9rem, 2vw, var(--fs-body));
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: 0.12s ease;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ind-item:hover {
  background: var(--bg-4);
  color: var(--text-secondary);
}

.ind-item.active {
  background: var(--accent-dim);
  color: var(--accent-bright);
  box-shadow: inset 0 0 0 1px rgba(212, 165, 116, 0.2);
}

.copy-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-tab {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: clamp(0.88rem, 2vw, var(--fs-body));
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-1);
  transition: 0.12s ease;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.cat-tab:hover {
  border-color: var(--border-strong);
  color: var(--text-secondary);
  background: var(--bg-4);
}

.cat-tab.active {
  background: var(--bg-5);
  border-color: var(--accent-border);
  color: var(--accent-bright);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.copy-preview-panel {
  flex: 1;
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 10px 36px;
  min-height: 240px;
  max-height: min(52vh, 440px);
  overflow-y: auto;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

@media (max-width: 640px) {
  .copy-preview-panel {
    max-height: min(42vh, 320px);
    min-height: 200px;
  }
}

.copy-more-hint {
  position: sticky;
  bottom: 0;
  margin: 8px -2px -2px;
  padding: 8px 10px;
  font-size: var(--ui-xs);
  font-family: var(--font-mono);
  color: var(--accent-bright);
  background: linear-gradient(to top, var(--bg-1) 70%, transparent);
  border-top: 1px solid var(--border-subtle);
  letter-spacing: 0.02em;
  text-align: center;
  pointer-events: none;
}

.copy-more-hint[hidden] {
  display: none !important;
}

.copy-preview-hint {
  font-size: var(--ui-sm);
  color: var(--text-faint);
  margin-bottom: 8px;
  padding: 0 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.35;
  word-break: break-word;
}

.copy-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  margin-bottom: 4px;
  transition: 0.12s ease;
  background: transparent;
  box-sizing: border-box;
}

.copy-line:hover {
  background: var(--bg-3);
  border-color: var(--border-subtle);
}

.copy-line.selected {
  background: var(--accent-dim);
  border-color: rgba(212, 165, 116, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.copy-check {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 3px;
  position: relative;
  transition: 0.12s ease;
  background: var(--bg-2);
  box-sizing: border-box;
}

.copy-line.selected .copy-check {
  background: var(--accent);
  border-color: var(--accent);
}

/* CSS 勾选，避免 ✓ 字符基线错位 */
.copy-line.selected .copy-check::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 5px;
  height: 9px;
  border: solid #1a1410;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -55%) rotate(45deg);
  box-sizing: border-box;
}

.copy-text {
  font-size: clamp(1rem, 2.2vw, var(--fs-input));
  line-height: 1.5;
  color: var(--text);
  letter-spacing: -0.01em;
  min-width: 0;
  flex: 1 1 auto;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.module-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.btn-primary {
  background: linear-gradient(180deg, #e0b892 0%, var(--accent) 100%);
  color: #1a1410;
  font-weight: 600;
  font-size: clamp(0.95rem, 2vw, var(--fs-btn));
  letter-spacing: -0.01em;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 2px 8px rgba(212, 165, 116, 0.25),
    0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s, opacity 0.12s;
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 4px 14px rgba(212, 165, 116, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.3);
  transform: translateY(-0.5px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  filter: brightness(0.98);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.3);
}

.btn-secondary {
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: clamp(0.9rem, 2vw, var(--fs-body));
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  transition: 0.12s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  border-color: var(--border-focus);
  color: var(--text);
  background: var(--bg-4);
}

.selected-count {
  font-size: var(--ui-md);
  color: var(--text-faint);
  margin-left: auto;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---- module 3: rewrite ---- */
.rewrite-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

@media (max-width: 700px) {
  .rewrite-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.rewrite-col {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 160px;
  min-width: 0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.rewrite-col-title {
  font-size: var(--ui-sm);
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
}

.rewrite-col-title .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.04);
}

.rewrite-col-title .dot.out {
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

.rewrite-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s;
}

.rewrite-card:hover {
  border-color: var(--border-strong);
}

.rewrite-card:last-child {
  margin-bottom: 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tag {
  font-size: var(--ui-xs);
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--info-dim);
  color: var(--info);
  letter-spacing: 0.03em;
  font-family: var(--font-mono);
  text-transform: uppercase;
  border: 1px solid rgba(125, 211, 252, 0.15);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag.theme {
  background: var(--accent-dim);
  color: var(--accent-bright);
  border-color: rgba(212, 165, 116, 0.2);
}

.rewrite-body {
  font-size: clamp(1rem, 2.2vw, var(--fs-input));
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.rewrite-struct {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.struct-block {
  border-left: 2px solid var(--border-strong);
  padding-left: 12px;
}

.struct-block .slabel {
  font-size: var(--ui-xs);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 3px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.struct-block .stext {
  font-size: clamp(0.92rem, 2vw, var(--fs-body));
  color: var(--text-secondary);
  line-height: 1.5;
  word-break: break-word;
}

.rewrite-empty {
  color: var(--text-faint);
  font-size: var(--fs-body);
  padding: 32px 12px;
  text-align: center;
  letter-spacing: -0.01em;
}

.rewriting-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 36px 12px;
  color: var(--accent-bright);
  font-weight: 500;
  font-size: var(--fs-body);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

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

/* ---- module 4: materials ---- */
.mat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 12px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

@media (max-width: 860px) {
  .mat-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.mat-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.sub-panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  min-width: 0;
  overflow: hidden;
}

.sub-panel h4 {
  font-size: var(--ui-sm);
  font-weight: 600;
  color: var(--text-faint);
  margin-bottom: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* 声音：横向滚动 + 试听按钮 */
.voice-row,
.voice-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.voice-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  min-width: 168px;
  max-width: 220px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  overflow: hidden;
  transition: border-color 0.12s, background 0.12s;
}

.voice-chip:hover {
  border-color: var(--border-strong);
  background: var(--bg-4);
}

.voice-chip.selected {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 1px rgba(212, 165, 116, 0.08);
}

.voice-chip.playing {
  border-color: var(--accent);
}

.voice-chip-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 10px;
  text-align: left;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
}

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

.voice-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 2px 8px rgba(0, 0, 0, 0.35);
}

.voice-avatar-text {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1;
  color: #1a1410;
  font-family: var(--font-mono);
}

.voice-chip-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-name {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.voice-desc {
  font-size: 0.68rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.voice-listen {
  flex: 0 0 auto;
  align-self: stretch;
  padding: 0 12px;
  border: none;
  border-left: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--accent-bright);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.voice-listen:hover,
.voice-chip.playing .voice-listen {
  background: var(--accent);
  color: #1a1410;
}

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

/* 兼容旧类名 */
.voice-card {
  display: none;
}

/* 字体 / 标题 · 样式缩略图（更紧凑，一排更多） */
.style-thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.font-thumb-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .font-thumb-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .title-thumb-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .font-thumb-grid,
  .title-thumb-grid,
  .style-thumb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.style-thumb {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  overflow: hidden;
  text-align: left;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  min-width: 0;
}

.style-thumb:hover {
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.style-thumb.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(212, 165, 116, 0.35), 0 4px 14px rgba(212, 165, 116, 0.12);
}

.style-thumb-canvas {
  aspect-ratio: 16 / 9;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #0a0a0c;
}

.font-thumb-grid .style-thumb-canvas {
  aspect-ratio: 5 / 3;
}

.style-thumb-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  padding: 4px 5px 5px;
  min-height: 24px;
  min-width: 0;
}

.style-thumb-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  line-height: 1.2;
}

.style-thumb.selected .style-thumb-name {
  color: var(--accent-bright);
}

.style-thumb-check,
.style-thumb-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1.2;
}

.style-thumb-check {
  color: var(--accent-bright);
  background: var(--accent-dim);
  border: 1px solid rgba(212, 165, 116, 0.25);
}

.style-thumb-badge {
  color: var(--info);
  background: var(--info-dim);
  border: 1px solid rgba(125, 211, 252, 0.2);
}

/* —— 字体缩略图 —— */
.font-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(212, 165, 116, 0.08), transparent),
    linear-gradient(165deg, #141418 0%, #0a0a0c 100%);
}

.font-thumb-main {
  font-size: clamp(0.85rem, 2.2vw, 1.05rem);
  line-height: 1.1;
  color: #f5f5f7;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 3px;
}

.font-thumb-sub {
  font-size: 9px;
  line-height: 1.2;
  color: rgba(245, 245, 247, 0.55);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 3px;
}

.font-thumb--light .font-thumb-main {
  font-weight: 400;
  color: #e8e8ec;
}

.font-thumb--serif .font-thumb-main {
  color: #f0e6d4;
}

.font-thumb--condensed .font-thumb-main {
  letter-spacing: -0.06em;
}

.font-thumb--soft .font-thumb-main {
  color: #ffe8d4;
}

.font-thumb--modern .font-thumb-main {
  text-transform: none;
}

.font-thumb--round .font-thumb-main {
  color: #ffe8c8;
}

.font-thumb--script {
  background:
    radial-gradient(ellipse 70% 50% at 50% 80%, rgba(255, 255, 255, 0.04), transparent),
    linear-gradient(165deg, #16141a 0%, #0c0a0e 100%);
}

.font-thumb--script .font-thumb-main {
  font-style: italic;
  color: #e8dcc8;
}

.font-thumb--impact .font-thumb-main {
  color: #fff;
  text-shadow: 0 2px 0 rgba(212, 165, 116, 0.5), 0 0 20px rgba(212, 165, 116, 0.25);
  transform: scaleY(1.05);
}

/* —— 标题样式缩略图（竖屏成片示意） —— */
.title-thumb {
  background: #08080a;
}

.title-thumb-frame {
  position: absolute;
  inset: 6px;
  border-radius: 4px;
  overflow: hidden;
  background:
    linear-gradient(160deg, #2a2218 0%, #12141a 45%, #0b0d12 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* 无标题 */
.tt-none {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0.55;
}

.tt-slash {
  width: 28px;
  height: 28px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  position: relative;
}

.tt-slash::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.45);
  transform: translate(-50%, -50%) rotate(-45deg);
}

.tt-hint {
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

/* 智能选择 */
.tt-auto {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background:
    radial-gradient(circle at 50% 40%, rgba(212, 165, 116, 0.18), transparent 55%),
    linear-gradient(165deg, #1a1814, #0e0e12);
}

.tt-auto-spark {
  font-size: 0.85rem;
  color: var(--accent-bright);
  animation: thumbPulse 2s ease infinite;
}

@keyframes thumbPulse {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

.tt-auto-text {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f2e6d4;
  letter-spacing: 0.08em;
}

.tt-auto-sub {
  font-size: 0.52rem;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-mono);
}

/* 居中大字 */
.tt-center {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.15), transparent 40%, rgba(0, 0, 0, 0.35)),
    linear-gradient(145deg, #3a3028, #151820);
}

.tt-center-text {
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

/* 底部条 */
.tt-bar {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tt-bar-scene {
  flex: 1;
  background:
    radial-gradient(ellipse at 60% 40%, rgba(212, 165, 116, 0.2), transparent 50%),
    linear-gradient(160deg, #2c3540, #12151c);
}

.tt-bar-strip {
  background: rgba(0, 0, 0, 0.78);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 6px;
  text-align: center;
}

.tt-bar-strip span {
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
}

/* 描边冲击 */
.tt-stroke {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: linear-gradient(160deg, #1a1020, #0c0c10 60%, #1a1410);
}

.tt-stroke span {
  font-size: 0.82rem;
  font-weight: 900;
  color: transparent;
  -webkit-text-stroke: 1.2px #fff;
  text-stroke: 1.2px #fff;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.2;
  filter: drop-shadow(0 0 6px rgba(212, 165, 116, 0.35));
}

/* 渐变高亮 */
.tt-gradient {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background:
    radial-gradient(ellipse at 50% 70%, rgba(212, 165, 116, 0.15), transparent 55%),
    linear-gradient(165deg, #12141a, #0a0a0c);
}

.tt-gradient span {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-align: center;
  line-height: 1.25;
  background: linear-gradient(105deg, #fff6e8 0%, #e8b87a 40%, #f5d4a8 70%, #fff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

/* 兼容旧 class */
.font-list,
.title-list {
  display: grid;
}

.choice-row {
  display: none;
}

/* material right */
.mat-right {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-height: 280px;
  min-width: 0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.group-switcher {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: var(--ui-md);
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-md);
  max-width: min(56%, 180px);
  transition: border-color 0.12s, background 0.12s;
  min-width: 0;
}

.group-switcher:hover {
  border-color: var(--accent-border);
  background: rgba(20, 18, 14, 0.92);
}

.group-switcher .gname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.group-switcher .ghint {
  color: var(--text-faint);
  font-weight: 500;
  font-size: var(--ui-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  line-height: 1;
}

.mat-right-title {
  font-size: var(--ui-sm);
  font-weight: 600;
  color: var(--text-faint);
  margin-bottom: 12px;
  padding-right: min(48%, 160px);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.3;
  min-width: 0;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
}

@media (max-width: 520px) {
  .material-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.mat-card {
  aspect-ratio: 9 / 16;
  min-height: 140px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: 0.15s ease, box-shadow 0.15s ease;
  background: var(--bg-3);
  box-shadow: var(--shadow-xs);
  display: block;
  width: 100%;
  padding: 0;
  color: inherit;
  text-align: left;
  font: inherit;
}

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

.mat-card .mat-thumb {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  height: 100%;
}

.mat-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.mat-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(212, 165, 116, 0.3), 0 4px 12px rgba(212, 165, 116, 0.12);
}

.mat-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.mat-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 55%);
  pointer-events: none;
}

.mat-thumb .mname,
.mat-thumb .mmeta {
  position: relative;
  z-index: 1;
}

.mat-thumb .mname {
  font-size: var(--ui-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.mat-thumb .mmeta {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  font-family: var(--font-mono);
  margin-top: 2px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.mat-check {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.55);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-sizing: border-box;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.mat-card.selected .mat-check {
  background: var(--accent);
  border-color: var(--accent);
}

.mat-card.selected .mat-check::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 4px;
  height: 8px;
  border: solid #1a1410;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -55%) rotate(45deg);
  box-sizing: border-box;
}

/* 上传按钮 · 固定横向条，避免大字号长文案撑破布局 */
.upload-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 12px;
  padding: 10px 12px;
  min-height: 48px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  overflow: hidden;
}

.upload-btn:hover {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  color: var(--text);
}

.upload-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-btn-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  color: var(--accent-bright);
  background: var(--accent-dim);
  border: 1px solid rgba(212, 165, 116, 0.25);
  font-family: var(--font-mono);
}

.upload-btn-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.upload-btn-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-btn-sub {
  font-size: 10px;
  line-height: 1.3;
  color: var(--text-faint);
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 兼容旧 class */
.upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 12px;
  padding: 10px 12px;
  min-height: 48px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-mono);
  overflow: hidden;
}

.upload-zone:hover {
  border-color: var(--accent-border);
  color: var(--text-secondary);
  background: var(--accent-dim);
}

.upload-zone input {
  display: none;
}

.upload-zone-sm,
.upload-zone-inline {
  margin-top: 12px;
}

.upload-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  line-height: 1.4;
  word-break: break-word;
}

.mat-play {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(236, 236, 239, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s, background 0.12s;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
}

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

.mat-play::after {
  content: "";
  position: absolute;
  left: 55%;
  top: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #09090b;
  transform: translate(-40%, -50%);
}

.mat-play:hover {
  transform: scale(1.08);
  background: #fff;
}

.mat-audio-icon {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  opacity: 0.55;
  z-index: 1;
  color: var(--accent-bright);
  pointer-events: none;
}

/* modal real media */
.modal-media .modal-video {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-el {
  display: none;
  width: 100%;
  height: 100%;
  max-height: 52vh;
  object-fit: contain;
  background: #000;
}

.media-el.active {
  display: block;
}

.media-audio.active {
  width: calc(100% - 32px);
  height: auto;
  margin: 48px 16px;
  max-height: none;
}

.media-image.active {
  object-fit: contain;
}

.fake-player {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 200px;
}

.fake-player.active {
  display: flex;
}

.fake-player .ph-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.fake-player .ph-text {
  font-size: var(--fs-label);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  font-family: var(--font-mono);
}

.fake-player .ph-text span {
  font-size: var(--fs-caption);
  color: var(--text-faint);
}

.media-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.media-upload-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.media-status {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex: 1 1 100%;
  line-height: 1.4;
}

@media (min-width: 700px) {
  .media-status {
    flex: 1 1 auto;
  }
}

/* generate bar */
.gen-bar {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(212, 165, 116, 0.06) 0%, rgba(212, 165, 116, 0.02) 100%);
  border: 1px solid rgba(212, 165, 116, 0.18);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.counter {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  padding: 2px;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.counter-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  transition: 0.12s;
  font-family: var(--font-mono);
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
}

.counter-btn:hover {
  background: var(--bg-4);
  color: var(--accent-bright);
}

.counter-val {
  min-width: 32px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.counter-label {
  font-size: var(--ui-sm);
  font-weight: 500;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.gen-bar .btn-primary {
  margin-left: auto;
  min-width: 120px;
}

@media (max-width: 560px) {
  .gen-bar .btn-primary {
    width: 100%;
    margin-left: 0;
  }
}

/* ---- module 5: results ---- */
.task-progress {
  margin-bottom: 18px;
  display: none;
  padding: 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.task-progress.show {
  display: block;
}

.progress-track {
  height: 4px;
  background: var(--bg-5);
  border-radius: 2px;
  overflow: hidden;
  border: none;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-bright) 70%, var(--success) 100%);
  border-radius: 2px;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(212, 165, 116, 0.4);
}

.progress-label {
  margin-top: 10px;
  font-size: var(--ui-sm);
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  min-width: 0;
}

.progress-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: 12px;
  min-width: 0;
}

.result-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: 0.2s ease;
  animation: fadeUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow: var(--shadow-xs);
  min-width: 0;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.result-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.result-cover {
  aspect-ratio: 9/16;
  max-height: 230px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  background-size: cover;
  background-position: center;
}

.result-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 50%);
}

.result-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(236, 236, 239, 0.95);
  z-index: 2;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s, background 0.15s;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0;
  box-sizing: border-box;
}

.result-play::after {
  content: "";
  position: absolute;
  left: 54%;
  top: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #09090b;
  transform: translate(-40%, -50%);
}

.result-card:hover .result-play {
  transform: translate(-50%, -50%) scale(1.06);
  background: #fff;
}

.result-duration {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 2;
  font-size: 11px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  padding: 3px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  border: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0.02em;
}

.result-body {
  padding: 10px;
  min-width: 0;
}

.result-title {
  font-size: clamp(0.92rem, 2vw, 1.05rem);
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 8px;
  letter-spacing: -0.015em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.result-meta span {
  background: var(--bg-3);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.result-actions button,
.result-actions .btn-upload-slot {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  padding: 8px 2px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: 0.12s;
  letter-spacing: 0.01em;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  white-space: nowrap;
}

.result-actions button:hover,
.result-actions .btn-upload-slot:hover {
  border-color: var(--accent-border);
  color: var(--accent-bright);
  background: var(--accent-dim);
}

.result-actions .btn-upload-slot input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.results-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-faint);
  font-size: var(--fs-body);
  letter-spacing: -0.01em;
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-4);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-strong);
  z-index: 200;
  opacity: 0;
  transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
  letter-spacing: -0.01em;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- admin · 分组配置工作台 ---- */
html.admin-page {
  font-size: 16px !important;
  --fs-caption: 0.8125rem;
  --fs-label: 0.875rem;
  --fs-body: 1rem;
  --fs-input: 1rem;
  --fs-title: 1.0625rem;
  --fs-display: 1.375rem;
  --fs-btn: 0.9375rem;
  --pad: 18px;
  --module-gap: 16px;
  --header-h: 56px;
  --radius: 8px;
  --radius-sm: 6px;
}

@media (min-width: 768px) {
  html.admin-page {
    font-size: 16px !important;
  }
}

@media (min-width: 1200px) {
  html.admin-page {
    font-size: 16px !important;
  }
}

body.is-admin {
  line-height: 1.5;
}

.admin-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 18px 64px;
  position: relative;
  z-index: 1;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.admin-header h1 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: 0;
}

.admin-header .sub {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: 5px;
  letter-spacing: 0;
  max-width: 620px;
  line-height: 1.45;
}

.admin-shell .btn-ghost {
  min-height: 40px;
  padding: 9px 13px;
  font-size: 0.875rem;
}

.admin-shell .btn-primary,
.admin-shell .btn-secondary,
.admin-shell .btn-danger {
  min-height: 40px;
  padding: 9px 14px;
  font-size: 0.875rem;
  line-height: 1.3;
}

.admin-workbench {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 680px;
  overflow: visible;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.admin-primary-nav {
  position: sticky;
  top: 18px;
  align-self: start;
  min-width: 0;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 18px 12px;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
}

.admin-nav-group + .admin-nav-group {
  margin-top: 20px;
}

.admin-nav-label {
  padding: 0 10px 7px;
  color: var(--text-faint);
  font-size: 0.6875rem;
  font-weight: 700;
}

.admin-workspace-nav {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 5px;
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.admin-workspace-nav:hover {
  color: var(--text-secondary);
  background: var(--bg-4);
}

.admin-workspace-nav.active {
  color: var(--accent-bright);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.admin-workspace {
  min-width: 0;
  padding: 24px 28px 28px;
}

.admin-workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-workspace-header h2 {
  margin: 0 0 5px;
  font-size: 1.375rem;
  letter-spacing: 0;
}

.admin-workspace-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.admin-workspace-status {
  align-self: flex-start;
  flex-shrink: 0;
  padding: 7px 10px;
  color: #86d9aa;
  background: rgba(74, 222, 128, 0.07);
  border: 1px solid rgba(74, 222, 128, 0.18);
  border-radius: 5px;
  font-size: 0.75rem;
}

.admin-workspace-content {
  min-width: 0;
}

.admin-shell .field,
.admin-shell .select,
body.is-admin .field,
body.is-admin .select {
  min-height: 44px;
  padding: 10px 12px !important;
  border-radius: 6px;
  font-size: 1rem !important;
  line-height: 1.4;
}

body.is-admin textarea.field {
  min-height: 92px !important;
  padding: 11px 12px !important;
  line-height: 1.5;
  resize: vertical;
}

body.is-admin label.field-label {
  font-size: 0.875rem !important;
  letter-spacing: 0;
  gap: 6px;
  margin-bottom: 0;
}

body.is-admin .form-grid {
  gap: 14px;
}

body.is-admin .form-row {
  gap: 7px;
}

body.is-admin .form-row.two {
  gap: 14px;
}

.admin-shell .mini-btn {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.admin-shell .json-editor {
  min-height: 420px;
  padding: 14px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.admin-shell .media-status {
  font-size: 0.8125rem;
  line-height: 1.4;
}

.admin-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  margin-bottom: 18px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.admin-tab {
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: 0.12s;
  letter-spacing: 0;
  white-space: nowrap;
}

.admin-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-4);
}

.admin-tab.active {
  background: var(--bg-4);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.admin-panel {
  display: none;
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: visible;
}

.admin-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10px;
  right: 10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

.admin-panel.active {
  display: block;
}

.admin-panel h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 5px;
}

.admin-panel h3[style*="margin-top"],
.admin-panel h4 {
  margin-top: 24px !important;
}

.admin-panel .hint {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-item {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: none;
}

.admin-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-item-head strong {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.admin-panel [data-save] {
  display: none;
}

.admin-toolbar:has(> [data-save]:only-child) {
  display: none;
}

.admin-save-dock {
  position: sticky;
  z-index: 20;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding: 12px 14px;
  background: rgba(24, 23, 27, 0.96);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.admin-save-dock[hidden] {
  display: none;
}

.cloud-publish-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.6fr);
  gap: 14px;
  min-width: 0;
}

.cloud-key-row,
.cloud-publish-actions {
  grid-column: 1 / -1;
}

.cloud-publish-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}

.cloud-publish-progress {
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.cloud-publish-progress[data-stage="done"] {
  color: #86d9aa;
}

.cloud-publish-progress[data-stage="error"] {
  color: #f5a3a3;
}

.cloud-publish-result {
  display: grid;
  gap: 14px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.cloud-publish-result[hidden] {
  display: none;
}

.cloud-result-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.cloud-publish-result strong {
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 1.25rem;
}

.cloud-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.cloud-link-row .field {
  font-family: var(--font-mono);
  font-size: 0.875rem !important;
}

.admin-save-note {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.admin-save-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.chip-input-row {
  gap: 8px;
  align-items: center;
}

.inline-fields {
  gap: 10px;
}

.copy-line-edit {
  gap: 8px;
}

.copy-lib-shell {
  gap: 14px;
}

.copy-lib-sidebar {
  padding: 12px;
}

.copy-lib-main {
  padding: 16px;
}

.copy-lib-head {
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.copy-lib-title {
  font-size: 1rem;
}

.copy-lib-sub,
.copy-lib-status {
  font-size: 0.8125rem;
}

.copy-lib-section-title {
  font-size: 0.9375rem;
  margin-bottom: 6px;
}

.industry-pick-item {
  padding: 9px 10px;
}

.industry-pick-name {
  font-size: 0.9375rem;
}

.industry-pick-meta {
  font-size: 0.75rem;
}

.admin-collapse-summary {
  padding: 6px 4px;
}

.admin-collapse-item .admin-collapse-summary {
  padding: 6px 8px;
}

.admin-collapse-title {
  font-size: 0.9375rem;
}

.admin-collapse-meta,
.admin-collapse-chevron {
  font-size: 0.8125rem;
}

.rewrite-origin-box {
  padding: 10px 12px;
  font-size: 0.9375rem;
}

.media-upload-row {
  gap: 6px;
}

@media (max-width: 900px) {
  .admin-shell {
    padding: 12px 12px 56px;
  }

  .admin-header {
    align-items: flex-start;
  }

  .admin-workbench {
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  .admin-primary-nav {
    position: static;
    display: flex;
    gap: 5px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overscroll-behavior-x: contain;
  }

  .admin-nav-group {
    display: contents;
  }

  .admin-nav-label {
    display: none;
  }

  .admin-workspace-nav {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
  }

  .admin-workspace-nav.active {
    border-bottom-color: var(--accent);
  }

  .admin-workspace {
    padding: 18px 16px 20px;
  }

  .admin-workspace-header {
    align-items: flex-start;
  }

  .admin-workspace-status {
    display: none;
  }

  .admin-panel {
    padding: 16px;
  }

  body.is-admin .form-row.two {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .cloud-key-row,
  .cloud-publish-actions {
    grid-column: auto;
  }

  .admin-save-dock {
    bottom: 12px;
    align-items: stretch;
    flex-direction: column;
  }

  .admin-save-note {
    display: none;
  }

  .admin-save-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  }
}

@media (max-width: 520px) {
  .admin-header {
    display: grid;
  }

  .admin-header .header-actions,
  .admin-header .btn-ghost {
    width: 100%;
  }

  .admin-workspace-header h2 {
    font-size: 1.25rem;
  }

  .admin-tabs {
    width: 100%;
  }

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

  .cloud-publish-actions,
  .cloud-link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .cloud-publish-actions .btn-primary,
  .cloud-link-row .btn-secondary {
    width: 100%;
  }
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.25);
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
  transition: 0.12s;
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.4);
}

.json-editor {
  width: 100%;
  min-height: 380px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.55;
  background: var(--bg-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: #d4d4d8;
  resize: vertical;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.json-editor:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: var(--shadow-focus), inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.inline-fields {
  display: grid;
  gap: 8px;
}

.chip-input-row {
  display: flex;
  gap: 8px;
}

.chip-input-row .field {
  flex: 1;
}

.mini-btn {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: var(--fs-label);
  font-weight: 500;
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  white-space: nowrap;
  transition: 0.12s;
  letter-spacing: -0.01em;
}

.mini-btn:hover {
  border-color: var(--border-focus);
  color: var(--text);
  background: var(--bg-4);
}

.mini-btn.danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.25);
  background: var(--danger-dim);
}

.mini-btn.danger:hover {
  background: rgba(248, 113, 113, 0.18);
}

.copy-lines-edit {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.copy-line-edit {
  display: flex;
  gap: 6px;
}

.copy-line-edit input {
  flex: 1;
}

.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 300;
  pointer-events: none;
}

.status-bar.saving::after {
  content: "";
  display: block;
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: load 0.7s ease infinite;
}

@keyframes load {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}

.footer-note {
  text-align: center;
  color: var(--text-faint);
  font-size: var(--fs-caption);
  margin-top: 28px;
  padding: 16px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.footer-note a {
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
}

.footer-note a:hover {
  color: var(--accent-bright);
  border-color: var(--accent-border);
}

/* play modal */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-mask.show {
  display: flex;
}

.modal {
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: min(360px, 100%);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0, 0, 0, 0.5);
  position: relative;
}

.modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  z-index: 1;
}

.modal-video {
  aspect-ratio: 9/16;
  max-height: 52vh;
  background: #000;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.modal-video .fake-player {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff;
  background: linear-gradient(165deg, #1a1814, #12100e 45%, #0c0b0a);
  animation: pulseBg 4s ease infinite alternate;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

@keyframes pulseBg {
  to {
    filter: brightness(1.12);
  }
}

.modal-body {
  padding: 18px;
  border-top: 1px solid var(--border-subtle);
}

.modal-body h3 {
  font-size: var(--fs-title);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.modal-body p {
  font-size: var(--fs-body);
  color: var(--text-muted);
  line-height: 1.5;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

.modal-close {
  margin-top: 16px;
  width: 100%;
}

/* scrollbars — 精密细条 */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* 文案库：按行业配置布局 */
.copy-lib-shell {
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

@media (max-width: 720px) {
  .copy-lib-shell {
    grid-template-columns: minmax(0, 1fr);
  }
}

.copy-lib-sidebar {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}

.industry-pick-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 420px;
  overflow-y: auto;
}

@media (max-width: 720px) {
  .industry-pick-list {
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
  }
}

.industry-pick-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  min-width: 0;
  transition: 0.12s;
}

.industry-pick-item:hover {
  background: var(--bg-4);
  color: var(--text);
}

.industry-pick-item.active {
  background: var(--accent-dim);
  border-color: rgba(212, 165, 116, 0.3);
  color: var(--accent-bright);
}

.industry-pick-name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.industry-pick-meta {
  font-size: 0.7rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.industry-pick-item.active .industry-pick-meta {
  color: rgba(232, 196, 160, 0.75);
}

.copy-lib-main {
  min-width: 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.copy-lib-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.copy-lib-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.copy-lib-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: var(--font-mono);
}

.copy-lib-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.copy-lib-status {
  font-size: 0.75rem;
  color: var(--accent-bright);
  font-family: var(--font-mono);
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(212, 165, 116, 0.2);
}

/* 改写配置：原文展示 */
.rewrite-origin-box {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* 后台素材组折叠 */
.admin-collapse-head {
  align-items: flex-start;
  gap: 8px;
}

.admin-collapse-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  width: 100%;
  text-align: left;
  padding: 10px 4px;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  min-width: 0;
}

.admin-collapse-summary-group {
  flex: 1 1 auto;
  padding: 4px 0;
}

.admin-collapse-title {
  font-size: 0.875rem;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-collapse-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.admin-collapse-chevron {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-bright);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.admin-collapse-body {
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
}

.admin-collapse-item .admin-collapse-summary {
  padding: 10px 12px;
}

.admin-collapse-item .admin-collapse-body {
  border-top: 1px solid var(--border-subtle);
}

/* focus 可见性 */
.copy-line:focus-visible,
.voice-card:focus-visible,
.style-thumb:focus-visible,
.cat-tab:focus-visible,
.ind-item:focus-visible,
.admin-workspace-nav:focus-visible,
.admin-tab:focus-visible,
.admin-save-dock button:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-ghost:focus-visible,
.upload-btn:focus-visible,
.field:focus-visible,
.select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 减少动效 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .result-card {
    animation: none !important;
  }

  .tt-auto-spark {
    animation: none !important;
  }
}

/* selection */
::selection {
  background: rgba(212, 165, 116, 0.3);
  color: var(--text);
}

/* 兼容旧变量名（若内联样式引用） */
:root {
  --bg: var(--bg-0);
  --bg-elevated: var(--bg-2);
  --bg-card: var(--bg-3);
  --bg-card-hover: var(--bg-4);
  --accent-soft: var(--accent-dim);
  --accent-2: var(--accent-bright);
  --success-soft: var(--success-dim);
}
