/* ========== Reset & 基础 ========== */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #F6F8FA;
  color: #1F2937;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ========== 顶栏 ========== */
.top {
  background: linear-gradient(135deg, #0EA5A4 0%, #0891B2 100%);
  color: #fff;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  box-shadow: 0 2px 8px rgba(14, 165, 164, 0.15);
}
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-ghost-light {
  background: rgba(255,255,255,.16);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  height: 34px; padding: 0 14px; font-size: 13px; border-radius: 6px;
}
.btn-ghost-light:hover { background: rgba(255,255,255,.26); }
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo {
  font-size: 22px; font-weight: 800; letter-spacing: 1px;
  background: rgba(255,255,255,.18);
  padding: 4px 12px; border-radius: 6px;
}
.tagline { font-size: 13px; opacity: .92; }
.card-area { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-input {
  height: 38px; width: 220px; padding: 0 12px;
  border: none; border-radius: 6px;
  background: rgba(255,255,255,.95); color: #0F172A;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 14px; letter-spacing: 1.5px;
  text-transform: uppercase;
}
.card-input:focus { outline: 2px solid #FBBF24; }
.quota-tag {
  font-size: 13px; padding: 4px 10px; border-radius: 12px;
  background: rgba(34, 197, 94, 0.18); color: #DCFCE7;
  border: 1px solid rgba(187, 247, 208, 0.4);
}

/* ========== 通用按钮 ========== */
.btn {
  height: 38px; padding: 0 18px; border-radius: 6px;
  font-size: 14px; font-weight: 600;
  border: none; transition: all .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: #FBBF24; color: #78350F;
}
.btn-primary:hover:not(:disabled) { background: #F59E0B; }
.btn-outline {
  background: #fff; color: #0EA5A4; border: 1.5px solid #0EA5A4;
}
.btn-outline:hover:not(:disabled) { background: #ECFEFF; }
.btn-ghost {
  background: transparent; color: #64748B; border: 1px solid #CBD5E1;
}
.btn-ghost:hover:not(:disabled) { background: #F1F5F9; }
.btn-generate {
  width: 100%; height: 56px; font-size: 17px;
  background: linear-gradient(135deg, #0EA5A4 0%, #0891B2 100%);
  color: #fff; border-radius: 10px; margin: 8px 0 16px;
  box-shadow: 0 4px 12px rgba(14,165,164,.3);
}
.btn-generate:disabled {
  background: #CBD5E1; box-shadow: none;
}

/* ========== 主体页面 ========== */
.page {
  max-width: 880px;
  margin: 24px auto;
  padding: 0 16px 80px;
}

.step-card {
  background: #fff;
  border-radius: 14px;
  padding: 22px 22px 24px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: #0EA5A4; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.step-head h2 { margin: 0; font-size: 17px; font-weight: 600; }

/* ========== 上传区 ========== */
.dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: 12px;
  min-height: 220px;
  position: relative;
  cursor: pointer;
  transition: all .2s;
  background: #FAFBFC;
  overflow: hidden;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: #0EA5A4;
  background: #ECFEFF;
}
.dropzone-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: #64748B;
}
.dz-icon { font-size: 38px; }
.dz-text { font-size: 15px; font-weight: 500; }
.dz-hint { font-size: 12px; color: #94A3B8; }
.dz-preview {
  width: 100%; max-height: 360px; object-fit: contain;
  display: block;
}
.btn-clear {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(15, 23, 42, .65); color: #fff; border: none;
  font-size: 18px; line-height: 28px; padding: 0;
}

/* ========== 项目两级菜单 ========== */
.cat-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
  border-bottom: 1px solid #E2E8F0; padding-bottom: 12px;
}
.cat-btn {
  padding: 8px 16px; border-radius: 6px;
  background: #F1F5F9; color: #475569; border: none;
  font-size: 14px; font-weight: 500;
}
.cat-btn:hover { background: #E2E8F0; }
.cat-btn.active {
  background: #0EA5A4; color: #fff;
}
.cat-btn .cat-desc { font-size: 11px; opacity: .8; margin-left: 6px; }

/* X 大类（一键修复）金色高亮 */
.cat-btn[data-cat="X"] {
  background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}
.cat-btn[data-cat="X"]:hover {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}
.cat-btn[data-cat="X"].active {
  background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
}
.cat-btn[data-cat="X"] .cat-desc { color: #FEF3C7; opacity: .95; }

/* 自动档位 toggle */
.auto-toggle {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  background: linear-gradient(135deg, #FEF3C7 0%, #FFFBEB 100%);
  border: 1.5px dashed #F59E0B;
  border-radius: 10px;
  font-size: 13px; color: #78350F;
  margin-bottom: 16px;
  cursor: pointer;
  line-height: 1.5;
  transition: all .15s;
}
.auto-toggle:hover { border-color: #D97706; }
.auto-toggle input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: #D97706;
  cursor: pointer;
}
.auto-toggle span { font-weight: 500; }

/* 自动档位激活时禁用 slider 视觉 */
.lvl-disabled .lvl-slider {
  opacity: .35; pointer-events: none;
  filter: grayscale(0.5);
}
.lvl-disabled .lvl-min,
.lvl-disabled .lvl-max { color: #CBD5E1; }
.lvl-disabled .lvl-display strong { color: #D97706; }

.proj-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.proj-btn {
  padding: 12px 10px; border-radius: 8px;
  background: #F8FAFC; border: 1.5px solid #E2E8F0;
  color: #334155; font-size: 13px; text-align: center;
  transition: all .15s;
}
.proj-btn:hover { border-color: #0EA5A4; background: #ECFEFF; }
.proj-btn.active {
  border-color: #0EA5A4; background: #0EA5A4; color: #fff;
  box-shadow: 0 2px 6px rgba(14,165,164,.3);
}
.picked-line {
  margin-top: 14px; font-size: 13px; color: #64748B;
}
.picked-line strong { color: #0F766E; }

/* 正畸视图切换 toggle */
.view-toggle {
  margin-top: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #ECFEFF 0%, #F0FDFA 100%);
  border: 1.5px solid #99F6E4;
  border-radius: 10px;
}
.view-toggle-label {
  font-size: 12px;
  color: #0F766E;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: .3px;
}
.view-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.view-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1.5px solid #CBD5E1;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.view-btn:hover { border-color: #0EA5A4; }
.view-btn.active {
  border-color: #0EA5A4;
  background: #0EA5A4;
  color: #fff;
  box-shadow: 0 2px 6px rgba(14,165,164,.3);
}
.view-btn-title {
  font-size: 13px;
  font-weight: 600;
  color: inherit;
}
.view-btn-sub {
  font-size: 11px;
  opacity: .85;
  color: inherit;
}
.view-toggle-tip {
  margin-top: 8px;
  font-size: 11px;
  color: #92400E;
  background: #FEF3C7;
  border-radius: 4px;
  padding: 4px 8px;
}

/* ========== 效果程度滑块 ========== */
.slider-row {
  display: flex; align-items: center; gap: 12px;
}
.lvl-min, .lvl-max {
  font-size: 12px; color: #64748B; white-space: nowrap;
}
.lvl-slider {
  flex: 1; height: 6px;
  -webkit-appearance: none; appearance: none;
  background: linear-gradient(to right, #94D5D4 0%, #0EA5A4 100%);
  border-radius: 3px; outline: none;
}
.lvl-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid #0EA5A4;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(14,165,164,.3);
}
.lvl-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid #0EA5A4;
  cursor: pointer;
}
.lvl-display {
  margin-top: 14px; font-size: 14px; color: #334155;
}
.lvl-display strong {
  font-size: 22px; color: #0EA5A4; margin: 0 4px;
}
.lvl-desc { color: #64748B; margin-left: 8px; font-size: 13px; }

/* ========== 免责声明 ========== */
.disclaimer {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #78350F;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.disclaimer strong { color: #92400E; margin-right: 6px; }

/* ========== Loading ========== */
.loading-box {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; background: #fff; border-radius: 10px;
  margin-bottom: 16px;
}
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid #E0F2F1; border-top-color: #0EA5A4;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #64748B; font-size: 14px; }

/* ========== 登录注册卡片 ========== */
.auth-card { max-width: 460px; margin: 30px auto 20px; }
.auth-tabs {
  display: flex; gap: 4px;
  background: #F1F5F9; padding: 4px; border-radius: 8px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none; background: transparent;
  color: #64748B; font-size: 15px; font-weight: 600;
  border-radius: 6px;
}
.auth-tab.active {
  background: #fff; color: #0EA5A4;
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
.auth-pane { display: flex; flex-direction: column; gap: 12px; }
.auth-title {
  font-size: 18px; font-weight: 700; color: #0F172A;
  margin: 0 0 4px;
}
.form-input {
  height: 46px; padding: 0 14px;
  border: 1.5px solid #E2E8F0; border-radius: 8px;
  font-size: 15px; color: #0F172A;
  background: #FAFBFC;
  transition: border-color .15s;
}
.form-input:focus { outline: none; border-color: #0EA5A4; background: #fff; }
.auth-tip {
  text-align: center; color: #64748B; font-size: 13px;
  margin: 6px 0 0; line-height: 1.7;
}
.auth-footer {
  max-width: 460px; margin: 30px auto 0;
  padding: 24px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.auth-footer h3 {
  font-size: 16px; color: #0F766E; margin: 0 0 14px;
}
.bullet-list {
  margin: 0; padding-left: 20px;
  color: #475569; font-size: 14px; line-height: 1.9;
}
.bullet-list li::marker { color: #0EA5A4; }

/* ========== 个人中心 ========== */
.me-panel { position: relative; }
.me-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  border: none; background: #F1F5F9;
  border-radius: 50%; font-size: 18px;
  color: #64748B; cursor: pointer;
}
.me-close:hover { background: #E2E8F0; }

.me-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin: 6px 0 16px;
}
.me-block {
  background: #F8FAFC;
  border-radius: 8px;
  padding: 12px 14px;
}
.me-label { font-size: 12px; color: #64748B; margin-bottom: 4px; }
.me-value { font-size: 16px; color: #0F172A; }
.me-value-strong { font-size: 22px; font-weight: 700; color: #0EA5A4; }
.me-value-mono {
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 18px; letter-spacing: 2px; color: #0E7490;
}
.me-action-row { display: flex; gap: 10px; margin-bottom: 6px; }

.me-divider {
  height: 1px; background: #E2E8F0;
  margin: 18px 0;
}
.me-section-title {
  font-size: 14px; color: #334155;
  margin: 0 0 10px; font-weight: 600;
}
.me-card-input-row {
  display: flex; gap: 8px; margin-bottom: 4px;
}
.card-input-large {
  flex: 1;
  height: 42px; padding: 0 14px;
  border: 1.5px solid #E2E8F0; border-radius: 8px;
  font-family: ui-monospace, monospace;
  font-size: 14px; letter-spacing: 1.5px;
  text-transform: uppercase;
  background: #FAFBFC;
}
.card-input-large:focus { outline: none; border-color: #0EA5A4; background: #fff; }

/* ========== 购买区布局 ========== */
.buy-block {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 16px;
  align-items: stretch;
}
.buy-side {
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
}
.buy-cta {
  display: flex; align-items: center; justify-content: center;
  height: 44px;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #fff !important;
  font-weight: 700; font-size: 15px;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
  transition: all .15s;
}
.buy-cta:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(245,158,11,.45); }
.buy-qr {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 10px 8px 6px;
  text-align: center;
}
.buy-qr img { width: 100%; max-width: 160px; height: auto; margin: 0 auto; display: block; }
.buy-qr-tip {
  font-size: 11px; color: #64748B; margin-top: 4px;
  letter-spacing: .3px;
}

/* ========== SKU 网格 ========== */
.sku-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.sku-card {
  background: linear-gradient(135deg, #ECFEFF 0%, #F0FDFA 100%);
  border: 1.5px solid #E0F2F1;
  border-radius: 10px;
  padding: 14px 14px 12px;
  position: relative;
  transition: all .15s;
}
.sku-card:hover {
  border-color: #0EA5A4;
  box-shadow: 0 4px 10px rgba(14,165,164,.15);
  transform: translateY(-1px);
}
.sku-card.recommended {
  border-color: #F59E0B;
  background: linear-gradient(135deg, #FEF3C7 0%, #FFFBEB 100%);
}
.sku-card.recommended::after {
  content: '推荐';
  position: absolute; top: -8px; right: 10px;
  background: #F59E0B; color: #fff;
  font-size: 11px; padding: 2px 8px;
  border-radius: 10px;
}
.sku-quota {
  font-size: 22px; font-weight: 800; color: #0F766E;
  line-height: 1.2;
}
.sku-quota .unit { font-size: 13px; font-weight: 500; color: #64748B; }
.sku-price {
  font-size: 18px; color: #DC2626; font-weight: 700;
  margin-top: 4px;
}
.sku-price .currency { font-size: 13px; }
.sku-perprice {
  font-size: 12px; color: #64748B; margin-top: 2px;
}

.me-tip {
  font-size: 12px; color: #64748B; margin: 12px 0 0;
  line-height: 1.7;
}

/* 多设备并发显示 */
.me-device-row {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0 0;
  padding: 10px 14px;
  background: #F0FDFA;
  border: 1px solid #99F6E4;
  border-radius: 8px;
  font-size: 13px;
  color: #0F766E;
  flex-wrap: wrap;
}
.me-device-label { font-weight: 600; }
.me-device-row strong {
  font-size: 16px;
  color: #0EA5A4;
  font-family: ui-monospace, monospace;
}
.me-device-tip { font-size: 11.5px; color: #64748B; flex: 1; min-width: 200px; }

/* ========== 历史记录 ========== */
.me-history-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.history-empty {
  grid-column: 1 / -1;
  padding: 20px; text-align: center;
  color: #94A3B8; font-size: 13px;
  background: #F8FAFC; border-radius: 8px;
  border: 1px dashed #CBD5E1;
}
.history-card {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.history-card:hover {
  border-color: #0EA5A4;
  box-shadow: 0 4px 10px rgba(14,165,164,.15);
  transform: translateY(-1px);
}
.history-thumb {
  display: grid; grid-template-columns: 1fr 1fr;
  width: 100%; aspect-ratio: 16 / 9;
  background: #0F172A;
}
.history-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.history-meta {
  padding: 8px 10px;
}
.history-meta .h-proj {
  font-size: 12px; font-weight: 600; color: #0F172A;
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-meta .h-info {
  font-size: 11px; color: #64748B; margin-top: 3px;
  display: flex; justify-content: space-between;
}
.history-card .h-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(15,23,42,.7); color: #fff;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.history-card .h-del:hover { background: #DC2626; }

/* ========== 模式切换 ========== */
.compare-modes {
  display: inline-flex; gap: 4px;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.mode-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: #64748B;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  transition: all .15s;
}
.mode-btn:hover { color: #0EA5A4; }
.mode-btn.active {
  background: #fff;
  color: #0EA5A4;
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
}

/* ========== 左右并排（默认模式） ========== */
.side-by-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sbs-card {
  position: relative;
  background: #0F172A;
  border-radius: 10px;
  overflow: hidden;
}
.sbs-card img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #0F172A;
}
.sbs-label {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(15,23,42,.75);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  z-index: 2;
  letter-spacing: .5px;
}
.sbs-label-after {
  background: rgba(14,165,164,.85);
}
/* .watermark-corner 已移除：水印改为烧进图片像素，详见 app.js applyWatermark */

/* ========== 对比结果（滑动模式） ========== */
.compare-box {
  position: relative; width: 100%;
  max-height: 600px;
  border-radius: 10px; overflow: hidden;
  background: #0F172A;
  user-select: none;
  touch-action: none;
}
.compare-img {
  display: block; width: 100%; height: auto;
}
.compare-after {
  width: 100%; max-height: 600px; object-fit: contain;
  background: #0F172A;
}
.compare-frame {
  position: absolute; inset: 0;
  width: 50%;
  overflow: hidden;
}
.compare-before {
  width: 200%; max-width: none; max-height: 600px; object-fit: contain;
}
/* 让 before 与 after 对齐 */
.compare-frame .compare-before {
  width: calc(100% / 0.5); /* will be controlled by JS via width and image natural */
}
.compare-handle {
  position: absolute; top: 0; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: ew-resize;
  z-index: 5;
}
.handle-line {
  position: absolute; top: 0; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 3px; background: #fff;
  box-shadow: 0 0 6px rgba(0,0,0,.4);
}
.handle-knob {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: #0EA5A4;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.compare-label {
  position: absolute; top: 10px;
  background: rgba(15,23,42,.7); color: #fff;
  font-size: 12px; padding: 4px 10px; border-radius: 4px;
  z-index: 4; pointer-events: none;
}
.compare-label-left { left: 10px; }
.compare-label-right { right: 10px; }
.watermark {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(15,23,42,.6); color: #fff;
  font-size: 11px; padding: 3px 8px; border-radius: 4px;
  z-index: 4; pointer-events: none;
}
.result-actions {
  display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap;
}

/* ========== 表单错误（永驻） ========== */
.form-error {
  background: #FEE2E2;
  border: 1.5px solid #FCA5A5;
  color: #991B1B;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.form-error strong { color: #7F1D1D; margin-right: 4px; }
.form-error-hint {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  color: #B91C1C;
  opacity: .9;
}

/* ========== 遮挡眼部模态 ========== */
.mask-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1100;
}
.mask-modal {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 94vw);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(15, 23, 42, 0.28);
  z-index: 1101;
  padding: 18px;
}
.mask-modal-head h3 { margin: 0 0 4px; font-size: 17px; color: #0F172A; }
.mask-modal-head p { margin: 0 0 12px; font-size: 13px; color: #64748B; }
.mask-modal-head strong { color: #0EA5A4; }
.mask-canvas-wrap {
  background: #0F172A;
  border-radius: 8px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  max-height: 60vh;
}
#maskCanvas {
  max-width: 100%;
  max-height: 60vh;
  display: block;
  cursor: crosshair;
  touch-action: none;
}
.mask-modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 14px;
}
@media (max-width: 600px) {
  .mask-modal { padding: 14px; }
  .mask-modal-actions .btn { flex: 1; }
}

/* ========== 技术支持浮窗 ========== */
.support-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0EA5A4 0%, #0891B2 100%);
  border: none;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 14px rgba(14, 165, 164, 0.4);
  transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.support-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14, 165, 164, 0.55);
}
.support-fab-icon { font-size: 26px; }
.support-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1001;
  backdrop-filter: blur(2px);
}
.support-card {
  position: fixed;
  right: 20px; bottom: 90px;
  width: 290px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.2);
  z-index: 1002;
  padding: 18px 18px 16px;
  text-align: center;
}
.support-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #F1F5F9; border: none;
  font-size: 18px; line-height: 1;
  cursor: pointer;
  color: #64748B;
}
.support-close:hover { background: #DC2626; color: #fff; }
.support-head { margin-bottom: 12px; }
.support-badge {
  display: inline-block; font-size: 28px; margin-bottom: 4px;
}
.support-head h3 {
  margin: 0; font-size: 17px; color: #0F172A; font-weight: 700;
}
.support-sub {
  margin: 4px 0 0;
  font-size: 12px; color: #64748B;
  letter-spacing: .3px;
}
.support-qr {
  display: block;
  width: 200px; height: 200px;
  margin: 0 auto 12px;
  border-radius: 8px;
  object-fit: contain;
  background: #F8FAFC;
  padding: 6px;
  border: 1px solid #E2E8F0;
}
.support-wechat {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  background: #F1F5F9;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.support-wechat-label {
  font-size: 12px; color: #64748B;
}
.support-wechat code {
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 14px; color: #0F766E;
  font-weight: 700;
  letter-spacing: 1px;
}
.support-tip {
  margin: 0;
  font-size: 11px; color: #94A3B8;
  letter-spacing: .3px;
}

/* ========== Toast ========== */
.toast {
  position: fixed; left: 50%; top: 80px;
  transform: translateX(-50%);
  background: #0F172A; color: #fff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  z-index: 9999;
  max-width: 90%;
}
.toast.error { background: #DC2626; }
.toast.success { background: #16A34A; }

/* ========== 底部 ========== */
.foot {
  text-align: center; color: #94A3B8; font-size: 12px;
  margin-top: 32px; line-height: 1.8;
}
.foot-tip { color: #64748B; }

/* ========== 响应式 ========== */
/* ========== 手机端（≤768px） ========== */
@media (max-width: 768px) {
  /* 顶栏紧凑 */
  .top {
    padding: 12px 14px;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
  }
  /* brand 区竖排：logo 在上，标语在下 */
  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    flex: 1;
    min-width: 0;
  }
  .logo {
    font-size: 19px;
    padding: 3px 11px;
  }
  .tagline {
    display: block;
    font-size: 11.5px;
    opacity: .9;
    line-height: 1.3;
    letter-spacing: .3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .top-right {
    gap: 5px;
    flex-shrink: 0;
    flex-wrap: nowrap;
  }
  .top-right .quota-tag {
    font-size: 11px;
    padding: 3px 7px;
    flex-shrink: 1;
    min-width: 0;
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .btn-ghost-light {
    height: 28px;
    padding: 0 9px;
    font-size: 11px;
  }

  /* 主体 */
  .page { padding: 0 12px 60px; margin-top: 14px; }
  .step-card {
    padding: 16px 14px;
    margin-bottom: 14px;
    border-radius: 10px;
  }
  .step-head { margin-bottom: 14px; }
  .step-head h2 { font-size: 16px; }
  .step-num { width: 26px; height: 26px; font-size: 13px; }

  /* 项目网格 - 在手机端 2 列且按钮更高便于点击 */
  .proj-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .proj-btn {
    padding: 14px 8px;
    font-size: 13px;
    min-height: 44px;
  }
  .cat-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* 生成按钮 */
  .btn-generate {
    height: 52px;
    font-size: 16px;
  }
  .compare-box { max-height: 70vh; }
  .side-by-side { grid-template-columns: 1fr; gap: 10px; }
  .sbs-card img { max-height: 60vh; }
  .compare-modes { width: 100%; display: flex; }
  .mode-btn { flex: 1; padding: 10px 8px; font-size: 13px; }

  /* 个人中心 */
  .me-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .me-block { padding: 10px 12px; }
  .me-value-strong { font-size: 18px; }
  .me-value-mono { font-size: 16px; }

  /* 购买区 */
  .buy-block { grid-template-columns: 1fr; gap: 12px; }
  .sku-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .sku-card { padding: 12px 12px 10px; }
  .sku-quota { font-size: 20px; }
  .sku-price { font-size: 16px; }
  .buy-side { flex-direction: row; gap: 10px; align-items: stretch; }
  .buy-cta { flex: 1; height: 48px; font-size: 15px; }
  .buy-qr { width: 100px; padding: 6px 4px 4px; flex-shrink: 0; }
  .buy-qr img { max-width: 90px; }
  .buy-qr-tip { font-size: 10px; }

  /* 卡密激活 */
  .me-card-input-row { flex-direction: column; gap: 8px; }
  .card-input-large {
    width: 100%;
    height: 46px;
    font-size: 15px;
    letter-spacing: 1.5px;
  }
  .me-card-input-row .btn { height: 46px; }

  /* 历史记录 */
  .history-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .history-meta { padding: 6px 8px; }
  .history-meta .h-proj { font-size: 11px; }
  .history-meta .h-info { font-size: 10px; }

  /* 登录注册 */
  .auth-card { margin: 14px auto; }
  .auth-title { font-size: 16px; }
  .form-input {
    height: 48px;
    font-size: 16px; /* 16px 防 iOS 自动放大 */
  }
  .auth-footer { margin-top: 14px; padding: 18px; }
  .auth-footer h3 { font-size: 15px; }
  .bullet-list { font-size: 13px; line-height: 1.8; }

  /* 免责声明 */
  .disclaimer {
    padding: 10px 12px;
    font-size: 12px;
  }

  /* 上传区 */
  .dropzone { min-height: 180px; }
  .dz-icon { font-size: 32px; }
  .dz-text { font-size: 14px; }

  /* 技术支持浮窗 手机端 */
  .support-fab {
    right: 16px; bottom: 16px;
    width: 50px; height: 50px;
  }
  .support-fab-icon { font-size: 22px; }
  .support-card {
    right: 50%;
    bottom: auto;
    top: 50%;
    transform: translate(50%, -50%);
    width: calc(100% - 32px);
    max-width: 320px;
    padding: 16px 14px 12px;
  }
  .support-qr {
    width: 180px; height: 180px;
  }
  .form-error { font-size: 12px; padding: 10px 12px; }
}

/* ========== 超窄屏（≤380px） ========== */
@media (max-width: 380px) {
  .me-grid { grid-template-columns: 1fr 1fr; }
  .sku-grid { grid-template-columns: 1fr 1fr; }
  .history-grid { grid-template-columns: 1fr; }
  .step-head h2 { font-size: 15px; }
  .top-right .quota-tag {
    max-width: 110px;
    font-size: 11px;
  }
}
