.tool-search { box-sizing: border-box; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; width: fit-content; max-width: 100%; margin: 24px auto; padding: 12px; border-radius: 10px; background: #000; color: #fff; box-shadow: 0 0 12px color-mix(in srgb, var(--icon-accent, #6f93d1) 55%, transparent); font: 14px Verdana, sans-serif; }
body.light-mode .tool-search { background: #fff; color: #111; }
.tool-search input, .tool-search button { box-sizing: border-box; min-height: 44px; padding: 8px 12px; font: inherit; border: 2px solid var(--icon-accent, #6f93d1); border-radius: 6px; background: #fff; color: #111; }
.tool-search input { width: 290px; max-width: 100%; }
.tool-search-field { position: relative; min-width: 0; }
.tool-search .tool-search-field input { width: 100%; padding-inline-end: 38px; }
.tool-search #tool-search::-webkit-search-cancel-button { display: none; }
.tool-search-shortcut {
  position: absolute;
  inset-inline-end: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 5px;
  border: 1px solid #777;
  border-radius: 4px;
  background: #f3f3f3;
  color: #333;
  font: 13px/1.2 monospace;
  cursor: default;
}
.tool-search button { cursor: pointer; }
.tool-search button:hover { background: var(--icon-accent, #6f93d1); color: var(--icon-hover-text, #111); }
.tool-search :focus-visible { outline: 3px solid var(--icon-accent, #6f93d1); outline-offset: 3px; }
.tool-search #tool-search-empty { width: 100%; height: auto; margin: 0; padding: 8px; background: transparent; color: inherit; text-align: center; font: inherit; line-height: 1.5; }
[hidden] { display: none !important; }
@media (max-width: 600px) { .tool-search { width: min(100%, 360px); } .tool-search label, .tool-search input, .tool-search output { width: 100%; } }

/* Active searches form one uninterrupted result block above the banners. */
.legacy-tool-results { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 12px; margin: 24px auto; max-width: 100%; }
.legacy-tool-results > div { float: none !important; width: auto; max-width: 100%; }
@media (max-width: 767px) {
  .legacy-tool-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
  .legacy-tool-results > div { width: 100%; min-width: 0; }
}

/* Match search-result spacing in both UIs without stacked margins or padding. */
.tool-search:has(+ .tool-search-results:not([hidden])) { margin-bottom: 0; }
.tool-search-results.container,
.tool-search-results.legacy-tool-results {
  margin-top: 24px;
  margin-bottom: 24px;
  padding: 0;
  gap: 12px;
}

/* Equal 24px gaps from logo through the first row of tools in both UIs. */
body .site-header:not(.footer-summary),
body .legacy-site-header {
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  margin: 24px 0 0; padding: 0;
}
body .site-header:not(.footer-summary) > a,
body .legacy-site-header > a { display: block; line-height: 0; }
body .site-header:not(.footer-summary) .site-logo,
body .legacy-site-header > a img { display: block; width: 100px; max-width: 100%; height: auto; margin: 0; }
body .site-header:not(.footer-summary) .site-name-box,
body .site-header:not(.footer-summary) .site-slogan-box,
body .legacy-site-header h2,
body .legacy-site-header h3 { margin: 0; height: auto; max-width: 100%; box-sizing: border-box; }
body .tool-search { margin-top: 24px; margin-bottom: 0; }
.tool-search-results[hidden] + .container { margin-top: 24px; padding-top: 0; }
.tool-search-results[hidden] + div[style="overflow:auto"] { margin-top: 24px; }

.tool-search .tool-search-help { flex-basis: 100%; width: auto; max-width: 660px; height: auto; margin: 0; padding: 0; background: transparent; color: inherit; font: 12px/1.6 Verdana, sans-serif; text-align: left; }

/* Compact help, available to mouse, touch, and keyboard users. */
.tool-search-label { display: flex; align-items: center; gap: 6px; }
.search-info { position: relative; }
.search-info .search-info-button { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; cursor: pointer; border-radius: 6px; list-style: none; }
.search-info .search-info-button::-webkit-details-marker { display: none; }
.search-info .search-info-button:hover { background: var(--icon-accent, #6f93d1); color: var(--icon-hover-text, #111); }
.tool-search .search-info .tool-search-help { display: none; position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 10001; width: min(300px, calc(100vw - 48px)); max-width: none; padding: 12px; border: 1px solid var(--icon-accent, #6f93d1); border-radius: 8px; background: #111; color: #fff; box-sizing: border-box; box-shadow: 0 3px 12px #0006; }
.search-info::after { content: ''; position: absolute; top: 100%; left: 0; width: 100%; height: 8px; }
.tool-search .search-info[open] .tool-search-help,
.tool-search .search-info:focus-within .tool-search-help { display: block; }
body.light-mode .tool-search .search-info .tool-search-help { background: #fff; color: #111; }
@media (hover: hover) { .tool-search .search-info:hover .tool-search-help { display: block; } }
@media (max-width: 600px) { .tool-search .tool-search-label { width: 100%; } .tool-search .tool-search-label label { width: auto; } .search-info .search-info-button { width: 44px; height: 44px; } }
@media (max-width: 600px) {
  .tool-search .search-info .tool-search-help { position: fixed; top: auto; bottom: 24px; left: 24px; right: 24px; width: auto; transform: none; }
}

/* Use a self-contained info glyph that cannot shrink with SVG styles. */
.tool-search .search-info .search-info-button { padding: 0; flex: 0 0 auto; }
.search-info-symbol { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: 20px; height: 20px; border: 2px solid currentColor; border-radius: 50%; font: bold 16px/1 Georgia, serif; }

/* Keep the original button box; reduce only its information glyph. */
.search-info-symbol { width: 16px; height: 16px; font-size: 12px; }

.tool-search .search-info-button svg.search-info-symbol { display: block; flex: 0 0 16px; width: 16px; min-width: 16px; height: 16px; border: 0; border-radius: 0; padding: 0; margin: 0; }
.tool-search .search-info-button svg.search-info-symbol {
  flex-basis: 20px;
  width: 20px;
  min-width: 20px;
  height: 20px;
}

/* Empty-result text spans a compact grid instead of widening a flex row. */
body .tool-search {
  display: grid;
  grid-template-columns: auto minmax(0, 290px) auto;
  width: max-content;
  max-width: 100%;
}
.tool-search #tool-search-count { grid-column: 4; }
.tool-search #tool-search-empty { grid-column: 1 / -1; width: auto; padding: 0; }
.search-result-banner { margin: 24px auto !important; padding: 0 !important; text-align: center; }
@media (max-width: 600px) {
  body .tool-search { width: min(100%, 360px); grid-template-columns: minmax(0, 1fr) auto; }
  .tool-search .tool-search-label { grid-column: 1 / -1; }
  .tool-search input { width: 100%; }
  .tool-search #tool-search-count { grid-column: 1 / -1; }
}
/* Eliminate inline-image baseline space below the active search banner. */
.search-result-banner { line-height: 0; }
.search-result-banner img { vertical-align: bottom; }
/* Span the optional count column as well, so the empty message is truly centered. */
.tool-search #tool-search-empty { grid-column: 1 / span 4; text-align: center; justify-self: stretch; }
@media (max-width: 600px) { .tool-search #tool-search-empty { grid-column: 1 / -1; } }

/* Stack the main search action beneath its input, matching the mobile account filter. */
@media (max-width: 767px) {
  body .tool-search { width: min(100%, 360px); grid-template-columns: minmax(0, 1fr); }
  .tool-search .tool-search-label,
  .tool-search #tool-search-count,
  .tool-search #tool-search-empty { grid-column: 1 / -1; }
  .tool-search #tool-search,
  .tool-search #clear-tool-search { grid-column: 1 / -1; width: 100%; }
}
