/* ==========================================================================
   随手工具箱 — 设计系统
   复刻自 tools.zhuangyou.net 的视觉规范（靛蓝 #6366f1 + 暖橙 #f97316）
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Geist+Mono:wght@300;400;500;600&display=swap');

/* ---------- 1. 设计令牌 ---------- */
:root {
  --font-display: "Outfit", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "Geist Mono", "SF Mono", Consolas, "JetBrains Mono", monospace;

  --color-primary: #1a1f36;
  --color-primary-light: #2d3748;
  --color-primary-lighter: #4a5568;
  --color-surface: #ffffff;
  --color-surface-elevated: #f8fafc;
  --color-surface-card: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;

  --brand-primary: #6366f1;
  --brand-primary-light: #818cf8;
  --brand-primary-dark: #4f46e5;
  --brand-soft: #eef2ff;

  --accent-warm: #f97316;
  --accent-warm-light: #fb923c;
  --accent-warm-dark: #ea580c;

  --success: #10b981;
  --success-light: #34d399;
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --error: #ef4444;
  --error-light: #f87171;

  --border-subtle: #e2e8f0;
  --border-default: #cbd5e1;
  --border-strong: #94a3b8;
  --bg-subtle: #f1f5f9;
  --bg-muted: #e2e8f0;
  --bg-brand: #eff6ff;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .04);
  --shadow-brand: 0 4px 14px 0 rgba(99, 102, 241, .15);
  --shadow-brand-lg: 0 8px 30px 0 rgba(99, 102, 241, .25);
  --shadow-warm: 0 4px 14px 0 rgba(249, 115, 22, .15);

  --space-xs: .25rem;
  --space-sm: .5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  --radius-sm: .375rem;
  --radius-md: .5rem;
  --radius-lg: .75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  --transition-fast: .15s cubic-bezier(.4, 0, .2, 1);
  --transition-base: .2s cubic-bezier(.4, 0, .2, 1);
  --transition-slow: .3s cubic-bezier(.4, 0, .2, 1);

  --nav-height: 76px;
  --page-max: 1240px;
}

/* ---------- 暗色主题 ---------- */
html[data-theme="dark"] {
  --color-primary: #e2e8f0;
  --color-primary-light: #cbd5e1;
  --color-primary-lighter: #94a3b8;
  --color-surface: #0b1120;
  --color-surface-elevated: #111827;
  --color-surface-card: #131a2b;

  --text-primary: #e8edf7;
  --text-secondary: #9aa8bf;
  --text-tertiary: #64748b;
  --text-inverse: #0b1120;

  --border-subtle: #23304a;
  --border-default: #33415c;
  --border-strong: #4a5a78;
  --bg-subtle: #182238;
  --bg-muted: #23304a;
  --bg-brand: #1b2440;
  --brand-soft: #1e2744;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .45);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .55);
}

/* ---------- 2. 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--color-surface-elevated);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
p { margin: 0; }
a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-primary-dark); }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--brand-primary); color: #fff; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: content-box; }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. 导航栏 ---------- */
.navbar {
  position: sticky; top: 0; z-index: 300;
  height: var(--nav-height);
  background: color-mix(in srgb, var(--color-surface-card) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}
.navbar-container {
  max-width: var(--page-max); height: 100%; margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-xl);
}
.navbar-brand { display: flex; align-items: center; gap: var(--space-md); cursor: pointer; background: none; border: 0; padding: 0; }
.navbar-logo-mark {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: 800;
  box-shadow: var(--shadow-brand);
  transition: transform var(--transition-base);
}
.navbar-brand:hover .navbar-logo-mark { transform: rotate(-8deg) scale(1.05); }
.navbar-logo { font-size: 1.4rem; font-weight: 700; margin: 0; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 3px; }
.logo-main { color: var(--color-primary); }
.logo-accent { color: var(--brand-primary); }
.version {
  padding: 2px 8px; background: var(--bg-brand); color: var(--brand-primary);
  border-radius: var(--radius-md); font-size: .72rem; font-weight: 600;
  font-family: var(--font-mono); align-self: center;
}
.navbar-menu { display: flex; align-items: center; gap: var(--space-md); }
.nav-link {
  padding: 8px 14px; border-radius: var(--radius-md); border: 0; background: transparent;
  color: var(--text-secondary); font-size: .92rem; font-weight: 500; cursor: pointer;
  transition: all var(--transition-base);
}
.nav-link:hover { background: var(--bg-subtle); color: var(--text-primary); }
.nav-link.active { background: var(--bg-brand); color: var(--brand-primary); }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle); background: var(--color-surface-card);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-base);
}
.icon-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); transform: translateY(-1px); }
.badge-count {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; background: var(--bg-brand); border: 1px solid var(--brand-primary);
  border-radius: var(--radius-full); font-size: 13px; font-weight: 500; color: var(--brand-primary);
}
.badge-count strong { color: var(--brand-primary-dark); }

/* ---------- 4. 布局 ---------- */
.page { max-width: var(--page-max); margin: 0 auto; padding: var(--space-2xl) var(--space-lg) var(--space-3xl); }

/* ---------- 5. 首页 Hero ---------- */
.hero-section { text-align: center; max-width: 820px; margin: 0 auto var(--space-2xl); }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; margin-bottom: var(--space-lg);
  background: var(--bg-brand); border: 1px solid color-mix(in srgb, var(--brand-primary) 30%, transparent);
  border-radius: var(--radius-full); font-size: .82rem; font-weight: 600; color: var(--brand-primary-dark);
}
.hero-eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.hero-title { font-size: 3rem; font-weight: 800; line-height: 1.12; margin-bottom: var(--space-lg); letter-spacing: -.03em; color: var(--text-primary); }
.hero-title .accent {
  background: linear-gradient(100deg, var(--brand-primary), var(--accent-warm));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-description { font-size: 1.08rem; color: var(--text-secondary); line-height: 1.75; max-width: 640px; margin: 0 auto; }

.hero-stats { display: flex; justify-content: center; gap: var(--space-2xl); flex-wrap: wrap; margin-top: var(--space-xl); }
.hero-stat { text-align: center; }
.hero-stat-value { font-size: 1.75rem; font-weight: 800; color: var(--brand-primary); font-family: var(--font-mono); letter-spacing: -.02em; }
.hero-stat-label { font-size: .8rem; color: var(--text-tertiary); margin-top: 2px; }

/* ---------- 6. 搜索与筛选 ---------- */
.search-box-wrapper { width: 100%; max-width: 620px; margin: var(--space-xl) auto var(--space-md); display: flex; flex-direction: column; gap: var(--space-sm); }
.search-box {
  position: relative; display: flex; align-items: center;
  background: var(--color-surface-card); border: 2px solid var(--border-subtle);
  border-radius: var(--radius-full); padding: 14px 22px;
  transition: all var(--transition-base); box-shadow: var(--shadow-sm);
}
.search-box:focus-within { border-color: var(--brand-primary); box-shadow: var(--shadow-brand); transform: translateY(-2px); }
.search-icon { flex-shrink: 0; width: 20px; height: 20px; color: var(--text-tertiary); margin-right: var(--space-md); transition: color var(--transition-base); }
.search-box:focus-within .search-icon { color: var(--brand-primary); }
.search-input { flex: 1; border: none; background: transparent; outline: none; font-size: 1rem; color: var(--text-primary); min-width: 0; }
.search-input::placeholder { color: var(--text-tertiary); }
.search-clear {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: var(--radius-full); border: none;
  background: var(--bg-muted); color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all var(--transition-base);
}
.search-clear:hover { background: var(--bg-subtle); color: var(--text-primary); }
.search-clear[hidden] { display: none; }

.filter-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.filter-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle); background: var(--color-surface-card);
  color: var(--text-secondary); font-size: .9rem; font-weight: 500; cursor: pointer;
  transition: all var(--transition-base);
}
.filter-tab:hover { border-color: var(--brand-primary); color: var(--brand-primary); transform: translateY(-1px); }
.filter-tab.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; box-shadow: var(--shadow-brand); }
.filter-tab .tab-count {
  font-family: var(--font-mono); font-size: .74rem; padding: 1px 6px;
  border-radius: 99px; background: var(--bg-subtle); color: var(--text-tertiary);
}
.filter-tab.active .tab-count { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- 7. 分区标题 ---------- */
.section-header { display: flex; align-items: center; gap: var(--space-lg); margin: var(--space-2xl) 0 var(--space-xl); }
.section-icon { font-size: 1.5rem; }
.section-title { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.01em; white-space: nowrap; }
.section-divider { flex: 1; height: 1px; background: linear-gradient(to right, var(--border-subtle), color-mix(in srgb, var(--brand-primary) 55%, transparent), transparent); }
.section-count { font-family: var(--font-mono); font-size: .82rem; color: var(--text-tertiary); white-space: nowrap; }

/* ---------- 8. 工具卡片网格 ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-lg); }
.tool-card {
  position: relative; display: flex; gap: var(--space-md); padding: var(--space-lg);
  background: var(--color-surface-card); border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle); cursor: pointer; overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  text-align: left; font-family: inherit; width: 100%;
}
.tool-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand-primary), var(--accent-warm));
  opacity: 0; transition: opacity var(--transition-base);
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand-primary) 40%, transparent); }
.tool-card:hover::before { opacity: 1; }

.tool-icon {
  flex-shrink: 0; width: 52px; height: 52px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; font-size: 26px; line-height: 1;
  background: var(--brand-soft); transition: transform var(--transition-slow), filter var(--transition-slow);
}
.tool-card:hover .tool-icon { transform: rotate(360deg) scale(1.06); filter: drop-shadow(0 8px 16px rgba(99, 102, 241, .4)); }

.tool-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tool-head { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.tool-name { font-size: 1.02rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.01em; }
.tool-category {
  display: inline-block; padding: 2px 9px; background: var(--bg-brand); color: var(--brand-primary);
  font-size: .68rem; font-weight: 600; border-radius: var(--radius-full);
  letter-spacing: .04em; text-transform: uppercase;
}
.tool-desc { font-size: .86rem; color: var(--text-secondary); line-height: 1.55; }
.tool-action {
  margin-top: auto; display: inline-flex; align-items: center; gap: 5px;
  font-size: .82rem; font-weight: 600; color: var(--brand-primary);
  opacity: 0; transform: translateX(-6px); transition: all var(--transition-base);
}
.tool-card:hover .tool-action { opacity: 1; transform: translateX(0); }
.tool-action svg { transition: transform var(--transition-base); }
.tool-card:hover .tool-action svg { transform: translateX(4px); }

.empty-search { text-align: center; padding: var(--space-3xl) var(--space-xl); }
.empty-search .empty-icon { font-size: 4rem; margin-bottom: var(--space-lg); opacity: .5; }
.empty-search .empty-title { font-size: 1.2rem; color: var(--text-primary); margin-bottom: var(--space-sm); font-weight: 600; }
.empty-search .empty-text { color: var(--text-tertiary); font-size: .9rem; }

/* ---------- 9. 工具工作台 ---------- */
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: var(--space-lg); font-size: .88rem; color: var(--text-tertiary); flex-wrap: wrap; }
.breadcrumb button {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand-primary); font-size: .88rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
}
.breadcrumb button:hover { color: var(--brand-primary-dark); text-decoration: underline; }
.breadcrumb .sep { opacity: .5; }
.breadcrumb .current { color: var(--text-secondary); font-weight: 600; }

.tool-header { display: flex; align-items: flex-start; gap: var(--space-lg); margin-bottom: var(--space-xl); flex-wrap: wrap; }
.tool-header-icon {
  flex-shrink: 0; width: 60px; height: 60px; border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  background: var(--brand-soft); box-shadow: var(--shadow-sm);
}
.tool-header-text { flex: 1; min-width: 240px; }
.tool-header-title { font-size: 1.75rem; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; letter-spacing: -.02em; }
.tool-header-desc { font-size: .95rem; color: var(--text-secondary); line-height: 1.65; }
.privacy-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  padding: 5px 12px; border-radius: var(--radius-full); font-size: .78rem; font-weight: 600;
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: color-mix(in srgb, var(--success) 85%, var(--text-primary));
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}

.workbench { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
.wb-col { display: flex; flex-direction: column; gap: var(--space-lg); min-width: 0; }

.panel {
  background: var(--color-surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl); padding: var(--space-lg); box-shadow: var(--shadow-sm);
}
.panel-title {
  font-size: .95rem; font-weight: 700; color: var(--text-primary);
  margin-bottom: var(--space-md); display: flex; align-items: center; gap: 8px;
}
.panel-title .step-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; font-family: var(--font-mono);
}

/* 上传区 */
.dropzone {
  border: 2px dashed var(--border-default); border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg); text-align: center; cursor: pointer;
  background: var(--color-surface-elevated); transition: all var(--transition-base);
}
.dropzone:hover { border-color: var(--brand-primary); background: var(--brand-soft); }
.dropzone.dragover { border-color: var(--brand-primary); background: var(--brand-soft); transform: scale(1.01); box-shadow: var(--shadow-brand); }
.dropzone-icon { font-size: 2.4rem; margin-bottom: var(--space-sm); line-height: 1; }
.dropzone-title { font-size: .95rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.dropzone-hint { font-size: .8rem; color: var(--text-tertiary); }
.dropzone-hint b { color: var(--brand-primary); font-weight: 600; }

/* 文件列表 */
.file-list { display: flex; flex-direction: column; gap: var(--space-sm); margin-top: var(--space-md); }
.file-item {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 10px 12px; background: var(--color-surface-elevated);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  font-size: .86rem; transition: all var(--transition-base);
}
.file-item:hover { border-color: var(--border-default); }
.file-item.dragging { opacity: .4; }
.file-item.drag-over { border-color: var(--brand-primary); box-shadow: inset 0 2px 0 var(--brand-primary); }
.file-handle { cursor: grab; color: var(--text-tertiary); flex-shrink: 0; display: flex; }
.file-thumb {
  width: 38px; height: 38px; border-radius: var(--radius-sm); flex-shrink: 0;
  object-fit: cover; background: var(--bg-muted);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.file-meta { flex: 1; min-width: 0; }
.file-name { color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { color: var(--text-tertiary); font-size: .76rem; font-family: var(--font-mono); }
.file-remove {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-tertiary); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all var(--transition-base);
}
.file-remove:hover { background: color-mix(in srgb, var(--error) 12%, transparent); color: var(--error); }

/* 表单控件 */
.field { margin-bottom: var(--space-md); }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: .84rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px;
}
.field-optional { font-size: .74rem; font-weight: 400; color: var(--text-tertiary); }
.field-value { font-family: var(--font-mono); font-size: .82rem; color: var(--brand-primary); font-weight: 600; }

.form-input, .form-select, .form-textarea {
  width: 100%; padding: 11px 14px;
  background: var(--color-surface-elevated); border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md); font-size: .92rem; color: var(--text-primary);
  outline: none; transition: all var(--transition-base);
}
.form-textarea { resize: vertical; min-height: 90px; line-height: 1.6; font-family: var(--font-mono); font-size: .86rem; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-primary); background: var(--color-surface-card); box-shadow: var(--shadow-brand);
}
.form-select {
  appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.form-row { display: flex; gap: var(--space-sm); align-items: center; }
.form-row > * { flex: 1; min-width: 0; }

input[type="range"] {
  width: 100%; height: 6px; appearance: none; -webkit-appearance: none;
  background: var(--bg-muted); border-radius: 99px; outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand-primary); border: 3px solid var(--color-surface-card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: grab; transition: transform var(--transition-fast);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.18); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--brand-primary);
  border: 3px solid var(--color-surface-card); cursor: grab;
}
input[type="color"] {
  width: 100%; height: 42px; padding: 3px; cursor: pointer;
  background: var(--color-surface-elevated); border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand-primary); cursor: pointer; }

.check-line {
  display: flex; align-items: center; gap: 9px; padding: 8px 0;
  font-size: .88rem; color: var(--text-secondary); cursor: pointer;
}
.check-line input { width: 16px; height: 16px; flex-shrink: 0; }

.seg-group { display: flex; background: var(--bg-subtle); padding: 3px; border-radius: var(--radius-md); gap: 2px; }
.seg-btn {
  flex: 1; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary);
  font-size: .84rem; font-weight: 600; cursor: pointer; transition: all var(--transition-base);
  white-space: nowrap;
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.active { background: var(--color-surface-card); color: var(--brand-primary); box-shadow: var(--shadow-sm); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-lg); border: 1.5px solid transparent;
  font-size: .92rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition-base); white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-primary { background: var(--brand-primary); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-primary-dark); transform: translateY(-2px); box-shadow: var(--shadow-brand-lg); }
.btn-warm { background: var(--accent-warm); color: #fff; box-shadow: var(--shadow-warm); }
.btn-warm:hover:not(:disabled) { background: var(--accent-warm-dark); transform: translateY(-2px); }
.btn-ghost { background: var(--color-surface-card); border-color: var(--border-default); color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brand-primary); color: var(--brand-primary); transform: translateY(-2px); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 15px; font-size: .84rem; border-radius: var(--radius-md); }
.btn-row { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 130px; }

/* 预览区 */
.preview-stage {
  min-height: 300px; border-radius: var(--radius-lg); overflow: auto;
  background:
    linear-gradient(45deg, var(--bg-subtle) 25%, transparent 25%, transparent 75%, var(--bg-subtle) 75%),
    linear-gradient(45deg, var(--bg-subtle) 25%, transparent 25%, transparent 75%, var(--bg-subtle) 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px;
  border: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center; padding: var(--space-lg);
  position: relative;
}
.preview-stage img, .preview-stage canvas, .preview-stage video {
  max-width: 100%; max-height: 460px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); display: block; object-fit: contain;
}
.preview-placeholder { text-align: center; color: var(--text-tertiary); font-size: .9rem; padding: var(--space-xl); }
.preview-placeholder .ph-icon { font-size: 3rem; margin-bottom: var(--space-sm); opacity: .4; }

.preview-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-sm); }
.preview-thumb {
  position: relative; border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--border-subtle); background: var(--color-surface-elevated);
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview-thumb .idx {
  position: absolute; top: 4px; left: 4px; padding: 1px 6px;
  background: rgba(15, 23, 42, .72); color: #fff; border-radius: 99px;
  font-size: .66rem; font-family: var(--font-mono);
}
.preview-thumb.selected { outline: 2px solid var(--brand-primary); outline-offset: -2px; }

/* 统计 / 结果 */
.result-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-md);
  padding: 14px var(--space-lg); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--success) 10%, var(--color-surface-card));
  border: 1px solid color-mix(in srgb, var(--success) 32%, transparent);
  flex-wrap: wrap;
}
.result-bar .rb-main { display: flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 600; color: var(--text-primary); }
.result-bar .rb-sub { font-size: .8rem; color: var(--text-secondary); font-family: var(--font-mono); margin-top: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-sm); }
.stat-box {
  padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--color-surface-elevated); border: 1px solid var(--border-subtle); text-align: center;
}
.stat-box .v { font-size: 1.15rem; font-weight: 700; color: var(--brand-primary); font-family: var(--font-mono); }
.stat-box .l { font-size: .74rem; color: var(--text-tertiary); margin-top: 2px; }

/* 进度条 */
.progress-track { height: 8px; border-radius: 99px; background: var(--bg-muted); overflow: hidden; margin-top: 10px; }
.progress-fill {
  height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand-primary), var(--accent-warm));
  transition: width .2s ease;
}
.progress-text { font-size: .8rem; color: var(--text-secondary); text-align: center; margin-top: 6px; font-family: var(--font-mono); }

/* 空状态 */
.empty-state { text-align: center; padding: var(--space-3xl) var(--space-lg); }
.empty-state .es-icon { font-size: 3.4rem; opacity: .35; margin-bottom: var(--space-md); }
.empty-state .es-title { font-size: 1.05rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.empty-state .es-text { font-size: .86rem; color: var(--text-tertiary); }

/* ---------- 10. Toast ---------- */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 12px; pointer-events: none;
}
.toast-item {
  display: flex; align-items: flex-start; gap: 12px; min-width: 300px; max-width: 420px;
  padding: 15px 16px; background: var(--color-surface-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); border-left: 4px solid var(--brand-primary);
  pointer-events: auto; animation: toastIn .3s cubic-bezier(.4, 0, .2, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast-item.leaving { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(100%); } }
.toast-item.success { border-left-color: var(--success); }
.toast-item.error { border-left-color: var(--error); }
.toast-item.warning { border-left-color: var(--warning); }
.toast-item.info { border-left-color: var(--brand-primary); }
.toast-icon { flex-shrink: 0; font-size: 18px; line-height: 1.4; }
.toast-item.success .toast-icon { color: var(--success); }
.toast-item.error .toast-icon { color: var(--error); }
.toast-item.warning .toast-icon { color: var(--warning); }
.toast-item.info .toast-icon { color: var(--brand-primary); }
.toast-message { flex: 1; min-width: 0; font-size: .88rem; font-weight: 500; color: var(--text-primary); line-height: 1.5; }
.toast-close {
  flex-shrink: 0; width: 22px; height: 22px; border: none; background: transparent;
  color: var(--text-tertiary); cursor: pointer; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.toast-close:hover { background: var(--bg-subtle); color: var(--text-secondary); }

/* ---------- 11. 页脚 ---------- */
.footer {
  margin-top: var(--space-3xl); padding: var(--space-2xl) var(--space-lg);
  border-top: 1px solid var(--border-subtle); background: var(--color-surface-card);
}
.footer-inner { max-width: var(--page-max); margin: 0 auto; display: flex; justify-content: space-between; gap: var(--space-xl); flex-wrap: wrap; }
.footer-brand { max-width: 320px; }
.footer-desc { font-size: .86rem; color: var(--text-tertiary); margin-top: 8px; line-height: 1.65; }
.footer-links { display: flex; gap: var(--space-2xl); flex-wrap: wrap; }
.footer-col h4 { font-size: .84rem; color: var(--text-primary); margin-bottom: 10px; font-weight: 700; }
.footer-col a, .footer-col span { display: block; font-size: .84rem; color: var(--text-tertiary); margin-bottom: 6px; }
.footer-col a:hover { color: var(--brand-primary); }
.footer-bottom {
  max-width: var(--page-max); margin: var(--space-xl) auto 0; padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle); font-size: .8rem; color: var(--text-tertiary);
  display: flex; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap;
}

/* 备案信息行：居中放在版权行下面（内容由 site-beian.js 注入） */
.footer-legal { max-width: var(--page-max); margin: var(--space-md) auto 0; }

/* ---------- 备案信息条（页脚 / 登录页 / 注册页三处共用） ----------
   工信部 ICP 备案号与公安部网安备案号是**法定必须展示**的内容，
   首页、工具页、登录页、注册页都不能少，所以样式只写这一份，
   由外层容器（.footer-legal / .login-site-footer）决定它落在哪儿。
   ⚠️ 公安徽标必须用官方图（本地 assets/img/beian-gongan.png），别拿 emoji 糊弄。 */
.site-beian {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 6px 14px; font-size: .78rem; line-height: 1.5; color: var(--text-tertiary);
}

.site-beian--left { justify-content: flex-start; }

.site-beian-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-tertiary); text-decoration: none;
  transition: color var(--transition-fast);
}

.site-beian-link:hover { color: var(--brand-primary); }

/* 徽标：宽度定死、高度 auto（配合标签上的 62×67 让浏览器算出精确宽高比），
   这样图片解码前后都不会布局跳动 */
.site-beian-badge { display: block; width: 16px; height: auto; flex-shrink: 0; }

/* 两个备案号之间的小圆点分隔 */
.site-beian-sep::before { content: '·'; font-weight: 700; color: var(--border-default); }

/* 极窄屏竖排，免得两个备案号被挤成难看的断行 */
@media (max-width: 420px) {
  .site-beian { flex-direction: column; gap: 4px; }
  .site-beian-sep { display: none; }
}

/* ---------- 12. 工具专属小组件 ---------- */
.canvas-wrap { position: relative; display: inline-block; max-width: 100%; }
.canvas-wrap canvas { max-width: 100%; box-shadow: var(--shadow-md); border-radius: var(--radius-sm); display: block; }
.crop-box {
  position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .55);
  cursor: move; touch-action: none;
}
.crop-box .handle {
  position: absolute; width: 12px; height: 12px; background: #fff;
  border: 1px solid var(--brand-primary); border-radius: 2px;
}
.crop-box .handle.nw { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-box .handle.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-box .handle.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-box .handle.se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.crop-box .handle.n  { top: -6px; left: 50%; margin-left: -6px; cursor: ns-resize; }
.crop-box .handle.s  { bottom: -6px; left: 50%; margin-left: -6px; cursor: ns-resize; }
.crop-box .handle.w  { top: 50%; left: -6px; margin-top: -6px; cursor: ew-resize; }
.crop-box .handle.e  { top: 50%; right: -6px; margin-top: -6px; cursor: ew-resize; }

.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.swatch {
  border-radius: var(--radius-md); overflow: hidden; cursor: pointer;
  border: 1px solid var(--border-subtle); transition: transform var(--transition-base);
}
.swatch:hover { transform: translateY(-3px) scale(1.04); box-shadow: var(--shadow-md); }
.swatch .chip { height: 46px; }
.swatch .code { padding: 5px 4px; font-size: .68rem; font-family: var(--font-mono); text-align: center; color: var(--text-secondary); background: var(--color-surface-card); }

.timeline-wrap { height: 78px; background: var(--color-surface-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); position: relative; overflow: hidden; cursor: crosshair; }
.timeline-wave { position: absolute; inset: 0; }
.timeline-sel { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--brand-primary) 24%, transparent); border-left: 2px solid var(--brand-primary); border-right: 2px solid var(--brand-primary); }
.trim-row { display: flex; align-items: center; gap: var(--space-md); font-size: .84rem; font-family: var(--font-mono); color: var(--text-secondary); }
.trim-row .val { color: var(--brand-primary); font-weight: 600; }

.qr-preview { display: flex; flex-direction: column; align-items: center; gap: var(--space-md); }
.qr-preview canvas, .qr-preview img { border-radius: var(--radius-md); box-shadow: var(--shadow-md); }

.info-note {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--bg-brand); border: 1px solid color-mix(in srgb, var(--brand-primary) 22%, transparent);
  font-size: .84rem; color: var(--text-secondary); line-height: 1.6;
}
.info-note.warn { background: color-mix(in srgb, var(--warning) 12%, var(--color-surface-card)); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.info-note .ni-icon { flex-shrink: 0; }
.info-note b { color: var(--text-primary); }

.kbd {
  display: inline-block; padding: 1px 6px; border-radius: 5px;
  background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-bottom-width: 2px;
  font-family: var(--font-mono); font-size: .76rem; color: var(--text-secondary);
}

/* ---------- 13. 响应式 ---------- */
@media (max-width: 980px) {
  .workbench { grid-template-columns: 1fr; }
  .hero-title { font-size: 2.35rem; }
}
@media (max-width: 720px) {
  :root { --space-3xl: 2.5rem; }
  .page { padding: var(--space-lg) var(--space-md) var(--space-2xl); }
  .hero-title { font-size: 1.85rem; }
  .hero-description { font-size: .98rem; }
  .hero-stats { gap: var(--space-lg); }
  .hero-stat-value { font-size: 1.4rem; }
  .tool-grid { grid-template-columns: 1fr; }
  .navbar-container { padding: 0 var(--space-md); }
  .navbar-logo { font-size: 1.15rem; }
  .navbar-logo-mark { width: 36px; height: 36px; font-size: 17px; border-radius: 10px; }
  .nav-link { padding: 7px 10px; font-size: .84rem; }
  .section-title { font-size: 1.25rem; }
  .tool-header-title { font-size: 1.35rem; }
  .btn-row .btn { min-width: 100%; }
  .toast-container { left: 12px; right: 12px; }
  .toast-item { min-width: 0; max-width: none; }
  .footer-inner { flex-direction: column; gap: var(--space-lg); }
  .footer-links { gap: var(--space-xl); }
}
@media (max-width: 480px) {
  .filter-tab { padding: 8px 13px; font-size: .82rem; }
  .hero-title { font-size: 1.6rem; }
  .preview-strip { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}

/* ==========================================================================
   登录页
   ========================================================================== */

/* 登录页是整屏布局：隐藏导航栏与页脚，主视图去掉宽度限制与内边距 */
body.login-mode .navbar,
body.login-mode .footer { display: none; }

body.login-mode .page {
  max-width: none;
  padding: 0;
  margin: 0;
}

.login-page {
  display: grid;
  grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
  min-height: 100vh;
}

/* ---------- 左侧品牌区 ---------- */
.login-brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* 左右只留 32px：角色舞台要 550px 宽，留太多会被迫缩小 */
  padding: var(--space-2xl) var(--space-xl);
  color: #fff;
  background: linear-gradient(152deg, #6366f1 0%, #4f46e5 46%, #7c3aed 100%);
}

/* 网格纹理 */
.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .085) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .085) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 34% 34%, #000 0%, transparent 76%);
  mask-image: radial-gradient(circle at 34% 34%, #000 0%, transparent 76%);
}

/* 右上角暖橙光晕，和工具箱的暖橙点缀呼应 */
.login-brand::after {
  content: '';
  position: absolute;
  width: 460px;
  height: 460px;
  right: -170px;
  top: -150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249, 115, 22, .5) 0%, rgba(249, 115, 22, 0) 68%);
  pointer-events: none;
}

.login-brand-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  /* 角色舞台是 550px 宽，这里必须至少放得下，否则会被迫缩得很小 */
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
}

.login-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  align-self: flex-start;
}

.login-logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .32);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.login-logo-text {
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: .3px;
}

.login-logo-text span { color: #fed7aa; }

/* ==========================================================================
   角色群像（login-chars.js）
   --------------------------------------------------------------------------
   四个方块角色 + 眼睛 + 嘴，全部照抄开源项目 animated-characters-login-page。
   舞台是固定的 550 × 400，靠外层 wrap 的 --ac-scale 整体缩放来适配容器，
   所以舞台内部的坐标永远是"舞台单位"，JS 里不用关心屏幕尺寸。

   ⚠️ 角色 / 眼睛 / 嘴都**不能**加 CSS transition：
      位置由 JS 逐帧缓动（收敛即停帧），再加一层 transition 会变成双重平滑，
      拖沓且鼠标快速移动时会明显滞后。只有"眨眼"和"嘴型"用 transition。
   ========================================================================== */

.ac-host {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ac-stage-wrap {
  /* 舞台最高能长到多少（矮屏 / 移动端会覆盖这个值） */
  --ac-max-h: 420px;
  --ac-scale: 1;
  position: relative;
}

.ac-stage {
  position: relative;
  width: 550px;
  height: 400px;
  transform: scale(var(--ac-scale, 1));
  transform-origin: top left;
}

.ac-char {
  position: absolute;
  bottom: 0;
  transform-origin: bottom center;
  will-change: transform, height;
}

/* ---------- 入场：四个角色依次弹进来 ---------- */
.ac-char--purple { animation: ac-enter-purple 1.2s cubic-bezier(.34, 1.56, .64, 1) forwards; }
.ac-char--black  { animation: ac-enter-black  1s   cubic-bezier(.34, 1.56, .64, 1) .2s backwards; }
.ac-char--orange { animation: ac-enter-orange 1.1s cubic-bezier(.34, 1.56, .64, 1) .1s backwards; }
.ac-char--yellow { animation: ac-enter-yellow 1s   cubic-bezier(.34, 1.56, .64, 1) .3s backwards; }

/* 动画放完就交还给 JS（否则 inline transform 会被 animation 压住） */
.ac-char.is-entered { animation: none; }

@keyframes ac-enter-purple {
  0%   { transform: translateX(-150px) translateY(50px) rotate(-15deg) scale(.3); opacity: 0; }
  60%  { transform: translateX(10px) translateY(-10px) rotate(3deg) scale(1.05); }
  100% { transform: translateX(0) translateY(0) rotate(0deg) scale(1); opacity: 1; }
}

@keyframes ac-enter-black {
  0%   { transform: translateY(-100px) scale(.5); opacity: 0; }
  70%  { transform: translateY(10px) scale(1.08); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes ac-enter-orange {
  0%   { transform: translateX(-200px) translateY(80px) rotate(-25deg) scale(.2); opacity: 0; }
  65%  { transform: translateX(15px) translateY(-8px) rotate(5deg) scale(1.1); }
  100% { transform: translateX(0) translateY(0) rotate(0deg) scale(1); opacity: 1; }
}

@keyframes ac-enter-yellow {
  0%   { transform: translateX(200px) translateY(60px) rotate(20deg) scale(.3); opacity: 0; }
  65%  { transform: translateX(-12px) translateY(-5px) rotate(-4deg) scale(1.06); }
  100% { transform: translateX(0) translateY(0) rotate(0deg) scale(1); opacity: 1; }
}

/* ---------- 眼睛 ---------- */
.ac-eyes {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: flex-start;
  will-change: transform;
}

.ac-eye {
  flex: 0 0 auto;
  /* 尺寸走变量：眨眼 / 悲伤只需要切 class，不用碰 inline style，
     也就不会出现"恢复时写空字符串导致高度塌陷成内容高度"这种坑 */
  width: var(--ac-eye-size, 12px);
  height: var(--ac-eye-size, 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height .3s cubic-bezier(.4, 0, .2, 1),
              border-radius .3s cubic-bezier(.4, 0, .2, 1),
              transform .3s cubic-bezier(.4, 0, .2, 1);
}

/* 眨眼：压成 2px 一条线（原项目就是 height: 2px） */
.ac-eye.is-blinking { height: 2px; }

/* 失败时的下垂半圆（只黑色角色用；原项目 isSad + sadRotate ±20°） */
.ac-eye.is-sad {
  height: calc(var(--ac-eye-size, 12px) / 2);
  border-radius: 0 0 var(--ac-eye-size, 12px) var(--ac-eye-size, 12px);
}
.ac-eye.is-sad-l { transform: rotate(-20deg); }
.ac-eye.is-sad-r { transform: rotate(20deg); }

/* 白眼球：眨眼时瞳孔被 overflow 裁掉 */
.ac-eye--ball {
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
  will-change: height, border-radius, transform;
}

/* 纯瞳孔（橙、黄两个角色没有眼白）—— 会动的就是这颗圆本身 */
.ac-eye--dot {
  border-radius: 50%;
  background: #2D2D2D;
  will-change: height, transform;
}

.ac-eye--ball .ac-pupil { background: #2D2D2D; }

/* 眨眼时瞳孔直接撤掉，和原项目的 v-if 一致 */
.ac-eye.is-blinking .ac-pupil { display: none; }

.ac-pupil {
  border-radius: 50%;
  will-change: transform;
}

/* ---------- 嘴 ---------- */
.ac-mouth-wrap {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.ac-mouth {
  background: #2D2D2D;
  transition: width .5s cubic-bezier(.4, 0, .2, 1),
              height .5s cubic-bezier(.4, 0, .2, 1),
              border-radius .5s cubic-bezier(.4, 0, .2, 1),
              transform .5s cubic-bezier(.4, 0, .2, 1);
}

/* 紫色角色 */
.ac-mouth--purple { width: 24px; height: 8px; border-radius: 0 0 12px 12px; }

/* 打字 / 躲避时嘴变成一条竖缝，并且要把身体的倾斜"抵消"掉，否则缝会歪 */
.ac-mouth--purple.is-typing {
  width: 7px;
  height: 32px;
  border-radius: 0;
  transform: translateX(13.5px) translateY(-28px) var(--ac-counter-skew, skewX(0deg));
}

.ac-mouth--purple.is-sad { width: 24px; height: 8px; border-radius: 12px 12px 0 0; }
.ac-mouth--purple.is-happy { width: 30px; height: 16px; border-radius: 0 0 15px 15px; }

/* 橙色角色 */
.ac-mouth--orange { width: 26px; height: 13px; border-radius: 0 0 13px 13px; }

.ac-mouth--orange.is-typing {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translateX(6px);
}

.ac-mouth--orange.is-sad { border-radius: 13px 13px 0 0; }
.ac-mouth--orange.is-happy { width: 32px; height: 18px; border-radius: 0 0 16px 16px; }

/* 黄色角色的嘴是一条会变形的波浪线 */
.ac-mouth-path {
  transition: d .5s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- 成功彩带 ---------- */
.ac-confetti {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 999;
}

.ac-confetti i {
  position: absolute;
  border-radius: 2px;
  animation-name: ac-confetti-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes ac-confetti-fall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(30px, 200vh) rotate(720deg); opacity: 1; }
}

/* 尊重系统的「减弱动态效果」：不播入场动画（JS 那边也会关掉跟随与眨眼） */
@media (prefers-reduced-motion: reduce) {
  .ac-char { animation: none !important; }
}

.login-brand-slogan {
  font-size: 1rem;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, .82);
  font-weight: 500;
}

/* ---------- 右侧表单区 ---------- */
/* 纵向布局：表单靠上下 auto 外边距垂直居中，备案条自然贴在最底部。
   （不用绝对定位 —— 内容超高时绝对定位会压住表单） */
.login-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-2xl) var(--space-lg) var(--space-lg);
  background: var(--color-surface);
}

.login-box {
  width: 100%;
  max-width: 400px;
  margin-top: auto;
  margin-bottom: auto;
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.3px;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: .93rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xl);
}

.login-form { display: block; }

.lf-field { margin-bottom: var(--space-md); }

.lf-label {
  display: block;
  font-size: .86rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.lf-input {
  width: 100%;
  padding: 13px 16px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--color-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.lf-input::placeholder { color: var(--text-tertiary); }

.lf-input:hover { border-color: var(--border-default); }

.lf-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .13);
}

.lf-invalid,
.lf-invalid:focus {
  border-color: var(--error);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, .12);
}

.lf-input-wrap { position: relative; }

.lf-input-wrap .lf-input { padding-right: 46px; }

.lf-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.lf-eye:hover {
  color: var(--brand-primary);
  background: var(--bg-subtle);
}

.lf-error {
  min-height: 16px;
  margin-top: 5px;
  font-size: .78rem;
  color: var(--error);
  line-height: 1.3;
}

.lf-alert {
  min-height: 18px;
  margin: 2px 0 10px;
  font-size: .84rem;
  color: var(--error);
  text-align: center;
  line-height: 1.4;
}

.lf-submit {
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  color: #fff;
  font-family: inherit;
  font-size: .98rem;
  font-weight: 600;
  letter-spacing: .3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: var(--shadow-brand);
  transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.lf-submit:hover:not(.lf-loading) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-brand-lg);
}

.lf-submit:active:not(.lf-loading) { transform: translateY(0); }

.lf-submit.lf-loading { opacity: .82; cursor: default; }

.lf-submit.lf-success {
  background: linear-gradient(135deg, var(--success), #059669);
  box-shadow: 0 4px 14px rgba(16, 185, 129, .28);
}

.lf-submit-icon { display: inline-flex; align-items: center; }

.lf-spinner {
  display: inline-block;
  width: 17px;
  height: 17px;
  border: 2.2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lf-spin .7s linear infinite;
}

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

.login-tips {
  margin-top: var(--space-lg);
  text-align: center;
  font-size: .82rem;
  color: var(--text-tertiary);
}

.login-tips b { color: var(--brand-primary); font-weight: 600; }

/* 登录 / 注册页底部的备案信息条。
   整屏版式下 `body.login-mode` 把全局页脚隐藏了，但备案号是法定展示项，
   所以这里单独补一条，内容复用 site-beian.js（与页脚同一个数据源）。 */
.login-site-footer {
  width: 100%;
  max-width: 400px;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

@keyframes lf-shake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-7px); }
  55% { transform: translateX(6px); }
  80% { transform: translateX(-3px); }
}

.login-box.lf-shake { animation: lf-shake .38s cubic-bezier(.36, .07, .19, .97); }

/* ==========================================================================
   注册页补充样式（复用登录页的 .login-page / .lf-* 基础样式）
   ========================================================================== */

/* 验证码一行：输入框占满剩余宽度，按钮固定不换行 */
.lf-code-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.lf-code-row .lf-input {
  flex: 1 1 auto;
  min-width: 0; /* 关键：不写这个，flex 子项在窄屏下不会收缩，会把按钮挤出去 */
  letter-spacing: 2px;
}

.lf-code-btn {
  flex: 0 0 auto;
  padding: 0 16px;
  min-width: 112px;
  font-family: inherit;
  font-size: .86rem;
  font-weight: 600;
  color: var(--brand-primary);
  background: var(--brand-soft);
  border: 1px solid var(--brand-primary-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.lf-code-btn:hover:not(:disabled) {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.lf-code-btn:disabled { cursor: default; }

/* 倒计时中：降饱和度，明确表达「还点不了」 */
.lf-code-btn.is-waiting {
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  border-color: var(--border-subtle);
}

/* 底部「还没有账号？立即注册」 */
.auth-switch {
  margin-top: var(--space-lg);
  text-align: center;
  font-size: .86rem;
  color: var(--text-secondary);
}

.auth-switch-link {
  margin-left: 5px;
  color: var(--brand-primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

.auth-switch-link:hover { border-bottom-color: currentColor; }

/* 窄屏下把验证码按钮再收窄一点，给输入框留空间 */
@media (max-width: 420px) {
  .lf-code-btn { min-width: 96px; padding: 0 12px; font-size: .8rem; }
  .lf-code-row .lf-input { letter-spacing: 1px; }
}

/* 矮屏（笔记本常见的 768px 高）把注册页整体收紧一档。
   注册页比登录页多一个"确认密码"，不压一下就会"要滚一点才看得见提交按钮"。
   只在桌面双列下生效：≤900px 已切成单列，本来就允许滚动，不必折腾。 */
@media (min-width: 901px) and (max-height: 830px) {
  .login-box--register .login-title { font-size: 1.7rem; }
  .login-box--register .login-subtitle { margin-bottom: var(--space-lg); }
  .login-box--register .lf-field { margin-bottom: 12px; }
  .login-box--register .lf-input { padding-top: 11px; padding-bottom: 11px; }
  .login-box--register .auth-switch { margin-top: var(--space-md); }
}

/* ==========================================================================
   导航栏用户区
   ========================================================================== */
.nav-user { position: relative; display: flex; align-items: center; }

.nav-login-btn {
  padding: 8px 19px;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: var(--shadow-brand);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.nav-login-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-brand-lg);
}

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px 4px 4px;
  font-family: inherit;
  font-size: .87rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--color-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.nav-user-btn:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.nav-avatar {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-primary), #7c3aed);
  flex-shrink: 0;
}

.nav-username {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-caret { font-size: .68rem; opacity: .6; }

.nav-user-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  background: var(--color-surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base);
  z-index: 60;
}

.nav-user-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu-header {
  padding: 7px 10px 9px;
  font-size: .78rem;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-menu-item {
  display: block;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  font-family: inherit;
  font-size: .87rem;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

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

.nav-menu-item.danger:hover { background: #fef2f2; color: var(--error); }

/* ==========================================================================
   滑块拼图验证
   ========================================================================== */
.sv-mask {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.sv-mask.sv-in { opacity: 1; }

.sv-panel {
  width: 368px;
  max-width: 100%;
  padding: 16px 18px 18px;
  background: var(--color-surface-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  transform: translateY(14px) scale(.97);
  transition: transform var(--transition-base);
}

.sv-mask.sv-in .sv-panel { transform: none; }

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

.sv-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sv-close {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sv-close:hover { background: var(--bg-subtle); color: var(--text-primary); }

/* 舞台宽度必须等于画布宽度，拖动映射才是 1:1 */
.sv-stage {
  position: relative;
  width: 320px;
  max-width: 100%;
  margin: 0 auto;
}

.sv-canvas {
  display: block;
  width: 320px;
  height: 160px;
  max-width: 100%;
  border-radius: var(--radius-lg);
  user-select: none;
  -webkit-user-drag: none;
}

.sv-piece {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  transition: transform .06s linear;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .35));
}

.sv-refresh {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .92rem;
  color: #fff;
  background: rgba(15, 23, 42, .45);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.sv-refresh:hover { background: rgba(15, 23, 42, .72); transform: rotate(90deg); }

.sv-bar {
  position: relative;
  width: 320px;
  max-width: 100%;
  height: 44px;
  margin: 13px auto 0;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  user-select: none;
}

.sv-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, rgba(99, 102, 241, .22), rgba(99, 102, 241, .4));
  transition: width .06s linear;
}

.sv-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  color: var(--text-tertiary);
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.sv-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
  background: #fff;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .18);
  cursor: grab;
  z-index: 2;
  transition: transform .06s linear;
  touch-action: none;
}

.sv-handle.sv-dragging { cursor: grabbing; }

.sv-panel.sv-passed .sv-bar-fill {
  background: linear-gradient(90deg, rgba(16, 185, 129, .3), rgba(16, 185, 129, .55));
}

.sv-panel.sv-passed .sv-bar-text { color: var(--success); font-weight: 600; }

.sv-panel.sv-passed .sv-handle { color: var(--success); }

@keyframes sv-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.sv-panel.sv-shake { animation: sv-shake .32s ease-in-out; }

/* ---------- 暗色主题适配 ---------- */
html[data-theme="dark"] .login-main { background: var(--color-surface); }

html[data-theme="dark"] .lf-input {
  background: var(--color-surface-elevated, #1e293b);
}

html[data-theme="dark"] .sv-handle { background: #e2e8f0; }

html[data-theme="dark"] .nav-menu-item.danger:hover { background: rgba(239, 68, 68, .12); }

/* 深色主题下的注册页补充控件 */
html[data-theme="dark"] .lf-code-btn {
  color: #c4b5fd;
  background: rgba(129, 140, 248, .14);
  border-color: rgba(129, 140, 248, .38);
}

html[data-theme="dark"] .lf-code-btn:hover:not(:disabled) {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

html[data-theme="dark"] .lf-code-btn.is-waiting {
  color: var(--text-tertiary);
  background: rgba(148, 163, 184, .12);
  border-color: rgba(148, 163, 184, .22);
}

html[data-theme="dark"] .auth-switch-link { color: var(--brand-primary-light); }

/* ---------- 登录页响应式 ---------- */
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }

  .login-brand {
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
  }

  .login-brand-inner { gap: var(--space-md); max-width: 420px; }

  .login-logo { align-self: center; }

  /* 单列布局下品牌区在顶部，高度得省着用（下面还有 4 个输入框） */
  .ac-stage-wrap { --ac-max-h: 280px; }

  /* 单列时品牌区已经占掉一大截，表单不再垂直居中，自然从顶部排下来；
     align-items 保持 base 的 center（横向居中对齐） */
  .login-main { padding: var(--space-xl) var(--space-lg) var(--space-2xl); }
  .login-box { margin-top: 0; margin-bottom: 0; }

  .login-site-footer { margin-top: var(--space-md); }
}

@media (max-width: 420px) {
  .login-title { font-size: 1.6rem; }
  .nav-username { display: none; }
  .sv-stage, .sv-canvas, .sv-bar { width: 100%; }
  .sv-canvas { height: auto; }
}
