/* ============================================================
   二维码生成器 · 样式
   ============================================================ */

:root {
  --bg: #f4f5fb;
  --bg-2: #eef0f8;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef0f7;
  --border: #e3e6f0;
  --border-strong: #d3d8e6;
  --text: #1b2033;
  --text-2: #4c5468;
  --text-3: #8a91a6;
  --brand: #6d5efc;
  --brand-2: #9b6dfd;
  --brand-soft: rgba(109, 94, 252, 0.1);
  --brand-soft-2: rgba(109, 94, 252, 0.18);
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.1);
  --ok: #12a76a;
  --ok-soft: rgba(18, 167, 106, 0.12);
  --radius-lg: 22px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 26, 51, 0.05), 0 1px 3px rgba(20, 26, 51, 0.04);
  --shadow: 0 1px 2px rgba(20, 26, 51, 0.04), 0 10px 30px -12px rgba(20, 26, 51, 0.16);
  --shadow-lg: 0 24px 60px -24px rgba(20, 26, 51, 0.3);
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Cascadia Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #0e1016;
  --bg-2: #131621;
  --surface: #171a24;
  --surface-2: #1c2030;
  --surface-3: #232838;
  --border: #272d3d;
  --border-strong: #333a4d;
  --text: #eef1f8;
  --text-2: #b3bacd;
  --text-3: #7c8499;
  --brand: #8b7dff;
  --brand-2: #b48cff;
  --brand-soft: rgba(139, 125, 255, 0.14);
  --brand-soft-2: rgba(139, 125, 255, 0.24);
  --danger: #ff6b6f;
  --danger-soft: rgba(255, 107, 111, 0.14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -14px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface-3);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

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

/* ---------- 背景装饰 ---------- */
.bg-deco {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-2), transparent 70%),
    var(--bg);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  animation: float 18s var(--ease) infinite alternate;
}
.blob-a {
  width: 520px; height: 520px;
  top: -180px; right: -120px;
  background: radial-gradient(circle, rgba(109, 94, 252, 0.45), transparent 65%);
}
.blob-b {
  width: 460px; height: 460px;
  bottom: -220px; left: -140px;
  background: radial-gradient(circle, rgba(59, 190, 220, 0.35), transparent 65%);
  animation-delay: -8s;
}
@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(30px, 40px, 0) scale(1.08); }
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 40px) 10px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(109, 94, 252, 0.8);
}
.brand-mark svg { fill: currentColor; stroke: none; }
.brand-text h1 {
  margin: 0;
  font-size: clamp(19px, 2.4vw, 23px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-text p {
  margin: 1px 0 0;
  font-size: 13px;
  color: var(--text-3);
}
.topbar-actions { display: flex; gap: 8px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.18s, border-color 0.18s, box-shadow 0.18s, opacity 0.18s;
  white-space: nowrap;
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(0.975); }
.btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(109, 94, 252, 0.9);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand), var(--brand-2)); filter: brightness(1.06); }
.btn-tonal { background: var(--brand-soft); color: var(--brand); }
.btn-tonal:hover { background: var(--brand-soft-2); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

html[data-theme="dark"] .icon-moon,
html:not([data-theme="dark"]) .icon-sun { display: none; }
html[data-theme="dark"] .icon-sun,
html:not([data-theme="dark"]) .icon-moon { display: block; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover { background: var(--surface-3); }

/* ---------- 布局 ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px;
  align-items: start;
  padding: 10px clamp(16px, 4vw, 40px) 28px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ---------- 左侧设置面板 ---------- */
.panel-config {
  display: flex;
  flex-direction: column;
  padding: 10px;
  min-height: 560px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}
.tab svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}

.tab-desc {
  margin: 14px 4px 2px;
  font-size: 13px;
  color: var(--text-3);
}

.fields {
  padding: 8px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeUp 0.28s var(--ease);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label,
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-label .opt {
  font-weight: 400;
  color: var(--text-3);
  font-size: 12px;
}
.field-hint { font-size: 12px; color: var(--text-3); margin: -1px 0 0; }

.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.textarea { min-height: 150px; resize: vertical; line-height: 1.6; font-family: var(--mono); font-size: 13.5px; }
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a91a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px;
  cursor: pointer;
}
html[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c8499' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.char-counter {
  align-self: flex-end;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  margin-top: -2px;
}
.char-counter.warn { color: var(--danger); }

/* 开关 */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  color: var(--text-2);
  font-weight: 600;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative;
  width: 40px; height: 23px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background 0.2s, border-color 0.2s;
  flex: none;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.22s var(--ease);
}
.switch input:checked + .track { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 颜色 */
.color-row { display: flex; align-items: center; gap: 8px; }
.color-swatch {
  position: relative;
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  flex: none;
  cursor: pointer;
  background: var(--surface-2);
}
.color-swatch input[type="color"] {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  border: 0;
  padding: 0;
  cursor: pointer;
  background: none;
}
.color-hex {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.color-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.preset {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  cursor: pointer;
  padding: 0;
  transition: transform 0.14s var(--ease), box-shadow 0.14s;
  position: relative;
}
.preset:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* 选项卡片按钮（分段选择） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip .dot-sample { width: 14px; height: 14px; border-radius: 3px; background: currentColor; flex: none; }
.chip .dot-sample.round { border-radius: 50%; }
.chip .dot-sample.dots { background: radial-gradient(circle, currentColor 42%, transparent 45%); }
.chip[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.seg button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

.align-start { align-self: flex-start; }

.input.mono, .textarea.mono, .mono { font-family: var(--mono); letter-spacing: 0.01em; }
.input[type="number"] { font-variant-numeric: tabular-nums; }

.preset[data-active="1"] {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand);
}


details.advanced {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}
details.advanced > summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 15px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease);
  margin-top: -4px;
}
details.advanced[open] > summary::after { transform: rotate(-135deg); margin-top: 2px; }
details.advanced .advanced-body {
  padding: 4px 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 预设主题 */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.theme-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s var(--ease);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}
.theme-card canvas { width: 100%; aspect-ratio: 1; border-radius: 7px; display: block; }
.theme-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.theme-card.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); color: var(--brand); }

/* 范围滑块 */
.range-row { display: flex; align-items: center; gap: 12px; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) var(--fill, 50%), var(--surface-3) var(--fill, 50%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--brand); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.range-value {
  min-width: 44px;
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-2);
}

/* ---------- 右侧预览 ---------- */
.panel-preview {
  position: sticky;
  top: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.preview-title h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.preview-meta { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.seg.seg-size button { padding: 0 10px; height: 28px; }

.preview-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px;
  border-radius: var(--radius);
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    repeating-conic-gradient(var(--surface-3) 0% 25%, transparent 0% 50%) 0 0 / 16px 16px;
  border: 1px solid var(--border);
}
.qr-frame {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: opacity 0.2s;
  background: #fff;
}
.qr-frame.is-empty { opacity: 0.45; filter: saturate(0.4); }
.qr-frame canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  display: block;
  image-rendering: auto;
}
.preview-error {
  margin: 0;
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 7px 11px;
  text-align: center;
  max-width: 100%;
  word-break: break-word;
}

.preview-error.is-note {
  color: var(--text-2);
  background: var(--brand-soft);
}

.info-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.info-chip.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.info-chip.warn { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

.preview-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.switch-sm { font-size: 12.5px; font-weight: 500; color: var(--text-3); gap: 8px; }
.switch-sm .track { width: 32px; height: 19px; }
.switch-sm .track::after { width: 13px; height: 13px; }
.switch-sm input:checked + .track::after { transform: translateX(13px); }

.export-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.export-grid .btn { padding: 0 8px; font-size: 13px; }
.export-grid .btn svg { width: 15px; height: 15px; }
.export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.export-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
}
.export-size select {
  height: 34px;
  padding: 0 30px 0 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background-color: var(--surface-2);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a91a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px;
}
.hint { margin: 10px 0 0; font-size: 12px; color: var(--text-3); }

/* ---------- 左侧面板底部动作 ---------- */
.panel-foot {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding: 14px 4px 2px;
  border-top: 1px solid var(--border);
}

/* ---------- Logo 设置 ---------- */
.logo-box {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-thumb {
  width: 56px; height: 56px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2) center / contain no-repeat;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 11px;
}
.logo-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 批量生成 ---------- */
.batch-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; }
.batch-results {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding: 2px;
}
.batch-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.batch-item canvas { width: 100%; aspect-ratio: 1; border-radius: 6px; display: block; }
.batch-item span {
  font-size: 11px;
  color: var(--text-3);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
}
.batch-summary { font-size: 13px; color: var(--text-2); margin: 12px 0 0; }

/* ---------- 识别二维码 ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.18s, background 0.18s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone svg { stroke: var(--brand); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dropzone small { color: var(--text-3); font-size: 12px; }
.scan-result { display: grid; grid-template-columns: 132px 1fr; gap: 14px; margin-top: 14px; }
.scan-preview canvas { width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; }
.scan-content { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.scan-status { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.scan-status.err { color: var(--danger); }
.scan-status.ok { color: var(--ok); }
.scan-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 620px) {
  .batch-grid { grid-template-columns: 1fr; }
  .scan-result { grid-template-columns: 1fr; }
  .scan-preview { max-width: 160px; }
}

@media print {
  .panel-foot { display: none; }
}

/* ---------- 底部 ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px 20px 26px;
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
}
.footer .dot { opacity: 0.6; }

/* ---------- 弹窗 / Toast ---------- */
.dialog {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  padding: 0;
}
.dialog::backdrop { background: rgba(12, 15, 25, 0.45); backdrop-filter: blur(3px); }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;
}
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-body { padding: 4px 20px 20px; }
.help-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--text-2); }
.help-list strong { color: var(--text); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s var(--ease);
  z-index: 50;
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */
@media (max-width: 1040px) {
  .layout { grid-template-columns: 1fr; }
  .panel-preview { position: static; order: -1; }
  .preview-stage { padding: 14px; }
  .qr-frame { max-width: 300px; }
}

@media (max-width: 620px) {
  .topbar { padding: 16px 16px 6px; }
  .brand-text p { display: none; }
  .btn-text { display: none; }
  .layout { padding: 6px 10px 20px; gap: 14px; }
  .panel-config { padding: 8px; min-height: 0; }
  .panel-preview { padding: 12px; }
  .fields { gap: 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .export-grid { grid-template-columns: repeat(2, 1fr); }
  .tab { padding: 0 10px; font-size: 12.5px; }
  .tab span.tab-label { display: none; }
  .tab svg { width: 18px; height: 18px; }
  .preview-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .seg.seg-size { align-self: flex-start; }
  .preview-stage { padding: 10px; }
  .qr-frame { max-width: min(260px, 100%); }
  .preview-tools { gap: 8px; }
  .switch-sm { font-size: 12px; }
  .export-row { flex-wrap: wrap; }
}

@media (max-width: 400px) {
  .qr-frame { max-width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* 打印：只输出二维码 */
@media print {
  body { background: #fff; }
  .bg-deco, .topbar, .panel-config, .footer, .preview-head, .preview-foot, .toast { display: none !important; }
  .layout { display: block; padding: 0; }
  .panel-preview { border: 0; box-shadow: none; padding: 0; }
  .preview-stage { border: 0; background: none; padding: 0; }
  .qr-frame { max-width: 100%; width: 80mm; box-shadow: none; }
}
