:root {
  color-scheme: dark;
  --bg: #0b1018;
  --bg-start: #0f1620;
  --glow: rgba(56, 189, 248, 0.12);
  --topbar: rgba(17, 24, 39, 0.75);
  --panel: #151a21;
  --panel-rgb: 17, 24, 39;
  --panel-soft: #1e293b;
  --surface: #111827;
  --surface-2: #1f2937;
  --surface-3: #374151;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #e2e8f0;
  --text-strong: #ffffff;
  --muted: #94a3b8;
  --table-head: rgba(31, 41, 55, 0.6);
  --table-text: #e2e8f0;
  --green: #10b981;
  --blue: #3b82f6;
  --cyan: #0ea5e9;
  --yellow: #f59e0b;
  --red: #ef4444;
  --red-bright: #f87171;
  --shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

body[data-theme="light"] {
  color-scheme: light;
  /* 💡 完美的清透蓝白天背景 */
  --bg: #e6f3fa; 
  --bg-start: #f2f9fc;
  --glow: rgba(14, 165, 233, 0.15); 
  
  /* 💡 顶部导航与面板的半透明玻璃态 */
  --topbar: rgba(242, 249, 252, 0.65);
  --panel: #ffffff;
  --panel-rgb: 255, 255, 255;
  --panel-soft: #f1f7fb; 
  
  --surface: #ffffff;
  --surface-2: #f8fbfe;
  --surface-3: #eef5f9;
  
  --line: rgba(148, 163, 184, 0.2); 
  --line-strong: rgba(148, 163, 184, 0.35);
  
  --text: #334155;
  --text-strong: #0f172a;
  --muted: #64748b;
  
  --table-head: rgba(241, 247, 251, 0.8);
  --table-text: #334155;
  
  --green: #10b981;
  --blue: #0ea5e9;
  --cyan: #06b6d4;
  --yellow: #d97706;
  --red: #ef4444;
  --red-bright: #f87171;
  
  /* 💡 像羽毛一样轻的弥散阴影 */
  --shadow: 0 16px 40px -12px rgba(14, 165, 233, 0.15), 0 4px 16px -4px rgba(14, 165, 233, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0; min-height: 100vh;
  /* 💡 更大范围的弥散渐变，营造高级质感 */
  background: 
    radial-gradient(circle at 10% 0%, var(--glow), transparent 45rem), 
    radial-gradient(circle at 90% 100%, rgba(14, 165, 233, 0.08), transparent 45rem), 
    linear-gradient(180deg, var(--bg-start) 0%, var(--bg) 100%);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* 让网页文字抗锯齿，更加丝滑 */
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

/* === 安全锁屏样式 === */
.auth-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  opacity: 1; visibility: visible; transition: all 0.3s ease;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.auth-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.auth-box {
  width: 90%; max-width: 360px; padding: 40px 28px;
  border: 1px solid var(--line); border-radius: 20px;
  background: rgba(var(--panel-rgb), 0.85); box-shadow: var(--shadow); text-align: center;
}
.auth-box h2 { margin-bottom: 8px; font-size: 20px; }
.auth-box p { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.auth-box input { margin-bottom: 16px; text-align: center; letter-spacing: 2px; }

.app-shell { min-height: 100vh; transition: filter 0.3s; }
.app-shell.locked { filter: blur(12px); pointer-events: none; user-select: none; height: 100vh; overflow: hidden; }

/* === 顶部导航与主体 === */
.topbar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 18px;
  height: 54px; padding: 0 24px; background: var(--topbar); 
  border-bottom: 1px solid var(--line);
  /* 💡 开启导航栏毛玻璃特效 */
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text-strong); text-decoration: none; white-space: nowrap; }
.brand strong { font-size: 16px; letter-spacing: 0.5px; }
.brand-mark { position: relative; display: inline-grid; place-items: center; width: 26px; height: 22px; }
.brand-mark::before { content: ""; width: 21px; height: 10px; border-radius: 50%; background: linear-gradient(90deg, #34d399, #6ee7b7); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2); }
.brand-mark::after { content: ""; position: absolute; top: 1px; width: 2px; height: 17px; background: #fb7185; transform: rotate(-3deg); }
.signal-dot { position: absolute; top: 7px; left: 8px; z-index: 1; width: 4px; height: 4px; border-radius: 50%; background: #ffffff; }
.version { padding: 2px 8px; border-radius: 6px; background: var(--cyan); color: white; font-size: 12px; font-weight: 700; box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3); }

/* 💡 彻底修复：全局隐藏导航栏讨厌的原生滚动条 */
.nav-tabs { 
  display: flex; align-items: stretch; gap: 6px; height: 100%; 
  overflow-x: auto; overflow-y: hidden; flex: 1; 
  -ms-overflow-style: none; scrollbar-width: none; 
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab { min-width: max-content; border: 0; padding: 0 16px; color: var(--muted); background: transparent; cursor: pointer; transition: all 0.2s; font-size: 14px; }
.nav-tab:hover { color: var(--text-strong); }
.nav-tab.active { color: white; background: var(--blue); font-weight: bold; border-radius: 8px; margin: 8px 0; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }

.theme-toggle { 
    display: flex; align-items: center; justify-content: center; gap: 6px;
    min-width: 100px; height: 36px; padding: 0 16px; 
    border: 1px solid var(--line-strong); border-radius: 18px; 
    background: var(--surface); color: var(--text-strong); 
    font-size: 13px; font-weight: bold; cursor: pointer; 
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.theme-toggle:hover { background: var(--panel-soft); border-color: var(--text); transform: translateY(-1px); }

.workspace { padding: 24px 20px 40px; max-width: 1200px; margin: 0 auto;}
.view { display: none; }
.view.active { display: grid; grid-template-columns: 1fr; gap: 20px; animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* === 面板与表单 === */
/* 💡 面板玻璃态升级：更大的圆角，更透的背景 */
.panel { 
    border: 1px solid var(--line); 
    border-radius: 20px; 
    background: rgba(var(--panel-rgb), 0.85); 
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow); 
    padding: 28px 24px; 
}
.panel-heading, .result-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font-size: 12px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; }
h1, h2 { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 700; color: var(--text-strong); }
h2 { font-size: 16px; }

.status-pill { padding: 4px 10px; border-radius: 999px; background: rgba(148, 163, 184, 0.15); color: var(--text); font-size: 12px; font-weight: bold; white-space: nowrap; }
.status-pill.running { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.status-pill.ok { background: rgba(14, 165, 233, 0.15); color: var(--cyan); }

.scan-form { display: grid; gap: 18px; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.three { grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field span, .hint { color: var(--muted); font-size: 13px; font-weight: 500; }
.hint { margin: 0; line-height: 1.6; }

select, input, textarea {
  width: 100%; border: 1px solid var(--line-strong); 
  border-radius: 10px; /* 💡 更圆润的输入框 */
  background: var(--surface-2); color: var(--text-strong); outline: none; transition: all 0.2s ease;
}
select, input { height: 48px; padding: 0 16px; font-weight: 500; }
textarea { min-height: 100px; resize: vertical; padding: 14px 16px; line-height: 1.5; }
select:focus, input:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15); background: var(--surface); }

.actions, .tool-actions, .header-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.input-with-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }

/* === 按钮 === */
.mini-action { min-height: 48px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); color: var(--text-strong); font-weight: 600; cursor: pointer; transition: all 0.2s; }
.mini-action:hover { background: var(--line); }

button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border: 0; border-radius: 10px; color: white; font-weight: 700; font-size: 14px; cursor: pointer; transition: all 0.2s ease; }

.primary-btn { padding: 0 24px; background: linear-gradient(135deg, var(--cyan), var(--blue)); box-shadow: 0 6px 20px -6px rgba(14, 165, 233, 0.5); }
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px -6px rgba(14, 165, 233, 0.6); }

.secondary-btn { padding: 0 20px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-strong); box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.secondary-btn:hover { background: var(--surface-3); border-color: var(--text); }

.danger-btn { padding: 0 20px; background: linear-gradient(135deg, var(--red-bright), var(--red)); box-shadow: 0 6px 20px -6px rgba(239, 68, 68, 0.4); }
.danger-btn:hover { transform: translateY(-1px); }

.ghost-btn { min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.ghost-btn:hover { color: var(--text-strong); border-color: var(--text); background: var(--surface-2); }

button:disabled { cursor: not-allowed; opacity: 0.45; filter: grayscale(1); pointer-events: none; box-shadow: none; transform: none; }

/* === 列表 UI === */
.scrollable-list {
  height: 180px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); padding: 8px; display: flex; flex-direction: column; gap: 6px;
}
.scrollable-list::-webkit-scrollbar { width: 6px; }
.scrollable-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 40px; padding: 0 14px; border: 1px solid transparent; border-radius: 8px;
  background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.list-item:hover { background: var(--surface-3); }
.list-item.active { border-color: var(--cyan); background: rgba(14, 165, 233, 0.08); color: var(--cyan); font-weight: 700; }
.list-item-delete { color: var(--muted); font-size: 18px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.list-item-delete:hover { background: rgba(239, 68, 68, 0.15); color: var(--red-bright); }

/* === 面板指标与日志 === */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.metrics article { padding: 16px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.metrics span { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.05em; }
.metrics strong { display: block; margin-top: 10px; color: var(--text-strong); font-size: clamp(18px, 2vw, 26px); line-height: 1; font-weight: 800; }

.progress-wrap { margin-bottom: 20px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--text-strong); font-size: 13px; font-weight: 600; }
.progress-bar { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.progress-bar span { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--blue)); border-radius: 999px; transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

.log-list { display: grid; gap: 8px; max-height: 320px; overflow: auto; margin: 0; padding: 0; list-style: none; }
.log-list li { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 13px; line-height: 1.5; font-family: ui-monospace, monospace; }
.tool-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; margin-bottom: 20px; }
.tool-actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px;}

/* === 各种区块 === */
.validation-board, .result-board, .generator-board, .stats-board { margin-bottom: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.result-board { padding: 0; border: 0; background: transparent; }
.collapsed-block { display: none !important; }

/* === 结果卡片 === */
.result-cards { display: grid; gap: 16px; }
.result-empty { padding: 30px 20px; border: 2px dashed var(--line-strong); border-radius: 16px; color: var(--muted); text-align: center; font-weight: 600; }
.result-card { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 4px 12px rgba(0,0,0,0.02); transition: all 0.2s; }
.result-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.05); }
.result-card-main { position: relative; z-index: 1; min-width: 0; }
.result-card-label { display: inline-block; margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.result-card strong { display: block; color: var(--text-strong); font-size: 18px; overflow-wrap: anywhere; }
.result-card p { margin: 10px 0 16px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.result-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.result-chip { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(14, 165, 233, 0.2); background: rgba(14, 165, 233, 0.05); color: var(--cyan); font-size: 12px; font-weight: 600; }
.result-latency { display: flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 16px; border-radius: 10px; font-weight: 800; border: 1px solid rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.1); color: var(--green); font-size: 15px; }

/* === 筛选与表格 === */
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filter-label { min-width: 64px; color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.filter-chip { min-height: 36px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--surface-2); color: var(--text-strong); font-weight: 600; font-size: 13px; cursor: pointer; transition: all 0.2s; }
.filter-chip:hover { border-color: var(--text); background: var(--surface-3); }
.filter-chip.active { border-color: var(--cyan); background: var(--cyan); color: #ffffff; box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
table { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { color: var(--muted); background: var(--table-head); font-weight: 700; letter-spacing: 0.05em; }
td { color: var(--table-text); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--surface-2); }
.empty-cell { color: var(--muted); text-align: center; padding: 40px; font-weight: 600; }
.tag { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 6px; background: rgba(148, 163, 184, 0.15); color: var(--text); font-size: 12px; font-weight: 600; }
.tag.checking { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }
.tag.valid { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.tag.invalid, .tag.error { background: rgba(239, 68, 68, 0.15); color: var(--red-bright); }

/* 移动端神级优化 */
@media (max-width: 980px) {
  .field-grid, .field-grid.two, .field-grid.three, .metrics, .validation-metrics { grid-template-columns: 1fr; }
  .tool-row { grid-template-columns: 1fr; }
  .tool-actions { flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .topbar { padding: 8px 16px; height: auto; flex-wrap: wrap; }
  
  .workspace { padding: 16px 12px 30px; }
  .panel { padding: 20px 16px; border-radius: 16px; }
  
  .actions button, .tool-actions button { width: 100%; margin-bottom: 6px; }
  .tool-actions { flex-direction: column; }
  
  .result-card { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .result-card-side { display: flex; justify-content: flex-start; }
  .result-latency { width: 100%; }
  
  /* 移动端表格取消圆角紧贴边缘 */
  .table-wrap { margin: 0 -16px; border-radius: 0; border-left: none; border-right: none; }
}