/* ===== DevKit 样式 · 双主题 ===== */

:root[data-theme="dark"] {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --bg-card: #171d26;
  --border: #262d3a;
  --border-hover: #3a4557;
  --text: #e6edf3;
  --text-dim: #8b97a8;
  --text-faint: #5d6878;
  --accent: #4f8cff;
  --accent-dim: #2d5bb8;
  --accent-glow: rgba(79, 140, 255, .14);
  --ok: #3fb950;
  --err: #f85149;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --bg-card: #ffffff;
  --border: #d8dee4;
  --border-hover: #b9c2cc;
  --text: #1f2328;
  --text-dim: #59636e;
  --text-faint: #8c959f;
  --accent: #0969da;
  --accent-dim: #0a58ca;
  --accent-glow: rgba(9, 105, 218, .10);
  --ok: #1a7f37;
  --err: #cf222e;
  --shadow: 0 4px 16px rgba(31, 35, 40, .08);
}

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

html { scroll-behavior: smooth; }

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

.wrap { width: min(1140px, 92vw); margin: 0 auto; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--text);
  font-weight: 700; font-size: 18px; letter-spacing: .3px;
}
.brand-mark {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px; font-weight: 700; color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 7px;
  padding: 1px 6px; line-height: 1.5;
}
.nav { display: flex; align-items: center; gap: 22px; }
.nav a {
  color: var(--text-dim); text-decoration: none;
  font-size: 14.5px; transition: color .2s;
}
.nav a:hover { color: var(--accent); }
.theme-toggle {
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text); width: 34px; height: 34px; border-radius: 8px;
  cursor: pointer; font-size: 15px; line-height: 1;
  display: grid; place-items: center; transition: all .2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Hero ===== */
.hero {
  padding: 76px 0 60px;
  text-align: center;
  background:
    radial-gradient(900px 340px at 50% -10%, var(--accent-glow), transparent 70%);
}
.hero h1 {
  font-size: clamp(30px, 5.2vw, 50px);
  letter-spacing: -.5px; margin-bottom: 18px; line-height: 1.25;
}
.hero h1 b {
  background: linear-gradient(100deg, var(--accent), #a371f7);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  color: var(--text-dim); font-size: 16.5px; max-width: 620px;
  margin: 0 auto 26px;
}
.hero-sub strong { color: var(--text); }
.hero-badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.badge {
  font-size: 13px; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 15px; background: var(--bg-soft);
}

/* ===== Section ===== */
.section-title {
  font-size: 22px; margin-bottom: 22px; padding-left: 12px;
  border-left: 3.5px solid var(--accent); line-height: 1.3;
}
.tools, .about { padding: 22px 0 68px; }

/* ===== Tool cards ===== */
.tool-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}
.tool-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 13px; overflow: hidden;
  transition: border-color .22s, box-shadow .22s, transform .22s;
}
.tool-card:hover { border-color: var(--border-hover); }
.tool-card.open {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), var(--shadow);
}
.tool-head {
  display: flex; align-items: center; gap: 13px;
  padding: 17px 19px; cursor: pointer; user-select: none;
}
.tool-icon {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
  background: var(--accent-glow); color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.tool-head h3 { font-size: 15.5px; line-height: 1.35; }
.tool-head p { font-size: 13px; color: var(--text-dim); line-height: 1.4; }
.tool-head > div { flex: 1; min-width: 0; }
.chev {
  color: var(--text-faint); font-size: 21px; line-height: 1;
  transition: transform .25s, color .2s;
}
.tool-card.open .chev { transform: rotate(90deg); color: var(--accent); }

.tool-body {
  display: none; padding: 0 19px 19px;
  border-top: 1px solid var(--border);
  padding-top: 17px;
}
.tool-card.open .tool-body { display: block; }

/* ===== Form controls ===== */
.io {
  width: 100%; background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 11px 13px; font-size: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit; resize: vertical;
}
.io:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea.io {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.65;
}
.io.short { width: 110px; }
.io.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }

.field-row { margin-bottom: 11px; }
.field-row label {
  display: block; font-size: 12.5px; color: var(--text-dim);
  margin-bottom: 5px;
}
.color-row { display: flex; gap: 10px; margin-bottom: 12px; }
#colorPicker {
  width: 46px; height: 42px; padding: 2px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 9px;
}

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.btn {
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 15px; font-size: 13.5px; cursor: pointer;
  transition: all .18s; font-family: inherit;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn.primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.btn.ghost { background: transparent; }
.btn:active { transform: translateY(1px); }

.result {
  font-size: 13px; border-radius: 8px; margin-top: 4px;
  padding: 0; word-break: break-all; display: none;
}
.result.show { display: block; padding: 10px 13px; }
.result.ok {
  background: color-mix(in srgb, var(--ok) 13%, transparent);
  color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 32%, transparent);
}
.result.err {
  background: color-mix(in srgb, var(--err) 13%, transparent);
  color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 32%, transparent);
}

/* ===== About ===== */
.about-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 13px; padding: 28px 30px;
}
.about-card p { color: var(--text-dim); margin-bottom: 14px; font-size: 15px; }
.about-card strong { color: var(--text); }
.feature-list {
  list-style: none; display: grid; gap: 9px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin-top: 18px;
}
.feature-list li { font-size: 14px; color: var(--text-dim); padding-left: 20px; position: relative; }
.feature-list li::before {
  content: "✓"; position: absolute; left: 0;
  color: var(--accent); font-weight: 700;
}

/* ===== Footer · 备案信息 ===== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 26px 0;
}
.footer-inner { text-align: center; }
.footer-line { font-size: 13.5px; margin: 4px 0; }
.beian-label { color: var(--text-faint); }
/* ICP 备案号须以可点击链接形式指向工信部备案系统 */
.beian-link {
  color: var(--text-dim); text-decoration: none;
  transition: color .2s; font-weight: 500;
}
.beian-link:hover { color: var(--accent); text-decoration: underline; }
.copyright { color: var(--text-faint); font-size: 13px; }

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .hero { padding: 52px 0 40px; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-head { padding: 15px 16px; }
  .tool-body { padding: 15px 16px 17px; }
  .about-card { padding: 20px 18px; }
  .nav { gap: 15px; }
}

/* ==========================================================================
 * DevKit v2 · 工具注册表架构新增样式（搜索 / 分类 / 字段 / 富结果）
 * ========================================================================== */

/* ===== 工具栏：搜索 + 分类 ===== */
.toolbar { margin-bottom: 20px; }
.search {
  width: 100%; margin-bottom: 14px; padding: 12px 15px;
  font-size: 14.5px; border-radius: 10px;
}
.search::placeholder { color: var(--text-faint); }

.cat-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-bottom: 4px;
}
.cat-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-soft); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-size: 13.5px; cursor: pointer;
  font-family: inherit; transition: all .18s;
}
.cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.cat-btn.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.cat-btn i {
  font-style: normal; font-size: 11.5px; opacity: .75;
  background: color-mix(in srgb, currentColor 16%, transparent);
  border-radius: 999px; padding: 0 6px; line-height: 1.6;
}

/* ===== 字段 ===== */
.fld { margin-bottom: 11px; }
.fld > label {
  display: block; font-size: 12.5px; color: var(--text-dim);
  margin-bottom: 5px;
}
.fld select.io { cursor: pointer; }
.chkline {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--text-dim); cursor: pointer;
}
.chkline input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.colorpick {
  width: 100%; height: 40px; padding: 3px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 9px;
}
.rngrow { display: flex; align-items: center; gap: 12px; }
.rngrow input[type="range"] { flex: 1; accent-color: var(--accent); cursor: pointer; }
.rngval {
  min-width: 46px; text-align: right; font-size: 13px; color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ===== 输出 ===== */
.out {
  margin: 4px 0 10px; background: var(--bg-soft);
  font-size: 13px; line-height: 1.65;
}
.rich {
  margin: 4px 0 10px; font-size: 13.5px; line-height: 1.6;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 9px; padding: 13px 15px; word-break: break-all;
}
.rich table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rich th, .rich td {
  border: 1px solid var(--border); padding: 6px 9px; text-align: left;
  vertical-align: top; word-break: break-all;
}
.rich th { background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 600; }
.rich code, .rich .mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px;
}
.rich .kv { display: flex; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.rich .kv:last-child { border-bottom: 0; }
.rich .kv b { flex-shrink: 0; min-width: 92px; color: var(--text-dim); font-weight: 500; }
.rich .swatch {
  display: inline-block; width: 100%; height: 56px; border-radius: 8px;
  border: 1px solid var(--border); margin-bottom: 10px;
}
.rich .palette { display: flex; gap: 0; border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.rich .palette span { flex: 1; height: 48px; }
.rich img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.rich pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 13px; overflow-x: auto; font-size: 12.5px; line-height: 1.6;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.empty {
  text-align: center; color: var(--text-faint);
  padding: 40px 0; font-size: 14.5px;
}

@media (max-width: 640px) {
  .cat-bar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
  .cat-btn { flex-shrink: 0; }
}
