/* ===== CSS Variables: Shopify Editions 工业审美 ===== */
:root {
  /* Canvas 画布：极淡暖灰 */
  --bg-primary: rgb(246, 246, 246);
  --bg-primary-tint: rgb(242, 242, 242);
  /* Planes 卡片：纯白，无边框 */
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: rgba(0, 0, 0, 0.04);
  /* Stroke 描边：仅必要时使用极淡灰 */
  --stroke: rgba(0, 0, 0, 0.05);
  --border: transparent;
  --border-focus: rgba(0, 0, 0, 0.2);
  /* 主色：深炭灰，绝不用纯黑 */
  --text-primary: rgb(26, 26, 26);
  --text-secondary: rgb(74, 74, 74);
  --text-muted: rgb(115, 115, 115);
  /* 社论排版 */
  --tracking-tight: -0.02em;
  --editorial-italic-opacity: 0.6;
  --accent: #18181b;
  --accent-hover: #3f3f46;
  --accent-bg: rgba(0, 0, 0, 0.06);
  --success: #15803d;
  --success-bg: rgba(21, 128, 61, 0.1);
  --warning: #a16207;
  --warning-bg: rgba(161, 98, 7, 0.1);
  --danger: #b91c1c;
  --danger-bg: rgba(185, 28, 28, 0.1);
  --radius: 24px;
  --radius-sm: 16px;
  /* 柔和层级阴影，无边框 */
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.06);
  --shadow-input: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-input-focus: 0 0 0 2px rgba(0, 0, 0, 0.08);
  --sidebar-w: 240px;
  --sidebar-gap: 20px;
  --sidebar-inset: 16px;
  --transition: 0.2s ease;
  --sidebar-glass: rgba(255, 255, 255, 0.85);
  --sidebar-glass-border: rgba(0, 0, 0, 0.05);
  --letter-spacing: 0.01em;
  --line-height: 1.7;
}

/* ===== Dark theme ===== */
[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-primary-tint: #13151c;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-input: #252838;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.06);
  --text-primary: #e8eaed;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #fafafa;
  --accent-hover: #e4e4e7;
  --accent-bg: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.35);
  --shadow-input: 0 2px 12px rgba(0, 0, 0, 0.2);
  --shadow-input-focus: 0 0 0 2px rgba(255, 255, 255, 0.15);
  --sidebar-glass: rgba(28, 30, 42, 0.75);
  --sidebar-glass-border: rgba(255, 255, 255, 0.06);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: var(--line-height);
  letter-spacing: var(--letter-spacing);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* ===== 背景噪点质感（纸张感，透明度约 0.02）===== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.02;
  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.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}

/* ===== 背景装饰：低饱和度模糊光晕 ===== */
.bg-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  -webkit-filter: blur(80px);
  opacity: 0.5;
}

.bg-orb--1 {
  width: 55vmax;
  height: 55vmax;
  min-width: 280px;
  min-height: 280px;
  background: radial-gradient(circle, hsl(265, 25%, 92%) 0%, hsl(260, 20%, 94%) 100%);
  top: -20%;
  left: -15%;
}

.bg-orb--2 {
  width: 50vmax;
  height: 50vmax;
  min-width: 260px;
  min-height: 260px;
  background: radial-gradient(circle, hsl(215, 25%, 92%) 0%, hsl(210, 20%, 94%) 100%);
  bottom: -25%;
  right: -12%;
}

[data-theme="dark"] .bg-orb {
  opacity: 0.2;
}

[data-theme="dark"] .bg-orb--1 {
  background: radial-gradient(circle, hsl(265, 30%, 25%) 0%, hsl(260, 25%, 18%) 100%);
}

[data-theme="dark"] .bg-orb--2 {
  background: radial-gradient(circle, hsl(215, 30%, 22%) 0%, hsl(210, 25%, 15%) 100%);
}

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

/* ===== Layout ===== */
#app {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ===== Sidebar (Glassmorphism + 悬浮间距) ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  border: none;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--sidebar-inset);
  left: var(--sidebar-inset);
  bottom: var(--sidebar-inset);
  z-index: 100;
}

.logo {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 0 var(--stroke);
  border: none;
}

.logo-image {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--text-primary), #52525b);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
}

.logo-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.logo-slogan {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav {
  flex: 1;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  border-left: none;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  transition: height var(--transition);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item:hover svg {
  transform: scale(1.08);
}

.nav-item.active {
  background: transparent;
  color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.06);
}

.nav-item.active::before {
  height: 24px;
}

.nav-item.active svg {
  transform: scale(1.08);
}

.nav-item svg {
  flex-shrink: 0;
  transition: transform var(--transition);
}

.sidebar-footer {
  padding: 16px 10px;
  box-shadow: 0 -1px 0 var(--stroke);
  border: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.theme-toggle svg {
  flex-shrink: 0;
}

/* ===== Mobile Top Bar (hidden on desktop) ===== */
.mobile-top-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 150;
  background: var(--sidebar-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--stroke);
}

.mobile-top-bar .logo {
  padding: 0;
  box-shadow: none;
  border: none;
  gap: 10px;
}

.mobile-top-bar .logo-image {
  height: 32px;
  width: auto;
}

.mobile-top-bar .logo-icon {
  width: 32px;
  height: 32px;
  font-size: 16px;
  border-radius: 12px;
}

.mobile-top-bar .logo-text {
  font-size: 16px;
}

.mobile-top-bar .logo-slogan {
  display: none;
}

.mobile-top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-top-bar-actions .btn {
  min-height: 36px;
  height: 36px;
}

.mobile-top-bar-actions .theme-toggle {
  padding: 8px;
  border-radius: 12px;
}

.mobile-top-bar-actions .theme-toggle span {
  display: none;
}

.mobile-top-bar .user-area {
  padding: 0;
  border-top: none;
}

.mobile-top-bar .user-info {
  gap: 6px;
}

.mobile-top-bar .user-email {
  font-size: 0.75rem;
  max-width: 100px;
}

/* Mobile drawer (hidden on desktop) */
.mobile-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 240;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-drawer-backdrop.show {
  opacity: 1;
}

.mobile-drawer {
  display: none;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 85vw;
  max-width: 360px;
  background: var(--bg-card);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 250;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}

.mobile-drawer-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.mobile-drawer-close {
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 8px;
  min-width: auto;
}

.mobile-drawer-tabs {
  display: flex;
  gap: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}

.mobile-drawer-tab {
  flex: 1;
  padding: 10px 12px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.mobile-drawer-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.mobile-drawer-tab.active {
  color: var(--accent);
  background: var(--accent-bg);
}

.mobile-drawer-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Drawer 内的 tab-content 必须强制显示，覆盖默认的 display:none */
.mobile-drawer-body > .tab-content {
  display: block;
  opacity: 1;
  transform: none;
  animation: none;
  padding: 16px;
}

.mobile-top-bar-menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.mobile-top-bar-menu:hover {
  background: var(--bg-hover);
}

/* ===== Main Content (与侧栏留出 Gap，悬浮感) ===== */
.main {
  flex: 1;
  margin-left: calc(var(--sidebar-inset) + var(--sidebar-w) + var(--sidebar-gap));
  padding: 40px 48px;
  max-width: 1200px;
  margin-right: auto;
}

/* ===== Page Header（社论主标题：加大、加粗、tracking-tight）===== */
.page-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  box-shadow: 0 1px 0 var(--stroke);
  border: none;
}

.page-header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: 1.25;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: var(--line-height);
  margin-bottom: 0;
  font-style: italic;
  opacity: var(--editorial-italic-opacity);
}

/* 社论斜体点缀：关键动词/辅助说明 */
.editorial-italic {
  font-style: italic;
  opacity: var(--editorial-italic-opacity);
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card.card-interactive:hover {
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  margin-bottom: 20px;
  color: var(--text-primary);
}

.card-header .card-title {
  margin-bottom: 0;
}

/* ===== Forms ===== */
.form-row {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.form-group.flex-1 {
  flex: 1;
  min-width: 200px;
}

.form-group.form-action {
  padding-bottom: 2px;
}

label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
select,
textarea {
  background: var(--bg-input);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  padding: 12px 16px;
  outline: none;
  box-shadow: var(--shadow-input);
  transition: box-shadow var(--transition);
  width: 100%;
  letter-spacing: var(--letter-spacing);
  line-height: var(--line-height);
}

input:focus, select:focus, textarea:focus {
  box-shadow: var(--shadow-input-focus);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

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

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
}

/* ===== 脚本生成表单：字段卡片容器 ===== */
.script-form .form-field-cards {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex-wrap: nowrap;
}

.script-form .form-field-cards--wrap {
  flex-wrap: wrap;
}

.script-form .form-field-card {
  flex: 1;
  min-width: 0;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  box-shadow: var(--shadow-input);
  border: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.script-form .form-field-card--full {
  flex: 1 1 100%;
  min-width: 0;
}

.script-form .form-field-card--wide {
  flex: 1.5 1 200px;
}

.script-form .form-field-card--narrow {
  flex: 0 1 140px;
}

.script-form .field-card-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin: 0;
}

.script-form .field-card-label .label-hint {
  font-style: italic;
  opacity: var(--editorial-italic-opacity);
}

.script-form .form-field-card input,
.script-form .form-field-card select {
  box-shadow: none;
  background: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .script-form .form-field-card input,
[data-theme="dark"] .script-form .form-field-card select {
  background: rgba(0, 0, 0, 0.15);
}

/* ===== 药丸型（Pill）选择器 ===== */
.pill-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.pill input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.pill .pill-text {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-hover);
  box-shadow: var(--shadow-input);
  border: 1px solid transparent;
  transition: all 0.25s ease;
}

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

.pill input:checked + .pill-text {
  background: linear-gradient(135deg, #3f3f46, #52525b);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .pill input:checked + .pill-text {
  background: linear-gradient(135deg, #3f3f46, #52525b);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.checkbox-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  height: 42px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #27272a, #3f3f46);
  color: #fff;
}

.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
}

/* 生成脚本按钮：工业风深灰渐变 + 缩放 */
.btn-generate-script {
  background: linear-gradient(135deg, #27272a, #3f3f46, #52525b) !important;
  margin-top: 8px;
  transition: all 0.3s ease !important;
}

.btn-generate-script:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.btn-generate-script:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: none;
  box-shadow: var(--shadow-input);
}

.btn-secondary:hover { filter: brightness(0.97); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm {
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
}

/* ===== Grid ===== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ===== Lists ===== */
.list-container {
  min-height: 60px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state-illustration {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  opacity: 0.6;
}

.empty-state .btn {
  margin-top: 16px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: none;
  box-shadow: var(--shadow-input);
  margin-bottom: 12px;
  transition: background var(--transition), box-shadow var(--transition);
  animation: listItemIn 0.35s ease backwards;
}

@keyframes listItemIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.list-item:nth-child(1) { animation-delay: 0.02s; }
.list-item:nth-child(2) { animation-delay: 0.05s; }
.list-item:nth-child(3) { animation-delay: 0.08s; }
.list-item:nth-child(4) { animation-delay: 0.11s; }
.list-item:nth-child(5) { animation-delay: 0.14s; }
.list-item:nth-child(n+6) { animation-delay: 0.17s; }

.list-item:hover {
  background: var(--bg-hover);
}

.list-item-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 14px;
  font-weight: 500;
}

.list-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.list-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ===== Tags & Status ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: var(--letter-spacing);
}

.tag-platform {
  background: var(--accent-bg);
  color: var(--accent);
}

.tag-type {
  background: var(--warning-bg);
  color: var(--warning);
}

.tag-success {
  background: var(--success-bg);
  color: var(--success);
}

.tag-success::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

.input-like {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--bg-card);
  color: var(--text-primary);
}

.video-edit-workspace {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.video-edit-top {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.video-edit-preview-card,
.video-edit-panel-card,
.video-edit-timeline-card {
  overflow: hidden;
}

.video-edit-preview-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.video-edit-preview-stage {
  position: relative;
  min-height: 460px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.12), transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
    #0b0d12;
}

.video-edit-preview-player {
  width: 100%;
  height: 100%;
  min-height: 460px;
  display: block;
  object-fit: contain;
  background: transparent;
}

.video-edit-preview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  color: rgba(255,255,255,0.88);
}

.video-edit-preview-empty-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.video-edit-preview-empty-subtitle {
  max-width: 560px;
  line-height: 1.6;
  font-size: 14px;
  color: rgba(255,255,255,0.68);
}

.video-edit-preview-overlay {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.video-edit-preview-overlay-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.video-edit-preview-script,
.video-edit-preview-meta,
.video-edit-preview-asset {
  padding: 10px 14px;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  background: rgba(7, 10, 18, 0.55);
  color: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
}

.video-edit-preview-script {
  font-weight: 700;
}

.video-edit-preview-asset {
  max-width: 420px;
  color: rgba(255,255,255,0.78);
}

.video-edit-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-edit-panel-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.video-edit-panel-tab {
  border: 1px solid var(--stroke);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 12px;
  min-height: 40px;
  font-weight: 600;
  cursor: pointer;
}

.video-edit-panel-tab.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(99, 102, 241, 0.25);
}

.video-edit-panel-section {
  display: none;
}

.video-edit-panel-section.active {
  display: block;
}

.video-edit-panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.video-edit-panel-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-edit-inline-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.video-edit-mini-list {
  max-height: 260px;
  overflow: auto;
}

.video-edit-inline-result {
  margin-top: 12px;
}

.video-edit-track-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-edit-track-overview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: var(--bg-elevated);
}

.video-edit-track-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.video-edit-track-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.video-edit-track-bar {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  cursor: pointer;
}

.video-edit-track-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(255,255,255,0.8));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
  cursor: grab;
}

.video-edit-track-segment.active {
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.18) inset,
    0 0 0 1px rgba(99,102,241,0.5);
}

.video-edit-track-handle {
  position: absolute;
  top: 2px;
  right: 2px;
  bottom: 2px;
  width: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  cursor: ew-resize;
}

.video-edit-track-row.active .video-edit-track-label {
  color: var(--accent);
}

.video-edit-track-list {
  max-height: 520px;
  overflow: auto;
}

@media (max-width: 1100px) {
  .video-edit-top {
    grid-template-columns: 1fr;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== Script Result ===== */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  margin: 28px 0 16px;
  padding-top: 20px;
  box-shadow: 0 1px 0 var(--stroke);
  border: none;
  color: var(--text-primary);
}

.scene-card {
  background: var(--bg-input);
  border: none;
  box-shadow: var(--shadow-input);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 14px;
}

.scene-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.scene-order {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.scene-duration {
  font-size: 12px;
  color: var(--text-muted);
}

.scene-narration {
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 10px;
}

.scene-visual {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 10px 14px;
  background: var(--accent-bg);
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: inset 3px 0 0 var(--accent);
}

.scene-refs {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 脚本可编辑块：获得焦点时高亮 */
.script-editable[contenteditable="true"] {
  outline: none;
  min-height: 1.5em;
}
.script-editable[contenteditable="true"]:focus {
  box-shadow: 0 0 0 2px var(--border-focus);
  border-radius: var(--radius-sm);
}
.hook-block .hook-text.script-editable {
  margin-top: 6px;
}

.scene-refs .ref-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 4px;
  color: var(--accent);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.2s;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-refs .ref-link:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.scene-refs .ref-link::before {
  content: '🔗';
  font-size: 10px;
}

.scene-refs .ref-text {
  display: inline-block;
  padding: 2px 6px;
  background: var(--bg-card);
  border-radius: 4px;
  font-size: 11px;
}

/* ===== Inline Tabs ===== */
.tabs-inline {
  display: flex;
  gap: 0;
  box-shadow: 0 1px 0 var(--stroke);
  border: none;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.prompt-block {
  display: none;
  animation: tabFadeIn 0.25s ease;
}

.prompt-block.active {
  display: block;
}

@keyframes tabFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.prompt-item {
  background: var(--bg-input);
  border: none;
  box-shadow: var(--shadow-input);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: var(--line-height);
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-item-header {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ===== Analyze Result ===== */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.analysis-item {
  background: var(--bg-input);
  border: none;
  box-shadow: var(--shadow-input);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.analysis-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.analysis-value {
  font-size: 14px;
  font-weight: 500;
}

.color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 8px;
  margin-right: 4px;
  vertical-align: middle;
  box-shadow: var(--shadow-input);
  border: none;
}

.thumbnail-preview {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: none;
}

/* ===== Cover Style Library ===== */
.cover-style-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.cover-style-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  box-shadow: var(--shadow-input);
}

.cover-style-summary {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

.cover-style-notes {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

.cover-edit-body .cover-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cover-edit-body .shot-type-row {
  display: flex;
  gap: 16px;
  align-items: center;
}

.cover-edit-body .shot-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.cover-edit-body .shot-label input {
  width: 60px;
}

@media (max-width: 600px) {
  .cover-edit-body .cover-edit-grid {
    grid-template-columns: 1fr;
  }
  .cover-edit-body .shot-type-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ===== Toast Stack (top-right) ===== */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: var(--line-height);
  box-shadow: var(--shadow-hover);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  border: none;
}

.toast-item.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-item.toast-success { background: var(--success); color: #fff; }
.toast-item.toast-error { background: var(--danger); color: #fff; }
.toast-item.toast-info { background: var(--accent); color: #fff; }

.toast-item .toast-icon { flex-shrink: 0; }
.toast-item .toast-msg { flex: 1; }
.toast-item .toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.8;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

.toast-item .toast-close:hover { opacity: 1; }

/* ===== Tab Content + Animations ===== */
.tab-content {
  display: none;
  opacity: 0;
  transform: translateY(8px);
}

.tab-content.active {
  display: block;
  animation: tabContentIn 0.3s ease forwards;
}

@keyframes tabContentIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Script Result card slide-down ===== */
#script-result.reveal {
  animation: cardReveal 0.4s ease;
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Script Hook ===== */
.hook-block {
  background: var(--accent-bg);
  border: none;
  box-shadow: var(--shadow-input);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 500;
  line-height: var(--line-height);
}

.hook-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-style: italic;
  opacity: var(--editorial-italic-opacity);
  color: var(--accent);
  margin-bottom: 8px;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-backdrop.show .modal {
  transform: scale(1);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.modal-body {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.6;
}

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

.modal.modal-wide {
  max-width: 560px;
}

.modal .form-group {
  margin-bottom: 16px;
}

.modal textarea {
  width: 100%;
  background: var(--bg-input);
  border: none;
  box-shadow: var(--shadow-input);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  padding: 12px 16px;
  resize: vertical;
  font-family: inherit;
  line-height: var(--line-height);
}

.modal textarea:focus {
  outline: none;
  box-shadow: var(--shadow-input-focus);
}

/* Style card details */
.style-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius);
  white-space: pre-wrap;
}

.style-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.style-url {
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

/* ===== Skeleton ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-input) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  margin-bottom: 12px;
  border: none;
  box-shadow: var(--shadow-input);
  border-radius: var(--radius-sm);
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-line:last-child {
  margin-bottom: 0;
  width: 60%;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }

/* ===== Progress indicator ===== */
.progress-wrap {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: none;
  box-shadow: var(--shadow-input);
}

.progress-step {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.progress-bar {
  height: 6px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 5%;
  background: linear-gradient(90deg, var(--accent), #52525b);
  border-radius: var(--radius-sm);
  transition: width 4.5s ease;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ===== Mobile: Bottom Tab Bar + Full-width Content ===== */
@media (max-width: 768px) {
  /* -- Hide sidebar, show bottom nav -- */
  .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    border-radius: 20px 20px 0 0;
    flex-direction: column;
    z-index: 200;
    padding: 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  }

  [data-theme="dark"] .sidebar {
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
  }

  /* Hide logo on mobile */
  .sidebar .logo {
    display: none;
  }

  /* Desktop nav: hide on mobile */
  .sidebar .nav {
    display: none;
  }

  /* Mobile 5-slot bottom tab bar */
  .sidebar .mobile-bottom-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    padding: 6px 4px 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
    gap: 0;
    justify-content: space-around;
    align-items: flex-end;
    width: 100%;
  }

  .sidebar .mobile-bottom-nav .nav-item {
    flex-direction: column;
    gap: 2px;
    padding: 6px 4px 4px;
    font-size: 10px;
    min-width: 0;
    flex: 1;
    text-align: center;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
  }

  .sidebar .mobile-bottom-nav .nav-item span {
    display: block;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 48px;
  }

  .sidebar .mobile-bottom-nav .nav-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  .sidebar .mobile-bottom-nav .nav-item:not(.mobile-tab-center):hover {
    background: var(--bg-hover);
    color: var(--text-primary);
  }

  .sidebar .mobile-bottom-nav .nav-item.active {
    color: var(--accent);
    background: transparent;
  }

  .sidebar .mobile-bottom-nav .nav-item.active svg {
    stroke: var(--accent);
  }

  /* Center button: prominent circle (XHS-style) */
  .sidebar .mobile-bottom-nav .nav-item.mobile-tab-center {
    position: relative;
    top: -18px;
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #27272a, #3f3f46);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  }

  .sidebar .mobile-bottom-nav .nav-item.mobile-tab-center span {
    display: none;
  }

  .sidebar .mobile-bottom-nav .nav-item.mobile-tab-center svg {
    width: 26px;
    height: 26px;
    stroke: #fff;
  }

  .sidebar .mobile-bottom-nav .nav-item.mobile-tab-center:hover,
  .sidebar .mobile-bottom-nav .nav-item.mobile-tab-center.active {
    background: linear-gradient(135deg, #3f3f46, #52525b);
    color: #fff;
    filter: brightness(1.05);
  }

  .sidebar .mobile-bottom-nav .nav-item.mobile-tab-center.active svg {
    stroke: #fff;
  }

  /* Hide sidebar footer on mobile (login/theme/docs) */
  .sidebar .sidebar-footer {
    display: none;
  }

  /* -- App layout: vertical on mobile -- */
  #app {
    flex-direction: column;
  }

  /* -- Mobile Top Bar -- */
  .mobile-top-bar {
    display: flex;
  }

  .mobile-top-bar-menu {
    display: flex;
  }

  .mobile-drawer {
    display: flex;
  }

  .mobile-drawer-body .page-header {
    padding-top: 0;
    margin-bottom: 16px;
  }

  .mobile-drawer-body .card {
    margin-bottom: 16px;
  }

  .tab-content.mobile-only-tab {
    display: none;
  }

  .tab-content.mobile-only-tab.active {
    display: block;
  }

  /* -- Main content: full width, add bottom padding for tab bar -- */
  .main {
    margin-left: 0;
    padding: 0 16px 100px;
    max-width: 100%;
    width: 100%;
  }

  /* Mobile home: 2x2 grid */
  .mobile-home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 28px;
  }

  .mobile-home-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 16px;
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    color: var(--text-primary);
    text-decoration: none;
    transition: transform var(--transition), box-shadow var(--transition);
  }

  .mobile-home-grid-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
  }

  .mobile-home-grid-item:active {
    transform: translateY(0);
  }

  .mobile-home-grid-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--accent-bg);
    color: var(--accent);
  }

  .mobile-home-grid-icon svg {
    width: 28px;
    height: 28px;
  }

  .mobile-home-grid-label {
    font-size: 0.9375rem;
    font-weight: 600;
  }

  .mobile-home-recent-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
  }

  .mobile-home-recent-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
  }

  .mobile-home-recent-scroll::-webkit-scrollbar {
    display: none;
  }

  .mobile-home-recent-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    min-width: 100%;
  }

  .mobile-home-recent-card {
    flex: 0 0 160px;
    padding: 14px;
    background: var(--bg-card);
    border-radius: 14px;
    box-shadow: var(--shadow-input);
    cursor: pointer;
    transition: box-shadow var(--transition);
  }

  .mobile-home-recent-card:hover {
    box-shadow: var(--shadow-hover);
  }

  .mobile-home-recent-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .mobile-home-recent-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
  }

  /* Mobile "我的" page */
  .mobile-me-page {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .mobile-me-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--stroke);
  }

  .mobile-me-section:last-child {
    border-bottom: none;
  }

  .mobile-me-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
  }

  .mobile-me-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 0;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9375rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
  }

  .mobile-me-link svg {
    color: var(--text-muted);
  }

  .mobile-me-link-btn {
    text-align: left;
  }

  .mobile-me-logout {
    width: 100%;
    justify-content: center;
    color: var(--text-muted);
  }

  .mobile-me-section .invitation-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
  }

  .mobile-me-section .invitation-input-row input {
    flex: 1;
    min-width: 0;
  }

  /* Page header: compact on mobile */
  .page-header {
    margin-bottom: 20px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 6px;
  }

  .subtitle {
    font-size: 0.875rem;
  }

  /* Cards: reduce padding */
  .card {
    padding: 20px 16px;
    margin-bottom: 16px;
    border-radius: 20px;
  }

  .card-header {
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-title {
    font-size: 1rem;
    margin-bottom: 14px;
  }

  .card-header .card-title {
    margin-bottom: 0;
  }

  /* Forms: stack vertically */
  .form-row {
    flex-direction: column;
    gap: 14px;
  }

  .form-group.flex-1 {
    min-width: 100%;
  }

  .form-group.form-action {
    padding-bottom: 0;
  }

  .form-group.form-action .btn {
    width: 100%;
  }

  /* Script form field cards: stack */
  .script-form .form-field-cards {
    flex-direction: column;
    gap: 12px;
  }

  .script-form .form-field-card--narrow,
  .script-form .form-field-card--wide {
    flex: 1 1 100%;
  }

  .script-form .form-field-card {
    padding: 16px;
  }

  /* Buttons: ensure min touch target */
  .btn {
    min-height: 44px;
    padding: 0 16px;
    font-size: 14px;
  }

  .btn-sm {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }

  .btn-generate-script {
    width: 100%;
  }

  /* Input / Select: larger touch target */
  input[type="text"],
  input[type="url"],
  input[type="number"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px; /* Prevent iOS zoom */
    padding: 14px 16px;
    border-radius: 14px;
  }

  select {
    padding-right: 40px;
  }

  /* Pills: slightly larger on mobile */
  .pill .pill-text {
    padding: 10px 18px;
    font-size: 14px;
  }

  /* Toast: bottom on mobile, above tab bar */
  #toast-container {
    top: auto;
    bottom: 90px;
    left: 16px;
    right: 16px;
    max-width: none;
  }

  .toast-item {
    transform: translateY(120%);
  }

  .toast-item.show {
    transform: translateY(0);
  }

  /* List items: more compact */
  .list-item {
    padding: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .list-item-actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Modal: full-width bottom sheet on mobile */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal.modal-wide,
  .modal.modal--wide {
    max-width: 100%;
  }

  .modal-actions {
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }

  /* Script result header: stack buttons */
  #script-result .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #script-result .card-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  /* Scene cards */
  .scene-card {
    padding: 14px 16px;
    border-radius: 14px;
  }

  /* History grid: single column */
  .history-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .shelf-card {
    padding: 18px 16px 14px;
  }

  /* Community grid: single column */
  .community-works-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Pricing cards: single column */
  .pricing-cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .pricing-card {
    padding: 24px 20px 20px;
  }

  /* Analysis grid: 2 columns on mobile */
  .analysis-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .analysis-item {
    padding: 12px;
  }

  /* Builtin sources: 1 column */
  .builtin-sources-grid {
    grid-template-columns: 1fr;
  }

  /* Grid 2: already handled above 900px but ensure it's 1 col */
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* History toolbar */
  .history-toolbar {
    justify-content: center;
  }

  .history-quick-input {
    width: 100%;
    flex: 1;
  }

  .history-quick-jump {
    width: 100%;
  }

  /* Community toolbar */
  .community-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .community-sort {
    justify-content: center;
  }

  /* Download menus: action sheet style on mobile */
  .shelf-download-menu,
  .result-download-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    margin-top: 0;
    border-radius: 20px 20px 0 0;
    padding: 16px 0 env(safe-area-inset-bottom, 16px);
    z-index: 300;
    min-width: auto;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
  }

  [data-theme="dark"] .shelf-download-menu,
  [data-theme="dark"] .result-download-menu {
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4);
  }

  .shelf-download-menu::before,
  .result-download-menu::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--text-muted);
    opacity: 0.3;
    margin: 0 auto 12px;
  }

  .shelf-download-menu button,
  .result-download-menu button {
    padding: 14px 20px;
    font-size: 0.9375rem;
  }

  /* Cover style item: stack on mobile */
  .cover-style-item {
    flex-direction: column;
    gap: 10px;
  }

  .cover-style-thumb {
    width: 100%;
    height: auto;
    max-height: 120px;
    border-radius: 12px;
  }

  /* Cover edit grid */
  .cover-edit-body .cover-edit-grid {
    grid-template-columns: 1fr;
  }

  .cover-edit-body .shot-type-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Checkbox / pill group: wrap nicely */
  .checkbox-group {
    gap: 10px;
  }

  .checkbox {
    font-size: 14px;
  }

  .checkbox input {
    width: 18px;
    height: 18px;
  }

  /* Skeleton rows */
  .skeleton-row {
    padding: 14px;
  }

  /* Background orbs: reduce on mobile */
  .bg-orb--1 {
    width: 70vw;
    height: 70vw;
    top: -15%;
    left: -20%;
  }

  .bg-orb--2 {
    width: 60vw;
    height: 60vw;
    bottom: -10%;
    right: -15%;
  }

  /* Thumbnail preview */
  .thumbnail-preview {
    max-width: 100%;
  }

  /* Safe area padding for bottom */
  .sidebar {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* ===== Extra Small Screens (< 380px) ===== */
@media (max-width: 380px) {
  .main {
    padding: 0 12px 100px;
  }

  .card {
    padding: 16px 12px;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  .sidebar .nav-item span {
    font-size: 9px;
    max-width: 44px;
  }

  .sidebar .nav-item svg {
    width: 18px;
    height: 18px;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }
}

/* 改写模式说明：纯文字，无边框无背景，不抢视线 */
.rewrite-mode-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: var(--line-height);
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

/* Utility classes */
.label-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
  opacity: var(--editorial-italic-opacity);
}
.text-muted {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* Script ID badge */
.script-id-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ===== 历史脚本：纵向网格布局 ===== */
.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.history-quick-jump {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-quick-input {
  width: 200px;
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: none;
  box-shadow: var(--shadow-input);
  font-size: 14px;
  background: var(--bg-input);
}

.history-quick-input:focus {
  outline: none;
  box-shadow: var(--shadow-input-focus);
}

/* 网格 */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* 卡片 */
.shelf-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 22px 18px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  overflow: visible;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: var(--shadow);
}

.shelf-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.shelf-card:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--border-focus);
}

.shelf-card:focus:not(:focus-visible) {
  box-shadow: var(--shadow);
}

.shelf-card-body {
  flex: 1;
  min-width: 0;
}

.shelf-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shelf-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.shelf-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--stroke);
}

.shelf-card-id {
  display: inline-block;
  font-size: 0.6875rem;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.shelf-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shelf-card-actions .btn {
  flex-shrink: 0;
}

.shelf-btn-delete:hover {
  color: var(--danger, #c53030);
}

.shelf-btn-edit:hover {
  color: var(--accent);
}

/* 下载下拉（通用） */
.shelf-download-wrap,
.result-download-wrap {
  position: relative;
  display: inline-block;
}

.shelf-btn-download {
  white-space: nowrap;
}

.shelf-download-menu,
.result-download-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 200px;
  padding: 6px 0;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--stroke);
  z-index: 50;
}

.shelf-download-menu.show,
.result-download-menu.show {
  display: block;
}

.shelf-download-menu button,
.result-download-menu button {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.shelf-download-menu button:hover,
.result-download-menu button:hover {
  background: var(--bg-hover);
}

/* 脚本架下载菜单分组 */
.shelf-download-group-label {
  padding: 4px 14px 2px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.shelf-download-divider {
  height: 1px;
  margin: 4px 10px;
  background: var(--stroke);
}

/* ===== User area (sidebar) ===== */
.user-area {
  padding: var(--sidebar-inset) 0;
  border-top: 1px solid var(--stroke);
}
.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.user-email {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ===== Pricing ===== */
.pricing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

/* 基础卡片 */
.pricing-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

/* 推荐卡片：深色背景，反转文字 */
.pricing-card--recommended {
  background: linear-gradient(160deg, #1a1a1a 0%, #2d2d30 50%, #3f3f46 100%);
  color: #f4f4f5;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}
[data-theme="dark"] .pricing-card--recommended {
  background: linear-gradient(160deg, #2a2d3a 0%, #353848 50%, #40445a 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.pricing-card--recommended:hover {
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.18);
}
.pricing-card--recommended .pricing-card-title,
.pricing-card--recommended .pricing-card-price {
  color: #fff;
}
.pricing-card--recommended .pricing-card-unit,
.pricing-card--recommended .pricing-card-yearly,
.pricing-card--recommended .pricing-card-features li span {
  color: #d4d4d8;
}
.pricing-card--recommended .pricing-card-features li svg {
  stroke: #a1a1aa;
}
.pricing-card--recommended .pricing-card-divider {
  background: rgba(255, 255, 255, 0.1);
}

/* 试用卡片：低调 */
.pricing-card--trial {
  opacity: 0.85;
}
.pricing-card--trial:hover {
  opacity: 1;
}

/* 推荐徽章 */
.pricing-badge {
  position: absolute;
  top: -10px;
  right: 20px;
  background: linear-gradient(135deg, #27272a, #52525b);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 4px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
[data-theme="dark"] .pricing-badge {
  background: linear-gradient(135deg, #fafafa, #d4d4d8);
  color: #18181b;
}

/* 图标 */
.pricing-card-icon {
  margin-bottom: 16px;
  opacity: 0.55;
}
.pricing-card--recommended .pricing-card-icon {
  opacity: 0.7;
}

/* 标题 */
.pricing-card-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  margin: 0 0 16px 0;
}

/* 价格行 */
.pricing-card-price-row {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-bottom: 4px;
}
.pricing-card-price {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1;
}
.pricing-card-unit {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* 年付提示 */
.pricing-card-yearly {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  min-height: 18px;
}
.pricing-card-yearly-placeholder {
  min-height: 18px;
}

/* 分隔线 */
.pricing-card-divider {
  width: 100%;
  height: 1px;
  background: var(--stroke);
  margin: 20px 0;
}

/* 功能列表 */
.pricing-card-features {
  list-style: none;
  padding: 0;
  margin: 0 0 auto 0;
  width: 100%;
  text-align: left;
}
.pricing-card-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.pricing-card-features li svg {
  flex-shrink: 0;
  stroke: var(--success);
}

/* 底部按钮 */
.pricing-card-action {
  width: 100%;
  margin-top: 24px;
}
.pricing-card-action .btn {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-sm);
}
.pricing-card-action .btn:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: default;
  filter: none;
}
/* 推荐按钮反转色 */
.btn-accent {
  background: #fff;
  color: #18181b;
  font-weight: 600;
}
.btn-accent:hover {
  background: #f4f4f5;
}
[data-theme="dark"] .btn-accent {
  background: #fafafa;
  color: #18181b;
}
[data-theme="dark"] .btn-accent:hover {
  background: #e4e4e7;
}

/* Dashboard 用量 */
.pricing-dashboard {
  display: grid;
  gap: 20px;
  margin-bottom: 32px;
}
.quota-summary {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

/* 支付弹窗 */
.payment-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.payment-modal-backdrop .modal { max-width: 380px; }
.qrcode-wrap { text-align: center; padding: 20px; background: #fff; border-radius: var(--radius-sm); margin: 16px 0; }
.qrcode-wrap canvas { max-width: 100%; }
.payment-desc, .payment-order { font-size: 0.875rem; color: var(--text-secondary); margin-top: 8px; }

/* ===== Auth modal ===== */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.auth-tab {
  padding: 8px 16px;
  border: none;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.auth-tab.active {
  background: var(--accent);
  color: var(--bg-primary);
}
.auth-form .form-group { margin-bottom: 16px; }
.auth-form .btn { width: 100%; margin-top: 8px; }

/* ===== Community Works ===== */
.community-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.community-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sort-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.community-sort .sort-btn.active {
  background: var(--accent-bg);
  color: var(--accent);
}
.community-works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.community-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.community-card:hover {
  box-shadow: var(--shadow-hover);
}
.community-card-body {
  padding: 18px;
  flex: 1;
  cursor: pointer;
  min-height: 0;
}
.community-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.community-card-author {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 8px 0;
}
.community-card-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.community-card-stats {
  display: flex;
  gap: 16px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.community-card-stats .stat-icon {
  margin-right: 2px;
}
.community-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--stroke);
  background: var(--bg-secondary);
}
.community-btn-like.active,
.community-btn-fav.active {
  color: var(--accent);
}
.community-btn-unpublish {
  color: var(--text-muted);
}
.community-btn-unpublish:hover {
  color: var(--danger, #c53030);
}
.load-more-wrap {
  text-align: center;
  margin-top: 24px;
}
.community-publish-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.modal--wide {
  max-width: 640px;
}
.community-detail-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.community-detail-content {
  max-height: 60vh;
  overflow-y: auto;
}
.community-detail-content .scene-header,
.community-detail-content .section-title {
  margin-top: 16px;
  margin-bottom: 8px;
  font-size: 0.9375rem;
}
.community-detail-content .scene-block,
.community-detail-content .prompt-item {
  margin-bottom: 12px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-close-btn {
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 8px;
  min-width: auto;
}

/* ===== Builtin Sources Grid ===== */
.builtin-sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.builtin-source-card {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-input);
}

.builtin-source-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.builtin-source-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.builtin-source-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* 高级版时长选项 */
.premium-option {
  color: #b8860b;
}

/* ===== 内测邀请码模块 ===== */
.invitation-code-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, color-mix(in srgb, var(--bg-card) 90%, #6366f1) 100%);
  border: 1px solid color-mix(in srgb, var(--border) 80%, #6366f1 20%);
}

.invitation-code-card .card-title svg {
  stroke: #6366f1;
}

.invitation-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.invitation-form {
  margin-bottom: 0;
}

.invitation-input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.invitation-input-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.invitation-input-row input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.invitation-input-row input::placeholder {
  text-transform: none;
  letter-spacing: normal;
  font-family: inherit;
}

.invitation-input-row .btn {
  min-width: 90px;
  flex-shrink: 0;
  border-radius: 10px;
  font-weight: 600;
}

/* 我的邀请码区域 */
.my-invite-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}

.my-invite-code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 8px;
}

.my-invite-code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #6366f1;
  background: color-mix(in srgb, var(--bg-card) 60%, #6366f1 8%);
  padding: 8px 18px;
  border-radius: 8px;
  border: 1.5px dashed color-mix(in srgb, #6366f1 40%, var(--border));
  user-select: all;
}

.my-invite-stats {
  font-size: 13px;
  color: var(--text-muted);
}

.my-invite-stats strong {
  color: #6366f1;
  font-weight: 700;
}

.redeem-section {
  margin-bottom: 0;
}

.invitation-bonus-info {
  margin-top: 14px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg-card) 50%, transparent);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.bonus-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bonus-label {
  font-size: 13px;
  font-weight: 600;
  color: #6366f1;
  white-space: nowrap;
}

.bonus-value {
  font-size: 13px;
  color: var(--text-secondary);
}

.bonus-value strong {
  color: #6366f1;
  font-size: 16px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .invitation-input-row {
    flex-direction: column;
  }
  .invitation-input-row .btn {
    min-width: unset;
  }
}

/* ===== Article Input Tabs ===== */
.article-input-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.article-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: var(--letter-spacing);
}

.article-tab:hover {
  color: var(--text-primary);
}

.article-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}

.article-tab-panel {
  display: none;
}

.article-tab-panel.active {
  display: block;
}

/* File upload area */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
}

.file-upload-area:hover,
.file-upload-area.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.04);
}

.file-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 14px;
}

.file-upload-icon {
  font-size: 28px;
  line-height: 1;
}

.file-upload-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.file-upload-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.file-upload-info .file-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

