.theme-switcher {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 25;
}

.theme-trigger {
  width: 3.25rem;
  height: 3.25rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease;
}

.theme-trigger:hover,
.theme-trigger[aria-expanded="true"] {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.theme-trigger-icon {
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #ffffff 0 16%, transparent 17%),
    conic-gradient(from 180deg, #4cc9f0, #ff8fab, #95d5b2, #f6bd60, #4cc9f0);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.theme-palette {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  box-shadow: var(--shadow);
  width: min(220px, calc(100vw - 2rem));
}

.theme-palette[hidden] {
  display: none;
}

.theme-palette p {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.theme-options button {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-soft) 76%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.theme-options button.active {
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #041119;
  font-weight: 700;
}

@media (max-width: 640px) {
  .theme-switcher {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .theme-palette {
    width: min(200px, calc(100vw - 1.5rem));
  }
}
