/* ==================== 主题变量 ==================== */
/* B 版 浅色精致风（默认） */
:root,
[data-theme="b"] {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --line: 1.75;

  --bg: #fbf7f4;
  --bg-glow: radial-gradient(900px 480px at 12% -8%, rgba(255, 180, 160, .30), transparent 65%),
             radial-gradient(800px 420px at 100% 0%, rgba(255, 214, 200, .38), transparent 60%);

  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-2: #fdf6f3;
  --surface-3: #f9ece7;
  --border: #f1e3dd;
  --border-strong: #e5d1c8;
  --highlight: none;
  --blur: none;

  --text: #2a211f;
  --text-2: #57504c;
  --muted: #776762;

  --accent: #d23c4a;
  --accent-hover: #b9303e;
  --accent-strong: #ad2a37;
  --accent-soft: #fdeceb;
  --ring: rgba(210, 60, 74, .2);
  --on-accent: #ffffff;
  --primary-bg: linear-gradient(135deg, #d23c4a, #bd2f45);
  --primary-bg-hover: linear-gradient(135deg, #bf3341, #a8293e);
  --primary-shadow: 0 6px 16px -6px rgba(210, 60, 74, .45);

  --secondary-bg: #fdf0ed;
  --secondary-bg-hover: #fbe3de;
  --secondary-text: #8f2330;

  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #1f7a4d;
  --warn: #8a5300;

  --chip-bg: #fdeceb;
  --chip-text: #a52734;

  --icon-bg: linear-gradient(140deg, #fff3ee, #fde1dd);
  --icon-color: #c3324a;

  --logo-1: #ff8a6b;
  --logo-2: #d23c4a;

  --input-bg: #fffdfc;
  --sk-a: #f6ece7;
  --sk-b: #fdf7f4;

  --radius-lg: 20px;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(91, 51, 38, .05);
  --shadow: 0 1px 2px rgba(91, 51, 38, .04), 0 12px 32px -14px rgba(91, 51, 38, .16);
  --shadow-hover: 0 2px 4px rgba(91, 51, 38, .05), 0 22px 44px -18px rgba(91, 51, 38, .26);

  --toast-bg: #2a211f;
  --toast-text: #ffffff;

  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23776762' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* A 版 暗色科技风 */
[data-theme="a"] {
  color-scheme: dark;
  --line: 1.7;

  --bg: #080b17;
  --bg-glow: radial-gradient(1000px 560px at 8% -12%, rgba(99, 102, 241, .32), transparent 62%),
             radial-gradient(900px 520px at 100% 0%, rgba(168, 85, 247, .22), transparent 60%),
             radial-gradient(900px 600px at 50% 115%, rgba(56, 189, 248, .12), transparent 60%);

  --surface: rgba(20, 25, 48, .62);
  --surface-solid: #141a30;
  --surface-2: rgba(10, 14, 30, .55);
  --surface-3: rgba(99, 102, 241, .10);
  --border: rgba(148, 163, 255, .16);
  --border-strong: rgba(148, 163, 255, .28);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, .07);
  --blur: blur(18px) saturate(140%);

  --text: #e9edf9;
  --text-2: #c3cae0;
  --muted: #a3acc6;

  --accent: #a5b0ff;
  --accent-hover: #c0c8ff;
  --accent-strong: #c7cdff;
  --accent-soft: rgba(124, 140, 255, .14);
  --ring: rgba(129, 140, 248, .35);
  --on-accent: #ffffff;
  --primary-bg: linear-gradient(135deg, #4f46e5, #7c3aed);
  --primary-bg-hover: linear-gradient(135deg, #5b52f0, #8b4af5);
  --primary-shadow: 0 8px 24px -8px rgba(99, 102, 241, .6), inset 0 1px 0 rgba(255, 255, 255, .18);

  --secondary-bg: rgba(129, 140, 248, .12);
  --secondary-bg-hover: rgba(129, 140, 248, .2);
  --secondary-text: #d6dbff;

  --danger: #ff9aa4;
  --danger-soft: rgba(255, 99, 115, .12);
  --success: #6ee7b7;
  --warn: #fcd34d;

  --chip-bg: rgba(129, 140, 248, .16);
  --chip-text: #cfd4ff;

  --icon-bg: linear-gradient(140deg, rgba(99, 102, 241, .28), rgba(168, 85, 247, .18));
  --icon-color: #c7cdff;

  --logo-1: #6366f1;
  --logo-2: #a855f7;

  --input-bg: rgba(8, 11, 24, .6);
  --sk-a: rgba(148, 163, 255, .08);
  --sk-b: rgba(148, 163, 255, .18);

  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 16px 40px -20px rgba(0, 0, 0, .8);
  --shadow-hover: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 22px 50px -20px rgba(79, 70, 229, .55);

  --toast-bg: #1d2442;
  --toast-text: #e9edf9;

  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23a3acc6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ==================== 基础 ==================== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: var(--line);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

/* 背景光晕（固定在视口，iOS 不支持 background-attachment: fixed） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg-glow), var(--bg);
  pointer-events: none;
}

.shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 24px 64px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

h1, h2, h3, h4 {
  margin: 0 0 12px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: .01em;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 12px; }

a { color: var(--accent-strong); }

.muted {
  color: var(--muted);
  font-size: .92rem;
}

.hint {
  color: var(--text-2);
  font-size: .9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}

.error {
  color: var(--danger);
  font-size: .92rem;
  margin: 0;
}

.error-box {
  background: var(--danger-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

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

/* ==================== 表面（卡片）与玻璃质感 ==================== */
.surface {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--highlight);
}

[data-theme="b"] .surface {
  box-shadow: var(--shadow);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  [data-theme="a"] .surface {
    background: var(--surface);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
  }
}

/* A 版：卡片顶部细高光描边 */
[data-theme="a"] .surface {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, 0) 40%);
}

/* ==================== 表单 ==================== */
label {
  display: block;
  font-size: .88rem;
  font-weight: 550;
  margin-bottom: 6px;
  color: var(--text-2);
}

input[type="text"],
input[type="password"],
input[type="url"],
textarea,
select {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 11px 14px;
  font: inherit;
  font-size: 1rem;
  line-height: 1.6;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  margin-bottom: 16px;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: .85;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

textarea.short {
  min-height: 80px;
}

select {
  padding-right: 38px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

select option,
select optgroup {
  background: var(--surface-solid);
  color: var(--text);
}

input[type="file"]:not(.file-input-visually-hidden) {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 10px;
  margin-bottom: 16px;
  font: inherit;
  font-size: .9rem;
  color: var(--text-2);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}

input[type="file"]:not(.file-input-visually-hidden)::file-selector-button {
  font: inherit;
  font-size: .88rem;
  margin-right: 12px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--secondary-bg);
  color: var(--secondary-text);
  cursor: pointer;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  min-width: 0;
  position: relative;
}

.file-input-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  background: transparent;
}

.file-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 10px 16px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--secondary-bg);
  color: var(--secondary-text);
  font: inherit;
  font-size: .95rem;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.file-picker-btn:hover {
  background: var(--secondary-bg-hover);
}

.file-input-visually-hidden:focus + .file-picker-btn,
.file-input-visually-hidden:focus-visible + .file-picker-btn {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}

.file-name {
  color: var(--text-2);
  font-size: .92rem;
  line-height: 1.4;
  min-width: 0;
  word-break: break-all;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}

input[type="checkbox"] {
  accent-color: var(--accent);
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 0;
  cursor: pointer;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  min-height: 44px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: .98rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  color: var(--text);
  background: var(--secondary-bg);
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s, transform .12s, border-color .2s;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn:active:not(:disabled) {
  transform: scale(.97);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .7;
}

.btn.primary {
  background: var(--primary-bg);
  color: var(--on-accent);
  box-shadow: var(--primary-shadow);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-bg-hover);
}

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

.btn.secondary:hover:not(:disabled) {
  background: var(--secondary-bg-hover);
}

.btn.ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border-strong);
}

.btn.ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.btn.danger,
.btn.danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: var(--border-strong);
}

.btn.danger:hover:not(:disabled),
.btn.danger-ghost:hover:not(:disabled) {
  background: var(--danger-soft);
}

.btn.small {
  min-height: 40px;
  padding: 8px 16px;
  font-size: .9rem;
}

.btn.tiny {
  min-height: 34px;
  padding: 6px 12px;
  font-size: .84rem;
  font-weight: 550;
  background: var(--surface-2);
  color: var(--text-2);
  border-color: var(--border);
}

.btn.tiny:hover:not(:disabled) {
  color: var(--accent-strong);
  border-color: var(--border-strong);
}

.btn.tiny.done {
  color: var(--success);
}

.btn.block {
  width: 100%;
}

/* 加载中：按钮内小转圈 */
.btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin .8s linear infinite;
}

.link-btn {
  background: none;
  border: 0;
  padding: 6px 0;
  font: inherit;
  font-size: .88rem;
  color: var(--accent-strong);
  cursor: pointer;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==================== 品牌头部 ==================== */
.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  margin-bottom: 24px;
  position: sticky;
  top: 12px;
  z-index: 20;
  border-radius: 999px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 44px;
  padding: 0 6px;
  background: none;
  border: 0;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  border-radius: 999px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  flex: none;
}

.logo-stop-1 { stop-color: var(--logo-1); }
.logo-stop-2 { stop-color: var(--logo-2); }

.brand-name {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

[data-view="login"] #logout-btn,
[data-view="boot"] #logout-btn {
  display: none;
}

[data-view="boot"] #login-view {
  visibility: hidden;
}

/* ==================== 登录 ==================== */
.login-wrap {
  display: flex;
  justify-content: center;
  padding-top: 8vh;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 28px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: block;
}

.login-card h1 {
  margin-bottom: 6px;
  letter-spacing: .06em;
}

.login-sub {
  color: var(--muted);
  font-size: .92rem;
  margin-bottom: 28px;
}

.login-card label,
.login-card input {
  text-align: left;
}

#login-msg {
  margin-top: 12px;
  min-height: 1.4em;
}

/* ==================== 首页 ==================== */
.home-intro {
  margin: 8px 4px 22px;
}

.home-intro h2 {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

/* 三大入口：中间的创作台是主线，更宽、更醒目 */
.entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.entry-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
  min-height: 200px;
  padding: 24px 22px;
  text-align: left;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.entry-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
}

.entry-main {
  border-color: var(--border-strong);
  background-image: linear-gradient(160deg, var(--accent-soft), transparent 60%);
}

[data-theme="a"] .entry-main {
  background-image: linear-gradient(160deg, rgba(124, 140, 255, .2), rgba(168, 85, 247, .06) 55%, transparent 80%);
  box-shadow: var(--shadow), 0 0 0 1px rgba(129, 140, 248, .22), 0 18px 48px -22px rgba(99, 102, 241, .65);
}

.entry-step {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  opacity: .07;
}

.entry-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  flex: none;
  border-radius: 15px;
  background: var(--icon-bg);
  color: var(--icon-color);
  box-shadow: var(--highlight);
}

.entry-main .entry-icon {
  width: 56px;
  height: 56px;
  background: var(--primary-bg);
  color: var(--on-accent);
  box-shadow: var(--primary-shadow);
}

.entry-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.entry-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.entry-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.12rem;
  font-weight: 700;
}

.entry-main .entry-title {
  font-size: 1.28rem;
}

.entry-tag {
  padding: 1px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 650;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.entry-desc {
  font-size: .9rem;
  line-height: 1.6;
  color: var(--text-2);
}

.entry-note {
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--warn);
  border: 1px solid var(--border-strong);
}

.home-projects .results-head {
  margin-top: 34px;
}

.home-foot {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}

.quiet-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px;
  background: none;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: .9rem;
  color: var(--muted);
  cursor: pointer;
}

.quiet-link:hover {
  color: var(--accent-strong);
  background: var(--surface-2);
}

.quiet-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==================== 功能页 ==================== */
.page-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 20px;
}

.page-bar h2 {
  margin: 0;
  font-size: 1.4rem;
  outline: none;
}

.btn.back svg {
  width: 18px;
  height: 18px;
}

.tab-section {
  display: none;
}

.tab-section.active {
  display: block;
  animation: fade-up .3s ease both;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 18px;
  align-items: start;
}

.voice-layout {
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
}

.panel {
  padding: 24px;
  min-width: 0;
}

.panel + .panel,
.panel-grid + .panel,
.panel + .results-section,
.panel-grid + .results-section,
.panel-grid + .action-bar,
.action-bar + .results-section {
  margin-top: 18px;
}

.panel-grid .panel + .panel {
  margin-top: 0;
}

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

.panel-head .panel-title {
  margin: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: .85rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tab-intro {
  color: var(--text-2);
  font-size: .98rem;
  line-height: 1.5;
  margin: 0 0 16px;
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 650;
  letter-spacing: .02em;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
}

.field {
  min-width: 0;
}

.span-2 {
  grid-column: 1 / -1;
}

.form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}

.form-foot.end {
  justify-content: flex-end;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px 4px 0;
}

.action-bar .muted {
  margin: 0;
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 20px;
}

.filter-bar .field {
  min-width: 160px;
}

.filter-bar .field.grow {
  flex: 1 1 260px;
}

.filter-bar input,
.filter-bar select {
  margin-bottom: 0;
}

.filter-bar .btn {
  min-width: 110px;
}

/* 勾选列表 */
.check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 2px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin: 0;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.check-item:hover {
  border-color: var(--border-strong);
}

.check-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.check-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.check-title {
  overflow-wrap: anywhere;
}

.check-time {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 400;
}

/* ==================== 结果区 ==================== */
.results-section {
  min-width: 0;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 4px 14px;
}

.results-head h3,
.section-title {
  margin: 0;
}

.section-title {
  margin: 28px 4px 14px;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 18px;
  min-width: 0;
}

.results-head + .results {
  margin-top: 0;
}

.result-group {
  min-width: 0;
  animation: fade-up .35s ease both;
}

.group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 4px 12px;
}

.group-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 260px;
  flex-wrap: wrap;
}

.group-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 200px;
}

.group-title {
  margin: 0;
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.group-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  width: 100%;
  font-size: .84rem;
  color: var(--muted);
  min-width: 0;
}

.group-actions,
.rc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 结果卡按钮始终在右上角一行，不换到标题下面 */
.rc-actions {
  flex: none;
  flex-wrap: nowrap;
  margin-left: auto;
}

.check-item.pick {
  min-height: 36px;
  padding: 4px 12px;
  font-size: .86rem;
  border-radius: 999px;
}

.check-item.pick input {
  width: 18px;
  height: 18px;
  min-width: 18px;
}

.ext-link {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
  word-break: break-all;
}

.chip {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--chip-bg);
  color: var(--chip-text);
}

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

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 16px;
}

.result-card {
  min-width: 0;
  padding: 18px 20px 20px;
  animation: fade-up .35s ease both;
  container-type: inline-size;
}

.result-card.wide {
  grid-column: 1 / -1;
}

.result-group.summary .result-card {
  border-color: var(--border-strong);
}

.rc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--border-strong);
}

.rc-title {
  margin: 6px 0 0;
  font-size: 1rem;
  color: var(--accent-strong);
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

/* 卡片较窄时按钮只留图标，文字仍在 aria-label / title 里 */
@container (max-width: 520px) {
  .rc-actions .btn {
    position: relative;
    padding: 6px;
    min-width: 34px;
    justify-content: center;
  }

  .rc-actions .btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

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

.rc-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: .97rem;
  line-height: var(--line);
  color: var(--text);
}

.rc-text + .rc-text,
.rc-text + .table-wrap,
.table-wrap + .rc-text,
.table-wrap + .table-wrap {
  margin-top: 14px;
}

.rc-empty {
  color: var(--muted);
  font-size: .92rem;
  margin: 0;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  line-height: 1.6;
}

.table-wrap th,
.table-wrap td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
  min-width: 72px;
  border-bottom: 1px solid var(--border);
}

.table-wrap th {
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 650;
  white-space: nowrap;
}

.table-wrap tr:last-child td {
  border-bottom: 0;
}

.status-card .status-line {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.video-link {
  margin-top: 14px;
}

/* 解析失败 */
.result-group.failed {
  padding: 16px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--danger-soft);
}

.fail-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 8px;
}

.fail-url {
  font-size: .88rem;
  color: var(--text-2);
  overflow-wrap: anywhere;
  word-break: break-all;
  margin-bottom: 10px;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 36px 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: var(--surface-2);
}

.empty-state p {
  margin: 0;
  max-width: 440px;
  font-size: .94rem;
}

.empty-icon svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .8;
}

/* 骨架屏 */
.skeleton-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 16px;
}

.skeleton-card {
  padding: 20px;
}

.sk-line {
  height: 12px;
  margin-top: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--sk-a) 25%, var(--sk-b) 50%, var(--sk-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.sk-line.sk-title {
  width: 40%;
  height: 16px;
  margin-top: 0;
  margin-bottom: 20px;
}

.sk-line.sk-short {
  width: 60%;
}

/* ==================== 我的口吻 ==================== */
.voice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.voice-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  animation: fade-up .3s ease both;
}

.voice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.voice-head h4 {
  margin: 6px 0 8px;
  overflow-wrap: anywhere;
}

.voice-body {
  margin: 0;
  font-size: .92rem;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.voice-card.expanded .voice-body {
  display: block;
  -webkit-line-clamp: unset;
}

/* ==================== 历史记录 ==================== */
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 16px;
  margin-top: 18px;
}

.history-list > .empty-state,
.history-list > .skeleton-wrap,
.history-list > .error {
  grid-column: 1 / -1;
}

.history-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 16px 18px;
  animation: fade-up .3s ease both;
}

.hc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hc-time {
  font-size: .8rem;
  color: var(--muted);
}

.hc-title {
  margin: 2px 0 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.history-card .ext-link {
  font-size: .84rem;
}

.hc-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.more-row {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

/* ==================== 顶栏补充 ==================== */
[data-view="login"] #open-voice,
[data-view="boot"] #open-voice {
  display: none;
}

.api-note {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: var(--surface-3);
  color: var(--warn);
  font-size: .9rem;
  font-weight: 550;
}

.api-note.inline {
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .82rem;
}

/* ==================== 项目列表 ==================== */
.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 14px;
  min-width: 0;
}

.project-list > .empty-state,
.project-list > .skeleton-wrap,
.project-list > .error {
  grid-column: 1 / -1;
}

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 14px 16px;
  animation: fade-up .3s ease both;
}

.pi-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.pi-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.pi-time,
.pi-counts {
  font-size: .8rem;
  color: var(--muted);
  margin: 0;
}

.pi-title {
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.pi-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}

.chip.chip-alt {
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}

/* ==================== 子页签 ==================== */
.subtabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  max-width: 100%;
}

.subtab {
  min-height: 40px;
  padding: 6px 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: .94rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}

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

.subtab.is-active {
  background: var(--surface-solid);
  color: var(--accent-strong);
  box-shadow: var(--shadow-sm);
}

[data-theme="a"] .subtab.is-active {
  background: var(--secondary-bg-hover);
  color: var(--text);
}

.subtab-panel > .muted {
  margin: 0 4px 14px;
}

/* ==================== 素材库：已存素材 ==================== */
.saved-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.saved-item {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.saved-item .saved-check {
  flex: 1 1 auto;
  min-width: 0;
  align-items: flex-start;
}

.saved-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  flex: none;
  font-size: .84rem;
}

.check-item input[type="checkbox"] {
  margin-top: 2px;
}

.material-item {
  align-items: flex-start;
}

.check-preview {
  font-size: .86rem;
  font-weight: 400;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.check-label .ext-link {
  font-size: .8rem;
  font-weight: 400;
}

.sticky-action {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 16px;
  padding: 10px 10px 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.sticky-action .muted {
  margin: 0;
}

.more-row.compact {
  margin-top: 10px;
}

.more-row.compact:has(.hidden:only-child) {
  display: none;
}

/* ==================== 创作台 ==================== */
.project-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.pb-main {
  flex: 1 1 320px;
  min-width: 0;
}

.pb-label {
  display: block;
  margin: 0 0 4px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted);
}

.pb-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pb-title-row input {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

#st-project-title.is-static {
  padding-left: 0;
  border-color: transparent;
  background: transparent;
  font-size: 1.12rem;
  font-weight: 650;
  box-shadow: none;
  cursor: default;
  text-overflow: ellipsis;
}

.pb-name {
  display: block;
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.pb-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 4px 0 0;
  font-size: .8rem;
  color: var(--success);
}

.pb-note svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 步骤线：序号圆点 + 竖线 */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.step-block {
  --dot: 34px;
  display: grid;
  grid-template-columns: var(--dot) minmax(0, 1fr);
  gap: 0 18px;
  position: relative;
  padding-bottom: 30px;
}

.step-block:last-child {
  padding-bottom: 0;
}

.step-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.step-rail::after {
  content: "";
  position: absolute;
  top: calc(var(--dot) + 6px);
  bottom: -24px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--border-strong);
}

.step-block:last-child .step-rail::after {
  display: none;
}

.step-block.is-done .step-rail::after {
  background: linear-gradient(180deg, var(--accent), var(--border-strong));
}

.step-dot {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  font-size: .92rem;
  font-weight: 750;
  background: var(--surface-solid);
  color: var(--muted);
  border: 2px solid var(--border-strong);
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
}

.step-check {
  display: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step-block.is-active .step-dot {
  border-color: var(--accent);
  color: var(--accent-strong);
  box-shadow: 0 0 0 5px var(--ring);
}

.step-block.is-done .step-dot {
  background: var(--primary-bg);
  border-color: transparent;
  color: var(--on-accent);
}

.step-block.is-done .step-num {
  display: none;
}

.step-block.is-done .step-check {
  display: block;
}

.step-content {
  min-width: 0;
}

.step-title {
  margin: 4px 0 14px;
  font-size: 1.14rem;
}

.step-lock-hint {
  display: none;
  margin: -6px 0 12px;
  font-size: .86rem;
  color: var(--muted);
}

.step-block.is-locked .step-lock-hint {
  display: block;
}

.step-block.is-locked .step-body,
.step-block.is-locked .step-title {
  opacity: .5;
}

.step-block.is-locked .step-body {
  pointer-events: none;
  user-select: none;
}

.step-body > .results {
  margin-top: 18px;
}

.source-label {
  display: inline-flex;
  margin: 0 0 16px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.voice-switch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  min-width: 0;
}

.voice-hint {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 8px;
  font-size: .84rem;
  color: var(--muted);
}

.voice-hint .link-btn {
  min-height: 32px;
  font-weight: 600;
}

.inline-check:has(input:disabled) {
  color: var(--muted);
  cursor: not-allowed;
}

.group-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 12px 4px 0;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.group-foot .muted {
  margin: 0;
}

.video-link-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 28px;
  padding: 14px 18px;
  font-weight: 600;
}

/* ==================== AI 视频线：镜头卡 ==================== */
.vl-upload {
  margin-top: 18px;
}

#vl-projects-wrap .results-head {
  margin-top: 0;
}

#vl-target {
  margin: -6px 0 12px;
}

.shot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  gap: 16px;
  min-width: 0;
}

.shot-list > .empty-state,
.shot-list > .skeleton-wrap,
.shot-list > .error,
.shot-list > .result-group {
  grid-column: 1 / -1;
}

.shot-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 18px 18px 16px;
  animation: fade-up .3s ease both;
}

.shot-card.is-dirty {
  border-color: var(--accent);
}

.shot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-strong);
}

.shot-no {
  font-size: 1.02rem;
  font-weight: 750;
  color: var(--accent-strong);
}

.shot-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.shot-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 12px;
}

.shot-fields textarea {
  min-height: 72px;
}

.shot-fields textarea,
.shot-fields input {
  margin-bottom: 10px;
  font-size: .94rem;
}

.shot-line {
  margin: -4px 0 0;
  font-size: .88rem;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.shot-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.shot-dirty {
  display: none;
  font-size: .8rem;
  color: var(--warn);
}

.shot-card.is-dirty .shot-dirty {
  display: inline;
}

.shot-gen {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.vendor-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.vendor-group legend {
  float: left;
  width: 100%;
  margin-bottom: 6px;
  padding: 0;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
}

.vendor-option {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 40px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

[data-theme="a"] .vendor-option {
  background: var(--input-bg);
}

.vendor-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.vendor-option input[type="radio"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  margin: 0;
}

.vendor-option.is-off {
  color: var(--muted);
  cursor: not-allowed;
  opacity: .75;
}

.vendor-off {
  font-size: .76rem;
  font-weight: 500;
  color: var(--warn);
}

.shot-task {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
}

.task-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: .88rem;
  min-width: 0;
}

.task-status {
  font-weight: 650;
}

.task-id {
  overflow-wrap: anywhere;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shot-task > .btn {
  align-self: flex-start;
}

.shot-video {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 360px;
  border-radius: var(--radius-sm);
  background: #000;
}

/* ==================== 确认框 ==================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 12, 10, .45);
  animation: fade-in .2s ease both;
}

[data-theme="a"] .modal-backdrop {
  background: rgba(3, 5, 14, .7);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 24px 22px 20px;
  animation: fade-up .25s ease both;
}

[data-theme="a"] .modal-card {
  background: var(--surface-solid);
}

body.modal-open {
  overflow: hidden;
}

.confirm-list {
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.confirm-row {
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr);
  gap: 8px;
  font-size: .94rem;
}

.confirm-row dt {
  color: var(--muted);
}

.confirm-row dt::after {
  content: "：";
}

.confirm-row dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.confirm-warn {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: .9rem;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==================== 提示条 ==================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 50;
  max-width: min(92vw, 480px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: .94rem;
  text-align: center;
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .35);
  border: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 12px);
  transition: opacity .25s, transform .25s, visibility .25s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.toast.warn::before,
.toast.error::before,
.toast.success::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
  background: #f5b74e;
}

.toast.error::before { background: #ff6b78; }
.toast.success::before { background: #4ade80; }

/* ==================== 动画 ==================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .entry-card:hover {
    transform: none;
  }
}

/* ==================== 响应式 ==================== */
@media (max-width: 1024px) {
  .entry-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .entry-card {
    flex-direction: row;
    align-items: center;
    min-height: 0;
    padding: 18px 20px;
  }
}

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

@media (max-width: 640px) {
  .shell {
    padding: 10px 14px 48px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .brandbar {
    top: 8px;
    margin-bottom: 18px;
    padding: 6px 8px 6px 8px;
  }

  .brand-name {
    font-size: 1rem;
  }

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

  .brand-actions .btn.small {
    min-height: 44px;
    padding: 8px 12px;
  }

  .home-intro h2 {
    font-size: 1.3rem;
  }

  .entry-grid,
  .panel-grid,
  .voice-layout,
  .form-grid,
  .result-grid,
  .skeleton-wrap,
  .history-list,
  .project-list,
  .shot-list,
  .shot-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .entry-card {
    gap: 14px;
    padding: 16px;
  }

  .entry-icon,
  .entry-main .entry-icon {
    width: 44px;
    height: 44px;
  }

  .entry-step {
    font-size: 2rem;
    top: 10px;
    right: 12px;
  }

  #open-voice .btn-label,
  #theme-toggle .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .brand-actions {
    gap: 6px;
  }

  .project-item {
    flex-direction: column;
    align-items: stretch;
  }

  .pi-actions {
    flex-direction: row;
  }

  .pi-actions .btn {
    flex: 1 1 0;
  }

  .saved-item {
    flex-direction: column;
    gap: 6px;
  }

  .saved-side {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
  }

  .sticky-action {
    border-radius: var(--radius);
    padding: 10px 12px;
  }

  .sticky-action .btn {
    width: 100%;
  }

  .step-block {
    --dot: 28px;
    gap: 0 10px;
  }

  .step-title {
    margin-top: 1px;
    font-size: 1.04rem;
  }

  .project-bar {
    padding: 12px 14px;
  }

  .project-bar > .btn {
    width: 100%;
  }

  .pb-main {
    flex-basis: 100%;
  }

  .shot-card {
    padding: 16px 14px;
  }

  .shot-gen {
    flex-direction: column;
    align-items: stretch;
  }

  .shot-gen .btn,
  .shot-actions .shot-save {
    width: 100%;
  }

  .subtabs {
    display: flex;
  }

  .subtab {
    flex: 1 1 0;
  }

  .modal-actions .btn {
    flex: 1 1 0;
  }

  .video-link-bar .btn,
  .group-foot .btn {
    width: 100%;
  }

  .panel {
    padding: 18px 16px;
  }

  .login-card {
    padding: 28px 20px 22px;
  }

  .login-wrap {
    padding-top: 4vh;
  }

  .btn {
    min-height: 48px;
  }

  .btn.small,
  .btn.tiny,
  .file-picker-btn {
    min-height: 44px;
  }

  .panel .btn.primary,
  .panel .btn.secondary,
  .action-bar .btn,
  .filter-bar .btn,
  .btn-row .btn,
  .results-head .btn,
  .more-row .btn {
    width: 100%;
  }

  .btn-row {
    width: 100%;
    flex-direction: column;
  }

  .form-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar .field {
    min-width: 0;
  }

  .rc-title {
    margin-top: 11px;
  }

  .rc-actions .btn {
    min-width: 44px;
  }

  .group-actions {
    width: 100%;
  }

  .group-actions .btn {
    flex: 1 1 0;
    padding: 6px 8px;
  }

  .hc-actions .btn {
    flex: 1 1 0;
  }

  .result-card {
    padding: 16px;
  }

  .page-bar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .page-bar h2 {
    font-size: 1.2rem;
  }
}

/* 带 hidden 属性的元素一律隐藏（修复后台弹窗遮住登录） */
[hidden] { display: none !important; }

/* ---- 视频线本地预览 / 镜头缩略图 / 素材「反推镜头」（扳手） ---- */
.vl-preview {
  display: block;
  width: 100%;
  max-height: 360px;
  margin: 10px 0 4px;
  border-radius: var(--radius);
  background: #000;
}

.vl-preview.hidden {
  display: none;
}

.shot-thumb {
  width: 100%;
  max-width: 320px;
  border-radius: calc(var(--radius) - 4px);
  overflow: hidden;
  background: var(--surface-2, rgba(0, 0, 0, .06));
}

.shot-thumb img {
  display: block;
  width: 100%;
  height: auto;
}

.btn.is-disabled {
  cursor: not-allowed;
  opacity: .5;
}

.saved-side .btn.tiny {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .saved-side {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px 10px;
  }

  .shot-thumb {
    max-width: none;
  }
}

/* 自动滚到镜头卡时避开顶部悬浮栏 */
#vl-shots-section { scroll-margin-top: 96px; }

/* 竖屏视频的缩略图不撑满整屏：限高，按原比例 */
.shot-thumb { width: fit-content; max-width: 100%; }
.shot-thumb img { width: auto; max-width: 100%; max-height: 240px; }
@media (max-width: 640px) {
  .shot-thumb { max-width: 100%; }
}

/* 体检修复：提示条、长任务提示、空素材置灰、分段标签 */
.warn-note {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: var(--surface-3);
  color: var(--warn);
  font-size: .88rem;
  font-weight: 550;
}
.long-hint {
  margin: 8px 0 0;
  color: var(--warn);
  font-size: .86rem;
}
.check-item.is-empty,
.saved-item.is-empty {
  opacity: .55;
}
.check-item.is-empty input[type=checkbox] {
  cursor: not-allowed;
}
.empty-tag {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: .75rem;
  background: var(--danger-soft);
  color: var(--danger);
  white-space: nowrap;
}
.segment-label {
  margin: 14px 0 6px;
  padding: 4px 10px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-2, inherit);
  font-size: .85rem;
  font-weight: 600;
}
.retry-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}
.boot-error {
  position: fixed;
  inset: 20vh 16px auto;
  max-width: 420px;
  margin: 0 auto;
  padding: 24px;
  text-align: center;
  z-index: 50;
  border-radius: var(--radius, 12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.choice-body {
  margin: 8px 0 16px;
  line-height: 1.6;
}
.btn-label-short {
  display: none;
}
@media (max-width: 640px) {
  /* 手机上图标按钮也带个短字，不只剩图标 */
  #open-voice .btn-label-short {
    display: inline;
    font-size: .8rem;
  }
  /* 素材卡的按钮留在卡片框里 */
  .saved-item {
    overflow: hidden;
  }
  .saved-side {
    width: 100%;
    box-sizing: border-box;
    padding: 0 4px 4px;
  }
  .saved-side .btn.tiny {
    flex: 0 1 auto;
    min-width: 0;
  }
}
.shot-list > .segment-label,
.shot-list > .reverse-warn,
.shot-list > .merge-undo {
  grid-column: 1 / -1;
}
@media (max-width: 640px) {
  /* 手机：整张素材卡（勾选区 + 按钮）在同一个框里 */
  .saved-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding-bottom: 8px;
  }
  .saved-item .saved-check {
    border: none;
    background: transparent;
  }
  .saved-item.is-empty .saved-check {
    background: transparent;
  }
  /* 主题按钮在手机上只留图标（有 aria-label / title「切换到暗色」），给品牌名留位置 */
}

/* 刷新后接着跟踪的长任务 */
.job-banners {
  display: grid;
  gap: 8px;
  margin: -20px 0 16px;
  padding-top: 8px;              /* 和品牌栏之间的 8px 空隙由横幅区自己的底色填上 */
  background: var(--bg);
  position: sticky;
  top: var(--banner-top, 68px);  /* 品牌栏下沿，由 syncBannerTop() 按实际高度算 */
  z-index: 19;                   /* 比品牌栏（20）低一层 */
}
.job-banner { transition: opacity .3s ease, transform .3s ease; }
.job-banner.is-leaving { opacity: 0; transform: translateY(-6px); }
.job-banner { background: var(--surface-solid, #fff); }
.job-banners:empty { display: none; }
.job-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border-strong);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .10);
  font-size: .92rem;
}
.job-banner-text { flex: 1 1 220px; min-width: 0; }
.job-banner.is-done { border-color: var(--success); }
.job-banner.is-failed { border-color: var(--warn); color: var(--warn); }
.warn-note.rewrite-short { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.warn-note.rewrite-short > span { flex: 1 1 200px; }

/* 反推方式：抽帧 / 整片看 */
.reverse-mode { border: 0; margin: 4px 0 12px; padding: 0; min-width: 0; }
.reverse-mode legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.reverse-mode-options { display: flex; flex-wrap: wrap; gap: 8px; }
.reverse-mode-help { margin: 8px 0 0; }
.reverse-usage { font-size: .86rem; margin: 0 0 10px; padding: 8px 12px; border-radius: var(--radius-sm, 8px);
  border: 1px dashed var(--border-strong); background: var(--surface-solid, #fff); overflow-wrap: anywhere; }
.shot-list > .reverse-usage { grid-column: 1 / -1; }

/* Claude 审核修复（2026-11-12 k）：提示里的「去看结果」、撤回合并条、提交结果不确定 */
.toast.has-link { pointer-events: auto; border-radius: 16px; }
.toast-link {
  margin-left: 8px; padding: 2px 10px; border: 1px solid currentColor; border-radius: 999px;
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.toast-link:focus-visible { outline: 2px solid var(--toast-text); outline-offset: 2px; }
.merge-undo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; justify-content: space-between; }
.merge-undo-text { flex: 1 1 260px; }
.shot-status.is-uncertain { background: #fff1d6; color: #7a4b00; }
[data-theme="a"] .shot-status.is-uncertain { background: #4a3a14; color: #ffe2a6; }

/* 收起 / 展开（2026-11-12 l，飞虞批准）：「已扒到的内容」默认一行，「已存素材」点标题或「展开」看全文 */
.collapse-panel[hidden] { display: none !important; }
.collapse-title {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  max-width: 100%;
}
.collapse-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.collapse-title:focus-visible,
.collapse-toggle:focus-visible { outline: 2px solid var(--accent, #c8364a); outline-offset: 2px; border-radius: 6px; }
.result-group.is-collapsible {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.result-group.is-collapsible + .result-group.is-collapsible { margin-top: 10px; }
.result-group.is-collapsible .group-head { margin: 0; align-items: center; }
.result-group.is-collapsible.is-open .group-head { margin-bottom: 12px; }
.result-group.is-collapsible .group-info { align-items: center; flex-wrap: nowrap; }
.result-group.is-collapsible .group-title-wrap { flex-wrap: nowrap; min-width: 0; }
.result-group.is-collapsible .group-title { min-width: 0; font-size: 1rem; }
.result-group.is-collapsible .group-title .collapse-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-rid { flex: none; font-size: .84rem; white-space: nowrap; }
.result-group.is-collapsible .collapse-panel .group-meta { margin: 0 0 10px; }
.result-group.is-collapsible .warn-note { margin: 8px 0 0; }

.saved-item {
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
/* 勾框单独一小块（只管挑素材），整张素材卡的底色和边框改由 .saved-item 承担 */
.saved-item .saved-check {
  flex: none;
  align-self: flex-start;
  min-height: 40px;
  padding: 0 4px;
  background: transparent;
  border: 0;
}
.saved-main {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.saved-title { font-weight: 600; }
.saved-panel { flex: 1 1 100%; min-width: 0; }
@media (max-width: 640px) {
  .result-group.is-collapsible .group-head { flex-wrap: wrap; }
  .result-group.is-collapsible .group-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .result-group.is-collapsible .group-actions .btn {
    min-width: 0;
    padding-left: 4px;
    padding-right: 4px;
    font-size: .8rem;
    white-space: nowrap;
  }
  .saved-item { flex-direction: row; flex-wrap: wrap; padding: 8px 10px; gap: 6px 8px; }
  .saved-item .saved-check { padding: 0 2px; min-height: 44px; }
  .saved-main { flex: 1 1 0; }
  .saved-item .saved-side { flex: 1 1 100%; }
}
