@font-face {
    font-family: 'Actor';
    src: url('Actor-Regular.ttf');
}

@font-face {
    font-family: 'Rubik';
    src: url('Rubik-VariableFont_wght.ttf') format("truetype-variations");
}

*,
::before,
::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --background: #2d2d2d;
    --grey: #505050;
    --blue: #19bcff;
    --yellow: #faac05;
    --orange: #f8583e;
    --white: #ebebeb;

    --s-circ-sz: calc(8px * 12);
    --m-circ-sz: calc(8px * 16);
    --xl-card-sz: calc(8px * 48);
}

body {
    background: var(--background);
    color: var(--white);
    max-width: 100vw;
    max-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Rubik';
    font-size: 40px;
    letter-spacing: -.5px;
}

svg {
    pointer-events: none;
}

.grid-overlay {
    position: absolute;
    max-width: 100%;
    max-height: 100vh;
    opacity: .05;
}

header {
    display: flex;
    justify-content: space-between;
    margin: 2rem 5rem 1.5rem 5rem;

    .profiles {
        .user-profile {
            display: block;
            aspect-ratio: 1 / 1;
            height: var(--s-circ-sz);
            background: rgba(0, 0, 0, 0.1);
            border: 4px solid var(--grey);
            border-radius: 100%;
            overflow: hidden;
            transition: all .2s;
            box-shadow: 0 2px 2px 3px rgba(0, 0, 0, 0.1);
            text-decoration: none;

            &:focus,
            &:focus-visible,
            &:hover {
                outline: none;
                border: 4px solid var(--blue);
            }

            img {
                width: 100%;
                object-fit: fill;
            }
        }
    }

    .indicators {
        display: flex;
        gap: 2rem;

        .time {
            letter-spacing: 2.5px;
        }

        .battery {
            sub {
                font-size: .6em;
                vertical-align: baseline;
            }
        }
    }
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3rem;

    .apps-slider {
        display: flex;
        gap: 1rem;
        overflow-x: -moz-scrollbars-none;
        overflow-x: scroll;
        scrollbar-width: none;
        scroll-behavior: smooth;

        &::-webkit-scrollbar {
            display: none;
        }

        .app-card {
            user-select: none;

            &:first-child {
                margin-left: 8%;
            }

            &:not(.empty):hover,
            &:not(.empty):focus,
            &:not(.empty):focus-visible {
                outline: none;
                cursor: pointer;

                img {
                    border: 8px solid var(--blue);
                }

                span {
                    opacity: 1;
                }
            }

            span {
                opacity: 0;
                transition: all .2s;
                color: var(--blue);
                pointer-events: none;
            }

            img {
                aspect-ratio: 1 / 1;
                width: var(--xl-card-sz);
                height: var(--xl-card-sz);
                background: var(--grey);
                border-radius: 2px;
                border: 8px solid var(--background);
                transition: all .2s;
                position: relative;
                outline: 0;
                margin-top: .25rem;
            }
        }
    }

    .nav-menu {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 2rem;

        button {
            background: var(--grey);
            aspect-ratio: 1 / 1;
            width: var(--m-circ-sz);
            border-radius: 50%;
            color: var(--white);
            border: 4px solid transparent;
            box-shadow: 0 2px 2px 3px rgba(0, 0, 0, 0.1);
            transition: all .2s;

            &:hover,
            &:focus,
            &:focus-visible {
                outline: none;
                border: 4px solid var(--blue);
                cursor: pointer;
            }

            &.news {
                color: var(--orange);
            }

            &.shop {
                color: var(--yellow);
            }

            &.gallery {
                color: var(--blue);
            }

            svg {
                aspect-ratio: 1 / 1;
                height: 50%;
                width: 50%;
            }
        }
    }
}

hr {
    margin: 0 calc(8px * 6);
}

footer {
    display: flex;
    justify-content: space-between;
    margin: 1.5rem 5rem;

    .controllers {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 2rem;
    }

    .controls {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 3rem;

        .control {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: .8rem;
            font-weight: 100;

            svg {
                height: 48px;
                width: 48px;
            }
        }
    }
}

/* ===== 编辑模式 ===== */

#start-btn {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.is-edit-mode {
    outline: 3px dashed var(--blue);
    outline-offset: -3px;
}

.is-edit-mode .app-card {
    cursor: grab;
    position: relative;
}

.is-edit-mode .app-card::after {
    content: '✎';
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--blue);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 10;
}

.is-edit-mode .app-card.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.is-edit-mode .app-card.drag-over img {
    border-color: var(--blue) !important;
}

.app-card-add {
    cursor: pointer !important;
}

.app-card-add .add-card-placeholder {
    aspect-ratio: 1 / 1;
    width: var(--xl-card-sz);
    height: var(--xl-card-sz);
    background: var(--grey);
    border-radius: 2px;
    border: 4px dashed var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    color: var(--blue);
    margin-top: .25rem;
}

.app-card-add span {
    opacity: 0;
}

/* 编辑工具栏 */
#edit-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 12px 24px;
    background: rgba(25, 188, 255, 0.95);
    backdrop-filter: blur(8px);
}

.edit-toolbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.edit-toolbar-hint {
    font-size: 16px;
    color: #fff;
    font-weight: 500;
}

.edit-toolbar-btns {
    display: flex;
    gap: 10px;
}

.edit-toolbar-btns button {
    padding: 6px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

#edit-save-btn {
    background: #fff;
    color: var(--blue);
}

#edit-exit-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
}

#edit-reset-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
}

.edit-toolbar-btns button:hover {
    transform: scale(1.05);
}

/* 编辑面板（弹窗） */
#edit-panel {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.edit-panel-inner {
    background: #3a3a3a;
    border-radius: 16px;
    padding: 32px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.edit-panel-inner h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #fff;
}

.edit-panel-inner label {
    display: block;
    font-size: 13px;
    color: #aaa;
    margin-bottom: 14px;
}

.edit-panel-inner input {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #555;
    border-radius: 8px;
    background: #2a2a2a;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: border-color .2s;
}

.edit-panel-inner input:focus {
    border-color: var(--blue);
}

.edit-panel-btns {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    justify-content: flex-end;
}

.edit-panel-btns button {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

#ep-confirm {
    background: var(--blue);
    color: #fff;
}

#ep-cancel {
    background: #555;
    color: #fff;
}

.ep-btn-danger {
    background: var(--orange) !important;
    color: #fff !important;
    margin-right: auto;
}

.edit-panel-btns button:hover {
    transform: scale(1.05);
}

/* Toast */
#switch-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(25, 188, 255, 0.95);
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all .3s;
    z-index: 3000;
    pointer-events: none;
}

#switch-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}