/* ============================================
   QRCode.wang — 二维码生成与解析网站
   完整样式系统:变量 / 明暗主题 / 玻璃拟态 / 响应式
   ============================================ */

/* ---------- 1. 主题变量 ---------- */
:root {
  /* 浅色(默认) */
  --bg-base: #f5f7fb;
  --bg-aurora-1: #6366f1;
  --bg-aurora-2: #8b5cf6;
  --bg-aurora-3: #ec4899;
  --bg-aurora-4: #06b6d4;

  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-hover: rgba(255, 255, 255, 0.85);
  --surface-input: rgba(255, 255, 255, 0.6);

  --border: rgba(99, 102, 241, 0.14);
  --border-strong: rgba(99, 102, 241, 0.28);

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.1);
  --accent: #ec4899;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;

  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-base: #0b1020;
  --bg-aurora-1: #6366f1;
  --bg-aurora-2: #8b5cf6;
  --bg-aurora-3: #ec4899;
  --bg-aurora-4: #06b6d4;

  --surface: rgba(30, 41, 59, 0.55);
  --surface-solid: #1e293b;
  --surface-hover: rgba(51, 65, 85, 0.65);
  --surface-input: rgba(15, 23, 42, 0.5);

  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.32);

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;

  --primary: #818cf8;
  --primary-hover: #6366f1;
  --primary-light: rgba(129, 140, 248, 0.14);
  --accent: #f472b6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(129, 140, 248, 0.35);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  transition: background-color var(--transition), color var(--transition);
}

/* 极光流动背景 */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -2;
  background: radial-gradient(
      ellipse 60% 50% at 20% 20%,
      var(--bg-aurora-1) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse 50% 40% at 80% 30%,
      var(--bg-aurora-3) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse 60% 60% at 50% 80%,
      var(--bg-aurora-2) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse 40% 40% at 90% 90%,
      var(--bg-aurora-4) 0%,
      transparent 50%
    );
  filter: blur(80px);
  opacity: 0.5;
  animation: aurora-drift 24s ease-in-out infinite alternate;
}

[data-theme="dark"] body::before {
  opacity: 0.35;
}

@keyframes aurora-drift {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  50% {
    transform: translate(4%, 2%) rotate(6deg) scale(1.05);
  }
  100% {
    transform: translate(-3%, -2%) rotate(-4deg) scale(1.02);
  }
}

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

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

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

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ---------- 3. 布局容器 ---------- */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 4. 顶部导航 ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.brand-text span {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  transition: all var(--transition);
  border: 1px solid var(--border);
}
.theme-toggle:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.theme-toggle .fa-sun {
  display: none;
}
.theme-toggle .fa-moon {
  display: block;
}
[data-theme="dark"] .theme-toggle .fa-sun {
  display: block;
}
[data-theme="dark"] .theme-toggle .fa-moon {
  display: none;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 10px;
  transition: all var(--transition);
}
.nav-link:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* ---------- 5. Hero 区 ---------- */
.hero {
  text-align: center;
  padding: 72px 0 40px;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--primary-light);
  border: 1px solid var(--border-strong);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
}
.hero-badge i {
  color: var(--accent);
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.75rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}
.hero-stat .num {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-stat .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- 6. Tab 切换 ---------- */
.tabs {
  display: flex;
  justify-content: center;
  margin: 8px 0 40px;
}

.tab-switcher {
  display: inline-flex;
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  position: relative;
  box-shadow: var(--shadow-md);
}

.tab-btn {
  position: relative;
  z-index: 2;
  padding: 10px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color var(--transition);
}
.tab-btn.active {
  color: #fff;
}
.tab-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  height: calc(100% - 12px);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

/* ---------- 7. 面板与卡片 ---------- */
.panel {
  display: none;
  animation: panel-in 0.4s ease;
}
.panel.active {
  display: block;
}

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

.card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  transition: all var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.generator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

/* ---------- 8. 类型选择 ---------- */
.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: var(--radius-md);
  background: var(--surface-input);
  border: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition);
  text-align: center;
}
.type-btn i {
  font-size: 1.4rem;
  color: var(--primary);
  transition: transform var(--transition);
}
.type-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.type-btn:hover i {
  transform: scale(1.15);
}
.type-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.type-btn.active i {
  color: var(--accent);
}

/* ---------- 9. 表单元素 ---------- */
.form-group {
  margin-bottom: 18px;
}
.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-label .req {
  color: var(--danger);
  margin-left: 2px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition);
  outline: none;
}
.form-control::placeholder {
  color: var(--text-muted);
}
.form-control:focus {
  border-color: var(--primary);
  background: var(--surface-hover);
  box-shadow: 0 0 0 4px var(--primary-light);
}
textarea.form-control {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* 颜色选择 */
.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.color-input {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  cursor: pointer;
  padding: 0;
  background: none;
  overflow: hidden;
}
.color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-input::-webkit-color-swatch {
  border: none;
  border-radius: 10px;
}
.color-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.preset-colors {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.preset-color {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all var(--transition);
}
.preset-color:hover {
  transform: scale(1.15);
  border-color: var(--primary);
}

/* 滑块 */
.range-group {
  display: flex;
  align-items: center;
  gap: 14px;
}
.range-input {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: var(--border-strong);
  outline: none;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  cursor: pointer;
  border: 3px solid var(--surface-solid);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
  transition: transform var(--transition);
}
.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
.range-input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid var(--surface-solid);
}
.range-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 70px;
  text-align: right;
}

/* 开关 */
.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.switch-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}
.switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background var(--transition);
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: all var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.switch.on {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.switch.on::after {
  transform: translateX(20px);
}

/* ---------- 10. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
}
.btn-secondary {
  background: var(--surface-input);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}
.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}
.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- 11. 二维码预览区 ---------- */
.preview-card {
  position: sticky;
  top: 92px;
}

.preview-stage {
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background: var(--surface-input);
  border-radius: var(--radius-lg);
  min-height: 340px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}

.preview-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 12px,
    rgba(99, 102, 241, 0.025) 12px,
    rgba(99, 102, 241, 0.025) 24px
  );
  pointer-events: none;
}

#qr-preview {
  border-radius: var(--radius-md);
  transition: all var(--transition);
  position: relative;
  z-index: 1;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow-md);
}
#qr-preview.empty {
  display: grid;
  place-items: center;
  width: 240px;
  height: 240px;
  background: transparent;
  box-shadow: none;
}
#qr-preview.empty::after {
  content: "\f029";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 4rem;
  color: var(--text-muted);
  opacity: 0.4;
}

.preview-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 12px 16px;
  background: var(--surface-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.preview-info .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.75rem;
}

.preview-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* ---------- 12. 解析器 ---------- */
.scanner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.dropzone {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  text-align: center;
  background: var(--surface-input);
  transition: all var(--transition);
  cursor: pointer;
  overflow: hidden;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.005);
}
.dropzone-icon {
  font-size: 3rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}
.dropzone h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.dropzone p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.dropzone .hint {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

#scan-preview {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  display: none;
}

/* 摄像头区 */
.camera-section {
  margin-top: 24px;
}
.camera-stage {
  position: relative;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
}
#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.scan-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  aspect-ratio: 1;
  border-radius: 16px;
}
.scan-frame::before,
.scan-frame::after {
  content: "";
  position: absolute;
  width: 40px;
  height: 40px;
  border: 4px solid var(--primary);
}
.scan-frame::before {
  top: -4px;
  left: -4px;
  border-right: none;
  border-bottom: none;
  border-radius: 12px 0 0 0;
}
.scan-frame::after {
  bottom: -4px;
  right: -4px;
  border-left: none;
  border-top: none;
  border-radius: 0 0 12px 0;
}
.scan-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent),
    transparent
  );
  box-shadow: 0 0 12px var(--accent);
  animation: scan-move 2s linear infinite;
}
@keyframes scan-move {
  0% {
    top: 0;
  }
  50% {
    top: calc(100% - 3px);
  }
  100% {
    top: 0;
  }
}
.camera-placeholder {
  color: var(--text-muted);
  text-align: center;
}
.camera-placeholder i {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* 解析结果 */
.result-card {
  display: flex;
  flex-direction: column;
}
.result-empty {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-muted);
  padding: 60px 24px;
}
.result-empty i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}
.result-content {
  animation: panel-in 0.3s ease;
}
.result-type {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 18px;
}
.result-text {
  padding: 16px;
  background: var(--surface-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  word-break: break-all;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 16px;
}
.result-fields {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}
.result-field {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.result-field .k {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}
.result-field .v {
  font-size: 0.9rem;
  color: var(--text-primary);
  word-break: break-all;
}
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 历史记录 */
.history-section {
  margin-top: 28px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title h3 i {
  color: var(--primary);
}
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.history-item {
  padding: 14px;
  background: var(--surface-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.history-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.history-item .type {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.history-item .text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-item .time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---------- 13. Toast ---------- */
.toast-container {
  position: fixed;
  top: 88px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in 0.3s ease;
  max-width: 360px;
}
.toast.success {
  border-left: 4px solid var(--success);
}
.toast.success i {
  color: var(--success);
}
.toast.error {
  border-left: 4px solid var(--danger);
}
.toast.error i {
  color: var(--danger);
}
.toast.info {
  border-left: 4px solid var(--primary);
}
.toast.info i {
  color: var(--primary);
}
.toast.removing {
  animation: toast-out 0.3s ease forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ---------- 14. 页脚 ---------- */
.footer {
  margin-top: 80px;
  padding: 48px 0 32px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}
.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 12px;
  line-height: 1.7;
}
.footer-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 14px;
}
.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-col a {
  color: var(--text-secondary);
  font-size: 0.88rem;
  transition: color var(--transition);
}
.footer-col a:hover {
  color: var(--primary);
}
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.footer-bottom .social {
  display: flex;
  gap: 12px;
}
.footer-bottom .social a {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-input);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.footer-bottom .social a:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

/* ---------- 15. 加载骨架 ---------- */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  place-items: center;
  z-index: 10;
  border-radius: inherit;
}
.loading-overlay.show {
  display: grid;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 16. 响应式 ---------- */
@media (max-width: 960px) {
  .generator-grid,
  .scanner-grid {
    grid-template-columns: 1fr;
  }
  .preview-card {
    position: static;
    order: -1;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }
  .hero {
    padding: 48px 0 28px;
  }
  .hero-stats {
    gap: 24px;
  }
  .type-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .preview-actions {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 20px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .tab-btn {
    padding: 10px 18px;
    font-size: 0.88rem;
  }
  .toast-container {
    right: 12px;
    left: 12px;
  }
  .toast {
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .type-grid {
    grid-template-columns: 1fr 1fr;
  }
  .nav-link {
    display: none;
  }
}

/* ---------- 语言切换下拉菜单 ---------- */
.lang-switcher {
  position: relative;
  display: inline-block;
}
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  padding: 6px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: lang-menu-in 0.2s ease;
}
@keyframes lang-menu-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.lang-item {
  display: block;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}
.lang-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.lang-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}
.lang-item.active::before {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 8px;
  font-size: 0.8rem;
}
#lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
}
#lang-toggle::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.7rem;
  transition: transform var(--transition);
}
#lang-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* ---------- 减少动画偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  body::before {
    animation: none;
  }
}
