.home-shell,
.app-container {
    position: relative;
}

.theme-switch {
    position: absolute;
    top: 0.85rem;
    right: 0;
    z-index: 30;
    display: inline-flex;
    gap: 0.2rem;
    padding: 0.22rem;
    border: 1px solid rgba(148, 154, 166, 0.32);
    border-radius: 999px;
    background: rgba(20, 22, 27, 0.78);
    box-shadow: 0 7px 22px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(9px);
}

.theme-switch button {
    min-width: 3.7rem;
    min-height: 2rem;
    padding: 0.3rem 0.72rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #aeb5c2;
    cursor: pointer;
    font: 600 0.75rem "Noto Sans SC", "Microsoft YaHei", sans-serif;
    transition: color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.theme-switch button:hover {
    color: #f3f5f8;
}

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

html[data-theme="dark"] .theme-switch button[aria-pressed="true"] {
    background: #343a48;
    color: #f3f5f8;
    box-shadow: inset 0 0 0 1px rgba(192, 132, 252, 0.32);
}

html[data-theme="wuxia"] .theme-switch {
    border-color: rgba(40, 50, 43, 0.22);
    background: rgba(251, 248, 239, 0.86);
    box-shadow: 0 7px 22px rgba(57, 48, 36, 0.11);
}

html[data-theme="wuxia"] .theme-switch button {
    color: #596057;
}

html[data-theme="wuxia"] .theme-switch button:hover {
    color: #20251f;
}

html[data-theme="wuxia"] .theme-switch button:focus-visible {
    outline-color: #a63f31;
}

html[data-theme="wuxia"] .theme-switch button[aria-pressed="true"] {
    background: #a63f31;
    color: #fffaf0;
    box-shadow: 0 3px 10px rgba(132, 49, 38, 0.18);
}

@media (max-width: 460px) {
    .theme-switch {
        top: 0.55rem;
        right: 0.5rem;
    }

    .theme-switch button {
        min-width: 3.25rem;
        min-height: 1.9rem;
        padding-inline: 0.58rem;
    }
}

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