:root {
  --w2d-update-bottom: max(16px, env(safe-area-inset-bottom));
}

#w2dUpdateAvailable {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: var(--w2d-update-bottom);
  z-index: 100080;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(390px, calc(100vw - 28px));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 8px 9px 8px 14px;
  background: rgba(17, 24, 39, 0.96);
  color: #fff;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font: 750 13px/1.2 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

#w2dUpdateAvailable[data-visible="true"] {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

#w2dUpdateAvailable .w2d-update-copy {
  min-width: 0;
}

#w2dUpdateAvailable .w2d-update-copy small {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 10px;
  font-weight: 600;
}

#w2dUpdateAvailable button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

#w2dUpdateAvailable .w2d-update-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

#w2dUpdateAvailable button:disabled {
  cursor: wait;
  opacity: 0.72;
}

@media (max-width: 520px) {
  #w2dUpdateAvailable {
    right: max(12px, env(safe-area-inset-right));
    left: max(12px, env(safe-area-inset-left));
    bottom: max(12px, env(safe-area-inset-bottom));
    max-width: none;
    justify-content: space-between;
  }

  body:has(input:focus, textarea:focus, [contenteditable="true"]:focus) #w2dUpdateAvailable {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #w2dUpdateAvailable {
    transition: none;
  }
}
