/* 在线工具箱 全站样式 */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --brand: #4f6ef7;
  --brand-2: #3d5ce0;
  --line: #e5e7eb;
  --ok: #16a34a;
  --bad: #dc2626;
  --mark-bg: #fde68a;
  --shadow: 0 1px 3px rgba(17, 24, 39, .07), 0 8px 24px rgba(17, 24, 39, .06);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141a;
    --card: #1c1f27;
    --text: #e6e8ee;
    --muted: #9aa1ad;
    --brand: #6d8bff;
    --brand-2: #587af0;
    --line: #2c303b;
    --mark-bg: #7c5d10;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: rgba(127, 127, 127, .14); border-radius: 4px; padding: 1px 6px; font-size: .9em; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 800; font-size: 19px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; color: var(--brand); }
.site-nav { display: flex; gap: 4px; overflow-x: auto; }
.site-nav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; white-space: nowrap; font-size: 15px; }
.site-nav a:hover { background: rgba(127, 127, 127, .12); text-decoration: none; }
.site-nav a.active { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); font-weight: 600; }

/* layout */
main.wrap { padding-top: 28px; padding-bottom: 60px; }
.crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
.lead { color: var(--muted); margin: 0 0 22px; }
.hero h1 { font-size: 32px; }
.hero { margin-bottom: 30px; }
.hero p { max-width: 720px; }
h2 { font-size: 20px; margin: 34px 0 14px; }

/* card */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.tool-card { margin-bottom: 8px; }

/* form */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
textarea, input[type="text"], input[type="number"], input[type="datetime-local"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  resize: vertical;
}
textarea { line-height: 1.6; }
textarea:focus, input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); border-color: transparent; }

/* buttons */
.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.btn-row.wrapable { row-gap: 8px; }
.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-outline:hover { background: rgba(127, 127, 127, .1); color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--brand); }
input[type="color"] { width: 72px; height: 72px; border: 1px solid var(--line); border-radius: 10px; background: none; cursor: pointer; padding: 4px; }

/* status / result */
.status { min-height: 1.4em; font-size: 14.5px; margin: 4px 0; }
.status.good { color: var(--ok); }
.status.bad { color: var(--bad); }
.result-box {
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14.5px;
  word-break: break-all;
  white-space: pre-wrap;
}
.dim { color: var(--muted); }

/* grid */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } .md-split { grid-template-columns: 1fr; } }

/* homepage tool grid */
.cat-section { margin-bottom: 8px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .tool-grid { grid-template-columns: 1fr; } }
.tool-card-link {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--text);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tool-card-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.tool-grid-sm .tool-card-link { padding: 12px 14px; }
.tc-name { font-weight: 700; font-size: 15.5px; }
.tc-desc { font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* usage & ad */
.usage { margin-top: 30px; }
.usage p { font-size: 15px; }
.ad-slot { margin-top: 34px; min-height: 0; border-radius: var(--radius); }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 22px 0 34px; color: var(--muted); font-size: 14px; text-align: center; }
.site-footer a { color: var(--muted); text-decoration: underline; }

/* timestamp */
.now-strip {
  display: flex; flex-wrap: wrap; gap: 10px 26px;
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 14.5px;
}

/* stats grid */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 720px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stat-item b { font-size: 22px; color: var(--brand); }
.stat-item span { font-size: 12.5px; color: var(--muted); }

/* image tool */
.drop-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 18px;
  transition: border-color .15s, background .15s;
}
.drop-zone.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.img-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 160px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 10px; overflow: hidden; background: var(--bg);
}
.img-preview img { max-width: 100%; max-height: 220px; object-fit: contain; }
.img-preview span { font-size: 12.5px; color: var(--muted); }

/* markdown */
.md-split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.md-body {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  min-height: 320px;
  max-height: 560px;
  overflow: auto;
  font-size: 15px;
}
.md-body h1, .md-body h2, .md-body h3 { margin: 1em 0 .4em; line-height: 1.35; }
.md-body h1 { font-size: 1.6em; border-bottom: 1px solid var(--line); padding-bottom: .3em; }
.md-body pre { background: rgba(127,127,127,.12); padding: 12px; border-radius: 8px; overflow: auto; }
.md-body code { font-size: .9em; }
.md-body blockquote { border-left: 4px solid var(--brand); margin: .8em 0; padding: 2px 14px; color: var(--muted); background: rgba(127,127,127,.06); border-radius: 0 6px 6px 0; }
.md-body table { border-collapse: collapse; margin: .8em 0; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: 6px 12px; }
.md-body th { background: rgba(127,127,127,.08); }
.md-body img { max-width: 100%; }

/* regex */
mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 2px; }
.match-item { border-left: 3px solid var(--brand); padding: 6px 12px; margin-bottom: 8px; background: var(--bg); border-radius: 0 8px 8px 0; font-size: 14.5px; }
.group-line { padding-left: 8px; }

/* cron */
.next-list { margin: 0; padding-left: 22px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14.5px; }

/* password */
.pw-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.pw-item {
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 15px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  cursor: pointer;
  word-break: break-all;
  transition: border-color .12s;
}
.pw-item:hover { border-color: var(--brand); }

/* qrcode */
.qr-side { display: flex; flex-direction: column; align-items: center; gap: 14px; justify-content: center; }
.qr-side canvas { border: 1px solid var(--line); border-radius: 8px; background: #fff; max-width: 100%; }

/* color */
.color-hero { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
.color-info { display: flex; gap: 10px; flex: 1; }
.swatch { flex: 1; height: 72px; border-radius: 10px; border: 1px solid var(--line); position: relative; }
.swatch::after { content: "当前颜色"; position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: rgba(255,255,255,.9); text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.swatch.complementary::after { content: "互补色"; }
.rgb-row input[type="number"] { flex: 1; min-width: 0; }
