/* ============ 基础 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --text-soft: #6b7280;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 16px rgba(16, 24, 40, .05);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3 { line-height: 1.35; }

/* ============ 头部 ============ */
.site-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff;
  padding: 36px 0 32px;
}

.site-header h1 { font-size: 32px; font-weight: 700; letter-spacing: .5px; }
.subtitle { margin-top: 10px; font-size: 15px; max-width: 720px; opacity: .95; }
.subtitle strong { color: #fde68a; }

/* ============ 工具卡片 ============ */
.tool-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: -18px;
  position: relative;
  padding: 24px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 240px 1fr;
  gap: 20px;
}

.panel h2 { font-size: 16px; margin-bottom: 12px; color: var(--accent-dark); }

/* 上传区 */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 12px;
  user-select: none;
}
.upload-zone:hover, .upload-zone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.upload-icon { font-size: 26px; }
.upload-zone p { font-size: 13.5px; }
.upload-zone .hint { font-size: 12px; color: var(--text-soft); margin-top: 2px; }

/* 字段行 */
.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-soft);
}
.field-row select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
}
.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

/* 文本域 */
.input-area {
  width: 100%;
  height: 300px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
  background: #fafbfc;
  transition: border-color .2s, box-shadow .2s;
}
.input-area:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.output-area { background: #f8fafc; }

/* 徽章 */
.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
  white-space: nowrap;
}
.badge.is-ok { background: #ecfdf5; color: #047857; }
.badge.is-warn { background: #fef2f2; color: #b91c1c; }

/* 转换面板 */
.convert-panel { background: #f8fafc; border-radius: 10px; padding: 16px; }
.field-label { font-size: 13px; color: var(--text-soft); margin: 14px 0 8px; }

.target-group { display: flex; gap: 8px; margin-bottom: 16px; }
.target-btn {
  flex: 1;
  padding: 10px 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  transition: all .15s;
}
.target-btn:hover { border-color: var(--accent); color: var(--accent); }
.target-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .35);
}

.convert-btn {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .3);
}
.convert-btn:hover { opacity: .92; }
.convert-btn:active { transform: scale(.98); }

.convert-list { margin-top: 16px; font-size: 12.5px; color: var(--text-soft); list-style: none; }
.convert-list li::before { content: "✓ "; color: #16a34a; font-weight: 700; }

/* 输出工具条 */
.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.toolbar-btns { display: flex; gap: 8px; }
.small-btn {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.small-btn:hover { border-color: var(--accent); color: var(--accent); }
.small-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.small-btn.primary:hover { background: var(--accent-dark); color: #fff; }
.small-btn:disabled { opacity: .5; cursor: not-allowed; }

.privacy-note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-soft);
  text-align: center;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

/* ============ 内容区 ============ */
.content-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 24px 0;
  padding: 28px;
}
.content-section h2 {
  font-size: 20px;
  margin: 26px 0 12px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}
.content-section h2:first-child { margin-top: 0; }
.content-section p { margin-bottom: 12px; font-size: 15px; }
.content-section code {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.table-wrap { overflow-x: auto; margin: 12px 0 4px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
}
th { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
tbody tr:nth-child(even) { background: #fafbfc; }

.steps { margin: 4px 0 8px 20px; }
.steps li { margin-bottom: 8px; font-size: 15px; }

.faq h3 {
  font-size: 15.5px;
  margin: 18px 0 6px;
  color: var(--accent-dark);
  cursor: default;
}
.faq h3::before { content: "❓ "; }
.faq p { font-size: 14.5px; margin-bottom: 6px; }

/* ============ 页脚 ============ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 28px;
  text-align: center;
  font-size: 13px;
  color: var(--text-soft);
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .tool-grid { grid-template-columns: 1fr; }
  .convert-panel { order: -1; }
  .site-header h1 { font-size: 26px; }
  .input-area { height: 220px; }
  .content-section { padding: 20px; }
}
