@media (width < 960px) {
    html:has(#menu-btn:checked) {
        overflow: hidden !important;
    }
}
@media (960px <= width) {
    header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: calc(4.2em + 1px);
        background: var(--bgColor);
        border-bottom: 1px solid var(--pColor);
        z-index: 114514;
    }
}

header {
    box-sizing: border-box;
    transition: 0.25s;
    @media (width < 960px) {
        #theme-toggle {
            color: var(--pColor);
            background-color: var(--bgColor);
            border: 1.5px solid var(--pColor);
            width: calc(100vw - 110px);
            height: 2.5em;
            margin: 10px 0 10px 75px;
            z-index: 114514;
        }
    }
    @media (960px <= width) {
        #theme-toggle {
            position: absolute;
            top: 0.8em;
            right: 30px;
            height: 3.6em;
            width: 5em;
        }
    }

    /* custom header color */
    .ColorTagDefault,
    .ColorTagDefault .number {
        border-color: #38b6ff;
    }
    .ColorTagYellow,
    .ColorTagYellow .number {
        border-color: #fac014;
    }
    .ColorTagSky,
    .ColorTagSky .number {
        border-color: #38b6ff;
    }
    .ColorTagBlue,
    .ColorTagBlue .number {
        border-color: #031491;
    }
    .container {
        &:hover,
        &:active {
            background: var(--pColor);
            span {
                color: var(--bgColor);
            }
        }
    }

    @media (width < 960px) {
        .header-sp {
            display: flex;
            position: fixed;
            z-index: 10;
            top: 0;
            left: 0;
            justify-content: space-between;
            align-items: center;
            width: 100dvw;
            height: 60px;
            margin: 0 auto;
            background: var(--bgColor);
        }
        .menu-sp {
            display: flex;
            justify-content: left;
            align-items: center;
            height: 60px;
        }
        .menuList-sp {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0;
            margin: 0;
        }
        .menuItem-sp {
            list-style: none;
        }
        .menuLink-sp {
            display: block;
            height: 100%;
            background-color: var(--mainBlueColor);
            text-decoration: none;
            color: white;
            font-size: 19px;
            padding: 10px;
            border-radius: 10px;
            margin-left: 1.5dvw;
            box-shadow: 0 0 4px var(--shadowColor);

            &:hover {
                background-color: #000000;
            }
        }
        .empty {
            width: 60px;
            height: 60px;
            margin-left: 2dvw;
        }
        .logo {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 60px;
            line-height: 60px;
            text-align: center;
            font-size: 20px;
            background: var(--bgThinColor);
        }
        .menu {
            background-color: #999999dd;
            position: fixed;
            top: 0;
            right: -100%;
            width: 100%;
            padding-top: 60px;
            height: 100dvh;
            overflow-y: auto;
            transition: 0.6s ease;
            z-index: 810;
            #menu-btn:checked ~ & {
                right: 0;
            }
        }
        .container {
            background: var(--bgColor);
            border: 1.5px solid var(--pColor);
            width: calc(100vw - 110px);
            height: 5.2em;
            margin: 10px 0 10px 75px;
            display: flex;
            color: inherit;
            text-decoration: none;
            z-index: 114514;
        }
        .number {
            width: 25%;
            margin-top: 0.2em;
            height: 1.3em;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 300%;
            border-right: 0.2em solid;
            padding-left: 0.15em;
        }
        .content {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            padding-left: 5%;
        }
        .upper {
            display: flex;
            font-size: 140%;
            margin-top: 0.3em;
        }
        .lower {
            display: flex;
            font-size: 80%;
        }
        label.menu-btn {
            background-color: #bbb;
            position: fixed;
            top: 0;
            right: 0;
            left: auto;
            z-index: 999;
            width: 60px;
            height: 60px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            span:not(:nth-child(4)) {
                width: 30px;
                height: 3px;
                margin: 4px 0;
                background-color: #000;
                display: block;
                transition: 0.3s ease;
                transform-origin: center center;
            }
            #menu-btn:checked ~ & span:not(:nth-child(4)) {
                &:nth-child(1) {
                    transform: rotate(45deg) translate(8px, 8px);
                }
                &:nth-child(2) {
                    opacity: 0;
                }
                &:nth-child(3) {
                    transform: rotate(-45deg) translate(8px, -7px);
                }
            }
            span:nth-child(4) {
                color: #000 !important;
                font-size: 0.8em;
                margin-top: 0px;
                &::before {
                    content: "MENU";
                }
            }
            #menu-btn:checked ~ & span:nth-child(4) {
                &::before {
                    content: "CLOSE";
                }
            }
        }
    }

    @media (960px <= width) {
        .header-sp {
            display: none;
        }
        .logo {
            width: 80px;
            padding-top: calc(calc(4.2rem - 60px) / 2);
            transform: scale(1.2);
            height: 4.2rem;
            line-height: 4.2rem;
            text-align: center;
            margin-right: 1em;
        }
        label.menu-btn {
            display: none;
        }
        div.menu {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 4.2em;
            display: flex;
            z-index: 99;
            padding-left: 1vw;
        }

        .container {
            display: flex;
            flex-direction: column;
            text-align: left;
            margin: 0.3em 0.3em 0 0;
            padding: 0 0.3em 0 0.4em;
            text-decoration: none;
            color: inherit;
            background: var(--bgColor);
            height: 3.6em;
            border-left-width: 0.6em;
            border-left-style: solid;
        }
        .number {
            display: none;
        }
        .upper {
            display: flex;
            font-weight: bold;
            font-size: 100%;
        }
        .lower {
            display: flex;
            font-size: 80%;
        }
    }
}