:root {
  --primary: #F97316;
  --primary-hover: #EA580C;
  --primary-light: #FFF7ED;
  --primary-dark: #C2410C;
  --accent: #F59E0B;
  --text: #1E293B;
  --text-muted: #64748B;
  --bg: #F8FAFC;
  --white: #FFFFFF;
  --border: #E2E8F0;
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --max-width: 1200px;
  --pdf-color: #C2410C;
  --image-color: #0E7490;
  --text-color: #B45309;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Navbar */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.site-header .container,
.site-footer .container {
  max-width: 100% !important;
  padding: 0 40px;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

@media (max-width: 768px) {
  .site-header .container,
  .site-footer .container {
    padding: 0 16px;
  }
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 2px;
}

.logo span {
  color: var(--primary);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1rem;
  margin-right: 8px;
}

.logo-img {
  width: 32px;
  height: 32px;
  margin-right: 8px;
  border-radius: 8px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1;
  min-height: 36px;
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: var(--primary-light);
}

/* Mega Dropdown */
.mega-dropdown {
  position: relative;
}

.mega-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1;
  min-height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
}

.mega-trigger:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.mega-trigger svg {
  transition: transform 0.2s;
}

.mega-dropdown:hover .mega-trigger svg {
  transform: rotate(180deg);
}

.mega-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  min-width: 200px;
  z-index: 200;
}

.mega-dropdown:hover .mega-menu {
  display: flex;
}

.mega-menu-wide {
  min-width: 700px;
}

.mega-column {
  display: flex;
  flex-direction: column;
  min-width: 140px;
}

.mega-column h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.mega-column a {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
}

.mega-column a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

@media (max-width: 768px) {
  .mega-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0 0 0 16px;
    min-width: 100%;
    flex-direction: column;
    gap: 0;
  }

  .mega-menu-wide {
    min-width: 100%;
  }

  .mega-dropdown:hover .mega-menu {
    display: none;
  }

  .mega-dropdown.open .mega-menu {
    display: flex;
  }

  .mega-trigger {
    width: 100%;
    justify-content: space-between;
  }
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }

  .nav-links.open { display: flex; }
  .mobile-toggle { display: block; }
}

/* Ad placeholders */
.ad-banner {
  background: var(--white);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 24px auto;
  min-height: 90px;
  max-width: var(--max-width);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-sidebar {
  background: var(--white);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  min-height: 600px;
  width: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 80px;
  z-index: 50;
}

#ad-slot-left {
  left: calc(50% - 780px);
}

#ad-slot-right {
  right: calc(50% - 780px);
}

@media (max-width: 1580px) {
  .ad-sidebar { display: none; }
}

/* Hero - light style (homepage) */
.hero {
  text-align: center;
  padding: 64px 20px 48px;
  background: var(--white);
}

.hero .hero-content {
  max-width: 700px;
  margin: 0 auto;
}

.hero .hero-accent {
  width: 48px;
  height: 4px;
  background: var(--primary);
  border-radius: 4px;
  margin: 0 auto 20px;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero h1 span { color: var(--primary); }

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

@media (max-width: 768px) {
  .hero { padding: 40px 16px 32px; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 1rem; }
}

/* Homepage filter tabs */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--white);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* Homepage main container */
.home-main {
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

@media (min-width: 1581px) {
  .home-main {
    max-width: 1240px;
    padding: 0 40px;
  }
}

@media (max-width: 768px) {
  .home-main { padding: 0 16px; }
}

/* Tool Sections */
.tools-section {
  padding: 12px 0;
  display: flex;
  flex-direction: column;
}

.tools-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tools-section h2 a {
  color: var(--text);
}

.tools-section h2 a:hover {
  color: var(--primary);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.25s;
  display: block;
  color: var(--text);
}

.tool-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-lg), inset 4px 0 0 0 var(--primary);
  transform: translateY(-2px);
  color: var(--text);
}

.tool-card .card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 14px;
}

.tool-card .card-icon.pdf { background: #FFF7ED; color: #C2410C; }
.tool-card .card-icon.image { background: #ECFEFF; color: #0E7490; }
.tool-card .card-icon.text { background: #FFFBEB; color: #B45309; }

.tool-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.tool-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.tool-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  margin-top: 16px;
  margin-left: auto;
}

.tool-more-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

body.dark .tool-more-btn { border-color: #334155; color: #94A3B8; }
body.dark .tool-more-btn:hover { border-color: #F97316; color: #F97316; background: #1E3A5F; }

/* Page Header (for tool pages) */
.page-header {
  text-align: center;
  padding: 32px 0 16px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.page-header p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 550px;
  margin: 0 auto;
}

/* Tool Workspace */
.tool-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  padding: 16px 0 32px;
}

@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; }
}

.tool-workspace {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.tool-workspace .drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
}

.tool-workspace .drop-zone:hover,
.tool-workspace .drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.tool-workspace .drop-zone-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.tool-workspace .drop-zone p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.tool-workspace .drop-zone .browse-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.2s;
  background: var(--white);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-secondary:hover:not(:disabled) {
  background: #DDE3FC;
}

.btn-success {
  background: var(--success);
  color: var(--white);
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* File list */
.file-list {
  list-style: none;
  margin: 16px 0;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.file-list .file-name {
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list .file-size {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0 12px;
  white-space: nowrap;
}

.file-list .remove-btn {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.file-list .remove-btn:hover {
  background: #FEE2E2;
}

/* Status / Messages */
.status {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  font-weight: 500;
  font-size: 0.9rem;
  display: none;
}

.status.show { display: block; }

.status.info {
  background: var(--primary-light);
  color: var(--primary);
}

.status.success {
  background: #ECFDF5;
  color: #065F46;
}

.status.error {
  background: #FEF2F2;
  color: #991B1B;
}

.status.loading {
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Preview */
.preview-container {
  margin: 16px 0;
  text-align: center;
}

.preview-container canvas,
.preview-container img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.preview-container .preview-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.preview-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}

@media (max-width: 600px) {
  .preview-compare { grid-template-columns: 1fr; }
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-family: var(--font);
}

.tab-btn:hover {
  color: var(--text);
  background: var(--bg);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Results */
.result-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}

.result-box pre {
  white-space: pre-wrap;
  word-break: break-all;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  background: var(--white);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  max-height: 400px;
  overflow-y: auto;
}

/* Stats cards (for word counter) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* SEO content section */
.seo-content {
  padding: 40px 0;
}

.seo-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.seo-content p {
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.7;
}

.seo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .seo-grid { grid-template-columns: 1fr; }
}

.seo-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.seo-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.seo-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0;
}

.seo-card ul {
  list-style: disc;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.seo-card ul li { margin-bottom: 4px; }

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 32px 0 24px;
}

.site-footer .footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.site-footer .footer-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer .footer-links {
  display: flex;
  gap: 16px;
}

.site-footer .footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer .footer-links a:hover {
  color: var(--primary);
}

.site-footer .footer-bottom {
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.site-footer .footer-bottom p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Footer grid */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 32px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
}

@media (max-width: 400px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.footer-col a {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  transition: color 0.2s;
}

.footer-col a:hover { color: var(--primary); }

.footer-col a.footer-more {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.footer-col a.footer-more:hover { color: var(--primary); }

/* Range slider */
input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
}

.range-value {
  font-weight: 600;
  color: var(--primary);
}

/* Checkbox toggle */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.toggle-group label {
  font-weight: 500;
  font-size: 0.9rem;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* category page special */
.category-hero {
  text-align: center;
  padding: 40px 20px;
}

.category-hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.category-hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Copy button */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
}

.result-box { position: relative; }

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.container {
  max-width: var(--max-width) !important;
}

/* Print */
@media print {
  .site-header, .site-footer, .ad-banner, .ad-sidebar { display: none; }
}

/* Header center + search */
.header-center {
  flex: 1;
  max-width: 360px;
  margin: 0 20px;
}

.search-wrap {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
  margin-top: 4px;
}

.search-results.open { display: block; }

.search-result-item {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--primary-light); color: var(--primary); }

.search-result-item .result-category {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.search-no-results {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .header-center { display: none; }
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s;
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

body.dark .icon-sun { display: block; }
body.dark .icon-moon { display: none; }
body:not(.dark) .icon-sun { display: none; }
body:not(.dark) .icon-moon { display: block; }

/* Dark mode variables */
body.dark {
  --text: #E2E8F0;
  --text-muted: #94A3B8;
  --bg: #0F172A;
  --white: #1E293B;
  --border: #334155;
  --primary-light: #1E3A5F;
  --success: #059669;
  --error: #DC2626;
}

body.dark .site-header { background: #1E293B; }
body.dark .site-footer { background: #1E293B; }
body.dark .nav-links a { color: #94A3B8; }
body.dark .nav-links a:hover,
body.dark .nav-links a.active { color: #F97316; background: #1E3A5F; }
body.dark .mega-trigger { color: #94A3B8; }
body.dark .mega-trigger:hover { color: #F97316; background: #1E3A5F; }
body.dark .mega-menu { background: #1E293B; border-color: #334155; }
body.dark .mega-column h4 { color: #F97316; border-color: #334155; }
body.dark .mega-column a { color: #94A3B8; }
body.dark .mega-column a:hover { color: #F97316; background: #1E3A5F; }
body.dark .search-results { background: #1E293B; border-color: #334155; }
body.dark .search-result-item { color: #E2E8F0; border-color: #334155; }
body.dark .search-result-item:hover { background: #1E3A5F; }
body.dark .toast { background: #E2E8F0; color: #0F172A; }

/* Dark mode overrides for Tailwind utility classes on tool pages */
body.dark { background: #0F172A; color: #E2E8F0; }
body.dark.bg-slate-50 { background-color: #0F172A; }
body.dark.text-slate-800 { color: #E2E8F0; }
body.dark.text-slate-900 { color: #F1F5F9; }

body.dark .bg-white { background-color: #1E293B !important; }
body.dark .border-slate-100 { border-color: #334155 !important; }
body.dark .border-slate-200 { border-color: #334155 !important; }
body.dark .text-slate-900 { color: #F1F5F9 !important; }
body.dark .text-slate-800 { color: #E2E8F0 !important; }
body.dark .text-slate-700 { color: #CBD5E1 !important; }
body.dark .text-slate-600 { color: #94A3B8 !important; }
body.dark .text-slate-500 { color: #94A3B8 !important; }
body.dark .text-slate-400 { color: #64748B !important; }
body.dark .text-slate-300 { color: #94A3B8 !important; }
body.dark .bg-slate-50 { background-color: #1E293B !important; }
body.dark .bg-slate-100 { background-color: #1E293B !important; }
body.dark .hover\:bg-slate-50:hover { background-color: #1E293B !important; }
body.dark .hover\:bg-slate-100:hover { background-color: #1E293B !important; }
body.dark .hover\:bg-orange-100:hover { background-color: #1E3A5F !important; }

body.dark input[type="file"] { color: #94A3B8; }
body.dark select.form-control { background-color: #0F172A; color: #E2E8F0; border-color: #334155; }
body.dark textarea.form-control { background-color: #0F172A; color: #E2E8F0; border-color: #334155; }
body.dark input[type="range"] { background: #334155; }
body.dark input[type="color"] { border-color: #334155; }

body.dark .shadow-xl { box-shadow: 0 10px 25px rgba(0,0,0,0.3) !important; }

body.dark .seo-content h2 { color: #F1F5F9; }
body.dark .seo-content p { color: #94A3B8; }
body.dark .seo-card { background: #1E293B; border-color: #334155; }
body.dark .seo-card h3 { color: #F1F5F9; }
body.dark .seo-card p { color: #94A3B8; }

body.dark .also-try { background: #1E293B; border-color: #334155; }
body.dark .also-try p { color: #94A3B8; }
body.dark .also-try a { color: #F97316; }

body.dark .faq-item { background: #1E293B; border-color: #334155; }
body.dark .faq-question { color: #E2E8F0; }
body.dark .faq-question:hover { background: #0F172A; }
body.dark .faq-answer-inner { color: #94A3B8; }

body.dark .result-box { background: #0F172A; border-color: #334155; }
body.dark .result-box pre { background: #1E293B; border-color: #334155; color: #E2E8F0; }

body.dark .stat-card { background: #1E293B; border-color: #334155; }
body.dark .tool-card { background: #1E293B; border-color: #334155; }
body.dark .tool-card:hover { color: #E2E8F0; }
body.dark .tool-card h3 { color: #F1F5F9; }
body.dark .tool-card p { color: #94A3B8; }

body.dark .category-hero h1 { color: #F1F5F9; }
body.dark .category-hero p { color: #94A3B8; }

/* Breadcrumb */
.breadcrumb {
  padding: 12px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
  transition: color 0.2s;
}

.breadcrumb a:hover { color: var(--primary); }

.breadcrumb .sep {
  margin: 0 6px;
  opacity: 0.5;
}

/* FAQ */
.faq-list {
  margin-top: 16px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font);
  transition: background 0.2s;
}

.faq-question:hover { background: var(--bg); }

.faq-question .faq-arrow {
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: 12px;
}

.faq-item.open .faq-arrow { transform: rotate(180deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer { max-height: 500px; }

.faq-answer-inner {
  padding: 0 16px 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* Related tools */
.related-tools {
  margin-top: 24px;
}

.related-tools h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.related-link {
  display: block;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.related-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow);
}

/* Share button */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.share-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Analytics placeholder */
.analytics-placeholder {
  display: none;
}

/* ============================================
   Generic Tool Page Classes
   ============================================ */

/* Tool page body */
body.tool-page {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Tool card wrapper */
.tool-card-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 28px;
  margin: 24px 0;
}

/* Tool title */
.tool-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
  color: var(--text);
}

/* Tool subtitle */
.tool-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 24px;
}

/* Tool label */
.tool-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

/* Small label */
.tool-label-sm {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

/* Tool input */
.tool-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.tool-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Tool select */
.tool-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.tool-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Tool file input */
.tool-file {
  width: 100%;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.tool-file::file-selector-button {
  margin-right: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 0;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  background: var(--primary-light);
  color: var(--primary-dark);
  transition: background 0.2s;
}

.tool-file::file-selector-button:hover {
  background: var(--primary);
  color: var(--white);
}

/* Tool controls area */
.tool-controls {
  space-y: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

/* Tool button primary */
.tool-btn {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: var(--primary);
  color: var(--white);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  margin-top: 16px;
}

.tool-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.tool-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tool-btn-reset {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  gap: 6px;
  padding: 10px 24px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  margin-top: 16px;
  background: transparent !important;
}

.tool-btn-reset:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light) !important;
}

body.dark .tool-btn-reset { border-color: #334155; color: #94A3B8; }
body.dark .tool-btn-reset:hover:not(:disabled) { border-color: #F97316; color: #F97316; background: #1E3A5F !important; }

/* Copy button */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  line-height: 1.4;
}

.copy-btn:hover {
  background: var(--primary-hover);
}

.copy-btn.copied,
.copy-btn:active {
  background: #16a34a;
}

body.dark .copy-btn { color: #fff; }

/* Output box */
.output-box {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-secondary, #f1f5f9);
  border-bottom: 1px solid var(--border);
}

.output-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
}

.output-content {
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: var(--bg);
  min-height: 60px;
  max-height: 400px;
  overflow-y: auto;
}

body.dark .output-header {
  background: #1e293b;
}

/* Info notice (warning/info banner) */
.info-notice {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 0.8rem;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.4;
}

body.dark .info-notice {
  background: #2a1f0a;
  border-color: #b45309;
  color: #fbbf24;
}

/* Section boxes */
.section-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.section-box:last-child {
  margin-bottom: 0;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 16px 0;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
  display: inline-block;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* Section-box inner field spacing override */
.section-box .tool-label {
  font-size: 0.75rem;
}

.section-box .space-y-4 > div {
  margin-bottom: 0;
}

.tool-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .tool-grid-3 { grid-template-columns: 1fr; }
}

/* Output text formatting */
.output-content strong {
  color: var(--primary);
  font-weight: 700;
}

.output-content .output-section-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
  margin-top: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.output-content .output-section-label:first-child {
  margin-top: 0;
}

/* Also try section */
.also-try {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 0.85rem;
}

.also-try p {
  color: var(--text-muted);
  margin: 0;
}

.also-try a {
  color: var(--primary);
  font-weight: 500;
}

/* Status message */
.tool-status {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 16px;
  display: none;
}

.tool-status.show { display: block; }
.tool-status.success { color: var(--success); }
.tool-status.error { color: var(--error); }
.tool-status.loading { color: var(--primary); }

/* Grid layout for tool controls */
.tool-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 500px) {
  .tool-grid-2 { grid-template-columns: 1fr; }
}

/* ============================================
   How To Use Section
   ============================================ */
.how-to-use {
  margin: 32px 0;
}

.how-to-use h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.how-to-use .steps {
  list-style: none;
  counter-reset: steps;
  padding: 0;
}

.how-to-use .steps li {
  counter-increment: steps;
  position: relative;
  padding: 14px 16px 14px 52px;
  margin-bottom: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.how-to-use .steps li::before {
  content: counter(steps);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 26px;
  height: 26px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

/* ============================================
   Progress Bar
   ============================================ */
.progress-wrap {
  margin: 16px 0;
  text-align: center;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Blog section on tool pages (injected via component) */
.blog-section { margin: 32px 0; }

.blog-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
}

.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.blog-tag {
  display: inline-block;
  padding: 6px 16px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s;
}

.blog-tag:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

body.dark .blog-tag {
  background: #1E3A5F;
  color: #93C5FD;
}

body.dark .blog-tag:hover {
  background: var(--primary);
  color: #fff;
}

/* ============================================
   Blog Styles
   ============================================ */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin: 32px 0;
}

@media (max-width: 500px) {
  .blog-grid { grid-template-columns: 1fr; }
}

.blog-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--text);
  transition: all 0.25s;
}

.blog-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  color: var(--text);
}

.blog-card-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  margin-bottom: 12px;
}

.blog-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}

.blog-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.blog-card-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Blog article */
.blog-article {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 32px;
  margin: 24px 0;
}

.blog-article .blog-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.blog-article h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 24px;
  line-height: 1.3;
}

.blog-article h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 28px 0 12px;
}

.blog-article p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 16px;
}

.blog-article a {
  color: var(--primary);
  font-weight: 500;
}

.blog-article a:hover {
  text-decoration: underline;
}

/* ============================================
   Action buttons row (share + copy)
   ============================================ */
.tool-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Blog dark mode */
body.dark .blog-card { background: #1E293B; border-color: #334155; }
body.dark .blog-card h2 { color: #F1F5F9; }
body.dark .blog-card p { color: #94A3B8; }
body.dark .blog-card:hover { border-color: #F97316; }
body.dark .blog-article h1 { color: #F1F5F9; }
body.dark .blog-article h2 { color: #F1F5F9; }
body.dark .blog-article p { color: #94A3B8; }
body.dark .blog-card-tag { background: #1E3A5F; color: #93C5FD; }

@media print {
  .site-header, .site-footer, .ad-banner, .ad-sidebar { display: none; }
}
