* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b1220;
  --panel: #161f32;
  --panel-2: #1e293b;
  --border: #263349;
  --text: #e6ecf5;
  --muted: #93a3bb;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 14px;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(11,18,32,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.logo { font-weight: 800; font-size: 17px; letter-spacing: .02em; }
.logo span { color: var(--accent); }
.nav-link {
  font-size: 13.5px;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: .15s;
}
.nav-link:hover { color: var(--text); border-color: var(--accent); }

/* ---------- 主体 ---------- */
.site-main {
  flex: 1;
  padding: 36px 28px 60px;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

/* ---------- 首页 hero ---------- */
.hero {
  text-align: center;
  padding: 32px 0 40px;
}
.hero h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -.01em;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #e6ecf5 30%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub { color: var(--muted); font-size: 14.5px; }
.hero-sub strong { color: var(--accent); }

.search-wrap {
  max-width: 460px;
  margin: 24px auto 0;
}
.search-wrap input {
  width: 100%;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  transition: .15s;
}
.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56,189,248,.12);
}

/* ---------- 首页卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: .18s ease;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(56,189,248,.09), transparent 60%);
  opacity: 0;
  transition: .18s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 30px -12px rgba(56,189,248,.35);
}
.card:hover::before { opacity: 1; }

.card-icon { font-size: 26px; position: relative; }
.card h3 {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  position: relative;
}
.card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
  position: relative;
}
.card-cta {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  position: relative;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
  font-size: 14px;
}

/* ---------- 工具页 ---------- */
.tool-wrap { max-width: 800px; margin: 0 auto; }

.back {
  display: inline-block;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 22px;
  transition: .15s;
}
.back:hover { color: var(--accent); }

.tool-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 26px;
}
.tool-icon {
  font-size: 34px;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
}
.tool-head h1 {
  font-size: 23px;
  font-weight: 800;
  margin-bottom: 6px;
}
.tool-head p { color: var(--muted); font-size: 14px; }

/* ---------- 表单 ---------- */
form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 7px;
  font-weight: 500;
}

.field input[type="number"],
.field input[type="text"],
.field input[type="date"],
.field select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: .15s;
  font-family: inherit;
}
.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56,189,248,.1);
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%2393a3bb' d='M6 8.5L1.5 4h9z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.chk {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: .15s;
  user-select: none;
  line-height: 1.45;
}
.chk:hover { border-color: var(--accent); }
.chk input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

button[type="submit"] {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121f;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: .15s;
  font-family: inherit;
  letter-spacing: .01em;
}
button[type="submit"]:hover:not(:disabled) { filter: brightness(1.1); }
button[type="submit"]:active:not(:disabled) { transform: scale(.99); }
button[type="submit"]:disabled { opacity: .55; cursor: wait; }

/* ---------- 结果 ---------- */
#result:empty { display: none; }
#result {
  margin-top: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
#result h3 {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  align-items: baseline;
}
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); flex-shrink: 0; }
.kv .v { color: var(--text); font-weight: 600; text-align: right; word-break: break-word; }

.list-item {
  padding: 9px 14px;
  background: var(--bg);
  border-radius: 9px;
  margin-bottom: 7px;
  font-size: 13.5px;
  line-height: 1.55;
}
.list-item:last-child { margin-bottom: 0; }

.nested {
  margin: 6px 0 12px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge.ok   { background: rgba(34,197,94,.15);  color: var(--ok); }
.badge.warn { background: rgba(245,158,11,.15); color: var(--warn); }
.badge.err  { background: rgba(239,68,68,.15);  color: var(--err); }

.error-box {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 14px;
}
.error-box h2 { font-size: 18px; margin-bottom: 8px; color: #fecaca; }

/* ---------- 相关工具 ---------- */
.related { margin-top: 56px; }
.related h2 {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.mini-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  transition: .15s;
}
.mini-card:hover { border-color: var(--accent); color: var(--accent); }
.mini-icon { font-size: 17px; flex-shrink: 0; }
.mini-name { line-height: 1.3; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 28px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .site-main { padding: 24px 16px 48px; }
  .site-header { padding: 12px 16px; }
  .hero { padding: 16px 0 28px; }
  .tool-head { flex-direction: column; gap: 12px; }
  .grid { grid-template-columns: 1fr; }
  form { padding: 20px 18px; }
}