.phone {
    position: fixed;
    width: calc(1px * var(--bg-widthPhone));
    height: calc(1px * var(--bg-heightPhone));
    border-radius: var(--bg-borderRadiusPhone);
    background: #000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    transition: all 0.2s, width 0s, height 0s, border-radius 0s;
    top: 50%;
    transform: translateY(-50%);
}
#frame {
    pointer-events: none;
    overflow: visible;
    justify-content: center;
    transition: box-shadow 0.4s;

    & .borderIn {
        position: absolute;
        display: flex;
        justify-content: center;
        width: calc(1px * var(--bg-widthPhone) + 10px);
        height: calc(1px * var(--bg-heightPhone) + 10px);
        border-radius: calc(var(--bg-borderRadiusPhone) + 5px);
        background: #000;
    }

    & .borderIn::after {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        border-radius: inherit;

        background: linear-gradient(to bottom, #ffffff50, #000) top / 100% 3px no-repeat,
            linear-gradient(to bottom, #000, #ffffff50) bottom / 100% 3px no-repeat;
    }

    & .borderOut {
        position: absolute;
        width: calc(1px * var(--bg-widthPhone) + 22px);
        height: calc(1px * var(--bg-heightPhone) + 22px);
        border-radius: calc(var(--bg-borderRadiusPhone) + 10px);
        background: var(--bg-phoneColor);
        box-shadow: inset 0 0 6px rgba(0, 0, 0, 1);
    }

    /*& .borderOut::after {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        border-radius: calc(var(--bg-borderRadiusPhone) + 10px);

        background: linear-gradient(to right, #000000, #00000000) left / 3px 100% no-repeat,
            linear-gradient(to bottom, #000000, #00000000) top / 100% 5px no-repeat;
    }*/

    & #powerBtn {
        position: absolute;
        height: 70px;
        width: 5px;
        background: var(--bg-phoneColor);
        right: -10px;
        top: 44%;
        translate: 100% -50%;
        border-radius: 0 5px 5px 0;
        pointer-events: all;
        transition: transform 0.2s;
        cursor: pointer;
    }
    & #powerBtn:active {
        transition: transform 0.1s;
        transform: translateX(-2px);
    }
    & #powerBtn::after {
        content: "";
        position: absolute;
        height: 100%;
        width: 30px;
    }

    & .volumeBtn {
        position: absolute;
        height: 125px;
        width: 5px;
        right: -10px;
        top: 26%;
        translate: 100% -50%;
        border-radius: 0 5px 5px 0;
        transition: transform 0.2s;
        cursor: pointer;

        & #volumeUp {
            position: absolute;
            height: 60px;
            width: 5px;
            top: 0;
            border-radius: 0 5px 5px 0;
            background: var(--bg-phoneColor);
            transition: transform 0.2s;
        }
        & #volumeUp:active {
            transition: transform 0.1s;
            transform: translateX(-2px);
        }
        & #volumeUp::after {
            content: "";
            position: absolute;
            height: 100%;
            width: 30px;
        }

        & #volumeDown {
            position: absolute;
            height: 60px;
            width: 5px;
            bottom: 0;
            border-radius: 0 5px 5px 0;
            background: var(--bg-phoneColor);
            transition: transform 0.2s;
        }
        & #volumeDown:active {
            transition: transform 0.1s;
            transform: translateX(-2px);
        }
        & #volumeDown::after {
            content: "";
            position: absolute;
            height: 100%;
            width: 30px;
        }
        & #volumeDown {
            position: absolute;
            height: 60px;
            width: 5px;
            bottom: 0;
            border-radius: 0 5px 5px 0;
            background: var(--bg-phoneColor);
            transition: transform 0.2s;
        }
        & #volumeDown:active {
            transition: transform 0.1s;
            transform: translateX(-2px);
        }
        & #volumeDown::after {
            content: "";
            position: absolute;
            height: 100%;
            width: 30px;
        }
    }
    & .cameraBtn {
        position: absolute;
        height: 80px;
        width: 5px;
        right: -10px;
        top: calc(1px * var(--bg-heightPhone) - 0.2px * var(--bg-heightPhone));
        translate: 100% -50%;
        border-radius: 0 5px 5px 0;
        pointer-events: all;
        transition: transform 0.2s;
        cursor: pointer;
        background: var(--bg-phoneColor);
    }
    & .cameraBtn:active {
        transition: transform 0.1s;
        transform: translateX(-2px);
    }
    & .cameraBtn::after {
        content: "";
        position: absolute;
        height: 100%;
        width: 30px;
    }
    & .cameraBtn::before {
        content: "";
        position: absolute;
        height: calc(100% - 10px);
        width: 3px;
        border-radius: 5px;
        background: #fff;
        opacity: 0;
        pointer-events: none;
        display: none;
    }
    & .cameraBtn.animate::before {
        animation: cameraBtnAnimateBefore 2.1s ease infinite;
        display: block;
    }
    & .cameraBtn.animate {
        animation: cameraBtnAnimate 2.1s ease infinite;
    }
}
body:has(.phone.phoneShadow) #frame {
    box-shadow: 0 0 90px var(--bg-phoneColor);
}

@keyframes cameraBtnAnimate {
    0% {
        box-shadow: none;
        transform: translateX(0px);
    }
    80% {
        box-shadow: 0 0 25px #fff000;
        transform: translateX(-2px);
    }
    90% {
        box-shadow: none;
    }
    100% {
        box-shadow: none;
        transform: translateX(0px);
    }
}

@keyframes cameraBtnAnimateBefore {
    0% {
        translate: 5px 5px;
        opacity: 0;
    }
    10% {
        opacity: 0;
    }
    70% {
        translate: 17px 5px;
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    90% {
        opacity: 0;
        translate: 17px 5px;
    }
    100% {
        opacity: 0;
        translate: 17px 5px;
    }
}

#overlayTurnOff {
    position: absolute;
    display: flex;
    content: "";
    height: 100%;
    width: 100%;
    pointer-events: none;
    transition: background calc(0.2s * var(--bg-speedAnimation));
}

#phone.aodOff.off #overlayTurnOff {
    background-color: rgba(0, 0, 0);
    pointer-events: none;
}
#phone.aodOff.off #statusBar {
    opacity: 0 !important;
}
#phone.aodOff.off .fingerBtn {
    opacity: 0 !important;
}

#phone:not(.aodOff).off #overlayTurnOff {
    background-color: rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

island {
    z-index: 10002;
    width: 100%;
    max-width: 500px;
    position: relative;

    & .camera {
        position: absolute;
        display: flex;
        width: 17px;
        height: 17px;
        border-radius: 17px;
        background: url("/OriginWEB/originData/phoneFrame/camera.png") 100%/100%;
        top: 12px;
        right: 50%;
        translate: 50%;
        z-index: 6;
        pointer-events: none;
    }

    & .island {
        position: absolute;
        display: flex;
        width: 17px;
        height: 17px;
        border-radius: 17px;
        background: #000;
        top: 9px;
        right: 50%;
        translate: 50%;
        scale: 0;
        cursor: pointer;
        transition: all 0.6s 0.3s cubic-bezier(0.3, 1.3, 0.6, 1.01), scale 0.5s 0.1s;
        padding: 2px;
        color: white;
        font-weight: bold;
        overflow: hidden;
        border: solid 1px rgba(255, 255, 255, 0.2);
        align-items: center;
    }
    & .main {
        z-index: 2;
        transition: all 0.6s cubic-bezier(0.3, 1.3, 0.6, 1.01), scale 0.5s 0.1s;
    }

    & [class="island main"],
    & [class="island small"] {
        pointer-events: none;
        border: none;
    }

    & svg {
        height: 10px;
        width: 10px;
        fill: #000;
    }
    & button {
        all: unset;
    }
    & .buttons {
        display: none;
    }
    .text {
        font-size: 10px;
        font-family: "noto sans", sans-serif;
        transition: font-size 0.6s cubic-bezier(0.3, 1.3, 0.6, 1.01), margin-left 0.6s cubic-bezier(0.3, 1.3, 0.6, 1.01);
    }
    /*not open*/
    & .island.main.music:not(.open) {
        transition: all 0.7s cubic-bezier(0.33, 1.4, 0.41, 1) 0.1s, scale 0.3s;
        width: 105px;
        scale: 1.1;

        &:active {
            transition: all 0.2s;
            width: 100px;
            scale: 1.05;
        }

        & .image {
            position: absolute;
            top: 50%;
            left: 5px;
            translate: 0 -50%;
            height: calc(100% - 9px);
            aspect-ratio: 1/1;
            overflow: hidden;
            border-radius: 5px;
            background-image: url("/OriginWEB/originData/OriginOS6Logo.png");
            background-size: cover;
            background-repeat: no-repeat;
            background-position: center;
            opacity: 0;
            animation: islandScaleAnimation 0.3s 0.1s ease forwards;
        }
        & .text {
            position: absolute;
            top: 50%;
            translate: 0 -50%;
            right: 6px;
            opacity: 0;
            animation: islandScaleAnimation2 0.3s 0.1s ease forwards;
        }
    }

    & .island.main.clock:not(.open) {
        transition: all 0.7s cubic-bezier(0.33, 1.4, 0.41, 1) 0.1s, scale 0.3s;
        width: 105px;
        scale: 1.1;

        &:active {
            transition: all 0.2s;
            width: 100px;
            scale: 1.05;
        }

        & .text {
            position: absolute;
            top: 50%;
            translate: 3px -50%;
            overflow: hidden;
            opacity: 0;
            animation: islandScaleAnimation 0.3s 0.1s ease forwards;
        }
        & .image {
            position: absolute;
            top: 50%;
            translate: 0 -50%;
            right: 2px;
            aspect-ratio: 1/1;
            border-radius: 15px;
            height: calc(100% - 4px);
            overflow: hidden;
            background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='orange'><path d='M360-840v-80h240v80H360Zm80 440h80v-240h-80v240Zm40 320q-74 0-139.5-28.5T226-186q-49-49-77.5-114.5T120-440q0-74 28.5-139.5T226-694q49-49 114.5-77.5T480-800q62 0 119 20t107 58l56-56 56 56-56 56q38 50 58 107t20 119q0 74-28.5 139.5T734-186q-49 49-114.5 77.5T480-80Z'/></svg>");
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            opacity: 0;
            animation: islandScaleAnimation2 0.3s 0.1s ease forwards;
        }
    }

    & .island.small {
        transition: all 0.6s ease-out, scale 0.4s 0.15s;
    }
    & .island.small.clock:not(.open) {
        transition: all 0.6s cubic-bezier(0.3, 1.3, 0.6, 1.01), scale 0.3s;
        transition-delay: 0.1s;
        scale: 1.1;
        translate: -65px 0;
        aspect-ratio: 1/1;
        border-radius: 15px;
        overflow: hidden;
        background-color: #000;

        &:active {
            transition: all 0.2s;
            scale: 0.95;
        }
        & .image {
            position: absolute;
            height: calc(100% - 4px);
            aspect-ratio: 1/1;
            background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 -960 960 960' width='24px' fill='orange'><path d='M360-840v-80h240v80H360Zm80 440h80v-240h-80v240Zm40 320q-74 0-139.5-28.5T226-186q-49-49-77.5-114.5T120-440q0-74 28.5-139.5T226-694q49-49 114.5-77.5T480-800q62 0 119 20t107 58l56-56 56 56-56 56q38 50 58 107t20 119q0 74-28.5 139.5T734-186q-49 49-114.5 77.5T480-80Z'/></svg>");
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
        }
    }
    & .island.small.music:not(.open) {
        transition: all 0.6s cubic-bezier(0.3, 1.3, 0.6, 1.01), scale 0.3s;
        transition-delay: 0.1s;
        scale: 1.1;
        translate: -65px 0;
        aspect-ratio: 1/1;
        border-radius: 15px;
        overflow: hidden;
        background-color: #000;
        justify-content: center;
        place-items: center;

        &:active {
            transition: all 0.2s;
            scale: 0.95;
        }
        & .image {
            height: calc(100% - 4px);
            aspect-ratio: 1/1;
            overflow: hidden;
            border-radius: 5px;
            background-image: url("/OriginWEB/originData/OriginOS6Logo.png");
            background-size: cover;
            background-repeat: no-repeat;
            background-position: center;
        }
    }

    & .island::after {
        /* blur effect */
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        border-radius: inherit;
        pointer-events: none;
    }
    & .island.animationBLur::after {
        animation: islandBlurAnimation 0.6s ease forwards;
        backdrop-filter: blur(3px);
    }

    /* open and open anim*/
    & .island.main.music.open {
        animation: openIslandAnimationMusic 0.6s cubic-bezier(0.3, 1.3, 0.6, 1.01);

        & .image,
        & .text {
            animation: islandBlurAnimation 0.3s ease reverse forwards;
        }
    }
    & .island.main.music.open {
        animation: openIslandAnimationMusic 0.6s cubic-bezier(0.3, 1.3, 0.6, 1.01) forwards;
        scale: 1;

        &:active {
            transition: "";
            scale: 1;
        }

        & .image {
            position: absolute;
            top: 15px;
            left: 15px;
            border-radius: calc(var(--bg-borderRadiusPhone) - 25px);
            height: 70px;
            aspect-ratio: 1/1;
            overflow: hidden;
            background-image: url("/OriginWEB/originData/OriginOS6Logo.png");
            background-size: cover;
            background-repeat: no-repeat;
            background-position: center;
        }
        & .text {
            animation: islandBlurAnimation2 0.3s ease reverse forwards;
        }

        & .buttons.music {
            position: absolute;
            display: flex;
            height: calc(100% - 30px);
            right: 15px;
            gap: 7px;
        }
    }

    & .island.main.clock.open {
        animation: openIslandAnimationClock 0.6s cubic-bezier(0.3, 1.3, 0.6, 1.01) forwards;
        scale: 1;

        &:active {
            transition: "";
            scale: 1;
        }

        & .image {
            animation: islandBlurAnimation 0.3s ease reverse forwards;
        }
        & .text {
            animation: islandBlurAnimation2 0.3s ease reverse forwards;
            font-size: 27px;
            margin-left: 14px;
        }

        & .buttons.clock {
            position: absolute;
            display: flex;
            height: calc(100% - 30px);
            right: 15px;
            gap: 7px;
        }
        & .buttons.clock button {
            display: flex;
            height: 100%;
            aspect-ratio: 1 / 1;
            border-radius: 100%;
            justify-content: center;
            align-items: center;
            transition: scale 0.6s cubic-bezier(0.3, 1.3, 0.6, 1.01);
        }
        & .buttons.clock button svg {
            height: calc(100% - 15px);
            width: calc(100% - 15px);
        }
        & .buttons.clock button:active {
            transition: scale 0.14s;
            scale: 0.9;
        }
        & .buttons.clock button:active svg {
            filter: blur(3px);
        }

        & .buttons.clock [data-btn="resume"] .resume {
            display: block;
        }
        & .buttons.clock [data-btn="resume"] .pause {
            display: none;
        }

        & .buttons.clock [data-btn="pause"] .resume {
            display: none;
        }
        & .buttons.clock [data-btn="pause"] .pause {
            display: block;
        }
    }
    & .island.main.open ~ .island.small.clock,
    & .island.main.open ~ .island.small.music {
        translate: 0;
        scale: 1;
    }
}

.phone:has(.island.main.music:not(.open)):not(:has(.lpControlCenterControlsCenter.open)):not(:has(island.Ihidden))
    #itemStatusRight,
.phone:has(.island.main.clock:not(.open)):not(:has(.lpControlCenterControlsCenter.open)):not(:has(island.Ihidden))
    #itemStatusRight {
    gap: 4px;
    translate: 6px 0;
    scale: 0.9;
}
.phone:has(.island.main.music:not(.open)):not(:has(.lpControlCenterControlsCenter.open)):not(:has(island.Ihidden))
    #itemStatusLeft,
.phone:has(.island.main.clock:not(.open)):not(:has(.lpControlCenterControlsCenter.open)):not(:has(island.Ihidden))
    #itemStatusLeft {
    gap: 4px;
    translate: -3px 0;
    scale: 0.9;
}

.phone:has(.island.main.music.open):not(:has(.lpControlCenterControlsCenter.open)):not(:has(island.Ihidden))
    #itemStatusRight,
.phone:has(.island.main.clock.open):not(:has(.lpControlCenterControlsCenter.open)):not(:has(island.Ihidden))
    #itemStatusRight {
    gap: 4px;
    translate: 100% 0;
    scale: 0.9;
    opacity: 0;
}
.phone:has(.island.main.music.open):not(:has(.lpControlCenterControlsCenter.open)):not(:has(island.Ihidden))
    #itemStatusLeft,
.phone:has(.island.main.clock.open):not(:has(.lpControlCenterControlsCenter.open)):not(:has(island.Ihidden))
    #itemStatusLeft {
    gap: 4px;
    translate: -100% 0;
    scale: 0.9;
    opacity: 0;
}

island.Ihidden .island {
    transition: all 0.6s cubic-bezier(0.3, 1.3, 0.6, 1.01), scale 0.5s 0.1s !important;
    width: 17px !important;
    height: 17px !important;
    scale: 0 !important;
}
island.Ihidden .island .image,
island.Ihidden .island .text {
    animation: islandBlurAnimation 0.2s ease forwards !important;
}

@keyframes islandBlurAnimation {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
@keyframes islandScaleAnimation {
    0% {
        scale: 0.8;
        opacity: 0;
        transform: translateX(10px);
    }
    100% {
        scale: 1;
        opacity: 1;
        transform: none;
    }
}
@keyframes islandScaleAnimation2 {
    0% {
        scale: 0.8;
        opacity: 0;
        transform: translateX(-10px);
    }
    100% {
        scale: 1;
        opacity: 1;
        transform: none;
    }
}

@keyframes openIslandAnimationMusic {
    0% {
        width: 105px;
        height: 20px;
        border-radius: "";
    }
    100% {
        width: calc(100% - 28px);
        height: 150px;
        border-radius: calc(var(--bg-borderRadiusPhone) - 10px);
    }
}
@keyframes openIslandAnimationClock {
    0% {
        width: 105px;
        height: 20px;
        border-radius: "";
    }
    100% {
        width: calc(100% - 28px);
        height: 70px;
        border-radius: calc(var(--bg-borderRadiusPhone) - 10px);
    }
}
.phone.darkMode #wallpaperHome {
    opacity: 0.5;
}
.wallpaper {
    position: absolute;
    display: flex;
    justify-content: center;
    height: 100%;
    width: 100%;
    bottom: 0;
    transition: all calc(0.3s * var(--bg-speedAnimation));
}
#wallpaperHome {
    background: var(--bg-wallpaperHome) no-repeat center center/cover;
    border-radius: var(--bg-borderRadiusPhone);
}
#wallpaperLock {
    background: #000;
    opacity: 0;
    animation: opacity0to1 0s ease forwards;
    background-attachment: fixed;
}
#wallpaperLock #imageForWallpaperLock {
    position: absolute;
    height: 100%;
    width: 100%;
    background-image: var(--bg-wallpaperLock);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: local;
    transition: all calc(0.6s * var(--bg-speedAnimation)) cubic-bezier(0.35, 1.2, 0.33, 1),
        display calc(0.6s * var(--bg-speedAnimation)) cubic-bezier(0.35, 1.2, 0.33, 1) allow-discrete;
    border-radius: var(--bg-borderRadiusPhone);
}
.wallpaper .imageForWallpaperLock {
    position: absolute;
    height: 100%;
    width: 100%;
    bottom: 0px;
    background-image: var(--bg-wallpaperLock);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: local;
    transition: all calc(0.3s * var(--bg-speedAnimation)), display calc(0.4s * var(--bg-speedAnimation)) allow-discrete;
    border-radius: var(--bg-borderRadiusPhone);
}
.wallpaper #imageForWallpaperLock.video {
    position: absolute;
    height: 100% !important;
    width: 100% !important;
    bottom: 0px !important;
    background-image: var(--bg-wallpaperHome) !important;
    transition: all calc(0.3s * var(--bg-speedAnimation));
    border-radius: var(--bg-borderRadiusPhone) !important;
    translate: none !important;
}

#wallpaperHome.open {
    transform: scale(1.1);
}

#navOvlay {
    position: absolute;
    display: flex;
    width: 100%;
    height: 30px;
    bottom: 0px;
    cursor: grab;
    justify-content: center;
    mix-blend-mode: difference;
    color: rgba(255, 255, 255, 0.9);
    z-index: 99;
}
#nav {
    position: absolute;
    display: flex;
    width: 100%;
    height: 30px;
    bottom: 0px;
    cursor: grab;
    justify-content: center;
    mix-blend-mode: difference;
    color: rgba(255, 255, 255, 0.9);
    z-index: 100;
}
#nav.buttonStyle {
    cursor: pointer;
    mix-blend-mode: unset;
}
#nav:not(.buttonStyle)::after {
    content: "";
    position: absolute;
    bottom: 3px;
    width: 100px;
    height: 3px;
    border-radius: 3px;
    transition: translate 0.4s;
    background: currentColor;
}
#nav:not(.buttonStyle):active::after {
    transition: translate 0.15s;
    translate: 0 -10px;
}
#nav:active {
    cursor: grabbing;
}

#nav.buttonStyle .buttonStyle {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: var(--nav-buttonStyleSize);
    transition: background calc(0.2s * var(--bg-speedAnimation));
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.phone:has(#nav.buttonStyle):has(.app.open) #nav.buttonStyle .buttonStyle {
    transition: background calc(0.4s * var(--bg-speedAnimation)) calc(0.3s * var(--bg-speedAnimation));
    background: color-mix(in srgb, var(--bg-itemBackground) 40%, transparent);
}
#nav .buttonStyle button {
    display: none;
}
#nav.buttonStyle .buttonStyle button {
    all: unset;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 70px;
    border-radius: 70px;
    transition: background 0.4s;
}
#nav.buttonStyle .buttonStyle svg {
    display: block;
    height: 50%;
    fill: color-mix(in srgb, var(--bg-color) 50%, transparent);
}

#nav.buttonStyle .buttonStyle button:active {
    transition: background 0.1s;
    background: color-mix(in srgb, var(--bg-color) 30%, transparent);
}

.phonePreview {
    width: calc(1px * var(--bg-widthPhone));
    height: calc(1px * var(--bg-heightPhone));
    border-radius: var(--bg-borderRadiusPhone);
    background: #000;
    overflow: hidden;
    flex-direction: column;
    align-items: center;
}

.phonePreview.small {
    width: calc(0.4px * var(--bg-widthPhone));
    height: calc(0.4px * var(--bg-heightPhone));
    border-radius: calc(var(--bg-borderRadiusPhone) * 0.4);
}

.phonePreview.smaller {
    width: calc(0.25px * var(--bg-widthPhone));
    height: calc(0.25px * var(--bg-heightPhone));
    border-radius: calc(var(--bg-borderRadiusPhone) * 0.25);
}
.phonePreview.smaller4x3 {
    width: calc(0.3px * var(--bg-widthPhone));
    height: calc(0.21px * var(--bg-heightPhone));
    border-radius: calc(var(--bg-borderRadiusPhone) * 0.2);
}

.phone:not(.devModOn) [data-hiddenByDev="1"] {
    display: none;
}
