:root {
    --subview-plane-size: 60px;
}

.count {
    font-size: 1.4em;
}

.reset {
    font-size: 1.2em;
}

.subview-container {
    display: flex;
    width: fit-content;
    margin: 0 0 10px auto;

    .subview-size {
        display: flex;
        flex-direction: column;
        margin-left: 6px;
        height: fit-content;
        padding: 2px 4px;
        border: 2px dashed #CCC;
        border-radius: 12px;

        .subview-size-label {
            margin-inline-start: 3px;
            font-size: 1.5em;
        }

        input[type="range"] {
            writing-mode: vertical-lr;
            transform: rotate(180deg);
            height: 100px;
        }
    }

    #subview {
        display: flex;
        flex-direction: column;
        width: fit-content;
        border: 3px dotted #DDD;
        border-radius: 24px;

        .subview-row {
            display: flex;
            justify-content: center;

            .subview-plane {
                position: relative;
                display: flex;
                flex-direction: column;
                border: 2px solid #888;
                /* height, widthは可変 */
                height: var(--subview-plane-size);
                width: var(--subview-plane-size);

                .subview-plane-row {
                    flex: 1;
                    display: flex;

                    .subview-voxel {
                        flex: 1;
                        border: 1px solid #CCC;
                        background-color: #F00;
                        /* もしこの色が表示されたらエラー 使わないvoxelの場合は.noneを使うこと */
                    }

                    .subview-voxel.on {
                        background-color: #FC0;
                    }

                    .subview-voxel.off {
                        background-color: #EEE;
                    }

                    .subview-voxel.none {
                        background: #666;
                    }
                }
            }

            .subview-plane:hover {
                opacity: 0.8;
            }

            .subview-plane:active {
                opacity: 0.6;
            }

            /* バツ印 */
            #subview-centroid-unavailable {
                display: none;
                /* 通常は表示しない */
                position: absolute;
                top: 0;
                left: 0;
                height: 100%;
                width: 100%;
            }

            #subview-centroid-unavailable::before,
            #subview-centroid-unavailable::after {
                content: "";
                position: absolute;
                display: block;
                top: 50%;
                left: 50%;
                width: 141.421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764%;
                height: 2px;
                background-color: #A66;
                transform: translate(-50%, -50%) rotate(45deg);
            }

            #subview-centroid-unavailable::after {
                transform: translate(-50%, -50%) rotate(-45deg);
            }

            .subview-arc-top-left {
                position: relative;
                /* height, widthは可変 */
                height: var(--subview-plane-size);
                width: var(--subview-plane-size);

                [class^="arc"] {
                    position: absolute;
                    bottom: 0;
                    right: 0;
                    border-top: 2px dotted #BBB;
                    border-left: 2px dotted #BBB;
                    border-radius: 100% 0 0 0;
                }

                .arc1 {
                    height: 16.67%;
                    width: 16.67%;
                }

                .arc2 {
                    height: 50%;
                    width: 50%;
                }

                .arc3 {
                    height: 83.33%;
                    width: 83.33%;
                }
            }

            .subview-arc-top-right {
                position: relative;
                /* height, widthは可変 */
                height: var(--subview-plane-size);
                width: var(--subview-plane-size);

                [class^="arc"] {
                    position: absolute;
                    bottom: 0;
                    left: 0;
                    border-top: 2px dotted #BBB;
                    border-right: 2px dotted #BBB;
                    border-radius: 0 100% 0 0;
                }

                .arc1 {
                    height: 16.67%;
                    width: 16.67%;
                }

                .arc2 {
                    height: 50%;
                    width: 50%;
                }

                .arc3 {
                    height: 83.33%;
                    width: 83.33%;
                }
            }

            .subview-arc-bottom-left {
                position: relative;
                /* height, widthは可変 */
                height: var(--subview-plane-size);
                width: var(--subview-plane-size);

                [class^="arc"] {
                    position: absolute;
                    top: 0;
                    right: 0;
                    border-bottom: 2px dotted #BBB;
                    border-left: 2px dotted #BBB;
                    border-radius: 0 0 0 100%;
                }

                .arc1 {
                    height: 16.67%;
                    width: 16.67%;
                }

                .arc2 {
                    height: 50%;
                    width: 50%;
                }

                .arc3 {
                    height: 83.33%;
                    width: 83.33%;
                }
            }

            .subview-arc-bottom-right {
                position: relative;
                /* height, widthは可変 */
                height: var(--subview-plane-size);
                width: var(--subview-plane-size);

                [class^="arc"] {
                    position: absolute;
                    top: 0;
                    left: 0;
                    border-bottom: 2px dotted #BBB;
                    border-right: 2px dotted #BBB;
                    border-radius: 0 0 100% 0;
                }

                .arc1 {
                    height: 16.67%;
                    width: 16.67%;
                }

                .arc2 {
                    height: 50%;
                    width: 50%;
                }

                .arc3 {
                    height: 83.33%;
                    width: 83.33%;
                }
            }
        }
    }
}

.move-button {
    position: relative;
    display: block;
    background-color: #fff;
    border: 5px solid #666;
}

.move-button:hover {
    opacity: 0.5;
}

.move-button:active {
    opacity: 0.3;
}

.move-button.button-ver {
    height: 9vw;
    /* 12vw * 0.75 */
    max-height: 75px;
    /* 100 * 0.75 */
    width: calc(36vw + 10px);
    /* 12vw*0.75*3 + 10px */
    max-width: 310px;
    /* 100*3 + 10 */
    margin: 0 auto;
}

.move-button.button-hor {
    height: calc(36vw + 10px);
    /* 12vw*0.75*3 + 10px */
    max-height: 310px;
    /* 100*3 + 10 */
    width: 9vw;
    /* 12vw * 0.75 */
    max-width: 75px;
    /* 100 * 0.75 */
}

.move-button .triangle-arrow {
    position: absolute;
    background-color: #666;
    width: 100%;
    height: 100%;
}

.move-button .triangle-arrow-in {
    position: absolute;
    background-color: #DDD;
    width: 100%;
    height: 100%;
}

#button-top {
    .triangle-arrow {
        clip-path: polygon(50% 100%, 0 0, 100% 0);
    }

    .triangle-arrow-in {
        clip-path: polygon(50% 90%, 5% 0, 95% 0);
    }
}

#button-right {
    .triangle-arrow {
        clip-path: polygon(0 50%, 100% 0, 100% 100%);
    }

    .triangle-arrow-in {
        clip-path: polygon(10% 50%, 100% 5%, 100% 95%);
    }
}

#button-bottom {
    .triangle-arrow {
        clip-path: polygon(50% 0, 100% 100%, 0 100%);
    }

    .triangle-arrow-in {
        clip-path: polygon(50% 10%, 95% 100%, 5% 100%);
    }
}

#button-left {
    .triangle-arrow {
        clip-path: polygon(100% 50%, 0 100%, 0 0);
    }

    .triangle-arrow-in {
        clip-path: polygon(90% 50%, 0 95%, 0 5%);
    }
}

.puzzle-container {
    display: flex;
    width: fit-content;
    margin: 0 auto;
}

#puzzle {
    display: flex;
    flex-direction: column;
    width: fit-content;
    border: 5px solid #666;

    .puzzle-row {
        display: flex;

        .puzzle-voxel {
            height: 12vw;
            max-height: 100px;
            width: 12vw;
            max-width: 100px;
            border: 5px solid #888;
            background-color: #F00;
            /* もしこの色が表示されたらエラー*/
        }

        .puzzle-voxel:hover {
            opacity: 0.7;
        }

        .puzzle-voxel:active {
            opacity: 0.3;
        }

        .puzzle-voxel.on {
            background-color: #FC0;
        }

        .puzzle-voxel.off {
            background-color: #EEE;
        }
    }
}

@keyframes fade-in {
    from {
        opacity: 0.0;
    }

    to {
        opacity: 1.0;
    }
}

@keyframes scale-up {
    from {
        transform: scale(0.9);
    }

    to {
        transform: scale(1.0);
    }
}

#clear-dialog {
    border-radius: 18px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    opacity: 0.0;

    .dialog-close {
        position: absolute;
        display: block;
        top: 20px;
        right: 20px;
        appearance: none;
        height: 30px;
        width: 30px;
        border: 1px solid #888;
        background-color: #FFF;
    }

    .dialog-close::before,
    .dialog-close::after {
        content: "";
        position: absolute;
        display: block;
        top: 50%;
        left: 50%;
        width: 141.4%;
        height: 3px;
        background-color: #777;
        transform: translate(-50%, -50%) rotate(45deg);
    }

    .dialog-close::after {
        transform: translate(-50%, -50%) rotate(-45deg);
    }

    h2 {
        text-shadow: 2px 2px #FF0;
        text-align: center;
        font-size: 3em;
    }

    p {
        text-align: center;
    }

    #dialog-clear-mode {
        font-size: 1.05em;
        font-style: italic;
    }

    #dialog-special-message {
        color: #F00;
    }

    .buttons {
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        gap: 16px;
        margin: 16px 0;
        max-width: 400px;

        .a-button {
            flex: 1;
            display: block;
            border: 2px solid #222;
            border-radius: 12px;
            background-color: #FFF0D0;
            color: #000;
            font-size: 1.1em;
            text-decoration: none;
            text-align: center;
            padding: 10px;
            white-space: nowrap;
        }
    }
}

#clear-dialog[open] {
    animation: fade-in forwards 600ms ease-out 400ms, scale-up forwards 1000ms ease-out 500ms;
}

#clear-dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

#clear-dialog[open]::backdrop {
    animation-name: fade-in;
    animation-fill-mode: forwards;
    animation-duration: 200ms;
    animation-timing-function: ease-out;
}