*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0a;
  --card: #111111;
  --card2: #161616;
  --border: #252525;
  --border2: #1e1e1e;
  --primary: #7c3aed;
  --primary-h: #6d28d9;
  --primary-dim: rgba(124,58,237,0.15);
  --text: #e2e2e2;
  --text-muted: #888;
  --text-dim: #555;
  --red: #ef4444;
  --green: #22c55e;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --sidebar-w: 240px;
  --topbar-h: 52px;
  --radius: 10px;
}

html { font-size: 16px; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-content { flex: 1; }

/* ── Mobile top bar ── */
.mobile-topbar { display: none; position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); background: var(--card); border-bottom: 1px solid var(--border); z-index: 200; align-items: center; gap: 12px; padding: 0 16px; }
.hamburger { background: none; border: none; color: var(--text); padding: 6px; border-radius: 6px; display: flex; align-items: center; }
.hamburger:hover { background: var(--card2); }

/* ── Sidebar ── */
.sidebar { width: var(--sidebar-w); background: var(--card); border-right: 1px solid var(--border); height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; }
.sidebar-backdrop { display: none; }
.sidebar-close { display: none; }

.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 12px; border-bottom: 1px solid var(--border); }
.logo-link { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; color: var(--text); }
.logo-icon { width: 28px; height: 28px; background: var(--primary); border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 0.9rem; font-weight: 800; }
.logo-text { font-size: 1.05rem; }

.sidebar-search { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.sidebar-search input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; color: var(--text); font-size: 0.8rem; outline: none; transition: border-color .2s; }
.sidebar-search input:focus { border-color: var(--primary); }
.sidebar-search input::placeholder { color: var(--text-dim); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0 16px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-home { display: flex; align-items: center; gap: 8px; padding: 8px 14px; color: var(--text-muted); font-size: 0.82rem; font-weight: 500; transition: color .15s, background .15s; border-radius: 0; }
.nav-home:hover, .nav-home.active { color: var(--text); background: var(--card2); }
.nav-home svg { flex-shrink: 0; }

.nav-group-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: none; border: none; color: var(--text-muted); font-size: 0.82rem; font-weight: 600; text-align: left; transition: color .15s, background .15s; }
.nav-group-btn:hover { color: var(--text); background: var(--card2); }
.nav-group.open .nav-group-btn { color: var(--text); }
.nav-group-icon { flex-shrink: 0; display: flex; align-items: center; }
.nav-group-label { flex: 1; }
.nav-group-chevron { transition: transform .2s; display: flex; align-items: center; }
.nav-group.open .nav-group-chevron { transform: rotate(180deg); }

.nav-group-items { display: none; padding: 2px 0 6px 36px; }
.nav-group.open .nav-group-items { display: block; }
.nav-item { display: block; padding: 6px 14px 6px 0; color: var(--text-muted); font-size: 0.8rem; transition: color .15s; border-left: 2px solid transparent; }
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--primary); border-left-color: var(--primary); font-weight: 500; }

/* ── Top ad ── */
.top-ad-bar { padding: 10px 16px; border-bottom: 1px solid var(--border2); display: flex; justify-content: center; background: var(--card); min-height: 52px; align-items: center; }

/* ── Ad placeholders ── */
.ad-placeholder { background: var(--card2); border: 1px dashed var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .05em; }
.ad-leaderboard { width: 728px; max-width: 100%; height: 90px; }
.ad-rect { width: 300px; height: 250px; }
.ad-mobile { width: 320px; height: 50px; }

/* ── Breadcrumb ── */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 10px 20px; font-size: 0.77rem; color: var(--text-muted); border-bottom: 1px solid var(--border2); background: var(--card); }
.bc-link { color: var(--text-muted); transition: color .15s; }
.bc-link:hover { color: var(--primary); }
.bc-current { color: var(--text-dim); }
.bc-sep { display: flex; align-items: center; opacity: .4; }

/* ── Tool container ── */
.tool-container { max-width: 700px; margin: 0 auto; padding: 36px 20px 48px; }
.tool-container.wide { max-width: 900px; }

.tool-header { margin-bottom: 24px; }
.tool-header h1 { font-size: 1.75rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.tool-header p { color: var(--text-muted); font-size: 0.9rem; }

.ad-bar { display: flex; justify-content: center; margin: 0 0 24px; }

/* ── Cards / panels ── */
.panel { background: var(--card2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 12px; }
.panel-title { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }

/* ── Form elements ── */
label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.label-row label { margin-bottom: 0; }
.char-count { font-size: 0.75rem; color: var(--text-muted); }
.char-count.warn { color: var(--red); }

input[type="text"], input[type="number"], input[type="date"], input[type="url"], input[type="email"], input[type="search"], textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; color: var(--text); font-size: 0.88rem; outline: none; transition: border-color .2s; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 120px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
input[type="range"] { appearance: none; width: 100%; height: 4px; background: var(--border); border-radius: 4px; outline: none; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--primary); cursor: pointer; border: none; }

.checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.checkbox-row span { font-size: 0.85rem; color: var(--text); }
.checkbox-row small { font-size: 0.75rem; color: var(--text-muted); margin-left: 4px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-size: 0.88rem; font-weight: 600; border: none; transition: opacity .15s, background .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-secondary { background: var(--card2); color: var(--text-muted); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text); background: var(--border); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { padding: 7px; border-radius: 7px; background: none; border: 1px solid var(--border); color: var(--text-muted); }
.btn-icon:hover { color: var(--text); background: var(--card2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ── Output / result area ── */
.output-box { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; min-height: 80px; font-size: 0.88rem; color: var(--text); white-space: pre-wrap; word-break: break-all; font-family: 'Menlo','Consolas','Monaco',monospace; }
.copy-btn { position: absolute; top: 8px; right: 8px; background: var(--card2); border: 1px solid var(--border); color: var(--text-muted); border-radius: 6px; padding: 4px 8px; font-size: 0.75rem; cursor: pointer; transition: all .15s; }
.copy-btn:hover { color: var(--text); background: var(--border); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

/* ── Stats chips ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 14px; }
.stat-chip { background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.stat-chip .val { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.stat-chip .lbl { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Result highlight ── */
.result-box { background: var(--primary-dim); border: 1px solid rgba(124,58,237,.3); border-radius: 8px; padding: 14px 16px; }
.result-box .result-val { font-size: 2rem; font-weight: 800; color: var(--text); font-family: 'Menlo','Consolas',monospace; }
.result-box .result-lbl { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }

/* ── Tabs ── */
.tab-bar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tab-btn { padding: 6px 14px; border-radius: 6px; font-size: 0.82rem; font-weight: 500; background: none; border: 1px solid var(--border); color: var(--text-muted); transition: all .15s; }
.tab-btn:hover { color: var(--text); border-color: var(--text-dim); }
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── JSON syntax highlight ── */
.json-key { color: #c678dd; }
.json-str { color: #98c379; }
.json-num { color: #d19a66; }
.json-bool { color: #56b6c2; }
.json-null { color: #56b6c2; }

/* ── SERP preview ── */
.serp-box { background: #fff; border: 1px solid #dfe1e5; border-radius: 8px; padding: 14px 18px; }
.serp-url { font-size: 0.78rem; color: #006621; margin-bottom: 2px; }
.serp-title { font-size: 1.15rem; color: #1a0dab; font-weight: 400; line-height: 1.3; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.serp-desc { font-size: 0.82rem; color: #545454; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Status indicator ── */
.status-row { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; margin-top: 6px; }
.status-ok { color: var(--green); }
.status-warn { color: var(--amber); }
.status-err { color: var(--red); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ── Pill badge ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-green { background: rgba(34,197,94,.15); color: var(--green); }
.badge-red { background: rgba(239,68,68,.15); color: var(--red); }
.badge-amber { background: rgba(245,158,11,.15); color: var(--amber); }

/* ── Strength bar ── */
.strength-bar { height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; margin-top: 8px; }
.strength-fill { height: 100%; border-radius: 4px; transition: width .3s, background .3s; }

/* ── Image converter drop zone ── */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 40px 20px; text-align: center; color: var(--text-muted); cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary); background: var(--primary-dim); color: var(--text); }
.dropzone input[type="file"] { display: none; }
.dropzone .dz-icon { font-size: 2.5rem; margin-bottom: 10px; }
.dropzone p { font-size: 0.88rem; }
.dropzone small { font-size: 0.78rem; color: var(--text-dim); }

.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.preview-item { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card2); }
.preview-item img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.preview-item .preview-info { padding: 8px; font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-item a.dl-link { display: block; margin: 0 8px 8px; text-align: center; background: var(--primary); color: #fff; border-radius: 6px; padding: 4px 0; font-size: 0.78rem; font-weight: 600; transition: background .15s; }
.preview-item a.dl-link:hover { background: var(--primary-h); }

/* ── Unit converter grid ── */
.unit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .unit-grid { grid-template-columns: 1fr; } }

/* ── Keyword table ── */
.kw-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.kw-table th { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; }
.kw-table td { padding: 8px 10px; border-bottom: 1px solid var(--border2); color: var(--text); }
.kw-bar-wrap { height: 4px; background: var(--border); border-radius: 4px; overflow: hidden; width: 100%; margin-top: 4px; }
.kw-bar { height: 4px; background: var(--primary); border-radius: 4px; }

/* ── Coming soon ── */
.coming-soon { text-align: center; padding: 60px 20px; }
.coming-soon .cs-icon { font-size: 3rem; margin-bottom: 16px; }
.coming-soon h2 { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.coming-soon p { color: var(--text-muted); font-size: 0.9rem; max-width: 400px; margin: 0 auto; }

/* ── Landing page ── */
.hero { text-align: center; padding: 48px 20px 36px; }
.hero h1 { font-size: 2.2rem; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.hero h1 span { color: var(--primary); }
.hero p { color: var(--text-muted); font-size: 1rem; max-width: 500px; margin: 0 auto 24px; }
.hero-search { max-width: 480px; margin: 0 auto; position: relative; }
.hero-search input { padding: 12px 16px 12px 44px; font-size: 0.95rem; border-radius: 10px; border: 1px solid var(--border); background: var(--card2); }
.hero-search input:focus { border-color: var(--primary); }
.hero-search .hs-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }

.categories-section { padding: 0 20px 48px; max-width: 860px; margin: 0 auto; }
.section-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-bottom: 28px; }
.cat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; transition: border-color .2s, background .2s; }
.cat-card:hover { border-color: var(--primary); background: var(--card2); }
.cat-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.cat-card-top strong { font-size: 0.9rem; color: var(--text); }
.cat-card p { font-size: 0.78rem; color: var(--text-muted); }
.cat-icon-wrap { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.all-cats { }
.all-cat-block { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.all-cat-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border2); background: var(--card2); }
.all-cat-header strong { font-size: 0.85rem; color: var(--text); flex: 1; }
.all-cat-header span { font-size: 0.75rem; color: var(--text-dim); }
.all-cat-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.all-cat-tools a { padding: 9px 16px; font-size: 0.82rem; color: var(--text-muted); display: flex; align-items: center; justify-content: space-between; border-right: 1px solid var(--border2); border-bottom: 1px solid var(--border2); transition: color .15s, background .15s; }
.all-cat-tools a:hover { color: var(--text); background: var(--card2); }

/* ── Footer ── */
.site-footer { border-top: 1px solid var(--border2); padding: 16px 20px 20px; background: var(--card); }
.footer-ad { display: flex; justify-content: center; margin-bottom: 14px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-bottom: 8px; }
.footer-links a { font-size: 0.78rem; color: var(--text-dim); }
.footer-links a:hover { color: var(--text-muted); }
.footer-copy { text-align: center; font-size: 0.72rem; color: var(--text-dim); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; top: 0; height: 100vh; z-index: 300; transition: left .25s ease; width: var(--sidebar-w); }
  .sidebar.open { left: 0; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 299; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: all; }
  .sidebar-close { display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--text-muted); padding: 4px; border-radius: 6px; }
  .sidebar-close:hover { color: var(--text); }
  .mobile-topbar { display: flex; }
  .main-wrap { padding-top: var(--topbar-h); }
  .top-ad-bar { display: none; }
  .ad-leaderboard { width: 320px; height: 50px; }
  .hero h1 { font-size: 1.6rem; }
}
@media (max-width: 600px) {
  .tool-container { padding: 24px 14px 40px; }
  .stat-chip .val { font-size: 1.2rem; }
  .result-box .result-val { font-size: 1.6rem; }
}

/* ── Search highlight ── */
.nav-item.search-hidden { display: none !important; }
.nav-group.search-hidden { display: none !important; }
