/* ============================================================
   快工具 QuickTool - 主样式
   ============================================================ */

:root {
  --brand: #2563eb;
  --brand-2: #7c3aed;
  --brand-soft: #eff4ff;
  --bg: #f6f8fc;
  --bg-soft: #eef2f9;
  --card: #ffffff;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --border: #e5e9f2;
  --border-strong: #d3dae8;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .04), 0 1px 3px rgba(17, 24, 39, .06);
  --shadow: 0 4px 16px rgba(17, 24, 39, .06);
  --shadow-lg: 0 18px 40px -12px rgba(17, 24, 39, .16);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

html[data-theme="dark"] {
  --brand: #5b8cff;
  --brand-2: #a78bfa;
  --brand-soft: #1b2440;
  --bg: #0d1117;
  --bg-soft: #151b26;
  --card: #161d29;
  --text: #e8eefb;
  --text-2: #c3cddf;
  --muted: #8b97ab;
  --border: #232c3c;
  --border-strong: #2f3a4d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 4px 18px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 44px -14px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
code, kbd, pre, samp { font-family: var(--mono); }
kbd {
  display: inline-block; padding: 1px 6px; font-size: 12px; line-height: 1.6;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; background: var(--bg-soft); color: var(--muted);
}
::selection { background: var(--brand); color: #fff; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }

/* ── 顶部 ───────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-bar { display: flex; align-items: center; gap: 18px; height: 62px; }

.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 800; flex: none; }
.brand-mark {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 10px; font-size: 17px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--brand) 60%, transparent);
}
.brand-name { font-size: 17px; letter-spacing: -.02em; }

.header-search {
  position: relative; flex: 1 1 auto; max-width: 520px; display: flex; align-items: center;
}
.header-search .search-icon {
  position: absolute; left: 12px; width: 17px; height: 17px;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
}
.header-search input {
  width: 100%; height: 40px; padding: 0 46px 0 36px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); font-size: 14px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.header-search input:focus {
  outline: none; border-color: var(--brand); background: var(--card);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}
.header-search input::-webkit-search-cancel-button { display: none; }
.search-kbd { position: absolute; right: 10px; pointer-events: none; }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.nav-link { color: var(--text-2); font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.nav-link:hover { background: var(--bg-soft); color: var(--brand); }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 9px; background: none; cursor: pointer;
  color: var(--text-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--brand); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.i-moon { display: none; }
html[data-theme="dark"] .i-sun { display: none; }
html[data-theme="dark"] .i-moon { display: block; }
.menu-btn { display: none; }

.cat-strip { border-top: 1px solid var(--border); background: var(--card); }
.cat-strip-inner {
  display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 8px 20px;
  scrollbar-width: none;
}
.cat-strip-inner::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 999px; font-size: 13.5px; color: var(--text-2);
  border: 1px solid transparent; white-space: nowrap; transition: all .15s;
}
.cat-chip:hover { background: var(--bg-soft); color: var(--brand); }
.cat-chip.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.cat-chip-icon { font-size: 13px; }

.mobile-menu {
  display: none; flex-direction: column; padding: 8px 20px 16px;
  border-top: 1px solid var(--border); background: var(--card);
  max-height: 70vh; overflow: auto;
}
.mobile-menu a { padding: 10px 4px; color: var(--text-2); border-bottom: 1px solid var(--border); font-size: 15px; }
.mobile-menu a:last-child { border-bottom: 0; }

/* ── 通用区块 ───────────────────────────────────────── */
.site-main { padding: 26px 0 60px; min-height: 60vh; }

.hero { text-align: center; padding: 26px 0 34px; }
.hero-title { font-size: 32px; margin-bottom: 10px; letter-spacing: -.03em; }
.hero-sub { color: var(--muted); font-size: 15px; max-width: 640px; margin: 0 auto 22px; }
.hero-search { position: relative; max-width: 620px; margin: 0 auto; }
.hero-search .search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 19px; height: 19px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
}
.hero-search input {
  width: 100%; height: 52px; padding: 0 18px 0 46px; font-size: 15px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--card); color: var(--text); box-shadow: var(--shadow-sm);
}
.hero-search input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 13%, transparent);
}
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--card);
  color: var(--text-2); font-size: 13px; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.hero-results {
  max-width: 620px; margin: 10px auto 0; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  overflow: hidden; text-align: left;
}
.hero-results a { display: flex; gap: 10px; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.hero-results a:last-child { border-bottom: 0; }
.hero-results a:hover { background: var(--brand-soft); }
.hero-results .r-icon { flex: none; width: 22px; text-align: center; }
.hero-results .r-name { font-weight: 600; font-size: 14px; }
.hero-results .r-desc { color: var(--muted); font-size: 12.5px; }
.hero-results .r-empty { padding: 16px; color: var(--muted); text-align: center; font-size: 14px; }

.section { margin-bottom: 38px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 19px; margin: 0; display: flex; align-items: center; gap: 8px; }
.section-icon { font-size: 18px; }
.section-hint { color: var(--muted); font-size: 13px; }
.section-more { margin-left: auto; font-size: 13.5px; color: var(--muted); }
.section-more:hover { color: var(--brand); }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 12px; }
.tool-card {
  display: flex; gap: 12px; padding: 14px 15px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); transition: transform .16s, box-shadow .16s, border-color .16s;
}
.tool-card:hover {
  transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  box-shadow: var(--shadow);
}
.tool-icon {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 11px; background: var(--brand-soft); font-size: 18px; font-weight: 700;
  color: var(--brand);
}
.tool-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tool-name { font-weight: 650; font-size: 14.5px; }
.tool-desc { color: var(--muted); font-size: 12.8px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tool-cat { color: var(--brand); font-size: 11.5px; margin-top: 3px; }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 16px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .current { color: var(--text-2); }

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 26px; display: flex; align-items: center; gap: 9px; }
.page-head-icon { font-size: 24px; }
.page-head-desc { color: var(--muted); font-size: 14px; margin: 0; }

.empty-state {
  padding: 46px 20px; text-align: center; color: var(--muted);
  background: var(--card); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty-state p { margin: 0 0 6px; }

.info-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.info-card h3 { font-size: 17px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-top: 14px; }
.feature { background: var(--bg-soft); border-radius: var(--radius-sm); padding: 14px; }
.feature strong { display: block; font-size: 14px; margin-bottom: 4px; }
.feature p { margin: 0; color: var(--muted); font-size: 13px; }
.info-html { margin-top: 16px; color: var(--text-2); font-size: 14px; }

/* ── 工具页 ─────────────────────────────────────────── */
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.tool-head { margin-bottom: 18px; }
.tool-head h1 { font-size: 25px; display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tool-head-icon { font-size: 24px; }
.tool-head-desc { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.tool-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; font-size: 12px;
  border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 500;
}
.badge-ghost { background: var(--bg-soft); color: var(--muted); }

.tool-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-sm); min-height: 120px;
}
.tool-loading { color: var(--muted); font-size: 14px; padding: 20px 0; text-align: center; }

.tool-help { margin-top: 26px; }
.tool-help h2 { font-size: 16px; }
.tool-help ul { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13.5px; }
.tool-help li { margin-bottom: 6px; }

.tool-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 128px; }
.side-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.side-card h3 { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.side-list { display: flex; flex-direction: column; gap: 2px; }
.side-list a { display: flex; gap: 9px; padding: 7px 8px; border-radius: 8px; color: var(--text); }
.side-list a:hover { background: var(--bg-soft); }
.side-icon { flex: none; font-size: 15px; width: 20px; text-align: center; }
.side-list strong { display: block; font-size: 13.5px; font-weight: 600; }
.side-list em { display: block; font-style: normal; color: var(--muted); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-tip p { font-size: 13px; color: var(--muted); margin: 0; }

/* ── 表单控件 ───────────────────────────────────────── */
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; font-size: 14px; font-family: inherit;
  color: var(--text); background: var(--bg-soft);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--brand); background: var(--card);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent);
}
textarea.input { min-height: 150px; resize: vertical; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; }
.input-sm { padding: 6px 10px; font-size: 13px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; font-size: 14px; font-family: inherit; font-weight: 500;
  color: var(--text-2); background: var(--card); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, var(--brand-2)));
  border-color: transparent; color: #fff; box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--brand) 65%, transparent);
}
.btn-primary:hover { color: #fff; filter: brightness(1.06); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── 工具通用 UI ────────────────────────────────────── */
.tui { display: flex; flex-direction: column; gap: 14px; }
.tui-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.tui-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.tui-row > .grow { flex: 1 1 200px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.field-hint { font-size: 12px; color: var(--muted); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-soft); border-radius: 10px; flex-wrap: wrap; }
.seg button {
  border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-family: inherit; color: var(--muted); transition: all .15s;
}
.seg button.is-active { background: var(--card); color: var(--brand); font-weight: 600; box-shadow: var(--shadow-sm); }
.out {
  margin: 0; padding: 14px; font-size: 13px; line-height: 1.65;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  white-space: pre-wrap; word-break: break-all; max-height: 420px; overflow: auto; color: var(--text);
}
.out:empty { display: none; }
.out-scroll-sm { max-height: 220px; }
.result-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap;
}
.result-head .result-title { font-size: 13px; font-weight: 600; color: var(--muted); }
.result-head .spacer { margin-left: auto; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px;
}
.stat-label { font-size: 12px; color: var(--muted); display: block; }
.stat-value { font-size: 18px; font-weight: 700; letter-spacing: -.02em; word-break: break-all; }
.stat-value.sm { font-size: 14px; font-weight: 600; }
.kv { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.kv-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 9px 12px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.kv-row:last-child { border-bottom: 0; }
.kv-row:nth-child(odd) { background: color-mix(in srgb, var(--bg-soft) 60%, transparent); }
.kv-key { color: var(--muted); font-size: 13px; }
.kv-val { word-break: break-all; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: var(--bg-soft); color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table .mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px;
  background: var(--bg-soft); color: var(--muted); font-weight: 500;
}
.tag-green { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.tag-blue { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.tag-amber { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tag-red { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.ok-text { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
.danger-text { color: var(--danger); font-weight: 600; }
.note { font-size: 12.5px; color: var(--muted); }
.err-box {
  padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13.5px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}
.warn-box {
  padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13.5px;
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  color: var(--warn);
}
.spin {
  width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.canvas-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--bg-soft); text-align: center; }
.canvas-box canvas, .canvas-box svg, .canvas-box img { max-width: 100%; height: auto; }

/* ── DNS 页 ─────────────────────────────────────────── */
.hero-dns { padding-bottom: 24px; }
.ip-status { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; font-size: 13px; }
.ip-item {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px; color: var(--muted);
}
.ip-item b { color: var(--text); font-family: var(--mono); font-size: 12.5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.off { background: var(--border-strong); }

.dns-tester {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.dns-tester-head h2 { font-size: 17px; }
.dns-tester-head p { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.dns-tester-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) 130px auto; gap: 10px; }
.dns-test-result { margin-top: 14px; }

.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-bar .input-sm { width: 220px; margin-left: auto; }

.dns-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.dns-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; transition: box-shadow .16s, border-color .16s;
}
.dns-card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.dns-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.dns-card-head h3 { font-size: 15px; margin: 0; }
.dns-card-head .tag { margin-left: auto; }
.dns-rows { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.dns-row { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 8px; align-items: start; }
.dns-row dt { font-size: 11.5px; color: var(--muted); font-weight: 600; padding-top: 4px; letter-spacing: .02em; }
.dns-row dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.copy-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 7px;
  cursor: pointer; transition: all .14s; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.copy-chip:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.copy-chip::after { content: "复制"; font-family: var(--sans); font-size: 10.5px; color: var(--muted); }
.copy-chip:hover::after { color: var(--brand); }
.copy-chip-wide { width: 100%; justify-content: space-between; }
.dns-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

/* ── 页脚 ───────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); background: var(--card); padding: 30px 0 20px; margin-top: 20px; }
.footer-inner { display: flex; gap: 40px; justify-content: space-between; flex-wrap: wrap; }
.footer-brand { max-width: 340px; }
.footer-desc { color: var(--muted); font-size: 13.5px; margin: 10px 0 6px; }
.footer-meta { color: var(--muted); font-size: 12.5px; margin: 0; }
.footer-links { display: flex; gap: 60px; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 7px; }
.footer-col h4 { font-size: 13px; color: var(--text); margin: 0 0 4px; }
.footer-col a { color: var(--muted); font-size: 13px; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom {
  display: flex; gap: 14px; justify-content: space-between; flex-wrap: wrap;
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 12.5px;
}
.footer-bottom a { color: var(--muted); }

/* ── 杂项 ───────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px;
  background: var(--text); color: var(--bg); opacity: 0; pointer-events: none;
  transition: all .22s; z-index: 999; box-shadow: var(--shadow-lg); max-width: 86vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.search-page-form { display: flex; gap: 10px; max-width: 620px; margin-bottom: 22px; }

.page-article {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px; max-width: 860px; color: var(--text-2);
}
.page-article h1 { font-size: 24px; color: var(--text); }
.page-article h2 { font-size: 18px; margin-top: 1.4em; color: var(--text); }
.page-article p { font-size: 14.5px; }

.page-error { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.error-wrap { text-align: center; max-width: 460px; }
.error-code {
  font-size: 76px; font-weight: 800; line-height: 1; letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 10px;
}
.error-wrap h1 { font-size: 20px; }
.error-wrap p { color: var(--muted); font-size: 14px; }
.error-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* ============================================================
   工具专用组件
   ============================================================ */

/* ── 文本对比 ── */
.diff-box {
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-family: var(--mono);
  font-size: 12.8px;
  line-height: 1.7;
}

.diff-line {
  padding: 1px 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-2);
  border-left: 3px solid transparent;
}

.diff-line.diff-add { background: rgba(5, 150, 105, .1); border-left-color: var(--ok); color: #065f46; }
.diff-line.diff-del { background: rgba(220, 38, 38, .09); border-left-color: var(--danger); color: #991b1b; }
.diff-line.diff-chg { background: rgba(217, 119, 6, .1); border-left-color: var(--warn); color: #92400e; }

html[data-theme="dark"] .diff-line.diff-add { color: #6ee7b7; }
html[data-theme="dark"] .diff-line.diff-del { color: #fca5a5; }
html[data-theme="dark"] .diff-line.diff-chg { color: #fbbf24; }

/* ── 世界时钟 ── */
.clock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.clock-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.clock-city { font-size: 12.5px; color: var(--muted); }
.clock-time {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
}
.clock-date { font-size: 11.5px; color: var(--muted); }

/* ── 色板 ── */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}

.palette-item {
  position: relative;
  height: 68px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  font-family: var(--mono);
  font-size: 11.5px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55);
  transition: transform .14s, box-shadow .14s;
}

.palette-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ── 名称 / 字符卡片 ── */
.name-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color .14s, background .14s, transform .14s;
}

.name-chip:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }

/* ── 数独 ── */
.sudoku {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: min(100%, 396px);
  margin: 0 auto;
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}

.sudoku-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--brand);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.sudoku-cell.given { color: var(--text); background: var(--bg-soft); }
.sudoku-cell:nth-child(9n) { border-right: 0; }
.sudoku-cell:nth-child(9n+3),
.sudoku-cell:nth-child(9n+6) { border-right: 2px solid var(--border-strong); }
.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--border-strong); }
.sudoku-cell:nth-child(n+73) { border-bottom: 0; }

/* ── 游戏通用 ── */
.game-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.game-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 12.5px;
  color: var(--muted);
}

.game-stat b { font-size: 15px; color: var(--text); font-family: var(--mono); }

.game-canvas {
  width: 100%;
  max-width: 400px;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  touch-action: none;
  display: block;
  margin: 0 auto;
}

/* ── 2048 ── */
.game2048 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(100%, 380px);
  margin: 0 auto;
  padding: 8px;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  touch-action: none;
}

.tile {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 22px;
  color: #4b5563;
  background: color-mix(in srgb, var(--card) 70%, var(--bg-soft));
  transition: background .12s, color .12s;
}

.tile-0 { background: color-mix(in srgb, var(--card) 55%, var(--bg-soft)); }
.tile-2 { background: #eee4da; color: #6b5b4f; }
.tile-4 { background: #ede0c8; color: #6b5b4f; }
.tile-8 { background: #f2b179; color: #fff; }
.tile-16 { background: #f59563; color: #fff; }
.tile-32 { background: #f67c5f; color: #fff; }
.tile-64 { background: #f65e3b; color: #fff; }
.tile-128 { background: #edcf72; color: #fff; font-size: 19px; }
.tile-256 { background: #edcc61; color: #fff; font-size: 19px; }
.tile-512 { background: #edc850; color: #fff; font-size: 19px; }
.tile-1024 { background: #edc53f; color: #fff; font-size: 16px; }
.tile-2048 { background: #edc22e; color: #fff; font-size: 16px; }
.tile-super { background: linear-gradient(135deg, #7c3aed, #2563eb); color: #fff; font-size: 15px; }

html[data-theme="dark"] .tile { color: #e8eefb; }
html[data-theme="dark"] .tile-2 { color: #6b5b4f; }
html[data-theme="dark"] .tile-4 { color: #6b5b4f; }

/* ── 扫雷 ── */
.mine-board {
  display: grid;
  gap: 3px;
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 8px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.mine-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: color-mix(in srgb, var(--card) 80%, var(--bg-soft));
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background .1s;
}

.mine-cell:hover { background: var(--brand-soft); }
.mine-cell.open { background: var(--bg); cursor: default; border-color: var(--border); }
.mine-cell.mine { background: rgba(220, 38, 38, .14); }
.mine-cell.n1 { color: #2563eb; }
.mine-cell.n2 { color: #059669; }
.mine-cell.n3 { color: #dc2626; }
.mine-cell.n4 { color: #7c3aed; }
.mine-cell.n5 { color: #b45309; }
.mine-cell.n6 { color: #0891b2; }
.mine-cell.n7 { color: #4b5563; }
.mine-cell.n8 { color: var(--muted); }

/* ── 响应式 ─────────────────────────────────────────── */
@media (max-width: 1080px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr); }
  .tool-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .tool-side .side-card { flex: 1 1 260px; }
}

@media (max-width: 860px) {
  .dns-tester-form { grid-template-columns: 1fr 1fr; }
  .dns-tester-form .btn { grid-column: span 2; }
  .footer-links { gap: 36px; }
}

@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .container { padding: 0 14px; }
  .header-bar { height: auto; padding: 10px 0; flex-wrap: wrap; gap: 10px; }
  .header-search { order: 3; flex: 1 1 100%; max-width: none; }
  .header-search .search-kbd { display: none; }
  .nav-link { display: none; }
  .menu-btn { display: grid; }
  .mobile-menu:not([hidden]) { display: flex; }
  .cat-strip-inner { padding: 8px 14px; }
  .hero { padding: 16px 0 24px; }
  .hero-title { font-size: 23px; }
  .hero-sub { font-size: 13.5px; margin-bottom: 16px; }
  .hero-search input { height: 46px; font-size: 14px; }
  .section { margin-bottom: 28px; }
  .section-head h2 { font-size: 16.5px; }
  .tool-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .tool-card { padding: 11px; gap: 9px; flex-direction: column; }
  .tool-icon { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }
  .tool-name { font-size: 13.5px; }
  .tool-desc { font-size: 11.5px; -webkit-line-clamp: 2; }
  .tool-panel { padding: 14px; border-radius: var(--radius); }
  .tool-head h1 { font-size: 20px; }
  .page-head h1 { font-size: 21px; }
  .dns-list { grid-template-columns: 1fr; }
  .dns-tester-form { grid-template-columns: 1fr; }
  .dns-tester-form .btn { grid-column: auto; }
  .filter-bar .input-sm { width: 100%; margin-left: 0; }
  .footer-inner { flex-direction: column; gap: 22px; }
  .footer-links { gap: 30px; }
  .kv-row { grid-template-columns: 96px minmax(0, 1fr); }
  .page-article { padding: 20px; }
  .tool-help ul { padding-left: 18px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .out { font-size: 12.5px; max-height: 320px; }
}

@media (max-width: 380px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── 工具组件：小屏适配 ─────────────────────────────── */
@media (max-width: 520px) {
  .clock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clock-time { font-size: 18px; }
  .palette-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .palette-item { height: 56px; font-size: 10.5px; }
  .sudoku-cell { font-size: 14px; }
  .tile { font-size: 18px; border-radius: 8px; }
  .tile-128, .tile-256, .tile-512 { font-size: 15px; }
  .tile-1024, .tile-2048, .tile-super { font-size: 13px; }
  .game2048 { gap: 6px; padding: 6px; }
  .mine-cell { font-size: 11px; }
  .game-stat { font-size: 11.5px; padding: 4px 9px; }
}
