/* =========================================================
   极简工具箱 · 全站共享样式
   ========================================================= */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1f2430;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

[data-theme="dark"] {
  --bg: #0f1117;
  --surface: #181b23;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --border: #2a2f3a;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-light: rgba(99, 102, 241, .15);
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 顶部导航 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.logo:hover { text-decoration: none; }

.logo-icon {
  width: 27px;
  height: 27px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.nav-links {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--primary); }

/* ---------------- 布局 ---------------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.hero { text-align: center; padding: 32px 0 24px; }
.hero h1 { font-size: 30px; letter-spacing: 1px; }
.hero p { color: var(--text-muted); margin-top: 10px; font-size: 15px; }

.page-title { font-size: 24px; margin-bottom: 8px; }
.page-desc { color: var(--text-muted); margin-bottom: 20px; font-size: 14px; }

.tool-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.tool-layout aside { position: sticky; top: 72px; }
.tool-layout aside .panel { margin-bottom: 16px; }

@media (max-width: 860px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-layout aside { position: static; }
}

/* ---------------- 面板与卡片 ---------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

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

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
  display: block;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
  text-decoration: none;
}
.tool-card .icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  margin-bottom: 12px;
}
.tool-card h3 { font-size: 16px; margin-bottom: 6px; }
.tool-card p { font-size: 13px; color: var(--text-muted); }

/* ---------------- 表单元素 ---------------- */
.field { margin-bottom: 16px; }

label {
  font-size: 13px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

textarea,
input[type="text"],
input[type="number"],
input[type="datetime-local"],
select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}

textarea {
  font-family: Consolas, Monaco, "Courier New", monospace;
  resize: vertical;
  min-height: 140px;
  line-height: 1.5;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

input[type="range"] { width: 100%; accent-color: var(--primary); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.checkbox-row input { width: auto; accent-color: var(--primary); }

.radio-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
  margin-right: 16px;
}
.radio-row input { width: auto; accent-color: var(--primary); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
}
.btn:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--surface);
}

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }

/* ---------------- 结果与提示 ---------------- */
.result-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  word-break: break-all;
  min-height: 44px;
  white-space: pre-wrap;
}

.msg { font-size: 13px; margin-top: 8px; }
.msg.error { color: var(--danger); }
.msg.success { color: var(--success); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.stat-card .num { font-size: 22px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 12px; color: var(--text-muted); }

.color-preview {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

/* ---------------- 广告位 ---------------- */
.ad-slot {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  margin: 20px 0;
  overflow: hidden;
}

/* ---------------- 相关工具 & SEO 文本 ---------------- */
.related h2 { font-size: 16px; margin-bottom: 12px; }
.related-list { display: flex; flex-wrap: wrap; gap: 10px; }
.related-list a {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
}
.related-list a:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.seo-text h2 { font-size: 18px; margin-bottom: 10px; }
.seo-text p { color: var(--text-muted); font-size: 14px; margin-bottom: 10px; }

.faq h3 { font-size: 15px; margin: 14px 0 4px; }
.faq p { color: var(--text-muted); font-size: 14px; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--surface);
  margin-top: 40px;
}
.footer-brand { font-weight: 600; margin-bottom: 6px; color: var(--text); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #111827;
  color: #fff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  transition: all .2s;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
