.jump-to-top {
  position: fixed;
  right: clamp(1rem, 2vw, 1.75rem);
  bottom: clamp(1rem, 2vw, 1.75rem);
  display: inline-grid;
  place-items: center;
  align-items: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: color-mix(in srgb, var(--panel-bg-hover) 88%, white 12%);
  color: color-mix(in srgb, var(--text-primary) 94%, white 6%);
  border-radius: var(--radius-sm);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(var(--brand-color-rgb), 0.18),
    0 16px 34px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px);
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast);
}

.jump-to-top svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  stroke-width: 2.2;
  color: color-mix(in srgb, var(--text-primary) 76%, var(--brand-primary) 24%);
}

.jump-to-top.is-visible {
  visibility: visible;
  pointer-events: auto;
}

.jump-to-top:hover,
.jump-to-top:focus-visible {
  border-color: rgba(var(--brand-color-rgb), 0.42);
  background: color-mix(in srgb, var(--panel-bg-hover) 82%, white 18%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(var(--brand-color-rgb), 0.2),
    0 18px 38px rgba(var(--brand-color-rgb), 0.18);
}

:root[data-theme="light"] .jump-to-top {
  background:
    radial-gradient(circle at top, rgba(193, 64, 38, 0.12), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 235, 229, 0.96));
  border-color: color-mix(in srgb, var(--panel-border) 84%, transparent);
  box-shadow:
    0 0 0 1px rgba(193, 64, 38, 0.08),
    0 14px 30px rgba(35, 24, 18, 0.14);
}

:root[data-theme="light"] .jump-to-top svg {
  color: color-mix(in srgb, var(--text-primary) 90%, var(--brand-primary) 10%);
}

:root[data-theme="light"] .jump-to-top:hover,
:root[data-theme="light"] .jump-to-top:focus-visible {
  border-color: color-mix(in srgb, var(--brand-primary) 48%, var(--panel-border) 52%);
  background:
    radial-gradient(circle at top, rgba(193, 64, 38, 0.18), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(242, 232, 226, 0.98));
}

@media (max-width: 768px) {
  .jump-to-top {
    right: 0.9rem;
    bottom: 0.9rem;
    width: 2.7rem;
    height: 2.7rem;
  }
}
