:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

.maintainer-only {
  display: none !important;
}

body.maintainer-mode .maintainer-only {
  display: block !important;
}

body:not(.maintainer-mode) #evidenceTools {
  grid-template-columns: minmax(0, 1fr);
}

.mobile-access-banner {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 16px;
  border: 2px solid var(--ink, #213547);
  border-radius: 20px;
  background: #fff0a8;
  box-shadow: 4px 5px 0 var(--ink, #213547);
}

.mobile-access-banner[hidden] {
  display: none;
}

.mobile-access-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid var(--ink, #213547);
  border-radius: 14px;
  background: #ff72aa;
  font-size: 22px;
}

.mobile-access-banner strong,
.mobile-access-banner small {
  display: block;
}

.mobile-access-banner small {
  margin-top: 2px;
  color: #536577;
}

.mobile-access-banner button {
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid var(--ink, #213547);
  border-radius: 14px;
  background: #64dfc6;
  color: var(--ink, #213547);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.mobile-access-banner .mobile-access-close {
  width: 44px;
  padding-inline: 0;
  background: #fff;
  font-size: 22px;
}

.route-publication-summary {
  margin: 14px 0 18px;
  padding: 13px 16px;
  border: 2px solid var(--ink, #213547);
  border-radius: 18px;
  background: #e8fbf5;
  color: #385264;
  font-weight: 750;
}

.route-publication-summary strong {
  color: var(--ink, #213547);
}

.route-library-loading,
.route-library-empty {
  grid-column: 1 / -1;
  padding: 28px 20px;
  border: 2px dashed #7a8792;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  text-align: center;
}

.route-library-loading span {
  display: inline-block;
  margin-right: 8px;
  animation: v5-bob 1.1s ease-in-out infinite alternate;
}

.recipe-swap-notice {
  margin: 0 0 14px;
  padding: 13px 15px;
  border: 2px solid var(--ink, #213547);
  border-radius: 16px;
  color: var(--ink, #213547);
  line-height: 1.55;
}

.recipe-swap-notice.is-exact {
  background: #dcf8ee;
}

.recipe-swap-notice.is-swapped {
  background: #fff0a8;
}

@keyframes v5-bob {
  to { transform: translateY(-5px) rotate(7deg); }
}

.footer-meta a,
.footer-link-button {
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-link-button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.mobile-dock {
  display: none;
}

.privacy-page {
  max-width: 920px;
  padding-top: clamp(24px, 5vw, 64px);
  padding-bottom: 64px;
}

.privacy-page > h1 {
  max-width: 760px;
  margin: 18px 0 12px;
  font-size: clamp(38px, 7vw, 76px);
  line-height: 0.98;
}

.privacy-card {
  margin-top: 18px;
  padding: clamp(18px, 3vw, 28px);
  border: 3px solid var(--ink, #213547);
  border-radius: 24px;
  background: #fff;
  box-shadow: 5px 6px 0 var(--ink, #213547);
}

.privacy-card:nth-of-type(3n + 1) { background: #ffe4ef; }
.privacy-card:nth-of-type(3n + 2) { background: #fff1a8; }
.privacy-card:nth-of-type(3n) { background: #ddf8f2; }
.privacy-card h2 { margin-top: 0; }
.privacy-card p { margin-bottom: 0; line-height: 1.75; }
.privacy-updated { margin-top: 28px; color: #657382; }

dialog {
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: calc(76px + var(--safe-top));
  }

  body {
    padding-bottom: calc(78px + var(--safe-bottom));
  }

  .site-header {
    padding-top: max(10px, var(--safe-top));
    padding-right: max(14px, var(--safe-right));
    padding-left: max(14px, var(--safe-left));
  }

  .mobile-access-banner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin: 10px max(12px, var(--safe-right)) 0 max(12px, var(--safe-left));
    padding: 10px 11px;
    border-radius: 18px;
  }

  .mobile-access-banner #installApp {
    grid-column: 2 / -1;
    width: 100%;
  }

  .mobile-access-banner .mobile-access-close {
    grid-column: 3;
    grid-row: 1;
  }

  .mobile-access-banner small {
    font-size: 12px;
    line-height: 1.45;
  }

  button,
  a.pill-button,
  input,
  select,
  textarea,
  summary {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  .route-recipe-meta span,
  .v4-live-strip span,
  .v4-live-strip small,
  .v4-pilot-card small,
  .coordinate-route-item small,
  .task-card small,
  .freshness-badge,
  .signal-chip {
    font-size: 12px !important;
    line-height: 1.35;
  }

  .route-publication-summary {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
  }

  .coordinate-route-list {
    max-height: none;
    overflow: visible;
  }

  .mobile-dock {
    position: fixed;
    z-index: 90;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 7px max(8px, var(--safe-right)) max(7px, var(--safe-bottom)) max(8px, var(--safe-left));
    border-top: 2px solid var(--ink, #213547);
    background: rgba(255, 249, 231, 0.96);
    box-shadow: 0 -6px 22px rgba(33, 53, 71, 0.14);
    backdrop-filter: blur(14px);
  }

  .mobile-dock a {
    display: grid;
    min-height: 52px;
    place-items: center;
    align-content: center;
    gap: 1px;
    border-radius: 16px;
    color: var(--ink, #213547);
    text-decoration: none;
    font-weight: 900;
  }

  .mobile-dock a:active,
  .mobile-dock a:focus-visible {
    background: #ffd954;
  }

  .mobile-dock span {
    font-size: 20px;
    line-height: 1;
  }

  .mobile-dock small {
    font-size: 11px;
  }

  .toast {
    bottom: calc(82px + var(--safe-bottom));
  }

  dialog {
    width: calc(100% - 18px);
    max-height: calc(100dvh - 18px);
    margin: auto;
  }

  .spot-dialog .dialog-body,
  .spot-dialog #dialogContent,
  .spot-dialog #spotUpgradePanel,
  .spot-dialog #spotUpgradePanel > *,
  .spot-dialog #spotUpgradePanel .freshness-timeline,
  .spot-dialog #spotUpgradePanel .freshness-timeline > div,
  .spot-dialog #spotUpgradePanel .signal-board,
  .spot-dialog #spotUpgradePanel .signal-item {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .spot-dialog .dialog-body,
  .spot-dialog #dialogContent {
    overflow-x: hidden;
  }

  .spot-dialog #spotUpgradePanel .signal-item {
    grid-template-columns: 24px minmax(0, 1fr) !important;
  }

  .spot-dialog #spotUpgradePanel .signal-item > *,
  .spot-dialog #spotUpgradePanel .freshness-timeline > div > * {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (display-mode: standalone) and (max-width: 760px) {
  .site-header {
    padding-top: calc(10px + var(--safe-top));
  }
}

@media (prefers-reduced-motion: reduce) {
  .route-library-loading span {
    animation: none;
  }
}
