/* ==========================================================================
   卓哥的工具箱 — 样式表
   零外部依赖，纯本地资源
   与 azxcvb.cn 共用同一套设计令牌
   ========================================================================== */

:root {
  --bg:            #f6f7f9;
  --bg-soft:       #eef0f4;
  --surface:       #ffffff;
  --surface-2:     #fafbfc;
  --surface-3:     #f2f4f7;
  --text:          #1b1f27;
  --text-2:        #4a5261;
  --text-3:        #8b93a3;
  --border:        #e4e7ec;
  --border-2:      #d5dae2;

  --accent:        #3b6ef5;
  --accent-2:      #6d8cff;
  --accent-soft:   rgba(59, 110, 245, .10);
  --accent-text:   #2b55cc;

  --purple:        #8b5cf6;
  --teal:          #0d9488;
  --amber:         #d97706;
  --rose:          #e11d48;
  --green:         #16a34a;

  --code-bg:       #f6f8fa;
  --code-border:   #e6e9ef;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow:    0 4px 16px rgba(16, 24, 40, .07);
  --shadow-lg: 0 18px 44px rgba(16, 24, 40, .13);

  --radius:    12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --container: 1180px;
  --nav-h: 62px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
          "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", "Courier New", monospace;
}

html[data-theme="dark"] {
  --bg:            #0e1116;
  --bg-soft:       #14181f;
  --surface:       #161b23;
  --surface-2:     #1b212b;
  --surface-3:     #212836;
  --text:          #e6e9ef;
  --text-2:        #b3bbc9;
  --text-3:        #7d8695;
  --border:        #242c38;
  --border-2:      #313b4a;

  --accent:        #6d8cff;
  --accent-2:      #8ba4ff;
  --accent-soft:   rgba(109, 140, 255, .14);
  --accent-text:   #9db4ff;

  --purple:        #a78bfa;
  --teal:          #2dd4bf;
  --amber:         #fbbf24;
  --rose:          #fb7185;
  --green:         #4ade80;

  --code-bg:       #11161e;
  --code-border:   #232c38;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow:    0 4px 16px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .5);
}

/* ---------- 2. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
body.ws-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* 顶部导航 */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .2s ease, background .25s ease;
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.nav-inner {
  height: 100%;
  display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--purple) 60%, var(--teal));
  color: #fff; font-size: 16px; font-weight: 800;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: 11px; font-weight: 500; color: var(--text-3); letter-spacing: .04em; }

.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-links a {
  padding: 7px 12px; border-radius: 8px; font-size: 14px;
  color: var(--text-2); transition: background .15s ease, color .15s ease;
}
.nav-links a:hover { background: var(--surface-3); color: var(--text); }
.nav-links a.active { color: var(--accent-text); background: var(--accent-soft); }

.nav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; transition: all .18s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-2); }
.icon-btn svg { width: 17px; height: 17px; }
.nav-toggle { display: none; }

/* ---------- 3. Hero ---------- */
.hero { padding: 64px 0 40px; }
.hero-grid {
  display: grid; grid-template-columns: 1.15fr .85fr;
  gap: 48px; align-items: center;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 13px; border-radius: var(--radius-full);
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 12.5px; font-weight: 600; margin-bottom: 20px;
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.18; letter-spacing: -.02em; font-weight: 800;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent), var(--purple) 55%, var(--teal));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-desc {
  margin: 0 0 28px; font-size: 16px; line-height: 1.85; color: var(--text-2);
  max-width: 560px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: all .2s ease; font-family: inherit;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 38%, transparent); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-text); transform: translateY(-2px); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }

.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  padding-top: 24px; border-top: 1px solid var(--border);
}
.hero-stat b { display: block; font-size: 25px; font-weight: 800; letter-spacing: -.02em; }
.hero-stat span { font-size: 12.5px; color: var(--text-3); }

/* Hero 视觉 */
.hero-visual { position: relative; }
.hero-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero-card-body { padding: 20px 22px 22px; }
.hero-card-tag {
  display: inline-block; padding: 3px 10px; border-radius: var(--radius-full);
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 12px; font-weight: 600; margin-bottom: 11px;
}
.hero-card-body h3 { font-size: 17px; margin: 0 0 8px; line-height: 1.4; }
.hero-card-body p { font-size: 13.5px; color: var(--text-3); margin: 0; line-height: 1.7; }
.float-chip {
  position: absolute; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius-full);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 12.5px; font-weight: 600;
  animation: float 5s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.float-chip .ic { font-size: 14px; }
.float-chip.c1 { top: -16px; left: -18px; animation-delay: 0s; }
.float-chip.c2 { bottom: 22px; right: -18px; animation-delay: 1.6s; }
.float-chip.c3 { bottom: -16px; left: 16px; animation-delay: 3.2s; }

/* ---------- 4. 工具区 ---------- */
.section { padding: 44px 0; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 22px; flex-wrap: wrap;
}
.section-title { display: flex; align-items: flex-start; gap: 12px; }
.section-title .bar {
  width: 4px; height: 34px; border-radius: 3px; margin-top: 3px;
  background: linear-gradient(180deg, var(--accent), var(--purple));
}
.section-title h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.section-title p { margin: 2px 0 0; font-size: 13.5px; color: var(--text-3); }

.toolbar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px;
}
.search-box { position: relative; flex: 1; min-width: 240px; }
.search-box input {
  width: 100%; padding: 11px 14px 11px 40px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: 14.5px; font-family: inherit;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.search-box input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-3); pointer-events: none;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius-full);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all .18s ease; font-family: inherit;
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-ic { font-size: 14px; }
.chip-n {
  padding: 0 6px; border-radius: var(--radius-full);
  background: var(--surface-3); color: var(--text-3);
  font-size: 11.5px; font-weight: 600;
}
.chip.active .chip-n { background: rgba(255, 255, 255, .22); color: #fff; }

.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 14px;
}
.tool-card {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 17px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: all .2s ease; cursor: pointer;
}
.tool-card:hover {
  transform: translateY(-2px); border-color: var(--accent);
  box-shadow: var(--shadow);
}
.tool-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-3); font-size: 19px;
}
.tool-card:hover .tool-icon { background: var(--accent-soft); }
.tool-info { flex: 1; min-width: 0; display: block; }
.tool-info b { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 3px; }
.tool-info span { display: block; font-size: 12.5px; color: var(--text-3); line-height: 1.55; }
.tool-go { color: var(--text-3); font-size: 15px; flex-shrink: 0; transition: transform .2s ease, color .2s ease; }
.tool-card:hover .tool-go { color: var(--accent); transform: translateX(3px); }
.empty-hint {
  grid-column: 1 / -1; padding: 44px; text-align: center;
  color: var(--text-3); font-size: 14.5px;
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}

/* ---------- 5. 工作区（工具弹层） ---------- */
.workspace {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: none; flex-direction: column;
}
.workspace.open { display: flex; }
.ws-head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}
.ws-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; background: var(--accent-soft); font-size: 19px;
  flex-shrink: 0;
}
.ws-titles { flex: 1; min-width: 0; }
.ws-titles h2 { margin: 0; font-size: 18px; font-weight: 700; }
.ws-titles p { margin: 1px 0 0; font-size: 13px; color: var(--text-3); }

.ws-body {
  flex: 1; overflow-y: auto; padding: 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  align-content: start;
}
.ws-body.single-col { grid-template-columns: 1fr; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; min-height: 0;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 15px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); flex-shrink: 0;
}
.panel-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.panel-actions { display: flex; gap: 7px; }

.panel-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
textarea.tool-textarea, .tool-input {
  flex: 1; min-height: 260px; width: 100%;
  padding: 14px 16px; border: none; resize: none;
  background: transparent; color: var(--text);
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7;
  outline: none; tab-size: 2;
}
.tool-output {
  flex: 1; min-height: 260px; margin: 0;
  padding: 14px 16px; overflow: auto;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  color: var(--text);
}
.tool-output:empty::before {
  content: "结果会显示在这里";
  color: var(--text-3); font-family: var(--font);
}

.tool-opts {
  padding: 12px 15px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); display: grid; gap: 9px; flex-shrink: 0;
}
.tool-opts.empty { display: none; }
.opt-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px; }
.opt-label { font-size: 13px; color: var(--text-2); }
.opt-row input[type="text"], .opt-row input[type="number"], .opt-row select {
  width: 100%; padding: 7px 11px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: 13.5px; font-family: inherit; outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.opt-row input:focus, .opt-row select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.opt-check { grid-template-columns: auto 1fr; justify-content: start; }
.opt-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.status { font-size: 13px; font-weight: 500; padding: 2px 0; }
.status.running { color: var(--text-3); }
.status.ok { color: var(--green); }
.status.fail { color: var(--rose); }

/* ---------- 6. 页脚 ---------- */
.site-footer {
  margin-top: 40px; padding: 40px 0 26px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.footer-grid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px;
}
.footer-brand p { font-size: 13.5px; color: var(--text-3); margin: 13px 0 16px; line-height: 1.75; max-width: 320px; }
.footer-col h5 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-col a { font-size: 13.5px; color: var(--text-3); transition: color .15s ease; }
.footer-col a:hover { color: var(--accent-text); }
.social-row { display: flex; gap: 9px; }
.social-row a {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-3);
  transition: all .18s ease;
}
.social-row a:hover { background: var(--accent); color: #fff; }
.social-row svg { width: 15px; height: 15px; }

.footer-bottom {
  padding-top: 22px; margin-top: 30px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-3);
}
.footer-bottom a { color: var(--text-3); }
.footer-bottom a:hover { color: var(--accent-text); }
.icp-badge {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--radius-full);
  background: var(--surface-3); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-3);
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.icp-badge:hover { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft); }
.icp-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 悬停显示的备案跳转地址气泡 */
.icp-tip {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px; line-height: 1.5;
  white-space: nowrap;
  font-family: var(--font-mono);
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  pointer-events: none; z-index: 20;
}
.icp-tip::after {
  content: "";
  position: absolute; top: 100%; right: 14px;
  border: 5px solid transparent; border-top-color: var(--text);
}
.icp-badge:hover .icp-tip,
.icp-badge:focus-visible .icp-tip { opacity: 1; visibility: visible; transform: translateY(0); }

@media (max-width: 520px) {
  .icp-tip { right: auto; left: 0; }
  .icp-tip::after { right: auto; left: 14px; }
}

/* ---------- 7. 响应式 ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-visual { max-width: 460px; }
  .ws-body { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px; }
}
@media (max-width: 760px) {
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px; display: none; box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: grid; }
  .hero { padding: 40px 0 28px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .tool-grid { grid-template-columns: 1fr; }
  .ws-body { padding: 14px; }
  .opt-row { grid-template-columns: 1fr; gap: 5px; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}
