/* 活力五色主题 — #ffbe0b #fb5607 #ff006e #3a86ff */

:root {
    --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 14px;
    --radius-sm: 8px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --page-gutter: 100px;
    --header-h: 58px;
    --header-control-h: calc(17px * 2.2);

    --palette-yellow: #ffbe0b;
    --palette-orange: #fb5607;
    --palette-pink: #ff006e;
    --palette-purple: #3a86ff;
    --palette-blue: #3a86ff;

    --theme-transition-duration: 0.42s;
    --theme-transition-easing: cubic-bezier(0.33, 1, 0.68, 1);
    --scrollbar-size: 5px;
}

html {
    background-color: var(--bg-primary, #0a0a0e);
    overflow-x: clip;
    overflow-y: scroll;
}

@media (prefers-reduced-motion: no-preference) {
    html.theme-transition,
    html.theme-transition *:not(.theme-switch):not(.theme-switch *),
    html.theme-transition *:not(.theme-switch):not(.theme-switch *)::before,
    html.theme-transition *:not(.theme-switch):not(.theme-switch *)::after {
        transition-property: background-color, border-color, box-shadow, outline-color !important;
        transition-duration: var(--theme-transition-duration) !important;
        transition-timing-function: var(--theme-transition-easing) !important;
        transition-delay: 0s !important;
    }

    html.theme-transition img,
    html.theme-transition video,
    html.theme-transition canvas,
    html.theme-transition iframe,
    html.theme-transition svg,
    html.theme-transition .lightbox,
    html.theme-transition .lightbox * {
        transition: none !important;
    }
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #0a0a0e;
    --bg-secondary: #121216;
    --bg-card: rgba(20, 20, 26, 0.88);
    --bg-card-hover: rgba(28, 28, 36, 0.94);
    --bg-input: rgba(14, 14, 18, 0.96);
    --text-primary: #ececf1;
    --text-secondary: #a8a8b3;
    --text-muted: #6b6b78;
    --accent: var(--palette-blue);
    --accent-light: var(--palette-blue);
    --accent-warm: var(--palette-orange);
    --accent-hot: var(--palette-pink);
    --accent-glow: rgba(58, 134, 255, 0.18);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(58, 134, 255, 0.35);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --pin-color: var(--palette-yellow);
    --bg-mesh-1: rgba(58, 134, 255, 0.09);
    --bg-mesh-2: rgba(58, 134, 255, 0.07);
    --bg-mesh-3: rgba(255, 190, 11, 0.04);
}

[data-theme="light"] {
    color-scheme: light;
    --bg-primary: #f4f5f8;
    --bg-secondary: #eceef3;
    --bg-card: rgba(255, 255, 255, 0.94);
    --bg-card-hover: #ffffff;
    --bg-input: #ffffff;
    --text-primary: #1a1a22;
    --text-secondary: #55556a;
    --text-muted: #8888a0;
    --accent: var(--palette-blue);
    --accent-light: var(--palette-blue);
    --accent-warm: var(--palette-orange);
    --accent-hot: var(--palette-pink);
    --accent-glow: rgba(58, 134, 255, 0.12);
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(58, 134, 255, 0.28);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --pin-color: var(--palette-orange);
    --bg-mesh-1: rgba(58, 134, 255, 0.06);
    --bg-mesh-2: rgba(58, 134, 255, 0.05);
    --bg-mesh-3: rgba(255, 190, 11, 0.05);
}

/* ===== Global Scrollbar (WebKit custom + Firefox thin) ===== */
@supports (scrollbar-width: thin) {
    @supports not selector(::-webkit-scrollbar) {
        html,
        body,
        textarea,
        select,
        .modal,
        .article-modal-inner,
        .admin-table-wrap {
            scrollbar-width: thin;
            scrollbar-color: var(--text-muted) transparent;
        }
    }
}

@supports selector(::-webkit-scrollbar) {
    *::-webkit-scrollbar {
        width: var(--scrollbar-size);
        height: var(--scrollbar-size);
        -webkit-appearance: none;
        appearance: none;
        background: transparent;
    }

    *::-webkit-scrollbar-track,
    *::-webkit-scrollbar-track-piece {
        background: transparent;
        -webkit-appearance: none;
        appearance: none;
        border: none;
    }

    *::-webkit-scrollbar-thumb {
        background: var(--text-muted);
        border-radius: 999px;
        -webkit-appearance: none;
        appearance: none;
        border: none;
    }

    *::-webkit-scrollbar-button,
    *::-webkit-scrollbar-button:vertical,
    *::-webkit-scrollbar-button:horizontal,
    *::-webkit-scrollbar-button:single-button,
    *::-webkit-scrollbar-button:double-button,
    *::-webkit-scrollbar-button:vertical:start:decrement,
    *::-webkit-scrollbar-button:vertical:end:increment,
    *::-webkit-scrollbar-button:horizontal:start:decrement,
    *::-webkit-scrollbar-button:horizontal:end:increment,
    *::-webkit-scrollbar-corner {
        display: none;
        width: 0;
        height: 0;
        max-width: 0;
        max-height: 0;
        -webkit-appearance: none;
        appearance: none;
        background: transparent;
        border: none;
    }
}

/* ===== Theme Switch (Uiverse.io by satyamchaudharydev) ===== */
.theme-switch.switch {
    display: block;
    --width-of-switch: 3.5em;
    --height-of-switch: 2em;
    --size-of-icon: 1.4em;
    --slider-offset: 0.3em;
    position: relative;
    width: var(--width-of-switch);
    height: var(--height-of-switch);
    flex-shrink: 0;
}

.theme-switch.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.theme-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #f4f4f5;
    transition: none;
    border-radius: 30px;
}

.theme-switch .slider::before {
    position: absolute;
    content: "";
    height: var(--size-of-icon, 1.4em);
    width: var(--size-of-icon, 1.4em);
    border-radius: 20px;
    left: var(--slider-offset, 0.3em);
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(40deg, #ff0080, #ff8c00 70%);
    transition: none;
}

html.theme-switch-ready .theme-switch .slider,
html.theme-switch-ready .theme-switch .slider::before {
    transition: 0.4s;
}

.theme-switch input:checked + .slider {
    background-color: #303136;
}

.theme-switch input:checked + .slider::before {
    left: calc(100% - (var(--size-of-icon, 1.4em) + var(--slider-offset, 0.3em)));
    background: #303136;
    box-shadow: inset -3px -2px 5px -2px #3a86ff, inset -10px -4px 0 0 #a3dafb;
}

@media (max-width: 768px) {
    :root {
        --header-h: 52px;
    }
}
