/* Floating “to the top” */
.to-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  z-index: 45;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border, #d6d6d6);
  background: var(--panel, #ffffff);
  color: var(--ink, #121212);
  box-shadow: 0 6px 20px rgba(26, 26, 26, 0.12);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.to-top:hover {
  border-color: var(--primary, #4e8dff);
  color: var(--primary, #4e8dff);
}

.to-top:focus-visible {
  outline: 2px solid var(--primary, #4e8dff);
  outline-offset: 2px;
}

html[data-theme='dark'] .to-top {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
