:root {
  color-scheme: light;
  --accent: #0b7a6b;
  --accent-ink: #075c50;
  --on-accent: #fff;
  --ink: #162c28;
  --muted: #475f59;
  --bg: #f5f8f7;
  --card: #fff;
  --line: #ccdcd7;
  --control-line: #849e96;
  --tint: #e4f3ee;
  --hero: #edf8f4;
  --error: #a82420;
  --shadow: 0 14px 36px #102e2510;
  --gutter: clamp(16px, 3vw, 36px);
  --header-height: 68px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --accent-ink: #a0f0d9;
    --ink: #edf7f4;
    --muted: #b5ccc5;
    --bg: #111e1c;
    --card: #192b26;
    --line: #3a5550;
    --control-line: #73928a;
    --tint: #25433a;
    --hero: #203a32;
    --error: #ffaea8;
    --shadow: 0 14px 36px #0004;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.6 system-ui, "Segoe UI", sans-serif; }
a { color: var(--accent-ink); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 3px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 1px; }
img, video { max-width: 100%; height: auto; }
svg { display: block; flex: none; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.022em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.25rem; }
button, input, select, textarea { font: inherit; }
button, .btn, input::file-selector-button {
  min-height: 44px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}
button.secondary { background: var(--tint); color: var(--accent-ink); }
button:disabled { opacity: .6; cursor: default; }
input, select, textarea {
  min-height: 44px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--control-line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
}
input[type=number] { width: 90px; }
input[type=file] { width: 100%; padding: 4px; border-color: var(--line); }
input::file-selector-button { margin-inline-end: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 4px; text-align: start; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-block: 10px; }
.row > label { max-width: 100%; }
.err { margin-top: 10px; color: var(--error); }
.result { margin-top: 14px; font-size: 1.125rem; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: .9375rem; }
.grid { display: grid; gap: 14px; }
.die { display: inline-block; min-width: 44px; margin: 4px; padding: 8px; border: 2px solid var(--accent); border-radius: 10px; font-weight: 700; text-align: center; }

.skip-link { position: absolute; z-index: 4; inset: 8px auto auto var(--gutter); transform: translateY(-150%); padding: 8px 14px; background: var(--card); }
.skip-link:focus { transform: none; }
.site-header { position: relative; z-index: 2; min-height: var(--header-height); border-bottom: 1px solid var(--line); background: var(--card); }
.header-inner {
  display: flex;
  max-width: 1320px;
  min-height: var(--header-height);
  margin-inline: auto;
  padding-inline: var(--gutter);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand, .site-nav, .site-nav > a, summary, .header-search, .mobile-search { display: flex; align-items: center; gap: 8px; }
.brand {
  min-height: 44px;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -.04em;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink);
}
.brand-mark { display: grid; width: 34px; height: 34px; border-radius: 10px; place-items: center; background: var(--accent); color: var(--on-accent); }
.brand-mark svg { width: 22px; height: 22px; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.all-tools > summary {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--tint);
  color: var(--accent-ink);
  font-weight: 700;
  white-space: nowrap;
}
.menu-chevron svg, .mobile-menu-icon svg, .header-search svg, .mobile-search svg { width: 18px; height: 18px; }
.all-tools[open] .menu-chevron { transform: rotate(180deg); }
.site-nav > .category-nav-link, .header-search { display: none; }
.mega-panel {
  position: absolute;
  inset: 100% 0 auto;
  max-height: calc(100vh - var(--header-height) - 8px);
  max-height: calc(100dvh - var(--header-height) - 8px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px var(--gutter) 16px;
  border: 1px solid var(--line);
  border-radius: 0 0 16px 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.mobile-search { margin-bottom: 10px; }
.mobile-search input, .header-search input { min-width: 0; flex: 1; }
.mobile-search button, .header-search button { display: grid; width: 44px; padding: 0; place-items: center; }
.mega-group + .mega-group { border-top: 1px solid var(--line); }
.mega-group > summary { min-height: 44px; color: var(--accent-ink); font-weight: 750; }
.mega-group > summary::after { margin-left: auto; content: "+"; }
.mega-group[open] > summary::after { content: "−"; }
.mega-group ul, .footer-columns ul { margin: 0; padding: 0; list-style: none; }
.mega-group a, .footer-columns a { display: flex; min-height: 44px; align-items: center; text-decoration: none; }
.mega-group a { padding: 4px 8px 4px 32px; border-radius: 8px; color: var(--ink); }
.mega-group a:hover, .category-nav-link:hover { background: var(--tint); }
@media (min-width: 1000px) {
  .site-nav { gap: 3px; }
  .site-nav > .category-nav-link {
    display: flex;
    min-height: 44px;
    padding-inline: 8px;
    border-radius: 8px;
    color: var(--ink);
    font-size: .9375rem;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
  }
  .header-search { display: flex; flex: 0 1 195px; }
  .mobile-menu-icon, .mobile-search { display: none; }
  .mega-panel {
    inset-inline: max(var(--gutter), calc((100% - 1260px) / 2));
    padding: 18px;
    border-radius: 0 0 16px 16px;
  }
  .mega-groups { columns: 4; column-gap: 20px; }
  .mega-group { break-inside: avoid; margin-bottom: 12px; }
  .mega-group a { padding-left: 8px; }
}

main { width: 100%; max-width: 860px; margin-inline: auto; padding: 22px var(--gutter) 36px; }
main:focus { outline-offset: -3px; }
.tool-page > h1 { margin: 8px 0 4px; }
.tool-page > .tool-description { margin: 0 0 14px; color: var(--muted); }
.card { min-width: 0; margin-bottom: 20px; padding: clamp(13px, 3vw, 24px); border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.card > :first-child { margin-top: 0; }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--accent); }
#tool-card .row > label { min-width: 0; }
#rows { table-layout: fixed; }
#rows th:last-child { width: 48px; }
#rows input { width: 100% !important; }
#rows td:last-child button { min-width: 44px; padding-inline: 4px; }
.text-editor { display: block; width: 100%; resize: vertical; }
.code-editor { font-family: ui-monospace, Consolas, monospace; }
.converter-fields > label { flex: 1 1 160px; }
.converter-fields input[type=number] { display: block; width: 100%; min-width: 0; }
.pdf-file-picker { display: grid; gap: 6px; padding: 14px; border: 2px dashed var(--control-line); border-radius: 12px; background: var(--hero); }
.pdf-file-picker:focus-within { border-color: var(--accent-ink); }
#pdf-selection, #links { overflow-wrap: anywhere; }
#pdf-form input[type=text] { width: min(100%, 230px); }
.adsbygoogle { min-height: 280px; }

.directory-main { max-width: 1320px; }
.tool-hero {
  padding: clamp(16px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 19px;
  background: linear-gradient(120deg, var(--card), var(--hero));
}
.tool-hero h1 { margin: 0; }
.tool-hero p { margin: 6px 0 14px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.125rem); }
.directory-search {
  display: flex;
  width: min(100%, 620px);
  min-height: 54px;
  align-items: center;
  gap: 12px;
  padding-inline: 13px;
  border: 1px solid var(--control-line);
  border-radius: 11px;
  background: var(--card);
  color: var(--accent-ink);
}
.directory-search:focus-within { outline: 3px solid var(--accent-ink); outline-offset: 2px; }
.directory-search input { min-width: 0; flex: 1; min-height: 52px; padding: 0; border: 0; background: transparent; outline: none; }
.popular-tools {
  display: flex;
  gap: 8px;
  margin: 10px -2px -4px;
  padding: 4px 2px 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.popular-tools a {
  display: flex;
  flex: none;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding-inline: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--accent-ink);
  font-size: .9375rem;
  font-weight: 650;
  text-decoration: none;
}
.popular-tools svg { width: 18px; height: 18px; }
.popular-tools a:hover { background: var(--tint); }
.tool-filters { display: flex; gap: 7px; overflow-x: auto; padding: 15px 4px 7px; scrollbar-width: thin; }
.tool-filters button { flex: none; padding-inline: 12px; border-color: var(--line); background: var(--card); color: var(--ink); font-size: .9375rem; font-weight: 650; white-space: nowrap; }
.tool-filters button[aria-pressed=true] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
#tool-count { margin: 4px 0 0; }
.tool-group { margin-block: 10px 26px; scroll-margin-top: 12px; }
.tool-group h2 { margin: 0 0 9px; }
.tool-group .grid { grid-template-columns: minmax(0, 1fr); }
.directory-card {
  display: grid;
  min-width: 0;
  min-height: 164px;
  grid-template-rows: auto auto 1fr auto;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.directory-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.card-mark { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 12px; background: var(--tint); color: var(--accent-ink); }
.card-arrow { color: var(--muted); }
.card-arrow svg { width: 18px; height: 18px; }
.directory-card strong { font-size: 1.125rem; line-height: 1.22; }
.card-summary { color: var(--muted); font-size: .9375rem; line-height: 1.4; }
.processing-badge { justify-self: start; padding: 2px 7px; border-radius: 6px; background: var(--tint); color: var(--accent-ink); font-size: .8125rem; font-weight: 650; }
@media (min-width: 620px) { .tool-group .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .tool-group .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1050px) { .tool-group .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.site-footer { border-top: 1px solid var(--line); background: var(--card); color: var(--muted); }
.footer-inner { max-width: 1320px; margin-inline: auto; padding: 24px var(--gutter); }
.footer-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }
.footer-columns h2 { margin: 0; font-size: 1.25rem; color: var(--ink); }
.footer-columns a:hover { text-decoration: underline; }
.footer-privacy { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.footer-copyright { margin: 3px 0 0; }
@media (min-width: 720px) { .footer-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
