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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #2c2c2c;
  background: #f5f5f5;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== 顶部 ========== */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e5e5;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 18px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: #2c2c2c;
  border-radius: 4px;
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: #ffffff;
}

.brand-mark::before {
  width: 14px;
  height: 2px;
  top: 10px;
  left: 8px;
  box-shadow: 0 6px 0 #fff, 0 12px 0 #fff;
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 600;
  color: #2c2c2c;
  letter-spacing: 0.3px;
}

.tagline {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.main-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #555;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.nav-btn:hover {
  color: #2c2c2c;
  background: #f0f0f0;
}

.nav-btn.active {
  background: #2c2c2c;
  color: #ffffff;
  border-color: #2c2c2c;
}

/* ========== 主内容 ========== */
.main-content {
  padding: 32px 20px 60px;
}

.tool-category {
  display: none;
}

.tool-category.active {
  display: block;
  animation: fadein 0.2s ease-out;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 工具卡片 ========== */
.tool-card {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  margin-bottom: 18px;
  overflow: hidden;
}

.tool-head {
  padding: 14px 18px;
  border-bottom: 1px solid #eaeaea;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-head h3 {
  font-size: 15px;
  font-weight: 600;
  color: #2c2c2c;
}

.tool-hint {
  font-size: 12px;
  color: #999;
}

.tool-body {
  padding: 18px;
}

.tool-body > label,
.form-grid > label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 14px;
}

.tool-body > label:last-child {
  margin-bottom: 0;
}

/* ========== 表单网格 ========== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-grid .col-span-2 {
  grid-column: 1 / -1;
}

/* ========== 输入控件 ========== */
input[type="text"],
input[type="number"],
input[type="url"],
input[type="datetime-local"],
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: #2c2c2c;
  background: #ffffff;
  border: 1px solid #d5d5d5;
  border-radius: 3px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #888;
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

input[type="color"] {
  width: 48px;
  height: 34px;
  padding: 2px;
  margin-top: 6px;
  border: 1px solid #d5d5d5;
  border-radius: 3px;
  cursor: pointer;
}

/* ========== 工具栏 ========== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar label {
  font-size: 13px;
  color: #555;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar label input {
  margin-top: 0;
  width: 70px;
}

.toolbar label select {
  margin-top: 0;
  width: auto;
}

.inline-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.inline-actions input {
  flex: 1;
  margin-top: 0;
}

/* ========== 复选框列表 ========== */
.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 6px;
}

.checkbox-list span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
}

.checkbox-list input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-block;
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: #ffffff;
  background: #2c2c2c;
  border: 1px solid #2c2c2c;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 14px;
}

.btn:hover {
  background: #4a4a4a;
  border-color: #4a4a4a;
}

.btn-ghost {
  background: #ffffff;
  color: #555;
  border-color: #d5d5d5;
}

.btn-ghost:hover {
  background: #f5f5f5;
  color: #2c2c2c;
  border-color: #b5b5b5;
}

/* ========== 结果展示 ========== */
.result {
  background: #fafafa;
  border: 1px solid #eaeaea;
  border-radius: 3px;
  padding: 14px 16px;
  font-size: 13px;
  color: #333;
  word-break: break-all;
}

.result.code {
  font-family: "SF Mono", Consolas, Monaco, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  max-height: 400px;
  overflow: auto;
}

/* ========== 关键词分析表 ========== */
.kwd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 4px;
}

.kwd-table th,
.kwd-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #eaeaea;
}

.kwd-table th {
  background: #f0f0f0;
  font-weight: 500;
  color: #555;
}

.kwd-bar-wrap {
  width: 100%;
  max-width: 220px;
}

.kwd-bar {
  height: 5px;
  background: #2c2c2c;
  border-radius: 2px;
}

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

/* ========== 哈希结果 ========== */
.hash-list {
  margin-top: 4px;
}

.hash-row {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  background: #fafafa;
  border: 1px solid #eaeaea;
  border-radius: 3px;
  margin-bottom: 6px;
  gap: 12px;
}

.hash-row:last-child {
  margin-bottom: 0;
}

.hash-label {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  min-width: 70px;
}

.hash-value {
  flex: 1;
  font-family: "SF Mono", Consolas, Monaco, monospace;
  font-size: 12.5px;
  color: #333;
  word-break: break-all;
}

.hash-copy {
  font-size: 12px;
  padding: 4px 10px;
  background: #ffffff;
  color: #555;
  border: 1px solid #d5d5d5;
  border-radius: 3px;
  cursor: pointer;
}

.hash-copy:hover {
  background: #2c2c2c;
  color: #ffffff;
  border-color: #2c2c2c;
}

/* ========== 字符统计 ========== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.stat-item {
  background: #fafafa;
  border: 1px solid #eaeaea;
  border-radius: 3px;
  padding: 12px 10px;
  text-align: center;
}

.stat-item .stat-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.stat-item .stat-value {
  font-size: 20px;
  font-weight: 600;
  color: #2c2c2c;
}

/* ========== 颜色工具 ========== */
.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.color-row > label {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
}

.color-picker-label input {
  width: 60px;
}

.color-preview {
  height: 50px;
  border: 1px solid #eaeaea;
  border-radius: 3px;
  background: #3b82f6;
  margin-top: 4px;
}

/* ========== 文本对比 ========== */
.diff-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.diff-col {
  background: #ffffff;
  border: 1px solid #eaeaea;
  border-radius: 3px;
  overflow: hidden;
}

.diff-col-title {
  padding: 8px 12px;
  background: #f0f0f0;
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

.diff-body {
  padding: 8px 0;
}

.diff-line {
  padding: 3px 12px;
  font-family: "SF Mono", Consolas, Monaco, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  color: #555;
}

.diff-line.added {
  background: #e8f5e9;
  color: #2e7d32;
}

.diff-line.removed {
  background: #fbe9e7;
  color: #c62828;
}

/* ========== 二维码 ========== */
.qr-output {
  text-align: center;
  margin-top: 8px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #eaeaea;
  border-radius: 3px;
  display: inline-block;
}

.qr-output canvas,
.qr-output img {
  display: block;
}

/* ========== 底部 ========== */
.site-footer {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: #999;
  border-top: 1px solid #e5e5e5;
  background: #ffffff;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #2c2c2c;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 3px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .main-nav {
    width: 100%;
  }

  .nav-btn {
    flex: 1;
    text-align: center;
  }

  .diff-result {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar label {
    justify-content: space-between;
  }

  .hash-row {
    flex-wrap: wrap;
  }

  .inline-actions {
    flex-wrap: wrap;
  }
}
