:root {
    --ON: initial;
    --OFF: ;

    --highlight1-light: linear-gradient(-45deg, #0023a2, #056bce);
    --highlight1-dark: linear-gradient(-45deg, #2a89d8, #056bce);
    --highlight2-light: linear-gradient(-45deg, #a22300, #ce6b05);
    --highlight2-dark: linear-gradient(-45deg, #d8892a, #ce6b05);

    --bg-page: var(--theme-light, #f9f9f9) var(--theme-dark, #222);
    --fg-page: var(--theme-light, #222) var(--theme-dark, #f9f9f9);
    --bg-file1: var(--theme-light, #e9e9e9) var(--theme-dark, #333);
    --bg-file2: var(--theme-light, #e3e3e3) var(--theme-dark, #393939);
    --bg-request-pending: var(--theme-light, #fba852) var(--theme-dark, #a22300);
    --bg-request-accepted: var(--theme-light, #6bce05) var(--theme-dark, #4f7e17);

    --fg-highlight1: var(--theme-light, var(--highlight1-light)) var(--theme-dark, var(--highlight1-dark));
    --fg-highlight2: var(--theme-light, var(--highlight2-light)) var(--theme-dark, var(--highlight2-dark));
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        --theme-light: var(--OFF);
        --theme-dark: var(--ON);
    }
}
:root[data-theme="light"], :root {
    --theme-light: var(--ON);
    --theme-dark: var(--OFF);
}
:root[data-theme="dark"] {
    --theme-light: var(--OFF);
    --theme-dark: var(--ON);
}

#theme_switch {
    display: flex;
    flex-direction: column;
    border: 2px solid var(--bg-file1);
    border-radius: 24px;
    inline-size: fit-content;
    padding: 3px;
    margin-left: 1.5rem;

    label {
        border-radius: 21px;
        cursor: pointer;
        padding: 0.5em 1em;
        text-align: center;
        user-select: none;
    }

    input {
        display: none;
    }

    label:has(input:checked) {
        background-color: var(--bg-file2);
    }
}

.hidden { display: none !important; }

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-family: Arial, sans-serif;
    margin: 0;
    background: var(--bg-page);
    color: var(--fg-page);
    transition: background 0.3s, color 0.3s;
    height: 100vh;
    width: 100vw;
}

header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#stVer, #stOffline {
    display: block;
    font-size: 0.6em;
    font-weight: normal;
    margin: 2px 0;
}

#stOffline { color: #a00; }

#controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 1rem 0;

    div {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1rem;
    }

    a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 2rem;
        width: 4rem;
        height: 4rem;
        text-decoration: none;

        mask-composite: subtract;
        mask-mode: luminance;
        mask-repeat: no-repeat;
        mask-size: cover;
        background: var(--fg-page);
    }

    a:hover {
        animation: wave 1.5s infinite ease-in-out;
        background: var(--fg-highlight1);
        opacity: 1;
    }

    a:active { background: var(--fg-highlight2); }
}

#btn_PlayPause {
    mask-image: linear-gradient(#fff, #fff), url("/textures/actionVideoPause128.png");
    &.paused { mask-image: linear-gradient(#fff, #fff), url("/textures/actionVideoPlay128.png"); }
}
#btn_ListPrev { mask-image: linear-gradient(#fff, #fff), url("/textures/actionVideoPrevious128.png"); }
#btn_ListNext { mask-image: linear-gradient(#fff, #fff), url("/textures/actionVideoNext128.png"); }
#btn_AudioMute {
    mask-image: linear-gradient(#fff, #fff), url("/textures/actionVolume128.png");
    &.muted { mask-image: linear-gradient(#fff, #fff), url("/textures/actionVolumeOff128.png"); opacity: 0.2; }
}
#btn_Fullscreen { mask-image: linear-gradient(#fff, #fff), url("/textures/actionVideoFullscreenOff128.png"); }

#volume_icon {
    position: relative;

    #volume_box {
        position: absolute;
        bottom: -0.6rem;
        width: 6rem;
        height: 0.9rem;
        background: var(--bg-file1);

        #volume {
            position: absolute;
            top: 0;
            left: 0;
            width: 50%;
            height: 100%;
            background: var(--fg-highlight1);

            &.hot { background: var(--fg-highlight2); }
        }

        #volume_nb {
            position: absolute;
            color: #fff;
            font-size: 0.8em;
            line-height: 100%;
            pointer-events: none;
        }
    }
}

nav {
    overflow: auto;
}

#playlist {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 1rem 0;
    min-height: 0;

    span {
        display: block;
        margin: 0 1em;
        background: var(--bg-file1);
        padding: 3px 15px;
        border-radius: 20px;
        align-self: stretch;

        &:nth-child(even) {
            background: var(--bg-file2);
        }

        &:hover, &.hl:hover {
            background: var(--fg-highlight2);
            color: #fff;
            cursor: pointer;
        }

        &.hl {
            background: var(--fg-highlight1);
            color: #fff;
        }
    }
}

#acl_requests {
    div {
        display: flex;
        gap: 1rem;
        margin: 1rem 1rem 0 1rem;
        padding: 15px;
        border-radius: 20px;
        background-color: var(--bg-request-pending);

        &.request_accepted { background-color: var(--bg-request-accepted); }

        span { flex: 1; }

        button {
            border-radius: 20px;
            background-color: var(--bg-page);
            color: var(--fg-page);
            border: 0;
            padding: 1rem 2rem;
            font-weight: bold;
            height: fit-content;
        }
    }
}

@keyframes wave {
    0% {
        transform: rotateY(0deg) rotateX(20deg) translate(0, 0);
        animation-timing-function: cubic-bezier(0.61, 1, 0.88, 1);
    }
    25% {
        transform: rotateY(15deg) rotateX(0deg) translate(-2px, -5px);
    }
    50% {
        transform: rotateY(0deg) rotateX(20deg) translate(-3px, 0);
        animation-timing-function: cubic-bezier(0.61, 1, 0.88, 1);
    }
    75% {
        transform: rotateY(-15deg) rotateX(0deg) translate(5px, 2px);
    }
    100% {
        transform: rotateY(0deg) rotateX(20deg) translate(0, 0);
    }
}
