.mobile-theme-item {
  margin-bottom: 0.18rem;
}

.theme-toggle {
  --track-w: 132px;
  --track-h: 56px;
  --pad: 4px;
  --thumb-w: calc((var(--track-w) - var(--pad) * 2) / 2);
  --thumb-h: calc(var(--track-h) - var(--pad) * 2);

  position: relative;
  width: var(--track-w);
  height: var(--track-h);
  padding: var(--pad);
  border: none;
  border-radius: var(--radius-pill) !important;
  cursor: pointer;
  outline: none;
  isolation: isolate;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle--desktop {
  flex: 0 0 auto;
  zoom: 0.72;
}

:root[data-theme="dark"] .theme-toggle {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.10),
    inset 0 1.5px 0.5px -0.5px rgba(255,255,255,0.45),
    inset 0 5px 8px -5px rgba(255,255,255,0.20),
    inset 0 -1.5px 0.5px -0.5px rgba(255,255,255,0.28),
    inset 0 -5px 8px -5px rgba(255,255,255,0.10);
}

:root[data-theme="light"] .theme-toggle {
  background: rgba(255,255,255,0.20);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    inset 0 1.5px 0.5px -0.5px rgba(255,255,255,0.85),
    inset 0 5px 8px -5px rgba(255,255,255,0.55),
    inset 0 -1.5px 0.5px -0.5px rgba(255,255,255,0.35),
    inset 0 -5px 8px -5px rgba(255,255,255,0.15);
}

.theme-toggle .thumb {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  width: var(--thumb-w);
  height: var(--thumb-h);
  border-radius: var(--radius-pill);
  transition:
    transform 0.45s cubic-bezier(0.34, 1.4, 0.5, 1),
    background 0.3s ease,
    box-shadow 0.3s ease;
  z-index: 1;
}

:root[data-theme="dark"] .theme-toggle .thumb {
  background: rgba(255,255,255,0.16);
  backdrop-filter: blur(8px) saturate(1.4);
  -webkit-backdrop-filter: blur(8px) saturate(1.4);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.20),
    inset 0 1.5px 0.5px -0.5px rgba(255,255,255,0.85),
    inset 0 6px 8px -6px rgba(255,255,255,0.5),
    inset 0 -1.5px 0.5px -0.5px rgba(255,255,255,0.5),
    inset 0 -6px 8px -6px rgba(255,255,255,0.2);
}

:root[data-theme="light"] .theme-toggle .thumb {
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(8px) saturate(1.6);
  -webkit-backdrop-filter: blur(8px) saturate(1.6);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.85),
    inset 0 1.5px 0.5px -0.5px rgba(255,255,255,1),
    inset 0 6px 8px -6px rgba(255,255,255,0.8),
    inset 0 -1.5px 0.5px -0.5px rgba(255,255,255,0.55),
    inset 0 -6px 8px -6px rgba(255,255,255,0.25);
}

.theme-toggle[data-state="light"] .thumb {
  transform: translateX(0);
}

.theme-toggle[data-state="dark"] .thumb {
  transform: translateX(calc(var(--thumb-w)));
}

.theme-toggle .icons {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.theme-toggle .icon-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.theme-toggle .icon-slot svg {
  width: 20px;
  height: 20px;
}

:root[data-theme="dark"] .icon-slot svg path,
:root[data-theme="dark"] .icon-slot svg circle,
:root[data-theme="dark"] .icon-slot svg line {
  stroke: rgba(255,255,255,0.92);
  fill: none;
}

:root[data-theme="light"] .icon-slot svg path,
:root[data-theme="light"] .icon-slot svg circle,
:root[data-theme="light"] .icon-slot svg line {
  stroke: rgba(28,28,32,0.88);
  fill: none;
}

.theme-toggle[data-state="light"] .icon-slot:first-child,
.theme-toggle[data-state="dark"] .icon-slot:last-child {
  opacity: 1;
}

.theme-toggle[data-state="light"] .icon-slot:last-child,
.theme-toggle[data-state="dark"] .icon-slot:first-child {
  opacity: 0.55;
}

.theme-toggle__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 767.98px) {
  .theme-toggle--desktop {
    display: none;
  }
}
