:root {
  --bg: #0b1220;
  --bg-soft: #111a2c;
  --panel: #141f36;
  --panel-2: #1a2740;
  --border: #24324e;
  --text: #e8eef9;
  --muted: #93a3bf;
  --accent: #4f8cff;
  --accent-2: #7aa7ff;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

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

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(79, 140, 255, 0.16), transparent 60%),
    radial-gradient(700px 400px at 92% 4%, rgba(122, 167, 255, 0.1), transparent 62%);
  z-index: -1;
}

.wrap { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.6em; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin-top: 1.6em; }
h3 { font-size: 1.15rem; margin-top: 1.3em; }
p { margin: 0 0 1em; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(11, 18, 32, 0.82);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1.2rem; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--text); font-weight: 800; font-size: 1.08rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
}
.brand-mark .icon { width: 17px; height: 17px; }
.site-nav { display: flex; gap: 1.4rem; margin-left: auto; }
.site-nav a { color: var(--muted); font-size: 0.94rem; font-weight: 500; }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px 9px; cursor: pointer; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; margin: 3px 0; }

@media (max-width: 720px) {
  .site-nav { display: none; }
  .nav-toggle { display: block; }
  .site-nav.open { display: flex; position: absolute; top: 62px; left: 0; right: 0; flex-direction: column; background: var(--bg-soft); border-bottom: 1px solid var(--border); padding: 1rem 1.25rem; gap: 0.9rem; }
}

/* ---------- hero ---------- */
.hero { padding: 3.4rem 0 2.2rem; text-align: center; }
.hero h1 { margin-bottom: 0.5rem; }
.hero p.lede { font-size: 1.1rem; color: var(--muted); max-width: 60ch; margin-inline: auto; }
.hero-search { margin: 1.8rem auto 0; max-width: 560px; position: relative; }
.hero-search input[type="text"] {
  width: 100%;
  padding: 0.95rem 1.1rem 0.95rem 2.9rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
}
.hero-search input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.2); }
.hero-search .icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }

.pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 1.3rem; }
.pill { font-size: 0.83rem; color: var(--muted); background: var(--panel); border: 1px solid var(--border); padding: 0.32rem 0.8rem; border-radius: 999px; }

/* ---------- cards ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 1rem; }
.tool-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  color: var(--text);
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--panel-2); text-decoration: none; }
.tool-card .tc-icon { color: var(--accent-2); margin-bottom: 0.65rem; }
.tool-card .tc-icon .icon { width: 22px; height: 22px; }
.tool-card h3 { margin: 0 0 0.3rem; font-size: 1.02rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.55; }

.section { padding: 2.6rem 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 0.9rem; white-space: nowrap; }

/* ---------- tool page ---------- */
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2.2rem; padding: 2.4rem 0 3rem; align-items: start; }
@media (max-width: 900px) { .tool-layout { grid-template-columns: 1fr; } }

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent-2); }
.breadcrumb .sep { margin: 0 0.4rem; opacity: 0.5; }

.tool-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.2rem; }
.tool-head .head-icon {
  flex: none; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--accent-2);
}
.tool-head .head-icon .icon { width: 24px; height: 24px; }
.tool-head h1 { font-size: clamp(1.55rem, 3vw, 2.1rem); margin: 0 0 0.35rem; }
.tool-head .tool-desc { color: var(--muted); margin: 0; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.panel + .panel { margin-top: 1rem; }
.panel h2, .panel h3 { margin-top: 0; }

.field { display: block; margin-bottom: 0.9rem; }
.field > span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.4rem; font-weight: 500; }
textarea, input[type="text"], input[type="number"], input[type="url"], input[type="email"], select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-size: 0.94rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
}
textarea { font-family: var(--mono); font-size: 0.88rem; line-height: 1.55; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18); }
input::placeholder, textarea::placeholder { color: #63739a; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.6rem; }
.btn {
  appearance: none; cursor: pointer;
  font-family: inherit; font-size: 0.92rem; font-weight: 600;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
}
.btn:hover { background: #22314f; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #3d7bf0; }
.btn-sm { padding: 0.38rem 0.75rem; font-size: 0.83rem; }

.result-box {
  margin-top: 0.9rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.95rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 460px;
  overflow: auto;
  color: #cfe0ff;
}
.result-box:empty { display: none; }
.result-box.error { color: #ffd3d3; border-color: rgba(248, 113, 113, 0.5); background: rgba(248, 113, 113, 0.09); }
.result-box .k { color: #7dd3fc; }
.result-box .s { color: #a5f3c0; }
.result-box .n { color: #fcd34d; }
.result-box .b { color: #c4b5fd; }
.result-box .null { color: #64748b; }

.status { font-size: 0.84rem; color: var(--muted); margin-top: 0.6rem; }
.status.err { color: var(--err); }
.status.ok { color: var(--ok); }

.copy-btn { float: right; }

/* ---------- sidebar ---------- */
.side { position: sticky; top: 78px; }
.side-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.05rem; margin-bottom: 1rem; }
.side-box h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 0.8rem; }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.side-list a { color: var(--text); font-size: 0.9rem; display: flex; gap: 0.5rem; align-items: center; }
.side-list a:hover { color: var(--accent-2); text-decoration: none; }
.side-list .icon { width: 15px; height: 15px; color: var(--muted); flex: none; }

.newsletter-form { display: flex; flex-direction: column; gap: 0.55rem; }
.newsletter-form input { font-size: 0.88rem; }
.newsletter-note { font-size: 0.78rem; color: var(--muted); margin: 0.4rem 0 0; }

/* ---------- ad ---------- */
.ad-slot { margin: 1.6rem 0; text-align: center; }
.ad-label { display: block; font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: #5a6a8c; margin-bottom: 0.4rem; }
.ad-slot ins { display: block; min-height: 90px; }

/* ---------- prose ---------- */
.prose { max-width: 72ch; }
.prose h2 { margin-top: 2em; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1em; }
.prose li { margin-bottom: 0.35rem; }
.prose blockquote {
  margin: 1.4rem 0; padding: 0.8rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--panel); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font-family: var(--mono); font-size: 0.86em; background: var(--panel-2); padding: 0.15em 0.4em; border-radius: 5px; }
.md-code {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.9rem 1rem; overflow-x: auto; margin: 1.2rem 0;
}
.md-code code { background: none; padding: 0; font-size: 0.84rem; line-height: 1.6; }
.table-wrap { overflow-x: auto; margin: 1.2rem 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.7rem; text-align: left; }
th { background: var(--panel-2); font-weight: 600; }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.prose img { max-width: 100%; border-radius: var(--radius-sm); }

/* ---------- faq ---------- */
.faq { margin-top: 1rem; }
.faq details {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.85rem 1rem; margin-bottom: 0.6rem;
}
.faq summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; color: var(--accent-2); font-weight: 700; margin-right: 0.55rem; }
.faq details[open] summary::before { content: "\2212"; }
.faq .faq-a { margin: 0.7rem 0 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- json syntax highlight ---------- */
.tok-str { color: #a5f3c0; }
.tok-num { color: #fcd34d; }
.tok-bool { color: #c4b5fd; }
.tok-null { color: #64748b; }
.tok-key { color: #7dd3fc; }
.tok-punc { color: #94a3b8; }

/* ---------- post list ---------- */
.post-list { display: flex; flex-direction: column; gap: 1.1rem; }
.post-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.15rem 1.25rem; color: var(--text);
}
.post-card:hover { border-color: var(--accent); text-decoration: none; }
.post-card h3 { margin: 0 0 0.35rem; font-size: 1.12rem; }
.post-card .meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
.post-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.post-card .more { color: var(--accent-2); font-size: 0.86rem; margin-top: 0.6rem; display: inline-block; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 2.4rem 0 1.6rem; background: var(--bg-soft); }
.aff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.8rem; margin-bottom: 2rem; }
.aff-link {
  display: flex; flex-direction: column; gap: 0.2rem;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.8rem 0.9rem; color: var(--text);
}
.aff-link:hover { border-color: var(--accent); text-decoration: none; }
.aff-link strong { font-size: 0.92rem; }
.aff-link span { font-size: 0.8rem; color: var(--muted); }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.footer-bottom p { margin: 0; font-size: 0.84rem; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.footer-links a { font-size: 0.84rem; color: var(--muted); }
.footer-links a:hover { color: var(--accent-2); }

.page-head { padding: 2.4rem 0 1.2rem; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.page-head h1 { margin-bottom: 0.4rem; }
.page-head p { color: var(--muted); margin: 0; max-width: 62ch; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
