:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #fafbfc;
  --text: #16181d;
  --text-muted: #6b7280;
  --text-faint: #9aa1ac;
  --border: #e4e7ec;
  --border-strong: #d3d8e0;
  --primary: #3d5afe;
  --primary-dark: #2f49d6;
  --primary-soft: #eef1ff;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 16px -4px rgba(16, 24, 40, 0.1), 0 2px 6px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 18px 40px -12px rgba(16, 24, 40, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
  background: linear-gradient(135deg, var(--primary), #7c4dff);
  box-shadow: 0 4px 10px -3px rgba(61, 90, 254, 0.55);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 450;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

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

.nav a {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.nav a:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

/* ---------- 主体 ---------- */
.main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}

/* ---------- 首页 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 40px 40px 36px;
  color: #fff;
  background: linear-gradient(135deg, #1e2a78 0%, #3d5afe 52%, #7c4dff 100%);
  box-shadow: var(--shadow-lg);
}

.hero::after {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  filter: blur(10px);
}

.hero-kicker {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 16px 0 10px;
  font-size: 32px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.hero p {
  margin: 0;
  max-width: 620px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.86);
}

.section-title {
  margin: 36px 0 16px;
  font-size: 17px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), #7c4dff);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.tool-card {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: var(--shadow-md);
}

.tool-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.tool-body {
  min-width: 0;
}

.tool-name {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.tool-summary {
  margin: 0;
  font-size: 13.5px;
  color: var(--text);
}

.tool-detail {
  margin: 4px 0 10px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.tool-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--primary-dark);
  background: var(--primary-allow, #eef1ff);
  background: var(--primary-soft);
}

.tool-arrow {
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: var(--text-faint);
  transition: transform 0.18s ease, color 0.18s ease;
}

.tool-card:hover .tool-arrow {
  transform: translateX(3px);
  color: var(--primary);
}

/* ---------- 工具页 ---------- */
.page-head {
  margin-bottom: 24px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-faint);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.page-head h1 {
  margin: 8px 0 6px;
  font-size: 25px;
  letter-spacing: -0.01em;
}

.page-head .lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

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

.panel + .panel {
  margin-top: 18px;
}

.panel-title {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

/* ---------- 上传区 ---------- */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone-icon {
  font-size: 30px;
  line-height: 1;
}

.dropzone-title {
  margin: 12px 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.dropzone-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.file-picked {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  border: 1px solid #c7d2fe;
}

.file-picked.is-visible {
  display: flex;
}

.file-picked .name {
  font-weight: 600;
  word-break: break-all;
}

.file-picked .meta {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- 表单 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.field .hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-faint);
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(61, 90, 254, 0.14);
}

/* ---------- 按钮 ---------- */
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s, transform 0.1s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #6a4bff);
  box-shadow: 0 6px 16px -6px rgba(61, 90, 254, 0.7);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #5a3ce8);
}

.btn-secondary {
  color: var(--text);
  background: #fff;
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.is-hidden {
  display: none;
}

/* ---------- 状态 ---------- */
.status {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  display: none;
  gap: 10px;
  align-items: flex-start;
}

.status.is-visible {
  display: flex;
}

.status-info {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #c7d2fe;
}

.status-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecdca;
}

.status-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid #abefc6;
}

.status-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #fedf89;
}

.spinner {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 结果 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-value {
  margin-top: 2px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-value.is-zero {
  color: var(--text-faint);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table.result {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.result th,
table.result td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.result th {
  position: sticky;
  top: 0;
  background: var(--surface-soft);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
}

table.result tbody tr:last-child td {
  border-bottom: none;
}

table.result tbody tr:hover {
  background: var(--primary-soft);
}

td.code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.empty-note {
  padding: 22px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.footnote {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---------- 页脚 ---------- */
.footer {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 32px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-faint);
  font-size: 12.5px;
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .main {
    padding: 22px 16px 40px;
  }
  .hero {
    padding: 28px 22px;
  }
  .hero h1 {
    font-size: 25px;
  }
  .panel {
    padding: 18px;
  }
  .topbar-inner {
    padding: 10px 16px;
  }
}
