:root {
  --bg: #080808; --surface: #111; --surface2: #1a1a1a; --border: rgba(255,255,255,.07);
  --red: #DC2626; --red2: #EF4444; --text: #f1f1f1; --muted: #777; --code-bg: #0d0d0d;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; min-height: 100vh; }

/* ── Header ── */
.site-header { position: sticky; top: 0; z-index: 200; background: rgba(8,8,8,.97); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 10px 16px; height: 52px; }
.logo { font-size: 18px; font-weight: 900; color: var(--text); text-decoration: none; white-space: nowrap; letter-spacing: -.5px; }
.logo span { color: var(--red); }
.header-search { flex: 1; max-width: 360px; }
.header-search input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; color: var(--text); font-size: 13px; outline: none; }
.header-search input:focus { border-color: var(--red); }
.back-btn { font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.back-btn:hover { color: var(--red2); }

/* ── Views ── */
.view { display: none; }
.view.active { display: block; }

/* ── Home / Hero ── */
.hero { text-align: center; padding: 48px 20px 36px; }
.hero h1 { font-size: clamp(28px, 6vw, 52px); font-weight: 900; line-height: 1.08; margin-bottom: 14px; }
.hero h1 span { color: var(--red); }
.hero p { color: var(--muted); font-size: 15px; max-width: 520px; margin: 0 auto 24px; line-height: 1.6; }
.hero-search input { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; color: var(--text); font-size: 15px; outline: none; display: block; margin: 0 auto; }
.hero-search input:focus { border-color: var(--red); }

/* ── Trust bar ── */
.trust-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.trust-badge { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px; letter-spacing: .03em; white-space: nowrap; }

/* ── Tool private note ── */
.tool-private-note { font-size: 11px; color: var(--muted); margin-bottom: 12px; }

/* ── Search results ── */
.search-results { max-width: 640px; margin: 0 auto; padding: 0 16px 16px; }
.search-result-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; text-decoration: none; color: var(--text); transition: border-color .12s; }
.search-result-item:hover { border-color: var(--red); }
.sri-name { font-weight: 700; font-size: 14px; }
.sri-cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sri-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ── Sections ── */
.section { padding: 8px 16px 32px; max-width: 1100px; margin: 0 auto; }
.section-title { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 14px; }

/* ── Category Grid ── */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.cat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px 16px; cursor: pointer; text-decoration: none; color: var(--text); transition: border-color .12s, transform .12s; display: block; }
.cat-card:hover { border-color: var(--red); transform: translateY(-1px); }
.cat-icon { font-size: 28px; margin-bottom: 10px; }
.cat-name { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.cat-count { font-size: 11px; color: var(--muted); }

/* ── Tool Grid ── */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; cursor: pointer; text-decoration: none; color: var(--text); display: block; transition: border-color .12s; }
.tool-card:hover { border-color: var(--red); }
.tool-card-name { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.tool-card-desc { font-size: 11px; color: var(--muted); line-height: 1.5; }
.tool-card-cat { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--red2); margin-top: 8px; }

/* ── Tool Page ── */
.tool-page { max-width: 860px; margin: 0 auto; padding: 16px 16px 100px; }
.breadcrumb { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--red2); }
.tool-h1 { font-size: clamp(20px, 4vw, 32px); font-weight: 900; line-height: 1.15; margin-bottom: 20px; }

/* ── Tool UI ── */
.tool-ui { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-bottom: 20px; }
.tool-row { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.tool-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; }
textarea.tt-input, input.tt-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; outline: none; resize: vertical; }
textarea.tt-input { min-height: 140px; }
textarea.tt-input:focus, input.tt-input:focus { border-color: var(--red); }
.tt-output { width: 100%; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: #a8d8a8; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; min-height: 60px; white-space: pre-wrap; word-break: break-all; overflow-x: auto; }
.tt-btn { padding: 9px 18px; background: var(--red); border: none; border-radius: 8px; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; transition: opacity .12s; white-space: nowrap; }
.tt-btn:hover { opacity: .88; }
.tt-btn-ghost { padding: 9px 18px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; transition: border-color .12s; white-space: nowrap; }
.tt-btn-ghost:hover { border-color: var(--red); color: var(--red2); }
select.tt-select { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; color: var(--text); font-size: 13px; outline: none; cursor: pointer; }
select.tt-select:focus { border-color: var(--red); }
input[type=range].tt-range { width: 100%; accent-color: var(--red); }
input[type=number].tt-num { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; color: var(--text); font-size: 13px; width: 90px; outline: none; }
input[type=number].tt-num:focus { border-color: var(--red); }
input[type=color].tt-color { width: 44px; height: 36px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; background: none; padding: 2px; }
.tt-copy { font-size: 11px; color: var(--muted); cursor: pointer; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface2); transition: border-color .1s; }
.tt-copy:hover { border-color: var(--red); color: var(--red2); }
.tt-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 5px; }
.tt-badge-pass { background: rgba(34,197,94,.15); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.tt-badge-fail { background: rgba(220,38,38,.15); color: var(--red2); border: 1px solid rgba(220,38,38,.2); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.stat-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; text-align: center; }
.stat-val { font-size: 22px; font-weight: 900; color: var(--red2); }
.stat-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.diff-line { font-family: monospace; font-size: 12px; padding: 1px 8px; white-space: pre-wrap; word-break: break-all; }
.diff-added { background: rgba(34,197,94,.12); color: #4ade80; }
.diff-removed { background: rgba(220,38,38,.12); color: #f87171; }
.diff-same { color: var(--muted); }
.swatch-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.swatch { width: 36px; height: 36px; border-radius: 6px; cursor: pointer; border: 1px solid rgba(255,255,255,.1); transition: transform .1s; }
.swatch:hover { transform: scale(1.15); }
.regex-match { background: rgba(220,38,38,.3); border-radius: 2px; }
.mid-ad { margin: 20px 0; text-align: center; }

/* ── Related Tools ── */
.related-tools { margin: 4px 0 24px; }
.related-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 480px) { .related-grid { grid-template-columns: 1fr 1fr; } }
.related-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-decoration: none; color: var(--text); display: block; transition: border-color .12s; }
.related-card:hover { border-color: var(--red); }
.related-card-name { font-size: 12px; font-weight: 700; }
.related-card-cat { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }

/* ── Tool About (SEO) ── */
.tool-about { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-top: 8px; }
.tool-about h2 { font-size: 15px; font-weight: 800; margin-bottom: 10px; }
.tool-about h3 { font-size: 13px; font-weight: 700; margin: 14px 0 6px; color: var(--red2); }
.tool-about p, .tool-about li { font-size: 13px; color: #bbb; line-height: 1.7; margin-bottom: 8px; }
.tool-about ul { padding-left: 18px; }

/* ── Category Page ── */
.cat-page { max-width: 1000px; margin: 0 auto; padding: 16px 16px 100px; }

/* ── Toast ── */
#toast { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%) translateY(10px); background: #222; color: var(--text); padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 9999; white-space: nowrap; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Markdown output ── */
.md-out h1, .md-out h2, .md-out h3 { margin: 16px 0 8px; font-weight: 700; }
.md-out h1 { font-size: 1.5em; } .md-out h2 { font-size: 1.25em; } .md-out h3 { font-size: 1.1em; }
.md-out p { margin-bottom: 10px; line-height: 1.6; }
.md-out code { background: #222; padding: 1px 5px; border-radius: 3px; font-family: monospace; font-size: .9em; }
.md-out pre { background: #0d0d0d; padding: 12px; border-radius: 8px; overflow-x: auto; margin-bottom: 12px; }
.md-out pre code { background: none; padding: 0; }
.md-out a { color: var(--red2); }
.md-out blockquote { border-left: 3px solid var(--red); padding-left: 12px; margin: 10px 0; color: var(--muted); }
.md-out ul, .md-out ol { padding-left: 20px; margin-bottom: 10px; }
.md-out li { margin-bottom: 4px; line-height: 1.5; }
.md-out hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.md-out table { border-collapse: collapse; width: 100%; margin-bottom: 12px; font-size: 13px; }
.md-out th, .md-out td { border: 1px solid var(--border); padding: 6px 10px; }
.md-out th { background: var(--surface2); }

@media (max-width: 500px) {
  .tool-row { flex-direction: column; }
  .related-grid { grid-template-columns: 1fr; }
}
