/* ToolHub-style layout: dark sidebar from top + main content. No registration. */
html:has(body.layout-toolhub) {
  overflow: hidden;
  height: 100%;
}
body.layout-toolhub {
  background: #ebebeb;
  min-height: 100vh;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.layout-toolhub .app-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Body: sidebar + main content below the header */
.layout-toolhub .app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.layout-toolhub .sidebar-overlay {
  display: none;
  pointer-events: none;
}

/* Sidebar: below header, menu only */
.layout-toolhub .sidebar {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #e2e8f0;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  font-family: inherit;
}

.layout-toolhub .sidebar #sidebarNav {
  flex: 1;
  padding: 0.5rem 0;
  overflow-y: auto;
}

/* Header: full width, 68px, icon + ProToolBox at start, search center, nav end */
.layout-toolhub .main-top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 68px;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0 2rem;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #e2e8f0;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
  font-family: inherit;
}

.layout-toolhub .main-top-bar .header-brand {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.layout-toolhub .main-top-bar .header-brand:hover {
  color: #fff;
}

.layout-toolhub .main-top-bar .header-brand-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layout-toolhub .main-top-bar .header-brand-icon picture {
  display: contents;
}

.layout-toolhub .main-top-bar .header-brand-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.layout-toolhub .main-top-bar .header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Hamburger: visible only on mobile. Markup: .sidebar-toggle-label + .sidebar-toggle-bars > 3×span — do not style all span {} or "Menu" collapses to bar size. */
.layout-toolhub .main-top-bar .sidebar-toggle {
  display: none;
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  width: auto;
  height: auto;
  padding: 8px 10px;
  margin: 0;
  border: none;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background-color 0.2s;
}
.layout-toolhub .main-top-bar .sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}
.layout-toolhub .main-top-bar .sidebar-toggle-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
}
.layout-toolhub .main-top-bar .sidebar-toggle-bars {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 5px;
  width: 22px;
  flex-shrink: 0;
}
.layout-toolhub .main-top-bar .sidebar-toggle-bars > span {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.layout-toolhub .main-top-bar .sidebar-toggle[aria-expanded="true"] .sidebar-toggle-bars > span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.layout-toolhub .main-top-bar .sidebar-toggle[aria-expanded="true"] .sidebar-toggle-bars > span:nth-child(2) {
  opacity: 0;
}
.layout-toolhub .main-top-bar .sidebar-toggle[aria-expanded="true"] .sidebar-toggle-bars > span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.layout-toolhub .main-top-bar .header-search-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 1rem;
}

/* Category/tool shell: results block above main area (must NOT live in .main-top-bar — fixed 68px height clips children) */
/* Same panel on index .main-content when SPA hides #homeContent (html.route-tool) */
.layout-toolhub .toolhub-main-content .shell-search-panel,
.layout-toolhub .main-content .shell-search-panel {
  flex-shrink: 0;
  order: -1;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 0.75rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  /* Full height: show all matches, page scrolls — no inner scrollbar */
}

.layout-toolhub .toolhub-main-content .shell-search-panel[hidden],
.layout-toolhub .main-content .shell-search-panel[hidden] {
  display: none !important;
}

.layout-toolhub .toolhub-main-content .shell-search-panel-title,
.layout-toolhub .main-content .shell-search-panel-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e293b;
}

.layout-toolhub .toolhub-main-content .shell-search-panel .shell-search-results-grid,
.layout-toolhub .main-content .shell-search-panel .shell-search-results-grid {
  margin: 0;
}

.layout-toolhub .toolhub-main-content .shell-search-panel .shell-search-no-results-msg,
.layout-toolhub .main-content .shell-search-panel .shell-search-no-results-msg {
  margin: 0;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  color: #64748b;
  text-align: center;
}

.layout-toolhub .main-top-bar .search-field-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-width: 0;
  box-sizing: border-box;
}

.layout-toolhub .main-top-bar .search-input {
  width: 100%;
  height: 44px;
  padding: 0 3rem 0 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  /* iOS Safari zooms the viewport when focused inputs compute below 16px — causes horizontal overflow */
  font-size: max(16px, 0.95rem);
  color: #0f172a;
  background: #fff;
  box-sizing: border-box;
  max-width: 100%;
  touch-action: manipulation;
}

.layout-toolhub .main-top-bar .search-btn-icon {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0 10px 10px 0;
  background: transparent;
  color: #1e293b;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.layout-toolhub .main-top-bar .search-btn-icon:hover {
  background: rgba(30, 41, 59, 0.08);
  color: #0f172a;
}
.layout-toolhub .main-top-bar .search-btn-icon:focus {
  outline: none;
  background: rgba(30, 41, 59, 0.12);
}
.layout-toolhub .main-top-bar .search-btn-icon svg {
  display: block;
  flex-shrink: 0;
}

.layout-toolhub .main-top-bar .search-input::placeholder { color: #64748b; }
.layout-toolhub .main-top-bar .search-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.35);
  background-color: #fff;
}
.layout-toolhub .main-top-bar .search-input:focus::placeholder { color: transparent; }

/* Share: between search and About / Contact; hrefs filled by main.js */
.layout-toolhub .main-top-bar .header-share-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.layout-toolhub .main-top-bar .header-share-wrap[hidden] {
  display: none !important;
}
.layout-toolhub .main-top-bar .header-share-wrap .header-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
  box-sizing: border-box;
}
.layout-toolhub .main-top-bar .header-share-wrap .header-share-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.layout-toolhub .main-top-bar .header-share-wrap .header-share-btn svg {
  display: block;
  width: 18px;
  height: 18px;
}

.layout-toolhub .main-top-bar .header-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* Same chip style as .header-share-btn */
.layout-toolhub .main-top-bar .header-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 34px;
  padding: 0 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.layout-toolhub .main-top-bar .header-nav a:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* About / Contact: desktop = header only; mobile = footer only (matches .header-nav visibility) */
.layout-toolhub .footer .footer-nav-mobile-cluster,
.footer.layout-toolhub-shell-footer .footer-nav-mobile-cluster {
  display: none !important;
}

/* Footer nav — same chip buttons as .main-top-bar .header-nav (About, Contact) */
.layout-toolhub .footer.layout-toolhub-shell-footer .footer-nav,
.footer.layout-toolhub-shell-footer .footer-nav {
  gap: 0.35rem;
}

.layout-toolhub .footer.layout-toolhub-shell-footer .footer-nav a,
.footer.layout-toolhub-shell-footer .footer-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 34px;
  padding: 0 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.layout-toolhub .footer.layout-toolhub-shell-footer .footer-nav a:hover,
.footer.layout-toolhub-shell-footer .footer-nav a:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.layout-toolhub .sidebar .sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 0.5rem 0.6rem;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 1rem;
  line-height: 1.65;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.layout-toolhub .sidebar .sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.layout-toolhub .sidebar .sidebar-item.is-active {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
}

.layout-toolhub .sidebar .sidebar-item .icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
}

.layout-toolhub .sidebar .sidebar-item .icon.icon-svg {
  font-size: 0;
}

.layout-toolhub .sidebar .sidebar-item .icon.icon-svg svg {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
}

.layout-toolhub .sidebar .sidebar-item.is-active .icon {
  color: #fff;
  background: rgba(147, 197, 253, 0.35);
  border-radius: 6px;
}

.layout-toolhub .sidebar .sidebar-item .label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layout-toolhub .sidebar .sidebar-item .count {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: #64748b;
}
.layout-toolhub .sidebar .sidebar-item.is-active .count { color: #94a3b8; }

.layout-toolhub .shell-breadcrumb-wrap {
  flex-shrink: 0;
  min-height: 2.25rem;
  padding: 0.4rem 2rem 0 2rem;
  background: #ebebeb;
}

.layout-toolhub .shell-breadcrumb {
  font-size: 1rem;
  color: #6b7280;
}

.layout-toolhub .shell-breadcrumb a {
  color: #1e293b;
  text-decoration: none;
}

.layout-toolhub .shell-breadcrumb a:hover {
  text-decoration: underline;
}

.layout-toolhub .main-content,
.layout-toolhub .toolhub-main-content {
  flex: 1;
  padding: 0 2rem 1.5rem;
  overflow: hidden;
  background: #ebebeb;
  display: flex;
  font-family: inherit;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Inner shell: scroll whole column so long search results stay visible (no inner panel scrollbar). */
.layout-toolhub.inner-toolhub-page .toolhub-main-content {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/*
 * Inner scroll: block flow (not flex column). Flex + margin-top:auto on .footer
 * caused the shell footer to sit mid-column and overlap content.
 * Order in HTML: main → footer; footer always below content, end of scroll.
 */
.layout-toolhub.inner-toolhub-page .inner-toolhub-scroll > main.main {
  display: block;
  max-width: 100%;
  min-height: 0;
}
.layout-toolhub.inner-toolhub-page .inner-toolhub-scroll > footer.layout-toolhub-shell-footer {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 1.5rem; /* wins over .footer { margin-top: auto } via higher specificity */
  position: static;
  z-index: auto;
}
/* Legacy: footer direct child of .toolhub-main-content */
.layout-toolhub .toolhub-main-content > .layout-toolhub-shell-footer {
  flex-shrink: 0;
  width: 100%;
  margin-top: 1rem;
  box-sizing: border-box;
}

.layout-toolhub .app-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* TOP1 tool pages (desktop): app-content overflow:hidden can clip sticky two-column outputs (design tools). */
body.ptb-tool-top1.layout-toolhub.inner-toolhub-page .app-content {
  overflow: visible;
}

/* Tool/category route: keep #homeContent visible (single document tree). */
html.route-tool #homeContent {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

/* Index: allow main column to scroll when shell search panel is tall (panel sits outside #app-content). */
html.route-tool .layout-toolhub .main-content {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Home hub: reserve min height before JS fills grids — cuts footer CLS when cards mount. */
body.ptb-home-top1.layout-toolhub #popularGrid {
  min-height: 17.5rem;
}
body.ptb-home-top1.layout-toolhub #allToolsContent {
  min-height: 24rem;
}

.layout-toolhub .home-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
  box-sizing: border-box;
}
.layout-toolhub .home-content::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Inner pages: one scroll column; main + footer stack in normal document order */
.layout-toolhub.inner-toolhub-page .inner-toolhub-scroll {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* Soft navigation: fetch new page body while shell stays in DOM */
body.ptb-soft-nav-loading .inner-toolhub-scroll {
  pointer-events: none;
  opacity: 0.88;
  transition: opacity 0.15s ease;
}

/* Inner pages: shell breadcrumb is server-rendered with header/sidebar — visible without JS */
.layout-toolhub.inner-toolhub-page .inner-toolhub-shell-crumb {
  display: block !important;
  min-height: 2.25rem !important;
  padding: 0.4rem 2rem 0 2rem !important;
}

/* Breadcrumb moved into #shellBreadcrumb; hide any leftover in-flow crumb in main */
.layout-toolhub.inner-toolhub-page #homeContent main.main .container > nav.breadcrumb {
  display: none !important;
}

.layout-toolhub .section-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Popular Tools header: large bold title, outline star, lighter count */
.layout-toolhub .popular-section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 1rem;
}

.layout-toolhub .popular-section-title .section-title-star {
  font-size: 1.4rem;
  color: #1a1a1a;
  font-weight: 400;
}

.layout-toolhub .section-title-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  color: #1a1a1a;
}
.layout-toolhub .section-title-icon .icon {
  width: 1.5rem;
  height: 1.5rem;
}
.layout-toolhub .section-title-icon .icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.layout-toolhub .popular-section-title .section-title-text {
  font-weight: 700;
}

.layout-toolhub .home-intro {
  margin-bottom: 2rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  text-align: center;
}
.layout-toolhub .home-intro-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 1.25rem 0;
  line-height: 1.3;
}
.layout-toolhub .home-intro-text {
  font-size: 1rem;
  line-height: 1.65;
  color: #4b5563;
  margin: 0;
  text-align: center;
  width: 100%;
}
.layout-toolhub .home-intro-text p {
  margin: 0 0 1rem 0;
}
.layout-toolhub .home-intro-text p:last-child {
  margin-bottom: 0;
}

.layout-toolhub .home-search-results {
  margin-bottom: 2rem;
}

.layout-toolhub .home-search-no-results {
  margin-bottom: 2rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  text-align: center;
}

.layout-toolhub .home-search-no-results-msg {
  margin: 0;
  font-size: 1.05rem;
  color: #4b5563;
  line-height: 1.5;
}

.layout-toolhub .popular-section {
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}

.layout-toolhub .popular-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.layout-toolhub .popular-card {
  background: #fff;
  border-radius: 12px;
  padding: 0.9rem 1.2rem;
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.layout-toolhub .popular-card:hover {
  box-shadow: 0 2px 6px rgba(30, 41, 59, 0.12);
  border-color: #1e293b;
  text-decoration: none;
  color: inherit;
}

.layout-toolhub .popular-card .card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  flex-shrink: 0;
}

.layout-toolhub .popular-card .card-icon.card-icon-svg {
  font-size: 0;
}

.layout-toolhub .popular-card .card-icon.card-icon-svg svg {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
}

.layout-toolhub .popular-card .card-icon.card-icon-category {
  background: #e2e8f0;
  color: #475569;
}

.layout-toolhub .popular-card .card-body { flex: 1; min-width: 0; }
.layout-toolhub .popular-card .card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  margin-bottom: 0.2rem;
}
.layout-toolhub .popular-card .card-desc {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.layout-toolhub .popular-card .btn-go {
  flex-shrink: 0;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  background: #fff;
  color: #1a1a1a;
  font-size: 0.9rem;
  font-weight: 700;
  border: 1px solid #d1d5db;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.layout-toolhub .popular-card .btn-go:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #1a1a1a;
}

/* Gear strip (gr / vs / ch) replaces “Go” on non-Popular cards; states toggled by JS */
.layout-toolhub .popular-card .btn-go.ptb-gear-go {
  position: relative;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.layout-toolhub .popular-card .btn-go.ptb-gear-go:hover {
  background: transparent;
  border: none;
  color: inherit;
}
.layout-toolhub .popular-card .ptb-gear-pic {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.layout-toolhub .popular-card .ptb-gear-pic .ptb-gear-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  display: block;
}
.layout-toolhub .popular-card.ptb-gear-state-gr .ptb-gear-pic[data-ptb-gear="gr"],
.layout-toolhub .popular-card.ptb-gear-state-vs .ptb-gear-pic[data-ptb-gear="vs"],
.layout-toolhub .popular-card.ptb-gear-state-ch .ptb-gear-pic[data-ptb-gear="ch"] {
  display: flex;
}

.layout-toolhub .category-section .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.layout-toolhub .filter-row {
  display: flex;
  gap: 0.5rem;
}

.layout-toolhub .filter-row select {
  padding: 0.4rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.85rem;
  background: #fff;
  color: #475569;
  cursor: pointer;
}

.layout-toolhub .all-tools-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.layout-toolhub .all-tools-category-block {
  margin: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.layout-toolhub .all-tools-category-block .section-title-text:hover {
  text-decoration: underline;
}
.layout-toolhub .tool-card-link {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.layout-toolhub .all-tools-category-block .section-title-text {
  text-decoration: none;
  color: inherit;
}

.layout-toolhub .tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 1200px) {
  .layout-toolhub .tools-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 992px) {
  .layout-toolhub .popular-grid { grid-template-columns: repeat(2, 1fr); }
  .layout-toolhub .tools-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile: width ≤768px always; tablet portrait (≤1024px) = mobile layout */
@media (max-width: 768px), ((max-width: 1024px) and (orientation: portrait)) {
  /* Single page scroll: header + column scroll together (not a fixed bar above an inner overflow). */
  html:has(body.layout-toolhub) {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100%;
  }
  body.layout-toolhub {
    overflow-x: hidden;
    overflow-y: visible;
    height: auto;
    min-height: 100%;
    min-height: 100dvh;
  }
  .layout-toolhub .app-wrap {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: none;
    overflow: visible;
  }
  .layout-toolhub .app-body {
    overflow: visible;
    flex: 1 1 auto;
    min-height: 0;
  }
  .layout-toolhub.inner-toolhub-page .toolhub-main-content {
    overflow: visible !important;
  }
  .layout-toolhub.inner-toolhub-page .inner-toolhub-scroll {
    overflow: visible !important;
  }
  .layout-toolhub .home-content {
    overflow: visible !important;
  }
  /* Inner tool/category pages: #app-content had overflow:hidden + flex min-height:0 — clips tall tool UI (generator result panels) on phones. */
  .layout-toolhub.inner-toolhub-page .app-content {
    overflow: visible !important;
  }
  html.route-tool .layout-toolhub .main-content {
    overflow: visible !important;
  }

  /* TOP1 tools (generators, etc.): match /text-tools/ — panel + #out grow with content; page scrolls, no clipped output. */
  body.ptb-tool-top1.layout-toolhub.inner-toolhub-page .main.tool-page .container.wc-page-stack {
    overflow: visible !important;
  }
  body.ptb-tool-top1.layout-toolhub.inner-toolhub-page .main.tool-page section.tool-input.wc-panel {
    overflow: visible !important;
  }
  body.ptb-tool-top1.layout-toolhub.inner-toolhub-page .main.tool-page section.tool-input.wc-panel .tool-card {
    overflow: visible !important;
  }

  /* WCAG contrast checker: keep live readout + checklist on-screen (flex shrink / compositing on iOS). */
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="contrast-checker"] .ptb-cx-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="contrast-checker"] .ptb-cx-grid-out .result-box.ptb-cx-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="contrast-checker"] #out.ptb-cx-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="gradient-generator"] .ptb-grad-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="gradient-generator"] .ptb-grad-grid-out .result-box.ptb-grad-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="gradient-generator"] #out.ptb-grad-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-harmonizer"] .ptb-harm-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-harmonizer"] .ptb-harm-grid-out .result-box.ptb-harm-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-harmonizer"] #out.ptb-harm-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="complementary-color"] .ptb-cmpl-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="complementary-color"] .ptb-cmpl-grid-out .result-box.ptb-cmpl-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="complementary-color"] #out.ptb-cmpl-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-rgb"] .ptb-h2r-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-rgb"] .ptb-h2r-grid-out .result-box.ptb-h2r-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-rgb"] #out.ptb-h2r-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-hsl"] .ptb-h2hs-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-hsl"] .ptb-h2hs-grid-out .result-box.ptb-h2hs-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-hsl"] #out.ptb-h2hs-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-blindness-simulator"] .ptb-cbs-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-blindness-simulator"] .ptb-cbs-grid-out .result-box.ptb-cbs-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-blindness-simulator"] #out.ptb-cbs-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 13rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-mixer"] .ptb-cm-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-mixer"] .ptb-cm-grid-out .result-box.ptb-cm-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-mixer"] #out.ptb-cm-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 13rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="rgb-to-hex"] .ptb-r2h-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="rgb-to-hex"] .ptb-r2h-grid-out .result-box.ptb-r2h-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="rgb-to-hex"] #out.ptb-r2h-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hsl-to-hex"] .ptb-hslhx-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hsl-to-hex"] .ptb-hslhx-grid-out .result-box.ptb-hslhx-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hsl-to-hex"] #out.ptb-hslhx-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-picker"] .ptb-cp-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-picker"] .ptb-cp-grid-out .result-box.ptb-cp-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-picker"] #out.ptb-cp-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-converter"] .ptb-cconv-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-converter"] .ptb-cconv-grid-out .result-box.ptb-cconv-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-converter"] #out.ptb-cconv-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }

  .layout-toolhub .main-top-bar {
    display: grid;
    grid-template-rows: 78px auto;
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    gap: 0 0.5rem;
    padding-bottom: 10px;
    position: relative;
    top: auto;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .layout-toolhub .main-top-bar .header-row {
    grid-row: 1;
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .layout-toolhub .main-top-bar .header-share-wrap {
    grid-row: 3;
    grid-column: 1 / -1;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0 0 4px;
    margin-top: 2px;
  }
  .layout-toolhub .main-top-bar .header-share-wrap .header-share-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }
  .layout-toolhub .main-top-bar .header-share-wrap .header-share-btn svg {
    width: 16px;
    height: 16px;
  }
  .layout-toolhub .main-top-bar .header-nav {
    display: none; /* About, Contact only in footer on mobile */
  }
  .layout-toolhub .footer .footer-nav-mobile-cluster,
  .footer.layout-toolhub-shell-footer .footer-nav-mobile-cluster {
    display: contents !important;
  }

  /* Footer links: even spacing; full footer reachable when scrolling (safe area / not clipped) */
  .layout-toolhub .footer .footer-nav,
  .footer.layout-toolhub-shell-footer .footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    row-gap: 0.5rem;
  }
  .layout-toolhub .footer .footer-nav a,
  .footer.layout-toolhub-shell-footer .footer-nav a {
    flex: 0 0 auto;
  }
  /* Scroll area: bottom padding so last lines + footer aren’t under home indicator */
  .layout-toolhub .home-content {
    padding-bottom: max(2.5rem, calc(env(safe-area-inset-bottom, 0px) + 1.5rem));
    box-sizing: border-box;
  }
  /* Footer lives inside .inner-toolhub-scroll — need generous bottom inset (iOS home bar) */
  .layout-toolhub.inner-toolhub-page .inner-toolhub-scroll {
    padding-bottom: max(3rem, calc(env(safe-area-inset-bottom, 0px) + 2rem));
    box-sizing: border-box;
  }
  .layout-toolhub.inner-toolhub-page .inner-toolhub-scroll > footer.layout-toolhub-shell-footer {
    padding-bottom: max(1.5rem, calc(env(safe-area-inset-bottom, 0px) + 1rem));
    box-sizing: border-box;
  }
  .layout-toolhub .main-top-bar .header-search-wrap {
    grid-row: 2;
    grid-column: 1 / -1;
    padding: 0;
    padding-top: 0;
    margin-top: -5px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .layout-toolhub .main-top-bar .search-field-wrap {
    max-width: none;
    width: 100%;
    min-width: 0;
  }
  .layout-toolhub .main-top-bar .sidebar-toggle { display: flex; margin-left: auto; }
  .layout-toolhub .app-body { position: relative; }
  .layout-toolhub .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 20;
    width: 280px;
    max-width: 85vw;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
  }
  body.layout-toolhub.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .layout-toolhub .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 0;
    z-index: 15;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.25s ease-out;
  }
  body.layout-toolhub.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  .layout-toolhub .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .layout-toolhub .popular-grid { grid-template-columns: 1fr; }
  /* Do not use padding shorthand on .toolhub-main-content — it overwrote safe-area padding-bottom */
  .layout-toolhub .main-content {
    padding: 0 1rem max(1.5rem, calc(env(safe-area-inset-bottom, 0px) + 0.75rem));
    box-sizing: border-box;
  }
  .layout-toolhub .toolhub-main-content {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 0;
    padding-bottom: max(2.25rem, calc(env(safe-area-inset-bottom, 0px) + 1.5rem));
    box-sizing: border-box;
  }
  .layout-toolhub .main-top-bar { padding: 0 1rem 10px 1rem; gap: 0.5rem; }
  .layout-toolhub .shell-breadcrumb-wrap { padding: 0.4rem 1rem 0; }
}

/*
 * Landscape phones & narrow tablets (e.g. width 780–1024, orientation landscape):
 * the block above does NOT run (needs ≤768 or portrait), so .app-content / .toolhub-main-content
 * keep overflow:hidden and flex min-height:0 — tall #out panels get clipped. Unconditionally fix
 * overflow + flex growth for all inner pages up to 1024px wide.
 */
@media (max-width: 1024px) {
  html:has(body.layout-toolhub) {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100%;
  }
  body.layout-toolhub {
    overflow-x: hidden;
    overflow-y: visible;
    height: auto;
    min-height: 100%;
    min-height: 100dvh;
  }
  .layout-toolhub .app-wrap {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: none;
    overflow: visible;
  }
  .layout-toolhub .app-body {
    overflow: visible;
    flex: 1 1 auto;
    min-height: 0;
  }
  .layout-toolhub.inner-toolhub-page .toolhub-main-content {
    overflow: visible !important;
  }
  .layout-toolhub.inner-toolhub-page .inner-toolhub-scroll {
    overflow: visible !important;
    min-height: min-content !important;
  }
  .layout-toolhub .home-content {
    overflow: visible !important;
  }
  .layout-toolhub.inner-toolhub-page .app-content {
    overflow: visible !important;
  }
  html.route-tool .layout-toolhub .main-content {
    overflow: visible !important;
  }
  body.ptb-tool-top1.layout-toolhub.inner-toolhub-page .main.tool-page .container.wc-page-stack,
  body.ptb-tool-top1.layout-toolhub.inner-toolhub-page .main.tool-page section.tool-input.wc-panel,
  body.ptb-tool-top1.layout-toolhub.inner-toolhub-page .main.tool-page section.tool-input.wc-panel .tool-card {
    overflow: visible !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="contrast-checker"] .ptb-cx-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="contrast-checker"] .ptb-cx-grid-out .result-box.ptb-cx-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="contrast-checker"] #out.ptb-cx-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="gradient-generator"] .ptb-grad-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="gradient-generator"] .ptb-grad-grid-out .result-box.ptb-grad-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="gradient-generator"] #out.ptb-grad-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-harmonizer"] .ptb-harm-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-harmonizer"] .ptb-harm-grid-out .result-box.ptb-harm-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-harmonizer"] #out.ptb-harm-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="complementary-color"] .ptb-cmpl-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="complementary-color"] .ptb-cmpl-grid-out .result-box.ptb-cmpl-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="complementary-color"] #out.ptb-cmpl-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-rgb"] .ptb-h2r-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-rgb"] .ptb-h2r-grid-out .result-box.ptb-h2r-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-rgb"] #out.ptb-h2r-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-hsl"] .ptb-h2hs-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-hsl"] .ptb-h2hs-grid-out .result-box.ptb-h2hs-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hex-to-hsl"] #out.ptb-h2hs-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-blindness-simulator"] .ptb-cbs-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-blindness-simulator"] .ptb-cbs-grid-out .result-box.ptb-cbs-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-blindness-simulator"] #out.ptb-cbs-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 13rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-mixer"] .ptb-cm-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-mixer"] .ptb-cm-grid-out .result-box.ptb-cm-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-mixer"] #out.ptb-cm-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 13rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="rgb-to-hex"] .ptb-r2h-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="rgb-to-hex"] .ptb-r2h-grid-out .result-box.ptb-r2h-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="rgb-to-hex"] #out.ptb-r2h-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hsl-to-hex"] .ptb-hslhx-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hsl-to-hex"] .ptb-hslhx-grid-out .result-box.ptb-hslhx-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="hsl-to-hex"] #out.ptb-hslhx-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-picker"] .ptb-cp-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-picker"] .ptb-cp-grid-out .result-box.ptb-cp-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-picker"] #out.ptb-cp-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-converter"] .ptb-cconv-grid-out {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    max-height: none !important;
  }
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-converter"] .ptb-cconv-grid-out .result-box.ptb-cconv-result-panel,
  .main.tool-page .tool-input.wc-panel .tool-card[data-tool="color-converter"] #out.ptb-cconv-result-panel {
    flex: none !important;
    flex-shrink: 0 !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 12rem !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    max-height: none !important;
    -webkit-transform: translateZ(0);
  }
  .layout-toolhub.inner-toolhub-page #homeContent {
    min-height: min-content !important;
  }
}

@media (max-width: 480px) {
  .layout-toolhub .tools-grid { grid-template-columns: 1fr; }
  .layout-toolhub .main-content {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-bottom: max(1.5rem, calc(env(safe-area-inset-bottom, 0px) + 0.75rem));
    box-sizing: border-box;
  }
  .layout-toolhub .toolhub-main-content {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-bottom: max(2.25rem, calc(env(safe-area-inset-bottom, 0px) + 1.5rem));
    box-sizing: border-box;
  }
  .layout-toolhub .main-top-bar { padding: 0 0.75rem 10px 0.75rem; }
}

.layout-toolhub .tool-card:not([data-tool]) {
  background: #fff;
  border-radius: 16px;
  padding: 1rem 1.25rem;
  min-height: 160px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.layout-toolhub .tool-card:not([data-tool]):hover {
  box-shadow: 0 2px 6px rgba(30, 41, 59, 0.12);
  border-color: #1e293b;
}
.layout-toolhub .tool-card:not([data-tool]):hover .card-title {
  color: #1e293b;
}

.layout-toolhub .tool-card:not([data-tool]) .card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  margin-bottom: 0.75rem;
}

.layout-toolhub .tool-card:not([data-tool]) .card-icon.card-icon-svg {
  font-size: 0;
}

.layout-toolhub .tool-card:not([data-tool]) .card-icon.card-icon-svg svg {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
}

.layout-toolhub .tool-card:not([data-tool]) .card-icon.card-icon-category {
  background: #e2e8f0;
  color: #475569;
}

.layout-toolhub .tool-card:not([data-tool]) .card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.layout-toolhub .tool-card:not([data-tool]) .card-desc {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1rem;
}

.layout-toolhub .tool-card:not([data-tool]) .btn-view {
  display: block;
  text-align: center;
  padding: 0.5rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #2563eb;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s;
}

.layout-toolhub .tool-card:not([data-tool]) .btn-view:hover {
  background: #e2e8f0;
  color: #1d4ed8;
  text-decoration: none;
}

.layout-toolhub .no-results {
  padding: 2rem;
  text-align: center;
  color: #64748b;
  font-size: 0.95rem;
}

/* Home: category links — same bar + chip style as .main-top-bar / .header-nav (About, Contact) */
/* Inset like .home-intro so border-radius is not clipped by .main-content / .app-content overflow:hidden */
.layout-toolhub .home-crawl-directory {
  margin: 1.25rem 0 1.75rem;
  padding: 1.1rem 1.75rem 1.2rem;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-sizing: border-box;
  overflow: hidden;
}

.layout-toolhub .home-crawl-cats-nav {
  display: flex;
  justify-content: center;
  width: 100%;
}

.layout-toolhub .home-crawl-cats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  max-width: 56rem;
}

.layout-toolhub .home-crawl-cats li {
  margin: 0;
}

/* Match .layout-toolhub .main-top-bar .header-nav a */
.layout-toolhub .home-crawl-cats a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 34px;
  padding: 0 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.layout-toolhub .home-crawl-cats a:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  text-decoration: none;
}

@media (max-width: 480px) {
  .layout-toolhub .home-crawl-cats a {
    font-size: 0.88rem;
    padding: 0 0.65rem;
    min-height: 32px;
  }
}

/* all-tools static page (before/after shell wrap) */
.all-tools-directory .all-tools-cat-block {
  margin-bottom: 2rem;
}

.all-tools-directory .all-tools-link-list {
  list-style: disc;
  margin: 0 0 0.5rem;
  padding-left: 1.35rem;
  columns: 2;
  column-gap: 2rem;
}

@media (min-width: 768px) {
  .all-tools-directory .all-tools-link-list {
    columns: 3;
  }
}

.all-tools-directory .all-tools-link-list li {
  break-inside: avoid;
  margin-bottom: 0.35rem;
}

/* Inner tool pages: stacked cards, H1 outside panels (see .cursor/rules/tool-page-layout.mdc) */
.layout-toolhub.inner-toolhub-page .main.tool-page .container.wc-page-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .container.wc-page-stack > h1 {
  margin-top: 0;
  margin-bottom: 0;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .container.wc-page-stack > .tool-related,
.layout-toolhub.inner-toolhub-page .main.tool-page .container.wc-page-stack > .tool-faq,
.layout-toolhub.inner-toolhub-page .main.tool-page .container.wc-page-stack > .tool-recent {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .wc-panel {
  margin: 0;
  padding: 1.5rem 1.75rem;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .wc-panel .tool-seo-h2:first-child {
  margin-top: 0;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .wc-panel .tool-when-useful-list,
.layout-toolhub.inner-toolhub-page .main.tool-page .wc-panel .tool-faq-list {
  margin-bottom: 0;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .wc-panel p:last-child,
.layout-toolhub.inner-toolhub-page .main.tool-page .wc-panel ul:last-child {
  margin-bottom: 0;
}

/* Above-the-fold tool hero: one-line promise + live mini-stats */
.layout-toolhub.inner-toolhub-page .main.tool-page .tool-tagline {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  line-height: 1.45;
  color: #333;
  font-weight: 500;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .tool-live-mini-stats {
  margin: 0.5rem 0 0.65rem;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #334155;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .tool-trust-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.45rem 1rem;
  font-size: 0.92rem;
  color: #1e293b;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .tool-trust-checks li {
  position: relative;
  padding-left: 1.35rem;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .tool-trust-checks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 2px #dcfce7;
}

/* Contrast checker: inputs, preview, WCAG list */
.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-checker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.25rem;
  margin-bottom: 0.25rem;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-color-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-color-row input[type="color"] {
  width: 3rem;
  height: 2.5rem;
  padding: 0.15rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  flex-shrink: 0;
  box-sizing: border-box;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-hex-input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-sizing: border-box;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-swap-wrap {
  margin: 0.35rem 0 0.75rem;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-size-fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.65rem 1rem 0.85rem;
  margin: 0 0 1rem;
  background: #f8fafc;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-size-legend {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  padding: 0 0.35rem;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-radio-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.4rem 0 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #334155;
  cursor: pointer;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-radio-label input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-preview {
  min-height: 5.5rem;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 0.35rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-preview-heading {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-preview-body {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-result-box {
  font-size: 0.95rem;
  line-height: 1.5;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-ratio-big {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  color: #0f172a;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-ratio-big strong {
  font-variant-numeric: tabular-nums;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-ratio-sub {
  font-size: 0.85rem;
  font-weight: 400;
  color: #64748b;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-size-note {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: #475569;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-wcag-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-wcag-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-pass {
  background: #ecfdf5;
  color: #065f46;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-fail {
  background: #fef2f2;
  color: #991b1b;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-wcag-label {
  flex: 1;
  min-width: 12rem;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-wcag-list li strong {
  font-variant-numeric: tabular-nums;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-hex-line {
  margin: 0;
  font-size: 0.88rem;
  color: #64748b;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-hex-line code {
  font-size: 0.9em;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-msg {
  margin: 0;
}

.layout-toolhub.inner-toolhub-page .main.tool-page .contrast-msg-warn {
  color: #b45309;
  background: #fffbeb;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #fde68a;
}

/* /text-tools/ hub: primary inputs ~7 lines by default, grow with content. */
body.ptb-hub-text-tools.layout-toolhub .main.tool-page #tool-root textarea:not([readonly]):not([aria-readonly="true"]):not([rows="2"]) {
  field-sizing: content;
  resize: vertical;
  min-height: calc(7 * 1.45em);
  line-height: 1.45;
  box-sizing: border-box;
}
@supports (min-height: 1lh) {
  body.ptb-hub-text-tools.layout-toolhub .main.tool-page #tool-root textarea:not([readonly]):not([aria-readonly="true"]):not([rows="2"]) {
    min-height: 7lh;
  }
}
