/* ============================================================
   cy_tool 在线工具箱 全站样式
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --nav-bg: linear-gradient(90deg, #1e3a8a 0%, #1d4ed8 100%);
  --text: #1f2937;
  --text-2: #6b7280;
  --border: #e5e7eb;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, .06), 0 1px 2px rgba(17, 24, 39, .04);
  --shadow-md: 0 6px 18px rgba(17, 24, 39, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶部导航 ---------- */
.site-header {
  background: var(--nav-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 18px; font-weight: 700; }
.brand:hover { color: #fff; }
.brand-logo { font-size: 22px; }
.main-nav { display: flex; gap: 4px; }
.main-nav a {
  color: rgba(255, 255, 255, .85);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 15px;
}
.main-nav a:hover, .main-nav a.active { color: #fff; background: rgba(255, 255, 255, .15); }
.header-search { margin-left: auto; display: flex; }
.header-search input {
  width: 200px;
  height: 32px;
  border: none;
  border-radius: 8px 0 0 8px;
  padding: 0 12px;
  font-size: 13px;
  outline: none;
  background: rgba(255, 255, 255, .95);
}
.header-search button {
  height: 32px;
  border: none;
  border-radius: 0 8px 8px 0;
  padding: 0 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, .25);
  color: #fff;
  font-size: 14px;
}
.header-search button:hover { background: rgba(255, 255, 255, .4); }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, #eef4ff 0%, var(--bg) 100%);
  padding: 48px 0 32px;
  text-align: center;
}
.hero h1 { margin: 0 0 8px; font-size: 30px; }
.hero-sub { margin: 0 0 24px; color: var(--text-2); }
.hero-search { display: flex; max-width: 560px; margin: 0 auto; }
.hero-search input {
  flex: 1;
  height: 46px;
  border: 2px solid var(--primary);
  border-right: none;
  border-radius: 10px 0 0 10px;
  padding: 0 16px;
  font-size: 15px;
  outline: none;
  background: #fff;
}
.hero-search button {
  height: 46px;
  padding: 0 28px;
  border: none;
  border-radius: 0 10px 10px 0;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.hero-search button:hover { background: var(--primary-dark); }
.hero-cats { margin-top: 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.hero-cats a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.hero-cats a:hover { border-color: var(--primary); color: var(--primary); }
.chip-icon { font-size: 15px; }

/* ---------- 区块 ---------- */
.section { padding: 28px 16px 8px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-eyebrow {
  display: block;
  width: 100%;
  color: var(--primary);
  font-size: 12px;
  letter-spacing: 3px;
  font-weight: 700;
}
.section-head h1, .section-head h2 { margin: 0; font-size: 22px; display: inline-flex; align-items: center; gap: 8px; }
.section-title { font-size: 22px; }
.section-count { color: var(--text-2); font-size: 14px; font-weight: 400; margin-left: 6px; }
.section-desc { width: 100%; margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.section-icon { font-size: 24px; }
.section-more { margin-left: auto; font-size: 14px; white-space: nowrap; }

/* ---------- 工具卡片网格 ---------- */
.tool-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.tool-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #c7d7f8; }
.tool-card-head { display: flex; align-items: center; gap: 10px; }
.tool-card-head h2, .tool-card-head h3 { margin: 0; font-size: 16px; flex: 1; min-width: 0; }
.tool-card-head h2 a, .tool-card-head h3 a { color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-card-head h2 a:hover, .tool-card-head h3 a:hover { color: var(--primary); }
.tool-icon {
  width: 40px;
  height: 40px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--primary-soft);
  border-radius: 10px;
  overflow: hidden;
  object-fit: cover;
}
.icon-empty { opacity: .55; }
.tool-card-tag {
  flex: none;
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 2px 10px;
}
.tag-hot { color: #d97706; background: #fef3c7; }
.tool-card-desc {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 42px;
}
.tool-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tool-card-host { color: #9ca3af; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-card-enter { font-size: 13px; font-weight: 600; white-space: nowrap; }

/* 迷你卡片（推荐位 / 相关工具） */
.tool-grid-mini { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.tool-card-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
  height: 100%;
}
.tool-card-mini:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--primary); }
.tool-card-mini .tool-icon { width: 32px; height: 32px; font-size: 18px; border-radius: 8px; }
.tool-card-mini-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 分类 chips ---------- */
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.cat-chips a {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 16px;
  color: var(--text);
  font-size: 14px;
}
.cat-chips a:hover { border-color: var(--primary); color: var(--primary); }
.cat-chips a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 面包屑 ---------- */
.breadcrumb { padding-top: 16px; font-size: 13px; color: var(--text-2); display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--primary); }

/* ---------- 工具详情 ---------- */
.tool-detail { padding-top: 16px; }
.tool-detail-card {
  position: relative;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow-md);
}
.tool-detail-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}
.tool-detail-head { display: flex; gap: 16px; align-items: center; }
.tool-icon-lg {
  width: 64px;
  height: 64px;
  font-size: 34px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #dbe7ff;
}
.tool-detail-name { margin: 0 0 6px; font-size: 24px; }
.tool-detail-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; }
.meta-tag { font-size: 12px; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 2px 10px; }
.tool-detail-desc { margin: 16px 0 0; color: var(--text-2); }
.tool-detail-actions { margin-top: 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn-primary-lg {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 28px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}
.btn-primary-lg:hover { background: var(--primary-dark); color: #fff; }
.tool-detail-host { color: var(--text-2); font-size: 13px; }
.tool-detail-content { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.tool-detail-content h2 { font-size: 18px; margin: 0 0 8px; }
.tool-detail-content p { color: var(--text); font-size: 14px; margin: 0 0 8px; }

/* ---------- 站内工具表单/结果 ---------- */
.tool-form { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.tool-form .form-field { width: 100%; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.tool-input {
  width: 100%; max-width: 560px; height: 42px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0 14px; font-size: 14px; outline: none; background: #fff;
}
.tool-input:focus, .tool-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.tool-textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; font-size: 14px; outline: none; background: #fff; resize: vertical;
}
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-item { font-size: 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.result-box {
  margin-top: 20px; background: var(--primary-soft);
  border: 1px solid #dbe7ff; border-radius: var(--radius); padding: 16px 20px;
}
.result-center { display: flex; flex-direction: column; align-items: center; gap: 14px; }
/* 二维码操作行 + Base64 面板 */
.qr-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn-secondary-lg {
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 22px;
  border: 1px solid #bfdbfe; border-radius: 10px;
  background: #eff6ff; color: #2563eb;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-secondary-lg:hover { background: #dbeafe; border-color: #93c5fd; }
.btn-secondary-lg:disabled { opacity: .6; cursor: default; }
.b64-panel { width: 100%; }
.b64-text { width: 100%; font-family: Consolas, Menlo, monospace; font-size: 12px; color: var(--text-2); resize: vertical; }
.b64-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.b64-size { font-size: 12px; color: var(--text-2); }
.result-text { margin: 0; font-size: 16px; word-break: break-all; white-space: pre-wrap; }
.result-meta { margin: 0 0 8px; color: var(--text-2); font-size: 13px; }
.result-error {
  margin: 16px 0 0; color: #b91c1c; background: #fef2f2;
  border: 1px solid #fecaca; border-radius: 10px; padding: 10px 14px; font-size: 14px;
}
.kv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv-table th, .kv-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #dbe7ff; word-break: break-all; }
.kv-table tr:last-child th, .kv-table tr:last-child td { border-bottom: none; }
.kv-table th { width: 110px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
/* 可复制结果行：值 + 复制按钮 */
.kv-copy-cell { display: flex; align-items: center; gap: 10px; }
.kv-copy-value { color: #2563eb; text-decoration: none; flex: 1; min-width: 0; }
.kv-copy-value:hover { text-decoration: underline; }
.copy-btn {
  flex-shrink: 0;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.copy-btn:hover { background: #dbeafe; border-color: #93c5fd; }
.copy-btn.copied { background: #dcfce7; border-color: #86efac; color: #16a34a; }
.word-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.word-chip {
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 14px; font-size: 14px; color: var(--text);
}

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 24px 0; }
.pagination a, .pagination span {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
  font-size: 14px;
  color: var(--text);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 空提示 ---------- */
.empty-tip { text-align: center; color: var(--text-2); padding: 48px 0; }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  background: #fff;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  padding: 24px 0;
}
.site-footer p { margin: 4px 0; }
.copyright a { color: var(--text-2); }
.copyright a:hover { color: var(--primary); }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .header-inner { gap: 12px; }
  .main-nav { display: none; }
  /* 移动端隐藏导航后，搜索框占满剩余宽度 */
  .header-search { flex: 1; min-width: 0; }
  .header-search input { width: auto; flex: 1; min-width: 0; }
  .hero { padding: 32px 0 20px; }
  .hero h1 { font-size: 22px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .tool-card { padding: 12px; }
  .tool-card-desc { display: none; }
  .tool-grid-mini { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .tool-detail-card { padding: 18px 16px; }
}
