:root,
html[data-theme='dark'] {
  --bg: #080b11;
  --bg-elevated: #0f141e;
  --surface: #121826;
  --surface-2: #182032;
  --surface-hover: #1e2940;
  --border: #232f46;
  --border-strong: #324364;
  --text: #eef2f9;
  --text-soft: #cbd5e1;
  --muted: #8b9bb7;
  --accent: #10b981;
  --accent-bright: #34d399;
  --accent-ink: #032217;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --blue: #3b82f6;
  --blue-bright: #60a5fa;
  --blue-soft: rgba(59, 130, 246, 0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --code-bg: #070a0f;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.42);
  --checker-a: #151c2c;
  --checker-b: #1c2538;
}

html[data-theme='light'] {
  --bg: #f6f8fc;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-hover: #e2e8f0;
  --border: #dde4ef;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #52627a;
  --accent: #059669;
  --accent-bright: #047857;
  --accent-ink: #ffffff;
  --accent-soft: rgba(5, 150, 105, 0.1);
  --blue: #2563eb;
  --blue-bright: #1d4ed8;
  --blue-soft: rgba(37, 99, 235, 0.09);
  --warn: #b45309;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --code-bg: #f8fafc;
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.09);
  --checker-a: #f1f5f9;
  --checker-b: #e2e8f0;
}

:root {
  --radius: 12px;
  --radius-sm: 8px;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.86rem;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.9rem;
}

.nav-links a {
  color: var(--muted);
  font-weight: 500;
}

.nav-links a:hover,
.nav-links a[aria-current='page'] {
  color: var(--text);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, border-color 0.15s ease, background 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-bright);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.btn-blue {
  background: var(--blue);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8rem;
}

/* Hero & Hub */
.hero {
  padding: 56px 0 36px;
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.79rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-bright);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(1.95rem, 4.4vw, 3.15rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 auto 14px;
  max-width: 820px;
}

.hero p.lead {
  font-size: 1.07rem;
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto 26px;
}

.hub-search-wrap {
  max-width: 640px;
  margin: 0 auto 22px;
  position: relative;
}

.hub-search {
  width: 100%;
  padding: 13px 16px 13px 42px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.96rem;
  box-shadow: var(--shadow-sm);
}

.hub-search:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.hub-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.filter-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 30px;
}

.filter-tab {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-tab.active,
.filter-tab:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  max-width: 900px;
  margin: 0 auto 36px;
}

.trust-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  text-align: left;
}

.trust-item strong {
  display: block;
  font-size: 0.94rem;
}

.trust-item span {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Tool Directory Cards */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 16px;
  margin-bottom: 42px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  color: var(--text);
  text-decoration: none;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.tool-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.cat-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-bright);
}

.badge-mono {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.tool-card h2,
.tool-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.tool-card p {
  margin: 0 0 14px;
  font-size: 0.87rem;
  color: var(--muted);
}

.tool-card-cta {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--accent-bright);
}

/* Tool Page Header & Breadcrumb */
.tool-page-head {
  padding: 28px 0 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--text);
}

.tool-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.tool-page-head h1 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.tool-subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
  font-size: 0.98rem;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-bright);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  white-space: nowrap;
}

/* Tool Interactive Workspace */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-title h2,
.panel-title h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--code-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.88rem;
}

.textarea {
  font-family: var(--mono);
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.code-output {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-x: auto;
  max-height: 440px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tab-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--accent-soft);
  color: var(--accent-bright);
  border-color: var(--accent);
}

.chip-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
}

.status-ok {
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.status-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-err {
  background: var(--danger-soft);
  color: var(--danger);
}

.checkerboard {
  background-image: linear-gradient(45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-a) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-a) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: var(--checker-b);
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 18px;
  text-align: center;
  cursor: pointer;
  background: var(--code-bg);
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Monetization & Portfolio Synergy Architecture */
.synergy-banner {
  margin-top: 26px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 11%, var(--surface)), color-mix(in srgb, var(--blue) 10%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.synergy-banner h3 {
  margin: 4px 0 6px;
  font-size: 1.08rem;
}

.synergy-banner p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  max-width: 720px;
}

.monetization-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.ad-slot {
  min-height: 150px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ad-slot-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.affiliate-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.affiliate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.affiliate-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.affiliate-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.aff-card {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.aff-card strong {
  font-size: 0.88rem;
  display: block;
}

.aff-card p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

/* SEO Content & FAQ */
.seo-sections {
  margin-top: 32px;
  display: grid;
  gap: 22px;
}

.seo-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.seo-box h2 {
  margin: 0 0 12px;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
}

.two-col-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.clean-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 0.92rem;
  display: grid;
  gap: 7px;
}

.faq-list {
  display: grid;
  gap: 10px;
}

details.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: 12px 15px;
}

details.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.94rem;
}

details.faq-item p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.related-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--bg-elevated);
  color: var(--text);
  display: block;
}

.related-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.related-card strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.related-card span {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Footer */
.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  padding: 32px 0 42px;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* Command Palette Modal */
.cmd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(5, 8, 15, 0.72);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 16px 24px;
}

.cmd-backdrop.open {
  display: flex;
}

.cmd-dialog {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.cmd-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 14px 16px;
  font-size: 0.96rem;
  outline: none;
}

.cmd-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
  display: grid;
  gap: 4px;
}

.cmd-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
}

.cmd-item:hover,
.cmd-item:focus {
  background: var(--surface-2);
  text-decoration: none;
}

.cmd-item span {
  font-size: 0.76rem;
  color: var(--muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 90;
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 920px) {
  .workspace-grid,
  .monetization-grid,
  .two-col-lists {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .nav-links {
    display: none;
  }
  .nav-bar {
    gap: 8px;
  }
  .brand {
    font-size: 0.94rem;
    gap: 7px;
  }
  .brand-sub {
    display: none;
  }
  .icon-btn {
    padding: 6px 9px;
    font-size: 0.78rem;
  }
  .kbd {
    display: none;
  }
  .form-row-2 {
    grid-template-columns: 1fr;
  }
  .hero {
    padding-top: 34px;
  }
}
