:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --border: #e3e8ef;
  --text: #171f2b;
  --text-muted: #5b6b7c;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --radius-lg: 12px;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .08);
  --input-bg: #fbfcfe;
  --input-bg-focus: #ffffff;
  --code-bg: #eef2f5;
  --secondary-hover: #eef4ff;
}
:root[data-theme="dark"] {
  --bg: #10151f;
  --surface: #1a2130;
  --border: #2c3547;
  --text: #e8edf5;
  --text-muted: #9aa7bb;
  --primary: #5b8cf0;
  --primary-dark: #6f9bf5;
  --success: #4ade80;
  --danger: #f87171;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .5);
  --input-bg: #141b28;
  --input-bg-focus: #0f1521;
  --code-bg: #232c3d;
  --secondary-hover: #202a3d;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10151f;
    --surface: #1a2130;
    --border: #2c3547;
    --text: #e8edf5;
    --text-muted: #9aa7bb;
    --primary: #5b8cf0;
    --primary-dark: #6f9bf5;
    --success: #4ade80;
    --danger: #f87171;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .5);
    --input-bg: #141b28;
    --input-bg-focus: #0f1521;
    --code-bg: #232c3d;
    --secondary-hover: #202a3d;
  }
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
.wrap { max-width: 860px; margin: 0 auto; padding: 2rem 1.25rem 3.5rem; }
header.site {
  max-width: 860px; margin: 0 auto; padding: 1.1rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
}
header.site a.brand { font-weight: 800; font-size: 1.2rem; color: var(--text); letter-spacing: -.01em; }
header.site nav a {
  font-size: .85rem; font-weight: 600; color: var(--text-muted);
  border: 1px solid var(--border); background: var(--surface);
  padding: .4rem .8rem; border-radius: 999px;
}
header.site nav a:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; }
h1 { color: var(--text); font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; margin: .2rem 0 .7rem; }
h2 { color: var(--text); font-size: 1.2rem; font-weight: 700; margin-top: 2.2rem; margin-bottom: .6rem; }
h3 { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { margin-left: 1.2rem; }
.lede { color: var(--text-muted); font-size: 1.05rem; max-width: 60ch; }

/* Homepage tool grid */
.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .85rem; margin: 1.25rem 0 2.25rem; padding: 0; list-style: none;
}
.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.tool-card .icon { font-size: 1.4rem; display: block; margin-bottom: .5rem; }
.tool-card a.name { font-weight: 700; color: var(--text); font-size: 1rem; display: block; margin-bottom: .3rem; }
.tool-card a.name:hover { color: var(--primary); text-decoration: none; }
.tool-card p { margin: 0; font-size: .82rem; color: var(--text-muted); }

.tool-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; margin: 1.4rem 0; box-shadow: var(--shadow-sm);
}
label { display: block; font-size: .82rem; font-weight: 700; margin: .8rem 0 .35rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .02em; }
label:first-child { margin-top: 0; }
textarea, input[type=text] {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  background: var(--input-bg);
  color: var(--text);
}
textarea { min-height: 140px; }
textarea:focus, input[type=text]:focus, select:focus {
  outline: 2px solid var(--primary); outline-offset: 1px; background: var(--input-bg-focus);
}
.controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.controls input[type=text] { width: auto; flex: 1 1 160px; }
button, select {
  font-size: .85rem; font-weight: 600;
  padding: .55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
button:hover { background: var(--primary-dark); }
button:active { transform: translateY(1px); }
button.secondary { background: var(--surface); color: var(--primary); }
button.secondary:hover { background: var(--secondary-hover); }
.theme-toggle {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; width: 2.1rem; height: 2.1rem; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
}
.theme-toggle:hover { background: var(--secondary-hover); }
header.site nav { display: flex; align-items: center; gap: .5rem; }
select { background: var(--surface); color: var(--text); border-color: var(--border); font-weight: 500; }
.status { font-size: .82rem; margin-top: .6rem; font-weight: 700; }
.status.ok { color: var(--success); }
.status.err { color: var(--danger); }
.faq h3 { margin-top: 1.1rem; }
.faq p { color: var(--text-muted); }
.related { display: flex; flex-wrap: wrap; gap: .5rem; }
.related a { border: 1px solid var(--border); background: var(--surface); padding: .4rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--text); }
.related a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
/* ponytail: hidden until a real AdSense unit replaces the placeholder — an empty box reads as an unfinished site and risks CLS when an ad finally loads into it */
.ad-slot { display: none; }
footer.site {
  max-width: 860px; margin: 2rem auto 0; padding: 1.25rem;
  border-top: 1px solid var(--border); font-size: .82rem; color: var(--text-muted);
  display: flex; gap: 1.25rem; flex-wrap: wrap;
}
footer.site a { color: var(--text-muted); font-weight: 600; }
footer.site a:hover { color: var(--primary); }
code { background: var(--code-bg); padding: .15rem .4rem; border-radius: 4px; font-size: .85em; }
p { color: var(--text); }
table.claims { border-collapse: collapse; width: 100%; font-size: .85rem; margin-top: .5rem; }
table.claims th, table.claims td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--border); }
table.claims th { color: var(--text-muted); font-weight: 700; text-transform: uppercase; font-size: .72rem; }

.cmdk-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  z-index: 1000; align-items: flex-start; justify-content: center; padding-top: 12vh;
}
.cmdk-box {
  width: min(560px, 90vw); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden;
}
.cmdk-input {
  width: 100%; border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  padding: .9rem 1.1rem; font-size: 1rem; font-family: inherit; background: var(--surface); color: var(--text);
}
.cmdk-input:focus { outline: none; }
.cmdk-list { list-style: none; margin: 0; padding: .4rem; max-height: 50vh; overflow-y: auto; }
.cmdk-item { padding: .55rem .7rem; border-radius: var(--radius); font-size: .9rem; cursor: pointer; display: flex; align-items: center; gap: .6rem; }
.cmdk-item.active { background: var(--primary); color: #fff; }
.cmdk-item .cmdk-group { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); border: 1px solid var(--border); border-radius: 4px; padding: .1rem .35rem; flex-shrink: 0; }
.cmdk-item.active .cmdk-group { color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.4); }
.cmdk-empty { padding: 1rem; color: var(--text-muted); font-size: .85rem; text-align: center; }

@media (max-width: 480px) {
  .wrap { padding: 1.25rem .9rem 2.5rem; }
  header.site { padding: .85rem 1rem; }
  h1 { font-size: 1.5rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .controls { flex-direction: column; align-items: stretch; }
  .controls button, .controls select, .controls input[type=text] { width: 100%; flex: none; }
}
