.theme-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 56px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
}

.theme-switch:hover,
.theme-switch:active {
    transform: none;
    box-shadow: none;
}

.theme-switch:focus-visible {
    outline: 2px solid #a78bfa;
    outline-offset: 3px;
}

.theme-switch-track {
    display: block;
    width: 56px;
    height: 30px;
    padding: 3px;
    border-radius: 999px;
    background: #d1d5db;
    transition: background-color 0.2s ease;
}

.theme-switch-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    color: #6d28d9;
    box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
    transition: transform 0.2s ease;
}

.theme-switch svg {
    width: 16px;
    height: 16px;
}

.theme-switch .theme-switch-moon { display: none; }
html[data-theme="dark"] .theme-switch-track { background: #7c3aed; }
html[data-theme="dark"] .theme-switch-thumb { transform: translateX(26px); }
html[data-theme="dark"] .theme-switch-sun { display: none; }
html[data-theme="dark"] .theme-switch-moon { display: block; }

@media (prefers-reduced-motion: reduce) {
    .theme-switch-track,
    .theme-switch-thumb { transition: none; }
}
