/* ===== ToolCrank - Design System ===== */

/* --- CSS Custom Properties --- */
:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --accent: #7C3AED;
  --accent-dark: #6D28D9;
  --accent-light: #EDE9FE;
  --success: #059669;
  --success-light: #D1FAE5;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --error: #DC2626;
  --error-light: #FEE2E2;
  --dark: #0F172A;
  --dark-700: #1E293B;
  --dark-600: #334155;
  --dark-500: #475569;
  --gray: #64748B;
  --gray-light: #94A3B8;
  --gray-lighter: #CBD5E1;
  --gray-lightest: #E2E8F0;
  --light: #F8FAFC;
  --white: #FFFFFF;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.05);
  --shadow: 0 1px 3px rgba(15,23,42,0.1), 0 1px 2px rgba(15,23,42,0.06);
  --shadow-md: 0 4px 6px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.06);
  --shadow-lg: 0 10px 15px rgba(15,23,42,0.1), 0 4px 6px rgba(15,23,42,0.05);
  --shadow-xl: 0 20px 25px rgba(15,23,42,0.1), 0 8px 10px rgba(15,23,42,0.04);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --max-width: 1200px;
  --transition: 150ms ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--dark);
  background: var(--light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.tool-page {
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, var(--light) 260px);
}

body.tool-page.tool-page--positioning {
  visibility: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--dark);
}
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.125rem; }

p { margin-bottom: 1rem; color: var(--dark-600); }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 4rem 0;
}

.section--alt {
  background: var(--white);
}

/* Reserve space for JS-injected header/footer to prevent CLS */
#header-mount { min-height: 65px; }
#footer-mount { min-height: 300px; }

/* --- Header / Navigation --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-lightest);
  padding: 0;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
  text-decoration: none;
}

.logo svg {
  width: 32px;
  height: 32px;
}

.logo span.gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav { display: flex; align-items: center; gap: 0.25rem; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav a {
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--dark-600);
  transition: all var(--transition);
}

.nav a:hover, .nav a.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  line-height: 1;
  color: var(--dark);
  flex-shrink: 0;
}

.nav-toggle svg { width: 24px; height: 24px; }

.header-search-btn {
  min-height: 42px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-search-btn svg {
  width: 16px;
  height: 16px;
}

/* --- Nav Dropdowns --- */
.nav-dropdown {
  position: relative;
  padding-bottom: 0.5rem;
  margin-bottom: -0.5rem;
}
.nav-dropdown > .nav-drop-toggle {
  display: flex; align-items: center; gap: 0.25rem;
  padding: 0.5rem 0.875rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500; color: var(--dark-600);
  cursor: pointer; transition: all var(--transition); background: none; border: none; font-family: inherit;
}
.nav-dropdown > .nav-drop-toggle:hover, .nav-dropdown.open > .nav-drop-toggle, .nav-dropdown:focus-within > .nav-drop-toggle { color: var(--primary); background: var(--primary-light); }
.nav-drop-toggle svg { width: 14px; height: 14px; transition: transform 0.2s; }
.nav-dropdown:hover .nav-drop-toggle svg, .nav-dropdown:focus-within .nav-drop-toggle svg, .nav-dropdown.open .nav-drop-toggle svg { transform: rotate(180deg); }
.nav-drop-menu {
  display: none; position: absolute; top: calc(100% - 1px); left: 0; min-width: 220px;
  background: var(--white); border: 1px solid var(--gray-lightest); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 0.5rem 0; z-index: 200; margin-top: 0;
}
.nav-dropdown:hover .nav-drop-menu, .nav-dropdown:focus-within .nav-drop-menu, .nav-dropdown.open .nav-drop-menu { display: block; }
.nav-drop-menu a {
  display: block; padding: 0.5rem 1rem; font-size: 0.85rem; font-weight: 500;
  color: var(--dark-600); transition: all var(--transition);
}
.nav-drop-menu a:hover { background: var(--primary-light); color: var(--primary); }

/* --- Hero --- */
.hero {
  padding: 4rem 0 2rem;
  text-align: center;
  background: linear-gradient(180deg, var(--white) 0%, var(--light) 100%);
}

.hero h1 {
  margin-bottom: 1rem;
}

.hero .subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--gray);
  max-width: 640px;
  margin: 0 auto 1.25rem;
}

.hero .badge {
  display: none;
}

/* --- Hero Search Bar --- */
.hero-search {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}
.hero-search input[type="text"] {
  display: block;
  width: 100%;
  min-height: 60px;
  padding: 1rem 1.25rem 1rem 4.25rem;
  border: 2px solid var(--gray-lightest); border-radius: 999px;
  font-size: 1.1rem; font-weight: 500; font-family: inherit;
  line-height: 1.35;
  background: var(--white); transition: all 0.2s;
  box-shadow: var(--shadow);
}
.hero-search input[type="text"]:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1), var(--shadow-md);
}
.hero-search input[type="text"]::placeholder { color: var(--gray-light); }
.hero-search-icon {
  position: absolute; left: 1.35rem; top: 50%; transform: translateY(-50%);
  width: 1.125rem;
  height: 1.125rem;
  color: var(--gray-light); pointer-events: none;
}

/* --- Tool Cards Grid --- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.tool-card {
  background: var(--white);
  border: 1px solid var(--gray-lightest);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  color: inherit;
}

.tool-card .icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.tool-card .icon--blue { background: var(--primary-light); color: var(--primary); }
.tool-card .icon--violet { background: var(--accent-light); color: var(--accent); }
.tool-card .icon--green { background: var(--success-light); color: var(--success); }
.tool-card .icon--amber { background: var(--warning-light); color: var(--warning); }

.tool-card h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--gray);
  flex: 1;
  margin-bottom: 1rem;
}

.tool-card .tag {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
  padding: 0.25rem 0.625rem;
  background: var(--light);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.tool-card .tag--seo { color: #1e40af; background: var(--primary-light); }
.tool-card .tag--writing { color: #5B21B6; background: var(--accent-light); }

/* --- Tool Page Layout --- */
.tool-header {
  padding: 1.75rem 0 1rem;
  background: var(--white);
  border-bottom: 1px solid var(--gray-lightest);
}

.tool-header h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 0.5rem;
}

.tool-header .desc {
  color: var(--gray);
  font-size: 1.05rem;
  max-width: 700px;
}

.tool-body {
  padding: 1rem 0 3rem;
}

body.tool-page .tool-header {
  padding: 1.35rem 0 0.85rem;
}

body.tool-page .tool-header h1 {
  font-size: clamp(1.4rem, 2.7vw, 1.85rem);
}

body.tool-page .tool-header .desc {
  font-size: 0.98rem;
  max-width: 680px;
}

body.tool-page .tool-body {
  padding: 0.75rem 0 2.25rem;
}

body.tool-page .tool-entry-view {
  --tool-entry-inline-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  height: 100svh;
  min-height: 100svh;
}

body.tool-page .tool-entry-main-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}

body.tool-page .tool-entry-view--natural-flow .tool-entry-main-shell {
  flex: 0 0 auto;
  overflow: visible;
}

body.tool-page .tool-entry-main {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  width: 100%;
  transform-origin: top center;
}

body.tool-page .tool-entry-view--sticky-bottom {
  height: auto;
  min-height: 100svh;
}

body.tool-page .tool-entry-view--sticky-bottom .tool-entry-main-shell {
  flex: 0 0 auto;
  overflow: visible;
}

body.tool-page .tool-entry-view--sticky-bottom .tool-entry-main {
  transform: none !important;
  width: 100% !important;
}

body.tool-page .tool-entry-main > .container,
body.tool-page .tool-entry-main > .section {
  width: 100%;
}

body.tool-page .tool-entry-inline-holder {
  width: 100%;
}

body.tool-page .tool-entry-inline-holder .ad-slot--inline {
  margin-inline: auto;
}

body.tool-page .tool-entry-inline-holder .ad-slot--inline.is-pinned {
  margin: 0;
  background: var(--white);
}

body.tool-page .tool-entry-view .ad-slot--header,
body.tool-page .tool-entry-view .ad-slot--inline {
  margin: 0;
}

body.tool-page .tool-entry-view .ad-slot--header {
  width: min(100%, 728px);
  align-self: center;
  margin-inline: auto;
}

body.tool-page .tool-entry-view--legacy {
  gap: 0.75rem;
  margin: 0;
}

body.tool-page .tool-entry-view--natural-flow .tool-entry-inline-holder {
  margin-top: auto;
}

body.tool-page .tool-entry-view--legacy .tool-entry-main {
  gap: 0;
}

body.tool-page .tool-entry-view--legacy .tool-entry-main > .section {
  padding-top: 0;
  padding-bottom: 0;
}

body.tool-page .tool-entry-primary-section + .section {
  padding-top: 1.5rem;
}

body.tool-page .hero.tool-header--legacy {
  text-align: left;
  background: var(--white);
  border-bottom: 1px solid var(--gray-lightest);
}

body.tool-page .hero.tool-header--legacy h1 {
  font-size: clamp(1.4rem, 2.7vw, 1.85rem);
  margin-bottom: 0.5rem;
}

body.tool-page .hero.tool-header--legacy .subtitle {
  font-size: 0.98rem;
  max-width: 680px;
  margin: 0;
}

.hero[style*="padding:4rem 0 2rem"] {
  padding: 2.75rem 0 1rem !important;
}

body.tool-page .hero[style*="padding:4rem 0 2rem"] {
  padding: 2rem 0 0.85rem !important;
}

body.tool-page .hero .subtitle {
  margin-bottom: 0.9rem;
}

.hero + .container + .section {
  padding-top: 1.5rem;
}

body.tool-page .hero + .container + .section {
  padding-top: 1rem;
  padding-bottom: 2.25rem;
}

body.tool-page .tool-entry-view--legacy + .section,
body.tool-page .tool-entry-view--legacy + .section.section--alt {
  padding-top: 2rem;
}

.tool-body > .container > .ad-slot--header:first-child {
  margin-top: 0;
  margin-bottom: 1rem;
}

body.tool-page .tool-body > .container > .ad-slot--header:first-child {
  margin-bottom: 0.875rem;
}

.tool-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

body.tool-page .tool-layout {
  gap: 1.125rem;
}

.tool-layout > * {
  min-width: 0;
}

.tool-layout--single {
  grid-template-columns: 1fr;
  max-width: 800px;
}

.tool-layout--balanced {
  align-items: stretch;
}

.tool-layout--balanced > .tool-panel {
  height: 100%;
}

.tool-layout__stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100%;
}

body.tool-page .tool-layout__stack {
  gap: 1.125rem;
}

.tool-layout__stack > .tool-panel {
  margin-bottom: 0 !important;
}

.tool-panel {
  background: var(--white);
  border: 1px solid var(--gray-lightest);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tool-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--gray-lightest);
  background: var(--light);
}

.tool-panel__header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dark-600);
}

.tool-panel__body {
  padding: 1.25rem;
}

body.tool-page .tool-panel__header {
  padding: 0.75rem 1rem;
}

body.tool-page .tool-panel__header h3 {
  font-size: 0.8125rem;
}

body.tool-page .tool-panel__body {
  padding: 1rem;
}

.tool-panel--fill-textarea {
  display: flex;
  flex-direction: column;
}

.tool-panel--fill-textarea > .tool-panel__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.tool-panel--fill-textarea textarea {
  flex: 1 1 auto;
}

.tool-panel--fill-textarea .btn {
  align-self: flex-start;
}

.tool-panel--fill-output {
  display: flex;
  flex-direction: column;
}

.tool-panel--fill-output > .tool-panel__body {
  display: flex;
  flex: 1 1 auto;
}

.tool-output-fill {
  flex: 1 1 auto;
  min-height: 100%;
}

/* --- Forms & Inputs --- */
textarea, input[type="text"], input[type="url"], input[type="email"], input[type="number"], select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-lightest);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--dark);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

textarea:focus, input[type="text"]:focus, input[type="url"]:focus, input[type="email"]:focus, input[type="number"]:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

textarea {
  resize: vertical;
  min-height: 200px;
  line-height: 1.7;
}

body.tool-page textarea,
body.tool-page input[type="text"],
body.tool-page input[type="url"],
body.tool-page input[type="email"],
body.tool-page input[type="number"],
body.tool-page select {
  font-size: 0.9rem;
}

body.tool-page textarea {
  min-height: 180px;
  line-height: 1.65;
}

textarea.mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--dark-600);
  margin-bottom: 0.375rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid--triple {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--gray-light);
  margin-top: 0.25rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

body.tool-page .btn {
  padding: 0.5625rem 1.125rem;
}

body.tool-page .btn--sm {
  padding: 0.375rem 0.75rem;
}

body.tool-page .btn--lg {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
}

.btn--primary {
  background: var(--primary);
  color: var(--white);
}
.btn--primary:hover { background: var(--primary-dark); color: var(--white); }

.btn--accent {
  background: var(--accent);
  color: var(--white);
}
.btn--accent:hover { background: var(--accent-dark); color: var(--white); }

.btn--outline {
  background: transparent;
  color: var(--dark-600);
  border: 1px solid var(--gray-lightest);
}
.btn--outline:hover { border-color: var(--primary); color: var(--primary); }

.btn--ghost {
  background: transparent;
  color: var(--gray);
  padding: 0.5rem 0.75rem;
}
.btn--ghost:hover { color: var(--primary); background: var(--primary-light); }

.btn--sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn--lg { padding: 0.875rem 2rem; font-size: 1rem; }

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* --- Code Output --- */
.code-output {
  position: relative;
  background: var(--dark);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-output pre {
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #E2E8F0;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-output .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255,255,255,0.1);
  color: var(--gray-light);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition);
}

.code-output .copy-btn:hover { background: rgba(255,255,255,0.2); color: var(--white); }
.code-output .copy-btn.copied { background: var(--success); color: var(--white); }

/* --- Stats/Metrics --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

.stats-grid--triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  background: var(--light);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

body.tool-page .stat-card {
  padding: 0.875rem;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-card .label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--gray-lightest);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-lightest);
}

th {
  background: var(--light);
  font-weight: 600;
  color: var(--dark-600);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(37,99,235,0.02); }

/* --- Progress / Gauge --- */
.gauge {
  height: 8px;
  background: var(--gray-lightest);
  border-radius: 999px;
  overflow: hidden;
}

.gauge__fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.gauge__fill--easy { background: var(--success); }
.gauge__fill--medium { background: var(--warning); }
.gauge__fill--hard { background: var(--error); }

/* --- Tags / Badges --- */
.badge-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge-pill {
  display: inline-flex;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pill--blue { background: var(--primary-light); color: #1e40af; }
.badge-pill--violet { background: var(--accent-light); color: #5B21B6; }
.badge-pill--green { background: var(--success-light); color: var(--success); }

/* --- SERP Preview --- */
.serp-preview {
  background: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-lightest);
  font-family: Arial, sans-serif;
}

.serp-preview .serp-url {
  font-size: 0.8125rem;
  color: #202124;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.25rem;
}

.serp-preview .serp-url .favicon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gray-lightest);
}

.serp-preview .serp-title {
  font-size: 1.25rem;
  color: #1A0DAB;
  font-weight: 400;
  margin-bottom: 0.25rem;
  cursor: pointer;
  line-height: 1.3;
}

.serp-preview .serp-title:hover { text-decoration: underline; }

.serp-preview .serp-desc {
  font-size: 0.875rem;
  color: #4D5156;
  line-height: 1.5;
}

/* --- Ad Placeholders --- */
.ad-slot {
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray);
  background: rgba(255,255,255,0.7);
  border: 1px dashed var(--gray-lighter);
  overflow: hidden;
}

.ad-slot--header {
  max-width: 728px;
  margin: 1rem auto;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-slot--sidebar {
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-slot--inline {
  margin: 2rem 0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.tool-page .ad-slot--header {
  margin: 0.75rem auto 0.875rem;
}

body.tool-page .ad-slot--inline {
  margin: 1rem 0 1.25rem;
}

/* --- Affiliate / CTA --- */
.cta-box {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  color: var(--white);
  text-align: center;
}

.cta-box h3 { color: var(--white); margin-bottom: 0.75rem; font-size: 1.5rem; }
.cta-box p { color: rgba(255,255,255,0.85); margin-bottom: 1.5rem; }
.cta-box .btn { background: var(--white); color: var(--primary); }
.cta-box .btn:hover { background: var(--light); }

body.tool-page .cta-box {
  padding: 2rem;
}

.affiliate-card {
  background: var(--white);
  border: 1px solid var(--gray-lightest);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: box-shadow var(--transition);
}

.affiliate-card:hover { box-shadow: var(--shadow-md); }

.affiliate-card--subtle {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.96) 100%);
  padding: 1.25rem;
}

.affiliate-card--centered {
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
  max-width: 680px;
  margin: 0 auto;
  padding: 1.75rem;
  text-align: center;
  background:
    radial-gradient(circle at top, rgba(37,99,235,0.12), transparent 58%),
    linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(248,250,252,0.96) 100%);
  box-shadow: var(--shadow-sm);
}

.affiliate-card__eyebrow {
  display: inline-block;
  margin-bottom: 0.375rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray);
}

.affiliate-card__title {
  margin-bottom: 0.5rem;
}

.affiliate-card__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.affiliate-card__status {
  align-self: flex-start;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--gray-lightest);
  border-radius: 999px;
  background: var(--light);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray);
  white-space: nowrap;
}

.affiliate-card--centered .affiliate-card__status {
  align-self: center;
  background: var(--primary-light);
  border-color: rgba(37,99,235,0.15);
  color: var(--primary-dark);
}

.affiliate-card .af-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  background: var(--light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--gray);
  flex-shrink: 0;
}

.affiliate-card .af-info { flex: 1; }
.affiliate-card .af-info h4 { margin-bottom: 0.25rem; }
.affiliate-card .af-info p { font-size: 0.85rem; margin-bottom: 0; }

.affiliate-card--centered .af-logo {
  width: 68px;
  height: 68px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

.affiliate-card--centered .af-info {
  flex: 0 1 auto;
  max-width: 560px;
}

.affiliate-card--centered .af-info h4 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

.affiliate-card--centered .af-info p {
  font-size: 0.95rem;
  line-height: 1.7;
}

/* --- Email Capture --- */
.email-capture {
  background: var(--dark);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  text-align: center;
  color: var(--white);
}

.email-capture h3 { color: var(--white); margin-bottom: 0.5rem; }
.email-capture p { color: var(--gray-light); margin-bottom: 1.25rem; }

.email-form {
  display: flex;
  gap: 0.5rem;
  max-width: 440px;
  margin: 0 auto;
}

.email-form input {
  flex: 1;
  border: 1px solid var(--dark-600);
  background: var(--dark-700);
  color: var(--white);
}

.email-form input:focus {
  border-color: var(--primary);
}

/* --- Footer --- */
.footer {
  background: var(--dark);
  color: var(--gray-light);
  padding: 3rem 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer h4 {
  color: var(--white);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.footer p { font-size: 0.875rem; color: var(--gray-light); }

.footer ul { list-style: none; }

.footer li { margin-bottom: 0.5rem; }

.footer a { color: var(--gray-light); font-size: 0.875rem; }
.footer a:hover { color: var(--white); }

.footer-bottom {
  border-top: 1px solid var(--dark-600);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--gray-light);
  padding: 0 0 0.625rem;
  flex-wrap: wrap;
}

.breadcrumbs a { color: var(--gray); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { color: var(--gray-lighter); }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-lightest);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-sans);
}

.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* --- Slider --- */
.range-slider {
  width: 100%;
  margin: 0.5rem 0;
}

.range-scale {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: center;
  padding-inline: 10px;
}

.range-scale span:first-child { text-align: left; }
.range-scale span:nth-child(2) { text-align: center; }
.range-scale span:last-child { text-align: right; }

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--gray-lightest);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* --- Tooltip --- */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: var(--white);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.tooltip:hover::after { opacity: 1; }

/* --- Utilities --- */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--gray); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-lightest);
    flex-direction: column;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
  }

  .nav.open { display: flex; }
  .nav-toggle { display: inline-flex; }
  .header-actions { margin-left: auto; }

  .nav-dropdown { padding-bottom: 0; margin-bottom: 0; }
  .nav-drop-menu { position: static; box-shadow: none; border: none; margin: 0; padding: 0 0 0 1rem; }
  .nav-dropdown:hover .nav-drop-menu { display: none; }
  .nav-dropdown.open .nav-drop-menu { display: block; }

  .tool-layout { grid-template-columns: 1fr; }

  .footer-grid { grid-template-columns: 1fr 1fr; }

  .form-row { grid-template-columns: 1fr; }

  .email-form { flex-direction: column; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .hero { padding: 3rem 0 2rem; }

  .section { padding: 2.5rem 0; }

  .tool-header { padding: 1.5rem 0 1rem; }

  .hero[style*="padding:4rem 0 2rem"] {
    padding: 2rem 0 0.75rem !important;
  }

  .hero + .container + .section {
    padding-top: 1rem;
  }

  .tool-body {
    padding-top: 0.75rem;
  }

  body.tool-page .tool-header {
    padding: 1.2rem 0 0.75rem;
  }

  body.tool-page .tool-body {
    padding-top: 0.625rem;
    padding-bottom: 2rem;
  }

  body.tool-page .tool-entry-view {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  body.tool-page .tool-entry-view > * + * {
    margin-top: 0.875rem;
  }

  body.tool-page .tool-entry-main-shell {
    display: block;
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
  }

  body.tool-page .tool-entry-main {
    display: block;
    transform: none !important;
    width: 100% !important;
  }

  body.tool-page .tool-entry-inline-holder {
    min-height: 0 !important;
  }

  body.tool-page .tool-entry-view--natural-flow .tool-entry-inline-holder {
    margin-top: 0;
  }

  body.tool-page .tool-entry-inline-holder .ad-slot--inline,
  body.tool-page .tool-entry-inline-holder .ad-slot--inline.is-pinned {
    position: static !important;
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    z-index: auto !important;
  }

  body.tool-page .tool-entry-view + .mt-4,
  body.tool-page .tool-entry-view + .section,
  body.tool-page .tool-entry-view + .section.section--alt,
  body.tool-page .tool-entry-view + div[class*="mt-"] {
    clear: both;
    position: relative;
    z-index: 0;
    margin-top: 1.25rem !important;
  }

  body.tool-page .tool-layout,
  body.tool-page .tool-layout__stack {
    gap: 1rem;
  }

  body.tool-page .hero.tool-header--legacy .subtitle {
    max-width: none;
  }

  .cta-box {
    padding: 1.5rem;
  }

  .cta-box h3 {
    font-size: 1.25rem;
  }

  .form-grid--triple {
    grid-template-columns: 1fr;
  }

  .stats-grid--triple {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .affiliate-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: 0.5rem; text-align: center; }
  .header-search-btn span { display: none; }
  .header-search-btn { min-width: 42px; padding-inline: 0.625rem; }
}
