/* ============================================================
   拼豆图纸生成器 — 玻璃拟态主题
   ============================================================ */

:root {
  --accent: #E95D4F;
  --accent-2: #2E8C9C;
  --accent-grad: linear-gradient(135deg, #E95D4F 0%, #F0A24A 52%, #2E8C9C 100%);
  --accent-soft: rgba(255, 107, 107, 0.12);
  --accent-ring: rgba(255, 107, 107, 0.25);

  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-strong: rgba(255, 255, 255, 0.9);
  --glass-bg-soft: rgba(255, 255, 255, 0.48);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-border-soft: rgba(255, 255, 255, 0.4);

  --shadow-sm: 0 2px 10px rgba(31, 38, 135, 0.06);
  --shadow-md: 0 8px 30px rgba(31, 38, 135, 0.1);
  --shadow-lg: 0 20px 50px rgba(31, 38, 135, 0.15);
  --shadow-glow: 0 8px 24px rgba(255, 107, 107, 0.25);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-pill: 999px;

  --text-1: #1a1a2e;
  --text-2: #4a4a6a;
  --text-3: #8888a0;
  --text-soft: #b0b0c4;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --sidebar-w: 240px;
  --tabbar-h: 64px;
}

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

html, body {
  height: 100%;
  overflow-x: hidden;     /* 防止某个内部元素超宽导致整页可横向滚动 */
  -webkit-text-size-adjust: 100%;  /* iOS Safari 横竖屏切换时不要自动放大字号 */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text-1);
  line-height: 1.5;
  background:
    linear-gradient(115deg, rgba(248, 95, 78, 0.12), transparent 34%),
    linear-gradient(245deg, rgba(46, 140, 156, 0.14), transparent 38%),
    repeating-linear-gradient(90deg, rgba(26, 26, 46, 0.025) 0 1px, transparent 1px 22px),
    linear-gradient(135deg, #fff9f4 0%, #f3faf9 48%, #f7f5ff 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; outline: none; }

/* ============================================================
   APP SHELL — 桌面侧边栏 + 主内容区
   ============================================================ */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--space-5) var(--space-4);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  margin-bottom: var(--space-5);
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-glow);
}
.brand-name { font-size: 17px; font-weight: 700; color: var(--text-1); letter-spacing: 0.3px; }

.side-nav {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: var(--space-2);
  overflow-y: auto;
  scrollbar-width: none;
}
.side-nav::-webkit-scrollbar { display: none; }
.side-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  text-align: left;
  transition: all 0.2s;
  width: 100%;
}
.side-nav-item:hover { background: rgba(255, 255, 255, 0.6); color: var(--text-1); }
.side-nav-item.active {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.side-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  font-size: 18px;
  line-height: 1;
}
.side-nav-icon-text,
.mobile-text-tool-icon {
  color: currentColor;
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}
.side-nav-icon-text {
  border: 1px solid currentColor;
  border-radius: 5px;
}
.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;
}
.side-nav-label {
  flex: 1;
  min-width: 0;
  line-height: 24px;
  white-space: nowrap;
}

.side-footer {
  padding: var(--space-4);
  text-align: center;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: var(--space-4);
}
.side-qr {
  width: 124px; height: 124px;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  display: block;
  margin: 0 auto var(--space-2);
}
.side-qr-hint { font-size: 11px; color: var(--text-3); line-height: 1.35; }

.app-main {
  padding: var(--space-6);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.mobile-more-nav,
.mobile-more-mask,
.mobile-editor-toggle,
.mobile-sticky-action { display: none; }
.image-actions > .mobile-editor-toggle { display: none; }
.mobile-secondary-tools { display: contents; }
.result-download-actions { display: contents; }

.container { width: 100%; }

/* VIP 链接首屏直接显示高级版，验证失败后由脚本恢复普通版。 */
html.vip-direct-entry .app-main > .container {
  display: none !important;
}
html.vip-direct-entry #aiPage {
  display: block !important;
}
html.vip-direct-entry #aiNavItem {
  display: flex !important;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
html.vip-direct-entry .side-nav-item[data-page="home"].active {
  background: transparent;
  color: var(--text-2);
  box-shadow: none;
}

/* ============================================================
   首页内容 / 豆图库
   ============================================================ */

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.section-eyebrow {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-2);
  letter-spacing: 0;
}
.section-head h2,
.gallery-page-head h2 {
  font-size: 22px;
  line-height: 1.2;
  color: var(--text-1);
}
.section-link-btn {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid rgba(46, 140, 156, 0.28);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.72);
  color: #1f6670;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.section-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gallery-download-all-btn {
  min-height: 40px;
  padding: 9px 18px;
  border: 0;
  border-radius: var(--radius-md);
  background: #ef6556;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(239, 101, 86, 0.24);
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.gallery-download-all-btn:hover {
  background: #dc5145;
  box-shadow: 0 8px 20px rgba(239, 101, 86, 0.3);
  transform: translateY(-1px);
}
.gallery-download-all-btn:focus-visible {
  outline: 3px solid rgba(239, 101, 86, 0.3);
  outline-offset: 3px;
}
.gallery-download-all-btn-wide {
  min-width: 132px;
  min-height: 44px;
  font-size: 15px;
}
.bead-gallery-section {
  margin-top: var(--space-6);
  padding: var(--space-5);
  background: rgba(255,255,255,0.64);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.bead-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}
#homeBeadGallery {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.gallery-home-actions {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(180px, 1fr);
  gap: 10px;
  width: min(100%, 560px);
  margin: var(--space-4) 0 0 auto;
}
.gallery-view-more-btn {
  border-color: rgba(46, 140, 156, 0.34);
  background: #fff;
}
.bead-card {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  background: rgba(255,255,255,0.86);
  border: 1px solid rgba(25, 34, 52, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.bead-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.bead-card:focus-visible { outline: 3px solid rgba(239, 101, 86, 0.35); outline-offset: 3px; }
.bead-card-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #eef3f4;
}
.bead-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bead-card-view-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(20, 27, 36, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.bead-card-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: rgba(17,24,39,0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.bead-card-body { padding: 14px; }
.bead-card-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-1);
}
.bead-card-size {
  flex-shrink: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}
.bead-card-desc {
  min-height: 36px;
  color: var(--text-2);
  font-size: 12px;
}
.bead-card-meta {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--text-3);
  font-size: 11px;
}
.bead-card-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-loading {
  grid-column: 1 / -1;
  padding: 32px;
  color: var(--text-3);
  text-align: center;
  border: 1px dashed var(--glass-border-soft);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.5);
}

/* 页面标题 */
.page-header {
  margin-bottom: var(--space-4);
  text-align: left;
}
.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.5px;
  margin-bottom: var(--space-2);
}
.page-subtitle { font-size: 14px; color: var(--text-3); }

/* ============================================================
   GLASS CARD 通用基类
   ============================================================ */

.upload-card, .preview-card, .params-card,
.feature-section, .miniapp-card, .seo-link-section,
.color-list-section, .image-actions,
.form-card, .new-card, .work-item,
.records-section, .result-section, .picker-toolbar,
.image-display-area, .preview-stats {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border-soft);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
}

/* ============================================================
   首页 - 上传卡片
   ============================================================ */

.upload-card {
  margin-bottom: var(--space-5);
  padding: var(--space-6);
}
.upload-area {
  border: 2px dashed rgba(255, 107, 107, 0.4);
  border-radius: var(--radius-md);
  padding: var(--space-6) var(--space-5);
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  background: rgba(255, 255, 255, 0.3);
}
.upload-area:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.upload-icon-wrap { display: inline-flex; }
.upload-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: #fff;
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-glow);
}
.icon-plus { line-height: 1; }
.upload-title { font-size: 16px; color: var(--text-1); font-weight: 600; margin-bottom: var(--space-2); }
.upload-subtitle { font-size: 13px; color: var(--text-3); }

/* 预览卡片 */
.preview-card {
  margin-bottom: var(--space-4);
  position: relative;
  overflow: hidden;
  padding: var(--space-2);
}
.preview-img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
}
.preview-overlay {
  position: absolute;
  bottom: var(--space-4); right: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s;
}
.preview-overlay:hover { background: rgba(0, 0, 0, 0.7); }
.preview-btn { color: #fff; font-size: 12px; }
.preview-info {
  position: absolute;
  bottom: var(--space-4); left: var(--space-4);
  padding: var(--space-1) var(--space-3);
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-pill);
}
.info-text { color: #fff; font-size: 11px; }

/* 章节标题 */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin: var(--space-3) 0 var(--space-2);
  display: flex; align-items: center; gap: var(--space-2);
}

/* ============================================================
   参数卡片
   ============================================================ */

.params-card { padding: var(--space-4); margin-bottom: var(--space-4); }
.param-row { padding: var(--space-2) 0; }
.param-label-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-2);
}
.param-name { font-size: 13px; color: var(--text-2); font-weight: 500; }
.param-value-box {
  display: inline-flex; align-items: baseline; gap: 2px;
  padding: 2px var(--space-3);
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
}
.param-value { font-size: 14px; color: var(--accent); font-weight: 700; }
.param-unit { font-size: 11px; color: var(--accent); }
.param-hint { margin-top: var(--space-2); }
.dimension-text { font-size: 12px; color: var(--text-3); }
.param-desc { font-size: 12px; color: var(--text-3); margin-top: var(--space-2); }

/* 滑块 */
.param-stepper {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: var(--space-2);
}
.param-step-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 107, 107, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--accent);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.08);
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.param-step-btn:hover {
  background: var(--accent-soft);
  border-color: rgba(255, 107, 107, 0.45);
  transform: translateY(-1px);
}
.param-step-btn:active {
  transform: translateY(0) scale(0.96);
}
.param-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 107, 107, 0.15);
  outline: none;
}
.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
  transition: transform 0.15s;
}
.param-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.param-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

.divider { height: 1px; background: rgba(0, 0, 0, 0.06); margin: var(--space-2) 0; }

/* 快捷按钮 */
.quick-size-row { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
.quick-size-label { font-size: 12px; color: var(--text-3); }
.quick-size-buttons { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.quick-btn {
  padding: 6px 14px;
  border: 1px solid rgba(255, 107, 107, 0.3);
  background: rgba(255, 255, 255, 0.6);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
}
.quick-btn:hover { background: var(--accent-soft); }
.quick-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* select */
.select-box {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-1);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23888' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  transition: all 0.2s;
}
.select-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.select-box-highlight {
  border-color: rgba(255, 107, 107, 0.4);
  background-color: var(--accent-soft);
}

/* ============================================================
   按钮
   ============================================================ */

.btn-area { margin: var(--space-4) 0; display: flex; flex-direction: column; gap: var(--space-3); }
.btn-change-image {
  width: 100%;
  padding: var(--space-4) !important;
  font-size: 16px !important;
  background: var(--accent-grad) !important;
  color: #fff !important;
  border: none !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-glow);
}
.btn-change-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(255, 107, 107, 0.4);
}
.btn-primary {
  width: 100%;
  padding: var(--space-4);
  background: var(--accent-grad);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-glow);
  transition: all 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(255, 107, 107, 0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-icon { font-size: 18px; }

.btn-secondary {
  padding: var(--space-3) var(--space-5);
  background: var(--glass-bg-strong);
  color: var(--text-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: all 0.2s;
}
.btn-secondary:hover { background: #fff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ============================================================
   首页 — 功能入口
   ============================================================ */

.feature-section { padding: var(--space-5); margin-top: var(--space-5); }
.seo-link-section {
  padding: var(--space-5);
  margin-top: var(--space-5);
}
.seo-link-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.seo-link-head h2 {
  font-size: 20px;
  color: var(--text-1);
  margin: 4px 0 0;
}
.seo-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
.seo-link-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border-soft);
  background: rgba(255,255,255,0.55);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.seo-link-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 107, 107, 0.35);
  box-shadow: var(--shadow-sm);
}
.seo-link-card strong {
  font-size: 14px;
  color: var(--text-1);
}
.seo-link-card span {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}
@media (min-width: 900px) {
  .feature-section, .miniapp-card, .footer-tips { display: none !important; }
  .create-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.95fr);
    grid-template-areas:
      "preview title"
      "preview params"
      "preview button";
    grid-template-rows: auto auto 1fr;
    gap: var(--space-4);
  }
  .create-grid > .preview-card {
    grid-area: preview;
    margin: 0;
    align-self: stretch;
    position: relative;
    overflow: hidden;
    min-height: 0;
  }
  .create-grid > .preview-card .preview-img {
    position: absolute;
    inset: var(--space-2);
    width: auto;
    height: auto;
    max-width: calc(100% - var(--space-2) * 2);
    max-height: calc(100% - var(--space-2) * 2);
    margin: auto;
    object-fit: contain;
  }
  .create-grid > #paramsTitle { grid-area: title; margin-top: 0; }
  .create-grid > .params-card { grid-area: params; }
  .create-grid > .btn-area { grid-area: button; align-self: start; }
}
.feature-title { font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: var(--space-4); }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
}
.feature-item {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--space-5) var(--space-3);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s;
}
.feature-item:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.feature-item:focus-visible,
.qr-source-tab:focus-visible,
.qr-size-option:focus-visible,
.qr-preview-tab:focus-visible,
.qr-generate-btn:focus-visible,
.qr-download-actions button:focus-visible {
  outline: 3px solid rgba(46, 140, 156, 0.35);
  outline-offset: 2px;
}
.feature-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-sm);
}
.feature-icon-draw { background: linear-gradient(135deg, #ffd5d5, #ffb3b3); }
.feature-icon-picker { background: linear-gradient(135deg, #c5e7ff, #99d3ff); }
.feature-icon-print { background: linear-gradient(135deg, #ffe6b8, #ffc76b); }
.feature-icon-tutorial {
  color: #fff;
  background: #2e8c9c;
  font-size: 24px;
}
.feature-icon-qr {
  color: #fff;
  background: #20242b;
  border: 5px solid #fff;
  outline: 1px solid rgba(26, 26, 46, 0.12);
}
.feature-name { font-size: 15px; font-weight: 600; color: var(--text-1); margin-bottom: var(--space-1); }
.feature-desc { font-size: 12px; color: var(--text-3); text-align: center; }

/* ============================================================
   底部小程序卡 / 提示
   ============================================================ */

.miniapp-card { margin-top: var(--space-5); padding: var(--space-5); }
.miniapp-content { display: flex; align-items: center; gap: var(--space-5); }
.miniapp-text { flex: 1; }
.miniapp-text h3 { font-size: 16px; font-weight: 600; color: var(--text-1); margin-bottom: var(--space-2); }
.miniapp-text p { font-size: 13px; color: var(--text-3); }
.miniapp-qrcode img {
  width: 136px; height: 136px;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  display: block;
}

.footer-tips { text-align: center; padding: var(--space-5) 0; }
.tips-text { font-size: 13px; color: var(--text-3); }

/* ============================================================
   覆盖页通用 — 结果页 / 识别页 / 画豆图
   ============================================================ */

.result-page, .picker-page, .draw-list-page, .gallery-page, .tutorial-page, .qr-bead-page, .text-bead-page,
.draw-new-page, .draw-canvas-page, .ai-page {
  position: fixed;
  inset: 0;
  left: var(--sidebar-w);
  background:
    linear-gradient(115deg, rgba(248, 95, 78, 0.12), transparent 34%),
    linear-gradient(245deg, rgba(46, 140, 156, 0.14), transparent 38%),
    repeating-linear-gradient(90deg, rgba(26, 26, 46, 0.025) 0 1px, transparent 1px 22px),
    linear-gradient(135deg, #fff9f4 0%, #f3faf9 48%, #f7f5ff 100%);
  z-index: 9000;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

/* ============================================================
   文字拼豆工具
   ============================================================ */

.text-bead-container {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 28px 32px 52px;
}
.text-bead-heading {
  padding: 6px 0 22px;
  border-bottom: 1px solid rgba(26, 26, 46, 0.1);
}
.text-bead-heading h2 {
  margin: 5px 0 8px;
  color: var(--text-1);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.2;
  letter-spacing: 0;
}
.text-bead-heading p {
  max-width: 780px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.7;
}
.text-bead-workspace {
  display: grid;
  grid-template-columns: minmax(380px, 0.88fr) minmax(480px, 1.12fr);
  gap: 20px;
  align-items: start;
  padding-top: 20px;
}
.text-bead-controls,
.text-bead-preview-panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(25, 34, 52, 0.11);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(31, 38, 75, 0.08);
}
.text-bead-controls { padding: 0 22px; }
.text-bead-group { padding: 22px 0; }
.text-bead-group + .text-bead-group { border-top: 1px solid #eceef2; }
.text-bead-group-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 16px;
}
.text-bead-step {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  background: #20242b;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}
.text-bead-group-head h3,
.text-bead-preview-head h3 {
  margin: 1px 0 3px;
  color: var(--text-1);
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: 0;
}
.text-bead-group-head p {
  margin: 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
}
.text-bead-input-wrap { position: relative; }
.text-bead-input-wrap input {
  width: 100%;
  min-height: 52px;
  padding: 11px 82px 11px 14px;
  color: var(--text-1);
  background: #f8f9fb;
  border: 1px solid #dfe3e8;
  border-radius: 7px;
  outline: none;
  font-size: 18px;
  font-weight: 650;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.text-bead-input-wrap input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(248, 95, 78, 0.12);
}
.text-bead-input-wrap > span {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 12px;
}
.text-bead-size-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.text-bead-size-grid button {
  min-height: 42px;
  padding: 8px 6px;
  color: var(--text-2);
  background: #f7f8fa;
  border: 1px solid #e2e5e9;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}
.text-bead-size-grid button:hover { border-color: rgba(248, 95, 78, 0.45); }
.text-bead-size-grid button.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.text-bead-custom-size {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  color: var(--text-3);
  border-top: 1px dashed #e2e5e9;
  font-size: 13px;
}
.text-bead-custom-size > span:first-child { margin-right: 4px; color: var(--text-2); font-weight: 700; }
.text-bead-custom-size label { position: relative; }
.text-bead-custom-size input {
  width: 76px;
  min-height: 40px;
  padding: 7px 6px;
  color: var(--text-1);
  background: #f8f9fb;
  border: 1px solid #dfe3e8;
  border-radius: 6px;
  outline: none;
  text-align: center;
  font-size: 14px;
  font-weight: 750;
}
.text-bead-custom-size input:focus { border-color: var(--accent); }
.text-bead-style-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 8px 0;
}
.text-bead-style-row + .text-bead-style-row { border-top: 1px solid #f0f1f3; }
.text-bead-style-row > span { color: var(--text-2); font-size: 13px; font-weight: 700; }
.text-bead-color-options,
.text-bead-segmented { display: flex; align-items: center; gap: 8px; }
.text-bead-color-options button {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  background: var(--swatch);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #d7dbe0;
}
.text-bead-color-options button.active {
  box-shadow: 0 0 0 2px var(--accent), 0 3px 9px rgba(25, 34, 52, 0.12);
}
.text-bead-color-options button.active::after {
  content: '';
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50%;
}
.text-bead-segmented {
  gap: 2px;
  padding: 3px;
  background: #f1f2f4;
  border-radius: 7px;
}
.text-bead-segmented button {
  min-width: 68px;
  min-height: 34px;
  padding: 6px 12px;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
}
.text-bead-segmented button.active {
  color: var(--accent);
  background: #fff;
  box-shadow: 0 1px 5px rgba(25, 34, 52, 0.1);
}
.text-bead-preview-panel {
  position: sticky;
  top: 72px;
  padding: 22px;
}
.text-bead-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.text-bead-preview-head > span {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: var(--text-2);
  background: #f1f3f5;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}
.text-bead-preview-stage {
  display: grid;
  width: 100%;
  min-height: 480px;
  place-items: center;
  padding: 18px;
  overflow: auto;
  background: #eef0f3;
  border: 1px solid #dfe3e8;
  border-radius: 7px;
}
.text-bead-preview-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 620px;
  background: #fff;
  image-rendering: pixelated;
  box-shadow: 0 4px 18px rgba(25, 34, 52, 0.12);
}
.text-bead-empty { max-width: 320px; color: var(--text-3); text-align: center; }
.text-bead-empty-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(248, 95, 78, 0.25);
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: 25px;
  font-weight: 800;
}
.text-bead-empty strong { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 15px; }
.text-bead-empty p { margin: 0; font-size: 12px; line-height: 1.6; }
.text-bead-result-tip { margin: 12px 0; color: var(--text-3); font-size: 12px; line-height: 1.55; }
.text-bead-generate {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  background: var(--accent-grad);
  border: 0;
  border-radius: 7px;
  box-shadow: var(--shadow-glow);
  font-size: 16px;
  font-weight: 800;
}
.text-bead-generate > span:first-child { font-family: Arial, sans-serif; font-size: 14px; }
.text-bead-generate:disabled { cursor: not-allowed; opacity: 0.42; box-shadow: none; }

/* ============================================================
   使用教程
   ============================================================ */

.tutorial-container {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px 28px 56px;
}
.tutorial-page-head {
  padding: 2px 0 16px;
  border-bottom: 1px solid rgba(26, 26, 46, 0.1);
}
.tutorial-page-head h2 {
  margin: 5px 0 7px;
  color: var(--text-1);
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0;
}
.tutorial-page-head p {
  max-width: 720px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
}
.tutorial-public-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  padding-top: 18px;
}
.tutorial-public-card {
  min-width: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(25, 34, 52, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 38, 75, 0.07);
}
.tutorial-public-video {
  position: relative;
  width: 100%;
  height: min(72vh, 820px);
  min-height: 520px;
  overflow: hidden;
  background: #171a20;
}
.tutorial-public-video video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #171a20;
}
.tutorial-public-content { padding: 16px 20px 18px; }
.tutorial-public-content h3 {
  margin: 0;
  color: var(--text-1);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: 0;
}
.tutorial-public-content p {
  margin: 7px 0 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}
.tutorial-public-state {
  grid-column: 1 / -1;
  padding: 70px 20px;
  color: var(--text-3);
  text-align: center;
  background: rgba(255, 255, 255, 0.62);
  border: 1px dashed rgba(25, 34, 52, 0.16);
  border-radius: 8px;
}

/* ============================================================
   二维码拼豆专区
   ============================================================ */

.qr-bead-container {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 28px 32px 48px;
}
.qr-bead-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 6px 0 24px;
  border-bottom: 1px solid rgba(26, 26, 46, 0.1);
}
.qr-bead-heading h2 {
  margin: 5px 0 8px;
  color: var(--text-1);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.2;
  letter-spacing: 0;
}
.qr-bead-heading p {
  max-width: 760px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.7;
}
.qr-local-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: #146b5c;
  background: #e8f7f1;
  border: 1px solid #bfe9db;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}
.qr-local-badge > span:first-child {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #fff;
  background: #16866f;
  border-radius: 50%;
  font-size: 12px;
}
.qr-bead-workspace {
  display: grid;
  grid-template-columns: minmax(340px, 0.78fr) minmax(520px, 1.22fr);
  gap: 20px;
  align-items: start;
  padding-top: 20px;
}
.qr-builder-panel,
.qr-result-panel {
  min-width: 0;
  padding: 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(25, 34, 52, 0.11);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(31, 38, 75, 0.08);
}
.qr-result-panel { min-height: 650px; }
.qr-step-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.qr-step-heading-spaced { margin-top: 24px; }
.qr-step-number {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  background: #20242b;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}
.qr-step-heading h3,
.qr-result-head h3 {
  color: var(--text-1);
  font-size: 18px;
  line-height: 1.35;
}
.qr-step-heading p {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.55;
}
.qr-source-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 16px 0 12px;
  padding: 4px;
  background: #f0f1f3;
  border-radius: 7px;
}
.qr-source-tab {
  min-height: 40px;
  padding: 8px 10px;
  color: #64697a;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
}
.qr-source-tab.active {
  color: #1c2028;
  background: #fff;
  box-shadow: 0 2px 8px rgba(20, 28, 48, 0.09);
}
.qr-upload-area {
  display: flex;
  width: 100%;
  min-height: 160px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 22px;
  color: var(--text-2);
  background:
    repeating-linear-gradient(0deg, transparent 0 19px, rgba(25, 34, 52, 0.025) 19px 20px),
    repeating-linear-gradient(90deg, transparent 0 19px, rgba(25, 34, 52, 0.025) 19px 20px),
    #fbfbfc;
  border: 1px dashed #b6bac4;
  border-radius: 7px;
  text-align: center;
  transition: border-color 0.18s, background 0.18s;
}
.qr-upload-area:hover,
.qr-upload-area.dragover {
  background-color: #fff7f4;
  border-color: var(--accent);
}
.qr-upload-symbol {
  margin-bottom: 5px;
  color: #20242b;
  font-size: 42px;
  line-height: 1;
}
.qr-upload-area strong { color: var(--text-1); font-size: 15px; }
.qr-upload-area > span:last-child { color: var(--text-3); font-size: 12px; }
.qr-source-preview {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 132px;
  padding: 12px;
  background: #f7f8fa;
  border: 1px solid #e0e2e7;
  border-radius: 7px;
}
.qr-source-preview img {
  width: 108px;
  height: 108px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #dedfe4;
}
.qr-source-preview-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}
.qr-source-preview-info strong { color: #137563; font-size: 14px; }
.qr-source-preview-info span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--text-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qr-source-preview-info button,
.qr-reset-btn {
  padding: 6px 10px;
  color: var(--accent);
  background: transparent;
  border: 1px solid rgba(233, 93, 79, 0.35);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
}
.qr-text-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-1);
  font-size: 13px;
  font-weight: 700;
}
#qrContentInput {
  display: block;
  width: 100%;
  min-height: 132px;
  resize: vertical;
  padding: 12px;
  color: var(--text-1);
  background: #fff;
  border: 1px solid #d8dae0;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.55;
}
#qrContentInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 93, 79, 0.11);
}
.qr-input-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  color: var(--text-3);
  font-size: 11px;
}
.qr-decode-status {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
  padding: 11px 12px;
  color: #5e6472;
  background: #f3f4f6;
  border-left: 3px solid #aeb3be;
  border-radius: 5px;
}
.qr-decode-status[data-state="working"] { color: #7a5515; background: #fff7df; border-color: #e8a72e; }
.qr-decode-status[data-state="success"] { color: #146b5c; background: #edf9f5; border-color: #16866f; }
.qr-decode-status[data-state="error"] { color: #a13b32; background: #fff0ee; border-color: #d94d40; }
.qr-status-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}
.qr-decode-status strong { display: block; font-size: 13px; }
.qr-decode-status p { margin-top: 2px; font-size: 11px; line-height: 1.5; }
.qr-decode-status code {
  display: block;
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  color: inherit;
  font-family: inherit;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qr-size-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.qr-size-option {
  display: flex;
  min-width: 0;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  padding: 9px 6px;
  color: var(--text-2);
  background: #fafafa;
  border: 1px solid #dedfe4;
  border-radius: 7px;
  text-align: center;
}
.qr-size-option.active {
  background: #fff7f4;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(233, 93, 79, 0.08);
}
.qr-size-option strong { color: var(--text-1); font-size: 14px; white-space: nowrap; }
.qr-size-option small { color: var(--text-3); font-size: 10px; line-height: 1.3; white-space: nowrap; }
.qr-generate-btn {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  padding: 12px 16px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(233, 93, 79, 0.2);
  font-size: 15px;
  font-weight: 800;
}
.qr-generate-btn:hover:not(:disabled) { background: #d94d40; }
.qr-generate-btn:disabled {
  color: #999da7;
  background: #e8e9ec;
  box-shadow: none;
  cursor: not-allowed;
}
.qr-result-empty {
  display: flex;
  min-height: 604px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px;
  color: var(--text-3);
  text-align: center;
}
.qr-result-empty h3 { margin-top: 20px; color: var(--text-1); font-size: 19px; }
.qr-result-empty p { max-width: 390px; margin-top: 7px; font-size: 13px; line-height: 1.65; }
.qr-empty-matrix {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  grid-template-rows: repeat(3, 28px);
  gap: 5px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e2e3e6;
  box-shadow: 0 8px 22px rgba(25, 34, 52, 0.08);
}
.qr-empty-matrix i { background: #20242b; }
.qr-empty-matrix i:nth-child(2),
.qr-empty-matrix i:nth-child(4) { background: transparent; }
.qr-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.qr-validation {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  color: #6c5520;
  background: #fff7df;
  border: 1px solid #efdb9d;
  border-radius: 6px;
}
.qr-validation[data-state="success"] { color: #146b5c; background: #edf9f5; border-color: #bfe9db; }
.qr-validation[data-state="error"] { color: #a13b32; background: #fff0ee; border-color: #f2c7c2; }
.qr-validation-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: #c3912e;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
}
.qr-validation[data-state="success"] .qr-validation-icon { background: #16866f; }
.qr-validation[data-state="error"] .qr-validation-icon { background: #d94d40; }
.qr-validation strong { font-size: 14px; }
.qr-validation p { margin-top: 2px; font-size: 11px; line-height: 1.5; }
.qr-result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  background: #dedfe4;
  border: 1px solid #dedfe4;
  border-radius: 6px;
}
.qr-result-stats > div { min-width: 0; padding: 11px 10px; background: #fff; text-align: center; }
.qr-result-stats span { display: block; color: var(--text-3); font-size: 10px; }
.qr-result-stats strong { display: block; margin-top: 3px; color: var(--text-1); font-size: 14px; }
.qr-preview-tabs {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  border-bottom: 1px solid #dedfe4;
}
.qr-preview-tab {
  position: relative;
  min-height: 38px;
  padding: 7px 13px;
  color: var(--text-3);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 700;
}
.qr-preview-tab.active { color: var(--text-1); }
.qr-preview-tab.active::after {
  content: '';
  position: absolute;
  right: 8px;
  bottom: -1px;
  left: 8px;
  height: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
}
.qr-line-color-panel {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 9px;
}
.qr-line-color-panel[hidden] { display: none; }
.qr-line-color-label {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
}
.qr-line-color-options {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qr-line-color-option {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 9px;
  color: var(--text-2);
  background: #fff;
  border: 1px solid #d9dce2;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.qr-line-color-option:hover { border-color: #b8bdc6; }
.qr-line-color-option.active {
  color: var(--text-1);
  background: #fff8f7;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(239, 106, 99, 0.1);
}
.qr-line-color-swatch {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 4px;
}
.qr-line-color-swatch-red { background: #ef8a84; }
.qr-line-color-swatch-gray { background: #666; }
.qr-line-color-swatch-black { background: #222; }
.qr-canvas-stage {
  display: grid;
  width: 100%;
  height: min(50vw, 560px);
  min-height: 360px;
  margin-top: 14px;
  overflow: hidden;
  place-items: center;
  padding: 14px;
  background: #e6e8eb;
  border: 1px solid #d7d9de;
  border-radius: 6px;
}
#qrResultCanvas {
  display: block;
  flex: 0 0 auto;
  background: #fff;
  box-shadow: 0 5px 18px rgba(20, 28, 48, 0.12);
  image-rendering: pixelated;
}
.qr-preview-caption { margin-top: 8px; color: var(--text-3); font-size: 11px; text-align: center; }
.qr-download-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.qr-download-actions button {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 8px;
  color: #fff;
  background: #20242b;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
}
.qr-download-actions button:hover:not(:disabled) { background: #303640; }
.qr-download-actions button:disabled { color: #9b9fa8; background: #e7e8eb; cursor: not-allowed; }
.qr-accuracy-note {
  margin-top: 14px;
  padding: 10px 12px;
  color: #5c6170;
  background: #f4f5f7;
  border-left: 3px solid #7d8492;
  border-radius: 4px;
}
.qr-accuracy-note strong { color: var(--text-2); font-size: 12px; }
.qr-accuracy-note p { margin-top: 3px; font-size: 10px; line-height: 1.55; }
[hidden] { display: none !important; }

.gallery-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-5);
}
.gallery-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.gallery-page-head p {
  margin-top: 8px;
  color: var(--text-3);
  font-size: 13px;
}
.bead-gallery-grid-full {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.gallery-more-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: var(--space-6);
  padding: var(--space-5) 0;
  border-top: 1px solid rgba(25, 34, 52, 0.1);
  border-bottom: 1px solid rgba(25, 34, 52, 0.1);
}
.gallery-more-copy { min-width: 0; }
.gallery-more-copy h3 {
  margin: 0;
  color: var(--text-1);
  font-size: 18px;
  line-height: 1.35;
}
.gallery-more-copy p {
  margin: 7px 0 0;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.65;
}
.gallery-more-action {
  flex: 0 0 auto;
  min-width: 190px;
}

.bead-detail-mask,
.bead-qr-mask {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 25, 34, 0.72);
  backdrop-filter: blur(8px);
}
.bead-qr-mask { z-index: 12020; }
.bead-detail-mask[hidden],
.bead-qr-mask[hidden] { display: none; }
.bead-detail-dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: min(88vh, 820px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(11, 18, 29, 0.28);
}
.bead-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.bead-detail-head h2,
.bead-qr-dialog h2 {
  margin-top: 4px;
  color: var(--text-1);
  font-size: 22px;
  line-height: 1.3;
}
.bead-modal-close {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #eef1f4;
  color: #3f4652;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.bead-detail-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.bead-detail-image-button {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(25, 34, 52, 0.1);
  border-radius: 8px;
  background: #f4f6f7;
  cursor: pointer;
}
.bead-detail-image-button img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #f1f3f4;
}
.bead-detail-image-label {
  display: block;
  padding: 11px 12px;
  background: #fff;
  color: var(--text-1);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}
.bead-detail-tip {
  margin-top: 16px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}
.bead-qr-dialog {
  width: min(460px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 8px;
  background: #f4f6f8;
  box-shadow: 0 24px 70px rgba(11, 18, 29, 0.3);
}
.bead-qr-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.08);
  background: #fff;
}
.bead-qr-success-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}
.bead-qr-dialog .bead-qr-success-title h2 {
  margin: 0;
  font-size: 22px;
}
.bead-qr-success-icon {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  border: 2px solid #16a765;
  border-radius: 50%;
  color: #128a54;
  font-size: 20px;
  font-weight: 800;
}
.bead-qr-content { padding: 18px; }
.bead-qr-guide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #cfe1f5;
  border-radius: 8px;
  background: #eaf3ff;
  color: #174f86;
  text-align: left;
}
.bead-qr-phone-icon {
  position: relative;
  width: 16px;
  height: 26px;
  flex: 0 0 16px;
  border: 2px solid #2476c7;
  border-radius: 4px;
  box-sizing: border-box;
}
.bead-qr-phone-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 4px;
  height: 1px;
  border-radius: 1px;
  background: #2476c7;
  transform: translateX(-50%);
}
.bead-qr-guide strong,
.bead-qr-guide span { display: block; }
.bead-qr-guide strong { font-size: 16px; line-height: 1.45; }
.bead-qr-guide div > span { margin-top: 2px; color: #5680a8; font-size: 12px; line-height: 1.5; }
.bead-qr-code-panel {
  margin-top: 16px;
  padding: 14px 14px 12px;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  box-shadow: 0 5px 18px rgba(30, 41, 59, 0.07);
}
.bead-gallery-qr {
  display: block;
  width: min(270px, 74vw);
  height: auto;
  margin: 0 auto;
}
.bead-qr-code-panel p { margin-top: 12px; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.bead-qr-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #edf1f5;
  color: #687385;
  font-size: 12px;
  line-height: 1.55;
}
.bead-qr-expiry-note {
  align-items: center;
  border: 1px solid #f1cf8c;
  background: #fff5dc;
  color: #79530f;
}
.bead-qr-countdown {
  display: inline-block;
  min-width: 54px;
  margin-left: 5px;
  color: #d24f36;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.bead-qr-info-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  border: 1px solid #6e91b5;
  border-radius: 50%;
  color: #547ca5;
  font-size: 11px;
  font-weight: 800;
}
.bead-qr-close-action {
  width: 100%;
  height: 44px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: #273342;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.bead-qr-close-action:hover { background: #182331; }
body.bead-gallery-modal-open { overflow: hidden; }

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

/* nav-bar 用于覆盖页顶部 */
.nav-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) var(--space-5);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border-soft);
  margin: 0;
  border-radius: 0;
  box-shadow: var(--shadow-sm);
}
.nav-title { font-size: 18px; font-weight: 700; color: var(--text-1); }
.back-btn {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-2) var(--space-4);
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: all 0.15s;
}
.back-btn:hover { background: #fff; transform: translateY(-50%) translateX(-2px); }

/* ============================================================
   结果页
   ============================================================ */

.result-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-4);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 1024px) {
  .result-container {
    grid-template-columns: 1.4fr 1fr;
    grid-template-areas:
      "preview actions"
      "preview colors";
    align-items: start;
  }
  .preview-section { grid-area: preview; }
  .color-list-section {
    grid-area: colors;
    max-height: calc(100vh - var(--space-5) * 6);
    overflow-y: auto;
    align-self: stretch;
  }
  .action-buttons { grid-area: actions; align-self: start; }
}

.preview-section {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
}
.preview-wrapper {
  display: block;
  position: relative;
  background: #fff;
  border-radius: var(--radius-md);
  padding: var(--space-2);
  height: var(--preview-frame-height, 360px) !important;
  max-height: var(--preview-frame-height, 360px) !important;
  min-height: var(--preview-frame-height, 360px) !important;
  overflow: hidden;
  text-align: center;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.preview-zoom-content {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  vertical-align: top;
  transform-origin: 0 0;
  will-change: transform;
  touch-action: pan-y;
}
.preview-wrapper canvas {
  max-width: none;
  height: auto;
  display: block;
  margin: 0;
  touch-action: pan-y;
}
#previewOriginImg {
  touch-action: pan-y;
}
.preview-wrapper.cell-editing {
  outline: 2px solid rgba(255, 180, 0, 0.7);
  outline-offset: 2px;
  background: #fffdf4;
  touch-action: none;
}
.preview-wrapper.cell-editing .preview-zoom-content,
.preview-wrapper.cell-editing canvas {
  touch-action: none;
}
.preview-wrapper.cell-editing canvas {
  cursor: crosshair;
}
.preview-wrapper.cell-painting {
  outline-color: rgba(239, 101, 86, 0.82);
  background: #fff8f6;
}
.preview-wrapper.cell-painting canvas {
  cursor: crosshair;
}

.preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  padding: var(--space-3);
  margin-top: var(--space-2);
}
.preview-tabs {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
  padding: 4px;
  margin: 0 auto var(--space-2);
  width: fit-content;
  background: var(--glass-bg-strong);
  border: 1px solid var(--border-color);
  border-radius: 999px;
}
.preview-tab {
  padding: 5px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  background: transparent; border: none;
  border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s;
}
.preview-tab:hover { color: var(--text-primary); }
.preview-tab.active {
  background: var(--accent, #FF6B6B);
  color: #fff;
}
.grid-step-group {
  display: flex; align-items: center; gap: 5px;
  margin-left: 6px; padding-left: 8px;
  border-left: 1px solid var(--border-color);
}
.grid-step-options,
.grid-thin-color-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}
.grid-step-label {
  font-size: 11px; color: var(--text-secondary); white-space: nowrap;
}
.grid-control-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.grid-step-btn {
  padding: 3px 10px;
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  background: transparent; border: none;
  border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s;
}
.grid-step-btn:hover { color: var(--text-primary); }
.grid-step-btn.active {
  background: rgba(0,0,0,0.12);
  color: var(--text-primary);
}
.grid-step-sep {
  width: 1px; height: 14px;
  background: var(--border-color);
  margin: 0 2px;
}
.grid-color-btn {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 3px;
  background: #fff;
  border: 1.5px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.grid-color-btn.active {
  border-color: var(--accent, #FF6B6B);
  box-shadow: 0 0 0 2px rgba(239,106,103,0.12);
}
.grid-color-btn:focus-visible,
.grid-bold-color-trigger:focus-visible,
.grid-bold-color-close:focus-visible,
.grid-bold-color-option:focus-visible {
  outline: 3px solid rgba(239,106,103,0.28);
  outline-offset: 2px;
}
.grid-color-swatch {
  display: block;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  border: 1px solid rgba(15,23,42,0.16);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}
.grid-bold-color-picker {
  position: relative;
}
.grid-bold-color-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 29px;
  padding: 4px 7px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
}
.grid-bold-color-trigger:hover,
.grid-bold-color-trigger[aria-expanded="true"] {
  color: var(--text-primary);
  border-color: rgba(239,106,103,0.48);
  background: #fff8f7;
}
.grid-color-chevron {
  margin-left: -1px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1;
}
.grid-bold-color-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 190px;
  padding: 9px;
  background: #fff;
  border: 1px solid #e4e6ea;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15,23,42,0.18);
}
.grid-bold-color-menu[hidden] { display: none; }
.grid-bold-color-menu-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  padding: 0 2px 4px;
  color: var(--text-primary);
  font-size: 12px;
}
.grid-bold-color-close {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--text-secondary);
  font-size: 19px;
  line-height: 1;
  background: #f3f4f6;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.grid-bold-color-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 38px;
  padding: 7px 8px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  background: #f8f9fa;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.grid-bold-color-option:hover { background: #f1f3f5; }
.grid-bold-color-option.active {
  color: var(--text-primary);
  background: #fff5f4;
  border-color: rgba(239,106,103,0.42);
}
.grid-color-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#previewOriginImg {
  display: block;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 4px;
}
#previewCanvas {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}
.preview-zoom-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto var(--space-2);
  padding: 6px 9px;
  width: fit-content;
  max-width: 100%;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--glass-border-soft);
  border-radius: 999px;
}
.preview-zoom-btn,
.preview-zoom-reset {
  height: 30px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-1);
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, color .15s, transform .15s;
}
.preview-zoom-btn {
  width: 30px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}
.preview-zoom-reset {
  min-width: 58px;
  padding: 0 12px;
  font-size: 12px;
}
.preview-zoom-btn:hover,
.preview-zoom-reset:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.preview-zoom-range {
  width: min(180px, 34vw);
  accent-color: var(--primary);
}
.preview-wrapper.is-zoomed {
  text-align: left;
  cursor: grab;
  touch-action: none;
}
.preview-wrapper.is-zoomed .preview-zoom-content,
.preview-wrapper.is-zoomed canvas,
.preview-wrapper.is-zoomed #previewOriginImg {
  touch-action: none;
}
.preview-wrapper.is-zoomed.is-panning {
  cursor: grabbing;
  user-select: none;
}
@media (max-width: 768px) {
  .preview-wrapper {
    height: var(--preview-frame-height, 280px) !important;
    max-height: var(--preview-frame-height, 280px) !important;
    min-height: var(--preview-frame-height, 280px) !important;
  }
}
.result-color-tune,
.result-color-tune-label,
.result-color-tune-value { display: none !important; }

.param-preview-wrap {
  display: flex; flex-direction: column;
  padding: 12px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  width: 100%;
  min-height: 260px;
  box-sizing: border-box;
  margin-bottom: var(--space-4);
}
@media (min-width: 900px) {
  .create-grid > .param-preview-wrap {
    grid-area: preview;
    margin: 0;
    align-self: stretch;
    min-height: 0;
  }
}
.param-preview-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-secondary); margin-bottom: 10px;
  flex: 0 0 auto;
}
.param-preview-meta { font-weight: 600; color: var(--accent); font-size: 14px; }
#paramPreviewCanvas {
  display: block; margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}
.stat-item { text-align: center; }
.stat-label { display: block; font-size: 11px; color: var(--text-3); margin-bottom: var(--space-1); }
.stat-value { font-size: 18px; font-weight: 700; color: var(--accent); }

.image-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-2);
  padding: 0 0 var(--space-2);
  margin: 0 0 var(--space-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}
.img-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
  padding: 8px 6px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}
.img-action-btn:hover { background: rgba(255, 255, 255, 0.85); transform: translateY(-2px); }
.img-action-btn.active {
  background: rgba(255, 180, 0, 0.16);
  border-color: rgba(255, 180, 0, 0.55);
  box-shadow: 0 8px 22px rgba(255, 180, 0, 0.15);
}
#cellPaintBtn.active {
  background: rgba(239, 101, 86, 0.14);
  border-color: rgba(239, 101, 86, 0.52);
  box-shadow: 0 8px 22px rgba(239, 101, 86, 0.14);
}
.cell-paint-color-swatch {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 6px;
  background:
    linear-gradient(135deg, transparent 44%, #b7bec8 45% 55%, transparent 56%),
    #eef1f4;
  box-shadow: 0 0 0 1px rgba(25, 34, 52, 0.16);
}
#cellPaintColorBtn:not(.is-disabled) .cell-paint-color-swatch {
  box-shadow: 0 0 0 1px rgba(25, 34, 52, 0.2), 0 3px 8px rgba(25, 34, 52, 0.14);
}
.cell-paint-size-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42px;
  margin: 0 0 var(--space-2);
  padding: 5px 8px;
  background: rgba(239, 101, 86, 0.08);
  border: 1px solid rgba(239, 101, 86, 0.18);
  border-radius: var(--radius-md);
}
.cell-paint-size-toolbar[hidden] { display: none; }
.cell-paint-size-label {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.cell-paint-size-options {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(46px, 1fr));
  gap: 3px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.66);
  border-radius: 7px;
  white-space: nowrap;
}
.cell-paint-size-btn {
  min-height: 28px;
  min-width: 0;
  padding: 3px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .cell-paint-size-toolbar { gap: 7px; padding-inline: 6px; }
  .cell-paint-size-options { grid-template-columns: repeat(4, minmax(42px, 1fr)); }
  .cell-paint-size-btn { padding-inline: 6px; }
}
.cell-paint-size-btn:hover { background: rgba(255, 255, 255, 0.86); }
.cell-paint-size-btn.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(25, 34, 52, 0.1);
}
.img-action-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.img-action-btn.is-disabled:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: none;
}
.img-action-icon { font-size: 20px; }
.img-action-text { font-size: 11px; color: var(--text-2); font-weight: 500; }

/* 颜色清单 */
.color-list-section { padding: var(--space-4); }
.btn-reselect {
  background: var(--accent-grad) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: var(--shadow-glow);
}
.btn-reselect:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(255, 107, 107, 0.4);
}
.color-list-hint {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}
.color-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  transition: all .2s;
  cursor: pointer;
}
.color-item:hover { background: rgba(255,255,255,0.75); transform: translateX(2px); }
.color-item.is-highlighted {
  background: rgba(255, 47, 63, 0.1);
  border-color: rgba(255, 47, 63, 0.8);
  box-shadow: 0 0 0 2px rgba(255, 47, 63, 0.12);
}
.color-item.is-highlighted .color-block {
  border-color: #ff2f3f;
  box-shadow: 0 0 0 3px rgba(255, 47, 63, 0.18), 0 2px 8px rgba(0,0,0,0.14);
}
.color-block {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.color-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.color-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.color-count { font-size: 11px; color: var(--text-3); }
.color-list-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-2);
}
.color-list-header h3 { font-size: 15px; font-weight: 600; color: var(--text-1); }
.toggle-btn {
  padding: 4px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}
.color-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-2); }
.color-list-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2);
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.color-list-item:hover { background: #fff; border-color: var(--accent-soft); }
.color-list-swatch { width: 24px; height: 24px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.08); flex-shrink: 0; }
.color-list-info { flex: 1; font-size: 12px; color: var(--text-2); min-width: 0; overflow: hidden; }
.color-edit-hint {
  appearance: none;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255,255,255,0.72);
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  margin-left: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.color-edit-hint:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}

.copy-btn {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.copy-btn:hover { background: rgba(255, 107, 107, 0.2); }

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.action-buttons .btn-secondary { width: 100%; }

/* ============================================================
   弹窗（modal）通用
   ============================================================ */

.color-picker-mask, .palette-mask, .activate-modal,
.activate-success-modal, .loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.2s ease;
}

.color-picker-panel, .palette-panel,
.activate-content, .activate-success-content {
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

.color-picker-panel { width: 100%; max-width: 480px; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; }
.color-picker-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.color-picker-title-row { display: flex; align-items: center; gap: var(--space-3); }
.color-picker-current { width: 32px; height: 32px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.1); }
.color-picker-title { font-size: 15px; font-weight: 600; color: var(--text-1); }
.color-picker-close {
  font-size: 18px; color: var(--text-3); cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.color-picker-close:hover { background: rgba(0,0,0,0.05); }
.color-picker-scroll { overflow-y: auto; padding: var(--space-4); flex: 1; }
.color-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: var(--space-2); }
.color-picker-item {
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ddd;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08) inset;
}
.color-picker-item:hover { transform: translateY(-2px) scale(1.05); box-shadow: var(--shadow-md); border-color: #fff; }
.color-picker-item.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.color-picker-swatch, .color-picker-item-swatch {
  position: absolute; inset: 0; z-index: 0;
}
.color-picker-code, .color-picker-item-code {
  position: relative; z-index: 1;
  font-size: 11px; font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6), 0 0 3px rgba(0,0,0,0.4);
  padding: 2px 4px;
  word-break: break-all;
}

/* 激活弹窗 */
.activate-content { width: 100%; max-width: 380px; padding: var(--space-6); text-align: center; }
.activate-title { font-size: 18px; font-weight: 700; color: var(--text-1); margin-bottom: var(--space-2); }
.activate-desc { font-size: 13px; color: var(--text-3); margin-bottom: var(--space-4); }
.activate-input-wrap { margin-bottom: var(--space-3); }
.activate-input {
  width: 100%; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-md);
  font-size: 14px; text-align: center; letter-spacing: 1px;
}
.activate-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.activate-error { font-size: 12px; color: #e74c3c; min-height: 16px; margin-bottom: var(--space-3); }
.activate-btn {
  width: 100%; padding: var(--space-3); background: var(--accent-grad);
  color: #fff; border: none; border-radius: var(--radius-md);
  font-size: 15px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-glow);
}
.activate-purchase-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 12px;
  color: var(--text-3);
  font-size: 11px;
}
.activate-purchase-divider::before,
.activate-purchase-divider::after {
  flex: 1;
  height: 1px;
  background: rgba(31, 38, 75, 0.12);
  content: '';
}
.activate-purchase-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  color: #d94f47;
  background: #fff7f6;
  border: 1px solid rgba(229, 91, 81, 0.32);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.activate-purchase-btn:hover { background: #fff0ee; border-color: rgba(229, 91, 81, 0.52); }
.activate-purchase-btn:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.activate-purchase-note {
  margin-top: 8px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.5;
}
.activate-recovery-link {
  display: inline-block;
  margin-top: 10px;
  color: #c44841;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.activate-hint { font-size: 11px; color: var(--text-3); margin-top: var(--space-3); }

.activate-success-content { width: 100%; max-width: 320px; padding: var(--space-6); text-align: center; }
.activate-success-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #4ECDC4, #44A08D);
  color: #fff; font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-3);
  box-shadow: 0 8px 24px rgba(78, 205, 196, 0.3);
}
.activate-success-title { font-size: 18px; font-weight: 700; color: var(--text-1); margin-bottom: var(--space-2); }
.activate-success-text { font-size: 13px; color: var(--text-3); margin-bottom: var(--space-4); }
.activate-success-btn {
  padding: var(--space-3) var(--space-6); background: var(--accent-grad);
  color: #fff; border: none; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; cursor: pointer;
}

/* 打印排版弹窗 */
.print-modal {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(20, 18, 16, 0.66);
}
.print-panel {
  width: min(920px, 100%);
  max-height: 94vh;
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.58);
  border-radius: 22px;
  background: #f3f3f3;
  box-shadow: 0 24px 80px rgba(0,0,0,0.32);
}
.print-modal-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
  background: rgba(243,243,243,0.95);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.print-kicker {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0;
}
.print-modal-head h2 {
  margin: 2px 0 0;
  color: var(--text-primary);
  font-size: 22px;
}
.print-close {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #555;
  font-size: 18px;
  cursor: pointer;
}
.print-size-step,
.print-range-step,
.print-preview-step {
  padding: 18px 22px 24px;
}
.print-desc {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}
.print-upload-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.74);
}
.print-upload-btn {
  min-height: 42px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
}
.print-upload-name {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.print-size-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.print-size-item {
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  background: #fff;
  color: #444;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.print-size-item:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.print-step-title {
  margin-bottom: 14px;
  color: #111;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}
.print-range-stage {
  position: relative;
  width: 100%;
  max-width: 760px;
  height: min(68vh, 820px);
  min-height: 420px;
  margin: 0 auto;
  overflow: hidden;
  background: #d9d9d9;
  touch-action: none;
  user-select: none;
}
.print-range-stage canvas {
  position: absolute;
  image-rendering: pixelated;
}
.print-range-frame {
  position: absolute;
  z-index: 2;
  box-sizing: border-box;
  border: 5px solid #f6bd16;
  cursor: grab;
  touch-action: none;
}
.print-range-frame:active { cursor: grabbing; }
.print-range-frame span,
.print-range-frame i {
  position: absolute;
  display: block;
  background: rgba(246,189,22,0.82);
  pointer-events: none;
}
.print-range-frame span:nth-child(1) { left: 33.333%; top: 0; width: 2px; height: 100%; }
.print-range-frame span:nth-child(2) { left: 66.666%; top: 0; width: 2px; height: 100%; }
.print-range-frame i:nth-child(3) { left: 0; top: 33.333%; width: 100%; height: 2px; }
.print-range-frame i:nth-child(4) { left: 0; top: 66.666%; width: 100%; height: 2px; }
.print-range-actions,
.print-position-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.print-small-btn {
  min-width: 86px;
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #625b56;
  font-weight: 800;
  cursor: pointer;
}
.print-next-btn {
  display: block;
  width: min(560px, 100%);
  height: 54px;
  margin: 18px auto 0;
  border: none;
  border-radius: 999px;
  background: #000;
  color: #f6bd16;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}
.print-a4-preview {
  position: relative;
  width: min(420px, 100%);
  aspect-ratio: 210 / 297;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 16px 40px rgba(0,0,0,0.18);
  touch-action: none;
}
.print-a4-preview canvas {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 640px) {
  .print-modal { align-items: stretch; padding: 0; }
  .print-panel { max-height: 100vh; border-radius: 0; }
  .print-modal-head { padding: 16px 16px 12px; }
  .print-size-step,
  .print-range-step,
  .print-preview-step { padding: 14px 12px 22px; }
  .print-range-stage {
    height: 66vh;
    min-height: 440px;
  }
}

/* 加载遮罩 */
.loading-content { background: var(--glass-bg-strong); padding: var(--space-6); border-radius: var(--radius-lg); text-align: center; box-shadow: var(--shadow-lg); }
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto var(--space-3);
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; color: var(--text-2); }

/* ============================================================
   色号识别页
   ============================================================ */

.picker-page #pickerUploadCard { max-width: 600px; margin: var(--space-6) auto; }

.picker-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-5);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 1024px) {
  .picker-section {
    grid-template-columns: 1.6fr 1fr;
    grid-template-areas:
      "topact  topact"
      "toolbar toolbar"
      "hintbar hintbar"
      "image   side"
      "btnbar  side"
      "records records";
  }
  .picker-top-actions { grid-area: topact; }
  .picker-toolbar { grid-area: toolbar; }
  .image-hint-bar { grid-area: hintbar; }
  .image-display-area { grid-area: image; }
  .result-section { grid-area: side; align-self: start; position: sticky; top: var(--space-4); }
  .picker-btn-area { grid-area: btnbar; }
  .records-section { grid-area: records; }
}

.picker-top-actions {
  display: flex;
  justify-content: flex-end;
}
.btn-change-image {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--accent-grad);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: all 0.2s;
}
.btn-change-image:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(255,107,107,0.35); }

.picker-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
}
.picker-toolbar-left, .picker-toolbar-right { flex-shrink: 0; }
.picker-toolbar-center { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }

.magnifier-preview {
  position: relative;
  width: 80px; height: 80px;
  border: 2px solid var(--accent);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-sm);
}
.magnifier-preview canvas { width: 100%; height: 100%; display: block; }
.magnifier-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--text-soft);
}

.picked-color-info { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.picked-row { display: flex; align-items: center; gap: var(--space-2); font-size: 12px; color: var(--text-2); }
.picked-block { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.1); }
.picked-hex { font-family: 'SF Mono', Monaco, monospace; font-weight: 600; color: var(--text-1); }
.pick-hint { color: var(--text-3); font-size: 13px; }

.brand-box {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-1);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.image-hint-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-3);
  font-size: 11px;
  color: var(--text-3);
}
.hint-item { display: flex; align-items: center; gap: var(--space-1); }
.hint-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.hint-dot.double { background: #4ECDC4; }
.hint-divider { width: 1px; height: 12px; background: rgba(0,0,0,0.1); }

.image-display-area {
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: var(--space-3);
  overflow: hidden;
  touch-action: none;
}
.picker-image-wrap { position: relative; display: inline-block; user-select: none; max-width: 100%; }
.picker-image { display: block; max-width: 100%; pointer-events: none; user-select: none; border-radius: var(--radius-md); }
.crosshair-line-h, .crosshair-line-v {
  position: absolute;
  background: rgba(255, 107, 107, 0.85);
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}
.crosshair-line-h { left: 0; right: 0; height: 1px; }
.crosshair-line-v { top: 0; bottom: 0; width: 1px; }
.crosshair-point {
  position: absolute;
  width: 12px; height: 12px;
  border: 2px solid var(--accent);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 6;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.8);
}

.result-section {
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  padding: var(--space-5);
  border: 1px solid var(--glass-border-soft);
  box-shadow: var(--shadow-sm);
}
.result-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: var(--space-3); }
.result-card {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}
.result-color { width: 56px; height: 56px; border-radius: var(--radius-sm); border: 1px solid rgba(0,0,0,0.08); flex-shrink: 0; }
.result-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result-code { font-size: 16px; font-weight: 700; color: var(--text-1); }
.result-hex { font-family: 'SF Mono', Monaco, monospace; color: var(--text-3); font-size: 12px; }
.save-btn {
  width: 100%;
  padding: var(--space-3);
  background: var(--accent-grad);
  color: #fff; border: none;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
}

.picker-btn-area { display: flex; gap: var(--space-3); }
.picker-btn-area button { flex: 1; }

.records-section {
  padding: var(--space-4);
}
.records-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-3); }
.records-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.records-count { font-size: 12px; color: var(--text-3); }
.records-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-2); }
.record-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2);
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-sm);
}
.record-swatch { width: 36px; height: 36px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.08); }
.record-info { flex: 1; min-width: 0; }
.record-code { font-size: 13px; font-weight: 600; color: var(--text-1); }
.record-meta { font-size: 11px; color: var(--text-3); }
.record-delete { color: var(--accent); cursor: pointer; padding: 4px 8px; }
.clear-all-btn {
  margin-top: var(--space-3); width: 100%;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: var(--accent);
  border-radius: var(--radius-md);
  font-size: 13px; cursor: pointer;
}
.clear-all-btn:hover { background: var(--accent-soft); }

/* ============================================================
   画豆图列表页
   ============================================================ */

.draw-list-page > *:not(.nav-bar),
.draw-new-page > *:not(.nav-bar) {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

.new-card {
  margin: var(--space-5) auto;
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  border: 2px dashed rgba(255, 107, 107, 0.4);
  transition: all 0.25s;
}
.new-card:hover { background: var(--accent-soft); transform: translateY(-2px); }
.new-icon {
  width: 56px; height: 56px;
  margin: 0 auto var(--space-2);
  border-radius: 16px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-glow);
}
.new-text { font-size: 16px; font-weight: 600; color: var(--text-1); }
.new-desc { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.count { font-size: 13px; color: var(--text-3); font-weight: normal; }
.draw-empty { text-align: center; color: var(--text-3); font-size: 13px; padding: var(--space-6) 0; }

.works-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
  padding-bottom: var(--space-6);
}
.work-item {
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.work-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.work-thumb, .work-thumb-placeholder {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  font-size: 36px;
}
.work-info { padding: var(--space-3); }
.work-name {
  font-size: 13px; font-weight: 600; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.work-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.work-delete {
  position: absolute; top: var(--space-2); right: var(--space-2);
  padding: 6px 12px;
  background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
  transition: all 0.2s;
  z-index: 5;
}
.work-delete:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(255, 71, 87, 0.55);
}

/* ============================================================
   新建画布页
   ============================================================ */

.form-card { padding: var(--space-5); margin: var(--space-5) auto; }
.form-card .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}
.form-card .label { font-size: 14px; color: var(--text-2); flex-shrink: 0; font-weight: 500; }
.form-card .input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  font-size: 14px;
  text-align: right;
  color: var(--text-1);
}
.form-card .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.form-card .select-box { flex: 1; max-width: 260px; }

.start-btn {
  display: block;
  margin: var(--space-5) auto;
  width: calc(100% - var(--space-5) * 2);
  max-width: 300px;
  padding: var(--space-4);
  background: var(--accent-grad);
  color: #fff; border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: all 0.2s;
}
.start-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(255,107,107,0.4); }

/* ============================================================
   画布编辑页
   ============================================================ */

.draw-canvas-page { display: flex; flex-direction: column; }
.draw-canvas-page .top-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-3) var(--space-5);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border-soft);
}
.current-color-chip {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s;
}
.current-color-chip:hover { background: #fff; }
.color-dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.1); }
.color-code { font-size: 13px; color: var(--text-1); font-weight: 600; }
.top-actions { display: flex; gap: var(--space-2); }
.top-btn {
  padding: var(--space-2) var(--space-3);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-1);
  cursor: pointer;
  transition: all 0.15s;
}
.top-btn:hover { background: #fff; }
.top-btn.primary { background: var(--accent-grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-glow); }
.top-btn.primary:hover { transform: translateY(-1px); }

.board-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-4);
  overflow: auto;
}
.board {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-width: 100%;
  touch-action: none;
  cursor: crosshair;
}

.draw-toolbar {
  display: flex;
  justify-content: space-around;
  padding: var(--space-3) var(--space-4);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border-soft);
}
.tool-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  min-width: 56px;
  transition: all 0.15s;
}
.tool-item:hover { background: rgba(255, 255, 255, 0.5); }
.tool-item.active { background: var(--accent-soft); }
.tool-item.active .tool-name { color: var(--accent); }
.tool-icon { font-size: 22px; }
.tool-name { font-size: 11px; color: var(--text-2); font-weight: 500; }
.tool-color-chip {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

@media (min-width: 1024px) {
  .draw-canvas-page .board-wrap { padding-right: 120px; }
  .draw-canvas-page .draw-toolbar {
    position: fixed;
    right: var(--space-5);
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border-soft);
    box-shadow: var(--shadow-md);
    border-top: 1px solid var(--glass-border-soft);
  }
}

/* 色板弹窗 */
.palette-panel {
  width: 100%;
  max-width: 560px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.palette-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.palette-title { font-size: 15px; font-weight: 600; color: var(--text-1); }
.palette-close {
  font-size: 18px; color: var(--text-3); cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.palette-close:hover { background: rgba(0,0,0,0.05); }
.palette-scroll { overflow-y: auto; padding: var(--space-4); flex: 1; }
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: var(--space-2); }
.palette-item {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  background: rgba(255, 255, 255, 0.4);
}
.palette-item:hover { border-color: var(--glass-border); background: rgba(255, 255, 255, 0.8); }
.palette-item.active { border-color: var(--accent); background: var(--accent-soft); }
.palette-color { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.08); box-shadow: var(--shadow-sm); }
.palette-code { font-size: 10px; color: var(--text-2); margin-top: 4px; }

/* ============================================================
   响应式 — 手机端
   ============================================================ */

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed;
    top: auto; bottom: 0; left: 0; right: 0;
    height: var(--tabbar-h);
    flex-direction: row;
    padding: var(--space-2) var(--space-3);
    border-right: none;
    border-top: 1px solid var(--glass-border);
    /* 锁定在最上层：进入结果页/色号识别页等覆盖页时也常驻可见 */
    z-index: 10000;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
  }
  .brand, .side-footer { display: none; }
  /* 手机端：语言切换收进底部栏右侧，不悬浮遮挡页面内容 */
  .side-theme-btn { display: none !important; }
  .side-bottom {
    position: static;
    flex: 0 0 auto;
    width: auto;
    padding: 0;
  }
  .side-lang-btn {
    width: 46px;
    min-width: 46px;
    height: 46px;
    padding: 0;
    flex-direction: column;
    gap: 1px;
    border-radius: 999px;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.65);
  }
  .side-lang-btn .side-nav-icon { font-size: 16px; line-height: 1; }
  .side-lang-btn .side-nav-label {
    font-size: 9px;
    line-height: 1;
    max-width: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .side-nav { flex-direction: row; gap: var(--space-2); justify-content: space-around; width: 100%; min-width: 0; overflow: visible; }
  .side-nav-item {
    flex-direction: column;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--space-1) 2px;
    font-size: 11px;
    text-align: center;
  }
  .side-nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: none;
  }
  html.vip-direct-entry #aiNavItem {
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: none;
  }
  .side-nav-icon {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
    font-size: 20px;
  }
  .side-nav-label {
    flex: none;
    width: 100%;
    font-size: 10px;
    line-height: 14px;
    text-align: center;
    white-space: nowrap;
  }
  .side-nav-item[data-page="qr"],
  .side-nav-item[data-page="tutorials"] { display: none; }
  .app-main {
    padding: var(--space-4);
    padding-bottom: calc(var(--tabbar-h) + var(--space-4));
  }
  .page-title { font-size: 22px; }
  .page-header { margin-bottom: var(--space-4); }
  .result-page, .picker-page, .draw-list-page, .gallery-page, .tutorial-page, .qr-bead-page, .text-bead-page,
  .draw-new-page, .draw-canvas-page, .ai-page {
    left: 0;
    padding-bottom: var(--tabbar-h);
  }
  .result-container, .picker-section { padding: var(--space-3); }
  .miniapp-content { flex-direction: column; text-align: center; gap: var(--space-4); }
  .miniapp-qrcode img { width: 130px; height: 130px; }
  .tutorial-container { padding: 14px 10px calc(var(--tabbar-h) + 24px); }
  .tutorial-page-head { padding: 0 6px 12px; }
  .tutorial-page-head h2 { font-size: 24px; }
  .tutorial-public-list { grid-template-columns: 1fr; gap: 14px; padding-top: 16px; }
  .tutorial-public-video {
    height: min(68svh, 720px);
    min-height: 390px;
  }
  .tutorial-public-content { padding: 14px 15px 16px; }
  .picker-toolbar { flex-wrap: wrap; gap: var(--space-3); }
  .picker-toolbar-center { order: 3; width: 100%; }
  .draw-toolbar { padding: var(--space-2); }
  .tool-item { min-width: 48px; padding: var(--space-1) var(--space-2); }
  .tool-icon { font-size: 20px; }
  .color-list { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .records-list { grid-template-columns: 1fr; }
  .palette-mask { align-items: flex-end; }
  .palette-panel { max-height: 75vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

  .qr-bead-container { padding: 20px 18px 36px; }
  .qr-bead-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .qr-local-badge { align-self: flex-start; }
  .qr-bead-workspace { grid-template-columns: 1fr; }
  .qr-result-panel { min-height: 0; }
  .qr-result-empty { min-height: 420px; }
  .qr-canvas-stage { height: min(74vw, 620px); }
}


@media (max-width: 480px) {
  /* 手机端：内容窄一点居中显示，每个模块本身做大一点，整屏自然填满，顶部留白 */
  .app-main {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
    padding-bottom: var(--tabbar-h);
    padding-top: var(--space-6);    /* 顶部留白：32px */
    max-width: 300px;
    margin: 0 auto;
    box-sizing: border-box;
  }

  /* 容器：常规流式布局，模块之间用 margin 控制（间距适中） */
  .app-main > .container {
    display: block;
  }

  /* 标题居中 */
  .page-header { text-align: center; margin-bottom: var(--space-4); }
  .page-title { font-size: 18px; line-height: 1.2; margin-bottom: 4px; }
  .page-subtitle { font-size: 12px; line-height: 1.3; }

  /* 上传卡：做大一点 */
  .upload-card { padding: var(--space-5) var(--space-3); margin-bottom: var(--space-3); }
  .upload-area { padding: var(--space-5) var(--space-3); }
  .upload-icon { width: 56px; height: 56px; margin-bottom: var(--space-2); }
  .upload-icon .icon-plus { font-size: 28px; }
  .upload-title { font-size: 14px; margin-bottom: 4px; }
  .upload-subtitle { font-size: 11px; line-height: 1.3; }

  /* 各种卡片：内边距更大 */
  .preview-card {
    padding: var(--space-2);
    margin-bottom: var(--space-2);
  }
  .preview-img {
    max-height: 190px;
  }
  .param-preview-wrap {
    min-height: 205px;
    padding: var(--space-2);
    margin-bottom: var(--space-2);
  }
  .params-card, .feature-section, .miniapp-card { padding: var(--space-3); }
  .params-card { margin-bottom: var(--space-3); }
  .param-row { padding: 5px 0; }
  .param-label-row { margin-bottom: 5px; }
  .param-stepper {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    gap: var(--space-1);
  }
  .param-step-btn {
    width: 30px;
    height: 30px;
    font-size: 18px;
  }
  .section-title { font-size: 16px; margin: var(--space-3) 0 var(--space-2); }
  .btn-area { margin: var(--space-3) 0; gap: var(--space-2); }
  .feature-section { margin-top: var(--space-3); margin-bottom: var(--space-3); }
  .seo-link-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .feature-title { font-size: 13px; margin-bottom: var(--space-3); text-align: center; }
  .feature-item { padding: var(--space-3) var(--space-2); }
  #entryTutorials {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: center;
    gap: var(--space-3);
  }
  #entryTutorials .feature-icon { flex: 0 0 44px; margin-bottom: 0; }
  #entryTutorials .feature-name { margin-bottom: 0; }
  .feature-icon { width: 44px; height: 44px; font-size: 22px; margin-bottom: var(--space-1); }
  .feature-name { font-size: 13px; margin-bottom: 2px; }
  .feature-desc { font-size: 11px; line-height: 1.3; }

  /* 按钮 */
  .quick-btn { padding: 4px 8px; font-size: 11px; }
  .btn-primary, .btn-secondary {
    padding: var(--space-3) var(--space-3);
    font-size: 14px;
  }

  /* 底部提示隐藏 */
  .footer-tips { display: none !important; }

  /* 小程序码：做大一点，横向布局 */
  .miniapp-card { margin-top: var(--space-3); padding: var(--space-4) var(--space-3); }
  .miniapp-content {
    flex-direction: row !important;
    text-align: left !important;
    gap: var(--space-3) !important;
    align-items: center;
  }
  .miniapp-text h3 { font-size: 13px; margin-bottom: 2px; }
  .miniapp-text p { font-size: 11px; line-height: 1.3; }
  .miniapp-qrcode img { width: 88px !important; height: 88px !important; }

  .qr-bead-page { padding-bottom: var(--tabbar-h); }
  .qr-bead-nav .nav-title { font-size: 17px; }
  .qr-bead-container { padding: 14px 10px 26px; }
  .qr-bead-heading { padding: 2px 4px 16px; }
  .qr-bead-heading h2 { font-size: 23px; }
  .qr-bead-heading p { font-size: 13px; line-height: 1.6; }
  .qr-local-badge { width: 100%; justify-content: center; font-size: 11px; }
  .qr-bead-workspace { gap: 12px; padding-top: 12px; }
  .qr-builder-panel,
  .qr-result-panel { padding: 14px; }
  .qr-step-heading h3,
  .qr-result-head h3 { font-size: 16px; }
  .qr-upload-area { min-height: 140px; padding: 16px 10px; }
  .qr-source-preview { grid-template-columns: 86px minmax(0, 1fr); }
  .qr-source-preview img { width: 86px; height: 86px; }
  .qr-source-tabs { margin-top: 13px; }
  .qr-source-tab { min-height: 38px; padding: 7px 5px; font-size: 12px; }
  .qr-size-options { gap: 6px; }
  .qr-size-option { min-height: 58px; padding: 8px 3px; }
  .qr-size-option strong { font-size: 12px; }
  .qr-result-empty { min-height: 360px; padding: 24px 10px; }
  .qr-result-stats { grid-template-columns: 1fr 1fr; }
  .qr-preview-tabs { justify-content: stretch; }
  .qr-preview-tab { flex: 1; padding: 7px 3px; font-size: 12px; }
  .qr-line-color-panel { justify-content: space-between; gap: 6px; }
  .qr-line-color-options { gap: 4px; }
  .qr-line-color-option { gap: 4px; padding: 5px 7px; font-size: 10px; }
  .qr-canvas-stage { height: calc(100vw - 48px); min-height: 290px; padding: 8px; }
  .qr-download-actions { grid-template-columns: 1fr; }
  .qr-download-actions button { min-height: 44px; font-size: 13px; }
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: rgba(26, 26, 46, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 20000;
  animation: toastIn 0.25s ease;
  pointer-events: none;
}
.toast.success { background: linear-gradient(135deg, #4ECDC4, #44A08D); }
.toast.error { background: linear-gradient(135deg, #e74c3c, #c0392b); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* 存储警告条 */
.storage-warning {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.1));
  border: 1px solid rgba(255, 152, 0, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 16px auto;
  max-width: 1000px;
  font-size: 13px;
  color: #8a5a00;
  line-height: 1.6;
}
.storage-warning b { color: #d97706; }

/* ==============================
   皮肤切换：侧边栏按钮 + 弹窗
   ============================== */
.side-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 var(--space-3) var(--space-3);
}
.side-theme-btn,
.side-lang-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
  transition: all .2s;
}
.side-theme-btn .side-nav-icon,
.side-lang-btn .side-nav-icon { font-size: 16px; }
.side-theme-btn .side-nav-label,
.side-lang-btn .side-nav-label { flex: none; }
.side-theme-btn:hover,
.side-lang-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.side-lang-btn {
  font-weight: 700;
  background: rgba(255, 255, 255, 0.72);
}

.theme-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  z-index: 15000;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  animation: fadeIn .2s ease;
}
.theme-modal-content {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-5);
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
}
.theme-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-4);
}
.theme-modal-header h2 { font-size: 20px; color: var(--text-1); margin: 0; }
.theme-modal-close {
  background: none; border: none; font-size: 22px; color: var(--text-3);
  cursor: pointer; padding: 4px 10px; border-radius: 8px;
}
.theme-modal-close:hover { background: rgba(0,0,0,0.05); color: var(--text-1); }

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
}
.theme-card {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: var(--space-2);
  transition: all .2s;
  background: rgba(255,255,255,0.5);
}
.theme-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.theme-card.active { border-color: var(--accent); background: var(--accent-soft); }
.theme-preview {
  height: 100px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.05);
}
.theme-preview::after {
  content: '';
  position: absolute;
  left: 12px; top: 14px;
  width: 50%; height: 60%;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(6px);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.7);
}
.theme-preview-default {
  background:
    radial-gradient(circle at 20% 20%, #ffd6e0 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, #c7e9ff 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, #e0d4ff 0%, transparent 50%),
    #f7f9ff;
}
.theme-preview-mint {
  background:
    radial-gradient(circle at 20% 20%, #b8f5d9 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, #a8e6f0 0%, transparent 50%),
    #f0fff8;
}
.theme-preview-sunset {
  background:
    radial-gradient(circle at 20% 30%, #ffd29a 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, #ffb1b1 0%, transparent 50%),
    #fff5ec;
}
.theme-preview-dark {
  background:
    radial-gradient(circle at 30% 30%, #3a3a5e 0%, transparent 60%),
    radial-gradient(circle at 70% 70%, #2a2a4a 0%, transparent 60%),
    #15152a;
}
.theme-preview-dark::after { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.theme-preview-minimal { background: #fafafa; border: 1px solid #e0e0e0; }
.theme-preview-minimal::after { background: rgba(255,255,255,0.95); border-color: #e8e8e8; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.theme-name { font-size: 13px; text-align: center; color: var(--text-1); padding: 4px 0; }
.theme-default-tag {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  margin-left: 4px;
}

/* === 主题：薄荷清新 === */
body.theme-mint {
  --accent: #2ec4a5;
  --accent-2: #4dd9b9;
  --accent-soft: rgba(46,196,165,0.12);
  background:
    radial-gradient(circle at 0% 0%, #b8f5d9 0%, transparent 45%),
    radial-gradient(circle at 100% 50%, #a8e6f0 0%, transparent 45%),
    radial-gradient(circle at 50% 100%, #d4f5d8 0%, transparent 45%),
    #f0fff8;
  background-attachment: fixed;
}

/* === 主题：日落暖橙 === */
body.theme-sunset {
  --accent: #ff7849;
  --accent-2: #ff9a6c;
  --accent-soft: rgba(255,120,73,0.12);
  background:
    radial-gradient(circle at 0% 0%, #ffd29a 0%, transparent 45%),
    radial-gradient(circle at 100% 50%, #ffb1b1 0%, transparent 45%),
    radial-gradient(circle at 50% 100%, #ffe2cc 0%, transparent 45%),
    #fff5ec;
  background-attachment: fixed;
}

/* === 主题：暗夜玻璃 === */
body.theme-dark {
  --accent: #7b8cff;
  --accent-2: #9aa6ff;
  --accent-soft: rgba(123,140,255,0.18);
  --glass-bg: rgba(40,40,60,0.55);
  --glass-bg-strong: rgba(30,30,50,0.85);
  --glass-border: rgba(255,255,255,0.12);
  --text-1: #e8e8f0;
  --text-2: #b8b8c8;
  --text-3: #888898;
  background:
    radial-gradient(circle at 0% 0%, #2a2a4a 0%, transparent 50%),
    radial-gradient(circle at 100% 50%, #3a2a5a 0%, transparent 50%),
    radial-gradient(circle at 50% 100%, #1a2a4a 0%, transparent 50%),
    #15152a;
  background-attachment: fixed;
  color: var(--text-1);
}
body.theme-dark .upload-area { color: var(--text-2); }
body.theme-dark input, body.theme-dark select, body.theme-dark .select-box {
  background: rgba(255,255,255,0.08); color: var(--text-1); border-color: rgba(255,255,255,0.15);
}
body.theme-dark .quick-btn { background: rgba(255,255,255,0.08); color: var(--text-2); }
body.theme-dark .grid-color-btn,
body.theme-dark .grid-bold-color-trigger,
body.theme-dark .grid-bold-color-menu {
  background: #24243a;
  border-color: rgba(255,255,255,0.14);
}
body.theme-dark .grid-bold-color-trigger:hover,
body.theme-dark .grid-bold-color-trigger[aria-expanded="true"] {
  background: #2d2d47;
  border-color: rgba(154,166,255,0.55);
}
body.theme-dark .grid-bold-color-close {
  color: var(--text-2);
  background: rgba(255,255,255,0.1);
}
body.theme-dark .grid-bold-color-option {
  color: var(--text-2);
  background: rgba(255,255,255,0.07);
}
body.theme-dark .grid-bold-color-option:hover {
  background: rgba(255,255,255,0.11);
}
body.theme-dark .grid-bold-color-option.active {
  color: var(--text-1);
  background: rgba(123,140,255,0.16);
  border-color: rgba(123,140,255,0.48);
}

/* === 主题：极简白 === */
body.theme-minimal {
  --accent: #1a1a2e;
  --accent-2: #4a4a6a;
  --accent-soft: rgba(26,26,46,0.06);
  --glass-bg: rgba(255,255,255,0.9);
  --glass-bg-strong: rgba(255,255,255,1);
  --glass-border: #e8e8ec;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.08);
  background: #fafafa;
  background-attachment: fixed;
}

/* ============================================================
   VIP 徽章 & AI 像素风页
   ============================================================ */

.vip-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #6b4500;
  background: linear-gradient(135deg, #ffe082 0%, #ffd54f 50%, #ffb300 100%);
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 6px rgba(255, 179, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: vipShine 2.4s ease-in-out infinite;
}

@keyframes vipShine {
  0%, 100% { box-shadow: 0 2px 6px rgba(255, 179, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
  50%      { box-shadow: 0 2px 14px rgba(255, 179, 0, 0.7),  inset 0 1px 0 rgba(255, 255, 255, 0.8); }
}

body.vip-mode .side-nav-item.vip-only {
  position: relative;
}
body.vip-mode .side-nav-item.vip-only::after {
  content: 'VIP';
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 9px;
  font-weight: 800;
  color: #6b4500;
  background: linear-gradient(135deg, #ffe082, #ffb300);
  padding: 1px 5px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

body.staff-mode .side-nav-item.vip-only,
body.staff-mode .side-qr,
body.staff-mode .side-qr-hint,
body.staff-mode .miniapp-card {
  display: none !important;
}

/* ---- AI 页面 ---- */

.ai-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4) var(--space-5);
}

/* AI 页面单栏布局 */
.ai-layout {
  display: block;
}
.ai-left {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}
.ai-right {
  display: none !important;
}
.ai-right-sticky {
  position: sticky;
  top: 72px;
}

/* 右栏占位提示 */
.ai-right-placeholder {
  padding: var(--space-5) var(--space-4);
  background: var(--glass-bg-strong);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  text-align: center;
}
.ai-placeholder-icon {
  font-size: 48px;
  margin-bottom: var(--space-2);
  opacity: 0.5;
}
.ai-placeholder-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.ai-placeholder-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

@media (max-width: 900px) {
  .ai-layout {
    display: block;
  }
  .ai-right {
    display: none !important;
  }
  .ai-right-sticky {
    position: static;
  }
  .ai-right-placeholder {
    display: none;
  }
}

.ai-vip-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  color: #6b4500;
  background: linear-gradient(135deg, #ffe082, #ffb300);
  border-radius: var(--radius-pill);
  vertical-align: middle;
}

.ai-hero {
  text-align: center;
  padding: var(--space-2) var(--space-3) var(--space-3);
  margin-bottom: var(--space-3);
}
.ai-hero-icon {
  font-size: 36px;
  margin-bottom: 4px;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.ai-hero-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 4px 0;
  background: linear-gradient(135deg, #FF6B6B 0%, #C77DFF 50%, #4ECDC4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ai-hero-desc {
  font-size: 12px;
  color: var(--text-2, #666);
  line-height: 1.5;
  margin: 0;
}

.ai-status-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(135deg, rgba(255, 224, 130, 0.25), rgba(255, 179, 0, 0.12));
  border: 1px solid rgba(255, 179, 0, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.ai-status-icon {
  font-size: 28px;
  animation: spin 4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-status-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 2px;
}
.ai-status-desc {
  font-size: 13px;
  color: var(--text-2, #666);
  line-height: 1.5;
}

.ai-step { margin-bottom: var(--space-4); }
.ai-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: var(--space-3);
}
.ai-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-grad);
  border-radius: 50%;
}

.ai-styles-section { margin-bottom: var(--space-5); }
.ai-styles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}
.ai-style-item {
  position: relative;
  padding: var(--space-3);
  background: var(--glass-bg-strong);
  border: 2px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.ai-style-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 6px 20px rgba(31,38,135,0.1));
}
.ai-style-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow-md, 0 6px 20px rgba(31,38,135,0.15));
}
.ai-style-item.selected::after {
  content: '✓';
  position: absolute;
  top: 8px; left: 8px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-grad);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 50%;
}
.ai-style-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
  background: var(--glass-bg-soft);
}
.ai-style-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ai-style-fallback-text {
  font-size: 14px;
  font-weight: 700;
  color: rgba(0,0,0,0.5);
  letter-spacing: 1px;
}
.ai-style-fallback-1, .ai-style-1 { background: linear-gradient(135deg, #ffd6e0, #c7e9ff); }
.ai-style-fallback-2, .ai-style-2 { background: linear-gradient(135deg, #fdf6b2, #fde68a); }
.ai-style-fallback-3, .ai-style-3 { background: linear-gradient(135deg, #c7e9ff, #e0d4ff); }
.ai-style-fallback-4, .ai-style-4 { background: linear-gradient(135deg, #ffe5ec, #fbcfe8); }
.ai-style-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}
.ai-style-desc {
  font-size: 11px;
  color: var(--text-2, #888);
  margin-top: 2px;
  line-height: 1.4;
}
.ai-style-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-grad);
  border-radius: var(--radius-pill);
}
.ai-style-empty {
  grid-column: 1 / -1;
  padding: var(--space-5);
  text-align: center;
  color: var(--text-2, #888);
  font-size: 13px;
}

.ai-upload-section { margin-bottom: var(--space-5); }
.ai-upload-area {
  position: relative;
  padding: var(--space-4) var(--space-3);
  background: var(--glass-bg-strong);
  border: 2px dashed var(--glass-border-soft);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-upload-area:hover, .ai-upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.ai-upload-empty { width: 100%; }
.ai-upload-preview {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ai-upload-preview img {
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md, 0 6px 20px rgba(31,38,135,0.12));
}
.ai-clear-btn {
  position: absolute;
  top: -8px; right: -8px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: #ff4d4f;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.ai-clear-btn:hover { background: #d9363e; }

.ai-action-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.ai-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 40px;
  background: var(--accent-grad);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 4px 16px var(--accent-ring);
}
.ai-generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px var(--accent-ring);
}
.ai-generate-btn.ai-generate-btn-purchase {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}
.ai-generate-btn.ai-generate-btn-purchase:hover {
  box-shadow: 0 6px 22px rgba(239, 68, 68, 0.32);
}
.ai-generate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.ai-generate-icon { font-size: 18px; }
.ai-quota-tip {
  font-size: 12px;
  color: var(--text-2, #888);
  min-height: 16px;
}

.side-nav-item.vip-access-locked {
  opacity: 0.36;
  filter: grayscale(1);
  cursor: not-allowed;
}
.side-nav-item.vip-access-locked:hover {
  transform: none;
}
body.vip-mode:not(.vip-usage-locked) .side-nav-item:not(.active),
body.vip-mode:not(.vip-usage-locked) .mobile-more-nav:not(.active) {
  color: var(--text-1);
  opacity: 1;
}
.mobile-more-grid button.vip-access-locked {
  opacity: 0.38;
  filter: grayscale(1);
  cursor: not-allowed;
}
.ai-result-use-image {
  cursor: pointer;
}
.ai-result-use-image:focus-visible {
  outline: 3px solid rgba(255, 107, 107, 0.55);
  outline-offset: 3px;
}
.vip-usage-locked .ai-fallback-card,
.vip-usage-locked #aiBackBtn,
.vip-usage-locked #aiGoHomeBtn {
  display: none !important;
}

.purchase-guide-mask {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.66);
  backdrop-filter: blur(5px);
}
.purchase-guide-box {
  position: relative;
  width: min(460px, 92vw);
  max-height: min(88vh, 760px);
  overflow: auto;
  padding: 22px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  text-align: center;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}
.purchase-guide-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #475569;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.purchase-guide-title {
  margin: 8px 38px 10px;
  color: #111827;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
}
.purchase-guide-lock-tip {
  margin: 0 0 16px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.65;
}
.vip-renew-options {
  margin-bottom: 16px;
}
.vip-renew-loading,
.vip-renew-empty,
.purchase-guide-empty {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 14px;
  line-height: 1.65;
}
.vip-renew-plans {
  display: grid;
  gap: 8px;
}
.vip-renew-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 62px;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid #dce1e8;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  text-align: left;
  cursor: pointer;
}
.vip-renew-plan.selected {
  border-color: #ff6b61;
  background: #fff7f6;
  box-shadow: inset 3px 0 0 #ff6b61;
}
.vip-renew-plan span {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.vip-renew-plan strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vip-renew-plan small {
  color: #64748b;
  font-size: 12px;
}
.vip-renew-plan b {
  flex: 0 0 auto;
  color: #e65047;
  font-size: 19px;
}
.vip-renew-payments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.vip-renew-pay {
  min-height: 48px;
  padding: 10px 12px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
}
.vip-renew-wechat { background: #07a94f; }
.vip-renew-alipay { background: #1677ff; }
.purchase-guide-dealer-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
  color: #64748b;
  font-size: 13px;
}
.purchase-guide-dealer-label::before,
.purchase-guide-dealer-label::after {
  height: 1px;
  flex: 1;
  background: #e5e7eb;
  content: '';
}
.purchase-guide-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
}
.purchase-guide-tip {
  margin: 12px 4px 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 520px) {
  .purchase-guide-mask {
    align-items: flex-end;
    padding: 0;
  }
  .purchase-guide-box {
    width: 100%;
    max-height: 90dvh;
    padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }
  .purchase-guide-title {
    margin-top: 4px;
    font-size: 20px;
  }
  .vip-renew-payments {
    grid-template-columns: 1fr;
  }
}

/* ===== AI 生成中 / 结果展示 ===== */
.ai-loading {
  margin: var(--space-4) 0;
  padding: var(--space-5) var(--space-4);
  background: var(--glass-bg-strong);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-align: center;
}
.ai-loading-spinner {
  width: 48px; height: 48px; margin: 0 auto var(--space-3);
  border: 4px solid rgba(255,107,107,0.15);
  border-top-color: #FF6B6B;
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-loading-text { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.ai-loading-sub { font-size: 12px; color: var(--text-secondary); }

/* 进度条 */
.ai-progress-wrap {
  display: flex; align-items: center; gap: 12px;
  max-width: 360px; margin: 12px auto 8px;
}
.ai-progress-bar {
  flex: 1; height: 10px; border-radius: 999px;
  background: rgba(255,107,107,0.12); overflow: hidden;
}
.ai-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #FF8E8E, #FF6B6B);
  border-radius: 999px;
  transition: width 0.4s ease-out;
}
.ai-progress-num {
  min-width: 42px; text-align: right;
  font-size: 14px; font-weight: 700; color: #FF6B6B;
  font-variant-numeric: tabular-nums;
}

/* 生成记录 */
.ai-step-num-history { background: linear-gradient(135deg, #6BC1FF, #4A9EFF) !important; }
.ai-history-clear {
  margin-left: auto; padding: 4px 10px;
  font-size: 12px; color: var(--text-secondary);
  background: transparent; border: 1px solid var(--border-color);
  border-radius: 6px; cursor: pointer;
}
.ai-history-clear:hover { color: #FF6B6B; border-color: #FF6B6B; }
.ai-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.ai-history-item {
  position: relative; cursor: pointer;
  border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--glass-bg-strong);
  transition: transform .15s, border-color .15s;
}
.ai-history-item:hover { transform: translateY(-2px); border-color: #FF6B6B; }
.ai-history-item img { display: block; width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.ai-history-item .ai-history-meta {
  padding: 4px 6px; font-size: 11px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ai-history-del {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff; border: none;
  font-size: 12px; line-height: 20px; text-align: center;
  cursor: pointer; opacity: 0; transition: opacity .15s;
}
.ai-history-item:hover .ai-history-del { opacity: 1; }
.ai-history-empty {
  grid-column: 1 / -1;
  padding: 24px 12px; text-align: center;
  font-size: 13px; color: var(--text-secondary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--glass-bg-strong);
}

.ai-result {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: var(--glass-bg-strong);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}
#aiResult {
  display: none !important;
}
.ai-result-compare {
  display: flex; align-items: center; gap: var(--space-3);
  margin: var(--space-3) 0;
}
.ai-result-col { flex: 1; min-width: 0; text-align: center; }
.ai-result-col img {
  width: 100%; max-height: 360px; object-fit: contain;
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
}
.ai-upload-area.has-ai-result {
  padding: var(--space-3);
  border-style: solid;
  border-color: rgba(255, 107, 107, 0.24);
  background: rgba(255, 255, 255, 0.74);
}
.ai-upload-area.has-ai-result .ai-upload-preview img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: rgba(0,0,0,0.04);
}
.ai-upload-area.has-ai-result > .ai-upload-preview > #aiPreviewImg {
  display: none;
}
.ai-upload-area.is-ai-generating {
  padding: var(--space-3);
  border-style: solid;
  border-color: rgba(255, 107, 107, 0.28);
  background: rgba(255,255,255,0.78);
}
.ai-upload-area.is-ai-generating #aiPreviewImg,
.ai-upload-area.is-ai-generating .ai-clear-btn {
  display: none;
}
.ai-upload-loading {
  width: 100%;
  min-height: 260px;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}
.ai-upload-area.has-ai-result .ai-clear-btn {
  display: none;
}
.ai-upload-result-panel {
  width: 100%;
  margin-top: var(--space-3);
}
.ai-upload-result-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: var(--space-2);
  text-align: left;
}
.ai-current-flow-notice {
  margin: 0 0 var(--space-3);
  padding: 9px 11px;
  border: 1px solid rgba(245, 158, 11, 0.34);
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}
.ai-current-flow-notice[hidden] {
  display: none;
}
.ai-upload-result-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.ai-upload-result-item {
  min-width: 0;
}
.ai-upload-result-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
  text-align: center;
}
.ai-upload-result-item img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.04);
  border: 1px solid var(--border-color);
}
.ai-upload-result-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}
.ai-upload-result-actions .ai-result-btn {
  min-width: 0;
  padding: 10px 12px;
  white-space: nowrap;
}
.ai-result-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.ai-result-arrow { font-size: 24px; color: #FF6B6B; flex-shrink: 0; }
.ai-result-actions {
  display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-3);
}
.ai-result-btn {
  flex: 1; min-width: 130px;
  padding: 10px 16px; font-size: 14px; font-weight: 600;
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ai-result-btn:hover { transform: translateY(-1px); }
.ai-result-btn-primary {
  background: linear-gradient(135deg, #FF6B6B, #FF8E8E);
  color: #fff; border: none;
  box-shadow: 0 4px 12px rgba(255,107,107,0.25);
}
@media (max-width: 600px) {
  .ai-result-compare { flex-direction: column; }
  .ai-result-arrow { transform: rotate(90deg); }
  .ai-result-btn { min-width: 100%; }
  .ai-upload-result-compare { grid-template-columns: 1fr; }
  .ai-upload-result-actions { grid-template-columns: 1fr; }
}

.ai-fallback-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius-md);
}
.ai-fallback-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2, #666);
}
.ai-fallback-text strong {
  font-size: 15px;
  color: var(--text-1);
}
.ai-fallback-btn {
  flex-shrink: 0;
  padding: 10px 18px;
  background: var(--accent-grad);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ai-fallback-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-ring);
}

@media (max-width: 600px) {
  .ai-container { padding: var(--space-3); }
  .ai-hero-title { font-size: 20px; }
  .ai-hero-icon { font-size: 44px; }
  .ai-styles-grid { grid-template-columns: repeat(2, 1fr); }
  .ai-fallback-card { flex-direction: column; align-items: stretch; text-align: center; }
}

@media (max-width: 1024px) {
  #homeBeadGallery,
  .bead-gallery-grid-full { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .section-head,
  .gallery-page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .section-head-actions {
    width: 100%;
  }
  .section-head-actions .gallery-download-all-btn,
  .section-head-actions .section-link-btn {
    flex: 1 1 0;
  }
  .gallery-download-all-btn-wide {
    width: 100%;
  }
  .gallery-home-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .gallery-more-cta {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-4);
  }
  .gallery-more-action { width: 100%; }
}

@media (max-width: 520px) {
  .bead-gallery-grid,
  .bead-gallery-grid-full {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bead-gallery-grid { gap: 12px; }
  .bead-detail-mask, .bead-qr-mask { padding: 12px; }
  .bead-detail-dialog { padding: 16px; max-height: 92vh; }
  .bead-detail-images { grid-template-columns: 1fr; gap: 14px; }
  .bead-detail-image-button img { aspect-ratio: auto; max-height: 52vh; }
  .bead-qr-header { min-height: 68px; padding: 14px 16px; }
  .bead-qr-content { padding: 14px; }
  .bead-qr-code-panel { padding: 14px 12px 12px; }
  .bead-gallery-qr { width: min(300px, 76vw); }
}

/* Keep the language switch compact inside the mobile tab bar. */
@media (max-width: 900px) {
  .app-sidebar .side-bottom {
    position: static;
    flex: 0 0 auto;
    width: auto;
    padding: 0;
    gap: 0;
  }
  .app-sidebar .side-lang-btn {
    width: 46px;
    min-width: 46px;
    height: 46px;
    padding: 0;
    flex-direction: column;
    gap: 1px;
    border-radius: 999px;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.65);
  }
.app-sidebar .side-lang-btn .side-nav-label {
    flex: none;
    max-width: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 9px;
    line-height: 1;
  }
}

body.payment-checkout-open { overflow: hidden; }

.payment-checkout-mask {
  position: fixed;
  inset: 0;
  z-index: 12100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  background: rgba(15, 20, 31, .66);
  opacity: 0;
  transition: opacity .16s ease;
}

.payment-checkout-mask.show { opacity: 1; }

.payment-choice-dialog {
  width: min(420px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  border: 1px solid #e2e6ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(17, 24, 39, .28);
}
.payment-choice-dialog:focus { outline: none; }

.payment-choice-options { display: grid; gap: 10px; padding: 18px; }
.payment-choice-recovery { display: block; padding: 0 18px 18px; color: #c44841; font-size: 13px; font-weight: 700; text-align: center; text-decoration: underline; text-underline-offset: 3px; }
.payment-choice-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid #dfe4eb;
  border-radius: 6px;
  background: #fff;
  color: #202532;
  text-align: left;
  cursor: pointer;
}
.payment-choice-option:hover { border-color: #f05b54; background: #fff9f8; }
.payment-choice-option[hidden] { display: none; }
.payment-choice-option:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.payment-choice-option .payment-checkout-provider { flex: 0 0 22px; }
.payment-choice-copy { display: grid; gap: 3px; min-width: 0; }
.payment-choice-copy strong { font-size: 16px; line-height: 1.3; }
.payment-choice-copy small { color: #667085; font-size: 12px; line-height: 1.4; }
.payment-choice-status { margin: 8px 0; color: #667085; font-size: 13px; text-align: center; }

.payment-checkout-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  height: min(720px, calc(100dvh - 40px));
  min-height: 420px;
  overflow: hidden;
  border: 1px solid #e2e6ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(17, 24, 39, .28);
}

.payment-checkout-header {
  display: flex;
  flex: 0 0 60px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px 0 20px;
  border-bottom: 1px solid #e9ecf1;
  background: #fff;
}

.payment-checkout-title-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.payment-checkout-title-wrap > div {
  display: grid;
  min-width: 0;
}

.payment-checkout-title-wrap strong {
  color: #202532;
  font-size: 16px;
  line-height: 1.35;
}

.payment-checkout-title-wrap small {
  overflow: hidden;
  color: #7a8494;
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-checkout-provider {
  position: relative;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 2px solid #08a94f;
  border-radius: 50%;
}

.payment-checkout-provider.wechat::after {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #08a94f;
  content: '';
}

.payment-checkout-provider.alipay {
  border-color: #1677ff;
  border-radius: 5px;
}

.payment-checkout-provider.alipay::after {
  position: absolute;
  inset: 4px;
  border: 2px solid #1677ff;
  border-top: 0;
  content: '';
  transform: rotate(-12deg);
}

.payment-checkout-close {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f3f5f7;
  color: #5f6978;
  font-size: 25px;
  line-height: 38px;
  cursor: pointer;
}

.payment-checkout-close:hover { background: #e8ebef; }

.payment-checkout-frame {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

.payment-checkout-loading {
  position: absolute;
  inset: 60px 0 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #667085;
  font-size: 14px;
  transition: opacity .15s ease;
}

.payment-checkout-loading.hidden {
  pointer-events: none;
  opacity: 0;
}

@media (max-width: 600px) {
  .payment-checkout-mask {
    padding: 10px 8px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .payment-checkout-dialog {
    width: 100%;
    height: calc(100dvh - max(20px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
    min-height: 0;
  }
  .payment-checkout-header {
    flex-basis: 54px;
    padding: 0 12px 0 14px;
  }
  .payment-checkout-loading { inset: 54px 0 0; }
  .payment-checkout-title-wrap strong { font-size: 15px; }
  .payment-checkout-close { width: 34px; height: 34px; line-height: 34px; }
}

/* ============================================================
   MOBILE WORKSPACE — focused layout without changing desktop
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --mobile-gap: 12px;
    --mobile-side: 14px;
    --mobile-nav-h: 66px;
    --tabbar-h: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px));
  }

  html, body { min-height: 100%; overflow-x: clip; }
  body {
    background: #f5f6f8;
    background-attachment: scroll;
  }
  body.mobile-sheet-open { overflow: hidden; }

  .app-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 18px var(--mobile-side) calc(var(--tabbar-h) + 24px);
  }
  .app-main > .container { width: 100%; max-width: 720px; margin: 0 auto; }

  .app-sidebar {
    height: var(--tabbar-h);
    padding: 6px max(8px, env(safe-area-inset-left, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-right, 0px));
    gap: 2px;
    background: rgba(255,255,255,0.97);
    border-top-color: rgba(25,34,52,0.1);
    box-shadow: 0 -4px 18px rgba(25,34,52,0.08);
  }
  .app-sidebar .side-nav { flex: 3 1 0; width: auto; gap: 2px; justify-content: stretch; overflow: visible; }
  body.vip-mode .app-sidebar .side-nav,
  html.vip-direct-entry .app-sidebar .side-nav { flex-grow: 4; }
  .app-sidebar .side-nav-item {
    display: none;
    min-height: 54px;
    padding: 4px 2px 3px;
    border-radius: 7px;
  }
  .app-sidebar .side-nav-item[data-page="home"],
  .app-sidebar .side-nav-item[data-page="gallery"],
  .app-sidebar .side-nav-item[data-page="draw"],
  .app-sidebar #aiNavItem { display: flex; }
  .app-sidebar .side-nav-icon { width: 22px; height: 22px; flex-basis: 22px; font-size: 19px; }
  .app-sidebar .side-nav-label { font-size: 10px; line-height: 13px; }
  .app-sidebar .side-bottom { display: none !important; }
  .mobile-more-nav {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    padding: 4px 2px 3px;
    color: var(--text-2);
    background: transparent;
    border: 0;
    border-radius: 7px;
  }
  .mobile-more-nav.active { color: var(--accent); background: var(--accent-soft); }
  .mobile-more-nav .side-nav-icon { font-size: 17px; letter-spacing: 1px; }
  .mobile-more-nav .side-nav-label { flex: none; width: 100%; font-size: 10px; line-height: 13px; }

  .mobile-more-mask {
    position: fixed;
    inset: 0;
    z-index: 16000;
    display: flex;
    align-items: flex-end;
    padding: 12px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(20,25,34,0.46);
    backdrop-filter: blur(4px);
  }
  .mobile-more-mask[hidden] { display: none !important; }
  .mobile-more-sheet {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 8px 14px 18px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(17,24,39,0.24);
    animation: mobileSheetUp .18s ease-out;
  }
  @keyframes mobileSheetUp { from { transform: translateY(16px); opacity: 0; } }
  .mobile-sheet-handle { width: 36px; height: 4px; margin: 0 auto 8px; border-radius: 3px; background: #d6d9df; }
  .mobile-more-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .mobile-more-head h2 { font-size: 18px; letter-spacing: 0; }
  .mobile-more-close { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f2f3f5; color: var(--text-2); font-size: 16px; }
  .mobile-more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .mobile-more-grid button {
    min-width: 0;
    min-height: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 5px;
    border: 1px solid #e7e9ed;
    border-radius: 7px;
    background: #f8f9fa;
    color: var(--text-1);
  }
  .mobile-more-grid button span { font-size: 22px; line-height: 1; }
  .mobile-more-grid button strong { max-width: 100%; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .page-header { margin: 0 0 14px; text-align: left; }
  .page-title { margin-bottom: 3px; font-size: 23px; line-height: 1.25; letter-spacing: 0; }
  .page-subtitle { font-size: 13px; }
  .upload-card,
  .params-card,
  .bead-gallery-section,
  .feature-section,
  .miniapp-card,
  .seo-link-section,
  .preview-section,
  .action-buttons,
  .color-list-section,
  .result-section,
  .picker-toolbar,
  .image-display-area,
  .records-section,
  .form-card,
  .new-card,
  .work-item {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #fff;
    border-color: #e7e9ed;
    box-shadow: 0 2px 10px rgba(25,34,52,0.05);
  }

  .upload-card { margin: 0 0 12px; padding: 10px; }
  .upload-area { min-height: 148px; padding: 22px 12px; border-radius: 7px; background: #fffafb; }
  .upload-icon { width: 52px; height: 52px; margin-bottom: 8px; font-size: 27px; }
  .upload-title { margin-bottom: 3px; font-size: 15px; }
  .upload-subtitle { font-size: 12px; }
  .create-grid { display: block; }
  .preview-card { margin: 0 0 10px; padding: 8px; background: #fff; border: 1px solid #e7e9ed; box-shadow: 0 2px 10px rgba(25,34,52,0.05); }
  .preview-img { width: 100%; max-height: 42svh; object-fit: contain; }
  .param-preview-wrap { min-height: clamp(240px, 62vw, 390px); margin: 0 0 10px; padding: 10px; background: #fff; border-color: #e7e9ed; }
  .section-title { margin: 14px 2px 8px; font-size: 17px; }
  .params-card { display: flex !important; flex-flow: row wrap; column-gap: 8px; margin: 0 0 12px; padding: 4px 14px; }
  .params-card > .divider { display: none; }
  .params-card > .param-row { flex: 0 0 100%; min-width: 0; padding: 10px 0; border-top: 1px solid #eceef1; }
  #widthParamRow { order: 1; border-top: 0; }
  #colorCountParamRow { order: 2; }
  #brandParamRow,
  #mardSpecRow { flex: 1 1 calc(50% - 4px); width: auto; order: 3; }
  #mardSpecRow > .divider { display: none; }
  #brandParamRow .param-desc,
  #mardSpecRow .param-desc { display: none; }
  #brandParamRow .select-box,
  #mardSpecRow .select-box {
    min-width: 0;
    padding-left: 10px;
    padding-right: 28px;
    background-position: right 8px center;
    font-size: 13px;
  }
  #colorCountParamLabel { font-size: 0; }
  #colorCountParamLabel::before { content: attr(data-mobile-label); font-size: 14px; }
  #widthParamRow .param-hint { margin-top: 5px; }
  #widthParamRow .quick-size-row { margin-top: 7px; }
  #colorCountParamRow .param-desc { margin-top: 5px; }
  .param-row { padding: 10px 0; }
  .param-label-row { margin-bottom: 8px; }
  .param-name { font-size: 14px; }
  .param-stepper { grid-template-columns: 40px minmax(0, 1fr) 40px; gap: 7px; }
  .param-step-btn { width: 40px; height: 40px; font-size: 21px; }
  .param-slider { min-width: 0; }
  .quick-size-row { gap: 7px; align-items: center; }
  .quick-size-label { flex: 0 0 auto; font-size: 12px; }
  .quick-size-buttons { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .quick-btn { min-width: 0; min-height: 34px; padding: 5px 4px; }
  .select-box { min-height: 44px; width: 100%; font-size: 14px; }
  .btn-area { margin: 12px 0 16px; gap: 8px; }
  .btn-area .btn-primary { flex: 1.7; min-height: 48px; }
  .btn-area .btn-secondary { flex: 1; min-height: 48px; }
  #homeGallerySection,
  #featureSection,
  #seoLinkSection,
  #miniappCard,
  #footerTips { display: none !important; }

  .result-page, .picker-page, .draw-list-page, .gallery-page, .tutorial-page, .qr-bead-page, .text-bead-page,
  .draw-new-page, .draw-canvas-page, .ai-page {
    padding-bottom: calc(var(--tabbar-h) + 18px);
    background: #f5f6f8;
  }
  .nav-bar { position: sticky; top: 0; z-index: 20; min-height: 52px; padding: 10px 56px; background: rgba(255,255,255,0.96); backdrop-filter: blur(12px); }
  .nav-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .back-btn { left: 10px; min-height: 38px; padding: 7px 10px; border: 0; background: #fff1f0; }
  .result-container { display: flex; flex-direction: column; gap: 10px; padding: 10px var(--mobile-side) 20px; }
  .preview-section { display: flex; flex-direction: column; padding: 10px; border-radius: 8px; }
  .preview-tabs { order: 0; width: 100%; flex-wrap: wrap; justify-content: center; margin-bottom: 7px; border: 0; border-radius: 7px; background: #f2f3f5; }
  .preview-tab { flex: 1 1 26%; min-height: 36px; padding: 6px 8px; }
  .grid-step-group { flex: 1 0 100%; justify-content: center; gap: 4px; margin: 2px 0 0; padding: 5px 0 0; border-left: 0; border-top: 1px solid #e1e3e7; }
  .grid-step-options,
  .grid-thin-color-controls { gap: 2px; }
  .grid-step-btn { min-height: 28px; padding: 3px 6px; }
  .grid-step-label,
  .grid-control-label { font-size: 10px; }
  .grid-step-sep { margin: 0 1px; }
  .grid-color-btn { width: 26px; height: 26px; }
  .grid-bold-color-trigger { min-height: 28px; padding: 4px 6px; gap: 4px; }
  body.grid-bold-color-menu-open::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 17000;
    background: rgba(15,23,42,0.32);
    pointer-events: none;
  }
  .grid-bold-color-menu {
    position: fixed;
    top: auto;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(var(--tabbar-h) + 10px);
    left: max(12px, env(safe-area-inset-left, 0px));
    z-index: 17020;
    width: auto;
    max-height: min(310px, calc(100vh - var(--tabbar-h) - 28px));
    padding: 12px;
    gap: 8px;
    box-shadow: 0 18px 44px rgba(15,23,42,0.28);
  }
  .grid-bold-color-menu-head { min-height: 34px; font-size: 14px; }
  .grid-bold-color-option { min-height: 46px; padding: 9px 10px; font-size: 13px; }
  .grid-bold-color-option .grid-color-swatch { width: 18px; height: 18px; flex-basis: 18px; }
  .preview-zoom-toolbar { order: 1; width: 100%; margin-bottom: 7px; border: 0; border-radius: 7px; background: #f7f8fa; }
  .preview-zoom-range { flex: 1; width: auto; min-width: 0; }
  .image-actions { order: 2; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin: 0 0 7px; padding: 0 0 7px; background: transparent; border: 0; border-bottom: 1px solid #eceef1; box-shadow: none; }
  .image-actions > .mobile-primary-tool,
  .image-actions > .mobile-editor-toggle { display: flex; }
  .mobile-editor-toggle { border: 1px solid #e4e6ea; }
  .mobile-editor-toggle[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); border-color: rgba(233,93,79,0.25); }
  .mobile-secondary-tools { display: none; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; padding-top: 2px; }
  .mobile-secondary-tools.is-open { display: grid; }
  .img-action-btn { min-height: 54px; padding: 6px 2px; border-radius: 6px; }
  .img-action-icon { font-size: 18px; }
  .img-action-text { max-width: 100%; font-size: 10px; line-height: 1.25; text-align: center; white-space: normal; }
  .cell-paint-size-toolbar { order: 3; margin-bottom: 7px; }
  .preview-wrapper { order: 4; width: 100%; height: var(--preview-frame-height, clamp(260px, 88vw, 430px)) !important; min-height: var(--preview-frame-height, clamp(260px, 88vw, 430px)) !important; max-height: var(--preview-frame-height, clamp(260px, 88vw, 430px)) !important; padding: 6px; border-radius: 6px; }
  .preview-stats { order: 5; margin-top: 7px; padding: 9px 6px; background: #f7f8fa; border: 0; box-shadow: none; }
  .stat-value { font-size: 16px; }
  .action-buttons { order: 2; padding: 10px; border-radius: 8px; }
  .result-download-actions { order: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .action-buttons #reselectBtn { order: 2; }
  .action-buttons #printLayoutBtn { order: 3; }
  .action-buttons .btn-secondary { min-height: 46px; padding: 10px 8px; }
  .action-buttons #reselectBtn,
  .action-buttons #printLayoutBtn { min-height: 42px; }
  .color-list-section { order: 3; padding: 12px; border-radius: 8px; }
  .color-list-header { gap: 8px; }
  .color-list-header h3 { min-width: 0; font-size: 15px; }
  .color-list-hint { display: block; width: fit-content; margin: 4px 0 0; font-size: 10px; }
  .toggle-btn { min-width: 54px; min-height: 36px; }
  .color-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .color-list-item { min-width: 0; padding: 7px; }
  .color-list-info { font-size: 11px; }

  .mobile-sticky-action {
    position: fixed;
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: calc(var(--tabbar-h) + 8px);
    z-index: 9500;
    display: block;
    max-width: 560px;
    margin: 0 auto;
    padding: 6px;
    border: 1px solid rgba(25,34,52,0.1);
    border-radius: 8px;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 8px 28px rgba(25,34,52,0.18);
    backdrop-filter: blur(12px);
  }
  .mobile-sticky-action[hidden] { display: none !important; }
  .mobile-sticky-generate,
  .mobile-sticky-downloads button { min-height: 46px; border: 0; border-radius: 6px; color: #fff; background: var(--accent); font-size: 14px; font-weight: 800; }
  .mobile-sticky-generate { width: 100%; }
  .mobile-sticky-downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .mobile-sticky-downloads[hidden] { display: none !important; }
  .mobile-sticky-downloads button:last-child { color: var(--text-1); background: #f1f2f4; }

  .gallery-container { padding: 12px var(--mobile-side) 24px; }
  .gallery-page-head { margin-bottom: 14px; gap: 10px; }
  .gallery-page-head h2 { font-size: 20px; }
  .bead-gallery-grid-full { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gallery-more-cta { margin-top: 18px; padding: 16px 0; }
  .bead-card-view-hint { right: 6px; bottom: 6px; padding: 4px 6px; font-size: 9px; }

  .picker-section { gap: 10px; padding: 10px var(--mobile-side) 20px; }
  .picker-toolbar { padding: 10px; gap: 8px; }
  .magnifier-preview { width: 62px; height: 62px; }
  .image-display-area { min-height: clamp(300px, 82vw, 520px); padding: 8px; }
  .picker-btn-area { gap: 8px; }
  .records-section { padding: 12px; }

  .draw-list-page > *:not(.nav-bar),
  .draw-new-page > *:not(.nav-bar) { padding-left: var(--mobile-side); padding-right: var(--mobile-side); }
  .new-card { margin: 14px auto; padding: 20px 12px; }
  .works-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-bottom: 20px; }
  .form-card { margin: 12px auto; padding: 12px; }
  .form-card .row { padding: 10px 0; }
  .draw-canvas-page .top-bar { padding: 8px 10px; gap: 8px; }
  .top-actions { gap: 5px; }
  .top-btn { padding: 7px 9px; font-size: 11px; }
  .board-wrap { padding: 8px; }
  .draw-toolbar { overflow-x: auto; justify-content: flex-start; gap: 4px; padding: 7px 8px; }
  .tool-item { flex: 0 0 58px; min-width: 58px; padding: 5px; }

  .print-panel { width: 100%; max-width: none; max-height: 100svh; border-radius: 0; }
  .print-range-stage { height: min(64svh, 620px); min-height: 360px; }
  .print-small-btn { min-width: 72px; height: 40px; padding: 0 10px; }

  .tutorial-container { padding: 12px var(--mobile-side) calc(var(--tabbar-h) + 20px); }
  .tutorial-public-video { min-height: 0; height: min(62svh, 620px); }

  .ai-container { padding: 10px var(--mobile-side) 24px; }
  .ai-hero { padding: 4px 4px 10px; }
  .ai-status-card { margin-bottom: 12px; padding: 11px; }
  .ai-step { margin-bottom: 14px; }
  .ai-section-title { margin-bottom: 8px; font-size: 15px; }
  .ai-upload-area { min-height: 130px; padding: 12px; border-radius: 7px; }
  .ai-upload-preview img { max-height: 46svh; }
  .ai-styles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ai-style-item { padding: 7px; border-width: 1px; }
  .ai-style-name { font-size: 12px; }
  .ai-style-desc { display: none; }
  .ai-action-bar { margin-bottom: 14px; }
  .ai-generate-btn { width: 100%; min-height: 48px; justify-content: center; padding: 12px 16px; border-radius: 7px; }
  .ai-history-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .ai-upload-result-compare { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ai-upload-result-actions { grid-template-columns: 1fr; }
  .ai-upload-result-actions .ai-result-btn { min-width: 0; }

  .qr-bead-container { padding: 12px var(--mobile-side) 24px; }
  .qr-bead-heading { padding-bottom: 12px; }
  .qr-bead-heading h2 { font-size: 21px; }
  .qr-builder-panel, .qr-result-panel { padding: 12px; border-radius: 7px; }
  .qr-result-empty { min-height: 260px; }
  .qr-canvas-stage { height: calc(100vw - 54px); min-height: 280px; }

  .text-bead-container { padding: 12px var(--mobile-side) 24px; }
  .text-bead-heading { padding: 2px 2px 12px; }
  .text-bead-heading h2 { margin: 4px 0 6px; font-size: 21px; }
  .text-bead-heading p { font-size: 13px; line-height: 1.6; }
  .text-bead-workspace { grid-template-columns: 1fr; gap: 12px; padding-top: 12px; }
  .text-bead-controls { padding: 0 14px; border-radius: 7px; }
  .text-bead-group { padding: 15px 0; }
  .text-bead-group-head { gap: 9px; margin-bottom: 12px; }
  .text-bead-step { width: 26px; height: 26px; flex-basis: 26px; }
  .text-bead-group-head h3, .text-bead-preview-head h3 { font-size: 15px; }
  .text-bead-input-wrap input { min-height: 48px; font-size: 17px; }
  .text-bead-size-grid { gap: 6px; }
  .text-bead-size-grid button { min-height: 40px; padding: 7px 4px; font-size: 12px; }
  .text-bead-custom-size { gap: 6px; }
  .text-bead-custom-size input { width: 68px; min-height: 38px; }
  .text-bead-style-row { min-height: 50px; gap: 10px; }
  .text-bead-style-row > span { font-size: 12px; }
  .text-bead-color-options { gap: 7px; }
  .text-bead-color-options button { width: 31px; height: 31px; flex-basis: 31px; }
  .text-bead-segmented button { min-width: 62px; min-height: 33px; padding: 5px 9px; }
  .text-bead-preview-panel { position: static; padding: 14px; border-radius: 7px; }
  .text-bead-preview-stage { min-height: 280px; max-height: 58svh; padding: 10px; }
  .text-bead-preview-stage canvas { max-height: calc(58svh - 22px); }
  .text-bead-generate { min-height: 50px; }
}

@media (max-width: 420px) {
  :root { --mobile-side: 12px; }
  .app-sidebar .side-nav-item,
  .mobile-more-nav { min-height: 52px; }
  .mobile-more-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .image-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .img-action-text { font-size: 9px; }
  .cell-paint-size-toolbar { gap: 5px; padding-inline: 5px; }
  .cell-paint-size-options { width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cell-paint-size-btn { padding-inline: 3px; }
}
/* 套餐购买入口：仅在服务端验证特殊链接后动态创建。 */
.payment-test-mask {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: rgba(15, 20, 31, .64);
  opacity: 0;
  transition: opacity .18s ease;
}

.payment-test-mask.show { opacity: 1; }

.payment-test-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(17, 24, 39, .22);
}

.payment-test-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 24px;
  border-bottom: 1px solid #edf0f4;
  color: #202532;
  font-size: 15px;
}

.payment-test-brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 7px);
  grid-template-rows: repeat(2, 7px);
  gap: 2px;
  width: 16px;
  height: 16px;
}

.payment-test-brand-mark i {
  display: block;
  border-radius: 2px;
  background: #ff655f;
}

.payment-test-brand-mark i:nth-child(2) { background: #202532; }
.payment-test-brand-mark i:nth-child(3) { background: #16a66a; }
.payment-test-brand-mark i:nth-child(4) { background: #ffb449; }

.payment-test-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 16px;
}

.payment-test-header h2 {
  margin: 5px 0 7px;
  color: #171923;
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: 0;
}

.payment-test-header p {
  max-width: 680px;
  margin: 0;
  color: #667085;
  font-size: 14px;
  line-height: 1.7;
}

.payment-test-kicker {
  display: block;
  color: #ec514b;
  font-size: 12px;
  font-weight: 800;
}

.payment-test-close {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f4f5f7;
  color: #475467;
  font-size: 26px;
  line-height: 40px;
  cursor: pointer;
}

.payment-test-close:hover { background: #e9ecf1; }

.payment-test-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 24px 18px;
  padding: 11px 13px;
  border-left: 3px solid #16a66a;
  background: #f2fbf7;
  color: #166746;
  font-size: 13px;
  line-height: 1.65;
}

.payment-test-notice > span {
  display: inline-flex;
  flex: 0 0 20px;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #16a66a;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.payment-test-plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 24px;
}

.payment-test-plan {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  min-width: 0;
  padding: 18px;
  overflow: hidden;
  border: 1px solid #dfe3e9;
  border-radius: 8px;
  background: #fff;
}

.payment-test-plan::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: #ff655f;
  content: '';
}

.payment-test-plan.advanced::before { background: #202532; }

.payment-test-plan-main { min-width: 0; }
.payment-test-plan-type {
  display: block;
  margin-bottom: 6px;
  color: #e9544d;
  font-size: 11px;
  font-weight: 800;
}
.payment-test-plan.advanced .payment-test-plan-type { color: #202532; }
.payment-test-plan h3 {
  margin: 0;
  overflow: hidden;
  color: #171923;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.payment-test-plan p {
  margin: 5px 0 0;
  color: #667085;
  font-size: 13px;
}

.payment-test-benefits {
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  color: #475467;
  font-size: 13px;
  line-height: 1.45;
  list-style: none;
}

.payment-test-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.payment-test-benefits li span {
  flex: 0 0 auto;
  color: #16a66a;
  font-weight: 900;
}

.payment-test-price {
  align-self: start;
  padding-top: 19px;
  color: #e9544d;
  font-size: 26px;
  font-weight: 800;
  white-space: nowrap;
}
.payment-test-price small { margin-right: 2px; font-size: 13px; }
.payment-test-price em {
  margin-left: 2px;
  color: #98a2b3;
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
}
.payment-test-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  padding-top: 3px;
}
.payment-test-pay {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.payment-test-pay.wechat { background: #08a94f; }
.payment-test-pay.alipay { background: #1677ff; }
.payment-test-pay:hover { filter: brightness(.95); }
.payment-test-provider-dot {
  position: relative;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, .96);
  border-radius: 50%;
}
.payment-test-provider-dot::after {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  content: '';
}
.payment-test-empty,
.payment-test-unavailable {
  grid-column: 1 / -1;
  padding: 26px 16px;
  border: 1px dashed #d0d5dd;
  color: #667085;
  font-size: 14px;
  line-height: 1.65;
  text-align: center;
}
.payment-test-unavailable { margin: 12px 24px 0; padding: 12px 16px; }
.payment-test-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px 26px;
  margin-top: 20px;
  padding: 15px 24px 18px;
  border-top: 1px solid #edf0f4;
  color: #667085;
  font-size: 12px;
}
.payment-test-footer span {
  position: relative;
  padding-left: 13px;
  white-space: nowrap;
}
.payment-test-footer span::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #16a66a;
  content: '';
  transform: translateY(-50%);
}
.payment-test-reopen {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 11990;
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: #171923;
  color: #fff;
  box-shadow: 0 10px 28px rgba(17, 24, 39, .2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 600px) {
  .payment-test-mask {
    align-items: flex-end;
    padding: 0;
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .payment-test-panel {
    width: 100%;
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }
  .payment-test-brand { min-height: 48px; padding: 0 16px; }
  .payment-test-header { gap: 12px; padding: 18px 16px 14px; }
  .payment-test-header h2 { margin-top: 4px; font-size: 23px; }
  .payment-test-header p { font-size: 13px; line-height: 1.6; }
  .payment-test-close { width: 36px; height: 36px; line-height: 36px; }
  .payment-test-notice { margin: 0 16px 14px; }
  .payment-test-plans { grid-template-columns: 1fr; }
  .payment-test-plans { gap: 10px; padding: 0 16px; }
  .payment-test-plan { gap: 10px 12px; padding: 15px; }
  .payment-test-plan h3 { font-size: 17px; }
  .payment-test-price { padding-top: 18px; font-size: 23px; }
  .payment-test-benefits { margin-top: 11px; }
  .payment-test-footer {
    flex-wrap: wrap;
    gap: 7px 18px;
    margin-top: 16px;
    padding: 13px 16px max(16px, env(safe-area-inset-bottom));
  }
  .payment-test-unavailable { margin-right: 16px; margin-left: 16px; }
  .payment-test-reopen {
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}
