:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #dfe4ea;
  --blue: #2563eb;
  --green: #0f9f6e;
  --coral: #e65f42;
  --gold: #b68213;
  --shadow: 0 16px 36px rgba(17, 24, 39, .08);
  --topbar-bg: rgba(246, 247, 249, .92);
  --soft-bg: #fbfcfd;
  --button-bg: #ffffff;
  --button-ink: #394150;
  --label-ink: #384252;
  --hover-bg: #eceff3;
  --card-bg: #ffffff;
  --meta-bg: #f0f3f6;
  --meta-line: #e3e8ee;
  --secondary-bg: #ecf1f5;
  --meta-ink: #536071;
  --hover-line: #b7c1cf;
  --interactive-bg: #17202a;
}

html[data-theme="dark"] {
  --bg: #20283a;
  --panel: #2b3650;
  --ink: #f4f6ff;
  --muted: #c0c9dc;
  --line: #45536d;
  --topbar-bg: rgba(32, 40, 58, .94);
  --soft-bg: #252f44;
  --button-bg: #35425d;
  --button-ink: #f0f3ff;
  --label-ink: #e2e7f5;
  --hover-bg: #3a4865;
  --card-bg: #303c57;
  --meta-bg: #3b4864;
  --meta-line: #52627f;
  --secondary-bg: #40506d;
  --meta-ink: #c1ccd8;
  --hover-line: #68798b;
  --interactive-bg: #6579a5;
  --shadow: 0 16px 36px rgba(0, 0, 0, .24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 56px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 800;
}

.brand img {
  width: 162px;
  height: 45px;
  object-fit: contain;
}

.brand span {
  padding: 4px 8px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

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

.nav a,
.quiet-link {
  text-decoration: none;
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 650;
}

.nav a:hover,
.quiet-link:hover {
  color: var(--ink);
  background: var(--hover-bg);
}

.language-toggle {
  color: var(--ink) !important;
  background: var(--button-bg);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.language-toggle:hover {
  border-color: var(--hover-line);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: clamp(24px, 5vw, 72px);
  align-items: end;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(44px, 7vw, 84px) clamp(18px, 4vw, 32px) 32px;
}

.compact-hero {
  padding-bottom: 18px;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 740px;
  margin: 0;
  font-size: clamp(44px, 7vw, 82px);
  line-height: 1;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.6;
}

.finder {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.finder label {
  display: block;
  margin-bottom: 10px;
  color: var(--label-ink);
  font-size: 13px;
  font-weight: 800;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input[type="search"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  background: var(--soft-bg);
}

input[type="search"]::placeholder {
  color: var(--muted);
  opacity: 1;
}

input[type="search"]:focus {
  outline: 2px solid rgba(101, 121, 165, .45);
  outline-offset: 1px;
}

button {
  font: inherit;
}

#clear-search,
.filter {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--button-ink);
  cursor: pointer;
  font-weight: 700;
}

#clear-search {
  padding: 0 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.filter {
  padding: 0 13px;
}

.filter.active {
  color: #fff;
  background: var(--interactive-bg);
  border-color: var(--interactive-bg);
}

.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px clamp(18px, 4vw, 32px);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-note {
  max-width: 660px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: 0;
}

.tool-grid,
.workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tool-browser {
  overflow: visible;
}

.category-menu {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-bg);
  box-shadow: 0 5px 14px rgba(17, 24, 39, .035);
}

.category-tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  color: var(--button-ink);
  background: var(--button-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.category-tab.active {
  color: #fff;
  background: var(--interactive-bg);
  border-color: var(--interactive-bg);
}

.tool-window {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(17, 24, 39, .05);
}

.tool-card,
.workflow-item {
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(17, 24, 39, .04);
}

.tool-card {
  display: flex;
  min-height: 272px;
  flex-direction: column;
  padding: 18px;
  color: inherit;
  box-shadow: none;
  text-decoration: none;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.tool-card[hidden] {
  display: none;
}

.tool-card:hover {
  border-color: var(--hover-line);
  box-shadow: 0 8px 18px rgba(17, 24, 39, .07);
  transform: translateY(-1px);
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.tool-icon.image {
  background: var(--green);
}

.tool-icon.audio {
  background: var(--coral);
}

.tool-icon.text {
  background: var(--blue);
}

.tool-icon.video {
  background: #2b6f77;
}

.planned-icon {
  background: var(--gold);
}

.tool-card h3 {
  margin: 18px 0 8px;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
}

.tool-meta span {
  color: var(--meta-ink);
  background: var(--meta-bg);
  border: 1px solid var(--meta-line);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.tool-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 14px;
  padding: 0 14px;
  color: #fff;
  background: var(--interactive-bg);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 800;
}

.tool-action.secondary {
  color: var(--ink);
  background: var(--secondary-bg);
}

.planned {
  border-style: dashed;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: var(--card-bg);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.workflow {
  padding-bottom: 72px;
}

.workflow-item {
  display: block;
  padding: 18px;
  text-decoration: none;
}

.workflow-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.workflow-item span {
  color: var(--muted);
  line-height: 1.5;
}

.workflow-item:hover {
  border-color: var(--hover-line);
  transform: translateY(-1px);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  padding: 28px 18px 36px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.footer a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #f4c542;
  background: var(--button-bg);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

html[data-theme="dark"] .theme-toggle {
  color: #f4c542;
  background: #514727;
}

.theme-toggle:hover {
  background: var(--hover-bg);
  border-color: #8a98a8;
}

.tool-detail {
  max-width: 1040px;
  margin: 0 auto;
  padding: 44px clamp(18px, 4vw, 32px) 76px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 16px;
}

.detail-panel,
.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(17, 24, 39, .04);
}

.detail-panel {
  padding: clamp(22px, 5vw, 38px);
}

.detail-panel h1 {
  max-width: 820px;
  margin-top: 8px;
}

.detail-meta {
  margin-top: 18px;
  padding-top: 0;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.detail-actions .tool-action {
  margin-top: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.detail-card {
  padding: 20px;
}

.detail-card h2 {
  font-size: 24px;
}

.detail-card ul {
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.65;
}

.detail-card p {
  color: var(--muted);
  line-height: 1.65;
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .tool-grid,
  .workflow-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .brand img {
    width: 146px;
    height: 41px;
  }

  h1 {
    font-size: 42px;
  }

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

  #clear-search {
    width: 100%;
  }

  .tool-window {
    padding: 14px;
  }
}
