.back-to-top {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 45;
  width: 72px;
  min-height: 72px;
  padding: 12px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #d8e3fc;
  border-radius: 16px;
  background: rgba(255, 255, 255, .96);
  color: var(--blue);
  box-shadow: 0 6px 24px rgba(34, 67, 153, .12);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: background .2s, border-color .2s, box-shadow .2s;
}

.back-to-top[hidden] { display: none; }
.back-to-top svg { width: 23px; height: 23px; }
.back-to-top:hover { background: #edf3ff; border-color: #b4c9fc; }
.back-to-top:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }

@media (max-width: 640px) {
  .back-to-top {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 60px;
    min-height: 60px;
    padding: 8px 4px;
    border-radius: 13px;
    font-size: 11px;
    gap: 3px;
  }
  .back-to-top svg { width: 21px; height: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: none; }
}
