.theme-change-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 18px;
  opacity: 0;
  background: rgba(178, 218, 255, 0);
  -webkit-backdrop-filter: blur(0) saturate(1) contrast(1) brightness(1);
  backdrop-filter: blur(0) saturate(1) contrast(1) brightness(1);
  pointer-events: all;
  transition:
    opacity .58s cubic-bezier(.22, .72, .18, 1),
    background-color .58s cubic-bezier(.22, .72, .18, 1),
    -webkit-backdrop-filter .96s cubic-bezier(.22, .72, .18, 1),
    backdrop-filter .96s cubic-bezier(.22, .72, .18, 1);
  contain: layout paint style;
}

.theme-change-overlay.is-visible {
  opacity: 1;
  background: rgba(178, 218, 255, .11);
  -webkit-backdrop-filter: blur(22px) saturate(.72) contrast(1.07) brightness(1.04);
  backdrop-filter: blur(22px) saturate(.72) contrast(1.07) brightness(1.04);
}

.theme-change-overlay.is-leaving {
  opacity: 0;
  background: transparent;
  -webkit-backdrop-filter: blur(0) saturate(1) contrast(1) brightness(1);
  backdrop-filter: blur(0) saturate(1) contrast(1) brightness(1);
  pointer-events: none;
}

.theme-change-card {
  width: min(214px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-solid, #fff) 88%, transparent);
  color: var(--text, #111318);
  box-shadow: 0 24px 70px rgba(5, 8, 15, .26);
  text-align: center;
  transform: translateY(8px) scale(.94);
  transition:
    transform .52s cubic-bezier(.22, .72, .18, 1),
    opacity .4s ease;
}

.theme-change-overlay.is-visible .theme-change-card {
  transform: translateY(0) scale(1);
}

.theme-change-overlay.is-leaving .theme-change-card {
  opacity: 0;
  transform: translateY(-5px) scale(.97);
}

.theme-change-card > strong,
.theme-change-card > span {
  display: block;
}

.theme-change-card > strong {
  margin-top: 9px;
  font-size: .86rem;
  line-height: 1.25;
}

.theme-change-card > span {
  margin-top: 2px;
  color: var(--text-muted, #6b7280);
  font-size: .69rem;
}

.theme-change-sky {
  position: relative;
  height: 82px;
  overflow: hidden;
  border-radius: 15px;
  background: linear-gradient(180deg, #69b9ff 0%, #bce5ff 66%, #ffd7a3 100%);
  transition: background .82s cubic-bezier(.22, .72, .18, 1);
}

.theme-change-overlay[data-next-theme="light"] .theme-change-sky {
  background: linear-gradient(180deg, #101a36 0%, #253c68 70%, #8d6a78 100%);
}

.theme-change-overlay[data-next-theme="dark"].is-switching .theme-change-sky {
  background: linear-gradient(180deg, #101a36 0%, #253c68 70%, #8d6a78 100%);
}

.theme-change-overlay[data-next-theme="light"].is-switching .theme-change-sky {
  background: linear-gradient(180deg, #69b9ff 0%, #bce5ff 66%, #ffd7a3 100%);
}

.theme-change-sun,
.theme-change-moon {
  position: absolute;
  top: 17px;
  left: 50%;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  border-radius: 50%;
  transition:
    transform .86s cubic-bezier(.22, .72, .18, 1),
    opacity .56s ease;
}

.theme-change-sun {
  background: #fff1a8;
  box-shadow: 0 0 0 7px rgba(255, 225, 116, .2), 0 0 22px rgba(255, 216, 98, .72);
}

.theme-change-moon {
  background: #f4f6ff;
  box-shadow: inset -7px -3px 0 #c7d1e8, 0 0 18px rgba(219, 228, 255, .54);
  opacity: 0;
  transform: translate(54px, 62px) rotate(24deg);
}

.theme-change-overlay[data-next-theme="light"] .theme-change-sun {
  opacity: 0;
  transform: translate(-54px, 62px) rotate(-20deg);
}

.theme-change-overlay[data-next-theme="light"] .theme-change-moon {
  opacity: 1;
  transform: translate(0, 0) rotate(0);
}

.theme-change-overlay[data-next-theme="dark"].is-switching .theme-change-sun {
  opacity: 0;
  transform: translate(-54px, 62px) rotate(-20deg);
}

.theme-change-overlay[data-next-theme="dark"].is-switching .theme-change-moon,
.theme-change-overlay[data-next-theme="light"].is-switching .theme-change-sun {
  opacity: 1;
  transform: translate(0, 0) rotate(0);
}

.theme-change-overlay[data-next-theme="light"].is-switching .theme-change-moon {
  opacity: 0;
  transform: translate(54px, 62px) rotate(24deg);
}

.theme-change-stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .65s ease;
}

.theme-change-stars i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 5px rgba(255, 255, 255, .8);
}

.theme-change-stars i:nth-child(1) { left: 18%; top: 18%; }
.theme-change-stars i:nth-child(2) { left: 31%; top: 38%; transform: scale(.65); }
.theme-change-stars i:nth-child(3) { right: 20%; top: 24%; transform: scale(.8); }
.theme-change-stars i:nth-child(4) { right: 31%; top: 46%; transform: scale(.55); }

.theme-change-overlay[data-next-theme="light"] .theme-change-stars,
.theme-change-overlay[data-next-theme="dark"].is-switching .theme-change-stars {
  opacity: 1;
}

.theme-change-overlay[data-next-theme="light"].is-switching .theme-change-stars {
  opacity: 0;
}

.theme-change-horizon {
  position: absolute;
  right: -8%;
  bottom: -22px;
  left: -8%;
  height: 48px;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, rgba(28, 55, 71, .44), rgba(17, 29, 42, .82));
}

@media (prefers-reduced-motion: reduce) {
  .theme-change-overlay {
    transition:
      opacity .24s ease,
      background-color .3s ease,
      -webkit-backdrop-filter .3s ease,
      backdrop-filter .3s ease;
  }

  .theme-change-card {
    transform: none;
    transition: opacity .12s ease;
  }

  .theme-change-sky,
  .theme-change-sun,
  .theme-change-moon,
  .theme-change-stars {
    transition: none !important;
  }

  .theme-change-overlay.is-visible .theme-change-card,
  .theme-change-overlay.is-leaving .theme-change-card {
    transform: none;
  }
}
