:root {
  --blue-50: #eff6ff; --blue-100: #dbeafe; --blue-600: #2563eb; --blue-700: #1d4ed8;
  --gray-50: #f8fafc; --gray-100: #f1f5f9; --gray-200: #e2e8f0; --gray-300: #cbd5e1; 
  --gray-600: #475569; --gray-700: #334155; --gray-800: #1e293b; --gray-900: #0f172a;
  --green-400: #4ade80; --green-500: #22c55e; --red-500: #ef4444;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-sans); color: var(--gray-800); background: var(--gray-50); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; transition: color 0.2s; }
ul { list-style: none; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* Utility Classes */
.text-center { text-align: center; }
.text-blue { color: var(--blue-600); }
.bg-white { background: #fff; }
.bg-gray { background: var(--gray-50); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; } .gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; } .mt-8 { margin-top: 2rem; } .mb-4 { margin-bottom: 1rem; } .mb-8 { margin-bottom: 2rem; }
.w-full { width: 100%; }

/* Navbar */
.navbar { background: #fff; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 50; }
.navbar .container { display: flex; justify-content: space-between; align-items: center; height: 4rem; }
.brand { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); display: flex; align-items: center; gap: 0.5rem; }
.brand svg { width: 28px; height: 28px; color: var(--blue-600); }
.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a { font-weight: 500; color: var(--gray-600); font-size: 0.95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--blue-600); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.75rem 1.5rem; font-weight: 600; font-size: 1rem; border-radius: 0.5rem; cursor: pointer; transition: all 0.2s; border: none; gap: 0.5rem; }
.btn-primary { background: var(--blue-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--blue-700); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { border: 1px solid var(--gray-300); background: #fff; color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-50); color: var(--gray-900); }

/* Mobile Menu */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.menu-toggle svg { width: 24px; height: 24px; color: var(--gray-700); }
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 4rem; left: 0; width: 100%; background: #fff; padding: 1.5rem; border-bottom: 1px solid var(--gray-200); box-shadow: var(--shadow-md); gap: 1rem; }
  .nav-links.show { display: flex; }
  .menu-toggle { display: block; }
}

/* Sections */
.hero { padding: 6rem 0 4rem; text-align: center; background: linear-gradient(180deg, #fff 0%, var(--gray-50) 100%); }
.hero h1 { font-size: 3.5rem; font-weight: 800; color: var(--gray-900); margin-bottom: 1.5rem; line-height: 1.1; letter-spacing: -0.02em; }
.hero p { font-size: 1.25rem; color: var(--gray-600); max-width: 700px; margin: 0 auto 2.5rem; }
.hero-btns { display: flex; justify-content: center; gap: 1rem; }
@media (max-width: 640px) { .hero h1 { font-size: 2.5rem; } .hero-btns { flex-direction: column; } }

.section { padding: 5rem 0; }
.section-title { text-align: center; font-size: 2.5rem; font-weight: 800; color: var(--gray-900); margin-bottom: 3rem; }

/* Grid & Cards */
.grid { display: grid; gap: 2rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }

.card { background: #fff; border: 1px solid var(--gray-200); border-radius: 1rem; padding: 2rem; box-shadow: var(--shadow-sm); transition: all 0.3s ease; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--blue-100); }
.card-icon { width: 3.5rem; height: 3.5rem; border-radius: 0.75rem; display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem; }
.card-icon.blue { background: var(--blue-50); color: var(--blue-600); }
.card-icon svg { width: 28px; height: 28px; }
.card h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; color: var(--gray-900); }
.card p { color: var(--gray-600); font-size: 1rem; }

/* Stats */
.stat-card { text-align: center; padding: 2rem; background: #fff; border-radius: 1rem; border: 1px solid var(--gray-200); }
.stat-number { font-size: 3rem; font-weight: 800; color: var(--blue-600); margin-bottom: 0.5rem; }
.stat-label { font-size: 1rem; color: var(--gray-600); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }

/* Tool Layout */
.tool-layout { display: grid; grid-template-columns: 2fr 1.2fr; gap: 2rem; }
@media (max-width: 1024px) { .tool-layout { grid-template-columns: 1fr; } }
.panel { background: #fff; border: 1px solid var(--gray-200); border-radius: 1rem; padding: 2rem; box-shadow: var(--shadow-sm); }
.panel-dark { background: var(--gray-900); color: #fff; border: none; box-shadow: var(--shadow-lg); position: sticky; top: 5.5rem; }
.panel-dark h3 { font-size: 1.125rem; font-weight: 600; padding-bottom: 1rem; border-bottom: 1px solid var(--gray-700); margin-bottom: 1.5rem; display: flex; justify-content: space-between; align-items: center; }

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--gray-700); }
.form-control { w-full; padding: 0.75rem 1rem; border: 1px solid var(--gray-300); border-radius: 0.5rem; font-family: inherit; font-size: 1rem; transition: all 0.2s; color: var(--gray-900); width: 100%; background: #fff; }
.form-control:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px var(--blue-50); }
textarea.form-control { resize: vertical; min-height: 100px; font-family: monospace; font-size: 0.9rem; }
.radio-group { display: flex; gap: 1.5rem; }
.radio-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: 500; }
.radio-label input { width: 1rem; height: 1rem; accent-color: var(--blue-600); }

/* Tool Output & Counters */
.output-pre { background: var(--gray-800); color: var(--green-400); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap; word-break: break-all; margin-top: 1rem; font-size: 0.875rem; padding: 1.5rem; border-radius: 0.5rem; min-height: 250px; overflow-y: auto; max-height: 500px; border: 1px solid var(--gray-700); }
.tool-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.btn-icon { padding: 0.5rem; background: var(--gray-700); color: #fff; border: none; border-radius: 0.5rem; cursor: pointer; transition: background 0.2s; display: flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: var(--gray-600); }
.btn-icon svg { width: 18px; height: 18px; }
.counters { display: flex; justify-content: space-between; font-size: 0.875rem; color: var(--gray-400); margin-top: 1rem; }

/* Custom Rules Dynamic Fields */
.custom-rule-item { display: flex; gap: 0.75rem; margin-bottom: 0.75rem; align-items: center; }
.btn-danger { color: var(--red-500); background: none; border: none; cursor: pointer; padding: 0.5rem; }
.btn-danger:hover { color: #dc2626; }
@media (max-width: 640px) { .custom-rule-item { flex-direction: column; align-items: stretch; } }

/* Footer */
.footer { background: #fff; border-top: 1px solid var(--gray-200); padding: 4rem 0 2rem; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer h4 { font-weight: 700; margin-bottom: 1.5rem; color: var(--gray-900); }
.footer p { color: var(--gray-600); font-size: 0.9rem; line-height: 1.6; }
.footer ul li { margin-bottom: 0.75rem; }
.footer ul a { color: var(--gray-600); font-size: 0.9rem; }
.footer ul a:hover { color: var(--blue-600); }
.footer-bottom { text-align: center; padding-top: 2rem; border-top: 1px solid var(--gray-200); color: var(--gray-500); font-size: 0.875rem; }

/* Prose / Content Pages */
.prose { max-width: 800px; margin: 0 auto; color: var(--gray-800); }
.prose-lg { max-width: 900px; }
.prose h1 { font-size: 2.5rem; font-weight: 800; color: var(--gray-900); margin-bottom: 1.5rem; line-height: 1.2; }
.prose h2 { font-size: 2rem; font-weight: 700; margin: 3rem 0 1.5rem; color: var(--gray-900); }
.prose h3 { font-size: 1.5rem; font-weight: 600; margin: 2rem 0 1rem; color: var(--gray-900); }
.prose p { margin-bottom: 1.5rem; font-size: 1.125rem; line-height: 1.7; }
.prose ul, .prose ol { margin-bottom: 1.5rem; padding-left: 1.5rem; font-size: 1.125rem; line-height: 1.7; }
.prose li { margin-bottom: 0.5rem; }
.prose a { color: var(--blue-600); text-decoration: underline; }
.prose a:hover { color: var(--blue-700); }
.prose code { background: var(--gray-100); padding: 0.2em 0.4em; border-radius: 0.25rem; font-size: 0.9em; font-family: monospace; color: var(--gray-900); }
.prose pre { background: var(--gray-900); color: #fff; padding: 1.5rem; border-radius: 0.5rem; overflow-x: auto; margin-bottom: 1.5rem; font-family: monospace; }
.prose blockquote { border-left: 4px solid var(--blue-600); padding-left: 1rem; margin: 2rem 0; font-style: italic; color: var(--gray-600); }

/* FAQ Section */
.faq-item { border-bottom: 1px solid var(--gray-200); padding: 1.5rem 0; }
.faq-q { font-weight: 700; font-size: 1.125rem; color: var(--gray-900); margin-bottom: 0.75rem; display: flex; justify-content: space-between; cursor: pointer; }
.faq-a { color: var(--gray-600); display: none; }
.faq-a.open { display: block; }
