.back-to-top {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 18;
  display: inline-flex;
  min-width: 3.75rem;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  padding: 0.5rem 0.78rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgb(19 26 36 / 0.94);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.3);
  backdrop-filter: blur(12px);
}

.back-to-top:hover {
  border-color: #50647d;
  background: var(--surface-raised);
  color: var(--text);
}

.back-to-top__arrow {
  font-size: 1.05em;
  line-height: 1;
}

.back-to-top[hidden] {
  display: none !important;
}

@media (max-width: 48rem) {
  .back-to-top {
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    min-width: 3.5rem;
    min-height: 2.75rem;
    padding: 0.48rem 0.68rem;
    font-size: 0.84rem;
  }
}

@media print {
  .back-to-top {
    display: none !important;
  }
}
