/* ============ 主题变量 ============ */
:root {
  --bg: #0a0a0f;
  --bg-2: #11111a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.12);
  --text: #f3f4f6;
  --text-2: #9ca3af;
  --text-3: #6b7280;
  --accent: #818cf8;
  --accent-2: #a78bfa;
  --accent-glow: rgba(129, 140, 248, 0.4);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-2: rgba(241, 245, 249, 0.8);
  --border: rgba(0, 0, 0, 0.06);
  --border-2: rgba(0, 0, 0, 0.1);
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

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

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

body {
  position: relative;
  overflow-x: hidden;
}

/* ============ 背景装饰 ============ */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}
.orb-1 { width: 400px; height: 400px; background: var(--accent); top: -100px; left: -100px; }
.orb-2 { width: 500px; height: 500px; background: #ec4899; bottom: -150px; right: -100px; animation-delay: -7s; }
.orb-3 { width: 300px; height: 300px; background: #06b6d4; top: 50%; left: 50%; animation-delay: -14s; opacity: 0.3; }

[data-theme="light"] .orb { opacity: 0.25; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* ============ 顶栏 ============ */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  max-width: 1100px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 8px 24px var(--accent-glow);
}
.logo svg { width: 22px; height: 22px; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.theme-toggle {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
}
.theme-toggle:hover { background: var(--surface-2); transform: scale(1.05); }
.theme-toggle svg { width: 20px; height: 20px; }
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ============ 容器 ============ */
.container {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 16px 32px 60px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.output-card, .config-card, .batch-card, .tips-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  transition: background 0.3s, border 0.3s;
}

.output-card, .config-card, .batch-card, .tips-card, .features-card { grid-column: 1 / -1; }

@media (max-width: 768px) {
  .container { grid-template-columns: 1fr; padding: 16px; }
  .topbar { padding: 16px 20px; }
  .output-card, .config-card, .batch-card, .tips-card, .features-card { padding: 20px; }
}

/* ============ 输出卡片 ============ */
.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.label { font-size: 13px; color: var(--text-2); font-weight: 500; }

.strength-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-2);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.strength-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3);
  transition: background 0.3s, box-shadow 0.3s;
}
.strength-badge.weak .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.strength-badge.fair .dot { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.strength-badge.good .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.strength-badge.strong .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }

.output-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 16px;
  transition: border 0.2s, box-shadow 0.2s;
}
.output-display:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

#passwordOutput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.copy-btn {
  flex-shrink: 0;
  width: 40px; height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.copy-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.copy-btn svg { width: 18px; height: 18px; }

.strength-meter {
  height: 6px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 12px;
}
.strength-bar {
  height: 100%;
  width: 0%;
  background: var(--text-3);
  border-radius: 100px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
}
.strength-bar.weak { background: linear-gradient(90deg, #ef4444, #f87171); }
.strength-bar.fair { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.strength-bar.good { background: linear-gradient(90deg, #6366f1, #818cf8); }
.strength-bar.strong { background: linear-gradient(90deg, #10b981, #34d399); }

.strength-stats {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--text-2);
  flex-wrap: wrap;
}
.strength-stats strong { color: var(--text); font-weight: 600; font-family: 'JetBrains Mono', monospace; }

.action-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn-primary, .btn-secondary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 8px 24px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-primary svg, .btn-secondary svg { width: 18px; height: 18px; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface); border-color: var(--border-2); }

/* ============ 配置卡片 ============ */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 24px;
}
.section-title svg { width: 20px; height: 20px; color: var(--accent); }

.control-group { margin-bottom: 24px; }
.control-group:last-child { margin-bottom: 0; }

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.control-header label { font-size: 14px; font-weight: 600; }
.value-chip {
  padding: 4px 10px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  min-width: 36px;
  text-align: center;
}
.control-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* 滑块 */
input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 100px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  background: white;
  border: 3px solid var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  background: white;
  border: 3px solid var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}

/* 复选框网格 */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) { .checkbox-grid { grid-template-columns: 1fr; } }

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.check-item:hover { border-color: var(--border-2); }
.check-item input { display: none; }
.check-box {
  width: 20px; height: 20px;
  border: 2px solid var(--border-2);
  border-radius: 6px;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s;
}
.check-item input:checked + .check-box {
  background: var(--accent);
  border-color: var(--accent);
}
.check-item input:checked + .check-box::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 6px; height: 11px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check-title { display: block; font-size: 13px; font-weight: 600; }
.check-desc { display: block; font-size: 11px; color: var(--text-2); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

/* 开关列表 */
.toggle-list { display: flex; flex-direction: column; gap: 8px; }
.toggle-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.toggle-item:hover { border-color: var(--border-2); }
.toggle-text { flex: 1; }
.toggle-title { display: block; font-size: 13px; font-weight: 600; }
.toggle-desc { display: block; font-size: 11px; color: var(--text-2); margin-top: 2px; }
.toggle-input { display: none; }
.toggle-switch {
  width: 40px; height: 22px;
  background: var(--border-2);
  border-radius: 100px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-input:checked + .toggle-switch { background: var(--accent); }
.toggle-input:checked + .toggle-switch::after { transform: translateX(18px); }

/* ============ 批量结果 ============ */
.batch-card { grid-column: 1 / -1; }
.batch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.batch-actions { display: flex; gap: 8px; align-items: center; }

.select {
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.icon-btn {
  width: 38px; height: 38px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.icon-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.icon-btn svg { width: 16px; height: 16px; }

.batch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}
.batch-list::-webkit-scrollbar { width: 6px; }
.batch-list::-webkit-scrollbar-track { background: transparent; }
.batch-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

.batch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.15s;
  min-height: 44px;
}
.batch-item:hover { background: var(--surface); border-color: var(--border-2); }
.batch-index {
  width: 28px; height: 28px;
  background: var(--bg-2);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--text-2);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  flex-shrink: 0;
}
.batch-pwd {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
  padding: 4px 0;
  line-height: 1.4;
}
.batch-copy {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.batch-copy:hover { background: var(--accent); color: white; border-color: var(--accent); }
.batch-copy svg { width: 14px; height: 14px; }

/* ============ 品牌扩展 ============ */
.brand-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}
.brand-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 4px;
  letter-spacing: 0.02em;
}

.topnav {
  display: flex;
  gap: 6px;
  align-items: center;
}
.topnav a {
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 500;
}
.topnav a:hover { color: var(--text); background: var(--surface); }

@media (max-width: 768px) { .topnav { display: none; } }

/* ============ 面包屑 / H1 / 副标题 ============ */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  padding: 4px 4px 0;
}
.breadcrumb a {
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .bc-sep { color: var(--text-3); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 500; }

.page-h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 8px 0 0;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-subtitle {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.7;
  margin: 8px 0 0;
  max-width: 720px;
}
@media (max-width: 600px) {
  .page-h1 { font-size: 24px; }
  .page-subtitle { font-size: 14px; }
}

/* ============ FAQ ============ */
.faq-card, .friends-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  grid-column: 1 / -1;
}
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border 0.2s;
}
.faq-item:hover { border-color: var(--border-2); }
.faq-item[open] { border-color: var(--accent); }
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 20px;
  font-weight: 300;
  color: var(--text-2);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); color: var(--accent); }
.faq-item p {
  padding: 0 18px 16px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
}

/* ============ 友情链接 ============ */
.friends-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.friends-list li a {
  display: block;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}
.friends-list li a:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ============ 特性卡片 ============ */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 600px) { .features-grid { grid-template-columns: 1fr; } }

.feature-item {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all 0.2s;
}
.feature-item:hover { border-color: var(--border-2); transform: translateY(-2px); }
.feature-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: white;
}
.feature-icon svg { width: 20px; height: 20px; }
.icon-1 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.icon-2 { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.icon-3 { background: linear-gradient(135deg, #10b981, #14b8a6); }
.icon-4 { background: linear-gradient(135deg, #f59e0b, #f97316); }
.feature-content h4 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.feature-content p { font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* ============ 提示卡片 ============ */
.tips-card { padding: 20px 28px; }
.tips-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-2);
}
.tips-title svg { width: 18px; height: 18px; color: var(--accent); }
.tips-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px 20px;
}
.tips-list li {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

/* ============ Footer ============ */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px 32px 40px;
  color: var(--text-3);
  font-size: 12px;
  border-top: 1px solid var(--border);
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.footer-main { line-height: 1.6; }
.footer-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.footer a { color: var(--text-2); text-decoration: none; transition: color 0.2s; }
.footer a:hover { color: var(--accent); }
.dot-sep { opacity: 0.5; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast svg { width: 18px; height: 18px; }
