/* tools.wwwneo — editorial flat: warm neutrals, single brick-orange accent */

:root {
  color-scheme: dark light;

  /* surfaces — neutral, slight warmth */
  --bg:        #0d0d0d;
  --bg-elev:   #161616;
  --bg-soft:   #1d1d1d;
  --line:      #2a2a2a;
  --line-soft: #1f1f1f;

  /* type */
  --text:      #ededed;
  --text-dim:  #b6b3ad;
  --text-mute: #7d7a73;

  /* accent — single warm tone, brick orange */
  --accent:        #f97316;
  --accent-hover:  #fb923c;
  --accent-fg:     #1a0d04;
  --accent-bg:     rgba(249, 115, 22, 0.08);
  --accent-bg-2:   rgba(249, 115, 22, 0.16);
  --accent-line:   rgba(249, 115, 22, 0.50);

  /* semantic */
  --ok:   #4ade80;
  --warn: #facc15;
  --err:  #f87171;

  /* engine colors — desaturated */
  --eng-client: #93b5e6;
  --eng-wasm:   #c4a8e0;
  --eng-server: #8dc69f;

  /* fonts */
  --code: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --san:  -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  /* shape — squarer, more editorial */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;

  --top-h: 56px;
}

:root[data-theme="light"] {
  --bg:        #faf9f6;
  --bg-elev:   #ffffff;
  --bg-soft:   #f3f1ec;
  --line:      #d8d5cd;
  --line-soft: #ebe8e1;

  --text:      #1c1b1a;
  --text-dim:  #4a4844;
  --text-mute: #807d77;

  --accent:        #d4543d;
  --accent-hover:  #c4452f;
  --accent-fg:     #ffffff;
  --accent-bg:     rgba(212, 84, 61, 0.08);
  --accent-bg-2:   rgba(212, 84, 61, 0.14);
  --accent-line:   rgba(212, 84, 61, 0.45);

  --ok:   #15803d;
  --warn: #b45309;
  --err:  #b91c1c;

  --eng-client: #2563eb;
  --eng-wasm:   #6d28d9;
  --eng-server: #15803d;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--san);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: none; }
::selection { background: var(--accent-bg-2); color: var(--text); }

.skip {
  position: absolute; top: -100px; left: 12px;
  background: var(--accent); color: var(--accent-fg);
  padding: 8px 12px; border-radius: var(--r-1); z-index: 99;
  font-weight: 500;
}
.skip:focus { top: 12px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  height: var(--top-h);
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text);
  font-weight: 600; font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand i {
  font-style: normal;
  color: var(--text-mute);
  font-weight: 400;
  font-size: 13.5px;
  margin-left: -3px;
  letter-spacing: 0;
}
.brand svg { color: var(--accent); width: 18px; height: 18px; }

.search-wrap {
  flex: 1; max-width: 460px;
  position: relative;
  display: flex; align-items: center;
}
.search {
  width: 100%;
  height: 32px; padding: 0 36px 0 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  outline: none; font: inherit;
  font-size: 13px;
  transition: border-color .12s;
}
.search:focus { border-color: var(--accent-line); }
.search::placeholder { color: var(--text-mute); opacity: .85; }
.search-wrap .kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  pointer-events: none;
  font: 600 10.5px var(--code);
  padding: 1px 6px; border-radius: 3px;
  background: var(--bg-soft);
  color: var(--text-mute);
  border: 1px solid var(--line-soft);
  letter-spacing: 0;
}
.search:focus + .kbd { display: none; }

.kbd-inline {
  display: inline-block;
  font: 600 11px var(--code);
  padding: 0 5px; border-radius: 3px;
  background: var(--bg-soft); color: var(--text-dim);
  border: 1px solid var(--line);
  margin-right: 4px; min-width: 16px; text-align: center;
}

.topnav { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font: inherit; font-size: 12.5px;
  transition: border-color .12s, color .12s, background .12s;
}
.icon-btn:hover { border-color: var(--text-mute); color: var(--text); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - var(--top-h));
}

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky; top: var(--top-h);
  align-self: start;
  height: calc(100vh - var(--top-h));
  overflow: auto;
  border-right: 1px solid var(--line-soft);
  padding: 16px 14px 32px;
  background: var(--bg);
}
.sidebar h4 {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 8px 4px;
  color: var(--text-mute);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 600;
}
.sidebar h4 em {
  font-style: normal;
  font-family: var(--code);
  letter-spacing: 0;
  font-size: 10.5px;
  color: var(--text-mute);
  opacity: .7;
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar .side-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  font-family: var(--code); font-size: 12px;
  color: var(--text-mute);
}
.sidebar .side-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar a {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 5px 8px;
  border-radius: var(--r-1);
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
  transition: background .1s, color .1s;
}
.sidebar a:hover { background: var(--bg-soft); color: var(--text); }
.sidebar a.active {
  color: var(--text);
  font-weight: 500;
  background: transparent;
}
.sidebar a.active::before {
  content: ""; position: absolute;
  left: -14px; top: 6px; bottom: 6px; width: 2px;
  background: var(--accent);
}
.sidebar a .badge {
  margin-left: auto;
  font-size: 9px; font-weight: 600;
  padding: 0;
  background: transparent;
  color: var(--text-mute);
  border: 0;
  text-transform: uppercase; letter-spacing: .08em;
  opacity: .8;
}
.sidebar a .badge[data-engine="client"] { color: var(--eng-client); }
.sidebar a .badge[data-engine="wasm"]   { color: var(--eng-wasm); }
.sidebar a .badge[data-engine="server"] { color: var(--eng-server); }

/* ---------- content ---------- */
.content { padding: 36px 40px 80px; min-width: 0; max-width: 1200px; }

/* ---------- hero (editorial, two-column) ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 48px;
  padding: 0 0 30px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  border-radius: 0;
}
.hero-main { min-width: 0; }
.hero-aside {
  border-left: 1px solid var(--line-soft);
  padding-left: 28px;
}
.hero-aside h5 {
  margin: 4px 0 14px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--text-mute);
  font-weight: 600;
}
.quick-list { list-style: none; padding: 0; margin: 0; }
.quick-list li { margin: 0; }
.quick-list a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
  color: var(--text);
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  transition: color .12s;
}
.quick-list a:last-child { border-bottom: 0; }
.quick-list a:hover { color: var(--accent); text-decoration: none; }
.quick-list .q-name { font-weight: 500; }
.quick-list .q-tag {
  font: 600 9px var(--code);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-mute);
}
.quick-list .q-tag[data-engine="client"] { color: var(--eng-client); }
.quick-list .q-tag[data-engine="wasm"]   { color: var(--eng-wasm); }
.quick-list .q-tag[data-engine="server"] { color: var(--eng-server); }

.hero .eyebrow {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--accent);
  margin-bottom: 14px;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: 32px; font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
}
.hero p {
  margin: 0;
  color: var(--text-dim);
  max-width: 720px;
  line-height: 1.65;
  font-size: 14.5px;
}
.hero .stats {
  display: flex; gap: 0;
  margin-top: 24px;
  border-top: 1px solid var(--line-soft);
  padding-top: 20px;
}
.hero .stat {
  display: flex; flex-direction: column; gap: 4px;
  padding-right: 32px;
  margin-right: 32px;
  border-right: 1px solid var(--line-soft);
}
.hero .stat:last-child { border-right: 0; padding-right: 0; margin-right: 0; }
.hero .stat .num {
  font: 600 22px var(--code);
  color: var(--text); letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}
.hero .stat .lbl {
  font-size: 10px; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: .14em;
  font-weight: 600;
}

/* ---------- category title ---------- */
.cat-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 40px 0 14px;
}
.cat-title h2 {
  margin: 0;
  font-size: 14px; font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
  display: inline-flex; align-items: center; gap: 12px;
}
.cat-title h2::before {
  content: "";
  display: inline-block;
  width: 16px; height: 1px;
  background: var(--accent);
}
.cat-title small {
  color: var(--text-mute);
  font: 600 11px var(--code);
  letter-spacing: .04em;
}

/* ---------- grid (table-like, hairline-only borders) ---------- */
.grid {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  position: relative;
  display: flex; flex-direction: column;
  justify-content: flex-start;
  min-height: 96px;
  padding: 18px 18px 16px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background .14s;
}
.card::before {
  content: ""; position: absolute;
  left: 0; top: 0; bottom: 0; width: 2px;
  background: transparent;
  transition: background .14s;
}
.card:hover {
  background: var(--bg-soft);
  text-decoration: none;
}
.card:hover::before { background: var(--accent); }
.card:hover .name { color: var(--accent); }
.card[data-engine="wasm"]:hover::before { background: var(--eng-wasm); }
.card[data-engine="server"]:hover::before { background: var(--eng-server); }
.card[data-engine="client"]:hover::before { background: var(--eng-client); }
.card .name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.005em;
  padding-right: 64px;
  transition: color .12s;
}
.card .desc {
  margin-top: 6px;
  color: var(--text-mute);
  font-size: 12.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .tag {
  position: absolute; top: 16px; right: 18px;
  font-size: 9px; font-weight: 600;
  padding: 0;
  background: transparent;
  color: var(--text-mute);
  border: 0;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.card .tag[data-engine="client"] { color: var(--eng-client); }
.card .tag[data-engine="wasm"]   { color: var(--eng-wasm); }
.card .tag[data-engine="server"] { color: var(--eng-server); }

/* ---------- breadcrumb ---------- */
.crumb {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-mute);
}
.crumb a {
  color: var(--text-mute);
  transition: color .12s;
}
.crumb a:hover { color: var(--accent); }
.crumb .sep { color: var(--text-mute); opacity: .55; font-family: var(--code); }
.crumb .current { color: var(--text); font-weight: 500; }

/* ---------- tool page ---------- */
.tool-head {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.tool-head-text { flex: 1 1 auto; min-width: 0; }
.tool-head h1 {
  margin: 0 0 4px;
  font-size: 26px; font-weight: 600;
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.tool-head p {
  margin: 0;
  color: var(--text-mute);
  font-size: 13.5px;
  line-height: 1.55;
}
.engine-pill {
  flex: 0 0 auto;
  display: inline-flex; align-items: center;
  font: 600 9.5px var(--code);
  letter-spacing: .14em;
  padding: 4px 8px;
  border-radius: var(--r-1);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-mute);
  margin-top: 6px;
}
.engine-pill[data-engine="client"] { color: var(--eng-client); border-color: color-mix(in oklab, var(--eng-client) 35%, var(--line)); }
.engine-pill[data-engine="wasm"]   { color: var(--eng-wasm);   border-color: color-mix(in oklab, var(--eng-wasm)   35%, var(--line)); }
.engine-pill[data-engine="server"] { color: var(--eng-server); border-color: color-mix(in oklab, var(--eng-server) 35%, var(--line)); }

.tool-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 980px) {
  .tool-grid.split { grid-template-columns: 1fr 1fr; }
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 600;
}

textarea, input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="tel"], input[type="number"], input[type="search"], input[type="datetime-local"], input[type="date"], input[type="time"], input[type="color"], select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  font: inherit;
  font-family: var(--code);
  font-size: 13px;
  outline: none;
  transition: border-color .12s, background .12s;
}
textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.6;
  white-space: pre;
  word-wrap: normal;
  overflow: auto;
}
textarea:focus, input:focus, select:focus { border-color: var(--accent-line); }
textarea::placeholder, input::placeholder { color: var(--text-mute); opacity: .65; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px;
  border-radius: 999px;
  background: var(--line);
  outline: none; padding: 0; border: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: 2px solid var(--bg);
  transition: transform .12s, background .12s;
}
input[type="range"]::-webkit-slider-thumb:hover { background: var(--accent); }
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); cursor: pointer; border: 2px solid var(--bg);
}

input[type="color"] { padding: 2px; height: 32px; cursor: pointer; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > * { flex: 0 0 auto; }
.row > .grow { flex: 1 1 auto; }

/* ---------- buttons (sharper, editorial) ---------- */
button.btn {
  padding: 8px 16px;
  background: var(--accent); color: var(--accent-fg);
  border: 1px solid var(--accent);
  border-radius: var(--r-1);
  cursor: pointer; font: inherit;
  font-weight: 500; font-size: 13px;
  letter-spacing: -0.005em;
  transition: background .12s, border-color .12s, color .12s, transform .12s;
}
button.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.btn:active { transform: translateY(1px); }
button.btn.ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--line);
}
button.btn.ghost:hover {
  border-color: var(--text-mute);
  color: var(--text);
  background: var(--bg-soft);
}
button.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
button.btn:disabled, button.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: var(--r-1);
  font-size: 12px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
  transition: background .1s, color .1s, border-color .1s;
}
.chip.ok    { color: var(--ok);   border-color: color-mix(in oklab, var(--ok)   28%, var(--line)); }
.chip.warn  { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 28%, var(--line)); }
.chip.err   { color: var(--err);  border-color: color-mix(in oklab, var(--err)  28%, var(--line)); }

.chip > input,
.chip > select {
  background: transparent; border: 0; padding: 0 2px;
  font: inherit; font-size: 12px; color: var(--text);
  outline: none; min-width: 50px;
}
.chip > input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); }
.chip > input[type="number"] { max-width: 64px; font-family: var(--code); }

/* ---------- KV ---------- */
.kv {
  display: grid; grid-template-columns: 168px 1fr;
  gap: 8px 24px;
  font-size: 13px;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}
.kv .k {
  color: var(--text-mute);
  font-size: 11.5px;
  letter-spacing: .04em;
  align-self: start;
  padding-top: 2px;
}
.kv .v {
  color: var(--text);
  word-break: break-all;
  font-family: var(--code);
  font-size: 13px;
  line-height: 1.55;
}

.empty { text-align: center; padding: 64px 24px; color: var(--text-mute); }
.empty h3 { margin: 0 0 12px; color: var(--text); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line-soft);
  color: var(--text-mute);
  font-size: 12px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  max-width: 1200px;
  padding: 28px 40px 36px;
}
.footer-col h5 {
  margin: 0 0 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--text);
}
.footer-col p { margin: 0; color: var(--text-mute); line-height: 1.65; max-width: 360px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { padding: 4px 0; color: var(--text-mute); font-size: 12px; }
.footer-col li a { color: var(--text-mute); }
.footer-col li a:hover { color: var(--accent); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translate(-50%, 16px);
  padding: 9px 14px;
  border-radius: var(--r-1);
  background: var(--text); color: var(--bg);
  font-size: 12.5px; font-weight: 500;
  z-index: 60;
  border: 1px solid transparent;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: transform .22s ease, opacity .22s ease, visibility 0s linear .22s;
}
.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: transform .22s ease, opacity .22s ease, visibility 0s linear 0s;
}
.toast.err { background: var(--err); color: #fff; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--text-mute) 22%, transparent);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in oklab, var(--text-mute) 45%, transparent); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-aside { border-left: 0; padding-left: 0; border-top: 1px solid var(--line-soft); padding-top: 22px; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .sidebar h4 { display: none; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 0; }
  .sidebar a { padding: 5px 10px; font-size: 12px; }
  .sidebar a.active::before { display: none; }
  .sidebar a .badge, .sidebar .side-icon { display: none; }
  .sidebar .side-name { white-space: normal; }
  .topnav .icon-btn { padding: 0 8px; }
  .hero { padding: 0 0 22px; }
  .hero h1 { font-size: 24px; }
  .hero .stats { gap: 0; padding-top: 16px; }
  .hero .stat { padding-right: 18px; margin-right: 18px; }
  .content { padding: 22px 18px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .kv { grid-template-columns: 110px 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 22px; padding: 24px 18px; }
  .crumb { font-size: 11.5px; flex-wrap: wrap; }
}
