/* DB PHYSICS — Floating Bottom Navigation */
.dbp-bottom-nav,
.dbp-more-panel,
.dbp-more-backdrop {
  display: none;
}

@media (max-width: 700px) {
  /* Remove the old top navigation and its reserved vertical space */
  body > header:has(.lg-dock) {
    display: none !important;
  }

  body .lg-dock,
  body .lg-dock > .lg-link,
  body .lg-dock > .dbp-mobile-menu-button {
    display: none !important;
  }

  body > main {
    padding-top: 20px !important;
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Fixed, compact four-item bottom bar */
  .dbp-bottom-nav {
    position: fixed;
    z-index: 9996;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 7px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 23px;
    background: rgba(18,24,48,.94);
    box-shadow: 0 8px 28px rgba(0,0,0,.28);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .dbp-bottom-nav a,
  .dbp-bottom-nav button {
    min-width: 0;
    min-height: 52px;
    padding: 5px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: #cbd5e1;
    text-decoration: none;
    font: 700 10px/1.15 Inter, system-ui, sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .dbp-bottom-nav i {
    font-size: 18px;
    line-height: 1;
  }

  .dbp-bottom-nav a.dbp-nav-active,
  .dbp-bottom-nav button[aria-expanded="true"] {
    background: rgba(129,140,248,.2);
    color: #c7d2fe;
  }

  .dbp-bottom-nav a:active,
  .dbp-bottom-nav button:active {
    background: rgba(129,140,248,.22);
  }

  /* More links open just above the bottom bar */
  .dbp-more-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9994;
    background: rgba(2,6,23,.28);
  }

  .dbp-more-panel.is-open {
    display: grid;
    position: fixed;
    z-index: 9995;
    left: 12px;
    right: 12px;
    bottom: calc(91px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: min(55vh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 13px;
    border: 1px solid rgba(148,163,184,.3);
    border-radius: 22px;
    background: rgba(15,23,42,.97);
    box-shadow: 0 16px 45px rgba(0,0,0,.3);
  }

  .dbp-more-panel a {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    min-width: 0;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1px solid rgba(148,163,184,.2);
    border-radius: 14px;
    background: rgba(255,255,255,.06);
    color: #f1f5f9;
    text-decoration: none;
    font: 700 11px/1.3 Inter, system-ui, sans-serif;
    overflow-wrap: anywhere;
  }

  .dbp-more-panel a i {
    flex: 0 0 16px;
    color: #a5b4fc;
    text-align: center;
  }

  .dbp-more-panel a:active {
    background: rgba(129,140,248,.2);
  }

  /* Respect the user's automatic light/dark theme */
  html[data-theme="light"] .dbp-bottom-nav {
    background: rgba(255,255,255,.96);
    border-color: rgba(148,163,184,.35);
    box-shadow: 0 8px 28px rgba(15,23,42,.18);
  }

  html[data-theme="light"] .dbp-bottom-nav a,
  html[data-theme="light"] .dbp-bottom-nav button {
    color: #475569;
  }

  html[data-theme="light"] .dbp-bottom-nav a.dbp-nav-active,
  html[data-theme="light"] .dbp-bottom-nav button[aria-expanded="true"] {
    background: #eef2ff;
    color: #4338ca;
  }

  html[data-theme="light"] .dbp-more-panel.is-open {
    background: rgba(248,250,252,.98);
    border-color: rgba(148,163,184,.35);
  }

  html[data-theme="light"] .dbp-more-panel a {
    background: #fff;
    color: #334155;
    border-color: #e2e8f0;
  }

  @media (prefers-reduced-motion: reduce) {
    .dbp-bottom-nav *,
    .dbp-more-panel * {
      scroll-behavior: auto !important;
      transition: none !important;
      animation: none !important;
    }
  }
}
