/* ToolsOnline — minimalist mobile layer */
@media (max-width: 767px) {
  :root {
    --mobile-nav-h: 3.5rem;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
  }

  body.has-mobile-nav {
    padding-bottom: calc(var(--mobile-nav-h) + var(--safe-bottom));
  }

  /* Compact sticky header */
  header.sticky,
  header[class*="sticky"] {
    padding-top: var(--safe-top);
  }

  header nav,
  header > div {
    min-height: 3rem !important;
    height: auto !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  header nav > div.flex.items-center.gap-6,
  header nav > div.flex.items-center.gap-6 ~ *,
  header .flex.items-center.gap-6:not(:first-child) {
    display: none !important;
  }

  header span.text-xl {
    font-size: 1rem !important;
  }

  header svg.w-8,
  header .w-10 {
    width: 1.75rem !important;
    height: 1.75rem !important;
  }

  /* Back to home — top right on tool pages */
  #mobile-home-back {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    border-radius: 9999px;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  #mobile-home-back svg {
    width: 1rem !important;
    height: 1rem !important;
  }

  #mobile-home-back:active {
    background: #dbeafe;
  }

  /* Hide clutter on tool pages */
  #breadcrumb-nav,
  #features-section,
  #in-depth-content,
  #related-tools,
  .mobile-hide {
    display: none !important;
  }

  /* Compact hero on tool pages */
  #breadcrumb-nav ~ section.bg-gradient-to-b,
  #breadcrumb-nav ~ section[class*="gradient"] {
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
  }

  #breadcrumb-nav ~ section h1 {
    font-size: 1.5rem !important;
    line-height: 1.25 !important;
  }

  #breadcrumb-nav ~ section p,
  #breadcrumb-nav ~ section .flex.flex-wrap.justify-center.gap-3 {
    display: none !important;
  }

  /* Home page — compact hero */
  body.home-mobile section.bg-gradient-to-b.from-blue-50 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  body.home-mobile section.bg-gradient-to-b.from-blue-50 h1 {
    font-size: 1.625rem !important;
    margin-bottom: 0.75rem !important;
  }

  body.home-mobile section.bg-gradient-to-b.from-blue-50 > div > p {
    display: none;
  }

  body.home-mobile section.bg-gradient-to-b.from-blue-50 .flex.flex-wrap.justify-center.gap-3 {
    display: none;
  }

  body.home-mobile section.bg-gradient-to-b.from-blue-50 .max-w-md {
    margin-bottom: 0 !important;
  }

  /* Tool grid — icon + name only */
  .tool-card {
    padding: 0.875rem !important;
    border-radius: 1rem !important;
  }

  .tool-card .text-3xl {
    font-size: 1.375rem !important;
    margin-bottom: 0.375rem !important;
  }

  .tool-card .text-sm.text-gray-500 {
    display: none !important;
  }

  .tool-card .font-semibold {
    font-size: 0.8125rem !important;
    line-height: 1.25 !important;
  }

  section.py-16 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  section.py-16 > h2 {
    font-size: 1.25rem !important;
    margin-bottom: 0.25rem !important;
  }

  section.py-16 > p.text-gray-600.mb-8 {
    display: none;
  }

  /* Ad slots — compact on mobile */
  ins.adsbygoogle {
    min-height: 60px !important;
  }

  footer .grid {
    display: none !important;
  }

  footer {
    padding: 1.25rem 1rem !important;
    margin-bottom: 0;
  }

  footer .border-t {
    border: 0 !important;
    padding-top: 0 !important;
  }

  /* Touch-friendly inputs */
  input,
  select,
  textarea,
  button {
    min-height: 2.75rem;
    font-size: 16px !important; /* prevent iOS zoom */
  }

  /* Bottom navigation */
  #mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    align-items: stretch;
    height: calc(var(--mobile-nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #e5e7eb;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  #mobile-bottom-nav a,
  #mobile-bottom-nav button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    min-height: var(--mobile-nav-h);
    padding: 0.375rem 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: 0;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  #mobile-bottom-nav svg {
    width: 1.375rem;
    height: 1.375rem;
  }

  #mobile-bottom-nav .active {
    color: #2563eb;
  }

  /* Install hint */
  #mobile-install-bar {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    top: calc(0.5rem + var(--safe-top));
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: #1e293b;
    color: #f8fafc;
    border-radius: 0.875rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    font-size: 0.8125rem;
    line-height: 1.35;
  }

  #mobile-install-bar.hidden {
    display: none !important;
  }

  #mobile-install-bar button {
    min-height: auto;
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    background: #2563eb;
    color: #fff;
    border: 0;
    white-space: nowrap;
    flex-shrink: 0;
  }

  #mobile-install-bar .close-install {
    background: transparent;
    color: #94a3b8;
    padding: 0.25rem;
    font-size: 1.125rem;
    line-height: 1;
  }

  /* Recent tools sheet */
  #mobile-recent-sheet {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
  }

  #mobile-recent-sheet.open {
    display: block;
  }

  #mobile-recent-sheet .sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
  }

  #mobile-recent-sheet .sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 70vh;
    padding: 1rem 1rem calc(1rem + var(--safe-bottom));
    background: #fff;
    border-radius: 1.25rem 1.25rem 0 0;
    overflow-y: auto;
  }

  #mobile-recent-sheet h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.75rem;
  }

  #mobile-recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  #mobile-recent-list a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: #f9fafb;
    color: #111827;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
  }

  #mobile-recent-list .empty {
    color: #6b7280;
    font-size: 0.875rem;
    padding: 1rem 0;
    text-align: center;
  }

  #mobile-recent-home {
    margin-top: 1rem;
  }

  #mobile-recent-home .tool-card {
    min-height: auto;
  }

  /* Cookie banner above bottom nav */
  .cookie-banner.show {
    bottom: calc(var(--mobile-nav-h) + var(--safe-bottom)) !important;
  }
}

@media (min-width: 768px) {
  #mobile-bottom-nav,
  #mobile-install-bar,
  #mobile-recent-sheet,
  #mobile-home-back {
    display: none !important;
  }
}
